Dashboardopencode-loreSQLite initialization and connection-lo…

SQLite initialization and connection-local sync capture

Category: architecture
Confidence: 1.00
ID: 01a09fd3-4d4a-77e4-ae50-2616c4f32a84
Project ID: 6f4be9ff-ed84-4cca-a9e7-732a0b0b8677
Cross-project: No
Recalled in other projects: 0
Source session: 0ax0UcO24ScS2D2Ts
Created: 2026-09-02 22:51:25
Updated: 2026-09-14 12:10:20

Content

Initialize raw SQLite completely before tracing or publishing the singleton so migrations and trigger setup cannot become re-entrant and failed initialization can retry. Register lore_current_tenant, preflight FTS5, migrate, install sync capture, load sqlite-vec, recover authoritative vec0, then enable tracing and publish. Sync capture uses connection-local TEMP triggers and TEMP _sync_applying depth state because gateway and CLI processes share the database; a persistent suppression flag could hide another process’s legitimate writes. lore_current_tenant() must resolve live AsyncLocalStorage state for every statement, and TEMP triggers must be installed on every initialized connection.

Move to: