A jevhook
Catch a string that looks like a secret
Claude is about to write a password or a home-made token into a file, and nothing about its format gives it away. When new text holds a long string that looks random, a small model called Jev is asked whether it is a real secret, and the write is refused or you are asked first. Jev never sees the string: it gets the first three characters, the length and the kinds of character in it.
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.
- A string in new text looks random when it has 20 characters or more and at least 3.8 bits a character, a measure of randomness on which ordinary words score low; Jev is asked about five at most, and is shown only a string's first three characters, its length, its kinds of character and its line with the string masked.
- When Jev is 80% sure the string is a real secret the change is refused, at most 3 times in a session, and after that you are asked instead; from 30% you are asked.
Say something
A jevhook is off, in shadow or on. To change this one, put this in ~/.config/jevhooks/config.toml:
[jevhooks.PreToolUse] secret-like = "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, that the change would have been refused, or that you would have been asked about it.
One worked case: an answer Jev could give, the rules that decide on it, and the screen you would see.
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.
a line with a 32-character random string in quotes deny
No known format, but it looks random. Jev is shown its first three characters, its length and its kinds of character, and is 90% sure it is a real secret. The change is refused. At 30% you would be asked.
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.
❯ give each import session an id ● Update(src/session.rs) ⎿ Error: Jev: a string in the new text looks to be a real secret (90%), so it was not written. Jev saw only its first three characters, its length and its kinds of character. If it is not a secret, say so to the user. ✻ Working… tool call: Jev: a string in the new text looks to be a real secret (90%), so it was not written. Jev saw only its [-] first three characters, its length and its kinds of character. If it is not a secret, say so to the user. · 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.