records: queryable file tier, diegetic per-run gate, narrow search with hard cap

This commit is contained in:
2026-11-11 18:30:29 +00:00
parent 57e8718ffa
commit b77a0de527
13 changed files with 277 additions and 49 deletions
+1
View File
@@ -1,6 +1,7 @@
<!-- GENERATED by tool/memory.mjs render — do not edit by hand. -->
<!-- A view of db/memory.db, ring A, ordered by last touch: top = most recent. -->
<!-- Policy lives in housekeeper.md; the models never write here. -->
<!-- Records: none — this character keeps no files to consult. -->
# Ring A — what matters
+1
View File
@@ -1,6 +1,7 @@
<!-- GENERATED by tool/memory.mjs render — do not edit by hand. -->
<!-- A view of db/memory.db, ring B, ordered by last touch: top = most recent. -->
<!-- Policy lives in housekeeper.md; the models never write here. -->
<!-- Records: none — this character keeps no files to consult. -->
# Ring B — what stuck anyway
+20 -5
View File
@@ -2,8 +2,11 @@
-- one row per line; entries and events ordered by id; restore with: restore
PRAGMA foreign_keys = ON;
-- ids are AUTOINCREMENT: rows can move between entries and records
-- (archive / unarchive), and ids must never be reused — journal targets
-- stay meaningful forever.
CREATE TABLE IF NOT EXISTS entries (
id INTEGER PRIMARY KEY,
id INTEGER PRIMARY KEY AUTOINCREMENT,
ring TEXT NOT NULL CHECK (ring IN ('a', 'b', 'cold')),
type TEXT NOT NULL CHECK (type IN ('place', 'person', 'fact', 'thread')),
label TEXT NOT NULL,
@@ -15,12 +18,24 @@ CREATE TABLE IF NOT EXISTS entries (
CREATE INDEX IF NOT EXISTS entries_ring_touch
ON entries (ring, last_touched DESC, id DESC);
-- append-only audit journal; nothing here is ever updated or deleted
-- the character's files: cards, ledgers, manifests.
-- detailed, queryable, never bulk-loaded into context.
-- access is diegetic and per-run: runs/<story>/settings.json {"records": bool}
CREATE TABLE IF NOT EXISTS records (
id INTEGER PRIMARY KEY AUTOINCREMENT,
kind TEXT NOT NULL,
label TEXT NOT NULL,
detail TEXT NOT NULL DEFAULT '',
created TEXT NOT NULL
);
-- append-only audit journal; nothing here is ever updated or deleted.
-- target is 'e<id>' for entries, 'r<id>' for records.
CREATE TABLE IF NOT EXISTS events (
id INTEGER PRIMARY KEY,
id INTEGER PRIMARY KEY AUTOINCREMENT,
window TEXT NOT NULL,
op TEXT NOT NULL CHECK (op IN ('insert', 'touch', 'promote', 'demote', 'reword', 'delete', 'evict', 'revive')),
entry_id INTEGER NOT NULL REFERENCES entries (id),
op TEXT NOT NULL CHECK (op IN ('insert', 'touch', 'promote', 'demote', 'reword', 'delete', 'evict', 'revive', 'record', 'archive', 'unarchive')),
target TEXT NOT NULL,
reason TEXT NOT NULL DEFAULT ''
);
+3
View File
@@ -0,0 +1,3 @@
{
"records": false
}