A jevhook
Drop old results from a compaction
When Claude Code compacts a long conversation, whatever writes the summary reads all of it, old build logs included. This jevhook swaps the long output of older tool calls that the work no longer needs for one line saying what was there, so the summary costs less and is about the work in hand. The call itself stays in the record, and the assistant can make it again.
It starts in shadow: it writes down what it would have done and changes nothing, until you switch it on. It acts at session.compact.
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.
- Without this, whatever writes the summary reads every long listing and build log of the session.
- Jev is asked whether the work in hand still needs each long result of an older call: one of 2,000 characters or more, not among the latest ten calls, not a failure, the eight longest.
- Jev is shown the call in brief and never what it returned.
- A result that Jev says is 25% or less likely to be needed has its text replaced by one line, which says what was there and to make the call again if it is wanted.
- The call itself stays.
Say something
A jevhook is off, in shadow or on. To change this one, put this in ~/.config/jevhooks/config.toml:
[jevhooks.session.compact] trimmed = "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 results would have been left out.
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
2 rules decide what is carried across a compaction and what its summary leaves out, from 6 things known. 2 are Jev's answers, a yes or no for every message or result asked about, read one by one and never as a sum: whether one of your latest 12 prompts still says how the assistant is to work (carried across at 70%), and whether one long result of an older call is no longer needed (left out at 25% or under). The rest are the two switches and whether there is anything to ask about, known before Jev is asked. Neither rule refuses anything or sends anything back. Both can hold for one compaction, and nothing here has a limit. A result that is left out keeps its call, and the summary's writer is told how to read the line that stands in its place.
The same rules serve standing.
a finished build's 40,000 characters, and the file the work is about trimmed
Jev says the build's output is 12% likely to be needed and the file 77%. Each result is judged by itself, never as a sum, so only the build's output is left out: a line stands in its place, and the call stays.
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.
โฏ fix the off-by-one in the parser โ The off-by-one is fixed in src/parser.rs, and the build passes. โป Worked for 3s compaction: Jev: 1 results no longer needed left out of it (40000 characters) ยท 150 ms ยท $0.0002 this session [-] โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โฏ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โธ manual mode on ยท ? for shortcuts
The summary's writer is told:
In this conversation the result of 1 tool call has been replaced by a line that begins "[jevhooks:". The assistant read each of those results in full when it made the call, and what it did and concluded from them stands: do not describe that work as unsupported or unverified, and do not quote or mention the replacement lines in the summary.
In place of a result:
[jevhooks: what this call brought back (40000 characters) was read at the time and left out when the conversation was compacted. The work in hand no longer needs it (Jev: 12% likely needed). Make the call again if it does.]
What this site keeps about a visit, and how to refuse it, is said in one place: what is kept.