Fast Jev Compaction Replaces Lossy Summaries in Claude Code
A new Claude Code plugin and npm package uses fast probability scoring to prune stale tool calls and outputs instead of summarizing them. By keeping kept messages verbatim, it prevents lost paths, constraints, and syntax errors.

Impact: Medium
Why it matters
You can eliminate the subtle bugs and lost constraints caused by LLM context summaries during long agentic coding sessions.
TL;DR
- 01Replaces context-destroying summaries by pruning only obsolete tool calls and outputs.
- 02User prompts, assistant code, and reasoning steps are preserved verbatim.
- 03Automatically falls back to built-in compaction if size reduction is less than 25%.
Key facts
- Default maxStateTokens
- 25,000
- Default maxRequestTokens
- 30,000
- Minimum compaction reduction ratio
- 0.25 (25%)
- Minimum Claude Code version
- 2.1.274+
Verbatim History Over Lossy Summaries
When long agent sessions trigger context compaction, standard summaries often wipe out essential constraints like "never edit src/generated" or nuanced syntax errors. The fast-jev-compaction utility acts as both a standalone npm package and a Claude Code hook plugin that preserves conversation messages verbatim while selectively pruning obsolete tool calls.
How Jev Scoring Works
1. State Fitting: The session state is fitted into maxStateTokens (default 25,000) using progressive compression: tool inputs drop from 1000 to 200 to 60 characters, and long texts collapse to head/tail slices. 2. Decision Matrix: For each tool call, Jev scores two questions against keepThreshold: should the call stay, and should the result stay verbatim? 3. Pruning Execution: If keepResult meets the threshold, both call and output remain. If only keepCall passes, the result is truncated to truncateHeadChars with a stub notice. If neither passes, the entire call and result pair is removed. 4. Fallback Handling: If the transcript cannot be fitted or the reduction ratio is under 0.25 (25%), Claude Code safely falls back to standard compaction.
Setup via Function Hooks
Function hooks require Claude Code 2.1.274 or newer with the experimental flag enabled in ~/.claude/settings.json:
{
"env": {
"CLAUDE_CODE_ENABLE_FUNCTION_HOOKS": "1",
"TYPESAFE_API_KEY": "<your-key>"
}
}Try it in 2 minutes
claude plugin marketplace add tamaratran/fast-jev-compaction
claude plugin install fast-jev-compaction@fast-jev-compactionbash
✓ When to use
- Use in multi-hour autonomous coding loops where tool outputs quickly saturate the context window.
- Use when standard compaction summaries cause your agent to forget previous architectural constraints.
✕ When NOT to use
- Do not use if you lack a TypeSafe API key or run completely offline environments.
- Avoid for tiny sessions where context size never approaches the compaction boundary.
What to do today
- Set CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 in your Claude Code environment configuration.
- Install the marketplace plugin via claude plugin install fast-jev-compaction@fast-jev-compaction.
- Export your TYPESAFE_API_KEY to test verbatim context compaction on heavy coding tasks.
Sources