agent-harness-docs
One source of truth, thin pointers everywhere else. Every coding-agent harness looks for
its own file (CLAUDE.md, .cursor/rules, opencode config, AGENTS.md), but you write the
guidance once in AGENTS.md and make every other file a one-line redirect. Duplicated
per-harness docs rot out of sync; a single AGENTS.md with pointers does not.
1. AGENTS.md is the canonical doc
AGENTS.md is the emerging cross-harness standard (Codex, Cursor, opencode, and others
read it natively). Put ALL real guidance here. Structure that works:
- Mental model — the one paragraph an agent needs to not misuse the tool.
- The interfaces — SDK / CLI / MCP, one line each.
- MCP tools table — tool name → when to call it.
- The task loop — the ordered steps an agent follows to do the main job (e.g. "wire
tracking": list → check → setup → verify → dry-run → wire).
- Rules — the hard constraints (what never to do), stated as imperatives.
Keep it task-oriented, not marketing. An agent reads it to act, not to be sold.
2. Thin per-harness pointers
Each harness gets a file that points at AGENTS.md — never a copy.
- CLAUDE.md —
See [AGENTS.md](./AGENTS.md). One line. Claude Code reads it.
.cursor/rules/<name>.mdc — frontmatter (description, globs, alwaysApply: false)
- a short bulleted digest of the key call shapes, ending "full guide: AGENTS.md". Cursor
rules want brevity; link, don't inline the whole thing.
opencode.json — declare the MCP server (opencode also reads AGENTS.md natively):
{ "mcp": { "<name>": { "type": "local", "command": ["npx","-y","<pkg>","mcp"], "enabled": true } } }
- Codex —
~/.codex/config.toml [mcp_servers.<name>] (document it in SETUP; it's a
user-machine config, not a repo file).
- Gemini —
~/.gemini/settings.json mcpServers block (document in SETUP).
3. The per-client MCP-setup section
If the tool ships an MCP server, put a ## MCP setup section in docs/SETUP.md with one
subsection per client, each showing the exact snippet:
- Claude Code —
claude mcp add <name> -- npx -y <pkg> mcp, or commit .mcp.json.
- Claude Desktop —
claude_desktop_config.json mcpServers block.
- Cursor —
.cursor/mcp.json mcpServers block.
- opencode — the
opencode.json block (already in the repo).
- Codex CLI —
~/.codex/config.toml [mcp_servers.<name>].
- Gemini CLI —
~/.gemini/settings.json mcpServers.
End with how the server receives secrets: the launching shell's env, or an env block in
the MCP config.
4. Ship AGENTS.md in the package
Add AGENTS.md to package.json files so it lands in the npm tarball — agents consuming
the package read it from node_modules/<pkg>/AGENTS.md. The per-harness pointer files
(.cursor, opencode.json, CLAUDE.md) are repo-level for contributors; they do not need to
ship.
5. Checklist
Pairing
Chains after agentic-cli-npm-package (which builds the CLI+npm+MCP) — that skill ships the
code, this one ships the agent docs. Reference exemplar: the adscapi package.
1---2name: agent-harness-docs3description: Author one set of agent-facing docs that work across every coding-agent harness — AGENTS.md as the single source of truth, thin per-harness pointers (CLAUDE.md, .cursor/rules, opencode.json, Codex/Gemini config), and a per-client MCP-setup section. Use when a package, CLI, or repo should be usable by Claude Code, Cursor, opencode, Codex, and Gemini without duplicating guidance per tool. Fills the gap left by build-from-template / agentic-cli-npm-package, which ship the code but not the agent docs.4---56# agent-harness-docs78One source of truth, thin pointers everywhere else. Every coding-agent harness looks for9its own file (CLAUDE.md, `.cursor/rules`, opencode config, `AGENTS.md`), but you write the10guidance **once** in `AGENTS.md` and make every other file a one-line redirect. Duplicated11per-harness docs rot out of sync; a single `AGENTS.md` with pointers does not.1213## 1. AGENTS.md is the canonical doc1415`AGENTS.md` is the emerging cross-harness standard (Codex, Cursor, opencode, and others16read it natively). Put ALL real guidance here. Structure that works:1718- **Mental model** — the one paragraph an agent needs to not misuse the tool.19- **The interfaces** — SDK / CLI / MCP, one line each.20- **MCP tools table** — tool name → when to call it.21- **The task loop** — the ordered steps an agent follows to do the main job (e.g. "wire22 tracking": list → check → setup → verify → dry-run → wire).23- **Rules** — the hard constraints (what never to do), stated as imperatives.2425Keep it task-oriented, not marketing. An agent reads it to act, not to be sold.2627## 2. Thin per-harness pointers2829Each harness gets a file that points at `AGENTS.md` — never a copy.3031- **CLAUDE.md** — `See [AGENTS.md](./AGENTS.md).` One line. Claude Code reads it.32- **`.cursor/rules/<name>.mdc`** — frontmatter (`description`, `globs`, `alwaysApply: false`)33 + a short bulleted digest of the key call shapes, ending "full guide: AGENTS.md". Cursor34 rules want brevity; link, don't inline the whole thing.35- **`opencode.json`** — declare the MCP server (opencode also reads AGENTS.md natively):36 `{ "mcp": { "<name>": { "type": "local", "command": ["npx","-y","<pkg>","mcp"], "enabled": true } } }`37- **Codex** — `~/.codex/config.toml` `[mcp_servers.<name>]` (document it in SETUP; it's a38 user-machine config, not a repo file).39- **Gemini** — `~/.gemini/settings.json` `mcpServers` block (document in SETUP).4041## 3. The per-client MCP-setup section4243If the tool ships an MCP server, put a `## MCP setup` section in `docs/SETUP.md` with one44subsection per client, each showing the exact snippet:4546- **Claude Code** — `claude mcp add <name> -- npx -y <pkg> mcp`, or commit `.mcp.json`.47- **Claude Desktop** — `claude_desktop_config.json` `mcpServers` block.48- **Cursor** — `.cursor/mcp.json` `mcpServers` block.49- **opencode** — the `opencode.json` block (already in the repo).50- **Codex CLI** — `~/.codex/config.toml` `[mcp_servers.<name>]`.51- **Gemini CLI** — `~/.gemini/settings.json` `mcpServers`.5253End with how the server receives secrets: the launching shell's env, or an `env` block in54the MCP config.5556## 4. Ship AGENTS.md in the package5758Add `AGENTS.md` to `package.json` `files` so it lands in the npm tarball — agents consuming59the package read it from `node_modules/<pkg>/AGENTS.md`. The per-harness pointer files60(`.cursor`, `opencode.json`, CLAUDE.md) are repo-level for contributors; they do not need to61ship.6263## 5. Checklist6465- [ ] `AGENTS.md` with mental model + interfaces + MCP tools + task loop + rules.66- [ ] `CLAUDE.md` = one-line pointer.67- [ ] `.cursor/rules/<name>.mdc` = digest + pointer.68- [ ] `opencode.json` = MCP declaration.69- [ ] `docs/SETUP.md` `## MCP setup` = per-client snippets (Claude Code/Desktop, Cursor,70 opencode, Codex, Gemini) + how secrets reach the server.71- [ ] `AGENTS.md` added to `package.json` `files`.7273## Pairing7475Chains after `agentic-cli-npm-package` (which builds the CLI+npm+MCP) — that skill ships the76code, this one ships the agent docs. Reference exemplar: the `adscapi` package.