Reads the session stream
It runs as an opencode plugin and works with the context already moving through the local session.
How it works
It keeps the useful parts of tool output, file reads, and session summaries without carrying every raw line forward.
Comparison table
Bigger raw context goes in. Smaller, useful context comes back out.
| Data / files / prompts / output | Without the plugin | With the plugin | Tokens saved |
|---|---|---|---|
| Output | $ npm test prints 18,400 chars: passing suites, webpack chatter, duplicate deprecation warnings, retry noise, stack traces, and one real failure buried near the bottom. | Command failed: npm test. Failing test: src/cart.test.ts. Error: Expected 2, received 3. Raw output kept locally. | ~4,575 tokens saved |
| Files | A full 2,400-line source file adds 96,000 chars of imports, helper functions, old migrations, test fixtures, comments, unrelated exports, and the one branch needed for the current bug. | Relevant symbols: createSession, updateSession, clearSession. Relevant block: updateSession error path. Omitted unrelated exports. | ~23,970 tokens saved |
| Prompts | A long working session carries 32,000 chars of repeated goals, stale guesses, pasted logs, obsolete warnings, already-fixed errors, failed workarounds, and earlier decisions. | Current objective, changed files, decisions made, failed attempts, tests still needed, and the next action stay in the compacted context. | ~7,970 tokens saved |
| Data | Raw local usage review means manually reading 12,000 chars across session logs, model names, sources, estimates, would-have-used totals, used totals, and saved-token math. | A local report shows sessions, models, events, sources, would-have-used tokens, used tokens, saved tokens, and percent saved. | ~2,970 tokens saved |
| Mixed context | A broad pack across app routes, components, and libraries can add 64,000 chars of unrelated routes, forms, styling helpers, validators, demo files, old experiments, and API clients. | Packed context keeps the settings route, SettingsForm, and API helper while skipping unrelated marketing components and CSS helpers. | ~15,970 tokens saved |
| Errors | A failing API call sends 14,500 chars of stack frames, repeated retry logs, framework wrappers, duplicate request metadata, bundled file paths, and one useful ECONNRESET cause. | Error: ECONNRESET. Path: src/lib/users.ts:88. Route: src/app/api/users/route.ts:21. Retries omitted. | ~3,600 tokens saved |
Processing path
It runs as an opencode plugin and works with the context already moving through the local session.
Large tool output is shortened. Relevant errors, paths, and commands stay visible.
Large file reads can come back as symbols, relevant blocks, or summaries instead of raw dumps.
Context quality
It keeps details that affect the next coding step: