Cairnmind
Operations & Deployment 51 min read Source: docs/STORAGE_AND_MAINTENANCE.md ↗

Storage, Backups & Maintenance

Data directory layout, checksummed logical backups, staged restore, single-writer store locks, pruning, and maintenance.

Data and backups

The default data directory is ~/.local/share/cairnmind on Linux, macOS and WSL2, or %LOCALAPPDATA%\cairnmind on native Windows for a new installation. An installation that already has data in ~/.local/share/devbrain keeps using that directory where it is; nothing is moved or copied. Choose another one with CAIRNMIND_HOME or the global --data-dir option. Variables are spelled CAIRNMIND_*; the earlier DEVBRAIN_* spelling is still read. For a configuration variable the new spelling wins when both are set; cairnmind doctor reports a pair that disagrees. ArcadeDB data lives in arcade/databases. The knowledge service and the engine run in the background until stopped (or until WSL/the host shuts down). cairnmind stop stops the knowledge service; once clients are closed, cairnmind engine stop stops the database without deleting data. A connect-only installation (CAIRNMIND_ARCADE_CONNECT_URL) has no arcade/ folder and no engine: its database runs elsewhere, the engine install, start and stop commands say so and do nothing, and engine status reports the server it connects to.

Commands that only read the store never start the engine, create the data directory, configuration or database, or upgrade the schema: project list, records, source, task list, plan list, plan show, plan next, plan contract without --write, check profiles, memory orphans, memory extraction-stats, impact, usage, proposed, answers list, answers show and store size. When the engine is not running, the store was never created or its schema needs an upgrade, they stop at once with one line that says what to run, cairnmind engine start or cairnmind init. brief still starts a stopped engine, as do the commands that write and check list, export and backup. On a connect-only installation no command starts an engine: when the server does not answer, each of them says where it looked.

cairnmind export ~/memory.json --project my-app
cairnmind export ~/memory.md --project my-app --markdown
cairnmind backup ~/cairnmind-backup.cairnmind.json.gz

