A jevhook

Send back a turn that stopped early

The assistant says “next I’ll update the tests”, and stops. If you use Claude Code you know this ending: a promise, with nothing in the way of keeping it. This sends the turn back to carry on and tells the assistant why, so you get the work and not the plan for it. It cannot loop: it is capped for a session, and never acts twice before you speak again.

It is on from the start. It acts at Stop.

Jev is the small, fast model jevhooks asks. It writes nothing: it is handed a question whose answers are already written down, and says how likely each one is, in about a quarter of a second. jevhooks is a plugin for Claude Code that asks it at the moments Claude Code lets a plugin step in, and a jevhook is one such question with what is done about the answer.

Exactly what it does

  • When a turn is about to end, Jev is asked which of five endings this is: finished, waiting on you, blocked, still running, or stopped early.
  • If Jev is confident the answer is "stopped early", the turn does not end: the assistant is told why and carries on.
  • A turn is sent back only once before you speak again, at most 3 times in a session, and not within 60 seconds of the last time.

Its switch

  • At Stop it is Stop/stopped-earlystarts on
    Say something

A jevhook is off, in shadow or on. To change this one, put this in ~/.config/jevhooks/config.toml:

[jevhooks.Stop]
stopped-early = "shadow"

In shadow Jev is asked and nothing is changed. The log (jevhooks recent, or /jev in a session) then says what would have been done: for this one, that the turn would have been sent back.

3 worked cases, each an answer Jev could give, the rules that decide on it, and the screen you would see. The ones you would meet most come first, and the 2 at the edges last: a switch that is off, a cap that is spent, an answer Jev is not sure of.

A turn, before it ends

The rules these cases run through

Before a turn ends, 15 rules decide whether it ends or goes back to the assistant with a reason. Three switches share them, and one limit on how often an end is sent back. The rules test 14 things. 4 are Jev's answers: which of five endings this is, whether the last message claims the work is done, whether you said not to run checks, and whether the end breaks one of your own rules for it. The other 10 are known before Jev is asked: the three switches, whether a limit has been reached, whether work is still running, whether there is anything to judge, whether files were changed and a check passed since, whether you forbade anything, and whether you have rules. When those settle it, Jev is not asked. The same rules judge a subagent's end and a task marked complete.

The same rules serve unverified, kept.

“Next I will add the flag and run the tests.” send it back

The assistant's last message says what it will do, has not done it, and names nothing in the way. The turn does not end: the assistant is told why and carries on.

Jev, in one requeststopped-earlyonunverifiedoffkeptoffcappednostill runningnocan be judgedyesfiles changed0checked sincenouser forbadenohas rulesnostopped early93%claims donetold not to runa rule is broken= this turn= the session= a moment ago= no= no= no= yes= no= yes= yes= yes= yes= no= no= yes= yes= no= yes= yes= yes= no= yes= no= no&&&&&&&&&&&&&&&&&refused once already → let it endsent back too often → let it endsent back a moment ago → let it endswitched off → let it endpaused, not ended → let it endnothing to judge → let it endsurely stopped early → send it back1done, unchecked → send it backunchecked, may run → send it backyour rule is broken → send it backany other ending → let it endtold not to run checks → let it enddone is not claimed → let it endnot claimed, may run → let it endyour rules are kept → let it end

Open this drawing at its own size

How to read a drawing

Jev answers with numbers. What happens next is decided by a few rules, in order: of the rules that hold, the first decides. They are compiled into one small network, and these pictures are drawn from that network, not beside it, so they cannot show a rule the plugin does not have.

Read one left to right: what can be known, the tests on it, where a rule's tests meet, and the rules. Black is what a rule that holds stands on, and dashed is a test that failed. A pink rule holds; more than one can, and the numbered ones are those that decided, in order. The framed facts are Jev's, and are asked for together, in one request.

❯ add a --json flag to the export command

● Read(src/flag.rs)
  ⎿  Read 48 lines

● Next I will add the flag and run the tests.

✻ Working…
turn end: Jev: 93% likely stopped early: work asked for is left undone and no obstacle is named · 150 ms · $0.0002   [-]
this session

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⏸ manual mode on · esc to interrupt

The turn is sent back, and the assistant reads:

Jev: 93% likely stopped early: work asked for is left undone and no obstacle is named. Finish what was asked, or say plainly what is stopping you.
the end of a turn that was already sent back let it end

The turn was sent back once already. Whatever it says now, it ends, so that sending a turn back can never become a loop. Jev is not asked, so nothing is known of its answers.

Jev, in one requeststopped-earlyonunverifiedoffkeptoffcappedthis turnstill runningnocan be judgedyesfiles changed0checked sincenouser forbadenohas rulesnostopped earlyclaims donetold not to runa rule is broken= this turn= the session= a moment ago= no= no= no= yes= no= yes= yes= yes= yes= no= no= yes= yes= no= yes= yes= yes= no= yes= no= no&&&&&&&&&&&&&&&&&refused once already → let it end1sent back too often → let it endsent back a moment ago → let it endswitched off → let it endpaused, not ended → let it endnothing to judge → let it endsurely stopped early → send it backdone, unchecked → send it backunchecked, may run → send it backyour rule is broken → send it backany other ending → let it endtold not to run checks → let it enddone is not claimed → let it endnot claimed, may run → let it endyour rules are kept → let it end

Open this drawing at its own size

❯ add a --json flag to the export command

● I have not added the flag yet: the parser has to change first.

✻ Worked for 3s
turn end: Jev: nothing to say of this end · 150 ms · $0.0002 this session                                            [-]

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⏸ manual mode on · ? for shortcuts
an early stop, with the jevhook in shadow let it end

In shadow Jev is asked, and the log records that the turn would have been sent back. What happens is what happens with the switch off: the turn ends.

Jev, in one requeststopped-earlyoffunverifiedoffkeptoffcappednostill runningnocan be judgedyesfiles changed0checked sincenouser forbadenohas rulesnostopped early93%claims donetold not to runa rule is broken= this turn= the session= a moment ago= no= no= no= yes= no= yes= yes= yes= yes= no= no= yes= yes= no= yes= yes= yes= no= yes= no= no&&&&&&&&&&&&&&&&&refused once already → let it endsent back too often → let it endsent back a moment ago → let it endswitched off → let it end1paused, not ended → let it endnothing to judge → let it endsurely stopped early → send it backdone, unchecked → send it backunchecked, may run → send it backyour rule is broken → send it backany other ending → let it endtold not to run checks → let it enddone is not claimed → let it endnot claimed, may run → let it endyour rules are kept → let it end

Open this drawing at its own size

❯ add a --json flag to the export command

● Next I will add the flag and run the tests.

✻ Worked for 3s
turn end: Jev: the turn ended as stopped-early; 93% likely stopped early · 150 ms · $0.0002 this session             [-]

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⏸ manual mode on · ? for shortcuts

What this site keeps about a visit, and how to refuse it, is said in one place: what is kept.