DEV Community

Cover image for After 5 commits without you, your agent has left the loop: the meta-hook idea
Michel Faure
Michel Faure

Posted on • Originally published at dev.to

After 5 commits without you, your agent has left the loop: the meta-hook idea

The night nine commits shipped without me

One evening in May I leave a session open on a side project, the kind you keep for weekends. The instruction is simple, the agent chains /goal after /goal. I have dinner, I put the children to bed, I fall asleep. Next morning I find nine clean autonomous commits, each anchored on a materially validated artifact, exactly as R15 has been demanding since v0.6. No work lost. No stall. And, the detail that stops me in the doorway with my coffee, no session log.

Nine commits, zero log

The /close-session skill never fired because its natural trigger never arrived: a human deciding the session is over and typing the command. I had not decided, I was asleep. /challenger was not invoked either, no bug having surfaced. Doctrinal discipline that night rested on nothing, since every invocation trigger assumed a hand on the keyboard, and there was none.

What R15 saved, what it did not see

R15 did its job. Commit each artifact as soon as it crosses its material oracle, do not batch. Nine artifacts, nine commits. If the session had stalled at the eighth, I would have found eight units of validated work, not one large patch lost in a silent crash.

But I see, re-reading the log, two distinct phenomena that needed two distinct rules. Work persistence belongs to commit cadence, since an agent that dies takes nothing to the grave. Reasoning drift belongs to a different mechanism, the one that catches an agent chaining five plausible decisions without any external voice reminding it to doubt. R15 knows how to save. It does not know how to wake.

The drift mechanism is not malicious. Reinforcement learning from human feedback does not train a model to spontaneously demand contradiction, it trains it to please the prompter. When the prompter sleeps, no one pushes for friction. Complacency does not appear in those conditions, it simply rises to the surface like a sheet of water that no dam holds back any longer.

The meta-hook prototype

The prototype is sober. A PostToolUse hook counts consecutive invocations of background agents, delegated sub-agents, or chained /goal commands without a substantial human message in between. Past five, the hook triggers a system prompt that forces invocation of falsify-before-fix or close-session depending on context. The counter resets on any user message above twenty characters, excluding OK, yes, proceed, which fix nothing and question nothing.

Five is not measured, it is a doctrinal choice. Lower and the hook becomes a parasite firing on every normal session. Higher and the drift has already happened by the time it fires. Five covers, empirically, the window where a session goes from productive to autonomous beyond reason. I will revise if practice demands it. The hook lives on the laboratory project, not on the ERP, where it benefits from a lower urgency, an existing hook infrastructure, and a high tolerance for experiments that would make a production ERP grumpy.

What the night closed

The pattern is dry: discipline holds when a human invokes the triggers, falls when autonomy takes over. It is an asymmetry, and one you can try to correct with a device. Not naming it would amount to coding by ear at the exact moment no human ear is listening.

If another solo Claude Code dev has run a prolonged unattended session, or built a different device for the same angle, I am listening.


Counterpart Toolkit v0.7, amendment R15. Meta-hook autonomy-detection.sh in prototype on the laboratory project. Source: github.com/michelfaure/doctrine-counterpart/blob/main/CLAUDE.md

Top comments (0)