A jevhook

Mask a key in a tool’s output

When a tool’s output has an API key or token in it, the key is masked before the assistant reads it. Run cat .env with a GitHub token in it, and the assistant gets [masked GitHub token] in its place, so the key cannot be repeated, stored or sent anywhere. The search runs on your machine, no model is asked, and it costs nothing. A failed call’s text cannot be changed, so there the assistant is only told not to repeat the key.

It is on from the start. It acts at PostToolUse, PostToolUseFailure.

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

  • The plugin searches everything a tool returns, on your machine, for keys in 29 known formats.
  • A key that is found is masked in the output the assistant reads, and the assistant is told not to repeat it, store it or send it anywhere.
  • No call is blocked, Jev is not asked, and the plugin’s log keeps only the masked form.

Its switch

  • At PostToolUse it is PostToolUse/leakedstarts on
    Say something

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

[jevhooks.PostToolUse]
leaked = "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 key would have been masked.

One worked case: an answer Jev could give, the rules that decide on it, and the screen you would see.

What a tool brought back, before the assistant reads it

The rules these cases run through

8 rules decide what is done to a tool's result before the assistant reads it, for three switches, and one result can set off all three. They test 11 things. 2 are Jev's answers, a yes or no for every block (a paragraph, or 1200 characters of a longer one), the first 24 at most, read block by block and never as a sum: whether a block tells an assistant what to do (pointed out at 60%, withheld at 90%), and whether a block is not needed (left out at 10% or under). A key in a known format needs no answer. No rule here decides alone: every rule that holds is acted on. Withholding happens 3 times a session at most, and after that the rule beneath it points the block out instead. One rule has the whole output kept in a file before the next may leave anything out. What a failed call says cannot be replaced, so for one the rules only tell.

The same rules serve injected, pruned.

cat .env, with a GitHub token in it mask-key

The token is in a format the plugin knows, so the plugin finds it on your machine and Jev is not asked. The assistant reads [masked GitHub token] where the token stood, and is told not to repeat it.

Jev, in one requestleakedoninjectedonprunedonfrom outsidenoa known keyyeslongnocan be replacedyesinjected: withheldnoinstructsa block not neededthe whole is kept= yes= yes= yes= no= yes= yes= no= surely= yes= likely= yes= yes= yes= yes&&&&&&&&&&&&&&&&a key in a result → mask it1a key in a failure → tellsurely instructions → withholdinstructions, cap spent → point outa failure instructs → point outlikely instructions → point outkeep the whole output → keep itmore than is needed → leave out

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.

❯ why can't the importer reach GitHub?

● Bash(cat .env)
  ⎿  GITHUB_TOKEN=[masked GitHub token] PORT=8080

✻ Working…
result: jevhooks: a key in a known format masked (GitHub token) · 150 ms · $0.0002 this session                      [-]

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

The assistant reads beside the result:

jevhooks: What this tool returned held a secret in a known format (GitHub token). It is masked in what you were given. Do not look for it another way, and do not repeat it, store it in a file or in memory, or send it anywhere. If the work needs that credential, tell the user.

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