Summary
Add full session state serialization and crash recovery to the LoopOrchestrator runtime (#69), replacing the current fragile /tmp file-based status tracking.
Problem / Context
Currently, loop state is tracked via multiple /tmp/ralph-loop-<feature>.* files (status, tokens, phases, baseline, log). If Wiggum crashes or the terminal closes, recovery is limited to what the --resume flag can reconstruct from these temp files.
Competitors have full session persistence with resume that restores complete state, session locking to prevent concurrent runs, and cross-project session registries. As we build the LoopOrchestrator (#69), session persistence should be a first-class concern — not bolted on after.
Roadmap phase: Phase 2 — CONTROL ("Wiggum owns the full process lifecycle")
Proposed Solution
- Persist full orchestrator state to
.ralph/sessions/<feature>.json (not /tmp)
- Include: current phase, iteration count, task progress, token usage, git baseline, timestamps, agent config
- Implement session locking (prevent two loops on same feature)
wiggum resume <feature> restores full state and resumes from exact point of interruption
- Clean up
/tmp files on graceful exit; session file persists for crash recovery
- Consider a session registry in
~/.wiggum/sessions.json for cross-project tracking
Files to Modify
| File |
Changes |
src/session/ (new) |
Session manager, serialization, locking |
src/commands/run.ts |
Integrate session lifecycle with loop execution |
src/tui/screens/RunScreen.tsx |
Display session recovery state |
Acceptance Criteria
Summary
Add full session state serialization and crash recovery to the LoopOrchestrator runtime (#69), replacing the current fragile
/tmpfile-based status tracking.Problem / Context
Currently, loop state is tracked via multiple
/tmp/ralph-loop-<feature>.*files (status, tokens, phases, baseline, log). If Wiggum crashes or the terminal closes, recovery is limited to what the--resumeflag can reconstruct from these temp files.Competitors have full session persistence with
resumethat restores complete state, session locking to prevent concurrent runs, and cross-project session registries. As we build the LoopOrchestrator (#69), session persistence should be a first-class concern — not bolted on after.Roadmap phase: Phase 2 — CONTROL ("Wiggum owns the full process lifecycle")
Proposed Solution
.ralph/sessions/<feature>.json(not/tmp)wiggum resume <feature>restores full state and resumes from exact point of interruption/tmpfiles on graceful exit; session file persists for crash recovery~/.wiggum/sessions.jsonfor cross-project trackingFiles to Modify
src/session/(new)src/commands/run.tssrc/tui/screens/RunScreen.tsxAcceptance Criteria
.ralph/sessions/on every phase transition and iteration boundarywiggum resume <feature>restores full state and continues loop