Repository navigation
OpenCode Cache Engine v1.4.0
Phase 7 — minimal user-facing observability. Adds a read-only, content-free cache report. No breaking changes.
Changes
- Cache report —
node src/cache-report.mjs [--file <path>](ornpm run report). Reads the telemetry JSONL (CACHE_ENGINE_METRICS_FILE, else~/.cache/opencode/cache-metrics.jsonl) and prints: policy mode · last structural change · first differing section · transformation status · wire verification · provider cache usage · accounting limitations · estimated cost impact. Exit0ok /2usage-or-unreadable. src/cache-report-core.mjs— pureparseReportInput(text)+renderReport(records); imports nothing, no side effects.src/cache-report.mjs— thin CLI (--file> env > default;~expanded exactly as the recorder does).- 10 new tests: JSONL parse tolerance · purity/determinism · per-element coverage · unavailable ≠ zero · no ratio without provider data · privacy allow-list · no wire claim · CLI args/paths · CLI exit codes · isolation + a symlinked-entry regression.
Observations
- 0 bytes added to any prompt — the report is never on the request path and is never imported by
./server,./v2, or./tui(enforced by an isolation test over everysrc/module). - No prompt/reasoning content, credentials, headers, bodies, or session ids appear (allow-listed fields only).
- Missing is unavailable, never zero; no ratio without provider data with a non-zero denominator; estimates are omitted.
- An
appliedhook change is never presented as wire verification (wireEffect: "not_observed").
Compatibility
- No breaking changes.
./server,./v2,./tuikeep their exact meaning; the report is opt-in by invocation. - No new runtime dependency, no
bin, no newexportsentry;npm packships 11 files.
Notes
- Provider cache metrics appear only when the provider reports them; offline they render
unavailable. - Wire verification is always "not observed" today (the plugin has no wire observer); a future wire-evidence source would surface automatically.
- An interactive
./tuipanel remains deferred until the OpenCode TUI-panel API is verified.
Full Changelog: v1.3.0...v1.4.0
Thank you to everyone for using the plugin and helping make this project successful!
Provider-aware prompt-cache optimization and observability for OpenCode.
opencode-cache-engine is an OpenCode npm plugin that exposes three targets required by OpenCode's installed plugin model:
./server— the V1 CacheEngine runtime, hooks, provider policies, and telemetry (verified on OpenCode 1.x)../tui— plugin-manager registration and enable/disable integration; it
has no CacheEngine-specific UI../v2— the OpenCode V2 adapter (preview): implemented and offline-tested; isolated shim-based loading,setup, and hook registration/dispatch are verified in an isolated OpenCode 2.0.26 runtime, but managed-config discovery/registration remain unverified.
CacheEngine is an OpenCode plugin designed for long-running agent sessions where prompt-cache efficiency affects both latency and cost. It keeps the harness conservative for providers whose cache behavior is already automatic, while applying provider-specific optimizations where the provider exposes useful cache controls or where prompt structure can be safely improved.
The plugin currently has eleven cache-policy families: DeepSeek, GPT-5.6+, GLM-5.3+, MiMo V2.6+, Kimi, Claude, Gemini, Qwen, Grok, Muse, MiniMax
Initial models were personally chosen for their performance in max programming task completed per dollar. More models can be added based on newer releases or updates.
Future releases will be based on newer versions of models from the above providers, as well as any model that performs optimally over the Pareto distribution on OpenRouter as well as on personal discretion. Since cache stability policy doesn't change much for the providers, there's no need for a code rebase.
Installation
V1 (stable):
opencode plugin opencode-cache-engine # TUI/CLI installer
or set config:
"plugin": ["opencode-cache-engine"]
V2 (preview):
opencode plugin add opencode-cache-engine # TUI/CLI installer
or set config:
"plugins": ["opencode-cache-engine"]
Both install the package by name, and each runtime selects the interface it supports from the package's ./server export (V1 → server, V2 → setup). Do not pass opencode-cache-engine/v2 as the package specifier; use the bare name.
Best complemented with agents for the particular models configured at AlexJoaquimPereira/opencode-agent-config