Repository navigation
Conversation
…estroy that keeps a cache The reset at main empties an instance: it deletes the raw store, the catalog, the attestations, the version chains and the verdicts with the derived stores, so the transcripts whose only copy is raw are lost, and it leaves the lexical index and the relation edges behind. This note classifies every store an instance writes as a ledger, an owner's declaration, a derived store with its rebuild, model output or operational state, and designs a reset that clears the derived stores and rebuilds them from raw and the ledgers in a fixed order, keeping everything else byte for byte. It also designs a retention ledger for the chat sensor, without which a kept raw store makes the sensor skip every transcript it has seen; a heal in the writer that re-derives a stale lexical index before any landing; a destroy for named instances that leaves a shared cache of open content (raw objects by digest, vectors by embedder and atom, downloaded sources) that a purge reaches; and the corpus instance at its own root. The proposals are listed as decisions for the owner, and the properties the build must test are listed for part B. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The chat sensor kept each transcript in the raw store and extracted it only when the raw store reported the bytes new, and recorded nothing else. With the raw store kept through a reset, every transcript still on disk would read as unchanged and nothing would rebuild the chat log; a transcript the CLI had pruned would never be read again. The sensor now appends each transcript it retains to an append-only ledger (`data/chat_retention.sqlite`), before it extracts anything, and the ledger's row is the change signal, which also closes the window in which a crash between retention and extraction left a transcript skipped. `ChatSensor.rebuild` replays the ledger in retention order through the same parse, guard and landing, reading the bytes back from the raw store. A chat log that predates the ledger seeds it once, one row a transcript digest, ordered within a session by the lowest turn it wrote, so the replay of the seed gives back that chat log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A lexical index whose units another tokenizer made refuses to land, and the embed job that would re-derive it is enqueued only after a landing succeeds. On 2026-11-11 this stopped every repository sync of the code instance until the index was re-derived by hand. `Writer.land`, which every landing passes, now resets such an index and lands every active item of the lexical classes again under the current tokenizer before it prices the plan, timed as the `rederive` stage of the receipt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… by atom `core/stores/cache.py` is the cache at `~/.mind-palace/cache`: raw objects by digest, vectors by embedder key and atom, downloaded source files with a manifest, the digests a purge erased, and when each entry was last taken, for a prune after 180 days. An entry carries no path, title or class, and reading never creates the cache. Three readers take entries back. The raw store, on a miss, takes an object whose bytes hash to the digest asked for and copies it in (`RawStore.fallback`). The vector drain looks an atom the plane lacks up under the instance's key before it calls the embedder and counts it as `cached`, keeping only a vector of the plane's width. `with_cache` wires both onto the writer's stores, and the embed job uses it. A purge, before it deletes the raw object, derives its chunks again and removes the object and every atom's vector from the cache under every key, then records the digest so no fill puts it back; `scripts/purge_raw.py` passes the shared cache. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…roy that keeps a cache The reset at main deleted the raw store, the catalog, the attestations, the version chains, the verdicts and the queue with the derived stores, losing the transcripts whose only copy was raw, and left the lexical index and the relation edges behind. It is replaced. `ops/lifecycle/inventory.py` is one table of every store an instance writes, each a ledger, a declaration, a derived store with its rebuild step, kept model output, or operational state; `reset_targets` and `_RESET_GUARD` are gone. `ops/lifecycle/rebuild.py` clears the derived stores and rebuilds them in order: the lexical index; the plane's occupancies, keeping its atoms so no embedder is called while they are held (`SharedPlane.reset_relations`, `drop_unheld`); the code and agent observations, re-projected without the attestor; the authored relation edges, parsed from raw by catalog digest (`relations.rebuild_authored`, `EdgeStore.delete_provenance`); the chat log from the retention ledger; the chat events; the causal edges; the verdict dispositions. It runs under the supervisor lock behind `data/reset.pending`, which makes the daemon's start and every on-demand writer refuse until the last step has run, and a second `reset --confirm` finishes an interrupted one. It refuses a live daemon, the lock held, and an embedder whose geometry is not the plane's. The membership store is kept: it holds the code atoms' embedder ledger beside their occupancy. `palace destroy` removes a named instance, never the default one, after filling the shared cache with its open content (`ops/lifecycle/destroy.py`): the raw objects, plane vectors and downloaded stream files of the open-corpus sources, the repository sources and the curated class. It refuses a live run, the lock held, an installed LaunchAgent, a root in a git working tree, the home root, a root that holds the cache or a symbolic link out of itself, and a volume without room. `palace cache` reports the cache, `cache fill` fills it without removing anything, `cache prune` removes what was not taken for 180 days; all are dry runs unless confirmed. The four tests that read the old target lists now read the class table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`config/instances/corpus.toml` declares `[instance] root = "~/.mind-palace/instances/corpus"`, where the data was moved on 2026-11-11; its old location in the corpus stage-1 worktree is a symbolic link to it, and the loader refuses a declared root inside a working tree, so the corpus can no longer land in a checkout. The design note, the stage-1 report and the defaults' comment say where the data lives. `scripts/corpus.py fetch` copies a source stream the shared cache holds into an empty source before the edge reader resumes it, and `ingest` refuses while a reset is pending and takes vectors and raw objects from the cache. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n fixture palaces A fixture palace exercises every lane: notes with an authored and an interpreted relation edge and a superseded version, open-corpus items, a repository landed lexically and read by the code sensor, transcripts through the chat sensor (one grown, one held by the guard, one with a commit the integrator resolves), signed verdicts and an attestation trail. The tests check the properties of dn-instance-lifecycle §8: the class table covers every store written; a reset keeps raw and every ledger, declaration and kept store, writes no attestation, converges to each derived store's head, rebuilds the chat log with the transcript directory emptied, builds no embedder, and is idempotent; the dry run writes nothing; a live run, the lock held and a changed geometry refuse; a failure at each of the nine steps leaves the marker, makes the daemon and the repository sync refuse, and a second reset converges; a repository sync and a vault landing succeed over an index left stale by the legacy tokenizer; destroy's refusals write nothing and a confirmed destroy leaves exactly the open classes in the cache; a cached vector is reused without the embedder under the same key only; a raw object is taken by digest and a corrupted entry refused; a purge reaches the cache and a later fill does not put it back; the corpus overlay resolves to its own root. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d cache The runbook's quick reference and the one-command lifecycle said `reset --confirm` wiped the corpus; it now rebuilds the derived stores and loses nothing. A section of its own describes the reset, the marker, the stale-index heal (and that the corpus instance's index will be re-derived at its next landing), destroy, the cache's commands and readers, and the corpus at its own root. The 2026-06-29 fresh start is recorded as the reset's old behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The note records where the build departs from it: the membership store is kept, since it holds the code atoms' embedder ledger; code membership vectors do not enter the cache; the cache is wired by `with_cache` where the drain runs, leaving the ingress to its open pull request; a source stream is reused when the instance's is empty; a derived instance root may be destroyed; a step whose input is absent writes nothing; a cached vector of another width is never landed; and the corpus's lexical index predates the recorded tokenizer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… as it was Four gaps the audit of the reset found, each with a test that fails without its fix: - A retained transcript whose raw object a purge erased stopped the chat log's replay after the clearing, on every rerun. The replay now skips it and counts it as purged, so the reset finishes and the chat log comes back without that transcript. - A commit the commit ledger holds that the repository has since pruned failed the code observations' re-projection after the clearing. The reset now checks that input first and refuses with nothing written. - The plane step drained every pending item, so on a lazy instance the reset embedded the backlog. It now re-occupies only the (path, digest) pairs the plane held current before the clearing, kept in the marker for a rerun, and the dry run counts the atoms the atom table lacks and the items with no vector. - clear() checks that every store it clears lies under the data directory. The fixture now writes an interpreted artifact, a queued job, a dream run, a claim operation and a staged hypothesis, so P2 sees a reset that deletes any of them. New tests cover the atom table after the rebuild, the vector width filter and the backend in the vector key. The chat sensor's comment no longer claims the ledger closes a crash window it does not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fill files vectors under their own key What the audit of destroy and the cache found, each with a test that fails without its fix: - destroy removed whatever lay under the root. It now refuses a root with a top-level entry no namespace of the instance names, an entry of its data directory the class table does not name, a git repository anywhere below it, or another declared instance's root at, inside or around it. The dry run lists the root's top-level entries. - A fill or a destroy after a change of embedder in the overlay filed the plane's vectors under the new embedder's key. Both now refuse unless the configured geometry is the one the plane recorded. - The fill plan held every vector as a Python list, dry run included. It now counts atoms, and the fill reads and writes the vectors 2,048 at a time. - The destroy dry run created data/supervisor.lock. It now probes the lock read only (`lock.held_elsewhere`) and takes it only when confirmed; its test compares every file's size and mtime under the home. - The cache records its uses and its purged digests to the day, not the second. - `take_source` refuses a manifest row whose name is absolute or climbs out of a directory. P12 now writes its expectations from the fixture's lanes by path and class, adds a dialogue turn, a model's reply, an inbox item and a curated item, and requires the cached source files to equal the stream's downloaded files. P15 fills a second vector key before the purge. The named fixture reads its vault and transcripts from outside its root. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ved reset lists Seven store modules still said they joined `reset_targets()` or sat in `_RESET_GUARD`, both removed by the lifecycle reset. Each now gives its class in `ops/lifecycle/inventory.py` and what a reset does to it; the reference edges are a ledger the reset keeps (decision D3), not a wipe target. The self sensor's class test is renamed to what it checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The note now says what the build does after the audit. §4.2 and §4.6: the plane step re-occupies only what the plane held, and the dry run counts the atoms the atom table lacks and the items with no vector. §4.3 and §4.5: a rerun finishes because a missing ledgered commit refuses before the clearing and a purged transcript is skipped. §6.1: destroy's new refusals, and a dry run that takes no lock. §6.4: a cache lookup does write, the day of the use, and `purged.sqlite` holds digests of private content, with why that is kept. §6.5: a fill files vectors only under the plane's geometry; the backend is not recorded. §7: the corpus's fill is batched and not yet measured, and the corpus is read with `immutable=1`. §10 gains items 9 to 15, §9 gains D14 for the kept membership store, and the mentions of the membership rebuild are marked as replaced. §1.2 items 2 and 4 are graded as the proposals D11 and D12. The status lines agree, and open question 3 carries the measured counts, with a new open question 4. The runbook section matches, offers no corpus fill until it is measured, and the new headings, like the class table's docstring, use no dash pauses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The article now describes the reset's preflight, the purged-transcript skip and the plane step that re-occupies only what the plane held; destroy's refusals of a root holding anything but the instance's own state, the geometry check before a fill, and the batched fill; and the 45 tests. The retention ledger's crash window is narrowed to what it closes. The memo is a constructive trace and, shared, a cloud build in Mokhov et al., not a verifying trace with early cutoff. Venti's pages are 89 to 101, as its record gives. The corpus query time is the read-only rerun's, 17.1 s at a load average of 2.46, scored under the legacy tokenizer, with the earlier check's sidecar files stated. It builds to 6 pages with no warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…or mypy The lambda used `list.append`'s value, which mypy reports (func-returns-value) and which put the tests' baseline at 68 errors instead of 67. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The plane step re-occupied only catalog heads the plane held, so on a lazy instance a note edited after it was embedded lost its occupancy in a reset and its old atom was dropped, while the dry run counted it as re-occupied. The marker now records each held occupancy with its title and class, and the step rebuilds it from raw at the held digest. The dry run says how many held items are older than the catalog's head and counts the items whose current version holds no vector. The lazy backlog test covers the edited note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… as its own open question The note, the runbook and the article say the plane step rebuilds each held occupancy from raw at the digest the plane held, the catalog's head or not, and the note's dry run counts the held items older than the head. Section 6.5 cited open question 1 for recording the backend, which is about the model file; a new open question 5 says the plane does not record the backend, that a change of backend alone is not caught before a fill, and names the plane schema change that would catch it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t has no secret for The landing log (#92) is two tables in the catalog's own file, so a reset that keeps the file keeps the log, and no rebuild step may append to it: each step reads the catalog's active rows and nothing else. The tests now check it: a reset keeps every row of the log and each chain's head hash, two resets and an interrupted one append nothing, and a healing sync's one new row is its own landing. Three rebuild steps open the catalog (`OPENS_CATALOG`; a test records every open), after the clearing. On a catalog with rows and no log that first open writes the log's genesis, which needs the instance's secret, and without it the open refuses after creating the log's two empty tables. The reset now finds that case read only before anything is written and refuses, naming the item the process reads (P17); with the secret the genesis is written at that open and the catalog's rows stay as they were. Under a named instance loaded through its overlay the item is `<id>.landing-log-key`, the default instance's does not serve, and a reset of a catalog that has its log needs no secret at all. A destroy reads the catalog read only and removes it whole, log included, so it needs no secret. Nothing of the log reaches the cache: P12 and P17 search every cache file for each chain's secret half, each row's key, commitment and hash, and the secret. The destroy's dry run now names `<id>.landing-log-key` among the Keychain items it leaves, which the namespaces' list omits. A `mode=ro` read of a SQLite file at rest creates its `-wal` and `-shm`, so destroy's dry run created files on an idle instance; its test passed only because the fixture held the stores open. The lifecycle's readers now go through `read_only`, which reads a file with no `-wal` beside it `immutable=1`, and P11 runs on an idle instance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… base The note's passages written while #92 was open now describe the merged state. §3.6 is the catalog and its landing log: the reset keeps the file whole, the log in it, and appends nothing; three steps open the catalog and none writes it; the one write is the first open's genesis on a catalog with rows and no log, which needs the secret, so the reset checks for that case read only and refuses without it. What stays a follow-up is named there: the catalog's rows as the log's fold, and every version rebuilt from a replay of the log. Decision D2 stays a proposal and now covers those two. A new §4.7 says what each command needs of the secret, for the default instance, a named one and the corpus; §6 says that a destroy needs none, removes the log with the catalog, lets nothing of it into the cache and names `<id>.landing-log-key` among the items it leaves. §7 says why the corpus is read with `immutable=1` and never through `VaultCatalog`, with the read-only check run again over the whole root. §8 extends P2, P6, P10, P11 and P12 and adds P17; §10 records part C's changes and what the code showed; LCF-7 and a sixth open question are new. The runbook's lifecycle section says the same for the operator, with the commands for a named instance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The article no longer speaks of the landing log as pending. The catalog's file holds the log, a ledger the reset keeps whole and appends nothing to; the reset reads the catalog read only before it writes its marker and refuses when the first open would write the log's genesis without the instance's secret; a destroy needs no secret, removes the log with the catalog and lets none of it into the cache. The evaluation adds the tests of the log, and the corpus check is the one run on the rebased tree, over the whole root. The limitations name what stays a follow-up: every version from a replay of the log, and the catalog's rows as its fold. It builds clean, seven pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
P11's dry run is checked on an instance at rest, with no SQLite file but the launcher's run ledger keeping its `-wal` and `-shm`. The test dropped the fixture's stores and let the garbage collector close them, which passed alone and failed in the tier: under coverage the collector finalizes those connections without SQLite removing their two files, so the catalog's, the lexical index's and the plane's stayed. The fixture now closes each store it holds (`close_stores`), and the test passes with and without coverage; a destroy reader opened `mode=ro` still fails it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The deterministic tier as `.github/workflows/ci.yml` runs it, on this branch rebased onto main with the landing log: 3,769 passed, 11 skipped, 21 deselected. That is main's 3,721 and the 48 tests of `tests/integration/test_instance_lifecycle.py`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and the cache A reset finds, before it writes its marker, every input that would stop it the same way on every rerun: a derived store outside the data directory is now among them, beside the ledgered commit and the landing log's secret. The plane step reads no catalog row, so it no longer opens the catalog (OPENS_CATALOG is the lexical index and the authored relation edges), and it skips and counts a held version whose raw object a purge erased, so a purge between an interrupted reset and its rerun no longer fails every rerun. The reset reads the plane's geometry read only, and when a reset is pending under a changed embedder its refusal says to finish the reset under the plane's embedder first, since reembed refuses while the marker stands. These scripts, which land or write a store the reset rebuilds, now read the marker first: purge_raw, ingest_self_knowledge, mint_ids, corpus.py embed, watch, migrate_chunk_keys, migrate_provenance_split and reembed_bodyonly. The writers this list missed (the founding ingest, the code and self sensors, verdict submit, the review loop, the talk loop and the plane migrations) are covered by a later commit. The cache refuses a source file that is not a plain file of its source (a symbolic link, a hard link, a file that resolves out of it), and destroy and cache fill refuse one before they write anything, so a link cannot carry the catalog's file or a note into the cache. Destroy's dry run names the sources it leaves outside the root and those it removes with it, with the files of theirs the cache does not take. The dry runs and refusals of reset, destroy and cache fill write nothing through the command: build_launcher's run ledger is opened at its first write and read only before that, so a root that does not exist is not created, and read_only reads a store whose -wal is empty with immutable=1, so a leftover empty -wal no longer has its -shm rewritten. Tests: the dry run at rest (P6), a store outside the data directory (P7), a purge while a reset is pending, a changed embedder while one is pending, every writing script (P9), a linked source file (P12), the commands' dry runs in a process of their own on a root at rest with an empty -wal and on a missing root (P11), and P17's dry run with the secret at hand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d two comments lose a dash The lifecycle package's docstring still called `reset` the fresh-start wipe this branch replaces; it now says what reset and destroy do. A comment of the chat sensor and a test's docstring, both rewritten by this branch, carried a dash pause from the text they replaced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The note's citations are lines of the base, 8d4dff3: the six that had moved since 0a5fba2 (perform and the receipt's timing, the query log's name, the version chains, the key writes and Writer.link) are cited at their new lines, and the header names them. The rebuild writes no ledger but the landing log's genesis on a catalog with rows and no log yet, and every byte-for-byte claim says so. Two steps open the catalog; the plane step does not. What the reset excludes is stated as it is: the marker refuses a writer that starts while it stands, the lock only the writers that take it, and an on-demand writer that takes no lock and started before the reset is not excluded (open question 7). The preflights now include a derived store outside the data directory, and the plane step skips a held version a purge erased while a reset was pending. The dry runs write nothing through the command, the run ledger and an empty -wal included. A source file that is a link enters no cache; destroy's dry run names the sources it leaves and those it removes, whose whole downloads under raw/ the cache does not take. The corpus: its raw store is 387,838 objects of 1,003,892,779 bytes (the whole root is 18,949,782,338), and a fill's plan counts 1.0 GB of raw objects, 1.37 GB of source files and 8.2 GB of vectors; a destroy refuses as the root stands, since the corpus tooling writes files at the root no namespace names (open question 8). The heal's change to writer.py is listed whole, and §10 records the build's departures from this round as items 21 to 26. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two steps open the catalog, and the plane's does not. The marker refuses a writer that starts while it stands, and an on-demand writer that takes no lock and started before the reset is left open; a store outside the data directory refuses before the marker, and a held version purged before a rerun is skipped. The dry runs write nothing, run as commands too, and a source file that is a link enters no cache. The evaluation counts 62 tests and names the new ones; the corpus query's top hit is the article Superconductivity; Proposition 1 defines the atom's layer; the limitations give the corpus fill's plan and the destroy that refuses as the corpus root stands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hand where no reader does The test of `palace destroy`, `reset` and `cache fill` as commands needs a catalog with an empty -wal beside it, the state a mode=ro reader leaves on this platform. Where a reader leaves none, the test now writes the empty -wal itself rather than failing on its precondition. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pus fill's disk use The note's convergence guarantee names both purges the rebuild comes back without: a transcript, and a version the plane held that a purge erased while a reset was pending. The corpus's raw store takes about twice its bytes on disk, one file per object in whole blocks (the stage-1 record's 2.0 GB of allocated blocks against 1,003,892,779 bytes), so the note and the runbook say a fill's plan counts bytes and its disk use is not measured. The note's destroy section keeps the landing log's item beside the Keychain items it belongs to. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The deterministic tier as ci.yml runs it: 3,783 passed, 11 skipped, 21 deselected (main's 3,721 and this branch's 62 lifecycle tests, 14 of them new with the audit of the rebase). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ds the reset's marker The founding ingest, the code and self sensors' syncs (which the post-commit hook runs on every commit on main), `verdict.py submit`, the review REPL, the live talk loop (which lands what the inbox kept when no daemon is live) and the swap of the two plane migrations wrote into an instance whose reset was pending: a founding item landed in that window kept its catalog row and lost its vectors at the rerun, and the code sensor synced the repository's whole history beside the marker. Each now refuses while the marker stands, before it opens anything; the migrations' dry runs, which swap nothing, still run. The test runs each script under the marker with the builders it reaches past it replaced by stand-ins that fail at once, and a scan of scripts/ keeps the list whole: a script that calls a builder of a landing or a derived store and is not run under the marker fails it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A reset interrupted after its clearing leaves the plane without the occupancies a fill selects vectors by, so a destroy then filled the cache with the raw objects and source files and none of the vectors, removed the root, and said nothing of why. `cache fill` already refused a pending reset; destroy now refuses it the same way, its dry run too, writing nothing, and once the reset has finished the fill selects every vector again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…out of its source The commands' run ledger is opened at its first write and read from the file before, which is now the live-daemon check of every command that only asks; the live-run tests opened the run through the launcher's own ledger, so they read it through that connection and never through the file. The run is now held by a ledger of its own, as by the daemon, and the reset, destroy and a fresh launcher's on-demand verb each refuse with the run's frames in the -wal and after a checkpoint, without opening their own ledger. A source file the cache would take is refused when it resolves out of its source, which is the one guard against a regular file reached through a directory link inside the root, or through a manifest part that climbs out of the stream; no test exercised it. P12 now does both: the stream directory linked to the data directory with a manifest naming the catalog's file, and a part of the real manifest that climbs to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ary directory The test built the chat sensor on the default configuration, so it opened the chat log, the raw store and the retention ledger in the checkout's data directory, and seeded the ledger once from the chat log there. The deploy gate runs this tier in the checkout of the running instance while its daemon still runs the code before the retention ledger: the test would seed that instance's ledger early, and the transcripts the old daemon retained after it would get no retention row, since the new daemon's start seeds nothing again. The test now builds the sensor on the default configuration with its data directory under tmp_path, and checks that every store it opened lies there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he rebase The note's §4.3 and the runbook name every script that now reads the reset's marker, the founding ingest, the two sensors the post-commit hook runs, the verdict paths, talk and the plane migrations' swap among them, and say that a scan of scripts/ keeps the list whole; the lock-less writers of open question 7 gain the same scripts. §6.1 and the runbook add destroy's refusal of a pending reset. P7, P9, P11 and P12 describe the tests this round added, LCF-5 names the scan, and §10 records items 27 to 30: the writers that ignored the marker, destroy and a pending reset, the two guards that had no test, and a test of the tier that wrote the checkout's data directory. Open question 9 asks whether the chat sensor's retention ledger should be seeded at every build rather than once, and how to order what such a seed adds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tests number 74. Destroy refuses a pending reset; the live run is read from the file each command reads it from; a scan of the scripts keeps the writers run under the marker whole; and a file reached out of its source through a link inside the root, or through a manifest part that climbs, is refused. The limitations add the retention ledger's one seed. 8 pages, a clean build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request gives
palace resetone meaning, the same in every instance: clear the derived stores and rebuild them from the raw store and the ledgers, losing nothing. It addspalace destroyfor named instances, which leaves the instance's open content in a cache at~/.mind-palace/cachethat other instances read back by digest and by atom, and a purge reaches that cache. It closes two gaps the rebuild needed: the chat log can now be rebuilt from raw, and a lexical index left stale by a tokenizer change no longer blocks every landing. With the landing log of #92 in the base, the reset keeps the catalog's file whole, the log in it, appends nothing to the log, and refuses before writing anything when the catalog's first open would write the log's genesis without the instance's secret; a destroy needs no secret and lets nothing of the log into the cache. The corpus instance declares its own root,~/.mind-palace/instances/corpus. The design isdocs/design-notes/dn-instance-lifecycle.md; the article ispapers/2026-11-11-instance-lifecycle/.Abstract
A knowledge store that keeps the verbatim bytes of everything it ingests can treat every index over those bytes as a materialized view. We use that to give an instance a lifecycle with two operations whose meaning is fixed in code. A reset classifies each of the instance's stores as a ledger, an owner's declaration, a derived store, model output, or operational state, clears the derived stores and rebuilds them in a fixed order from the raw store and the ledgers, and keeps everything else row for row. A destroy removes a named instance and leaves its open content in a cache shared by every instance of the machine, addressed by content, so that another instance can take a raw object by its digest, a vector by its embedder and text hash, and a downloaded source stream by its manifest without a trust decision beyond the address. A purge reaches the cache, so the cache is no way around erasure. The catalog's file also holds a hash-chained log of the catalog's past: a reset keeps it whole and appends nothing to it, and refuses before writing anything when the catalog's first open would write the log's genesis without the instance's secret; a destroy removes the log with the catalog and lets none of it into the cache. Two gaps in the store had to close first: the chat log could not be rebuilt because nothing recorded which raw objects were transcripts, and a lexical index made by an older tokenizer refused every landing while the job that would repair it ran only after a landing. We add a retention ledger for the first and a repair inside the one writer for the second. 74 tests on fixture palaces check that a reset keeps every ledger, the log's rows and chain heads among them, converges to the state before for each derived store, is idempotent, calls no embedder while the atoms are held, and finishes after an interruption at any step, and that a destroy removes only the instance's own state and leaves exactly the cache's classes.
What changes
ops/lifecycle/inventory.py): every store an instance writes is a ledger, a declaration, a derived store with its rebuild step, kept model output, or operational state.reset_targetsand_RESET_GUARDare removed. The landing log is named there as a ledger in the catalog's file (LANDING_LOG).ops/lifecycle/rebuild.py,Launcher.reset): keeps the raw store, the catalog with its landing log, the version chains, the attestations, the verdicts, the authored supersessions, the reference edges, the queue, the interpreted artifacts and every other kept store; clears and rebuilds, in order, the lexical index, the plane's occupancies (atoms kept, so no embedder call while they are held; only the (path, digest) pairs the plane held current are re-occupied, kept in the marker with each occupancy's title and class and rebuilt from raw at the held digest even where the catalog's head has moved on, so a lazy instance's backlog stays with the embed job and a note edited since it was embedded stays searchable at its old version;SharedPlane.reset_relations,drop_unheld), the code and agent observations (re-projected without the attestor), the authored relation edges (parsed from raw by catalog digest; the interpreted rows stay), the chat log, the chat events, the causal edges and the verdict dispositions. No step writes the catalog or appends to its landing log; on a catalog with rows and no log yet, the catalog's first open, which the rebuild makes, writes the log's genesis. Two steps open the catalog (OPENS_CATALOG: the lexical index and the authored relation edges); the plane step reads no catalog row and does not. Runs under the supervisor lock behinddata/reset.pending; while the marker exists the daemon's start and every command that lands or writes a derived store refuse (the on-demand verbs and the scripts that write), and a secondreset --confirmfinishes an interrupted reset. Refuses a live daemon, the lock held, a changed embedder geometry (read from the plane's record, read only; under a pending reset the refusal says to finish it under the plane's embedder first), a derived store outside the data directory, a commit the commit ledger holds that the repository no longer has, and, on a catalog with rows and no landing log yet, an environment without the instance's landing-log secret (the rebuild's first open would write the log's genesis, and without the secret that open refuses after creating the log's empty tables), each before anything is written, the marker included. A retained transcript whose raw object a purge erased is skipped by the replay and counted, and so is a version the plane held that a purge erased while a reset was pending. Dry run by default, as before; it counts the atoms the atom table lacks, the held items older than the catalog's head, and the items whose current version has no vector, says when the first open would write the log's genesis, and on an instance at rest creates, removes and touches no file. The old reset is gone; there is no switch back.core/stores/chat_retention.py,ChatSensor.rebuild): the sensor records each transcript it retains, in order, before extraction; the ledger is now its change signal, which closes the gap between the raw write and the row (an extraction cut short after the row waits for a reset's replay); a reset replays it from raw with no transcript directory. A chat log older than the ledger seeds it once.Writer.heal_lexical): every landing re-derives an index made by another tokenizer before it lands, reported as therederivestage of the receipt. It appends nothing to the landing log.ops/lifecycle/destroy.py,palace destroy): named instances only; fills the cache, then removes the root without following a link out of it, the catalog's file and its landing log with it. It reads the catalog read only, so it needs no landing-log secret. Refuses the default instance, a live run, the lock held, a pending reset (a reset interrupted after its clearing leaves the plane without the occupancies the fill takes vectors by, so a destroy then would keep none of them), an installed LaunchAgent, a root in a git working tree (other than the derived<repo>/instances/<id>), the home root, a root that holds the cache or contains a link out of itself, a root that is a link, a root holding anything but the instance's own state (a top-level entry no namespace of it names, an unclassified data entry, a git repository below it, another declared instance's root at, inside or around it), a source file the cache would take that is a link, a configured embedder that is not the plane's geometry, and a cache volume without room. The dry run takes no lock, reads each SQLite file at rest (no-wal, or an empty one) withimmutable=1(read_only) and the run ledger without opening it, so it creates no file, nor a root that does not exist. It lists the root's top-level entries, the sources it leaves outside the root, and the sources inside it, which go with the root, with the count and bytes of their files the cache does not take (whole downloads underraw/, cursors, state). Names the Keychain items it leaves,<id>.landing-log-keyamong them.core/stores/cache.py,palace cache [fill|prune]): raw objects by digest, vectors by embedder key and atom, stream files with a manifest, purged digests, use days for a 180-day prune (recorded to the day, not the second). A fill refuses unless the configured geometry is the plane's; its plan counts atoms and the fill copies vectors 2,048 at a time. Only open content enters: the open-corpus sources, the repository sources and the curated class; nothing of the catalog's file, its landing log or the log's secret, and no source file that is not a plain file of its source (a symbolic link, a hard link, a file that resolves out of it), which a fill and a destroy refuse before writing and the cache's writer refuses too. Readers: the vector drain (by atom, same key, same width), the raw store on a miss (checked against the digest; a bad entry is deleted), andscripts/corpus.py fetch(a cached stream copied into an empty source; a manifest name that is absolute or climbs out is refused).LazyRunLedger,read_only):build_launcheropens the run ledger at its first write and reads it read only before, so the dry runs and refusals of reset, destroy and cache fill create no file and no missing root; a store whose-walis empty is readimmutable=1, so a reader's leftover-waland-shmare not touched.scripts/ingest.py,scripts/corpus.py ingestandembed,purge_raw,ingest_self_knowledge,mint_ids,watch,migrate_chunk_keys,migrate_provenance_split,reembed_bodyonly,ingest_founding, the code and self sensors'snapshot_codeandsense_self(which the post-commit hook runs on every commit on main, reporting a failed sync that a sync after the reset heals),verdict.py submitandreview(which apply dispositions),talk(which lands what the inbox kept when no daemon is live) and the swap ofops.plane_migrateandops.float16_migrateread the marker before they open anything;palace destroyrefuses too. A test runs each script under the marker, with the builders it would reach past it replaced by ones that fail at once, and a scan ofscripts/fails on a script that calls a builder of a landing or of a derived store and is not run that way.purge_raw(..., cache=),scripts/purge_raw.py): the object and its chunks' vectors under every key are removed and the digest recorded so no fill restores it.config/instances/corpus.tomldeclares[instance] root = "~/.mind-palace/instances/corpus"; the corpus design note, the stage-1 report and the defaults' comment say where the data lives; the runbook has a section of its own for the lifecycle, with what reset and destroy need of the landing log's secret under the default and a named instance.Decisions for the owner
Each is proposed, recommendation first.
~/.mind-palace/cache, one namespace per kind, entries kept until a prune removes those not taken for 180 days.config/instances/corpus.toml.palace code-rebuildstays what derives it.repo-sync,scripts/ingest.py, the corpus runner,watch), but not an on-demand writer that takes no lock and started before it (vault-sync,embed,dream,relate,lanes,reembed,ingest-chat,dialogue-sync,cache fill, and the other scripts that write); such a writer goes on writing into the stores the reset rebuilds. Closing it needs either every on-demand writer to take the supervisor lock for its whole run, which widens the lock beyond the supervisor role of dn-supervision-and-liveness §2.6 and makes two on-demand writers exclude each other, or a lock the writers share and the reset takes alone (note, open question 7). Until then the runbook says to run a reset when no on-demand command is running.isolation.json,gate.log,progress.json,progress-vectors.json; the stage-1 measurements'results/), so a destroy of the corpus refuses as its root stands. Whether they are the instance's own state, for a destroy to remove, and whether the measurements' results are kept elsewhere first, needs a decision (note, open question 8).Gates
uv run ruff check .: all checks passed.uv run python scripts/check_imports.py: import firewall OK, worker boundary OK.uv run mypy core agents eval ops scheduler scripts: no issues in 379 source files.uv run mypy: 67 errors in 19 files, the tests baseline.uv run python -m ops.type_gate: passes (the one parked, non-fatal psutil report is unchanged)..github/workflows/ci.ymlruns it, at54b9e3e6(the head adds only the README's count): 3,795 passed, 11 skipped, 21 deselected in 300 s, load average 1.89 at the start and 3.68 at the end, 2.2 GB resident at most (main: 3,721; this branch's 74 are intests/integration/test_instance_lifecycle.py, 3 of them new with the landing log, 14 with the audit of the rebase and 12 with its second audit).scripts/build_papers.sh: 8 pages, no undefined reference, no overfull box.Notes
VaultCatalogitself. The catalog's constructor writes the log's genesis on the first open of a catalog that has rows and no log, and without the secret it raises afterexecutescripthas committed the log's two empty tables, so the constructor cannot be the check: the reset reads the catalog read only first and refuses, naming the item. With the log in the file a reset needs no secret.landing-log-keyfor the default instance,<id>.landing-log-keyunderMIND_PALACE_OVERLAY.scripts/run_with_secrets.shrefuses a named instance, so a named instance's reset that needs the secret is given its own item under its own name (the runbook shows the command). A destroy and a cache fill need none. A test loads a named instance through its overlay, as a process does, and checks each case; the fixtures that build a named configuration in-process key their catalogs with the default item, since the process's configuration stays the default one, and none of them lacked its item after the rebase.VaultCatalog. Its catalog holds 400,274 rows and no landing log yet, so opening it through its class would write under the root (the WAL files, the migration, the log's tables and a genesis of 400,274 rows), or, withoutcorpus.landing-log-key, refuse after creating the log's two empty tables. The check opens every SQLite fileimmutable=1and the Lance table only read, and was run on this tree, withoutcorpus.landing-log-keyin its environment, with a snapshot of the whole root before and after: 389,745 entries (389,417 files, 18,949,782,338 bytes) by type, size and modification time, none added, removed or changed. It found: the overlay resolves the root to~/.mind-palace/instances/corpus, data underdata/, sources undersources/; the catalog holds 400,274 rows, all active (wikipedia 11,414, openalex 145,029, arxiv 41,659, stackexchange 163,503, gutenberg 338, hackernews 38,331, counted on 2026-11-12), invault_filesalone; the lexical index 1,369,944 current units; the vector table 1,338,585 rows. The lexical querysuperconductivity phase transition, scored under the legacy tokenizer (the index records none), returned, top first,corpus/wikipedia/26884"Superconductivity" (24.52),corpus/wikipedia/37461"State of matter" (24.52),corpus/wikipedia/4474"Bose–Einstein condensate" (23.96),corpus/wikipedia/26884again (23.40, its second unit) andcorpus/wikipedia/54423"Phase transition" (22.67), in 17.37 s at a load average of 2.84 2.55 2.65; the whole check took 30.5 s and 437 MB resident. The first check, on 2026-11-12, opened the SQLite files withmode=ro, which on a WAL database creates the-waland-shmfiles: it created an emptylexical.sqlite-waland alexical.sqlite-shmunder the corpus root and touchedvault_catalog.sqlite-shm, changing no row.corpus.landing-log-keyplaced first: its first open of the catalog writes the genesis.metatable), so by the store's own rule it is the legacy tokenizer's and stale under the current one. With this pull request, the nextscripts/corpus.py ingestre-derives all 1.37 million units before its first batch lands. That cost is not measured here.mode=roread of a SQLite file at rest creates its-waland-shm, and rewrites a-shma reader left; destroy's dry run did so for the catalog and the plane, and its test passed only because the fixture held the stores open. The lifecycle's readers read a file whose-walis absent or empty withimmutable=1; the reset reads the plane's geometry from its record instead of opening the plane; andbuild_launchergives the launcher a run ledger opened at its first write and read only before, since opening it eagerly made everypalacecommand, a dry run or a refusal included, createdata/runs.sqlite, and the root itself when it did not exist. The tests run on an instance at rest, closing the fixture's stores by hand (under coverage a connection the garbage collector finalizes keeps its two files), and one runspalace destroy,palace resetandpalace cache fillas commands in processes of their own, on a root whose catalog has an empty-waland a-shmbeside it and on a root that does not exist: no file under the home is created, removed or touched. A store whose-walholds frames (an instance not at rest) is readmode=ro, which updates its-shm.with_cachewhere the drain runs (the embed job,palace embed, the reset, the corpus runner), not inbuild_stores, because A read-only guest principal: the grant, its MCP surface, and the leaks it closed #89 was changingcore/ingest/ingress.pywhen this was built; with A read-only guest principal: the grant, its MCP surface, and the leaks it closed #89 merged, wiring it throughbuild_storesis a follow-up. A landing throughrun_libraryalone does not take raw objects from the cache.sources/<source>/raw/; a destroy removes them with the root, and its dry run counts them. On the corpus they are 810 files of 2,598,652,044 bytes.eval/corpus/footprint.py), about twice its bytes; the vectors go into SQLite pages. Neither the fill's disk use nor its time is measured. A destroy of the corpus refuses as its root stands (open above). The plane does not record the embedder's backend, so a change of backend alone is not caught before a fill; catching it needs a new key in the plane'smetatable, a schema change left open (note, open question 5).OPENS_CATALOG, a destroy reader openingmode=ro), the 21 the audit of the rebase asked for (the empty-walread, the run ledger opened late, the plane's geometry read only, the data-directory preflight, the purged held version, the plane step without the catalog, the cache's, destroy's and the fill's link checks, hard links, the pending-geometry refusal, the dry run with the secret at hand, destroy's dry run naming the sources, and each of the eight writing scripts' marker check), and the 12 its second audit asked for (the run ledger read from the file, the source file that resolves out of its source, destroy's refusal of a pending reset, the marker check of each of the six scripts and the two plane migrations it added, and a script outside the list that calls a writer, which the scan finds) was mutated one at a time in the worktree, each restored after, and each mutation made a lifecycle test fail.commits the rebase carried now give the counts their content sets (3,754 and 3,766), and the
commit that listed eight writing scripts no longer calls them every writer, since a later commit
adds the six scripts and two plane migrations the list missed.
in the note, the article and here, a reason against seeding the retention ledger at every build
that overstates its cost: run before the sensor syncs, such a seed puts each missing digest after
rows that all precede it in time in both cases the question names, so the replay gives the chat
log back there; the question stays open. P7's text says neither the reset nor an on-demand verb
refuses once the run stops, and its test checks only the verb. An instance whose pending reset
cannot finish (a ledgered commit gone, open question 4) can now be neither reset nor destroyed,
and the runbook does not name the way out, removing
data/reset.pendingby hand.data/airlock/,data/handoff/,data/reference_edges.sqliteanddata/selfmod_ledger.sqlite, and each test file this branch changes, run the same way, created nothing there. The deploy gate runs the tier in the running instance's checkout; which tests write there, and what, is not examined here.Merge order
On main after #92 and #89 (rebased onto
8d4dff3d). It changesops/lifecycle/launcher.py,scripts/palace.pyand, incore/ingest/writer.py,Writer.land, a newWriter.heal_lexical, acachefield ofStoresand the import fromderive.py; notWriter.finish, whose two key writes #92 changed. Of the files #93 changes (core/stores/lexical.py,core/attestation/store.py,core/ingest/landing.pyamong them) it shares onlyREADME.md's tests count anddocs/runbook.md, where its section is one of its own beside #93's; of those the algebra of cuts (#94) changes (core/stores/landings.py,agents/ambassador/mcp.py,docs/LAWS.md,docs/design-notes/dn-temporal-snapshot.mdamong them) it shares onlyREADME.mdandconfig/defaults.toml, where the two change different lines. #93 and the cut algebra (#94) may merge first; whichever of this pull request and each of them merges later is rebased. A trial merge of this head with each of their branches at their heads of 2026-11-14 (git merge-tree,e20be814and9c5b4d91) conflicts only inREADME.md.🤖 Generated with Claude Code