The "done" gate
An agent does not finish work while its edits leave new red checks; red at the start of a session is not its fault. Claude Code hooks for the start and the end of work.
The "done" gate
The idea comes from the harness (the cards "Report gate" and "Acceptance and checks"): a task is done only when its checks are green and the gate let the report through. Here is the minimal working part without the harness core, on Claude Code hooks.
- Session start (
baseline). The hook runs all project checks (the same asshtuk check) and remembers the red findings of this session in.shtukbase/state/gate/<session>.json. The agent sees their list: they were there before it. - End of work (
stop). Before the agent ends its turn, the hook runs the checks again. If there are findings that were not there at the start, the agent goes back to work and reads which ones. The findings from the start do not hold it. - Return counter. After three returns in a session the gate lets the agent go and asks it to name the remaining red in its report. This way a check the agent cannot fix does not spin the session endlessly.
Norms:
- FIN-R01: an agent does not finish work with new red checks. The enforcer is the hook
stop. - FIN-R02: red at the start of a session is not charged to the agent; it is mentioned at the start. The enforcer is the hook
baseline.
Boundary: a finding is compared by the text of its line. If the text of an old finding changed, it counts as new. The harness chain of stages, the environment classifier and the task criteria are not here. The package hooks is required. It is worth keeping the folder .shtukbase/state/ out of git.