Repository navigation
feat(stow-guard): the token-line ask asks for a quick save, the daily ask keeps the full pass - #297
Conversation
… ask keeps the full pass The context ask now asks for /stow quick, which runs only the knowledge sweep and open-record persistence. The age ask still asks for the full pass, and a stow Skill call whose first argument word is quick does not move last_stow, so the full pass still comes due once a day.
…et-checks every new one
…ts row or receipt
| fired=$(jq -c --arg sid "$sid" '.[$sid] = true' <<<"$fired") || exit 0 | ||
| elif [ "$saves_readable" -eq 1 ] && [ -z "$last_stow" ]; then | ||
| last_stow=$now | ||
| elif [ "$saves_readable" -eq 1 ] && [ $((now - last_stow)) -ge "$max_age" ] && [ $((now - asked)) -ge 3600 ]; then |
There was a problem hiding this comment.
The age ask can still ask for a full pass while the session is above the token line. This PR set out to stop exactly that, and the case is wider than the 'both due at one stop' limit the PR accepts. Example: the context ask fires at hour 23 since the last full pass, and the quick save no longer moves last_stow. At hour 24 the age branch fires (the context branch is skipped because fired[sid] is already true) and asks for a full pass, even though tokens are still at or above the threshold. Fix: skip or defer the age ask while tokens >= threshold (or while fired[sid] is true), so it waits until the context has dropped below the line.
Failure scenario: tokens=240000, last full stow 23h ago. Stop A has 250K tokens, so the context ask asks for /stow quick, which runs and leaves last_stow unchanged. The helm keeps working for 61 more minutes at 260-290K. Stop B finds now-last_stow >= 24h and now-asked >= 3600, so it blocks with 'Run the /stow skill now (full pass, no argument)'. The full pass then starts about 10-50K tokens before compaction, and compaction hits mid-pass. That is the failure cited in the decision record.
|
Failure scenario: restart=1. The captain types |
|
Re the The age-ask finding (important) is fixed in 37007e0: the age ask now waits while the context is at or above the token line, and |
|
Code review: Claude Code |
Summary
At its token line, the stow guard now asks for a short save (
/stow quick), not a full/stow.The daily age ask still asks for the full pass.
Arjun approved this in the helm on 2026-11-22.
Evidence from that day: the guard asks at
tokens=240000, compaction is near 300K, and a full pass did not fit in the gap. Compaction hit in the middle of the pass, and the helm had to re-read its 69KB startup digest to finish.The clock rule (brief item 3): a quick save does not move
last_stowinstate/.stow-guard.json, so the 24-hour full pass still comes due after quick saves.The guard tells the two apart by the
Skillcall'sinput.args, the field Claude Code writes when a skill gets args. A live transcript shows{"skill":"tstack-sol-loop","args":"..."}, and the skill body receives it asARGUMENTS: ....A mis-invoked save (args like
quickly) counts as a full pass. That can delay the age ask, but it never makes the clock look older than it is.These are unchanged: the once-per-crossing state,
asked, offer handling,restart=1, and the rule that a guard ask never offers a restart.A
/stow quickthe captain types still records an offer, as before. The quick save never says reset-safe, so it never asks him to start fresh.The age ask now also waits while the context reading is at or above the token line. The merge-gate review found this case: quick saves no longer reset the clock, so without the wait, the daily ask could ask for a full pass in the same gap before compaction. When both asks are due at one stop, the context ask wins. The age ask then waits at least an hour, and until the context drops below the line. A test pins this.
The decision record is
docs/fork-decisions/2026-11-22-stow-guard-quick-save.md, not a line indocs/fork-decisions.md. The repo keeps one record per file, andbin/fm-fork-decisions.sh checkrejects records added to the index page.Evidence
restart=1saidRun the /stow skill now (full pass). Every stow Skill call movedlast_stow.The updated suite, run against the
mainguard, fails as expected:tests/fm-stow-guard.test.shpasses 18 of 18. The three new tests cover:test_each_ask_names_its_pass: the context ask names/stow quickand not the full pass; the age ask names the full pass and not quick.test_quick_save_does_not_move_the_full_pass_clock:last_stowon the full pass;Quick,quick\t...,QUICK) still gets the age ask a day later;quickly pleasecounts as a full pass;test_both_asks_due_asks_quick_then_full_below_the_line: the age ask stays silent an hour later while the context is over the line, and asks for the full pass once it drops below.bin/fm-test-run.sh --near: total=3 failed=0 skipped_gate=1 (the opt-in live prompt guard).bin/fm-lint.sh bin/fm-stow-guard.sh tests/fm-stow-guard.test.sh,bin/fm-fork-decisions.sh check,bin/fm-fork-decisions.sh pr-check --base origin/main(upstream-owned=4 records=1) andbin/fm-doc-audience-check.sh: all ok.Merge Danger
Door: two-way
A revert restores the old message and clock rule. The state file format is unchanged, so no stored state needs migration.
Blast Radius: stow-guard
It reaches only homes with
config/stow-guard, and only Claude primaries. After an upgrade, the first age ask may come earlier than a home expects, because quick saves no longer reset the clock.Reviewed with sol-loop: 3 rounds with gpt-6.2-sol. Sol verdict: approved