Dashboard › opencode › Distillation
d4e62f25-cc79-4e3d-84c4-82b47c7dd528["lore_tm_v1_P82vwCxoslDlcIPvl00GhgARYCtgCSaHSTnBfKP-sOw","lore_tm_v1_6detCB9IBcyBxJcvlEvm7gRLOMtdFr5wxbDLwlHH1Vc","lore_tm_v1_c9ykb1lreLg4f84mRNCJH2gWKMojHssWKyn9owOdeTI","lore_tm_v1_jCa64Ehre36upVOh7M2mkoQFOEaJk35aY-DwitCEvZo"]
Date: Sep 16, 2026
/tmp/opencode/session-recovery-v7-check/packages/core/src/session/context-epoch.ts, SessionContextEpoch.initialize() and SessionContextEpoch.prepare() require a SessionExecutionClaim.Claim, and epoch writes are fenced through SessionExecutionClaim.transaction(...).SessionContextEpoch.prepareOnce() concurrently loads the current SystemContext, stored epoch, and SessionHistory.latestCompaction(...); without a stored epoch it initializes context and inserts a baseline, while an existing epoch is decoded with SystemContext.Snapshot and decode failures become ContextSnapshotDecodeError.stored.baseline_seq as replacementSeq: it calls SystemContext.replace(...) when such a sequence exists and SystemContext.reconcile(...) otherwise. Unchanged and ReplacementBlocked preserve the stored baseline; ReplacementReady replaces the baseline and snapshot; an incremental update publishes SessionEvent.ContextUpdated and advances the snapshot in its commit callback./tmp/opencode/session-recovery-v7-check/packages/core/src/session/context-epoch.ts stores baseline, snapshot, and baseline_seq in SessionContextEpochTable; insert() derives baselineSeq from EventV2.latestSequence(...), while replace() and advance() die with Context Epoch not found if no row is updated./tmp/opencode/session-recovery-v7-check/packages/core/src/session/compaction.ts defines compaction defaults DEFAULT_BUFFER = 20_000, DEFAULT_KEEP_TOKENS = 8_000, TOOL_OUTPUT_MAX_CHARS = 2_000, and SUMMARY_OUTPUT_TOKENS = 4_096; document configuration can override auto, buffer, and keep.tokens, with later configured values reducing over earlier ones.## Objective, ## Important Details, ## Work State with ### Completed, ### Active, and ### Blocked, then ## Next Move with exactly two numbered placeholders, and ## Relevant Files. Rules require every section, terse bullets, preservation of exact paths/symbols/commands/errors/URLs/identifiers, and no mention of compaction or the summary process.SUMMARY_UPDATE_INSTRUCTIONS requires combining <prior-summary> with newer <conversation> content, carrying forward objectives, constraints, directives, decisions, and parallel workstreams unless finished and no longer needed; newer conversation wins conflicts, completed work moves from Active to Completed, resolved blockers are updated, and Objective/Next Move reflect current state.[User], [Assistant], [Assistant reasoning], [Assistant tool call], [Tool result], [Tool error], [System update], [Synthetic context], or [Shell]; attached content is represented by MIME type and optional name, and oversized tool or shell output is cut to exactly 2_000 characters followed by \n[truncated].compaction, walks backward to retain up to the configured recent-token budget, and divides serialized history into head for summarization and recent for direct retention.SessionCompaction.compactIfNeeded() only auto-compacts when enabled and estimated { system, messages, tools } exceeds context - Math.max(output, config.buffer); SessionCompaction.compactAfterOverflow() refuses compaction for missing/nonpositive context limits, absent summarizable history, or a summary prompt larger than context - summaryOutput.SessionCompaction.compactAfterOverflow() publishes SessionEvent.Compaction.Started with reason: "auto", optionally runs beforeStream, invokes the LLM with no tools and maxTokens capped at 4_096, collects textDelta chunks, treats provider errors, LLM.Error, or blank output as failure, and on success publishes SessionEvent.Compaction.Ended with the generated text, retained recent history, and optional commit callback.