# Codex Sync (Step 2b)

Unlike the Copilot step, this one does **not** hand-copy files. The Codex tree is a
*transform* of the Claude tree, not a mirror of it, and the transform is real work:

- the sub-command specs become reference files, because Codex silently truncates
  its skills block (see `cross-cli-contract.md` 2.6 for the measurement)
- every `$HOME/.claude/...` reference to a CLI-owned tree is retargeted, with
  `agents/<persona>.md` becoming `.toml` and the dispatcher becoming the router skill
- the personas under `agents/` are regenerated as TOML with a model + reasoning-effort mapping
- shared state (`logs/`, prefs, `knowledge/`) is deliberately NOT retargeted

That logic lives in `install/codex.mjs` and is gate-locked by
`smoke-codex-install.sh`. Re-describing it here in prose would give the pipeline two
definitions of the same transform, and the prose copy would be the one that rots. So
the step runs the installer's Codex target:

```bash
cd "$HOME/multi-agent-pipeline"
node install.js --codex
```

**Verify** (the installer is quiet about correctness, only about counts):

```bash
# exactly one pipeline skill: more than one means the skills block will truncate
ls -1 "$HOME/.codex/skills" | grep -c '^multi-agent$'          # want 1
# every sub-command reachable as a ref
find "$HOME/.codex/multi-agent-refs/commands" -name SKILL.md | wc -l   # want the command count
# no reference left pointing at a tree a Codex-only install does not have
grep -rhoE '(\$HOME|~)/\.claude/(agents|scripts|lib|schemas|commands|multi-agent-refs|rules)' \
  "$HOME/.codex/skills" "$HOME/.codex/multi-agent-refs" | sort -u   # want empty
```

**MCP**: the installer runs `codex mcp add multi-agent-toolkit` itself. It is idempotent, and
it is skipped with a warning when `codex` is not on `PATH` -  never hand-edit
`~/.codex/config.toml`, which Codex owns (marketplace and plugin state live there
too).

**Order matters**: run this AFTER Step 3 (REPO), because the installer reads the repo
tree. Running it before means Codex gets the previous revision.

---
