Skip to content

Releases

v0.2.0 — the deterministic swap

Choose a tag to compare

@omeryasirkucuk omeryasirkucuk released this 19 Nov 13:49
e641ec8

The deterministic swap

The swap no longer contains, waits for, or depends on an LLM. v1's extraction cursor sat inside the swap's safe-point condition — a failing, quota-limited, or slow extraction model deferred swaps indefinitely (extraction_lagging), and behavior visibly differed per model. v2 replaces the whole loop with one deterministic transformation.

Highlights

  • Swap = pure function. Decides and freezes from state alone; runs in milliseconds on every model. No model-dependent code path can defer or fail a swap.
  • Mechanical projection (core/projection.ts, new): verbatim user prompts (capped), first lines of assistant replies, touched files from tool parts, then the ledger sections. Ledger records are positionally scoped to the discarded region. Identical inputs render byte-identically.
  • Optional ledger enrichment (new ledger config key, default true; false = swap-only pipeline with zero extra LLM calls). Replaces extractionGate. Completed records and invalidations refresh the frozen render in place; failures stay invisible.
  • Honest budgets: renderTruncated persisted on the rollover record, new render_truncated metric, gate_* metrics withdrawn, new ledger_enriched metric.
  • Status card names the context counter's source (usage / estimate); /rollover status and /rollover show report the frozen render the model actually receives after a swap.
  • Concurrency: usage tracking, touched-file notes, extraction commits, and the swap are single critical sections per session; in-lock metrics are fire-and-forget.

Verification

  • 279 tests / 0 fail; live smoke against the fork-built binary: with extraction scripted to fail on every call, the swap still fired in 4 ms with a 5793 → 170 token reduction.
  • Full change description in the README changelog and docs/2026-11-19-deterministic-swap-design.md.

Install / update: opencode plugin add context-rollover (or opencode plugin update context-rollover).