Skip to content

A worktree with a live battery is read-only: PreToolUse guard hook; verdict.w reads logs - #2345

Merged
ehartford merged 3 commits into
mainfrom
battery-guard
Oct 11, 2026
Merged

ehartford merged 3 commits into
mainfrom
battery-guard

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Controls, not notes (Eric, 2026-10-10). The hook refuses edits, builds, kills and tree-changing git in a worktree whose battery is alive, and refuses reading gate/battery logs by eye; with run tools/verdict.w <log> is the one reader. 13 guard cases pass against a live battery. Rides the next stack's battery.

Eric Hartford added 2 commits October 11, 2026 07:43
…es it; verdict.w reads logs

Eric, 2026-10-10: "You will do nothing differently, unless you force
yourself to by writing gates and controls into triggers and tools."
Today an edit under a running battery produced a false red, a battery
was stopped mid-survey (so the next one rediscovered the reds one at a
time), and a gate log read by eye started a battery into the gate's
lock. A memory note already forbade the first; it did not hold.

tools/hooks/battery_guard.w (PreToolUse on Edit/Write/Bash, wired in
.claude/settings.json) reads the battery slot registry and refuses, in a
worktree whose battery is alive: an edit; a build run there; a kill of
its pid or a pkill naming it; tree-changing git run there; mv/rm/cp of
or a redirect into its files. It also refuses grep/tail/cat/head of a
gate, build or battery log: `with run tools/verdict.w <log>...` prints
`rc=N green|RED <targets>` or OPEN while the log is still being
written, and its exit code is the verdict. guard_cases.w runs the
thirteen cases in guard_cases.tsv against a live battery (13 agree).
…only the uat step

A battery started inside a maintenance wake on 2026-10-11 ran 45 s per
16 min for three hours: the gate and the survey held no sleep lock, so an
idle Mac slept through them.
@ehartford

Copy link
Copy Markdown
Contributor Author

Rebased onto main after #2342. Adds: every battery phase holds the machine awake (caffeinate -i -s), after a battery started in a maintenance wake ran 45 s per 16 min for three hours on 2026-10-11. The verdict tool gains --progress, --detail <target> and --times in the next commit.

…ime; --detail prints a red target's failure block; --times the wall lines

A gate that ran three hours for fifteen minutes of steps was reported as
unexplained because the tool only printed reds; the log had the answer.
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery green on stack #2347 top 43f4ffdfe (len-sweep, 2026-10-11, seed-driven with run tools/battery.w: gate, uat, battery-checks all green; out/battery/status.txt: green). Battery 1 on d695b0e was red on internals-tests only, fixed in 43f4ffd.

@ehartford
ehartford marked this pull request as ready for review October 11, 2026 17:58
@ehartford
ehartford merged commit bb62ee0 into main Oct 11, 2026
@ehartford
ehartford deleted the battery-guard branch October 11, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant