Port Agent Config
Move a project's agent instructions and skills to work with a different
coding tool, without breaking what already works for the current one. Two
situations, two procedures — check which one applies before doing anything.
Step 0: which situation is this?
Look for a reachable agentharness checkout with tools/generate-*.sh in it:
- This repo itself (agentharness) — the scripts are right here.
- A consumer project where
harness-link.sh init ran: readlink a
.claude/skills/* entry to find the harness's real path, or look for an
agentharness/ submodule, or a durable npm-mode copy.
Found one → Section A. Not found → Section B.
Section A — agentharness-linked: use the real generators
Don't hand-write the target file. Each generator already reuses the exact
same source (CLAUDE.md + the skill catalog), is CI-drift-checked against
its committed output, and carries the correct caveats — reconstructing its
shape by hand is strictly worse and will drift the next time CLAUDE.md
changes.
| Target tool |
Generator |
Produces |
| Codex CLI |
tools/generate-agents-md.sh --output AGENTS.md |
AGENTS.md |
| Gemini CLI / Antigravity |
tools/generate-gemini-md.sh --output GEMINI.md |
GEMINI.md |
| GitHub Copilot |
tools/generate-copilot-instructions.sh --output-dir . |
.github/copilot-instructions.md + .github/instructions/*.instructions.md |
| Kilo Code |
tools/generate-kilo-rules.sh --output .kilo/rules/agentharness.md |
.kilo/rules/agentharness.md |
| Cursor |
tools/generate-cursor-rules.sh --output-dir . |
.cursor/rules/agentharness-router.mdc + one .mdc per skill |
| OpenCode / Zed |
nothing to generate — both read AGENTS.md directly |
— |
| Claude Code |
nothing to generate — CLAUDE.md is the hand-authored source |
— |
Steps:
- Run the matching command against the target project (see each script's
own
--help, or docs/INTEGRATION.md's per-platform section when the
harness checkout and the target project aren't the same directory).
- Re-run the project's own content-quality check (
tools/verify-content-quality.py
here; the consumer's equivalent elsewhere) to confirm the new file isn't
silently broken.
- Tell the user this is a manual step, not auto-wired into
init/update
(ROADMAP.md's P1-01) — they'll need to re-run it whenever CLAUDE.md
or the skill catalog changes.
- Keep the same caveat every generated file already states: not verified
against a live session of the target tool.
Custom subagents (task delegation to a separate agent instance —
.claude/agents/*.md — a different mechanism from the routing/skill
generators above) have their own set of generators, one per
delegation-capable target:
| Target tool |
Generator |
Produces |
| Codex CLI |
tools/generate-codex-agents.sh --output-dir . |
.codex/agents/<name>.toml |
| OpenCode |
tools/generate-opencode-agents.sh --output-dir . |
.opencode/agents/<name>.md |
| Cursor |
tools/generate-cursor-agents.sh --output-dir . |
.cursor/agents/<name>.md (not .cursor/rules/ — that's the skill generator) |
| Kilo Code |
tools/generate-kilo-agents.sh --output-dir . |
.kilo/agents/<name>.md |
| GitHub Copilot |
tools/generate-copilot-agents.sh --output-dir . |
.github/agents/<name>.agent.md (not .github/copilot-instructions.md/.github/instructions/ — those are the routing/skill generator) |
| Gemini CLI |
tools/generate-gemini-agents.sh --output-dir . |
.gemini/agents/<name>.md |
| Zed |
nothing to generate — real subagent delegation exists architecturally, but no confirmed user-facing named-config-file format was found (see docs/CLIENT_COMPATIBILITY.md's custom-agent table) |
— |
Important limitation, state it every time: none of these six
generators port tool/permission scoping (Claude Code's tools: field,
Cursor's readonly/is_background, Kilo's permission/
permission.task, Copilot's target/disable-model-invocation/
user-invocable, Gemini's tools/temperature/max_turns) — that
vocabulary is unverified per-platform. Ported
files carry name/description/model and the body verbatim; tell the
user the tool/permission scope needs re-specifying by hand for the
target platform.
Section B — no agentharness: hand-port
- Read the source config in full. Don't summarize from memory — find
every file the source tool actually reads.
- Identify the target's real mechanism: its always-on file (name,
location, whether it's read hierarchically or as a single file) and its
skill/rule format (Agent Skills' progressive disclosure vs. Cursor's
per-file
.mdc frontmatter). docs/CLIENT_COMPATIBILITY.md in
agentharness is a good reference table even from outside the repo; don't
guess if you can check the target tool's own docs instead.
- Port routing prose near-verbatim, demoting every heading one level
so the source's own H1 doesn't collide with the target file's H1 — the
same rule every generator here follows (
demote_headings() in
tools/lib/adapter-common.sh).
- Port skills without duplicating bodies:
- Target supports the Agent Skills standard (Codex, Gemini CLI,
Antigravity, GitHub Copilot, Zed, Kilo Code, OpenCode all do): point it
at the same skills directory instead of re-authoring content, and add
only a name+description index to the always-on file.
- Target has no Agent Skills support (Cursor is the only confirmed
case): port each skill individually into the target's native rule
format — for Cursor, one
.mdc per skill, description copied
verbatim, no globs (Agent-Requested activation, not Auto-Attached).
- State the caveat explicitly: "ported from
<source>'s config to
<target>'s format; not verified against a live <target> session" —
unless the user has actually run it themselves.
- Custom subagents (task delegation, not skills/instructions) only
port meaningfully between tools that both support real delegation
with a confirmed config-file format (Claude Code, Codex CLI,
OpenCode, Cursor, Kilo Code, GitHub Copilot, Gemini CLI — see
docs/CLIENT_COMPATIBILITY.md's custom-agent table); Zed likely has
real delegation too but no confirmed file format to port into, so
treat it as unconfirmed rather than either persona-only or portable.
Don't assume a tool is persona-only without checking its docs
directly — this table was wrong about both Copilot and Gemini CLI for
a full session before being caught and corrected (same root-cause
error both times: conflating "can't nest further subagents" with "no
delegation at all"). Same tool/permission-scoping
limitation as Section A's generators applies here too — port
name/description/model/body, don't guess at the target's
tool-name vocabulary.
The one mistake to avoid either way
Never concatenate every skill's full body into the always-on router file
"to be safe." That defeats progressive disclosure and front-loads
irrelevant context into every task regardless of relevance — the exact bug
this repo's own AGENTS.md redesign fixed (P0-06: an 880-line file cut to
~200 by switching to an index). Always prefer: routing rules + skill
index, full bodies loaded on demand.
Reference
docs/CLIENT_COMPATIBILITY.md — per-tool file/mechanism table, sources
and caveats.
docs/INTEGRATION.md — the exact manual-regen recipe for each
already-built target.
tools/lib/adapter-common.sh — the shared logic (demote_headings,
render_skill_index, frontmatter_field) every generator uses; read it
before hand-porting something none of the generators cover yet.
1---2name: port-agent-config3description: Use when asked to port, migrate, or add equivalent agent instructions, skills, or custom sub-agents for a different coding tool than the one already configured — e.g. "add Cursor support from our CLAUDE.md", "we're switching from Cursor to Codex, port our rules", "make this work for Copilot too", "port our review subagent to Codex". Covers both agentharness-linked projects (use the real generators, don't hand-write) and plain projects with hand-authored config (port by hand, same principles).4---56# Port Agent Config78Move a project's agent instructions and skills to work with a different9coding tool, without breaking what already works for the current one. Two10situations, two procedures — check which one applies before doing anything.1112## Step 0: which situation is this?1314Look for a **reachable agentharness checkout** with `tools/generate-*.sh` in it:15- This repo itself (agentharness) — the scripts are right here.16- A consumer project where `harness-link.sh init` ran: `readlink` a17 `.claude/skills/*` entry to find the harness's real path, or look for an18 `agentharness/` submodule, or a durable npm-mode copy.1920**Found one → Section A.** **Not found → Section B.**2122## Section A — agentharness-linked: use the real generators2324Don't hand-write the target file. Each generator already reuses the exact25same source (`CLAUDE.md` + the skill catalog), is CI-drift-checked against26its committed output, and carries the correct caveats — reconstructing its27shape by hand is strictly worse and will drift the next time `CLAUDE.md`28changes.2930| Target tool | Generator | Produces |31|---|---|---|32| Codex CLI | `tools/generate-agents-md.sh --output AGENTS.md` | `AGENTS.md` |33| Gemini CLI / Antigravity | `tools/generate-gemini-md.sh --output GEMINI.md` | `GEMINI.md` |34| GitHub Copilot | `tools/generate-copilot-instructions.sh --output-dir .` | `.github/copilot-instructions.md` + `.github/instructions/*.instructions.md` |35| Kilo Code | `tools/generate-kilo-rules.sh --output .kilo/rules/agentharness.md` | `.kilo/rules/agentharness.md` |36| Cursor | `tools/generate-cursor-rules.sh --output-dir .` | `.cursor/rules/agentharness-router.mdc` + one `.mdc` per skill |37| OpenCode / Zed | nothing to generate — both read `AGENTS.md` directly | — |38| Claude Code | nothing to generate — `CLAUDE.md` is the hand-authored source | — |3940Steps:41421. Run the matching command against the target project (see each script's43 own `--help`, or `docs/INTEGRATION.md`'s per-platform section when the44 harness checkout and the target project aren't the same directory).452. Re-run the project's own content-quality check (`tools/verify-content-quality.py`46 here; the consumer's equivalent elsewhere) to confirm the new file isn't47 silently broken.483. Tell the user this is a manual step, not auto-wired into `init`/`update`49 (`ROADMAP.md`'s P1-01) — they'll need to re-run it whenever `CLAUDE.md`50 or the skill catalog changes.514. Keep the same caveat every generated file already states: not verified52 against a live session of the target tool.5354**Custom subagents** (task delegation to a separate agent instance —55`.claude/agents/*.md` — a different mechanism from the routing/skill56generators above) have their own set of generators, one per57delegation-capable target:5859| Target tool | Generator | Produces |60|---|---|---|61| Codex CLI | `tools/generate-codex-agents.sh --output-dir .` | `.codex/agents/<name>.toml` |62| OpenCode | `tools/generate-opencode-agents.sh --output-dir .` | `.opencode/agents/<name>.md` |63| Cursor | `tools/generate-cursor-agents.sh --output-dir .` | `.cursor/agents/<name>.md` (not `.cursor/rules/` — that's the skill generator) |64| Kilo Code | `tools/generate-kilo-agents.sh --output-dir .` | `.kilo/agents/<name>.md` |65| GitHub Copilot | `tools/generate-copilot-agents.sh --output-dir .` | `.github/agents/<name>.agent.md` (not `.github/copilot-instructions.md`/`.github/instructions/` — those are the routing/skill generator) |66| Gemini CLI | `tools/generate-gemini-agents.sh --output-dir .` | `.gemini/agents/<name>.md` |67| Zed | nothing to generate — real subagent delegation exists architecturally, but no confirmed user-facing named-config-file format was found (see `docs/CLIENT_COMPATIBILITY.md`'s custom-agent table) | — |6869**Important limitation, state it every time**: none of these six70generators port tool/permission scoping (Claude Code's `tools:` field,71Cursor's `readonly`/`is_background`, Kilo's `permission`/72`permission.task`, Copilot's `target`/`disable-model-invocation`/73`user-invocable`, Gemini's `tools`/`temperature`/`max_turns`) — that74vocabulary is unverified per-platform. Ported75files carry `name`/`description`/`model` and the body verbatim; tell the76user the tool/permission scope needs re-specifying by hand for the77target platform.7879## Section B — no agentharness: hand-port80811. **Read the source config in full.** Don't summarize from memory — find82 every file the source tool actually reads.832. **Identify the target's real mechanism**: its always-on file (name,84 location, whether it's read hierarchically or as a single file) and its85 skill/rule format (Agent Skills' progressive disclosure vs. Cursor's86 per-file `.mdc` frontmatter). `docs/CLIENT_COMPATIBILITY.md` in87 agentharness is a good reference table even from outside the repo; don't88 guess if you can check the target tool's own docs instead.893. **Port routing prose near-verbatim**, demoting every heading one level90 so the source's own H1 doesn't collide with the target file's H1 — the91 same rule every generator here follows (`demote_headings()` in92 `tools/lib/adapter-common.sh`).934. **Port skills without duplicating bodies:**94 - Target supports the Agent Skills standard (Codex, Gemini CLI,95 Antigravity, GitHub Copilot, Zed, Kilo Code, OpenCode all do): point it96 at the same skills directory instead of re-authoring content, and add97 only a name+description index to the always-on file.98 - Target has no Agent Skills support (Cursor is the only confirmed99 case): port each skill individually into the target's native rule100 format — for Cursor, one `.mdc` per skill, `description` copied101 verbatim, no `globs` (Agent-Requested activation, not Auto-Attached).1025. **State the caveat explicitly**: "ported from `<source>`'s config to103 `<target>`'s format; not verified against a live `<target>` session" —104 unless the user has actually run it themselves.1056. **Custom subagents** (task delegation, not skills/instructions) only106 port meaningfully between tools that both support real delegation107 with a confirmed config-file format (Claude Code, Codex CLI,108 OpenCode, Cursor, Kilo Code, GitHub Copilot, Gemini CLI — see109 `docs/CLIENT_COMPATIBILITY.md`'s custom-agent table); Zed likely has110 real delegation too but no confirmed file format to port into, so111 treat it as unconfirmed rather than either persona-only or portable.112 Don't assume a tool is persona-only without checking its docs113 directly — this table was wrong about both Copilot and Gemini CLI for114 a full session before being caught and corrected (same root-cause115 error both times: conflating "can't nest further subagents" with "no116 delegation at all"). Same tool/permission-scoping117 limitation as Section A's generators applies here too — port118 `name`/`description`/`model`/body, don't guess at the target's119 tool-name vocabulary.120121## The one mistake to avoid either way122123Never concatenate every skill's full body into the always-on router file124"to be safe." That defeats progressive disclosure and front-loads125irrelevant context into every task regardless of relevance — the exact bug126this repo's own `AGENTS.md` redesign fixed (P0-06: an 880-line file cut to127~200 by switching to an index). Always prefer: routing rules + skill128index, full bodies loaded on demand.129130## Reference131132- `docs/CLIENT_COMPATIBILITY.md` — per-tool file/mechanism table, sources133 and caveats.134- `docs/INTEGRATION.md` — the exact manual-regen recipe for each135 already-built target.136- `tools/lib/adapter-common.sh` — the shared logic (`demote_headings`,137 `render_skill_index`, `frontmatter_field`) every generator uses; read it138 before hand-porting something none of the generators cover yet.