Export the folder and move it to a new machine
Write ~/.canonfig/ to one archive, check exactly what it holds, and import it on another machine or back onto this one.
canonfig export writes your Canonical Folder to one .tar.gz file.
canonfig import checks that file and writes the folder back into
~/.canonfig/ on any machine that is not an enrolled Follower Machine. Use
them to move a Source Machine's setup to a new computer, to keep a copy before
a large edit, or to give an auditor the exact files that left a machine.
Use the browser
Run canonfig ui. On Source Profile or follower Local settings, choose
Export and optionally Include managed harness files. Import verifies those
files but never writes them back to the harnesses.
To import, choose Import archive on Source Profile or in the header of the setup
role-choice screen on an unconfigured machine. An enrolled Follower cannot import its Source's
mirror. Select the .tar.gz and enter an expected signing key fingerprint obtained
independently from your trusted Source. Without that field, import checks integrity
but accepts unsigned archives and does not establish the signer's identity.
If the folder already holds entries, choose Allow replacement of existing folder
entries only after reading its warning. Matching files or whole directories are
snapshotted under ~/.canonfig/.backups/ before replacement. Entries absent from
the archive remain.
Choose Verify and preview, inspect the plan, then confirm Import verified archive. Verification writes no folder entries. The completed import reports its fingerprints and any recovery snapshot. It does not publish a revision, create a Source identity, enroll this machine or apply harness files.
If observation fails, use Resume observation, not another import. For an
interrupted run, inspect canonfig status and use canonfig recover. To undo a
replacement, use canonfig restore <snapshot> with the reported snapshot.
Export the folder
canonfig export --output ~/canonfig-setup.tar.gzThe archive holds canonfig.jsonc, AGENTS.md, rules/, skills/,
agents/, commands/, hooks/, files/ and local/, so authored
resources with their files, and this machine's local items, Local Overlays
and key claims, travel with it. It never holds state.sqlite,
takeover snapshots, the hook runtime, logs, installer bindings or credentials,
because export reads nothing else in ~/.canonfig/. MCP secrets stay
{ "fromEnv": "NAME" } references: export refuses a literal credential in
canonfig.jsonc or local/local.jsonc with the same check publication uses,
so a token never enters the file.
The output says where the archive went and gives two SHA-256 digests: sha256
for the whole archive and manifestSha256 for its manifest. It also names the
signer: on the Source Machine, export signs the manifest with the Source
signing key and signer is that key's fingerprint; on any other machine it is
unsigned. See Check who made an archive.
Export refuses an output that already exists. To replace it:
canonfig export --output ~/canonfig-setup.tar.gz --forceThe output must be inside your home directory and outside ~/.canonfig/.
Without --output, the archive is canonfig-export-<UTC time>.tar.gz in the
current directory. The file is private to your user.
Check what the archive holds
The archive is a standard tar file. Its first entry, manifest.json, lists
every other file with its path, size, SHA-256 and mode, plus the Canonfig
version, the time of the export and the machine's role:
mkdir check && tar -xzf ~/canonfig-setup.tar.gz -C check
cat check/manifest.jsonTo check every file against the manifest on Linux (on macOS, use
shasum -a 256 -c instead of sha256sum -c):
cd check && jq -r '.files[] | "\(.sha256) \(.path)"' manifest.json | sha256sum -ccanonfig import --dry-run runs the same check without writing anything.
Check who made an archive
An archive from the Source Machine carries signature.json right after the
manifest: the Source's public key, its fingerprint and an Ed25519 signature of
the manifest's SHA-256. Since the manifest lists every file's SHA-256, the
signature covers the whole folder. Import checks it before anything else and
refuses the archive, writing nothing, when the signature does not match. The
output's signer is the fingerprint, or unsigned.
A valid signature only says which key signed. To make sure that key is your Source's, read its fingerprint on the Source Machine:
canonfig status --jsonThe fingerprint is data.machineRole.sourceFingerprint. Then pass it to
import, which refuses an unsigned archive or one another key signed:
canonfig import ~/canonfig-setup.tar.gz --dry-run --expect-key 3f1c0a9e6b2d4f8a7c5e1b3d9f0a2c4e6b8d0f1a3c5e7b9d1f3a5c7e9b1d3f5aMove the folder to a new machine
-
Install Canonfig on the new machine and copy the archive there.
-
Check the archive and see what the import would write:
canonfig import ~/canonfig-setup.tar.gz --dry-run -
Import it:
canonfig import ~/canonfig-setup.tar.gzImport runs as one journaled Synchronization Run. If an action fails it rolls back, and if the process stops part way,
canonfig recoverfinishes or rolls back the run. The result ends withoutcome: Converged. If the archive came from your Source Machine, add--expect-keywith its fingerprint, as above. -
Project the folder into this machine's harnesses:
canonfig sync --plan canonfig sync --applyThe first apply takes each harness over and writes a takeover snapshot, exactly as on any machine. See Restore a harness from a backup.
-
To make the new machine the Source Machine, run
canonfig source initand publish:canonfig source init canonfig source publish --reviewer maria
A Follower Machine cannot import: its ~/.canonfig/ mirrors the Source Machine
and the next sync would overwrite it. To change what every machine gets, import
on the Source Machine and publish.
Replace a folder that already has content
Import never writes over what is there unasked. It refuses a folder that holds
any authored entry, and local/ when the archive has one. To replace them:
canonfig import ~/canonfig-setup.tar.gz --replace--replace replaces each entry the archive holds. A replaced directory, such
as skills/, then holds exactly the archive's files. An entry the archive does
not hold stays as it is and is listed under kept.
Before it replaces anything, import copies those entries to a takeover
snapshot in ~/.canonfig/.backups/<UTC time>/ and names it in the output as
backup. The copies sit under canonfig/.canonfig/, byte for byte. To put the
folder back as it was before the import:
canonfig restore 2026-11-05T09-30-00-000ZUse the backup id from the import's output. With no id, canonfig restore
takes the latest snapshot, which is this one until Canonfig takes another.
Restore writes the entries back as a journaled run, whatever they hold now, and
first copies what it replaces to a new snapshot, named as backup in its
output, so a restore can be undone the same way. Entries the archive added and
the folder did not have before stay. Snapshots follow the usual retention:
Canonfig keeps the first harness snapshot, the first folder snapshot and the
four most recent.
Include the harness files
canonfig export --include-harnesses --output ~/canonfig-audit.tar.gzThis adds the files Canonfig manages in each harness on this machine, under
harnesses/<harness>/<path below home>. Each manifest entry names the harness
and the original path, such as ~/.claude/CLAUDE.md. For a file the harness
shares with its own state, such as ~/.claude.json, the archive holds only the
keys Canonfig owns there, so logins and history never leave the machine.
Authored resources appear under harnesses/resources/. A surface you edited
since Canonfig last wrote it is left out and listed under
skippedHarnessSurfaces, and so is an append-local surface, which holds this
machine's own content beside Canonfig's.
Import verifies harness files and counts them, but never writes them. The next
canonfig sync projects the imported folder instead, which produces the same
files for the harnesses installed on that machine.
Find past exports and imports
Every export, and every import except --dry-run, adds a row to the
archive_events table in ~/.canonfig/state.sqlite, apart from
Synchronization Runs, so canonfig status keeps reporting the last sync. Each
row holds the time, the command, the outcome (Exported, the import run's
outcome, or Error), the archive path, its SHA-256 and the signer. Rows are
never changed or deleted. To list them:
sqlite3 ~/.canonfig/state.sqlite "SELECT * FROM archive_events"If something fails
| Message | Cause | Fix |
|---|---|---|
| "... already exists; pass --force to replace it, or choose another --output" (exit 4) | A file is already at the output path. | Choose another name, or pass --force. |
| "... is outside the home directory ..." (exit 2) | The output directory is not inside your home directory. | Write the archive under your home directory and copy it from there. |
| "... has a literal credential at ... [REDACTED]; an export never holds secret values" (exit 2) | A value in canonfig.jsonc or local/local.jsonc looks like a token. | Replace it with { "fromEnv": "NAME" } and export again. |
| "... is a credential file; an export never holds one" (exit 2) | A file such as .env sits in an authored entry. | Move it out of ~/.canonfig/. |
| "... does not match its checksum in manifest.json; the archive was changed or damaged after export" (exit 7) | The file changed after export, for example in transfer. | Copy the archive again and compare its SHA-256 with the one export printed. |
| "... has a signature.json that does not match manifest.json ..." (exit 7) | The manifest or the signature changed after the Source signed the archive. | Copy the archive again from the Source Machine, or export it again there. |
| "... is signed by key ..., not by the --expect-key ..." or "... is unsigned, but --expect-key requires a signature ..." (exit 7) | The archive does not come from the Source whose fingerprint you passed. | Check the fingerprint with canonfig status --json on the Source Machine, and export there. |
| "... holds ..., a symbolic link; an export holds regular files only" or "... which is outside what an export may hold" (exit 7) | The archive was not written by canonfig export, or was edited by hand. | Use an archive straight from canonfig export. |
| "... is an enrolled Follower Machine's mirror of the Source, so an import cannot write it" (exit 2) | This machine is enrolled. | Import on the Source Machine and publish, or run canonfig follower unenroll first. |
| "... already holds ..., and an import never overwrites them unasked" (exit 4) | The folder has content. | Pass --replace; import backs the entries up first. |
Restore a harness from a backup
Find the Takeover Snapshot Canonfig took before it first wrote to a harness, and put the harness's earlier configuration back.
Add items to one machine only
Keep extra skills, rules, subagents, commands, MCP servers, or settings on one machine in ~/.canonfig/local/, without publishing them.