The SQLite schema is at version 5 (#581): its full-text index holds words cut where ArcadeDB's analyzer cuts them (a word followed by . or : and then a space or punctuation, or joined to another by / or -, is found; foo.bar, key:value and 3.14 stay one word), and the writer's first opening of an older store rebuilds that index from the chunks and records inside one transaction, after a state.db.pre-vN.bak copy; a rebuild that stops leaves the store as it was and the next opening starts it again. The ArcadeDB schema stays at version 4, the profile format at 2, and the administrative backup at 5, with support for the earlier formats 2–4. Old plan groups can be adopted explicitly with plan adopt, or in the workspace (More, then Old task groups) when a group holds a task a person confirmed. To move a single project, use memory import; restore replaces the entire store.

Archiving does not wait for the GPU. Status shows archiving, indexing, model processing and the queue separately. The portable backup contains a consistent export of sources and database state; it does not contain credentials, model weights or vectors (#187: the embeddings rows and the vector_* types are written empty, in the same format 5, and cairnmind export leaves them out too). A restore sets the completed embedding jobs back to pending, says how many, and the service rebuilds the vectors from the text; until then search uses the text only and says so, and cairnmind status shows the jobs left. A file written by 0.12.0 or earlier still restores with its vectors. How much a backup now saves is measured by scripts/store_growth.py (evaluation/RESULTS.md). Automatic backup runs while the service is running and keeps the seven most recent copies.

How a restore writes (#362). cairnmind restore and cairnmind setup local --backup write a restore in transactions of at most 5,000 rows, 8 MiB of text or 5 seconds open, whatever the size of the store: the engine keeps the pages a transaction changed in its heap until the commit, so one transaction for a store the size of Cairnmind's own repository (81,488 graph vertices and 101,428 edges) ran the engine out of memory on its default heap of 1 GB, and the same restore now passes on that heap (a prototype of the bound also passed on 512 MB). The outcome is still one of two, the whole backup or the store as it was. Before the first row is deleted, the restore writes a mark in the store (devbrain_meta, restore_unfinished: the backup, the before-restore-* copy and that copy's SHA-256; no backup carries it and no restore deletes it) and removes it as its last commit. When a restore fails it puts the store back from the before-restore-* copy, after checking the copy's digest, and the error says so; that copy holds no vectors, so the error says what becomes of them as after any restore, by the setting (rebuilt when the knowledge agent is enabled, waiting when it is disabled). When the restore is cut off or killed, or the undo fails too, the mark stays: every command that opens the store, on any installation of it, is refused with one sentence naming the backup and the copy and the two ways out, and cairnmind doctor shows restore_unfinished and exits 1. On the installation that writes the store, cairnmind restore FILE finishes it, or cairnmind restore of the before-restore-* copy goes back to the rows the store held before (a by-hand restore follows the confirmation rule of MEMORY_CONTRACTS.md, so keep the workspace open to keep a person's confirmations; finishing a restore writes no second copy). From another installation of the store, or when the one that started the restore is gone for good, there is a way out that needs none of its files: cairnmind store takeover --yes there (a person's act that a marked store allows, and that leaves the mark where it is), then cairnmind restore FILE with any valid backup, which replaces the store and removes the mark; the refusal sentence says so. A backup or an export of a marked store is refused, and cairnmind store prune-backups keeps the before-restore-* copy the mark names (and every such copy when it cannot read the mark) and says so. A failure before the first row was deleted changes nothing and says so, without an undo. When the mark itself cannot be read, what the store holds is not known: no copy is made, a failed restore is not undone and the store stays refused until a restore succeeds. The writer lock is held from the mark to its removal, so another command of the same installation waits instead of committing between two transactions. A transaction that has been open 5 seconds is committed, and a delete that took that long halves the next ones, so on a slow link or a loaded server no request of a restore nears the client's wait of 30 s (the commits of a restore are waited for 120 s, every other commit 30 s); if the engine of a server still takes longer than that, the restore fails, is put back, and says so. A backup is read in pages of at most 1,000 rows in one read transaction and needs no such bound. When the engine runs out of memory or stops answering during a restore, the message says so and names where its heap is set (see DEPLOYMENT.md). A store has one writer: the installation that first opened it, named in the database. An installation is its data directory, identified by installation.json there; a copy of that directory on another machine or under another path gets an identity of its own and does not write as the original. A second installation pointed at the same database (for example a server on another host, #72) reads it only: commands that read work, a command that writes stops with one line naming the writer, and its service does not start. cairnmind store writer shows which installation writes and what this one is; doctor and status show the same. To move writing to this installation, a person runs cairnmind store takeover --yes [--note TEXT]; the change is kept in the store, the jobs the previous writer was running go back to the queue, and the previous writer stops at its next write. For a store used from one machine nothing changes.

A project removed with cairnmind project remove (see INSTALL.md) keeps every row in the store: it is counted in store size, shown by status as removed_projects, and written to backups, and a restore brings it back still removed. Its queued jobs wait and run once the project is back. The workspace deletes one (More, then Delete project memory; see below); backups are not changed, so take one first with cairnmind backup.

Deleting a project's memory

Deleting a project's whole memory is a person's act, made in the workspace only (#347). Open it with cairnmind, choose More, then Delete project memory, and pick the project: the open one is listed first, then the other registered projects, then the removed ones (so a removed project, also one whose folder lies inside the data directory, can be deleted without bringing it back). The workspace reads what would be deleted from the service and shows a consent dialog that names the project and its folder, the counts (records, plans, sources, sessions, check runs, code graph, search passages and vectors), the answer log, and what stays. Delete in that dialog is the only thing that sends the deletion. Afterwards the workspace says what was deleted; when the project was the open one it returns to the project list.

  • Deleted: every row of the project in the store (records and their revisions, sources and the audit notes, passages, vectors, code graph, plans, sessions, acknowledgements, check runs, jobs, memory settings and bindings), its registry row, and its answer log. A new project with the same name and folder starts empty, with a new identity.
  • Not changed: the backups in backups/ (only restoring one brings the project back), the project's folders (its .memory snapshots, its published memory and the files cairnmind install wrote), and every other project, its backups, snapshots and published memory.
  • Refused: while the project has a session in the workspace that is not known to have ended, or a job in work; on a reader installation (the writer deletes); and for a request that does not come from the open workspace, whatever its token. The checks run before the dialog and again inside the deletion. A coding client started outside the workspace leaves no sign that it runs; its later calls are refused as an unknown project.
  • The command line deletes nothing. cairnmind forget PROJECT --delete-project is refused with exit code 2 and says where the person does it. There is no override flag or variable.
  • The trace: each deletion appends an entry to the deleted_projects list kept in the store (the last 100: the project's id, when it was removed from the registry, when it was deleted, the host, and the counts; never its name or its folder), which cairnmind status shows. Backups do not carry it, and a restore does not remove it.

If the workspace cannot open (tmux missing or broken, a store that does not start), the rule does not change and there is no other way to delete one project's memory. First make the workspace work: cairnmind doctor names what is missing. Meanwhile cairnmind project remove PROJECT --yes takes the project out of the registry (nothing indexes it, names it or archives its conversations; its memory is kept). If the memory must go before the workspace works again, either restore a backup made before the project was added (cairnmind stop, then cairnmind restore FILE; everything stored after that backup goes too, and without the workspace a person's confirmations become the backup's claims), or remove the memory of the whole installation as INSTALL.md says: cairnmind backup DIR/, cairnmind workspace stop, cairnmind stop, cairnmind engine stop, then delete the data directory. With a database that this installation only connects to (cairnmind setup remote-db, or CAIRNMIND_ARCADE_CONNECT_URL) the memory lives on that server: deleting the data directory leaves it there.

How a large code graph is written

Indexing replaces a project's code graph as a whole. A graph of more than 20,000 rows is written in several transactions of at most 20,000 rows each, so that the engine's default memory is enough for it (#377). While those transactions run, and after a write that stopped half way, the project's code graph is reported as not built: impact, the memory status and the inspector's graph, groups and neighbors say so, and nothing reads the partial graph as the whole one. The next indexing replaces the whole graph. Before the edges are stored, indexing waits for up to a minute until the engine's index finds the vertices just committed; if it does not, indexing fails with an error that names how many vertices are missing, and no edge is dropped silently. A restore writes a backup's graph in its own, smaller transactions (#362) and waits the same way once, after all its vertices are committed and before its first edge, with no transaction open: the edge transactions begin after the wait. A group of edges that still misses a vertex is committed, waited for and written once more in a new transaction (#396); if that fails, the restore is undone like any other failed restore. If the index keeps missing, putting the store back can fail too: the message then names the safety copy to restore, and the restore mark stays until a restore finishes.

A vertex whose id was deleted shortly before (#433). The engine's unique index of nodes.id can still hold the id of a vertex deleted by an earlier pass, and it finds no row for it, so the write cannot ask first. A directory that was renamed and, in the next pass, renamed back was then refused at the commit with a duplicated key, or the edges that name a re-created vertex found no endpoint (on the test engine: 3 of 3 runs at 322 files, 2 of 3 at 260 and 1 of 2 at 160; none of 12 at 200, 120, 80, 40 and 15 files; these are few runs, so where the edge lies between 80 and 160 files is not known, and a synthetic graph of 10,000 vertices failed 2 of 8 times the second way). Indexing now rolls that transaction back, waits 5 seconds and writes the graph once more, the whole of it if an earlier transaction had committed (the fingerprint is then cleared); the result of such a pass says graph_written_again: true, as it wrote the graph twice. If the engine refuses again, indexing fails with an error that names the refusal and the wait, and the next indexing writes the graph: a write of several transactions has cleared the fingerprint, so the graph stays marked not built; a write that fitted in one transaction left the previous graph, which the readers still report as built although it no longer matches the files.

A row stored twice under one id (#456). Seen on the pinned database image in production mode: the pass back of a renamed directory stored the vertex source:... twice, with no refusal and no retry, and the graph then differed from a full rebuild by that vertex. The graph write asks the engine's unique index of nodes.id whether a vertex exists (Store._checked_node, a lookup of 500 ids) and creates the ones it does not find. What was found, on the pinned image in production mode: in the pass that stored it, the lookup by id inside the write's transaction found nothing, for the vertex alone as for the 500 ids, while another session found the vertex at the same moment, and the unique check of the commit, which uses the same view, did not refuse the second copy; afterwards the engine's id index held only the second copy while a scan of the type found both. The requests of one such series (4,216, of 10 files of 1,000 symbols renamed and back, recorded on a container that had served a 30-file series) were then sent again by plain HTTP, with no product code, each time to a new database on a freshly started container of the same image: the same vertex was stored twice 6 of 6 times, and 3 of 3 after a restart of the container before the replay; with a pause of 2 seconds before the transaction that stores the second copy (the one that begins 3 ms after the commit of the one before it) the engine refused the second copy as it should, 3 of 3 times (earlier replays with pauses of 0.5 and 2 s: 2 of 2). So the cause is suspected to be the engine's, not shown: a transaction that begins right after a commit that wrote 1,000 vertices may not see an entry of the id index that the engine is rewriting in the background, and its uniqueness check may not either; the pause that removes it fits that, but it is not proof. The product does not create a vertex without asking first, and cannot ask the index first. The state of the engine that decides it is not isolated: the recorded log (267 MB) was not kept and was never reduced to a few statements, so the replay cannot be repeated from this repository; a later check found 1 duplicate in 120 product passes on an aged container of the pinned image and none in 40 on the managed engine, and a plain-HTTP pattern of 1,000-vertex commits each followed at once by an insert of an old id was refused 60 of 60 times, so it does not reproduce it. Issue #456 stays open until a reproduction that someone else can run exists; no report was sent upstream.

What the product does instead of asking: after a pass that wrote vertices or edges, the project's rows and its distinct ids are counted for both, by the project's own index (72 ms for a project of 89,000 vertices on a shared machine; a pass that wrote nothing to the graph, such as every explicit cairnmind index with no code changed, makes the same two requests; an idle round of the watcher makes no pass and no request), and a difference is repaired in the same pass. The first stored copy of an id stays and the others are deleted; what the pass computed for the vertices and the edges the deleted copies held are written on the copy that stays by its record id, never by a lookup of the id, so the repair cannot make a third copy where the lookup misses; an edge stored twice keeps its first copy. The rows are counted again afterwards: a repair that does not end whole fails the pass by name and marks the code graph as not built. The result of the pass says graph_duplicates_removed and graph_duplicate_edges_removed and names the counts in errors. cairnmind doctor counts the vertices and the edges of the whole store that share an id with another (vertices_stored_twice, edges_stored_twice and graphs_stored_twice in the JSON, a note per project in the summary, never an exit code), and the note names the command that repairs an idle project: cairnmind index PROJECT writes the graph again, whole, when it holds such a row, even where no file changed, and also removes a duplicate of a vertex whose id goes away in that pass (every copy is deleted by id, and the extra ones count in graph_duplicates_removed). A repair of more than one transaction leaves the code graph marked as not built until its last commit. The embedded SQLite backend cannot hold the problem: id is the primary key of every collection, a second row of an id is refused by the database, and the check there answers without a request. Writing a graph over an existing one (#385). An indexing run that does not hold the graph it wrote last in its own memory (the first run of the service after it started, or after a change behind its back) compares the stored edges with the ones it computed. An edge's id names its two ends, its kind, its source and its line, so a stored edge with a computed id and the marks a full write gives it is that edge and stays; only the stored edges that are not in the computed graph are deleted, in groups of one transaction's rows, and only the edges that are not stored are written. Every vertex is still written again. This replaced deleting every edge and writing the same ids again, which failed on the test engine from about 40,000 edges on: the engine's unique index of edges.id still held entries of the deleted edges (a write error, or a group of edges that was not created), and the run stopped with the graph marked not built (a sleep of 60 s before writing did not help). The figures are from a synthetic graph (symbols, files and sources of 1,000-symbol files, 1.25 edges per vertex) written by the indexer's own graph step on a private engine with its default 1 GB heap, one run each; the graph of 330,660 vertices of the finding was not written again (the machine's disk is small), the largest here has 119,238 vertices and 148,869 edges.

Vertices First write Second write, same graph, before Second write, same graph, now Second write, every symbol moved, now
20,040 9.7 s 16.0 s not run not run
30,060 12.4 s 21.7 s not run not run
40,080 15.7 s failed (edges of 40,000 and more) 6.5 s 55.7 s
80,160 29.2 s not run (fails the same way) 13.2 s 134.0 s
119,238 40.5 s not run (fails the same way) 19.4 s 315.5 s

The second write of the same graph now costs 0.4 to 0.5 of the first and grows with the size of the graph, in the vertex updates (3.4, 6.7 and 9.6 s). When the graph really changed, so that its vertices go, the removal of them does not grow with the size of the graph but with its square: the engine scans the project's whole index of nodes.project_id for every group of 250 vertices (DELETE FROM nodes WHERE project_id=... AND id IN ...), 19.4 s at 40,080 vertices, 63.0 s at 80,160 and 208.9 s at 119,238, and the edges' removal did the same until it was written in groups of one transaction's rows (24.1 s became 3.9 s at 80,160 vertices; the commits of the deletes, about 0.5 s per 1,000 rows removed, are the engine's and grow with the number of rows only). The old vertices are now removed in groups of one transaction's rows too (#402), the count of each delete checked like the edges' (the engine counts the vertices a delete removes, not the edges that go with them). One run on the test engine, on a synthetic graph of 39,906 vertices and 49,878 edges in which every symbol moved, a full write took 65.6 s with this and 84.6 s with groups of 250 vertices (the first write of that graph, 27.8 s); the rest is the engine's commits and the writes of the new rows. The removal still scans the index once per group, so its scans grow with the square of the graph, but there is one per 20,000 rows instead of one per 250: the square term is 80 times smaller and negligible at the sizes measured (one size only, so the growth rate itself was not measured). A write over a graph whose vertices all went still costs more than twice a first write. A graph whose vertices stay, as in the finding's second write of the same graph, does not pay it. The finding's own second write at 330,660 vertices, which succeeded in 686 s, was not reproduced: the earlier path failed at 40,080 and 80,160 vertices on this engine, so which path produced that figure is open until the 330,660-vertex case is run once on a machine with room for it.

After a change to one file (#409). The process that wrote the graph keeps it as one part per file: the file's own rows (the file, its source, its symbols), and the rows of its imports and calls, which look at the symbols of the files it imports. A pass over the very same files computes again only the files whose source changed, and the files that import a file whose symbols changed (a symbol's id holds its name and its line, so a body edited in place does not move the importers, and a line added above a symbol does). The parts are those a computation of every file gives; tests/test_graph_parts.py compares them after a body edit, a line added, a rename, a symbol moved to another file, a changed import, an added and a deleted file, and tests/test_incremental_index.py compares the stored rows with a full run. Another set of files, another parser, another root of a file, or a stored graph that is not the remembered one (the fingerprint and the count of edges are compared first) computes every file, as before. A file whose imports now lead elsewhere is computed again though no file changed: the walk leaves symlinks out and resolving an import follows them, so a retargeted link moves an import; every pass that runs asks again where every import leads, 68 ms for the 7,270 imports of this repository, from a table of what each distinct import leads to. A link retargeted, added or removed on its own, with no file changed, is noticed by a running process in its ordinary scan round (#451): the walk that makes the signature of the tree notes every symlink in the directories it lists, whatever its name (one named like an excluded directory too), its path and what it says (one readlink each, and the signature holds them), so the signature differs and a pass runs. That pass asks again where the imports lead and writes the rows that moved, from the remembered graph, as after a changed file; a link to a directory, a chain of links (each of them is noted), a broken link and a loop of links are the same, and an import that a loop of links makes unreachable stays unresolved instead of failing the pass. A round in which nothing changed is as before: no pass, no database write, and the walk adds no measurable time (101 ms before and after, median of 20 on a copy of this repository of 667 files, 100.7 and 100.9 ms with no link, 101.4 and 101.0 ms with 50 links). A link outside the registered root is noted like any other and leads nowhere that is indexed, as before; a link outside the root that itself leads back into it is not seen when it is retargeted. A link inside a directory the walk skips (an excluded name such as node_modules, or a gitignored one) is not listed, so it is not seen either when it is retargeted: the next pass that changes the graph, or a restart, resolves the imports again. A round in which nothing changed still does not look at the stored graph, so a graph damaged behind the process while the indexed sources stay the same (an edge whose end was changed in place) is not seen by it: the next pass that changes the graph, or a restart, repairs it. Two symbols of one id are counted, not collapsed, when the importers are chosen. A sequence of 66 edits of every kind above (a retargeted symlink, an empty file, a file that cannot be read, a changed parser, a second folder that goes away and comes back, 50 files moved at once, and more) and of 20 seeded random ones, then 40 seeded random ones for each of two more seeds, each sequence applied in one long-lived process, was compared with a full computation made by a second process after every edit and after the second look (the first sequence found the symlink), and tests/test_graph_parts.py does so for three seeds of 40 edits of a project of 12 files. With 14 edits of links added, 12 of them a link and nothing else (#451: a link retargeted, removed, added, broken, in a chain, in a loop of two, a link to a directory added, retargeted and removed, a link to a file outside the root added with its user and retargeted), seed 1 of every fixed edit and 20 random ones (102 edits) and seeds 2 and 3 of 60 random edits each ended equal to the full computation after every pass and after every second look, and the kill test of #409 (four moments) ended whole again after each kill. What still grows with the project in such a pass is what is read from the database or scans it, and what is done in memory: see the section on #426 below, and a union of the parts (about 45 ms). Measured on 23 November 2026 at commit 6021825 on a copy of this repository (586 files, 88,352 nodes, 110,218 edges; a comment line added in a function of ingest.py, which writes 883 nodes and 1,060 edges), WSL 2, a machine shared with other work (load 2.6 to 12), 20 runs after 3 warm-ups, in blocks of 5 runs of the old and the new code taking turns on the same store, ms as minimum, median, 95th percentile, maximum:

First pass after the edit Before After
Wall 5,377 / 5,574 / 5,763 / 5,879 1,973 / 2,099 / 2,162 / 2,172
Python CPU 4,030 / 4,114 / 4,303 / 4,328 651 / 701 / 724 / 734
Database requests 147 143
Second pass 2.2 s later (a file touched less than 2 s before is looked at once more) 347 / 370 / 408 / 416, 16 requests 241 / 264 / 292 / 341, 15 requests
Pass with nothing changed 107 / 112 / 120 / 121, 4 requests 107 / 113 / 125 / 183, 4 requests

By part (10 runs each, with timers inside the code, which cost the old code more): the graph step was 5,185 ms (4,389 of Python: 1,646 building the rows and sets, 881 resolving imports, 862 digests of nodes, 736 ids; 791 of database) and is 1,440 ms (638 of Python, 794 of database). The three walks of the tree, 313 ms, are one, 107 ms (#409); that walk is used only when no other indexing of the project had to be waited for, else the tree is walked again under the lock. The rest of the pass, about 0.4 s, is the database work of the changed file's source and chunks, which a replaced source with 1,900 graph rows hanging on it writes one by one.

What a one-file pass still reads (#426). Three reads of the pass grew with the project. What each protects, and what was done: (1) The count of the project's stored graph edges, compared with the count the process wrote, is how an edge taken or added in place behind the process is noticed (the fingerprint and the counts on the project row, compared first, notice another process that indexed, a restore, a graph marked as not built and a half-written graph, since each changes or clears them). It stays: no cheaper count says the same. A count of the project's edges without their kinds costs 59 ms against 75, and the count of the whole edges type costs 1 ms but includes the other projects' edges and the knowledge relationships, so any write elsewhere would send every pass to the slow path. (2) The ids of every stored node (273 ms at 88,000 nodes, standalone) were read to find the nodes that went and to delete a node nobody wrote. The process knows the ids that go, so the pass now counts the project's graph nodes (45 ms standalone) and compares the count with the number it wrote: a node added or taken in place is noticed, and the pass then compares the stored rows as it does after another writer (before, an added node was deleted and a node taken was noticed only through its edges). A vertex that a knowledge record's relationship names is kept when its code node goes (so that edge never dangles), and the process remembers which it kept and counts them too, else the count would never match again and every later pass would write the whole graph. (3) The edges to delete were found by project_id, kind and id, which scans the project's index (228 ms for 1,000 edges of 110,000); they are deleted by id alone, in the index of ids (25 ms), the id holding the project and the count of every group still checked. After two commits of one write (a directory of 300 files renamed, 67,045 edges deleted in groups of 20,000) the index of ids missed 569 and 325 of a group of 20,000, as it misses vertices committed a moment ago: the write failed its count, so the rest of a group are deleted by the project's index as before, and a count still short fails the write. What neither the old nor the new check notices behind a running process, and is noticed at the next start (the stored rows are compared then): an edge whose end was changed in place with the count of edges kept, and a node taken together with a node added. tests/test_incremental_index.py changes the stored graph behind the process (a node added, a node taken, an edge taken, the fingerprint of another graph, the graph marked as not built, another process that indexed) and the pass writes every node again and ends with the rows of a full run. Measured on 24 November 2026 on a copy of this repository (587 files, 88,644 nodes, 110,599 edges; a comment line added in a function of ingest.py, which writes 939 nodes and 1,146 edges), WSL 2, a machine shared with other work (load 10 to 13), the code of commit 2f625dd and of the one after it each in a long-lived process on its own store, taking turns, 20 runs after 3 warm-ups, ms as minimum, median, 95th percentile, maximum:

First pass after the edit Before After
Wall 2,655 / 2,897 / 3,177 / 3,347 2,320 / 2,507 / 2,706 / 2,876
Python CPU 1,003 / 1,057 / 1,173 / 1,197 945 / 1,013 / 1,070 / 1,177
Database requests 148 148
Median time in the node ids read / the node count 331 118
Median time in the edge count 152 170
Median time in the edges' deletion 248 24

The three reads took 731 ms of the median pass and take 312 ms; the node count is slower in the pass (118 ms) than alone (45 ms) because the machine was busy. The number of requests is the same: the three reads were requests before and are requests now.

What the knowledge service keeps in memory (#410)

A freshly started service holds about 265 to 275 MB resident with this repository indexed (588 files, 3,295 chunks, 88,663 graph vertices, 110,576 edges), and its first scan peaks at about 476 MB. One service had been seen at 810 MB while idle after a session. scripts/measure_service_memory.py repeats the series that found the cause (--quick shortens it, --steps picks steps): it copies a project into a temporary directory with an engine and ports of its own, starts one service under a launcher that turns on tracemalloc, and reads the resident memory (VmRSS, VmHWM) after every repetition of a step, after the step, and after an idle wait, with Python's own view (traced memory, objects after a collection, the allocation sites that grew). The figures below are one run of the whole series on one machine (WSL 2, glibc, the repository's own 588 files, the owner's Ollama for the embedding queue and the chat answers, 20 repetitions, 60 s idle, 30 minutes for the last step); resident memory is read without tracemalloc (--no-trace), which adds several hundred MB of its own.

Step Before: after the step / after 60 s idle MB, growth per repetition Now: after the step / after 60 s idle MB, growth per repetition
1 start and first scan (peak 478 / 476) 277 / 277 264 / 265
2 embedding queue, 3,295 jobs, to empty 290 / 291, +0.3 269 / 269, +0.1
3 20 one-file edits, each to the end of its scan round 886 / 886, +29.4 294 / 295, +0.3
5 20 answers with the chat model 911 / 911, +1.1 304 / 304, +0.2
6 20 status and 20 inspector graph requests 1,460 / 1,435, +28.2 per graph request 338 / 332, +2.7 per graph request before #450 (+0.006 since, below)
7 30 minutes idle 1,408 / 1,406 318 / 316
4 20 answers without a model (a second, fresh service with the knowledge agent disabled) 241 / 241, +0.3 230 / 230, +0.3

What kept it. Not Python objects: with tracemalloc on, the memory Python holds stayed at 107 MB after the first scan and 114.5 MB after everything, 0.8 MB more than after the embedding queue, with no allocation site growing by edit, answer or request (the few objects that were added came from the first use of a route, once). It was the C allocator. glibc gives each thread that allocates much its own arena and keeps what the arena held at its peak; indexing builds the project's whole graph in a worker thread (a peak of about 200 MB above the idle size for 88,663 vertices) and the inspector's graph read built every row of the project to answer with 300 nodes (a peak of about 190 MB; until #450), so each worker thread that ran one of them kept its own peak, and a new thread was started often enough that the threads grew from 9 to 33 in the run: +29 MB for every edit and +28 MB for every graph request (the slope over the 20 graph readings; the 20 status readings before them stay flat and are not counted), and 1.4 GB at the end. MALLOC_ARENA_MAX=2 alone flattened it (8 edits and 8 graph requests, no model: 489 and 797 MB with the default, 338 and 372 MB with two arenas), and handing the free pages back after a pass flattened what was left. The service now limits itself to two arenas at start (cairnmind serve; the service allocates under the GIL, so a second arena costs no speed) and returns the free pages of every arena after an indexing pass and after the inspector's graph, groups and neighbors reads (memory_release.py; malloc_trim). Without glibc (musl, macOS) both calls do nothing and memory behaves as before the change; that case was not measured. With tracemalloc on, the same series ended at 3.1 GB resident before (4.3 GB after step 6) and 0.75 GB now, with the traced Python memory at 114.5 and 114.9 MB: the change moved no Python object. The inspector's graph, groups and neighbors routes ask the database for the rows of the page they return and for the counts they show, and no longer read every row of the project (#450; inspector_graph.py): the first identifiers in order after the cursor, then their rows and the edges between them, with the counts and the groups summed by the database. The answers are the same as the whole read gave, field by field and in the same order (checked page by page on a fixture of every kind of row, and on the 45 pages, every group and 16 sampled nodes of the project of the run below). A request without a worktree reads at most a page of rows, at most limit + 1 identifiers from each table, never the project's vertices and edges (the sums are one row per group, and per transcript session for the group counts). A request with a worktree is paged the same way once the database has said what that worktree holds back (held): every distinct root and worktree the project's rows name (one row for each, from four tables) and every distinct file path of its sources, each put through the match the whole read applies to a row; the rows that carry a value that does not match, and the vertices and edges of their sources, are held back. The page is cut from the rows in the order of their identifiers, in batches of twice its size, the held rows left out as they come (a worktree that holds back nine tenths of a table reads ten times the page from it); the counts take the vertices and edges of the held sources off the totals by the index of source_id (a NOT IN of them, over every row, cost 0.5 to 0.8 s a query at 178,000 vertices); an edge of the worktree's sources to a vertex it holds back is left out of the page (the edges of a node are all read, as many as its degree, and their ends asked for in one request) and out of the count (one request for the edges whose ends' sources are held); and a worktree's scope is remembered, eight at most, until a write moves the journal's watermark. A scope that holds back more than 50,000 rows, or names a root that is not text, is read whole, as before. The same answers, checked on a fixture with three roots that all hold rows (files, records, plans and revisions of each, a file every root has and one with history, a record of one root that rests on another root's source, edges across roots both ways), page by page for each root and for the project, and on a store built from this repository registered with a copy of itself as a second root (1,184 files, 178,602 vertices, 223,080 edges; --second-root): 291 pages, groups and sampled nodes of the main root and of the second root were the same, field by field and in order. On that store a request for one worktree took a median 3.1 s (worst 8.1 s, the request that finds what the worktree holds back) where the whole read took 8.7 s (worst 9.2 s). The counts of the graph route are still the database's own, about 0.2 s each for the vertices and the edges: the project row's graph_nodes and graph_edges are what the indexer wrote (its vertices and six kinds of edge), not the vertices and edges a record or plan writes, so they cannot give the totals (a test shows the tables' counts passing the row's once a record is written). A vertex of a record, plan or source whose row is not there would not be in a page, though the whole read showed it; none can be written: the record's, the plan's and the indexer's source vertices are written in the transaction that writes the row, no path deletes a source, record or plan while its vertex stays (a project is deleted whole, vertices first; only the chunks of replaced sources are deleted), a restore writes the rows and vertices the backup holds, as they were, and a memory package that names such a vertex is refused. A test checks every such vertex a fixture of records, plans, revisions and an indexed folder leaves, and the refusal. The two measurements, the same series of 300 graph requests on a fresh service before and after (--steps 1,6 --repeat 300 --no-trace --no-ollama; 590 files and 88,785 vertices before, 592 files and 89,240 after, WSL 2, other work running on the machine): a request took a median 3,447 ms (worst 4,252) before and 996 ms (worst 1,121) after, the rest being the database's own counting (110,000 edges and 89,000 vertices, about 0.2 s each); resident memory in blocks of 50 requests was 289, 325, 351, 361, 374 and 391 MB before (threads 33, 140 MB above the idle size) and 243, 246, 250, 254, 257 and 260 MB after (threads 17); the first scan's peak is about the same, 470 MB before and 475 MB after. The remainder is gone as a ceiling, not as a slope. The series of 300 requests above ended while the service's pool of worker threads was still growing (from 7 to 17), which is where the 0.07 MB per request came from; 2,000 graph requests on a fresh service (--steps 1,6 --repeat 2000 --block 100 --no-status --no-trace --no-ollama, 592 files and 89,419 vertices, WSL 2, the machine busy with other work) show where it stops. The pool grew from 9 threads to 31 by request 1,000 and to 33 by request 1,100, and stayed there. All of these 2,000 requests, and the figures of this paragraph, are of a store of one root (89,000 vertices) with requests that name no worktree; a store of two roots with a scoped request was run for 300 requests only (the pool still growing, 17 to 31 threads, +0.098 MB per request) and not to its ceiling. Resident memory in blocks of 100 requests was 226.9, 234.3, 242.4, 243.2, 231.3, 238.7, 246.8, 254.7, 250.0, 234.7, 241.4, 249.6, 257.8, 245.4, 238.1, 244.8, 252.0, 256.8, 237.1 and 242.1 MB: a sawtooth between 224 and 265 MB (the service held 265 MB after its first scan; each request builds its page and its counts, and the pages go back after it) with no trend, +0.006 MB per request over the 2,000, 249.8 MB at the end after an idle wait, a median 1,122 ms per request (worst 1,639). The same 2,000 requests sent after 2,000 status requests, so that the pool was full from the first of them, were the same sawtooth, 228 to 261 MB, +0.004 MB per request. It is not Python objects: with tracemalloc (--trace-at 200,1800, 2,000 requests, threads 33) the memory Python holds was 115.06 MB at request 200 and 115.07 MB at request 1,800, the objects 120,484 and 120,486, and the allocation site that grew most was 0.016 MB (the date formatting of an HTTP header), none of them by request. What the pool keeps is therefore a ceiling, its limit (asyncio.to_thread's default executor: the smaller of 32 and the processor count plus 4; 33 threads on this machine with the main one): each added worker thread costs about 0.8 MB of resident memory here (its stack and its per-thread allocator caches; the service has two arenas, so the threads do not own one each; the series rose from 227 to about 245 MB while the threads went from 9 to 33). A dedicated executor would only move that limit, so none was made.

The cockpit's broker. cairnmind cockpit serve indexes nothing and opens no store: it proxies the service's routes, so there are no edits to measure. Asked for what a workspace sends most, in turn the state, the status, the graph (2,000 nodes), the groups, one node's neighbors and the brief (--steps 1,8 --repeat 3000 --block 100 --no-trace --no-ollama; step 8, the broker under a launcher of the script as the service is, one process at the start and at the end), its resident memory went from 63.2 MB to 145.4 MB over 3,000 requests: in blocks of 100 requests 79.4, 88.0, 91.3 and on to 145.3, 145.4, 145.4, 145.4 and 145.4 MB (0.024 MB per request over the whole run, flat only over the last 500), the pool's threads from 12 to 33 by request 600, a median 348 ms per request (worst 1,752). Limiting its arenas to two at start had made no difference (the earlier series of 300 requests), and handing the free pages back every 10 s did not either (60.9 to 116.8 MB, the same slope), so neither is done. With tracemalloc on the broker (--trace-at 200,2800) the memory Python holds went from 31.80 to 34.14 MB between request 200 and request 2,800 (the threads from 17 to 33; the allocation sites that grew, none by more than 0.012 MB) while its resident memory went from 94 to 170 MB: what grew was not a Python object that is alive. Two things in the broker fit that and both are fixed. The broker made a new HTTP client for every request it sent to the service (several for one request of the state), each loading the system's certificate store for a plain http address that needs none; it makes one, without a certificate store and keeping no connection (a service that was restarted is found at the next request). And httpx binds the stream of an answer to the answer, a reference cycle that only a run of the garbage collector frees, and the runs come rarer as the heap grows: the bodies of the answers, the graph's with its 2,000 nodes the largest, piled up between them; the broker cuts the cycle as the database's client does (arcade.py). A test sends ten requests with the collector off and finds every answer freed at the end of its request (it fails without the line). The same series after the first change alone: 60.3 to 119.4 MB (0.014 MB per request, blocks 72.5 to 119.0, no ceiling); after both, 60.3 to 66.2 MB, blocks of 100 requests of 63.2, 63.8, 64.2, 64.7, 65.1 and from the sixth block on between 65.1 and 66.2 MB, +0.001 MB per request, threads 33 from request 400, a median 318 ms (worst 1,500): a ceiling about 3 MB above what the first 100 requests reach, the pool's threads. The broker's workers, the processes that run a coding client's pane for a run, were not part of the series, none being started (the process count stayed at 1); that needs a real machine with a client installed.

What stays on purpose. The indexing process remembers, per project, what it learned in its last pass, so that the next pass reads only the files that changed and writes only the graph rows that differ (#62, #385): the identity of every file with its stored analysis (symbols, imports and calls: 29 MB for 588 files, 3.3 MB per 10,000 graph vertices) and the graph it wrote (every vertex id with a digest and every edge id: 31.7 MB for 88,663 vertices and 110,576 edges, 3.6 MB per 10,000 vertices at 1.25 edges per vertex). A service with a project of 100,000 vertices therefore holds about 70 MB for it for as long as it runs; it keeps one entry per project and drops it when the project is removed or deleted by another process (forget_missing_projects), never one per edit. The rest of the 114 MB is the interpreter and the imported modules (19 MB of code objects). The answer cache holds at most 128 answers and is cleared by every write; the parser's languages are cached (at most four), the retriever keeps one small index description per vector type, and the transcript files whose import read nothing are remembered by name. The embedding queue, the model clients (a client is opened and closed per call) do not grow in the measurement.

Store size

store size [PROJECT] [--json] reports how large the store is. Like the other commands that only read, it never starts the engine or the service and changes nothing; it prints counts and sizes, never the text of a record or a source. It lists:

  • every collection (the tables of the schema, nodes, edges and each vector_* type) with its rows and approximate bytes;
  • sources by kind, current against replaced (an earlier version of the same address), and their chunks grouped by the kind of their source in the same way;
  • vector rows per embedding namespace, and jobs per state;
  • disk use: the whole data directory, arcade/databases and this store's database in it, arcade/engine.log and its rotated copies engine.log.1, engine.log.2 and so on, the engine's arcade/log, the backups in backups/ (scheduled ones, before-schema-*, before-restore-* and others, each a count and a size) and the agent journals in runtime/agents (sessions and size).

With PROJECT the rows are that project's only; journal_state and ingestion_inbox belong to no project and are shown as store-wide (JSON: rows and bytes null, "store_wide": true), and the disk use is always the whole data directory. Bytes are the length of each row's JSON form, measured in the engine (equal to UTF-8 bytes for ASCII text), so they are close to what the row takes in a backup before compression, not what it takes on disk (except the rows of embeddings and of the vector_* types, which a backup does not carry, #187). A collection of at most 1,000 rows is summed exactly, and so are one project's rows. Above that, for the whole store, the bytes are estimated from 256 rows, 32 windows of 8 rows at random positions spread over the whole collection, and marked ~ (JSON: "sampled": true); the row counts are always exact. The estimate is close when rows of different sizes are mixed through the collection (within about 2% in the tests and on a synthetic store of uneven rows); a collection where a few rows are far larger than the rest can be further off. To group chunks by the kind of their source the command reads one short row per source (id, kind and chunk count, no text), so its time grows with the number of sources: on a test store of 20,000 sources and 80,000 chunks it took about one second, and about one and a half seconds for one project of that store. The figures are not one snapshot: each is its own query, so a row the service writes meanwhile can be counted in one figure and not in another, and chunks whose source was not found are listed as (source not found) (JSON: "source_found": false). The text form looks like this (from a store filled by the test fixture in tests/test_store_size.py; collections with no rows are left out here):

Store size (all projects)
Bytes are approximate (length of each row's JSON form in the engine; equal to UTF-8 bytes for ASCII text); ~ marks a figure estimated from 256 sampled rows.

Collections
  projects                                  2         422 B
  sources                                   4       3.9 KiB
  chunks                                    7       4.5 KiB
  records                                   1         692 B
  jobs                                      7       4.4 KiB
  embeddings                                3       1.2 KiB
  journal_events                           34      11.5 KiB
  vector_994f28d5f148c8082083cef6           3       1.3 KiB

Sources by kind: current / replaced
  document                     1     1.5 KiB  /         1     1.6 KiB
  manual                       2       899 B  /         0         0 B

Chunks by source kind: current / replaced
  document                     2     1.7 KiB  /         3     2.2 KiB
  manual                       2       617 B  /         0         0 B

Vectors by namespace
  embedder@digest: 1 type(s), 3 rows, 1.3 KiB

Jobs by state
  pending: 7

Disk
  data directory        6.9 KiB  /tmp/.../memory
  databases               700 B
  this database           700 B
  engine.log              300 B
  old engine.log         absent
  engine logs            absent
  backups scheduled          1 file(s)      3.3 KiB
  backups before-schema      1 file(s)        200 B
  backups before-restore     1 file(s)        300 B
  backups other              0 file(s)          0 B
  safety backups (newest first; delete old ones with `cairnmind store prune-backups --keep K`)
    2026-11-14T09:12:40+00:00       300 B  before-restore-abc.cairnmind.json.gz
    2026-11-02T18:03:11+00:00       200 B  before-schema-3-to-4-abc.cairnmind.json.gz
  agent journals      2 session(s)      1.5 KiB
Measured in 0.197 s.

--json prints the same data with the keys project (null, or id and name), method (exact_rows, sample_rows, bytes), collections (each name, rows, bytes, sampled, store_wide), sources and chunks (each sampled and kinds: kind (for chunks also source_found), then current and replaced, each rows and bytes), vectors (types: name, namespace, dimension, project_id, rows, bytes, sampled; namespaces: namespace, types, rows, bytes, sampled), jobs (state to count), disk (data_dir, databases, database, engine_log, old_engine_logs (the rotated engine.log.<n> copies), engine_logs, each path, exists, files, bytes; backups with path and scheduled, before_schema, before_restore, other, each count and bytes, and safety: each safety backup with name, kind, bytes and modified, newest first; agent_journals with path, exists, sessions, files, bytes), elapsed_seconds and text. A size is null (text: unknown) when it could not be estimated.

Replaced sources and what else is kept

When a file is edited or deleted, its earlier version stays as a replaced source with its full text and hash, so evidence that cites it can still be read and checked; its chunks and vectors are deleted with the replacement, since search never reads them. A store written by an earlier release still holds such chunks (Chunks by source kind, column replaced). store drop-replaced-chunks [--batch N] [--max-batches N] deletes them, for every project in the store (it takes no project), and prints how many rows went (removed: chunks, embeddings, vector_rows; sources, transactions, complete). It deletes at most --batch rows (default 200), chunks or left-over vectors, per transaction, so other writes are not held up for long; transactions counts every one of them. It can be stopped and run again, and complete is false when --max-batches stopped it with rows still to delete. No source, record or other evidence is touched. Restoring a backup made before the clean-up brings those chunks back; run it again afterwards.

What else is kept without end is bounded as follows:

  • Safety backups. The store copies itself to backups/before-schema-* before it upgrades its schema and to backups/before-restore-* before a restore. Nothing deletes these on its own, and the daily rotation (which keeps the last seven scheduled backups) never counts them. store prune-backups --keep K deletes all but the newest K of each kind: it prints the files it would delete and those it keeps, and asks before deleting (--yes skips the question). Only a person in their own terminal can run it; inside a coding session, or without a terminal, it deletes nothing. A file written again after the list was shown is left in place. Scheduled backups and backups you named yourself are never touched.
  • Job history. Every job row stays, because later work reads it: a job's key stops the same extraction or embedding from being queued again, status and the job summaries count jobs by state, import coverage reads the import job, and a held or all-rejected extraction can be queued again. What goes is the attempt history of completed jobs that last changed more than job_history_days ago (config.json, default 30, 0 keeps it): once a day, right after the daily backup, the writer installation empties it and keeps how many events there were (jobs show still counts them). Failed, pending and running jobs keep their history.
  • arcade/engine.log. When the engine starts and the log has reached engine_log_bytes (default 10 MiB), it is moved to engine.log.1, older copies shift up, and engine_log_copies of them are kept (default 3). The engine therefore always starts on a log under the limit; one long run can still write past it until the next start. If the filesystem refuses the rotation, the engine starts anyway, appends to the old log and writes a line there saying why.

Atomic writes and durability on POSIX and Windows

Local state files (config.json, installation.json, cockpit preferences, API credentials, agent journals, backups, and memory snapshots) are written to a private temporary file in the same directory, flushed and synced to disk (os.fsync on POSIX / FlushFileBuffers via os.fsync on Windows), and swapped into place atomically (os.replace, and on Windows, where an ordinary reader or an antivirus scan may hold the target, retries for about three seconds and then MoveFileExW with write-through, in private_files.atomic_replace). What is guaranteed when the call returns, by platform:

  • POSIX: the file's data is on disk before the rename, and the parent directory is synced after it (fsync of a O_DIRECTORY descriptor), so the new name survives a sudden power loss.
  • Windows: the file's data is on disk before the rename (FlushFileBuffers). The rename is a POSIX-semantics rename where NTFS allows it, otherwise MoveFileExW with MOVEFILE_WRITE_THROUGH, and the parent directory is flushed afterwards through a directory handle (FlushFileBuffers, which NTFS accepts for a handle that may write). A volume that refuses the directory flush still gives what NTFS's journal gives: after a power loss the old name or the new one, whole, never a half-written file. Only the promise that "returned means the new name is on disk" is as strong as the volume's own flush there.
  • A reader and a replace. Files opened through private_files.open_no_follow and read_text_shared share delete, so a concurrent replace does not wait for them. Python's own open() does not, on Windows: a replace waits for such a reader with bounded retries (about three seconds) and then raises, with the old file whole.

When the engine does not read a request (#558)

On the pinned ArcadeDB (26.11.1) the engine very rarely does not read a request that waits on a kept connection: very roughly once in tens of millions of requests, a rough estimate from the project's own CI runs, where it was seen four times (three reads and one write in a transaction, the last against the pinned container image), and never reproduced on a developer machine. The command that sent it waits its 30 seconds and reports the database as unavailable (unavailable (ReadTimeout)) though the engine runs and answers the next request at once. Nothing is half-written: the request was never read, and a transaction the engine holds open is dropped after the same 30 seconds. Running the command again is the way out; the product does not send a read again by itself in 0.13.0. Inside a longer operation the operation stops with that error, and you run it again. A backup is written to a temporary file and moved into place only after its read transaction ends, so a backup that stops leaves no file under its name. A restore that stops before its first change leaves the store as it was; one that stops later is put back from its before-restore-* copy and says so; when it cannot be put back, or the process dies, the store is refused under the unfinished mark until a restore finishes, and the mark stays and running cairnmind restore FILE again finishes it (the message may say that the engine "failed or stopped answering" and name memory: for this error that only means no answer came). An indexing pass that stops leaves the previous code graph, or marks it as not built when the pass wrote it in several transactions, and the next pass of that project writes it again.

SCIP multi-language indexers

Downloaded SCIP indexers and temporary index outputs are stored under <data_dir>/runtime/scip/ with owner-only private permissions (0700 on POSIX, Protected DACL on Windows). Direct binary downloads are pinned to exact release versions and verified against exact SHA-256 digests before extraction (cairnmind scip install or scip enable --yes only); archive extraction rejects absolute paths, path traversal, symlinks, and oversized outputs. Indexer subprocesses run in isolated process groups (or Windows Job Objects) killed completely on scip_timeout (default 300 s), never write index.scip into the user's git working tree, and use --network=none with a read-only (:ro) mount when falling back to Docker (e.g. scip-clang or scip-ruby on Windows). Background indexing is off until a person runs cairnmind scip enable PROJECT, which says first which indexer would run (the exact version for a pinned one, "whatever version is on your PATH" for the others), from where, and that the indexer may run the project's own build (cargo, Gradle, Maven, MSBuild: build scripts, with network access), and with --yes installs the checksum-pinned ones and turns it on for that project; cairnmind scip disable PROJECT turns it off. The background service never downloads or installs anything, and an upgrade never turns it on. Indexers and any build they start run with a minimal environment: no token, password or CAIRNMIND_* variable. An indexer with no pinned checksum (scip-dotnet, scip-php, scip-go where no binary is pinned) is never fetched: it is used only when you put it on PATH yourself (a copy found through the current directory or a relative PATH entry is ignored), and a Docker image is never pulled. A cached binary is checked again against the digest recorded at install. A SCIP index is attached only to a file whose stored copy is what the indexer read and whose lines exist (an index Cairnmind ran itself is checked against what the indexer read; an imported one is checked against the manifest you give it, see below, and otherwise only against the stored copy and its line count); a file edited after an indexer described it is marked stale, said in the pass result and in cairnmind doctor, until an indexer runs again. scip_mode (CAIRNMIND_SCIP_MODE) is "manual" (default) or "auto" (both: only enabled projects) or "off"; use cairnmind scip status, cairnmind scip install, cairnmind scip index, and cairnmind scip import to inspect or drive indexing explicitly. cairnmind scip import PROJECT INDEX_FILE takes an index made elsewhere and refuses to run unless it is tied to the tree: either --manifest PATH, a JSON list of {"path", "sha256"} with the SHA-256 of every file the index was built from (cairnmind scip manifest INDEX_FILE --root DIR writes INDEX_FILE.manifest.json beside the index; run it right after the indexer, in CI or by hand; scip index runs the indexer itself and keeps no index file, so it needs none), or --matches-current-tree, your statement that the index was built from the files as they are now, recorded in the result as tree_match: "stated by the person". With a manifest, a document whose file differs from its hash, is absent or is not named is left out and listed in the result (files_skipped, skipped up to 20 entries, skipped_not_listed for the rest), and a manifest path that leaves the repository refuses the whole manifest. With a manifest the result says tree_match: "manifest"; "hashes" is only the result of an indexer run Cairnmind made itself, whose hashes it took before the run. A manifest is the claim of whoever made it, at the time scip manifest ran: an index carries no hash of the files it was built from, so Cairnmind cannot tell whether the index was really built from those files, and the manifest does not name the index it belongs to. Anyone who can run the command line, a coding assistant with a shell included, can make a manifest or pass --matches-current-tree. The service, MCP tools and agents have no way to state that an index matches.