# Sync Overview: targets, shared sections, tokens

Read by `/multi-agent:sync` before Step 1.5 (DETECT) to know every target's
path and direction, and before any step that switches GitHub identity or
publishes.

## Targets

| # | Target | Path | Direction |
| --- | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
| 1 | Claude Code (source of truth) | `~/.claude/commands/multi-agent/` + `~/.claude/multi-agent-refs/` + `~/.claude/agents/` + `~/.claude/scripts/` + `~/.claude/lib/` | source |
| 2   | Copilot CLI                   | `~/.copilot/copilot-instructions.md` + `~/.copilot/skills/` + `~/.copilot/multi-agent-refs/`                                      | <- from Claude (path-rewritten) |
| 2b | Codex CLI | `~/.codex/AGENTS.md` + `~/.codex/skills/multi-agent/` + `~/.codex/multi-agent-refs/` + `~/.codex/agents/*.toml` | <- from Claude (path-rewritten) |
| 2c | Local LLM | `~/.codex-local/AGENTS.md` + `~/.codex-local/skills/multi-agent/` + `~/.codex-local/multi-agent-refs/` + `~/.codex-local/agents/*.toml` | <- from Claude (path-rewritten), only when the tree exists |
| 3 | multi-agent-pipeline repo | `~/multi-agent-pipeline/pipeline/` | <- from Claude (genericized) |
| 4 | Website | `{owner}/{website-host}` | <- version + features |
| 5 | multi-agent MCP server | resolved from `prefs.global.devToolkit` or the `mcpServers` registration | own repo: gate, commit, publish |

A host tree that is not there is not created by a sync: installing a host is
`/multi-agent:setup`'s decision and the user's, and a sync that created one
would enrol a machine in a host nobody asked for. Target 2c is therefore
skipped, not failed, when `~/.codex-local` is absent.

## Sync rules (Claude <-> Copilot)

1. **Read first**  -  understand every target's current state before making any change
2. **Preserve file structure**  -  each target has its own format:
   - `commands/multi-agent/` SKILL tree + `multi-agent-refs/phases/`: detailed pipeline spec (frontmatter, phases, routing)
   - `copilot-instructions.md`: general development instructions + pipeline summary section
   - `multi-agent-pipeline/pipeline/`: generic open-source version (NO personal data)
3. **Sync the shared sections** (Claude ↔ Copilot):
   - Pipeline entries table (base / :autopilot)
   - Project detection (URL-based + cwd-based)
   - Figma pipeline flow
   - Git conventions (author, branch, commit format)
   - Keychain management (registry, naming convention, multi-agent pattern)
4. **Do not duplicate**  -  summary in Copilot, full spec in Claude. Keep this distinction.
5. **Report**  -  show a short diff summary after sync

## Keychain Token Access

| Operation | Token Source |
| --------------------------------- | ------------------------------------------------------------------------------------------------- |
| `gh` CLI (personal) | `{owner}` gh auth (Keychain) |
| `gh` CLI (work) | `{user}_<work-label>` gh auth (Keychain)  -  see `prefs.global.accounts[]` |
| npm publish | `NODE_AUTH_TOKEN`  -  `GITHUB_TOKEN` in CI, Keychain PAT locally |
| multi-agent-mcp publish (Step 3d) | `npm` logical Keychain key -> throwaway `--userconfig`, registry from that repo's `publishConfig` |

```bash
gh auth switch --user {owner}  # for personal repos
```

## Website files (Step 4)

| File | What to sync |
| ---------------------- | -------------------------------------------------------- |
| `src/lib/i18n.tsx` | Phase count, model count, feature descriptions (EN + TR) |
| `src/data/projects.ts` | Version number, tagline, description, feature list |

## Sub-command paths

| Claude Code | Copilot CLI |
| ----------------------------------------------- | ---------------------------------------------- |
| `~/.claude/commands/multi-agent/{cmd}/SKILL.md` | `~/.copilot/skills/multi-agent-{cmd}/SKILL.md` |

**Claude -> Copilot**: add SKILL.md frontmatter (`name`, `description`, `user-invocable: true`, `argument-hint`)
**Copilot -> Claude**: simplify the frontmatter (`description` + `allowed-tools`), add `$ARGUMENTS`
