fast-jev / opencode

Keep the context.
Not the clutter.

Context compaction that makes decisions,
not new summaries.

JEV classifies old tool calls and results. Useful history stays in its own words; what can be re-read or re-run can go.

opencode plugin add github:overbit/fast-jev-compaction-opencode

Experimental Conservative by default. Native compaction remains the fallback.

session / context reviewIllustrative example
Before compaction
01
User request Pinned“Fix the authentication test.”
02
glob("src/**/*.ts") Drop48 paths · can be searched again
03
read("src/auth.ts") KeepRelevant implementation · verbatim
04
read("package.json") TruncateCall + output · full contents not needed
05
read("docs/old-api.md") DropStale reference · can be re-read
06
Recent test failure PinnedExpected 200, received 401
Classify, don’t summarize.Protect recent work.Hosted or local.

A smaller history.
The same retained words.

Source reads, searches, and build logs can outlive their usefulness. Rather than rewrite the conversation, the plugin asks two specific questions about each eligible completed tool call.

Call retention

Does knowing this call was made still matter?

JEV evaluates the tool call and input in the surrounding conversation.

Result retention

Is the full output still needed verbatim?

Large outputs are represented by bounded notes in the decision prompt.

What the decision means, at the default threshold of 0.5
Classifier decisionCheckpoint outcomeWhat changes
Full result meets thresholdKeepCall and full result stay.
Only the call meets thresholdTruncateCall stays; result is shortened.
Neither meets thresholdDropCall and result are removed.
First or recent messagePinnedAlways retained; not a candidate.

No useful decision? Keep the safety net.

Unanswered calls default to keep. Classifier errors or a reduction below the configured minimum leave OpenCode’s native compaction available. With few completed tool calls, there may be little to remove.

From install
to your next session.

Add the plugin, then choose where decisions run. TypeSafe is hosted; LM Studio and Ollama support native local System One decisions without a cloud key.

1Add the plugin

Run this in your terminal for OpenCode V2.

Terminal
opencode plugin add github:overbit/fast-jev-compaction-opencode

The package provides both ./server and ./tui entrypoints.

2Choose your backend

Hosted TypeSafe JEV

The default backend. Set your API key; no plugin options are required.

Terminal
export TYPESAFE_API_KEY=...

Default model: jev-latest. Keep credentials out of committed configuration.

Local System One

LM Studio 0.4.26+ supports /v1/systemone. Load a decision model such as Jev-Style 0.8B v3 and use its loaded model ID.

opencode.json · LM Studio
{
  "$schema": "https://opencode.ai/config.json",
  "plugins": [{
    "package": "github:overbit/fast-jev-compaction-opencode",
    "options": {
      "backend": "systemone",
      "localModel": "YOUR_LOADED_DECISION_MODEL_ID"
    }
  }]
}

LM Studio default: http://127.0.0.1:1234/v1/systemone.

For Ollama 0.35+, run ollama pull tev1:0.8b and configure:

opencode.json · Ollama
{
  "plugins": [{
    "package": "github:overbit/fast-jev-compaction-opencode",
    "options": {
      "backend": "systemone",
      "localBaseUrl": "http://127.0.0.1:11434/v1",
      "localModel": "tev1:0.8b",
      "maxStateTokens": 1200,
      "maxRequestTokens": 1800
    }
  }]
}

Tev1 0.8B is designed for short inputs; use smaller state/request limits as shown. Larger models may support more context.

Native System One scores multiple retention questions per request. For older chat-only models, the legacy backend: "local" still supports top_logprobs.

Conservative settings.
Explicit limits.

The plugin supplies a deterministic checkpoint string through OpenCode V2’s compaction hook. Retained text is not model-rewritten, but the original message structure is flattened.

This is an experimental port, not an arbitrary replacement-message API.

Explore all configuration options
Recent messages pinned
6 preserveRecentMessages
Keep threshold
0.5 keepThreshold
Minimum reduction
25% minReductionRatio
Truncated result head
300 chars truncateHeadChars

When something doesn’t compact.

No request reaches the local model

A classification request needs at least one completed tool call outside the pinned recent-message window. Short sessions may correctly send no request. Check the diagnostic log for candidate counts before changing your configuration.

The local classifier falls back

Check that the System One endpoint is reachable, the requested model is a decision model, and its loaded context is large enough. The legacy chat backend additionally requires logprobs and top_logprobs. Every compaction writes an outcome reason to ~/.local/share/opencode/log/fast-jev-compaction.log.

See diagnostic reasons and smoke-test configuration
Can I use the smaller 0.8B v3 model?

Yes. Use backend: "systemone" with LM Studio 0.4.26+ or another compatible System One server and the identifier of a loaded decision model. The legacy backend: "local" chat path is still intended for v1 models.

Read the model compatibility notes

Keep what matters.
Inspect how it works.

Explore the source