Community · E2 · artifact verified

Replace Claude Code compaction with Jev decisions

A Claude Code plugin and npm library asks Jev which old tool calls and results still matter, then drops or truncates the stale ones, so /compact replaces the lossy built-in summary with the kept messages verbatim.

01 · Role in the system

What Jev does here

For every tool call outside the pinned recent window, Jev sees the whole conversation fitted into a state and answers two Noul questions per call: whether the call still matters, and whether its result must stay verbatim. Code pairs the answers against a keep threshold into three outcomes — keep call and result, keep the call with a truncated result, or drop both — batches the questions into concurrent requests under Jev's 32k limit, and falls back to Claude Code's built-in summary on errors or when the reduction is too small.

Per-item keep decisions instead of a lossy rewrite

Claude Code's built-in compaction rewrites a long history into a generated summary, and whatever the summary drops is gone. This plugin replaces that step with per-item decisions. For every tool call outside the pinned recent window, Jev answers two paired questions: whether the call still matters to the work in progress, and whether its result must remain available verbatim. Code pairs the answers against a keep threshold and sorts each item into one of three outcomes: keep the call and its result, keep the call with a truncated result, or drop both.

The transcript is then rebuilt from the kept items, so everything that survives stays byte-identical to what the tools actually returned. Assistant and user text are never rewritten or shortened, which contains the blast radius of a wrong judgment: the worst case is a dropped tool result that can be regenerated by re-running the tool, not corrupted dialogue history.

Batching, budgets, and the fallback path

The whole conversation is fitted into a single Jev state per pass, and questions are batched into concurrent requests under the model's 32k-token state limit, with token budgets estimated from character counts. Histories near the ceiling cost one request per handful of questions, a cost profile the limitations disclose rather than hide.

Two engineering guardrails make the risky part safe to ship. If the reduction is too small to justify the pass, or a request fails, the plugin falls back to Claude Code's built-in summary, so compaction always completes. And keep probabilities remain request-level judgments rather than proof that a result is safe to delete, which is why the threshold, the pinning window, and the truncation rules all stay in code where they can be tuned without touching the model.

How to evaluate a compaction pass

The design suggests its own evaluation checklist, which is part of why it is easy to index. A reviewer can diff the rebuilt transcript against the original and confirm that kept items are byte-identical; sample dropped calls and check whether re-running them was actually possible; and measure the achieved reduction against the too-small threshold that triggers the fallback. Because every decision is per item, failures attribute to specific judgments instead of diffusing into a summary nobody can audit.

That auditability is the deeper contrast with the built-in summarizer, which keeps no per-item record of why content disappeared. Whether the keep probabilities are good enough for production histories remains an open and unmeasured question, and the record does not pretend otherwise. The honesty about what is unproven is exactly what makes the artifact worth indexing at E2 rather than being marketed as a finished replacement. Re-running a dropped tool is also not always free, so the checklist above is a way to bound the risk of a wrong drop, not to eliminate it.

02 · Control boundary

Where Jev sits

Fitted conversation state to two paired Noul judgments per tool call; deterministic code owns pinning, batching, thresholding, transcript rebuilding, and the fallback to the built-in summarizer.

Code owns the loop, permissions, thresholds, validation, and side effects. Jev owns only the bounded judgments described above.

03 · Known limits

What this evidence does not prove

  • Only tool calls and results are removable; assistant and user text is never rewritten or shortened.
  • Keep probabilities are request-level judgments, not proof a result is safe to delete, since the tool can be re-run.
  • Token budgets are estimated from character counts, and histories near the state ceiling cost one request per handful of questions.

04 · Attribution

Public sources

This is a Community record: the project was published by a third-party community author.