Skip to content

v1.1.1

Choose a tag to compare

@AlexJoaquimPereira AlexJoaquimPereira released this 14 Oct 14:16
· 134 commits to master since this release

OpenCode Cache Engine v1.1.1

This release lands Phase 2 of the post-1.0.0 plan: it verifies the date-relocation hook shape and implements a content-preserving date-line relocation for GLM-5.3 / MiMo-V2.6 — opt-in and experimental (default off). No provider measurements were made and no cache benefit is claimed.

Changes

  • New stabilizeDate policy (GLM-5.3 / MiMo-V2.6), default false — moves the standalone Today's date: … line to the system-prompt tail.
  • New core helper relocateVolatileDateLine(text) — byte-preserving, fail-closed.
  • New telemetry: additive boundary record reason: "system_date_relocated" (V1 + V2).
  • Phase 2 research shipped: RF-OC-035, a hook-shape report, and a shape-fixture corpus; stale <env> relocation notes corrected.

The problem (verified on OpenCode 2.0.26)

The V2 context hook delivers system as four text parts. The daily date is a standalone line (Today's date: Wed Oct 14 2026) that sits outside the <env> block, inside part 2 — so the existing <env> relocation does not move it (and, on 2.0.26, the <env> relocation is itself a within-part no-op because the block is terminal in its part). The date line is therefore the only per-day byte that breaks the cacheable prefix.

Detailed Changes:

Core (src/cache-engine-core.mjs)

  • relocateVolatileDateLine(text) → { text, changed }: moves the single standalone date line to the end of its containing text. All non-date bytes are preserved byte-for-byte; at most one separator \n is inserted. The date value/format is never changed and never pinned.
  • Fail-closed: no-op for missing / duplicate / malformed / ambiguous dates, for a date inside any <env> block, when the <env> structure is not a single well-formed pair, and when the date is already at the tail.
  • New policy flag stabilizeDate (default false) for glm53 and mimo26, controllable independently of stabilizeSystem.

V1 + V2 wiring (src/cache-engine.ts, src/cache-engine-v2.mjs)

  • Same families, same content-preserving contract as the <env> relocation. V2 relocates only the single eligible text part and leaves every other part byte-identical; if zero or more than one part is eligible, nothing changes.

Telemetry (additive)

  • New boundary record reason: "system_date_relocated" with policy / provider / model when the transform fires. Existing record kinds and fields are unchanged.

Docs & research

  • README.md + examples/cache-engine.json document stabilizeDate; AGENTS.md GLM/MiMo invariant updated.
  • docs/phase2-date-relocation-hook-shape.md (anchor-per-version report + go/no-go); RF-OC-035 added and RF-OC-033 superseded in docs/research-findings.md; stale reasons corrected in the plan and the v2 record.
  • Offline capture harness gains a OC_CAPTURE_MODEL override (per-model captures).

Compatibility

  • No breaking changes. Exports (./server, ./tui, ./v2) and existing telemetry are unchanged; the new transform is off by default and every addition is read-only until enabled.
  • When stabilizeDate is enabled, requests for GLM-5.3/MiMo-V2.6 have the date line moved to the tail (the only prompt-byte change).

Testing & audit

  • 368 tests pass / 0 fail; npm run test:harness all pass.
  • Independent adversarial review → fixes applied: single-<env>-pair guard, label-based ambiguity detection, already-at-tail no-op, exact-byte corpus assertions, multi-part/ambiguity adapter tests, and the system_date_relocated telemetry.

Limitations / evidence boundary

  • Default off / experimental. Structurally and offline verified only — no provider requests, so no cache-read/write benefit is measured or claimed (deferred to P2-T4).
  • The date matcher is intentionally narrow (OpenCode's Today's date: template); a format change makes it a safe no-op.

Full Changelog: v1.1.0...v1.1.1


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