Discussion about this post

User's avatar
Foundation's Edge's avatar

A PreToolUse guard stops one action; the failure class that slips past guards is the finished-but-wrong changeset. A Stop gate is built for exactly that: validation runs on the total diff at the moment the working tree forms a coherent changeset, and exit 2 keeps the agent working while it still holds the context to repair. The fact that onFailure does nothing on Stop and SubagentStop hints at why; those boundaries are commit points with their own semantics, and the transaction view of a turn is what the Agents Don't Equate to Agency series maps in full. https://seldondance.substack.com/p/agents-dont-equate-to-agency

Andrii Tretiak's avatar

Good that you mentioned PreCompact also fires on idle compaction, I didn't know that. I checked my own sessions with a small script and found two idle compactions from October 9, so it was already working before 2.1.299. And both were marked as "auto", so they look like a normal compaction near the limit. If you want to check yours, look for compact_boundary lines where the line before is about an hour older. I wrote a post about what gets lost and what I do instead: https://swarmery.substack.com/p/claude-code-started-compacting-my

Ready for more?