Expand description
Append-only SQLite log for KernelEvent records — Phase 3a double-write.
§Purpose
Written by the double-write adapter during Phase 3a; not yet read by any production code path. Phase 3b will add the projection/replay consumer.
§Schema (additive, backward-compatible)
CREATE TABLE IF NOT EXISTS kernel_events (
id INTEGER PRIMARY KEY AUTOINCREMENT,
seq INTEGER NOT NULL,
ts_ms INTEGER NOT NULL,
kind TEXT NOT NULL,
turn_id TEXT, -- NULL only for schema_version sentinel
payload TEXT NOT NULL -- JSON-serialised KernelEvent
);Adding columns in future schema versions: ALTER TABLE ADD COLUMN … DEFAULT ….
Removing columns: increment schema_version and provide an upcast script.
§WAL / performance
Inherits the WAL-mode connection from open_sqlite_session_db. Each
KernelEventLog::append call is a single INSERT; callers may batch via
append_batch to amortise transaction overhead.
Structs§
- Kernel
Event Log - Append-only writer for the
kernel_eventstable.
Functions§
- ensure_
kernel_ events_ table - Ensure the
kernel_eventstable and index exist. Safe to call on every startup — usesCREATE … IF NOT EXISTS.