audit: canonical dump as committed truth; db demoted to gitignored cache; restore

This commit is contained in:
2026-11-11 17:58:39 +00:00
parent e0b384f858
commit 1dcdc917d2
6 changed files with 115 additions and 11 deletions
+26 -6
View File
@@ -25,8 +25,8 @@ forget; files don't — so the file must be shaped to forget too.
window. Reads the transcript and the rendered rings; emits a **manifest** of
semantic operations. Judgment, no clerical work.
- **`tool/memory.mjs` = the clerk.** Validates and applies manifests,
maintains the database, enforces caps, renders views, writes the log.
Fails loudly, never drifts silently.
maintains the database, enforces caps, renders views, writes the log,
dumps canonical state. Fails loudly, never drifts silently.
## Scope
@@ -140,9 +140,26 @@ minors, gratuitous violence. These live in `system.md`; edit them there.
## Housekeeping
This directory is a git repo. Every housekeeping pass should end in a commit
— the diff over `canon/`, `log/`, and `manifests/` is the classification and
drift record. No model touches git; the human commits.
This directory is a git repo. Every housekeeping pass should end in a commit.
The **primary audit surface is `dumps/memory.sql`** — the canonical dump:
id-ordered, one row per line, auto-written by every mutation. Because the
ordering is by id, diffs are position-stable — a touch is one changed line,
a promotion is one changed line, an eviction is one changed line. Diffing
two consecutive dumps reconstructs exactly the operations that were applied,
including overflow and everything in cold storage.
Cross-check it against the window's log: the log is what the housekeeper
*declared*, the dump-diff is what *actually happened*. Any disagreement is
either a tool bug or a hand edit — and hand edits have a contract: all
mutations go through the tool, so the dump never drifts. (If you ever poke
the db with a sqlite browser, run `dump` afterwards and confess in the
commit message.)
The dump is restorable SQL and the **committed truth**; the binary
`db/memory.db` is a gitignored local cache — fresh clone:
`node tool/memory.mjs restore`. The `canon/` views stay committed as
provenance — exactly what the models were sent — and `log/` + `manifests/`
remain the human-readable record.
The housekeeper may be a different model than the player — cheaper, or more
pedantic, whatever housekeeping needs. The two prompts are independent.
@@ -161,7 +178,10 @@ tool/
memory.mjs the clerk: init, render, apply, insert, delete, revive, status
db/
schema.sql entries + append-only events journal
memory.db the state (SQLite; binary — diffs live in canon/ and log/)
memory.db the state (gitignored local cache — rebuilt via restore)
dumps/
memory.sql canonical dump (GENERATED): id-ordered, restorable SQL —
the committed truth and primary diff/audit surface
manifests/ housekeeper manifests, one JSON per window (diffable)
canon/
ring-a.md GENERATED view: important facts, MRU-ordered