Skip to main content

Module memories

Module memories 

Source
Expand description

Persistence layer for the memories table and its vector companion.

Functions here encapsulate every SQL statement touching memories, vec_memories and the FTS5 fts_memories shadow table. Callers receive typed MemoryRow or NewMemory values and never build SQL strings.

Structs§

MemoryRow
Fully materialized row from the memories table.
NewMemory
Input payload for inserting or updating a memory.

Functions§

delete_vec
Deletes the vector row for memory_id from vec_memories.
find_by_hash
Looks up a live memory by exact body_hash within a namespace.
find_by_name
Finds a live memory by (namespace, name) and returns key metadata.
fts_search
Executes a prefix-matching FTS5 search against fts_memories.
insert
Inserts a new row into the memories table.
knn_search
Runs a KNN search over vec_memories restricted to a namespace.
list
Lists live memories in a namespace ordered by updated_at descending.
list_deleted_before
Fetches all memory_ids in a namespace that are soft-deleted and whose deleted_at is older than before_ts (unix epoch seconds).
read_by_name
Fetches a live memory by (namespace, name) and returns all columns.
read_full
Fetches a live memory by primary key and returns all columns.
soft_delete
Soft-deletes a memory by setting deleted_at = unixepoch().
update
Updates an existing memory optionally guarded by optimistic concurrency.
upsert_vec
Replaces the vector row for a memory in vec_memories.