Component: ralph loop state handling
Symptom
When the stop hook trips, .claude/prp-ralph.state.md is removed outright.
After one false trip (see the companion issue on substring matching of the completion tag) the file was gone from both the primary checkout and the worktree. The only surviving record was a separately-triggered paused snapshot under ralph-archives/ — a different, older artifact, not the live ledger.
Impact
The C2 progress ledger is the loop's entire audit trail, and it is the input to the C3 stall rule. Deleting it on trip destroys the record of what the run actually did, and there is no recovery path.
Why this is filed separately
It is arguably the blast radius of the substring-matching bug rather than an independent defect. Filing separately because the fixes are independent: even with the matching bug fixed, a legitimate stop should archive the ledger rather than unlink it. A completed run's ledger is the most useful thing it produces.
Suggested fix
Archive the state file into ralph-archives/ on every terminal transition instead of deleting it. The pause path already does something very close to this — reusing it on trip and on completion would close the gap.
Component: ralph loop state handling
Symptom
When the stop hook trips,
.claude/prp-ralph.state.mdis removed outright.After one false trip (see the companion issue on substring matching of the completion tag) the file was gone from both the primary checkout and the worktree. The only surviving record was a separately-triggered paused snapshot under
ralph-archives/— a different, older artifact, not the live ledger.Impact
The C2 progress ledger is the loop's entire audit trail, and it is the input to the C3 stall rule. Deleting it on trip destroys the record of what the run actually did, and there is no recovery path.
Why this is filed separately
It is arguably the blast radius of the substring-matching bug rather than an independent defect. Filing separately because the fixes are independent: even with the matching bug fixed, a legitimate stop should archive the ledger rather than unlink it. A completed run's ledger is the most useful thing it produces.
Suggested fix
Archive the state file into
ralph-archives/on every terminal transition instead of deleting it. The pause path already does something very close to this — reusing it on trip and on completion would close the gap.