Cairnmind
Operations & Deployment 30 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 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.

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.

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 with bounded short retries for transient Windows sharing/antivirus holds in private_files.atomic_replace). On POSIX, Cairnmind also calls fsync on the parent directory (O_DIRECTORY) so the rename entry is durable across sudden power loss. NTFS does not expose directory-handle fsync to user-space processes; instead, NTFS records file-creation and rename metadata through its filesystem journal while file data is flushed by os.fsync (FlushFileBuffers) before MoveFileExW. All files opened through private_files.open_no_follow on Windows request FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, so concurrent readers do not trigger sharing violations during atomic replacement.

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; 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). Set scip_mode (CAIRNMIND_SCIP_MODE) to "auto" (default), "manual", or "off"; use cairnmind scip status, cairnmind scip install, cairnmind scip index, and cairnmind scip import to inspect or drive indexing explicitly.