Blog / Questions / FIG. 146
fast-jev-compaction: Agent Memory on a Diet
fast-jev-compaction is a Jev compaction plugin for Claude Code that scores tool history for keep, trim, or drop. How it works and its siblings.
fast-jev-compaction is a Jev compaction plugin for coding agents: per its directory entry, a Claude Code plugin and library that "score tool-call/result pairs for deletion or truncation while retaining selected text verbatim." In plain terms, it asks Jev, the decision model from TypeSafe AI, a fast series of keep-or-drop questions about your agent's context, instead of pausing to summarize the whole thing.
Why agent housekeeping is decision-shaped in the first place is argued on Jev for developers, which owns the pattern. This page profiles the tool.
The problem with normal compaction
Claude Code compaction, like most agent compaction, is summarization: when the context window fills, a model rewrites the history into a shorter story. It's slow, it costs a generation call, and it's lossy in the worst possible place. The exact stack trace you were debugging becomes "encountered an error in the auth module." Nice summary. Useless fix.
Keep, trim, drop: verdicts instead of prose
The plugin's move is to treat each tool-call and result pair as an item to judge. Stale file listing from forty turns ago: drop. Long test output where only the failing assertion matters: trim. The error message you're currently fixing: keep, verbatim. Each ruling is a closed question, which is the only kind of question Jev answers, and closed questions are fast and cheap enough to run across a whole transcript.
The "verbatim" part is the design choice worth copying. Summaries paraphrase; a keep verdict preserves the original bytes. For code, bytes are the point.
Speed and behavior are as reported by the author; there are no official benchmarks for this or any Jev tool, and the repo is the place to check current behavior before trusting it with a long session.
The sibling builds
The pattern spread quickly, which is its own kind of evidence:
- pi-fast-jev-compaction brings it to the Pi agent: prune stale tool history first, and leave summary compaction to Pi when pruning isn't enough. A sensible cascade.
- fast-jev-codex targets Codex from the other side: Jev scores tool history, then the plugin restores verbatim context after Codex compacts, "so compaction stops eating the error being fixed," per its author.
- compact-adviser answers the timing question instead: is the session at a safe task boundary to compact? Its author reports tuning the question against a private eval set of 40 hand-labeled sessions, as reported.
Together they show the lane: judge first, summarize only as a fallback.
Before you install it
It's a community project, so pin the version and watch its maintenance. Keep a way to recover dropped context (logs, or the raw transcript) until you trust its verdicts on your kind of work, and never let a compaction step gate anything irreversible. It prunes memory, not decisions.
Frequently asked questions
Does fast-jev-compaction replace Claude Code's built-in compaction?
It scores and prunes tool history before summarization is needed; how it hooks into your setup is documented in its repo, and summarization can remain the fallback.
Why use a decision model for compaction?
Keep, trim, or drop is a closed question per item, which Jev answers quickly and cheaply, and keep verdicts preserve original text rather than paraphrasing it.
Is it safe for long debugging sessions?
That's the case it targets, but verify on your own sessions first and keep raw logs; behavior is as reported by the author, not independently benchmarked.
Are there versions for other agents?
Yes: Pi and Codex variants exist in our directory, plus compact-adviser for deciding when to compact.
Numbers throughout are as reported by the build authors, not verified by shipwithjev. Code-shaped examples are pseudocode; the official docs live at docs.typesafe.ai.