sanctum CLI Reference

sanctum is the operator surface for every Sanctum host: router, wizard and doctor in one Python binary (Typer + Rich). brew install ogilthorp3/sanctum/sanctum-cli installs it from the public Homebrew tap, tapping ogilthorp3/sanctum on first use; the maintainer’s own host also keeps a dev install at ~/.local/bin/sanctum. The everyday commands are below, a dozen deeper helpers one level down. sanctum --help is the canonical roster, and it moves faster than this page.
sanctum <command> [args]Most commands read ~/.sanctum/instance.yaml and fail blunt when it’s missing or invalid; sanctum init writes a minimal one. The errors are deliberately curt: Sanctum is for technical-friend hausholds, and we trust you with the real line.
sanctum doctor
Section titled “sanctum doctor”The first command you run, the first when something’s wrong, and the first we’ll ask for when you need help. It probes the three subsystems the host needs healthy.
sanctum doctorsanctum doctor --fullsanctum doctor --jsonWhat it checks
Section titled “What it checks”| Group | Probe |
|---|---|
| LaunchAgents | launchctl list, filtered to haus.sanctum.*. Each row’s status is derived from its PID and last exit code |
| Providers | Reachability + latency for each configured model provider (claude, gemini, mlx_local) |
| Backup repos | restic snapshots against each configured repo (local SSD + cloud) |
It’s brevity-gated: one summary line when green (on a hub, after a Service principal (wave-1) line), the full tables only on a DEGRADED, UNKNOWN or FAILED row or with --full. --json emits the whole report, for the menu-bar plugin and CI.
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 |
The report printed, whatever it found: a DEGRADED, UNKNOWN or FAILED row leaves the exit code at 0, so a script reads overall from --json. A row reads UNKNOWN when its probe could not run: a provider with no key in the Keychain, a restic probe that timed out |
5 |
instance.yaml is missing or does not load |
sanctum self-test
Section titled “sanctum self-test”The canonical health suite: is the install still good after an update, a reboot or a drift suspicion? Sixteen probes, three tiers:
sanctum self-testsanctum self-test --jsonsanctum self-test --only cathedralThe sixteen probes
Section titled “The sixteen probes”| # | Probe | Verifies | Tier |
|---|---|---|---|
| 1 | network reachability | loopback + DNS resolve | CLI |
| 2 | node binary identity | on the haus tier, /usr/local/bin/node is the Node.js Foundation-signed binary; elsewhere the first node found (Homebrew’s, /usr/local/bin/node, then PATH) is codesigned, and no node at all reads n/a |
CLI |
| 3 | sanctum config valid | ~/.sanctum/instance.yaml parses and validates |
CLI |
| 4 | recent backup snapshot | a restic snapshot exists and is recent (n/a on a fresh install) | CLI |
| 5 | vault armor unlocked | the volume named in ~/.sanctum/vault-armor/manifest.json reads Locked: No (n/a where Vault Armor isn’t set up) |
CLI |
| 6 | satellite local brain | {url}/models on the router.default backend answers HTTP 200, or 401/403 from a server that wants a key |
satellite |
| 7 | Yoda cathedral (:1337) |
TLS port reachable | haus |
| 8 | Coder cathedral (:3301) |
TLS port reachable | haus |
| 9 | proxyd routing (:4040) |
service alive (an HTTP 401 counts — it answered) | haus |
| 10 | proxy key provisioned | the council’s proxyd key is set (environment or Keychain), not the fallback | haus |
| 11 | Force Flow (:4077) |
listening | haus |
| 12 | service user wave-1 | the wave-1 control plane runs as the sanctum service user |
haus |
| 13 | chitti samskara (:2188) |
listening | haus |
| 14 | TCC grants | the expected automation grants are present | haus |
| 15 | R2D2 supervisor heartbeat | the auto-fix supervisor is beating, with a sane success rate | haus |
| 16 | audit log within budget | the audit log is under its size cap | haus |
The five CLI-tier probes run everywhere. The ten haus-tier probes only mean something once the haus services are up; on a CLI-only box they return n/a, not fail, and n/a doesn’t count. The satellite probe runs only on a satellite and reads n/a everywhere else.
The satellite profile
Section titled “The satellite profile”A machine whose instance.yaml says instance.role: satellite (written by sanctum init --role satellite) reports the satellite tier. Every haus-tier probe reads n/a there, because those services run on the hub. Two probes carry the profile instead.
satellite local brain resolves router.default to its entry under router.backends and GETs {url}/models directly: no proxy, no redirects, so a 3xx fails. A satellite has no council to fall back on, so this brain is the one it thinks with.
| Backend key | What the probe does with it |
|---|---|
url |
The server’s OpenAI base URL, ending in /v1; the probe GETs {url}/models |
ca_cert_path |
Over https, verifies the server’s certificate against this CA; without it, against the system trust store |
client_cert_path, client_key_path |
Presents this certificate and key to a server that demands a client certificate |
api_key_env |
Names an environment variable whose value goes out as a bearer token |
any *_path key on an http url |
Fails the probe |
ca, client_cert, client_key |
Pre-release names; the probe fails and names the replacements (ca_cert_path, client_cert_path, client_key_path); rename them |
vault armor unlocked: locked after boot means the witness unlock has not collected its shares yet, and whatever lives on the volume waits until it does.
Beyond the self-test:
| Command | On a satellite |
|---|---|
sanctum council, chat, code, brainstorm, and the endocrine and bridge subcommands (such as sanctum bridge health) |
Print the “needs a full Sanctum haus” banner instead of starting, and exit 0. Bare sanctum endocrine or sanctum bridge prints Typer’s usage and exits 2, as a missing subcommand does on any machine. SANCTUM_HAUS_ON_SATELLITE=1 lifts the rule on a satellite that can reach the hub’s council and bridge; the banner names it |
Bare sanctum |
Prints its status line and does not open the council chamber; it prints no banner. The same override lifts this |
sanctum onboard --recipe operator, sanctum service-user status and check |
Report the hub’s service principal as n/a |
sanctum service-user install |
Refuses to run and exits 5 |
The satellite profile and both probes ship in sanctum-cli 1.0. The Satellite Setup guide shows the router block the brain probe reads.
Pass rule
Section titled “Pass rule”No percentage threshold. The suite exits 0 iff every applicable probe passes; one real failure exits 1. n/a probes are skipped either way.
[ 8/16] Coder cathedral (:3301) ···· fail no response on :3301
1 probe(s) failed. 14/15 applicable probes passed in 185 ms. Each red line above has the actionable detail.| Flag | Behavior |
|---|---|
--only <substr> |
Run only the probes whose names contain the substring |
--json |
Emit the report as JSON; the soak harness reads it |
sanctum logs self-test has the full transcript when a red line’s own detail isn’t enough. Run the suite after install, a macOS major upgrade or a reboot you’re unsure of, and weekly as hygiene; sanctum update runs it as the gate.
sanctum init
Section titled “sanctum init”Writes the smallest ~/.sanctum/instance.yaml the CLI accepts, an instance name and its slug, so a fresh Mac can run every other command. With --role it also records the machine’s role.
sanctum initsanctum init --yessanctum init --name chalet --role satelliteRun bare, it prompts for an instance name, offers one derived from the hostname, and derives the slug from the name. It honours $SANCTUM_INSTANCE_FILE, like the rest of the CLI.
| Flag | Behavior |
|---|---|
--name |
Instance name; skips the prompt |
--yes / -y |
Accept the hostname-derived name; no prompts |
--role |
hub or satellite, written as instance.role. satellite switches sanctum self-test to the satellite profile. hub grades the machine as the hub: every haus-tier probe becomes required, and node binary identity accepts only the Node.js Foundation-signed /usr/local/bin/node |
--force |
Replace the whole file and drop every other block, the router: block too. The old file is kept as instance.yaml.bak |
On an existing file
Section titled “On an existing file”Without --force, init never replaces a file that already exists. It edits the instance: block in place, keeps every other block and comment, re-parses the result before writing, and saves the previous version as instance.yaml.bak.
| The file | What init does |
|---|---|
Has no instance: block |
Adds one: name, slug and any --role |
Has an instance: block |
Sets instance.name and instance.role as --name and --role ask. An existing slug never changes; a block without one gets a slug derived from its name, even with no flags |
Has a slug and gets neither --name nor --role |
Leaves the block as it is |
| Cannot be edited safely | Leaves the file untouched, prints the lines to add by hand and exits 1 |
| Cannot be read, or is not valid YAML | Leaves the file untouched and exits 1 with the reason |
| Parses but fails the schema | Exits 5 with the schema error; an edit it made stays in place |
sanctum status
Section titled “sanctum status”The thirty-second health glance: the host’s own vital signs, with no probes into other services. If you run one command in the morning, run this one.
sanctum statussanctum status --onelinesanctum status --jsonWhat it reports
Section titled “What it reports”| Field | Source |
|---|---|
| instance / host | instance.yaml (instance name, hostname) |
| default provider | the router’s current default (e.g. claude) |
| disk | df on /System/Volumes/Data; DEGRADED at >=85% used, FAILED at >=90% |
| backups | restic snapshot count + age per repo (local SSD + cloud), oldest age wins |
| telemetry | 7-day rollup: requests and errors |
The default render is a set of Rich tables; --oneline collapses it to the one line a menu-bar plugin and a morning glance want:
sanctum @ manoir.local · backup 7h / ? · router→claude · disk 76% (operational) · telemetry 32r/8e/7dstatus answers “is this host okay right now?”; doctor is what you reach for when it shows red.
sanctum update
Section titled “sanctum update”Runs brew update, then brew upgrade ogilthorp3/sanctum/sanctum-cli, then sanctum self-test as the gate, and won’t call the upgrade done unless every probe still passes. Run it by hand on a new release; no launchd timer runs it yet.
sanctum updatesanctum update --dry-runsanctum update --skip-self-test| Flag | Behavior |
|---|---|
--dry-run |
Print every action without executing |
--skip-self-test |
Skip the gate. Operator-grade — use when you know what you’re doing |
brew upgrade exits 0 when nothing changed, so an already-current install falls through harmlessly. If the gate fails after a real upgrade, the command exits non-zero and says so: investigate, then downgrade or fix forward.
sanctum uninstall
Section titled “sanctum uninstall”Removes every operational artifact (LaunchAgents, Keychain credentials, the Homebrew formula and tap) but never your data. Pass --purge if you actually want the data gone too.
sanctum uninstallsanctum uninstall --purgesanctum uninstall --dry-runWhat it removes (always)
Section titled “What it removes (always)”| Artifact | How it goes |
|---|---|
Every haus.sanctum.* LaunchAgent in ~/Library/LaunchAgents/ |
bootout, then the plist is renamed .plist.uninstalled-YYYY-MM-DD, because orphan plists are worse than missing services. Found by glob, so it tracks the roster |
Every sanctum/* Keychain entry |
Revoked with security delete-generic-password |
The sanctum-cli formula and the ogilthorp3/sanctum tap |
brew uninstall, then brew untap; a later brew install re-taps |
SanctumBridge.app and SanctumLauncher.app |
Renamed with the .uninstalled- suffix |
What it preserves (without --purge)
Section titled “What it preserves (without --purge)”| Kept | What it holds |
|---|---|
~/.sanctum/logs/ |
The audit trail |
~/.sanctum/memory/ |
Agent memory and the Memory Vault |
~/.sanctum/backups/ |
Local snapshots |
~/.sanctum/secrets/ |
Mode-600 secret files |
| Your cloud bucket | Your R2, B2 or gdrive target, untouched |
What --purge adds
Section titled “What --purge adds”The ~/.sanctum/ data dirs above, renamed to ~/.sanctum.purged-<timestamp> rather than rm -rf’d, so a fat-fingered purge gets a few seconds of grace. It never touches /usr/local/bin/node, the Apple Installer’s domain.
sanctum logs <service>
Section titled “sanctum logs <service>”A typed shortcut around tail. It resolves a short name to its real path (some under ~/.sanctum/logs/, some under ~/.openclaw/logs/) and streams it: follow, last 50 lines.
sanctum logs <service>sanctum logs --listsanctum logs proxyd --once -n 200Service names
Section titled “Service names”sanctum logs --list prints the canonical map (names, paths, which files exist) and won’t go stale:
| Name | File |
|---|---|
r2d2 |
~/.sanctum/logs/r2d2-audit.jsonl |
kitchen-loop |
~/.sanctum/logs/kitchen-loop.log |
proxyd |
~/.openclaw/logs/proxyd.log |
yoda |
~/.openclaw/logs/sanctum-mlx.log |
coder |
~/.openclaw/logs/sanctum-mlx-coder.log |
cathedral |
both sanctum-mlx.log + sanctum-mlx-coder.log |
bridge |
~/.openclaw/logs/sanctum-bridge.log |
force-flow |
~/.openclaw/logs/force-flow.log |
watchdog |
~/.openclaw/logs/watchdog-rust.log |
agent-trace |
~/.sanctum/logs/agent-trace.log |
ram-sentinel |
~/.sanctum/logs/ram-sentinel.log |
launchd-health |
~/.sanctum/logs/launchd-health.log |
signal |
~/.sanctum/logs/signal-health.log |
backup |
~/.sanctum/logs/backup.log |
self-test |
~/.sanctum/logs/self-test.log |
log-rotate |
~/.sanctum/logs/log-rotate.log |
| Flag | Behavior |
|---|---|
--follow / --once, -f |
Stream (default) or take a one-shot snapshot |
--lines, -n |
How many lines of history to show first (default 50) |
--list |
Print every known service + its path, then exit |
Anything not in the map is rejected with a pointer to --list. No fuzzy match: know which log you want.
sanctum devices
Section titled “sanctum devices”Read-only inventory in three tables: Family (per-person), Shared, and Unassigned (auto-discovered, not yet attributed). It reads the Screen Time module’s devices.yaml, the source of truth that maps MACs to people and categories.
sanctum devicesLookup order: $SANCTUM_DEVICES_FILE (a fixture override, unset in production), then ~/.sanctum/screen-time/devices.yaml, then ~/Projects/sanctum-screen-time/devices.yaml; the first that exists wins. It never mutates: assigning is sanctum screen-time assign (Family Pass Phase 2) or an edit of the YAML.
sanctum schedule
Section titled “sanctum schedule”Read-only view of the curfew schedule: weekday and weekend cutoffs per child, plus shared-device hard curfews. Curfews live in the same devices.yaml that sanctum devices reads.
sanctum scheduleIt shows; it does not edit. To extend a curfew once, for a school event or a late movie, use the Force Flow override the command prints:
curl -X POST http://127.0.0.1:4077/screen/override \ -d '{"target":"NAME","minutes":30}'sanctum net home
Section titled “sanctum net home”Daily home-network health. One pane (Internet, WAN path, CDN/MSS guard, armor, hub) and a safe improve that only re-asserts the Firewalla MSS clamp, never flipping WAN mode or Advanced DMZ.
sanctum net homesanctum net home status --jsonsanctum net home improvesanctum net home doctor --applyWalkthrough: Home Network. Deeper NAT and speed tools: check, optimize and speedtest below.
sanctum net check
Section titled “sanctum net check”Read-only audit of your network topology. It changes nothing, so run it as often as you like.
sanctum net checkIt prints the NAT topology (single, double or unknown), the ISP and default gateway it detected, and one line of reasoning behind the verdict. Read that line: a double-NAT call is only as good as the evidence it cites.
sanctum net optimize
Section titled “sanctum net optimize”The guided path from double-NAT to single-NAT, where your own router (a Firewalla, typically) holds the public IP instead of the ISP’s hub. It is opt-in and reversible.
sanctum net optimizesanctum net optimize --plan-onlysanctum net optimize --yesIt runs net check first. Already single-NAT, or no Firewalla to put in front? It says so and exits 0 without prompting. Otherwise it prints the playbook for your detected ISP, snapshots a rollback baseline, warns that the cutover briefly drops your internet, confirms you’re physically at the box, and waits while you run the steps.
| Flag | Behavior |
|---|---|
--plan-only |
Print the ISP-specific plan and stop — no snapshot, no prompt, no verify loop. The dry-read |
--yes / -y |
Skip the “are you at the box?” confirmation. For when you already know |
The verify loop
Section titled “The verify loop”After the steps, it probes the result and renders one of three verdicts:
| Verdict | Meaning |
|---|---|
VERIFIED |
The cutover took |
APIPA_ROLLBACK |
The box fell back to a self-assigned 169.254.x.x address: the change failed, and it prints the rollback commands |
| inconclusive | It can’t tell yet, and says so |
sanctum net speedtest
Section titled “sanctum net speedtest”The honest throughput doctor. A multi-gig line routinely “tests slow” because the test is the bottleneck, not the line.
sanctum net speedtestsanctum net speedtest --streams 16sanctum net speedtest --no-testsanctum net speedtest --jsonIt reads the link speed of every hop it can see (your NIC, Wi-Fi or wired, and the Firewalla’s WAN and LAN ports when it can reach them over SSH), finds the slowest, then runs a bounded multi-stream download and interprets the gap. When a single stream stalls and parallel streams fly, the single number was the artifact. At the link ceiling, it names the hop to fix.
| Flag | Behavior |
|---|---|
--streams N |
Parallel download streams (default 8). Raise it on a very fast line or to escape a single-stream artifact |
--no-test |
Ceiling audit only — read every hop’s link speed and interpret it, skip the live download entirely |
--json |
Emit the full report as JSON (hops, bottleneck, verdict, advice) for the menu bar or a script |
What it exposes
Section titled “What it exposes”The interpreter encodes the field rules so the lie is visible:
| Artifact | What the doctor says |
|---|---|
| Single-stream cap | A single connection stalls near 1-2 Gbps; the multi-stream figure is the real one — trust it |
| Wi-Fi ceiling | Wi-Fi caps you at ~1-2 Gbps regardless of the line; go wired and re-test |
| Slowest port | A 1G switch or a 2.5G NIC anywhere in the chain is your ceiling — no line upgrade moves it |
| NAT topology | Single- vs double-NAT changes throughput by zero; do not chase NAT to go faster |
| ISP hub test | The hub’s built-in test is single-stream on a weak CPU and under-reports; measure from your own machine |
| PPPoE | CPU-bound on most routers, caps around ~3-3.5 Gbps; the band is named when the WAN uses it |
sanctum keys backup <path>
Section titled “sanctum keys backup <path>”Export an encrypted bundle of your Sanctum Keychain credentials: OpenRouter, Anthropic, Gemini, Firewalla-bridge, R2, B2. The single most important command in the CLI: sanctum uninstall revokes those entries, and a dead disk takes them with it. The bundle re-keys a fresh Mac in seconds instead of by hand.
sanctum keys backup ~/Documents/sanctum-keys-2026-06-09.tar.gz.encIt reads each sanctum/* Keychain entry into a mode-600 file, prompts twice for a passphrase of at least 12 characters (the CLI neither generates nor stores it), then tar.gzs and openssl enc -aes-256-cbc -pbkdf2 -salts the lot to the .enc path you gave. No copy anywhere, no cloud call. Restore with sanctum keys restore <path>.
Options
Section titled “Options”Global options; everything else routes to the command.
| Option | Behavior |
|---|---|
--version |
Print the CLI version and exit 0 |
--traceback |
Print a full traceback on an uncaught exception (otherwise you get the curt line) |
-h, --help |
Print the usage banner and exit 0 |
sanctum --version # → sanctum and the installed versionsanctum --help # → command rosterExit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
0 |
OK (--help and --version included) |
1 |
User error: bad input. Also a check the command ran that failed: self-test with a failing probe, service-user check with wave-1 expected and unhealthy, update when Homebrew is missing, brew fails or the self-test gate fails; and init when it cannot read or safely edit the file |
2 |
Provider error: a rate limit, a rejected key, a model that is unavailable. Typer’s usage errors (an unknown command, a missing argument or subcommand) also exit 2 |
3 |
Network error: a DNS lookup or a connection that fails |
4 |
Local error: Keychain, disk, a tool or helper script the command needs and cannot find (restic for sanctum backup, the tailnet-toolkit scripts for sanctum node ha-check and apply-names-local; update without Homebrew exits 1), or a sanctum binary on a world-writable path |
5 |
Configuration error: an instance.yaml that is missing, cannot be read or fails the schema, or sanctum service-user install on a satellite |
Quick Reference
Section titled “Quick Reference”| Command | Purpose |
|---|---|
sanctum status |
Host vital signs — one line with --oneline |
sanctum doctor |
Are the LaunchAgents, providers, and backups healthy? |
sanctum self-test |
Run the sixteen canonical probes |
sanctum init |
Write a minimal instance.yaml; --role satellite on a satellite |
sanctum update |
brew upgrade + self-test as the gate |
sanctum uninstall |
Remove operational artifacts (preserve data by default) |
sanctum uninstall --purge |
Also remove the ~/.sanctum/ data dirs |
sanctum logs <service> |
Tail a known log — --list to see them all |
sanctum devices |
Read-only haushold device inventory |
sanctum schedule |
Read-only curfew view |
sanctum net home |
Daily home-network health + safe CDN/MSS improve |
sanctum net check |
Read-only NAT-topology + ISP audit |
sanctum net optimize |
Guided, reversible double-NAT → single-NAT cutover |
sanctum net speedtest |
Honest multi-stream throughput doctor — names the real ceiling |
sanctum keys backup <path> |
Encrypt your Keychain credentials to a portable bundle |
sanctum chat / code / vision |
Talk to the router-chosen / Claude / Gemini model |
sanctum onboard |
One-shot first-run: recipe → cloud → first backup → canary |