Skip to content

back to claude code cli + updating and improving#8

Merged
edgarpavlovsky merged 7 commits intomainfrom
claude/audit-ralph-comparison-K5LVu
Jan 22, 2026
Merged

back to claude code cli + updating and improving#8
edgarpavlovsky merged 7 commits intomainfrom
claude/audit-ralph-comparison-K5LVu

Conversation

@edgarpavlovsky
Copy link
Member

No description provided.

Compares frankbria/ralph-claude-code with Fireteam to identify:
- Where Fireteam excels (complexity routing, SDK integration, parallel reviews)
- Where Ralph excels (circuit breaker, rate limiting, session continuity)
- Actionable improvements to pull into Fireteam

Key findings:
- Fireteam has stronger architectural foundation
- Ralph has critical safety mechanisms we lack (circuit breaker, rate limiting)
- Recommended: implement circuit breaker and rate limiting as priority
Updated Ralph comparison audit to highlight that:
- Ralph piggybacks on Claude Code session (user's existing credits)
- Fireteam requires separate ANTHROPIC_API_KEY (separate billing)

This is now Priority 0 - foundational architectural change needed.
Users shouldn't need two billing sources to use Fireteam.

Added implementation approaches for fixing this gap.
Major architectural refactor to close the gaps identified in the
Ralph vs Fireteam audit:

1. **Claude Code Session Piggybacking** (Priority 0)
   - New claude_cli.py wraps `claude` CLI instead of SDK direct API
   - Uses --session-id and --resume for session continuity
   - Piggybacks on user's Claude Code session/credits
   - No separate ANTHROPIC_API_KEY required

2. **Circuit Breaker Pattern** (Priority 1)
   - New circuit_breaker.py with warn behavior
   - Tracks: files changed, repeated errors, output length decline
   - Three states: CLOSED → HALF_OPEN → OPEN
   - Issues warnings but doesn't halt (per user preference)

3. **Rate Limiting** (Priority 1)
   - New rate_limiter.py for API budget management
   - Configurable calls per hour (default: 100)
   - Wait-for-reset or raise exception options

4. **Dual-Gate Exit Detection** (Priority 2)
   - Executor can signal WORK_COMPLETE: false
   - Both reviewer pass AND executor signal required for completion
   - Respects Claude's judgment over automation assumptions

5. **Session Continuity** (Priority 3)
   - Leverages Claude Code's native --resume/--continue
   - CLISession tracks session_id across iterations
   - No custom persistence needed

Updated:
- loops.py: Uses CLI wrapper instead of SDK
- complexity.py: Uses CLI wrapper for estimation
- api.py: New parameters for rate limiting and circuit breaker
- __init__.py: Exports new modules
- All tests updated to mock CLI instead of SDK

All 92 tests pass.
Adds lean tmux integration for running Fireteam as an autonomous
agent until project completion:

New module: runner.py
- start_session(): Start autonomous execution in detached tmux
- attach_session(): Attach to running session
- kill_session(): Terminate a session
- list_sessions(): List all Fireteam sessions
- tail_log(): View recent log output

CLI entry point (fireteam command):
  fireteam start -p /path -g "goal"  # Start autonomous session
  fireteam list                       # List running sessions
  fireteam attach <name>              # Attach to session
  fireteam logs <name>                # View logs
  fireteam kill <name>                # Terminate session

Features:
- Sessions run in detached tmux, persist across terminal disconnects
- Logs saved to ~/.fireteam/logs/ for debugging
- Session state tracked in ~/.fireteam/<session>.json
- Auto-generated session names from project directory

No web UI - designed to eventually integrate with Pentagon for
more extensive UI capabilities.
- Add --goal-file and --edit flags to fireteam start/run commands
- Update runner to use resolve_prompt() for flexible prompt sources
- Export Prompt and resolve_prompt from __init__.py
- Add comprehensive tests for prompt parsing (32 tests)

Prompt sources (in priority order):
1. --goal "string" - explicit goal string
2. --goal-file path.md - markdown file with @file includes
3. Auto-detect PROMPT.md or .fireteam/prompt.md
4. --edit - open editor interactively
@edgarpavlovsky edgarpavlovsky merged commit 2fa8b36 into main Jan 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants