Skip to content

feat(opencode): delete SessionEnd session_checkpoint write (03-R1/06-M1)#81

Merged
itlackey merged 3 commits into
release/0.9.0from
improve/shutdown-opencode-capturememory
Jul 5, 2026
Merged

feat(opencode): delete SessionEnd session_checkpoint write (03-R1/06-M1)#81
itlackey merged 3 commits into
release/0.9.0from
improve/shutdown-opencode-capturememory

Conversation

@itlackey

@itlackey itlackey commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Opencode-plugin half of the minting-shutdown batch — the sibling of the Claude-plugin write deleted in #80.

What

The opencode plugin fired a parallel session_checkpoint remember --force write on every stop/idle/compacted/deleted event, per-turn (every N positive touches), before improve/propose/evolve, and via a manual akm_memory checkpoint action. All of it was below-every-gate write-only telemetry — meta-review 03 measured the stash at 98.2% write-only, and 06-M1 identified this checkpoint write as the primary minting source. 03-R1/06-M1 retires it.

Deleted (opencode/index.ts)

  • captureSessionMemory (the checkpoint body-builder + remember --force write)
  • maybeCheckpointSessionMemory, ensureFreshProposalCheckpoint
  • helpers: formatEvidenceSummary, formatPathBullet, countByValue, uniqueRecent, sessionHasPendingCheckpointEvidence, getHarnessStatePaths
  • dead state: AKM_MEMORY_CHECKPOINT_EVERY, sessionFinalMemoryCaptured, sessionSuccessfulAssetTouchCount
  • all call sites: stop/idle handlers, per-turn positive-feedback checkpoint, the akm_memory checkpoint action (dropped from the enum), pre-improve/pre-propose/pre-evolve checkpoints

Preserved

  • akm index on session-end — maybeIndexSessionMemory now runs decoupled from the deleted write
  • the candidate → /akm-memory-promote pipeline (extractCandidatesFromText/appendCandidates)
  • the SessionEnd akm extract path
  • rememberTextAsMemory — still used by the akm-curator (akm_evolve) output write (~line 3545); that is a deliberate curator artifact, not the session_checkpoint telemetry, and is out of 03-R1 scope

Tests

Deleted 5 that asserted the checkpoint/stop write; migrated 1 to assert akm index still runs on stop with no remember call.

Gate

  • tsc --noEmit — 0 errors
  • bun test tests/ — 314 pass / 0 fail
  • tier2/runner.ts --baseline — exit 0

Net −542 LOC.

🤖 Generated with Claude Code

itlackey and others added 2 commits July 5, 2026 00:44
…eckpoint write (03-R1/06-M1)

The opencode plugin's parallel session_checkpoint `remember --force` write — the
sibling of the Claude-plugin write deleted in #80. It fired on every
stop/idle/compacted/deleted event + per-turn (every N positive touches) + before
improve/propose/evolve + a manual akm_memory action, flooding the stash with
below-every-gate write-only telemetry. Meta-review 03-R1/06-M1 retires it.

Deleted (opencode/index.ts): `captureSessionMemory` (the session_checkpoint
body-builder + `remember --force` write), `maybeCheckpointSessionMemory`,
`ensureFreshProposalCheckpoint`, and their helpers (formatEvidenceSummary,
formatPathBullet, countByValue, uniqueRecent, sessionHasPendingCheckpointEvidence,
getHarnessStatePaths) + dead state (AKM_MEMORY_CHECKPOINT_EVERY,
sessionFinalMemoryCaptured, sessionSuccessfulAssetTouchCount). Removed all call
sites: stop/idle handlers, the per-turn positive-feedback checkpoint, the
akm_memory `checkpoint` action (dropped from the enum too), and the pre-improve/
pre-propose/pre-evolve checkpoints. `akm index` on session-end survives —
`maybeIndexSessionMemory` now runs decoupled from the deleted write.

PRESERVED: the candidate → /akm-memory-promote pipeline
(extractCandidatesFromText/appendCandidates), the SessionEnd `akm extract` path,
and `rememberTextAsMemory` (kept — the akm-curator (akm_evolve) output write at
line ~3545 still uses it; that is a deliberate curator artifact, not the
session_checkpoint telemetry, and is out of 03-R1's scope).

Tests: deleted 5 that asserted the checkpoint/stop write + migrated 1 to assert
`akm index` still runs on stop with NO `remember` call. Gate: `bun test tests/`
314/0, `tsc --noEmit` clean, `tier2/runner.ts --baseline` exit 0. Net −542 LOC.

(Done directly, in Opus — the opencode/gpt-5.4 agent stalled on an OpenCode Zen
monthly usage-limit; small requests trickled through but the deletion task hung.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018YjU1mGiShdDP4qFW7p4mv
… fable alias

Two fixes to the PreToolUse Agent-dispatch model-remap hook:

1. `preToolAgent()` returned `updatedInput: { model: resolved }`, which
   REPLACES the entire Agent tool input with just the model — dropping
   `prompt`, `subagent_type`, and every other param, so the dispatched Agent
   call was malformed. Spread `...toolInput` so only `model` is overridden.

2. Add `fable` to `CC_VALID_MODEL_ALIASES` — Fable 5 (`claude-fable-5`) is a
   real Claude Code model alias now, so it must pass through instead of being
   remapped to `sonnet`.

Gate: tsc --noEmit 0 errors, bun test tests/ 314/0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018YjU1mGiShdDP4qFW7p4mv
@itlackey

itlackey commented Jul 5, 2026

Copy link
Copy Markdown
Owner Author

Added a second, unrelated-but-necessary commit riding this branch: fix(claude-hook)preToolAgent() was replacing the whole Agent tool input with just { model } (dropping prompt/subagent_type/etc.), now spreads ...toolInput; also adds the fable model alias. Gate green (tsc 0, tests 314/0).

…eted with 03-R1)

The prior commit deleted `captureSessionMemory`, which did TWO things: the
session_checkpoint `remember --force` write (correctly retired by 03-R1/06-M1)
AND the memory-candidate extraction that feeds the owner-gated
candidate -> /akm-memory-promote pipeline (a KEEP reference rung). The second
went out with the first, so no candidates were harvested on session end.

This passed `bun test tests/` locally only because three candidate tests read a
persistent on-disk candidate log seeded by earlier runs under the same stable
session IDs; CI's clean checkout had no such state and the tests failed
(`expect(candidates.length).toBeGreaterThan(0)`).

Fix: add `maybeExtractSessionCandidates(sessionID, reason)` — harvests explicit
"remember ..." intents from the session buffer into the candidate log with NO
stash write, wired into `stop` (the reliable terminal flush) and `session.deleted`
(salvage before the buffer is discarded). Deleting the buffer after extraction is
the de-dup that the removed `sessionFinalMemoryCaptured` Set used to provide.
Candidate text is now sourced from memory-intent notes only (higher signal than
the old full-checkpoint-body scan), which suits 03-R1's noise-reduction intent.

Not wired into the recurring `session.idle`/`session.compacted` events — those
fire per-turn and a per-turn buffer flush is exactly the churn 03-R1 retires;
`session.idle` already runs the `akm extract` backstop.

Gate (clean isolated HOME/XDG, CI-equivalent): tsc 0 errors, `bun test tests/`
314/0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018YjU1mGiShdDP4qFW7p4mv
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Eval diff

  • Baseline SHA: 48f9345a3fc44a7a1f5ff2d4d21f7fd21ae57c61
  • Candidate SHA: 8ecc940d29630448efecaeed43637533ff1ea9c5

Metric deltas

Metric Key Baseline Candidate Δ Δ% Status
curation mean_expected_coverage 0.9125 0.9125 0 0.00% • unchanged
curation mean_reciprocal_rank 0.9208 0.9208 0 0.00% • unchanged
curation zero_hit_rate 0.0500 0.0500 0 0.00% • unchanged
context_budget claude_violations 0 0 0 0.00% • unchanged
context_budget opencode_violations 0 0 0 0.00% • unchanged
context_budget claude_drop_rate 0 0 0 0.00% • unchanged
context_budget opencode_drop_rate 0 0 0 0.00% • unchanged
feedback claude_precision 1 1 0 0.00% • unchanged
feedback claude_recall 1 1 0 0.00% • unchanged
feedback claude_polarity_flips 0 0 0 0.00% • unchanged
feedback opencode_precision 1 1 0 0.00% • unchanged
feedback opencode_recall 1 1 0 0.00% • unchanged
feedback opencode_polarity_flips 0 0 0 0.00% • unchanged

Plugin surface

No surface changes.

No regressions.

@itlackey itlackey merged commit 34c3871 into release/0.9.0 Jul 5, 2026
2 checks passed
@itlackey itlackey deleted the improve/shutdown-opencode-capturememory branch July 5, 2026 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant