Skip to main content

Module sqlite_store

Module sqlite_store 

Source

Structs§

ActiveSession
A top-level Claude Code session with transcript lines in a window.
AgentNote
What an agent records about its own session. Stored as the content of an agent-note memory in the text render writes, which parse reads back, so the fields survive sync and redaction without a column of their own.
ArchivedRaws
Archived raw memories split at an age bound, each side newest first.
ChunkWork
A live memory whose stored chunk set is missing or no longer matches its content: the chunks to embed and the hash store_chunks must be handed back so a set split from since-changed content is refused.
Corrected
IndexableMemory
IngestedSession
KindCounts
MemoryChunk
OutboxRow
ReadDeadline
Bounds the wait for a pooled read connection on this thread until the guard drops: a read that finds the pool empty waits at most until deadline, then opens a connection of its own, which closes on drop. That open is bounded by BUSY_TIMEOUT, not by the deadline, and if it fails the read waits for the pool as an unbounded read would. Thread-local because every store read takes a connection through reader() and a recall’s reads all run on the one thread that holds the guard; the guard is not Send, so it cannot be dropped on another.
RedactionReport
RedactionRun
SkippedRow
A row the pass could not parse. Its text was redacted in place (a chunk row was deleted) without syncing or re-embedding it. row is rowid N, local_seq N for sync_log, or from_id/to_id/relation_type for relations; it and reason are redacted, since a corrupt value or an error message can echo a secret.
SqliteStore
Every write (via with_txn or a direct execute) goes through writer, the single connection WAL reserves for the one process-wide writer. Reads go through readers: a pool of separate connections in file-backed mode, or the same connection as the writer for in_memory, where a second connection would just see an empty, unrelated database.
VacuumSpace
Free space against what a VACUUM of this store needs, on the filesystem with the least room to spare.

Enums§

CorrectRefusal
NoteKind
RawMemoryState
What became of the raw memory a transcript passage was cut from.
RedactionPhase
Where the one-time pass over stored content stands. A cursor is the last rowid its phase finished, so a restart resumes after it. Relations have no rowid, so that phase restarts from the top; redacted rows no longer match, which makes the rescan cheap and the outcome the same.
RetireOutcome
Store-side shape the index drainer consumes; body is context + content, the same text the embedding was computed over.
RewriteOutcome

Constants§

BASELINE_VERSION
The user_version of a store created by schema.sql alone, before any ladder step. Stores that old carry no schema_migrations table.
NOTE_COVERED
The distillation_log status of a raw retired because an agent note covers its session, so no LLM ever saw it.
SCHEMA_VERSION
Derived from the ladder length, not hand-maintained: bumping the schema means appending to MIGRATIONS, never editing a version number here.
TRAVERSE_MAX_RESULTS
Cap on what one traverse call returns. The walk also stops expanding after TRAVERSE_MAX_WALK (id, depth) pairs, because a hub entity can connect one memory to tens of thousands and the context pack that asks only shows a handful.