Keep a machine's own instructions and skills
Let every machine keep its own AGENTS.md text and its own skills next to what the Source Machine publishes, with append-local and sync --review-local.
By default Canonfig owns the instructions file and the skills directory it projects into a harness: at takeover it saves what was there to a takeover snapshot and replaces it. When each machine has instructions or skills of its own that must stay, the Source Machine can share those outputs with every machine instead. Canonfig then owns only its part:
- In an instructions file such as
~/.codex/AGENTS.mdor~/.claude/CLAUDE.md, Canonfig owns a marked section at the top. Everything after it is the machine's text. - In a skills directory such as the shared
~/.agents/skills/, Canonfig owns the skill directories it writes. Every other skill there is the machine's.
This is the append-local policy. A machine can also keep instructions and
skills in ~/.canonfig/local/, which reach every harness on that machine; both
are covered below.
Before you start
- You need the Source Machine to change
canonfig.jsoncand publish. - A takeover snapshot is still taken before the first write, unless backups are off on that machine.
Share instructions and skills with each machine (Source Machine)
Add appendLocal to local in ~/.canonfig/canonfig.jsonc. Add
instructions and skills to allow as well if machines should also keep
items in their local folder:
{
"local": {
"allow": ["instructions", "skills"],
"appendLocal": ["instructions", "skills"]
}
}canonfig source publish --reviewer "$USER"appendLocal takes instructions, skills, or both. It applies to every
listed harness on every machine, the Source Machine included.
Review the first sync on a machine
The first sync on a machine that already has an instructions file keeps the whole file as that machine's text, even if it repeats what the Source Machine publishes: matching text does not prove who wrote it. The plan says so for each file:
canonfig sync --planFirst adoption preserves the entire existing file as local text. Matching Source bytes do not establish ownership. Inspect exact Source and retained local text before applying: canonfig sync --plan --review-local
To see exactly what will be written, ask for private reviews:
canonfig sync --plan --review-localThe output lists one JSON file per instructions file, under
~/.canonfig/.reviews/adoption-review-<id>/. Each holds:
| Field | Meaning |
|---|---|
sourceAddition | The text Canonfig will own at the top of the file. |
retainedLocal | The text that stays yours, exactly as it is now. |
proposedText | The whole file that sync --apply will write. |
revision, planDigest, sourceDigest, retainedLocalDigest | What the review was made from. |
These files can hold secrets from your instructions. Canonfig makes the
directory readable only by you (0700, files 0600 on Linux and macOS), never puts
the text in the plan, the journal, or the command output, and never sends it
anywhere. Read them locally, do not paste them anywhere, and delete the
adoption-review-<id> directory when you are done. If the file changes before
the review is written, the command stops and asks you to plan again.
The plan records first adoption separately from creating a new section, updating an owned section, or converting a file Canonfig already owns whole. Apply checks that recorded transition again. Changed local bytes or a file that appeared after planning require a new plan, not an inferred adoption.
A file that already has valid Canonfig markers but no Applied Resource Record is not a first unmanaged adoption. Canonfig accepts its section only when it already matches the desired Source text; a different section is Follower Drift. Its local suffix stays untouched, and it does not produce a first-adoption review.
--review-local works only with an interactive --plan; with --apply,
--scheduled, or --no-input it exits 2.
When the plan looks right, apply it:
canonfig sync --applyWhat the files look like afterwards
<!-- canonfig:source:start -->
# Team rules
Prefer small diffs.
<!-- canonfig:source:end -->
# Laptop notes
Use fish, not bash.Edit only below the closing marker. Later syncs replace the section between
the markers and keep your text byte for byte. Changing the section itself is
Follower Drift: Canonfig keeps the file, reports it, and exits 4. Move the edit
below the marker, or into ~/.canonfig/local/AGENTS.md, then sync again.
Damaged or repeated markers also stop the sync until you repair them; deleting
the whole file lets Canonfig write it again.
In a shared skills directory, skills Canonfig did not write stay where they are and are never reported as drift. A file you add inside one of Canonfig's skill directories is drift, as before. If a machine has a skill with the same name as a published one that Canonfig did not write, even with the same content, the sync stops with Follower Drift instead of taking it over, whether the skill was published before or after the machine's first sync. To keep your copy without syncing the Source version, exclude that name as described below. Otherwise rename or remove your copy before syncing.
Keep a same-name skill local
With skills in the Source's local.appendLocal, run on this machine:
canonfig local skills add deploy
canonfig local skills add review
canonfig local skills listThis saves excludeSkills in ~/.canonfig/local/local.jsonc. Names use lowercase
letters, digits and hyphens, starting with a letter or digit. In the browser,
open the machine-local settings page and use Kept on this machine.
To remove a name, run canonfig local skills remove deploy.
Those names stay local in every harness skill directory, including shared
~/.agents/skills. Sync can still add and update other Source skills. It does
not write, check, or delete excluded skills. If Canonfig managed one before,
the next successful sync gives its current files back to the machine without
restoring Source content. Exclusions do not remove Source copies from the
canonical mirror.
Run canonfig sync --plan before applying. Removing an exclusion does not
give Canonfig ownership of the local copy: overlapping local skills still
stop sync. If the Source stops sharing skills, configured exclusions stop
sync with a configuration error instead of allowing a whole-directory takeover.
Keep native MCP options
To keep only Codex's native MCP map while other harnesses receive Source MCP, run:
canonfig local mcp preserve --harness codex
canonfig local mcp statusThis saves "preserveMcp": ["codex"] in ~/.canonfig/local/local.jsonc.
Codex app updates can then change their own node_repl server without MCP drift.
Repeat --harness <id> to preserve more harnesses. Use
canonfig local mcp project --harness codex to return Codex to projection.
Without --harness, preserve keeps every native map and project restores
projection everywhere. In the machine-local settings page, use Choose harnesses
under Native MCP in Kept on this machine, or the switch for every harness.
These choices work on both Sources and Followers.
Canonfig leaves preserved server maps unchanged, including OAuth settings or startup timeouts the canonical format cannot express. The next successful sync releases any MCP keys it previously owned without changing their content. New Source servers do not replace preserved maps on later syncs. Other settings and the selected instruction, skill, and command surfaces still synchronize.
This preserves MCP rather than disabling it. It does not verify server startup, authentication or connectivity. Each harness keeps its native configuration and credentials. Turning preservation off does not adopt conflicting local data.
Keep text and skills in the local folder
With instructions and skills in local.allow, a machine can also keep
items in its own folder:
~/.canonfig/local/
AGENTS.md appended after the published AGENTS.md
skills/<name>/SKILL.md added next to the published skillsThese reach every harness on that machine, not one file. Text in
local/AGENTS.md goes inside Canonfig's section, after the published
instructions. See Add items to one machine only.
Stop sharing
Removing an entry from appendLocal makes Canonfig own the whole file or
directory again. An instructions file with nothing after the closing marker is
rewritten without the markers. If your own text follows the marker, the next
sync stops with Human Action Required (exit 3) and leaves the file as it is;
in a skills directory, your own skills are reported as Follower Drift (exit 4).
Move that content into ~/.canonfig/local/ (or delete it), then sync.
canonfig restore on a shared surface removes only Canonfig's section or
skill directories. What the machine had before Canonfig took over, and what it
added since, stays. An instructions file that holds nothing after Canonfig's
section, such as one Canonfig created, is removed. See
Restore a harness from a backup.
If something fails
| Message | Cause | Fix |
|---|---|---|
| "codex instructions cannot keep this machine's text: append-local Source text contains a reserved Canonfig marker" (exit 2) | The published instructions, or local/AGENTS.md, contain <!-- canonfig:source:start --> or <!-- canonfig:source:end -->. | Remove the marker text from the folder and publish again. |
| "Cannot read append-local target: ..." (exit 3) | The instructions file is not valid UTF-8 text or its markers are damaged. | Repair the file, or delete it so Canonfig writes it again. |
| "... changed after planning; run 'canonfig sync --plan --review-local' again" (exit 3) | The file changed between planning and writing the review. | Plan again. |
| "... holds this machine's own text after the Canonfig section, and Canonfig no longer shares it (append-local is off)" (exit 3) | appendLocal was turned off while your text follows the closing marker. Canonfig has not changed the file. | Move that text into ~/.canonfig/local/AGENTS.md, or delete it, then sync. |
| Follower Drift on an instructions file (exit 4) | The section between the markers was edited. | Move your edit below the marker or into local/AGENTS.md, then sync. |
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.
Replace a published item on one machine
Use a Local Overlay so one machine's own skill, rule, MCP server, or settings replace the published item with the same name, or claim one settings key so Canonfig leaves it alone.