Skip to content

Jev Practices & Patterns

Compaction and the long-context era

Jev's compaction tools keep or drop tool calls instead of summarizing them — the thresholds they fire at, the savings they report, and why 1.14's opt-in 262k context doesn't settle the choice.
Published
Category
Jev Practices & Patterns
Resources cited
8
Reading time
5 min
Tags#compaction#long-context#coding-agents

Summarization is the default answer to a full context window: pay a model to write a shorter transcript. The Jev ecosystem's compaction tools reject that trade. They ask two binary questions per tool call, leave user and assistant text verbatim, and treat uncertainty as a reason not to touch anything. Jev 1.14's opt-in 262k context is in preview and not production-ready by TypeSafe's own account, so the judgment layer has a bigger alternative to argue with.

Keep or drop, never summarize

The family starts with fast-jev-compaction, a Claude Code plugin and npm library. Every non-pinned tool call gets two Noul questions: should the call stay, and should the result stay verbatim. State is fitted to 25k tokens in stages before anything is sent, requests are split under a 30k-token cap, and answers are merged back per call. A message that loses all its content is removed, and no result is left without its call.

save-token-jev extends the pattern with adapters for Codex, OpenCode V2, Claude Code, the Anthropic and OpenAI APIs, and a generic transcript format: each call is kept with its full result, kept with a bounded result, or removed together with its result, and nothing is rewritten. On Codex it scores before built-in compaction and injects retained context at SessionStart. omp-jev-compaction vendors the same core; the wider roster is those two questions against different hosts, all inside the loop the coding-agent survey maps.

Two questions, three outcomes

The decision shape is stable across ports. The DeepSeek Harness port's defaults show it: a keepResult at or above keepThreshold (0.5) keeps call and result verbatim; keepCall alone keeps the call and truncates the result to 300 characters; otherwise both drop. Six recent messages are preserved, state is capped at 25k tokens, requests at 30k, and everything kept stays verbatim.

The differences are in the failure posture. QuentinDanblon's Pi port sends unmodified messages on any uncertainty, including a Jev error or a state that cannot be fitted, and gives up about 10 points of net gain to remove a call only when it is provably re-runnable. winnow splits large Read, Bash, and Grep results into roughly 25-line blocks and asks one yes/no question per block; a hidden block becomes a three-line stub with a key that restores the text. Output judged to show an error is never hidden, and borderline blocks are kept. Several ports, save-token-jev included, fail open: a missing key leaves the request unpruned rather than wrong.

When they fire

compact-adviser asks two one-sentence questions per checkpoint — is the unit finished, and is this hands-on work — and composes them into a score whose threshold starts near 0.90 on an almost empty context and relaxes toward 0.50 as the host's own compaction point approaches. Hints are suppressed below a constant 40,000-token minimum, requests are capped at 32,000 serialized bytes, and an error is never treated as an affirmative judgment. Only Pi and Claude Code compact automatically; Codex and Grok are hint-only.

KamilPostrozny's Pi port gates the judgment itself: a prune must free at least the hysteresis gap — 5,632 estimated tokens at a 112,640-token window with 16,384 in reserve — or it commits nothing and lets native compaction proceed. Jev there never sees result bodies; it judges from call inputs plus output size and error metadata, so an all-drop pass is safe but content-agnostic.

What the tools measure

omp-jev-compaction has the most mechanical numbers: a 16,198-message replay produced 3 rewrites and 37 reuses over 40 requests, with 0 prefix breaks across 39 checks. A cache guard skips sessions already at 80% or more cache reads, and on 14 live sessions the project reports it protected $1.81 per request round while capturing $2.61; its OpenRouter route measured about 430 ms and $0.0000198 per decision request.

The QuentinDanblon port's ratios come from two screen-heavy sessions, about 90% tool results and mostly base64 screenshots: 31.8% and 37.7% net gain with background scoring, 33.6% and 40.9% on the request path, which cost 2,984 ms in the hook over a session against 322 ms in the background. Only the ratios are defensible, its caveat says. Past that the numbers thin: a single 700 ms measurement in the DeepSeek Harness port, a demo post with no independent benchmark, no measured results reviewed for the Codex packet tool.

