Dashboard › opencode › Distillation
ec67d0be-8d2c-4211-9b88-4ffdf01957d0["lore_tm_v1_16h7lASdyb8RzPkMoQZtKM6N6nvV8jnerrkpCmC5w1s"]
Date: Sep 14, 2026
/home/byk/Code/opencode/packages/core/src/session/context-epoch.ts lines 45-144. Lines 46-48 concurrently load context, find(db, sessionID), and SessionHistory.latestCompaction(db, sessionID) with { concurrency: "unbounded" }./home/byk/Code/opencode/packages/core/src/session/context-epoch.ts, when no stored context epoch exists, lines 50-53 call SystemContext.initialize(value), persist it via insert(db, sessionID, generation), and return { baseline: generation.baseline, baselineSeq }.Schema.decodeUnknownEffect(SystemContext.Snapshot)(stored.snapshot); decoding errors become ContextSnapshotDecodeError({ sessionID, details: String(error) }).replacementSeq only when compaction.seq > stored.baseline_seq, uses SystemContext.replace(value, snapshot) when replacement is applicable and otherwise SystemContext.reconcile(value, snapshot), retains the stored baseline for "Unchanged" or "ReplacementBlocked", and persists result.generation via replace(db, sessionID, baselineSeq, result.generation) for "ReplacementReady"./home/byk/Code/opencode/packages/core/src/session/context-epoch.ts lines 72-76 publish SessionEvent.ContextUpdated with { sessionID, messageID: SessionMessage.ID.create(), timestamp: yield* DateTime.now, text: result.text }; its deferred commit callback is { commit: () => advance(db, sessionID, result.snapshot).pipe(Effect.orDie) }.initializeOnce at lines 80-89 exits if exists(db, sessionID) is true; otherwise it initializes context with context.pipe(Effect.flatMap(SystemContext.initialize)), inserts the generation, and returns { baseline: generation.baseline, baselineSeq }./home/byk/Code/opencode/packages/core/src/session/context-epoch.ts: exists selects SessionContextEpochTable.session_id; find selects the full row; exported reset deletes by session_id; insert obtains EventV2.latestSequence(db, sessionID) and stores session_id, baseline, snapshot, and baseline_seq.