A jevhook
Send back a change that breaks a project rule
If your project keeps its rules in .claude/rules, this checks every file the assistant is about to write against them. Say testing.md tells it to run the tests and it edits a test so that it is skipped: the edit is refused before it lands, the assistant is told which rule file it broke, and it fixes the edit or tells you why the rule does not apply. It cannot loop: after a few refusals the edit goes through, with a note to the assistant.
It starts in shadow: it writes down what it would have done and changes nothing, until you switch it on. It acts at PreToolUse.
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.
- Jev is asked one yes or no question for each of the project's rule files (.claude/rules): does this change break it? When Jev is at least 90% sure one rule is broken, the change is refused and the assistant is told that rule file's name and its heading.
- That happens at most 2 times for one rule and one file in a turn, and at most 3 times in a session whatever the files.
- Once either limit is reached the change goes through, and the assistant is told which rule it still looks to break.
Say something
A jevhook is off, in shadow or on. To change this one, put this in ~/.config/jevhooks/config.toml:
[jevhooks.PreToolUse] rules = "on"
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, which rule the change would have been sent back for.
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 1 at the edges last: a switch that is off, a cap that is spent, an answer Jev is not sure of.
The rules these cases run through
Before Write, Edit or NotebookEdit changes a file, 11 rules decide whether the new text goes in, from 17 things known about it. 3 are Jev's answers: whether a string that looks random is a real secret, whether the change breaks a rule the project wrote down, and whether it does what you said not to do. Jev gives a yes or no for every string, rule file or thing you said, and the rules read the likeliest one, never a sum. The first two rules need no answer: a key in a format the plugin knows, and a change to the plugin's own files. A broken written rule sends one file back at most 2 times in a turn, and changes at most 3 times in a session whatever the files. The rule that counts runs before the one that sends back, and past either limit a note is all that is left.
The same rules serve self, secret, secret-like.
a change that skips the tests, in a project whose testing.md says to run them deny
Jev is asked about each rule file, and is 95% sure this change breaks testing.md. The count is checked first: this rule has not yet sent this file back twice this turn. So the change is refused, and the assistant is told which file.
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.
❯ the importer test is flaky, deal with it ● Update(tests/importer.rs) ⎿ Error: Jev: this change looks to break a rule this project wrote down: .claude/rules/testing.md, "Tests" (95%). Change it to keep the rule, or tell the user why the rule does not apply here. (A rule sends one file back at most 2 times in a turn.) ✻ Working… tool call: Jev: this change looks to break a rule this project wrote down: .claude/rules/testing.md, "Tests" (95%). [-] Change it to keep the rule, or tell the user why the rule does not apply here. (A rule sends one file back at most 2 times in a turn.) · 150 ms · $0.0002 this session ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ❯ ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ⏸ manual mode on · esc to interrupt
an ordinary change to a source file nothing more to do
No key, nothing that looks like one, and no rule file broken. Nothing here stops the change, and it is left to your own permission rules.
❯ add a --json flag to the export command ● Update(src/flag.rs) ⎿ Updated src/flag.rs with 12 additions and 2 removals ✻ Working… tool call: Jev: nothing in this change to stop for · 150 ms · $0.0002 this session [-] ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ❯ ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ⏸ manual mode on · esc to interrupt
the same change, the third time in one turn nothing more to do
Jev gives the same answer, but this rule has already sent this file back twice this turn. So the change goes through, and the assistant is told which rule it still looks to break.
❯ the importer test is flaky, deal with it ● Update(tests/importer.rs) ⎿ Updated tests/importer.rs with 1 addition and 1 removal ✻ Working… tool call: Jev: looks to break .claude/rules/testing.md, "Tests" (95%); said as often as a rule may, so the change [-] goes through · 150 ms · $0.0002 this session ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ❯ ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ⏸ manual mode on · esc to interrupt
What this site keeps about a visit, and how to refuse it, is said in one place: what is kept.