Skip to content

Recover a CORE install

This page describes how to bring back a CORE production install. The backup is the Proxmox nightly backup of the whole CORE VM, and the first way back is to restore that image. The second way, rebuilding from parts, is for when no image is usable. The recovery drill (#1070) restores the image on a throwaway VM, checks it, then destroys the VM. The page lists paths only. No secret value appears here.

Every step names who runs it:

  • host admin (darek, outside CORE): the person with root on the hypervisor and the VM. Every setup script and core-deploy needs root. The governor's CORE account holds no sudo, so these steps happen outside CORE.
  • a CORE account: core (the services), core-law (the law's custodian), core-runner (the deploy pipeline). These accounts act on their own, through the units and scripts, once the host admin has set them up.

The backup: Proxmox nightly VM backup

  • What: the Proxmox backup job for VM 200, the CORE VM. It runs every night at 02:30 and makes a vzdump-qemu-200-<date>.vma.zst archive (15.4 GB on 2026-10-16).
  • Where: on the Proxmox host pve, in storage backup (/ZFS-pool/backup). That is a different disk from the VM's own (local-lvm).
  • Contains: the VM's whole disk, so every part in the table below, the unique ones included.
  • Can lose: up to 24 hours, that is everything since the last 02:30 run.
  • Live snapshot: the backup is taken while the VM runs. After a restore, PostgreSQL replays its log on first start (about 2.5 minutes in the drill).
  • Limit: the archive sits on the same physical Proxmox host as the VM. Losing pve loses both. How long archives are kept is set in the backup job on pve.

Restore from the VM backup

Every step is the host admin (darek, outside CORE)'s: qm runs on pve, and commands inside the VM run as root through qm guest exec <vmid> --. The guest agent works on a restored VM.

# Step Note
1 qmrestore <archive> <vmid> --storage ZFS-pool --unique 1 a drill uses a new <vmid>; a real restore replaces VM 200
2 Before the first boot: qm set <vmid> --delete ide2,cicustom,ipconfig0,nameserver,searchdomain (remove the cloud-init drive). A drill clone also gets qm set <vmid> --name core-restore-drill --net0 <…>,link_down=1 --onboot 0 without step 2, cloud-init would run its setup again: reset passwords, upgrade packages, re-own /mnt/vector_db. The drill clone must not reach the network next to the live VM. The new name is not needed for isolation (the guest keeps its hostname core, and its network is down); it keeps qm list and the Proxmox UI from showing two VMs named core. qmrestore has no --name, so step 2 sets it
3 qm start <vmid>, then wait until qm agent <vmid> ping answers
4 Drill clone only, as soon as the agent answers: systemctl stop core-pipeline.timer core-promote-propose.timer core-qdrant-backup.timer core-law-auto-apply.timer core-law-digest.timer; crontab -u core-claude -r (each backup has only some of these timers; stopping a missing one is harmless) see Timers on a restored VM
5 Wait for PostgreSQL to finish crash recovery about 2.5 minutes after boot; see Startup on a restored VM
6 Wait until curl http://127.0.0.1:8000/health answers {"status":"ok"}. Do not restart anything the API retries by itself while PostgreSQL recovers, at most a minute apart (#1092); it reaches Qdrant on loopback, with or without network (#1088)
7 The checks in Check the result the audit and the law check run as core-claude (#1089)
8 Drill only: qm stop <vmid> && qm destroy <vmid> --purge 1 --destroy-unreferenced-disks 1 leaves no disks, config or job entries

Timers on a restored VM

The backup restores core-pipeline enabled (deploys approved promotions, first run 2 minutes after boot). A backup from before 2026-10-18 also restores core-law-auto-apply (applied record-only law without a merge, first run 5 minutes after boot) and core-law-digest (a daily read-only digest); core-law-setup now removes both. Backups from 2026-10-19 to the deploy that runs core-one-path-setup step 8b/8c also restore core-promote-propose (never ran: no token) and core-qdrant-backup (a Qdrant snapshot job, removed by #1258). From 2026-10-23 core-claude's crontab runs the daily promotion proposal at 06:00 (infra/scripts/core-promote-daily.sh); from 2026-11-02 it also writes the thesis trip counts at 05:30 (infra/scripts/thesis_transcript_counts.py,

1396). None of

these is stopped before the first boot, because that would mean editing the VM's disk from pve (#1090).

  • Drill clone: step 2 takes its network down before the first boot. The pipeline cannot reach GitHub, so it can neither fetch nor deploy, and law auto-apply writes only the clone's own disk, which step 8 destroys. Step 4 stops every timer and removes core-claude's crontab as soon as the guest agent answers (about 40 s after boot), before the first one is due. They are not started again: the clone is destroyed.
  • Real restore (replaces VM 200): leave core-pipeline enabled. The restored VM is CORE again, and the pipeline then deploys a promotion approved after the backup. If the two law timers came back, remove them at once: sudo core-law-setup --governor core-darek --apply. The Services check confirms what is active.

Startup on a restored VM

While PostgreSQL replays its log, the services that need it restart on their own. In the 2026-10-17 drill:

  • core-api restarted twice through its retry (#1092), then answered {"status":"ok"}.
  • core-daemon and 15 core-daemon-worker@ units restarted once each, on their 2-minute watchdog.

This is expected. Everything came back without a manual step, so these restarts are not a gap. Restart nothing by hand (step 6).

Rerun: 2026-10-17

The rerun restores the nightly backup of 2026-10-17 02:30, vzdump-qemu-200-2026_10_17-02_30_*.vma.zst, with the restore steps above and nothing else. It is a clean pass when:

  • step 6 needs no restart and no address alias: the proof for #1092 and #1088;
  • every row in Check the result is healthy, the audit included: PASS, with the user and command named there;
  • the data check finds core.blackboard_entries rows up to the backup's start;
  • no step needs a fix that is not written on this page.

What changed in the live VM before that backup, on 2026-10-16:

  • The dev checkout follows each deploy (#1063). The 3f3ab7fa deploy moved it from 354d17fd; its offline audit is PASS and law check-tree exits 0.
  • Nine stale .specs/ files and a duplicate custody line were removed from /opt/dev/CORE and /opt/core/law (host admin, once). They came from proposals that predate main's deletions.
  • All 36 law proposals are superseded by main and moved to /opt/dev/CORE/var/law-proposals-withdrawn/, so neither law apply nor the timer can apply one again (#1096 adds the guard).
  • QDRANT_URL is moved to loopback by core-runtime-setup (#1088).

"Same state as before" for this rerun, without anything recorded by hand:

  • runuser -l core-claude -c 'git -C /opt/dev/CORE rev-parse HEAD' on the clone equals readlink /opt/core/current on the clone (the checkout follows the live release);
  • the clone's /opt/core/custody/ledger.jsonl is a prefix of the live VM's (lines added after 02:30 are the only difference);
  • the open-findings count (the open-findings row in Check the result) is compared with the live VM's; a difference must be explained by work after 02:30.

Drill record: 2026-10-16

  • Restored from: vzdump-qemu-200-2026_10_16-02_30_01.vma.zst (15.4 GB, nightly job, TASK OK), storage backup on pve.
  • Restored to: VM 990 core-restore-drill on ZFS-pool, a different disk from the live VM 200. It was isolated from the network the whole time, then destroyed. VM 200 kept running throughout.
# Step Time Result
1 Restore the archive 7 min 48 s ok
2 Isolate before first boot (net link down, no onboot, 12 GB / 8 cores, cloud-init drive removed) 3 s ok
3 Boot until the guest agent answers 38 s ok
4 Stop the timers that write under 5 s ok
5 PostgreSQL crash recovery about 2.5 min ok, automatic
6 Start the API 46 s ok only after a manual restart (#1087) and a loopback alias for Qdrant (#1088)
7 core-admin law check-tree --json 18 s exit 0: no refusals, law loads, 140 intent files valid, 0 dangling
8 core-admin code audit --offline --severity block 68 s DEGRADED: three .intent/ files differ from the last commit, as on the live checkout (#1063)
9 Data check: core.blackboard_entries 4 s 2,303 rows from the day of the backup, the last one 2 s before the backup started; 17,521 rows from the day before
10 Destroy the clone 5 s nothing left
  • Total: about 16 minutes of work, 12:33:42 to 12:57:59 including diagnosis. False starts are not in the table (the audit first run as core-law, then as core-claude; law check-tree without a path). The full log is /root/drill-990.log on pve.
  • Time to recover once the findings are fixed: about 13 minutes: restore 8 min, boot and database recovery about 3 min, checks about 2 min.
  • Result: not a clean pass. The data is complete, but the API did not come back by itself and the audit is DEGRADED. #1070 stays open until a rerun passes clean.

Findings

  1. A restored clone would run cloud-init's setup again. Removing the cloud-init drive before the first boot is now step 2 of the restore.
  2. The API did not come back by itself when PostgreSQL started slowly, as after a restore or a power loss: it started before PostgreSQL was ready, exited 0, and Restart=on-failure did not restart it (#1087). A clean reboot is not affected: on 2026-10-16 at 13:44 the live VM rebooted, and the API answered after 64 s with 0 restarts. #1092 fixes it; the #1070 rerun is the proof.
  3. QDRANT_URL pointed at the VM's LAN address, not loopback (#1088). Fixed: core-runtime-setup moves it to loopback.
  4. The audit was DEGRADED because three .intent/ files that core-law changed on 2026-10-15 were uncommitted (#1063). The restore did not cause this; the live checkout showed the same. Fixed: each deploy moves the checkout to the deployed commit.
  5. No single user and command ran the offline audit on a restored host (#1089). Fixed: core-claude with the checkout's .venv, see Check the result.
  6. A restored VM starts with every timer enabled. On the isolated clone, the pipeline ran once and failed on DNS (#1090). Settled: see Timers on a restored VM.
  7. The clone was capped at 12 GB and 8 cores because the host had about 28 GB free, so it did not match production (24 GB, 12 cores).

Drill record: 2026-10-17

  • Restored from: vzdump-qemu-200-2026_10_17-02_30_03.vma.zst, storage backup on pve.
  • Restored to: VM 990 on ZFS-pool. It kept the name core (see step 2). It was isolated from the network the whole time, then destroyed. VM 200 was not touched.
# Step Time Result
1 Restore the archive 10 min 46 s ok
2 Isolate before first boot 2 s ok
3 Boot until the guest agent answers 33 s ok
4 Stop the timers that write 3 s ok
5 PostgreSQL crash recovery ready 2 min 19 s after start ok, automatic
6 Start the API {"status":"ok"} 4 min 29 s after start ok, with no manual restart and no alias (#1092, #1088)
7 The checks 2 min 56 s see below
8 Destroy the clone 5 s nothing left
  • Total: 21 min 22 s; from the restore's start to the API, 15 min 48 s.
  • Checks:
  • Audit: PASS, 0 blocking.
  • Law: law check-tree exit 0.
  • Workers: 37 of 38 alive; the Goal Execution Worker is not counted, as the Workers row says.
  • Sandbox: 8 of 8 passed.
  • Ledger: identical to VM 200's.
  • Checkout: equals the live release b06e1444.
  • Data: the last row at 02:29:51, 11 s before the backup.
  • Not run: Database, Pipeline, open-findings.
  • Logs: /root/drill-990-2026-10-17.log and /root/drill-990-2026-10-17-checks.txt on pve.
  • Result: not a clean pass, because of the page gaps below. #1070 stays open.

Findings

  1. core-admin is not on root's PATH, so the Database, Pipeline and open-findings checks did not run. Fixed: every row in Check the result names its user and full path.
  2. The Services row expected the three timers active, but step 4 stops them on a drill clone. Fixed: the row states the drill exception.
  3. The Data query also counted rows the clone wrote after boot. Fixed: it stops at PostgreSQL's start on the clone.
  4. At startup the API restarted twice and core-daemon and 15 workers once each, all by themselves. Settled as expected: see Startup on a restored VM.
  5. The page did not say whether a drill clone must be renamed; it kept the name core. Settled: it need not be for isolation; step 2 renames it so the two VMs are told apart.

Drill record: 2026-10-23

  • Restored from: vzdump-qemu-200-2026_10_23-02_30_01.vma.zst (15 GB, nightly job, finished 02:35:09, both disks included), storage backup on pve.
  • Restored to: VM 990 core-restore-drill on ZFS-pool, full size (24 GB, 12 cores). It was isolated from the network the whole time, then destroyed. VM 200 was not touched. Run from the page as merged in #1270 (985efa66), nothing else.
# Step Time Result
1 Restore the archive 8 min 39 s ok, new MAC (--unique 1)
2 Isolate before first boot 3 s ok: cloud-init drive and settings removed, link_down=1, onboot 0, renamed
3 Boot until the guest agent answers 42 s ok
4 Stop the timers, remove the crontab 2 s ok; three of the five timers do not exist in this backup, and it has no core-claude crontab (both harmless, as the step says). core-promote-propose had already fired at boot, see finding 2
5 PostgreSQL crash recovery ready 2 min 20 s after start ok, automatic; redo 0.89 s
6 Start the API {"status":"ok"} 4 min 7 s after start ok, no manual restart, no alias; systemd restarted it 4 times by itself (#1092 exit 3)
7 The checks 4 min 35 s see below
8 Destroy the clone 5 s nothing left: no config, zvols or job entries
  • Total: 20 min 16 s, 09:21:44 to 09:42:00 UTC; from the restore's start to the API, 13 min 25 s.
  • Checks:
  • Checkout: 855040a6 with 17 uncommitted files; the clone's live release is 1c1ece1f. Audit and Law ran in the detached worktree at 1c1ece1f, as the page says. Recorded as finding 3.
  • Audit: DEGRADED, 0 blocking (9 INFO, 1 NOT EVALUATED: mypy_check timed out after 60 s). Healthy by the row.
  • Law: law check-tree exit 0; law loads, 140 intent files valid, 0 dangling.
  • Database: connected, 50 migrations applied, 0 pending, exit 0.
  • Data: the last row before PostgreSQL started is 02:29:43, 17 s before the backup started. 86 rows were written by the clone after boot and are left out.
  • API: {"status":"ok"}.
  • Workers: 13 of 38 alive at 09:39 (14 at 09:41). 19 workers with a heartbeat in the hour before the backup (00:24–00:29 UTC) had none after boot. Not healthy, see finding 1.
  • Services: core-daemon, core-api and the 15 core-daemon-worker@ units active; core-sandbox.socket active; every timer inactive; no core-law-* unit.
  • Sandbox: 8 of 8 passed.
  • Pipeline: live commit 1c1ece1f, the release the backup holds.
  • Open findings: 20. VM 200 had 18 at 09:04 UTC. The two extra are repo_sync::clone (f3efb061) and its stale marker (ffb28098), both open at backup time and resolved on VM 200 at 02:57 and 03:04. The clone created no open finding after boot.
  • Ledger: 51 lines; sha256 equals the first 51 of VM 200's 53 lines (5216129e…). A prefix, as required.
  • Vector store: every collection's point count equals the table in Vector store.
  • Logs: /root/drill-990-2026-10-23.log and /root/drill-990-2026-10-23-checks.txt on pve.
  • Result: not a clean pass, because of the Workers row. Restore, isolation, database, API, audit, law, sandbox, data, ledger and vectors are all good. #1070 stays open.

Findings

  1. 19 workers that the Workers row counts did not come back: Worker ShopManager, DB Sync Worker, System Observer, State Sensor, Test Runner Sensor, Proposal Pipeline ShopManager, Blackboard ShopManager, Violation Executor, Repo Embedder, Governance Embedder, Test Coverage Sensor, Coherence Sensor, Prompt Drift Sensor, Repo Crawler, Audit Ingest Worker, Canary Sandbox Janitor, Quality Ingest Worker, Dead Shim Sensor, Thesis Sensor. None sent a heartbeat in the 10 minutes after boot; 13 of them run every 132–990 s, so they missed several runs. core-daemon started at 09:31:50, during PostgreSQL's crash recovery. Its log shows ten workers failing to register (Connect call failed ('127.0.0.1', 5432), Connection reset by peer, unexpected connection_lost()) with no retry. Two of them, test_remediator and violation_remediator, were alive later. The 2-minute watchdog did not fire (NRestarts=0). On 2026-10-17 it did, and that restart is what brought the workers back. So Startup on a restored VM held by chance, and the same applies to a real restore or a power loss. The daemon needs the API's treatment (#1092): retry registration, or exit so systemd restarts it (#1271). Nothing was restarted by hand (step 6).
  2. Step 4 does not always come "before the first one is due". core-promote-propose.timer is Persistent=true (06:00), so the missed 06:00 run fired at boot, 09:31:40, 4 s before the guest agent answered. It was skipped (ConditionFileNotEmpty=/etc/core/promote-github-token; the backup has no token). It was harmless here. On a backup that holds the token it would run, and step 4 cannot stop it in time.
  3. The backup's dev checkout was not at the live release: 855040a6 with 17 uncommitted files, against 1c1ece1f. The page's note names 0a636dbf as live. That is VM 200's release today, after the backup. The worktree route made the checks independent of it.
  4. The audit's mypy_check timed out after 60 s (NOT EVALUATED). Healthy by the row, but no type check ran.

Drill record: 2026-10-23, second run

  • Restored from: vzdump-qemu-200-2026_10_23-15_01_09.vma.zst (14.86 GB), a hand backup taken for this run instead of the 02:30 nightly, with the nightly job's settings (--mode snapshot --compress zstd --storage backup) plus --protected 1, so that the job's pruning keeps the 02:30 archive the first run cites. 13:01:08 to 13:06:11 UTC, 5 min 2 s, both disks included, job finished successfully. VM 200's release at that time: 23d10ebe (deploy of 11:35:30, promotion #1276), which holds the fix for #1271 (#1273, 490b1af4).
  • Restored to: VM 990 core-restore-drill on ZFS-pool, full size (24 GB, 12 cores). It was isolated from the network the whole time, then destroyed. VM 200 was only read (state at backup time, below). Run from the page at aa32fb82, nothing else.
  • Recorded at backup time on VM 200 (13:00:49–13:01:00 UTC): 37 of 38 workers alive; 22 open findings; ledger 54 lines, sha256 8800ff8a…; checkout 23d10ebe, clean; vector point counts as in the Checks below. Timers: only core-pipeline.timer. core-claude's crontab: the 06:00 promotion job and the 15-minute alert check.
# Step Time Result
1 Restore the archive 9 min 0 s ok, new MAC (--unique 1)
2 Isolate before first boot 3 s ok: cloud-init drive and settings removed, link_down=1, onboot 0, renamed
3 Boot until the guest agent answers 38 s ok
4 Stop the timers, remove the crontab 3 s ok; only core-pipeline.timer exists in this backup, core-promote-propose no longer does. core-claude's crontab was there and was removed 34 s after boot, before its next entry was due (13:30)
5 PostgreSQL crash recovery ready 2 min 16 s after start ok, automatic
6 Start the API {"status":"ok"} 4 min 21 s after start ok, no manual restart
7 The checks 6 min 59 s see below
8 Destroy the clone 5 s nothing left: no config, zvols or job entries
  • Total: 24 min 26 s, 13:06:45 to 13:31:11 UTC, of which 3 min 27 s between steps 7 and 8 went to reading the clone's findings for the Open findings row. From the restore's start to the API, 13 min 45 s. With the backup, 30 min 3 s.
  • Checks:
  • Checkout: 23d10ebe, 0 uncommitted files, equal to the clone's live release. Audit and Law ran in the checkout itself (table rows), not in a worktree.
  • Audit: PASS, 0 blocking (9 INFO; 187 of 189 rules executed, 2 reporting rules skipped), 229 s.
  • Law: law check-tree exit 0; law loads, 140 intent files valid, 0 dangling.
  • Database: connected, 50 migrations applied, 0 pending, exit 0.
  • Data: the last row before PostgreSQL started is 13:01:01, 7 s before the backup started. 218 rows were written by the clone after boot and are left out.
  • API: {"status":"ok"}.
  • Workers: all 31 workers with a heartbeat in the hour before the backup sent one after boot. 37 of 38 alive, as on VM 200 before the backup. #1271 holds (#1273). Not counted: the Goal Execution Worker (last seen 2026-09-13) and six long-period workers last seen at the 11:36 deploy.
  • Services: core-daemon, core-api and the 15 core-daemon-worker@ units active; core-sandbox.socket active; every timer inactive; no core-law-* unit.
  • Sandbox: 8 of 8 passed.
  • Pipeline: live commit 23d10ebe, the release the backup holds.
  • Open findings: 18 on the clone, 22 on VM 200 at backup time. The clone's own database also counts 22 open at the backup. The difference: four test.coverage findings resolved by reaudit (VM 200 resolved the same four at 13:01:38–13:01:51); repo_sync::clone opened, because the clone has no network; and the blocking access_register::github::bypass::live-writers finding, resolved only on the clone, see finding 1.
  • Ledger: 54 lines, sha256 8800ff8a…, equal to VM 200's at backup time (no line added since).
  • Vector store: every collection's point count equals VM 200's at backup time: core-code 6,921, core-tests 7,577, core-docs 629, core-prompts 156, core-patterns 2,492, core_policies 265, core_specs 2,546, governance_claims 516. The first three are above the table in Vector store, which was counted earlier in the day; VM 200 had embedded more since.
  • GitHub: no event, issue, comment, pull request, commit or workflow run on the repository from 13:01:08 to 13:31:11 UTC. Nothing from the clone.
  • Logs: /root/drill-990-2026-10-23-run2.log, /root/drill-990-2026-10-23-run2-checks.txt, /root/drill-990-2026-10-23-run2-pre200.txt and /root/drill-990-2026-10-23-run2-findings.txt on pve.
  • Result: clean pass against #1070's done-when: throwaway install, restored only from the backup and this page, audit and law pass, services up, ledger and .intent/ (checkout 23d10ebe, clean) equal to the pre-drill state, findings equal with the difference explained, every gap opened as an issue (finding 1).

Findings

  1. Without GitHub, the State Sensor resolved a blocking finding it could not check (#1285). check_github_access records an unreadable source only as not evaluated, and _sync_access then resolves every open access finding it did not see again. On the clone this cleared bypass::live-writers::DeployKey:None, which is still open on VM 200. It does not change what the backup restores, but a restored VM without network reports a cleaner access state than it has, and so does the live VM during any GitHub outage.

What a complete backup contains

Rebuildable means that git (by commit SHA), GitHub or PyPI can make the part again. Unique means that only a backup can bring it back. Every part lives on the VM's disk, so the nightly VM backup holds all of them; the last column says what else exists.

Part Where it lives Kind Backup
Database PostgreSQL container core_postgres_db, volume core_postgres_data (docker-compose.yml) unique nightly VM backup; also a dump /opt/core/backups/<stamp>-pre-<sha12>.dump before each deploy that migrates, restore-checked by core-deploy (see The pre-migration dump)
Vector store Qdrant (QDRANT_URL in /opt/core/etc/core.env; storage /mnt/vector_db/core_qdrant_db in compose, the VM's second disk scsi1 = /dev/sdb) derived (re-embedding takes hours) nightly VM backup: the Proxmox job includes scsi1 as well as scsi0 (verified in the 2026-10-23 job log); see Vector store
Law, as committed /opt/dev/CORE/.intent, /opt/dev/CORE/.specs rebuildable git (GitHub)
Release law /opt/core/law/.intent, /opt/core/law/.specs rebuildable from git; core-law writes it on each apply
Custody ledger /opt/core/custody/ledger.jsonl (only lines from before the move are in git, in .intent/custody/ledger.jsonl) unique nightly VM backup
Ledger signing key /opt/core-law/home/.ssh/core_law_ledger (the public half is in git as .intent/custody/allowed_signers) unique nightly VM backup
Deploy ledger /opt/core/deploy-ledger.jsonl (core-deploy --rollback reads it) unique nightly VM backup
Runtime secrets /opt/core/etc/secrets.env (DATABASE_URL, CORE_MASTER_KEY); its sources /opt/dev/CORE/.env and /opt/dev/CORE/.secrets/core.env unique nightly VM backup. Without CORE_MASTER_KEY, the secrets stored in the database cannot be read
Host config /opt/core/etc/deploy.conf, /opt/core/etc/core.env hand-edited nightly VM backup; the examples are in infra/systemd/d2/
Pipeline config /etc/core/pipeline.conf rebuildable core-one-path-setup writes it
Pipeline token /etc/core/pipeline-github-token (optional) re-issuable nightly VM backup; it can also be issued again on GitHub
Private-names config /opt/core/law/private-names/ (private-names.conf, names.txt) unique nightly VM backup. Without it, the assistant's commits and gh writes are refused
On-disk history /opt/dev/CORE/var/law-proposals/, /opt/dev/CORE/var/law-proposals-withdrawn/, /var/lib/core-pipeline/logs/, /opt/dev/CORE/.intent/keys/ unique nightly VM backup
Releases /opt/core/releases/<sha>/, /opt/core/current rebuildable core-deploy builds them by SHA
Custodian venv /opt/core-law/venv rebuildable core-law-setup installs it from the live release (its second run on a fresh host)
Service units core's user units in ~core/.config/systemd/user/ (sources in infra/systemd/d2/); system units in /etc/systemd/system/: the sandbox units (infra/systemd/sandbox/), the pipeline timer (generated by infra/core-one-path-setup) rebuildable the setup scripts write them
Accounts core, core-claude, core-darek, group core-dev (no script creates them); core-law, core-runner, core-build, core-sandbox, group core-gov (the setup scripts create them) rebuildable listed here

The pre-migration dump

Before a deploy migrates the schema (whenever migrations are pending), core-deploy stops every unit and dumps the database (BACKUP_COMMAND in /opt/core/etc/deploy.conf) to /opt/core/backups/<stamp>-pre-<sha12>.dump. It then checks the dump before anything migrates (#1113). core-deploy runs every step, as root; nothing is done by hand.

# Step On failure
1 pg_restore --list <dump> must read the dump refused: units restarted, nothing migrated
2 Row counts on the live database, read-only (PSQL_COMMAND, in a BEGIN TRANSACTION READ ONLY). Every unit is still stopped, so these are the counts at dump time refused
3 The dump is restored into a throwaway cluster: a container of the server's own image (RESTORE_IMAGE), --network none, removed afterwards (docker rm -f even after a timeout of one hour). A new cluster in a temp dir inside it, pg_restore --no-owner --no-privileges --exit-on-error, then the same row counts. The live server is never written refused
4 Every table's count in the copy must equal the live count refused; the tables that differ are recorded

The result is written next to the dump as <dump>.check.json (verdict, reason, the live counts, the tables that differ, the end of the error output), and on a deploy that goes live also in its deploy-ledger line as backup_check. pg_restore --list reads only the dump's table of contents: a dump cut off halfway still lists, and only the restore in step 3 finds it.

Why refuse, not warn: until the migration runs, refusing costs only time (the old release keeps running on its own schema). After it, the dump is the only way back. A dump that does not restore is no backup.

Without PSQL_COMMAND or RESTORE_IMAGE the dump is only listed (step 1), and the deploy warns and records the verdict unchecked. core-one-path-setup adds both when missing, from DATABASE_URL and the core_postgres_db container.

Restore the newest dump by hand (host admin, as root; the steps the check runs, ending in a table list with sizes):

dump=$(ls -t /opt/core/backups/*-pre-*.dump | head -1)
image=$(grep '^RESTORE_IMAGE=' /opt/core/etc/deploy.conf | cut -d= -f2-)
pg_restore --list "$dump" | head
docker run --rm -i --network none --user postgres --entrypoint /bin/sh "$image" -c '
  d=$(mktemp -d); initdb -D $d/data -U postgres -A trust >/dev/null
  pg_ctl -D $d/data -l $d/log -s -w -o "-c listen_addresses= -c unix_socket_directories=$d" start
  createdb -h $d -U postgres restore_check
  pg_restore -h $d -U postgres -d restore_check --no-owner --no-privileges --exit-on-error
  psql -h $d -U postgres -d restore_check -c "\dt+ core.*"' < "$dump"

To restore a dump into the live database itself, see step 5 of Rebuild from parts.

Record: no deploy has migrated since the check exists. The next deploy that migrates records the first result in its ledger line and <dump>.check.json.

Vector store

The Proxmox nightly VM backup (02:30, 7 daily, 4 weekly, 3 monthly) includes both of VM 200's disks: scsi0 (system) and scsi1 (40G, /dev/sdb, where Qdrant keeps its data). Neither has backup=0, and the 2026-10-23 job log lists include disk 'scsi0' and include disk 'scsi1'. A separate snapshot job (#1241) was removed again for that reason (#1081). The restore drill (#1070) proves it: in the restored VM, every collection's point count must match the table.

What is in it. Eight collections, all derived from files in the repository. Rebuilding them means embedding every file again (nomic-embed-text, thousands of calls, hours), so the VM backup is the way back and the rebuild is the fallback.

Collection Points (2026-10-23) Source Rebuild command (fallback)
core-code 6,898 src/** core-admin vectors rebuild --write --yes
core-tests 7,469 tests/** same
core-docs 615 docs/**, infra SQL same
core-prompts 156 src/shared/_prompts/** same
core-patterns 2,492 .intent/** same (both of its phases write it)
core_policies 265 .intent/rules/** same (phase 2)
core_specs 2,546 .specs/** same (phase 2)
governance_claims 516 .intent/ and .specs/ claims core-admin coherence seed bootstrap

None of these rebuild commands has been run end to end against an empty Qdrant.

Backup by parts

This is for when no VM image can be used, for example moving CORE to other hardware. It is not scheduled.

host admin (darek, outside CORE), on the live host, as root:

  1. Dump the database and its globals: docker exec core_postgres_db pg_dump -U <db-user> -Fc <db-name> and docker exec core_postgres_db pg_dumpall -U <db-user> --globals-only. The user and database name are in DATABASE_URL in /opt/core/etc/secrets.env.
  2. Copy these unique files, keeping owner and mode (tar --numeric-owner -cpf):
  3. /opt/core/etc/ (secrets.env, deploy.conf, core.env);
  4. /opt/dev/CORE/.env, /opt/dev/CORE/.secrets/;
  5. /opt/core/custody/, /opt/core/deploy-ledger.jsonl;
  6. /opt/core-law/home/.ssh/;
  7. /opt/core/law/private-names/;
  8. /etc/core/pipeline-github-token (if present);
  9. /opt/dev/CORE/var/law-proposals/, /opt/dev/CORE/var/law-proposals-withdrawn/, /var/lib/core-pipeline/;
  10. Record the live commit (readlink /opt/core/current) and, for the check at the end, the pre-drill state:
  11. sha256sum /opt/core/custody/ledger.jsonl;
  12. runuser -l core-claude -c 'git -C /opt/dev/CORE rev-parse HEAD';
  13. the open-findings count (the open-findings row in Check the result).
  14. Encrypt the archive and keep it off the host. The archive holds every secret CORE has.

Rebuild from parts

Use this only without a usable VM image. The VM is a Proxmox linked clone of core-template. That template is an Ubuntu VM prepared with scripts/coldroom-prep.sh: Docker, Poetry, the Postgres and Qdrant images and the guest agent, but no CORE. The drill destroys the clone at the end.

Write each step's start and end time in the drill record. The total is the time to recover.

# Step Who
1 On the Proxmox host: qm clone <core-template-vmid> <drill-vmid> --name core-drill (a linked clone), then qm start <drill-vmid>. Find its address with qm guest exec <drill-vmid> -- ip -br addr host admin (darek, outside CORE)
2 Copy the encrypted backup to the VM and decrypt it there host admin (darek, outside CORE)
3 Create the accounts no script creates: core, core-claude, core-darek and group core-dev. The governor core-darek must not be in sudo, docker or another root-equivalent group host admin (darek, outside CORE)
4 Clone CORE into /opt/dev/CORE and check out the recorded commit. Restore /opt/dev/CORE/.env and /opt/dev/CORE/.secrets/ from the backup host admin (darek, outside CORE)
5 Start PostgreSQL (docker compose up -d postgres in /opt/dev/CORE). Restore the globals with psql, then the dump with pg_restore --clean --if-exists -d <db-name>, both through docker exec -i core_postgres_db host admin (darek, outside CORE)
6 Start Qdrant (docker compose up -d qdrant), or point QDRANT_URL at the existing store. Its data comes back with the VM's disk scsi1; without it, rebuild the collections, see Vector store host admin (darek, outside CORE)
7 Restore /opt/core-law/home/.ssh/, /opt/core/law/private-names/ and /opt/core/custody/ from the backup. Then sudo /opt/dev/CORE/infra/core-law-setup --governor core-darek, first without --apply (plan only), then with --apply: it creates core-law, seeds the release law /opt/core/law/.intent and .specs from the dev tree, and keeps the restored key and private-names config. Nothing is deployed yet, so it skips the custodian venv (#1085) host admin (darek, outside CORE) runs it; core-law then owns the law
8 sudo /opt/dev/CORE/infra/core-runtime-setup --ref <sha> --governor core-darek, first without --apply (plan only), then with --apply. Then restore /opt/core/etc/secrets.env, deploy.conf and core.env from the backup over the files it made host admin (darek, outside CORE)
9 sudo core-deploy <sha> --promotion <PR> (core-runtime-setup installed it; <PR> is the promotion that made <sha> live): builds the release, switches /opt/core/current, starts the services host admin (darek, outside CORE) runs it; the units then run as core
10 sudo /opt/dev/CORE/infra/core-law-setup --governor core-darek --apply again: it installs the custodian venv from the live release host admin (darek, outside CORE)
11 sudo bash /opt/dev/CORE/infra/core-one-path-setup --ref <sha>: the pipeline account, /etc/core/pipeline.conf, the timer, BACKUP_COMMAND if missing. Restore /etc/core/pipeline-github-token if one is used host admin (darek, outside CORE) runs it; the timer runs as core-runner
12 Restore /opt/core/deploy-ledger.jsonl, /opt/dev/CORE/var/law-proposals/, /opt/dev/CORE/var/law-proposals-withdrawn/ and /var/lib/core-pipeline/ from the backup host admin (darek, outside CORE)
13 Check the result (next section) host admin (darek, outside CORE) runs the root checks; core runs the rest
14 Destroy the VM: qm stop <drill-vmid>, then qm destroy <drill-vmid> --purge. Delete the decrypted backup copy host admin (darek, outside CORE)

A step that needs a fix not written here is a gap. Record the gap as an issue, update this page in the same PR, and run the drill again. #1070 allows no undocumented fixes.

Check the result

The audit and the law check run as core-claude, with the dev checkout's own environment /opt/dev/CORE/.venv (#1089). Run them as root with runuser -l, so that core-claude's home and git settings apply. Other accounts fail:

  • core-law: git refuses the repository, which root owns ("dubious ownership").
  • The release's core-admin (/opt/core/current/venv): it audits its own installed CLI, not the checkout's, and lacks core-cli, so the CLI checks block.

core-claude can read neither /opt/dev/CORE/.env nor the secrets; the offline audit needs neither. The checkout must be at the deployed commit, which every deploy now sees to (#1063). When the backup's checkout is not there (a deploy refuses to move a checkout with uncommitted files; on 2026-10-23 it held 855040a6 with 17, while the backup's live release was 1c1ece1f), run the Audit and Law rows in a detached worktree at the live commit instead, and record the checkout's state as a drill finding:

runuser -l core-claude -c 'git -C /opt/dev/CORE worktree add -q --detach /opt/dev/CORE/var/tmp/wt-drill "$(basename "$(readlink -f /opt/core/current)")"'
runuser -l core-claude -c 'cd /opt/dev/CORE/var/tmp/wt-drill && REPO_PATH=$PWD PYTHONPATH=$PWD/src /opt/dev/CORE/.venv/bin/core-admin code audit --offline'
runuser -l core-claude -c 'cd /opt/dev/CORE/var/tmp/wt-drill && REPO_PATH=$PWD PYTHONPATH=$PWD/src /opt/dev/CORE/.venv/bin/core-admin law check-tree'
Check Command Healthy
Audit runuser -l core-claude -c 'cd /opt/dev/CORE && .venv/bin/core-admin code audit --offline' PASS, or DEGRADED with 0 blocking findings
Law runuser -l core-claude -c 'cd /opt/dev/CORE && .venv/bin/core-admin law check-tree' exit 0
Database sudo runuser -u core -- bash -c 'set -a; . /opt/core/etc/core.env; /opt/core/current/venv/bin/core-admin database status' (core reads the database credential through CORE_SECRETS_FILE in core.env) exit 0 (current)
Data docker exec core_postgres_db psql -U <db-user> -d <db-name> -Atc "select max(created_at) from core.blackboard_entries where created_at < pg_postmaster_start_time()" (user and database from DATABASE_URL in /opt/core/etc/secrets.env). Rows from after PostgreSQL started on the clone are the clone's own and are left out a time within minutes before the backup started
API curl http://127.0.0.1:8000/health {"status":"ok"}
Workers curl http://127.0.0.1:8000/v1/daemon/status every worker whose last heartbeat before the backup was within its last hour is alive again, with a heartbeat after the boot. Rows last seen long before the backup (on 2026-10-16: 19 test registrations from June and the Goal Execution Worker, last seen 2026-09-13) are not counted
Services systemctl --user -M core@ status core-daemon core-api 'core-daemon-worker@*' and systemctl status core-sandbox.socket core-pipeline.timer both active, and no core-law-auto-apply or core-law-digest unit. On a drill clone every timer is inactive: step 4 stops them
Sandbox sudo runuser -u core -- bash -c 'set -a; . /opt/core/etc/core.env; /opt/core/current/venv/bin/core-admin runtime sandbox-check --mode service' every row passed
Pipeline runuser -l core-claude -c '/opt/core/current/venv/bin/core-admin runtime status' live commit is the recorded commit. On a drill clone main cannot be read from GitHub (no network)
Open findings curl -s http://127.0.0.1:8000/v1/status/health \| python3 -I -c 'import json,sys; print(sum(r["count"] for r in json.load(sys.stdin)["blackboard"] if r["entry_type"]=="finding" and r["status"]=="open"))' equal to the value recorded at backup time, or the difference explained
Same state as before sha256sum /opt/core/custody/ledger.jsonl, runuser -l core-claude -c 'git -C /opt/dev/CORE rev-parse HEAD', the open-findings count (row above) equal to the values recorded at backup time