Skip to content

opencode-context-pruner

OpenCode port of fast-jev-compaction that prunes stale tool calls from outgoing requests verbatim, by default only on compaction.

Hookbeta

Overview

opencode-context-pruner adapts fast-jev-compaction to OpenCode. Rather than modifying stored history, it prunes the outgoing model request: each tool call gets two Jev noul questions (keep the call? keep the result?), and the answers map to drop_call, drop_result (truncate with a note) or keep. Persisted history is untouched, so nothing disappears from the session log.

By default it prunes only compaction requests, the largest single requests in a session, which does not invalidate a prompt cache. A per-request mode also prunes normal requests but only after an hour of silence, when the cache is cold. Decisions are cached per tool_use_id, so requests without new tool calls make no Jev request, and any error leaves the request untouched. It handles both newer runtimes with a compaction hook and older ones by recognising the synthetic compaction prompt.

What the decision model decides

TypeQuestionAnswers
Yes / noKeep this tool call?yes · no
Yes / noKeep this tool result?yes · no

How it works

  1. Hook into compaction (and optionally context) before dispatch.
  2. Ask two noul questions per new tool call.
  3. Apply drop_call, drop_result or keep to the request view.
  4. Cache decisions per tool call; fail open on errors.

Strengths

  • Kept messages stay verbatim.
  • Cache-aware defaults avoid extra cost.
  • Fails open.

Caveats

  • Requires a TypeSafe key.
  • Per-request mode only acts after long idle gaps.

At a glance

Type
Hook
Status
beta
Language
TypeScript
Runtime
OpenCode plugin
Has code
yes

Use cases and integrations

How curated lists describe it

  • Continuous verbatim context pruning for OpenCode, powered by TypeSafe Jev. Port of fast-jev-compaction adapted to OpenCode's context hook.

    hellogumbo/awesome-jev

Frequently asked questions

Does it change my saved session?

No, it only prunes the outgoing request view.

When does it prune?

By default only on compaction requests; per-request mode prunes after an idle gap.

How many Jev calls does it make?

Each tool call is judged once and cached; requests without new tool calls make none.

Related projects

  • winnow★ 110

    Calibrated context sieve for Claude Code: Jev judges each block of large tool output and hides confident-no blocks behind recallable stubs.

    Projectbeta
  • Codex hook that compacts large command and tool outputs, using Jev to rank which chunks matter and keeping the full output retrievable.

    ServicebetaPython
  • Local proxy for Claude Code that uses Jev to remove stale tool results from the context once it reaches about 120K tokens, failing open.

    ProjectbetaJavaScript
  • Claude Code /fc command where Jev picks which old tool outputs to keep whole; the rest are trimmed and saved to files.

    ProjectbetaTypeScript
  • Local compaction proxy for Claude Code and Codex that compacts more often with local rules and keeps full history searchable.

    ProxybetaGo
  • Claude Code (and Codex) plugin that trims long Bash output chunk by chunk with Jev before it reaches the model, without summarising.

    PluginbetaTypeScript