Instruction Sync
oat instructions ... is the project-scoped lane for keeping canonical AGENTS.md files aligned with sibling CLAUDE.md files throughout a repository tree.
Use it when you want OAT to:
- validate nested
AGENTS.md/CLAUDE.mdpairs - repair missing or drifted
CLAUDE.mdfiles with a chosen strategy - adopt Claude-only directories back into canonical
AGENTS.md
This command group is intentionally separate from manifest-backed provider sync. It operates on repo-local instruction files, not provider view manifests.
Scope
Instruction sync is currently project-only.
- It scans the current repository recursively.
- It supports nested directories all the way down the tree.
- It skips provider-irrelevant or local-only roots such as
.git,.oat,.worktrees, andnode_modules. - It does not scan user-level provider roots such as
~/.claudein this release.
Canonical Model
AGENTS.mdis canonical.CLAUDE.mdis derived from the siblingAGENTS.md.- If a directory contains only
CLAUDE.md, OAT can adopt that file by writing canonicalAGENTS.mdcontent first and then regeneratingCLAUDE.md.
Commands
oat instructions validate
Read-only validation for instruction integrity.
- Resolves the project root automatically.
- Scans nested directories for instruction pairs and Claude-only strays.
- Returns exit code
0when everything is valid and1when drift is detected. - Suggests the matching repair command, including
--strategywhen you validated with a non-default mode.
oat instructions sync
Repair and adoption command for instruction drift.
- Mutates by default.
- Use
--dry-runto preview planned actions. - Use
--forceto overwrite mismatchedCLAUDE.mdfiles. - Reuses the selected strategy when creating or repairing
CLAUDE.md.
Supported Strategies
CLAUDE.md can be generated or validated in one of three modes:
| Strategy | Expected CLAUDE.md shape | Notes |
|---|---|---|
pointer | file content @AGENTS.md | Default mode. Lightweight and explicit. |
symlink | file symlink to AGENTS.md | Uses a same-directory relative symlink. |
copy | hard copy of AGENTS.md content | Useful when symlinks are undesirable. |
Validation treats the selected file shape as part of correctness. For example, copy mode rejects a symlink even if the symlink resolves to identical content.
Reported States
oat instructions validate and oat instructions sync --dry-run work from the same scan model.
| State | Meaning |
|---|---|
ok | The discovered instruction pair matches the selected strategy. |
missing | AGENTS.md exists but sibling CLAUDE.md is missing. |
content_mismatch | CLAUDE.md exists but has the wrong shape/content, or an instruction file is unreadable/broken. |
stray | CLAUDE.md exists without sibling AGENTS.md and the Claude file is readable enough to adopt. |
Claude-Only Adoption
When a directory contains CLAUDE.md but no AGENTS.md, sync can adopt it:
- Read the existing
CLAUDE.md - Write canonical
AGENTS.mdwith that content - Regenerate
CLAUDE.mdusing the selected strategy
This means the original Claude instructions become canonical before the derived file is rewritten.
Readable Claude-only files are adoptable. Unreadable Claude-only files are not.
When --force Is Required
oat instructions sync does not overwrite a mismatched CLAUDE.md unless you pass --force.
Typical pattern:
oat instructions validate --strategy symlink
oat instructions sync --dry-run --strategy symlink
oat instructions sync --force --strategy symlink
oat instructions validate --strategy symlinkThis keeps validation, preview, and repair aligned to the same expected file shape.
Manual-Repair Cases
Some states are intentionally surfaced as drift but not auto-repaired.
Examples:
- unreadable canonical
AGENTS.md - broken or unreadable
AGENTS.mdsymlink targets - unreadable Claude-only sources
- broken or unreadable paired
CLAUDE.mdsymlink targets
In these cases, sync reports a manual-repair skip instead of guessing at destructive recovery.
Example Workflow
Preview and adopt nested Claude-only strays as pointer files:
oat instructions sync --dry-run
oat instructions syncValidate and repair everything as symlinks:
oat instructions validate --strategy symlink
oat instructions sync --dry-run --strategy symlink
oat instructions sync --force --strategy symlinkValidate and repair everything as hard copies:
oat instructions validate --strategy copy
oat instructions sync --dry-run --strategy copy
oat instructions sync --force --strategy copy