The 262k counterargument

Jev 1.14, as summarized by MarkTechPost, raises context to 262k behind opt-in danger zone headers at an unchanged $0.042 per million input tokens, experimental, with TypeSafe saying plainly that none of it is production-ready. A larger window defers the choice; it does not judge whether an old tool result still matters, and the workload these tools were built for is a transcript whose bulk is stale tool output. Window size does not settle cache arithmetic either: one port's append-only decision ledger invalidates the provider's prompt cache from the first edited message, while the omp plugin keeps its truncations sticky so the prefix survives.

What none of it guarantees

Decisions are model judgments, not proofs, as one port's caveat puts it. Selection is lossy: the Codex packet tool says to keep the original input as the authoritative archive, and the savings-gate port warns that committed excerpts stay fixed until their calls leave the active branch. Privacy is part of the contract, too — installing the adviser is stated as consent to send checkpoint context to TypeSafe once a key is available, and the omp port sends conversation state including tool names, inputs, and message text on every reduction.

Used as designed — conservative thresholds, text untouched, failures ending in a no-op — the family is a cheap way to keep a long session honest. Its two questions per call ride the existing batching discipline, which keeps a decision at a fraction of a cent. The long-context header makes the layer optional; the measurements above should decide whether you take the option.

From the Jev directory

The resources behind this article.

7.7kGitHub stars
A Claude Code plugin and npm library that replaces transcript summarization with Jev keep-or-drop judgments, deleting stale tool calls and results while kept text stays verbatim.
Jev Tools & CLIs#community#typescript#claude-code
81GitHub stars
A Jev-guided context compaction library for coding agents: instead of summarizing old context, Jev decides which tool calls and results still matter while user and assistant text is kept verbatim.
Jev Tools & CLIs#community#typescript#compaction
12GitHub stars
An omp plugin that does verbatim Jev-scored context reduction: stale tool calls and results are truncated to a short head plus a recoverable note, while sticky rewrites keep the provider's prompt cache intact.
Jev Tools & CLIs#community#typescript#compaction
pi extension that never summarizes: it asks Jev whether each old tool call and tool result is still needed, then drops or truncates only those, passing text, thinking and images through verbatim in a per-request view.
Jev Agents & MCP#community#jevbest#catalog-import
Pi package that uses Jev to decide, call by call, which old tool results can leave model context, with a savings gate that rejects prunes too small to be worth the prompt churn and bounded excerpts from status documents.
Jev Agents & MCP#community#awesomejev#catalog-import
112GitHub stars
A Claude Code context sieve: large Read, Bash, and Grep results are split into ~25-line blocks and judged by Jev before they enter context, with confident-no blocks replaced by a recallable stub.
Jev Tools & CLIs#community#python#claude-code
218GitHub stars
An agent plugin for Pi, Claude Code, Codex CLI and Grok Build that asks Jev two classification questions to decide whether a session sits at a safe compaction boundary, then hints or compacts for you.
Jev Agents & MCP#community#jevbest
MarkTechPost's write-up of the Jev 1.14 release: images, a box question type and 262k long context as experimental danger-zone features, unchanged $0.042 per million input token pricing, and TypeSafe's own note that none are production-ready.
Jev Media & TalksArticle#community#news#images
Community
Back to all articles

More Jev articles

How Pydantic AI, Mastra, TanStack AI, DSPy, Spring AI, and LiteLLM expose Jev: where the typed decision sits in the loop, what each integration returns, and which big frameworks are only adjacent.
Jev Integrations & Adapters#agents#frameworks#integrations
Read article
Tool menus can outgrow the context that reads them. The catalog's Jev-based routers and gates narrow the list: benchmarked tool search, per-tool scoring, fail-closed approvals, and WebMCP in the browser.
Jev Agents & MCP#mcp#tool-routing#agents
Read article

From the Jev AI model community

Posts from builders shipping with Jev right now.

Follow @typesafeai