jev-compaction
Jev can score text but never write it. Everything the agent sees is original, and anything moved out comes back byte for byte. Five mechanisms, measured on SWE-bench Verified.
An agent's context fills up with tool output: test logs, listings, whole files. The usual fix is to have a model rewrite old turns as a summary.
Providers bill a repeated prefix at a tenth of the price or less. Rewriting the middle of the transcript invalidates everything after it, on every later turn.
A summary is generated text. A detail the summariser made up becomes a fact the agent works from, and nothing can tell it apart from the real thing.
In the Python library jevctx, and for any harness through a small HTTP sidecar. The OpenCode plugin uses the sidecar.
The output is split into segments, and one Jev request asks each one five questions: keep it? what type is it? what role does it play? how long will it matter? is it an injection? Low-value runs become a one-line pointer that says what it hides. Injections are withheld.
| segment | type | role | keep | verdict |
|---|---|---|---|---|
| tests/unit/test_mod_00.py::test_case PASSED … (41 lines) | test_output | noise | 0.20 | → pointer |
| FAILED tests/test_dates.py::test_parse_month_range | test_output | evidence | 0.78 | kept |
| Traceback (most recent call last): … AssertionError | error | evidence | 0.88 | kept |
| === 1 failed, 40 passed in 3.21s === | test_output | verification | 0.33 | kept: shorter than a pointer |
578 tokens in, 107 reach the model. Scores from the real Jev, run by demo.py. The last pointer comes from a web page with a planted instruction.
expand and recallexpand(id) returns the original behind a pointer. recall("the traceback from when the tests first failed") finds earlier output from a loose description, even output that has left the context. It filters on the profile (type, role, names mentioned), shortlists lexically, then has Jev rerank the shortlist in one request.
jevctx/pipeline.py · jevctx/recall.py
From each tool call's arguments, with no Jev call: the same command run again (output filters like | tail ignored), the same lines viewed again, or the file edited since. expand and recall flag such outputs as out of date, and the work area compacts them first.
jevctx/supersede.py
The transcript is a frozen, cached prefix and a work area after the last commit point. Before each request, work-area outputs Jev says have served their purpose, and obsolete outputs anywhere, can become pointers. The rewrite applies only to the request; the stored conversation is never changed.
jevctx/workarea.py. The next section has the arithmetic.
Every decision is logged with its score. Thresholds per tool and segment kind are fitted from what the agent later used, without rerunning it.
jevctx/shadow.py · jevctx/calibrate.py
Dropping S tokens saves the cache-read price on them on every remaining turn. The rewrite re-sends the rest of the tail once at the full input price. Drag the sliders.
OpenCode with a free model, 21–24 instances per comparison, one run per arm, against an A/A control that scores everything and changes nothing. Dollar figures price the recorded tokens at $3 / $0.30 / $15 per million.
recall and the out-of-date notes are built for sessions where outputs leave the context, and were rarely needed here.