Repository navigation
Description
Split out of #125. v0.8.5 fixed the fork storm (post-tool-hook.sh now consults the last-save-ts cooldown marker before forking), but that is the symptom. The cause #125 and @VictorVvdl's comment both identify is still live, and it is the one that actually costs users their memory.
The invariant that's wrong
scripts/save-session.sh writes the cooldown marker at :128, before the gates:
:126 extract
:128 date +%s > "$COOLDOWN_MARKER" # throttle signal — always written
:131 [ "$EXCHANGE_COUNT" -eq 0 ] && exit 0
:133 [ "$HUMAN_COUNT" -lt "$MIN_HUMAN" ] && exit 0
...
:200 save-position # only reached on success
:208 save-position
Every early exit and every failure (the min_human gate, EXCHANGE_COUNT == 0, a Haiku error, any set -e/ERR abort) sits upstream of both save-position calls. So the saved position never advances, LAST_LINE stays at its old value, and the next run re-extracts the same span and dies the same way — once per cooldown window, forever.
Consequences, both confirmed in the wild:
- Agentic sessions never save at all. Many tool calls, few human turns → the
min_humangate trips on every run → memory is never written, with no error output. This is post-tool-hook forks save-session.sh on every tool call until the first successful save #125's stated top-priority impact and v0.8.5 does not change it. - A single oversized session can wedge saving for a month. @VictorVvdl reached the identical loop via the save-session: no cap on extract size → oversized Haiku prompt exceeds context window → silent rotation stop (complements #94) #96 Haiku-overflow path (2026-06-22 → 2026-07-22, macOS): a 57 MB transcript extracted to ~1.8M tokens, Haiku failed, the position was never written, and every subsequent save re-extracted the whole thing and failed identically. The save-session: no cap on extract size → oversized Haiku prompt exceeds context window → silent rotation stop (complements #94) #96 extract cap would have broken the loop — but Claude Code snapshots plugin hooks at session start, so the long-lived session kept running the uncapped 0.7.3 hook off disk while 0.8.3 was already installed. Position advancement is the only thing that self-heals a session in place.
Direction
Advance the read position as soon as extraction succeeds, independently of whether Haiku runs or any gate trips. A no-work session, an under-threshold session, and a failed summarization should all leave the cursor where the transcript actually ends — the throttle signal and the write that clears it must not sit on opposite sides of an early exit.
Care needed on: a genuinely unsummarized span must not be silently lost when the next session does have enough human turns (either carry the span forward, or accept it — decide explicitly and document it), and the IS_SKIP / malformed-entry drop paths from #119 must keep advancing too.
Recovery for anyone stuck today
@VictorVvdl's workaround — bootstrap the position manually so extraction becomes incremental again:
SID=<your-stuck-session-uuid>
JSONL=~/.claude/projects/<slug>/$SID.jsonl
python3 -c "import json; json.dump({'session':'$SID','line':$(wc -l < \"$JSONL\")}, open('$HOME/.remember/tmp/last-save.json','w'))"Acceptance
- Position advances after a successful extract, regardless of gate/summarizer outcome
- Regression test: a session with
HUMAN_COUNT < min_humanrun twice does not re-extract the same span the second time - Regression test: a failing Haiku call still advances the position (no re-extract loop)
-
--dry-runstill does not advance the position
Reported originally by @KyleUnlock, with the month-long macOS repro and root-cause generalization from @VictorVvdl.
Activity
fix: don't advance on --dry; give up on a span after repeated summary…
fix: stop agentic sessions from silently never saving (Digital-Proces…
fix: quarantine, not lose, a span behind an unrecognised-envelope save (