Dashboard › opencode-lore › SQLite initialization and connection-lo…
01a09fd3-4d4a-77e4-ae50-2616c4f32a84Initialize 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.