How jergensturdley/9rh works
9rh is a local-repository coding agent, entered through its CLI or REPL. The core workflow selects a backend, runs an agent turn using repository tools, and records observed changes and outcomes as receipts and reports. Optional branches add team orchestration, spec framing, repair, rewind, and replay. The desktop app presents sessions and these run artifacts alongside a separate 9router console. Some links reflect README descriptions or import references in the SOURCE INDEX; unsampled desktop and runtime internals limit finer-grained control-flow claims.
Main entry points: agent.ts Coding agent · index.ts CLI and REPL · replayEngine.ts Replay engine · App.tsx Desktop shell
Components 29
Entry and configuration
- CLI and REPL
src/index.ts - Configuration
src/config.ts - Backend selection
src/backends/index.ts - Terminal interface
src/tui.ts
Agent runtime
- Coding agent
src/agent.ts - Reasoning
src/reasoner/reasoner.ts - Input compression
src/inputCompression.ts - Skills
src/skills.ts
Execution and safety
- Repository tools
src/tools.ts - Sandbox execution
src/sandbox/sandboxer.ts
Coordination and recovery
- Team pipeline
src/orchestrator/orchestrator.ts - Team roles
src/orchestrator/roles.ts - Spec-driven testing
src/spec/specDrivenTesting.ts - Repair and snapshots
src/repair/snapshotManager.ts - Turn rewind
src/rewind.ts
Run records
- Replay engine
src/replay/replayEngine.ts - Flight recorder
src/flightRecorder.ts - Session ledger
src/ledger.ts - Run reports
src/reports/runReport.ts - Run visualization
src/visualization.ts
Desktop workbench
- Desktop shell
desktop/src/renderer/app/App.tsx - Agent sessions
desktop/src/renderer/pages/AgentPage.tsx - Replay viewer
desktop/src/renderer/pages/ReplaysPage.tsx - Router console
desktop/src/renderer/pages/RouterPage.tsx - Router client
desktop/src/main/routerClient.ts - Router updates
desktop/src/main/routerUpdate.ts
Other components
- User
- 9router
- LLM endpoint
Connections 34
- User → CLI and REPL: submits task
README.md - CLI and REPL → Backend selection: selects backend
src/index.ts - CLI and REPL → Coding agent: starts run
src/index.ts - CLI and REPL → Configuration: reads settings
src/index.ts - CLI and REPL → Team pipeline: dispatches team task
src/index.ts - CLI and REPL → Terminal interface: renders interaction
src/index.ts - Backend selection → 9router: connects optionally
README.md - Backend selection → LLM endpoint: selects provider
README.md - Coding agent → LLM endpoint: requests completions
src/agent.ts - Coding agent → Repository tools: executes tools
src/agent.ts - Coding agent → Reasoning: uses reasoning
src/agent.ts - Coding agent → Input compression: compresses input
src/agent.ts - Coding agent → Skills: loads skills
src/agent.ts - Coding agent → Sandbox execution: uses sandbox
src/agent.ts - Coding agent → Spec-driven testing: frames tasks
src/agent.ts - Coding agent → Repair and snapshots: captures snapshots
src/agent.ts - Coding agent → Flight recorder: logs run events
src/agent.ts - Coding agent → Run reports: writes turn report
src/agent.ts - Coding agent → Session ledger: records receipts
README.md - Team pipeline → Team roles: runs role pipeline
src/orchestrator/orchestrator.ts - CLI and REPL → Turn rewind: offers rewind
src/index.ts - CLI and REPL → Replay engine: replays run
README.md - Flight recorder → Replay engine: supplies run log
src/flightRecorder.ts - Replay engine → Repository tools: re-executes tools
src/replay/replayEngine.ts - Replay engine → Repair and snapshots: restores snapshot
src/replay/replayEngine.ts - Desktop shell → Agent sessions: routes to page
desktop/src/renderer/app/App.tsx - Desktop shell → Replay viewer: routes to page
desktop/src/renderer/app/App.tsx - Desktop shell → Router console: routes to page
desktop/src/renderer/app/App.tsx - Agent sessions → Coding agent: hosts agent sessions
README.md - Replay viewer → Flight recorder: views recorded runs
README.md - Router console → Router client: uses router services
- Router updates → Router client: uses client
desktop/src/main/routerUpdate.ts - Router client → 9router: calls local service
README.md - Coding agent → Run visualization: emits visualization data
README.md