AI Coding Agents — Creation Hub
Use this skill to go from a coding agent idea to a working agent definition, whether a single-purpose agent or a coordinated multi-agent coding team.
This skill owns the coding-domain-specific creation workflow, templates, and patterns. For agent architecture decisions and build-vs-not gates, start with ../ai-agents/SKILL.md.
Two Different Tracks
This skill (and its siblings prefixed ai-coding-agents-*) split into two tracks with different audiences. Pick the right one before going deeper.
Track A — Create an agent on an existing platform (this skill).
Use this umbrella when the platform exists (Claude Code, Codex, or Agent SDK) and you need to define an agent on top of it: frontmatter, tools, archetype, multi-agent coordination. This is the common case.
Track B — Build a coding-agent runtime from scratch (the 14 sibling skills).
Use the dedicated curriculum when you are building the runtime itself — the thing that loads agents, sandboxes execution, routes tool calls, manages sessions. Each skill captures known traps, patterns, and anti-patterns for one subsystem:
If the request is "how do I add a slash command to my runtime?" or "how should I design approval prompts?", route to Track B. If it's "how do I define a code-review agent on Claude Code?", stay here.
ASCII Flow
user need
|
v
classify: define agent on existing platform OR build runtime subsystem
|
+--> existing platform
| -> choose platform: Claude Code | Codex | Agent SDK
| -> choose archetype or team pattern
| -> scope tools + context + verification
| -> smoke test on representative coding tasks
|
+--> runtime subsystem
-> route to ai-coding-agents-* sibling skill
-> design subsystem contract + invariants + failure modes
-> validate with host/runtime-specific tests
Quick Reference
| Question |
Read |
Outcome |
| How do I create a coding agent end-to-end? |
references/creation-workflow.md |
Step-by-step from idea to running agent |
| Which platform should I target? |
references/platform-patterns.md |
Decision tree: .md vs .toml vs SDK |
| What single-agent archetypes exist? |
references/agent-archetypes.md |
Six patterns with frontmatter and tools |
| When should I use a multi-agent team? |
references/multi-agent-coding-patterns.md |
Three architectures: coordinator, fork, swarm |
| How do I manage context for code-heavy work? |
references/context-management.md |
Token budgets, file selection, progressive disclosure |
| How do I wrap dev tools for agents? |
references/tool-integration.md |
Linter, formatter, test runner, type checker patterns |
| My agent is broken |
references/debugging-guide.md |
Failure taxonomy and fixes |
| What do production coding agents look like? |
references/production-patterns.md |
Real patterns from Claude Code source |
| How does Claude Code define and validate agents? |
references/claude-code-agent-runtime-patterns.md |
File format, validation, and persistence rules |
| How do swarms, teammates, and worktrees behave? |
references/claude-code-swarm-and-worktree-patterns.md |
Team files, inherited flags, worktree lifecycle |
| How are skills and built-in plugins loaded? |
references/claude-code-skill-and-plugin-loading.md |
Frontmatter loading, plugin-backed skills, prompt budgets |
| Which prompt recipes steer a Claude Code session to a specific outcome? |
references/claude-code-prompt-recipes.md |
35 named recipes covering setup, planning, execution, review, debug/recovery, and session economics |
| Should I route a coding task to a cheap or premium model? |
references/multi-model-routing-economics.md |
85/15 routing pattern, cost/context tradeoffs — re-verify live numbers before costing |
When To Use
- Create a new coding agent from scratch on any supported platform
- Choose the right archetype for a coding task (review, test generation, refactoring, migration, docs, security)
- Design a multi-agent team for complex coding tasks (parallel reviews, bug investigation, migration fleets)
- Design context loading strategy for agents working with large codebases
- Wrap existing dev tools (linters, formatters, test runners, type checkers) for agent use
- Debug a coding agent producing poor results, hallucinated files, or scope creep
- Port a coding agent between platforms (Claude Code ↔ Codex ↔ Agent SDK)
Use Other Skills
| Need |
Use Instead |
| Agent architecture decisions, build-vs-not |
../ai-agents/SKILL.md |
| Subagent frontmatter, delegation contracts |
agents-subagents — current fields include name, description, model (alias fable valid), effort, maxTurns, tools, disallowedTools, skills, memory, initialPrompt, background, isolation (worktree only value), color; permissionMode field noted but auto value and plugin-subagent restrictions apply — see ../ai-coding-agents-permissions/SKILL.md; Agent(type) tool-scoping syntax gates spawnable subagent types |
| MCP server setup and integration |
../agents-mcp/SKILL.md |
| Hook guardrails and lifecycle events |
../agents-hooks/SKILL.md |
| Skill packaging and SKILL.md conventions |
../agents-skills/SKILL.md |
| Generic multi-agent orchestration, wave dispatch |
../agents-swarm-orchestration/SKILL.md |
| AGENTS.md (Codex-originated convention) and CLAUDE.md (Claude Code equivalent) configuration |
../agents-memory/SKILL.md |
| Slash-command runtime architecture for coding-agent CLIs |
../ai-coding-agents-command-runtime/SKILL.md |
| Trace, replay, regression evals, and cost accounting |
../ai-coding-agents-observability-evals/SKILL.md |
| Plugin and extension architecture for coding agents |
../ai-coding-agents-plugins/SKILL.md |
| Tool approvals, allow/ask/deny rules, and permission routing |
../ai-coding-agents-permissions/SKILL.md |
| Model-provider abstraction, streaming normalization, and fallback routing |
../ai-coding-agents-provider-runtime/SKILL.md |
| Packaging, update channels, cache migrations, and plugin compatibility |
../ai-coding-agents-release-distribution/SKILL.md |
| Session lifecycle, resume, rewind, and transcript restoration |
../ai-coding-agents-sessions/SKILL.md |
| Local UI plus remote execution architecture |
../ai-coding-agents-remote-runtime/SKILL.md |
| Process isolation, filesystem policy, network controls, and destructive-command boundaries |
../ai-coding-agents-execution-sandbox/SKILL.md |
| Settings precedence, managed policy, and runtime config reload |
../ai-coding-agents-settings-policy/SKILL.md |
| Terminal-first REPL and coding-agent interaction design |
../ai-coding-agents-terminal-ui/SKILL.md |
| Background task runtimes, teammate queues, and task ownership |
../ai-coding-agents-tasks/SKILL.md |
| Tool registry, tool search, and tool execution architecture |
../ai-coding-agents-tools/SKILL.md |
| Testing coding agents (evals, regression) |
../qa-agent-testing/SKILL.md |
| Context loading strategies (generic) |
../dev-context-engineering/SKILL.md |
| Measuring coding agent ROI |
../dev-ai-coding-metrics/SKILL.md |
| Claude API and Agent SDK reference |
claude-api skill |
Default Workflow
- Classify the task: What code does the agent touch? What tools does it need? What is the output?
- Single agent or team? One bounded task → single agent. Multiple interdependent tasks, parallel reviews, or complex investigation → multi-agent team.
- Pick the archetype closest to your need from the archetypes or multi-agent patterns.
- Choose the platform: Claude Code
.md for repo-level agents, Codex .toml for Codex workflows, Agent SDK for programmatic integration.
- Start from the matching template in
assets/templates/.
- Scope tools to the minimum needed. Read-only agents get Read, Grep, Glob. Edit agents add Edit, Write, Bash.
- Design the context strategy: What files does the agent need? How does it discover them? What is the token budget?
- Add verification: How does the agent check its own work? For teams: assign a separate verifier.
- Smoke test: Run on 3+ representative tasks before deploying.
- Test extension robustness: For edit, refactor, and migration agents, run at least one evolving-spec sequence with 3+ checkpoints. Start each checkpoint in a fresh conversation/context, carry forward the same agent-created workspace, and retain all prior regression tests.
- Iterate: Observe real behavior, tighten scope, improve prompts.
Known Traps
- giving a coding agent repo-wide edit authority before the owned files and verification surface are clear
- asking the same agent to implement, review, and approve its own high-risk changes
- inheriting parent context blindly across phases instead of re-briefing from current repo truth
- building a multi-agent coding team before the task graph, file ownership, and merge plan exist
- assuming Claude Code, Codex, and SDK workers expose equivalent tools, hooks, and approval semantics
- treating one-shot green tests, a plan-first prompt, or an anti-slop prompt as evidence that edit-capable agents remain extensible over repeated changes
Common Anti-Patterns
- "full-stack fixer" agents with no bounded artifact, path, or runtime scope
- tool wrappers that hide destructive commands behind vague natural-language instructions
- edit-capable workers launched in parallel on the same branch with no ownership contract
- context strategies that preload too much code instead of progressive disclosure and file selection
- smoke tests skipped because the prompt "looks right"
OpenAI Internal Practice (Codex, 2026-05)
Source: How OpenAI uses Codex, May 2026 — internal-usage report across Security, Product, Frontend, API, Infrastructure, and Performance Engineering teams. These patterns are validated by daily use inside OpenAI; cite this source rather than restating as your own observations.
Two-stage Ask → Code flow for non-trivial changes
- Pattern: for any change above the trivial single-file fix, run Ask Mode first to produce an implementation plan. Then switch to Code Mode and feed the plan as input to follow-up prompts.
- Why: keeps the agent grounded; the plan becomes a self-correction surface — if the plan is wrong, the human catches it before generation rather than after.
- Anti-pattern: going straight to Code Mode for a multi-file change. The agent will improvise structure that the human then has to reverse-engineer at review time.
- Recipe: "Plan the implementation for X. Do not write code yet." → review plan → "Execute the plan above, file by file."
Environment-as-prompt (compoundable)
- Pattern: treat the agent's runtime environment — startup script, env vars, internet access — as part of the persistent prompt. Iterate on env config every time a build error appears and ask whether the env should have prevented it.
- Why: env improvements compound. A startup script that installs the right toolchain once removes a category of errors from every future task in the repo.
- Anti-pattern: treating env failures as one-off prompt fixes. The agent re-discovers the same gap on every new task.
- Recipe: maintain a single
setup.sh (or equivalent) that the agent runs at session start; add to it when a class of build error recurs.
Prompt-as-GitHub-Issue
- Pattern: structure prompts the way you would write a PR description or issue — file paths, component names, diffs, doc snippets, and "implement this the same way it's done in [module X]" anchors.
- Why: the model already responds well to PR/issue-shaped text from training distribution; this is free signal that doesn't require new tooling.
- Anti-pattern: chat-shaped prompts ("can you change the auth flow?") that omit the repo coordinates the agent needs to act precisely.
Task queue as lightweight backlog
- Pattern: fire off tangential ideas, partial work, or incidental fixes as separate Codex tasks rather than holding them in human working memory. The queue is the backlog; no obligation to produce a full PR per task.
- Why: captures drive-by fixes without forcing context switches; staging area mirrors the engineer's working set.
- Where this lives in this skill: see
../ai-coding-agents-tasks/SKILL.md for the task-runtime detail and the sizing heuristic (~1 hour of human work / a few hundred LOC).
Best-of-N as a generation primitive
- Pattern: generate N parallel solutions for a single task and either pick the best or combine parts of multiple outputs.
- Why: for ambiguous or open-ended tasks, the cheapest quality-improving move is variance, not better prompting.
- Anti-pattern: running Best-of-N on tasks with one obviously correct shape (mechanical refactors, type fixes). Wasted compute; pick prompt engineering instead.
- Vendor scope: Codex-specific feature surface. The equivalent on other runtimes is parallel subagent dispatch — see
../agents-swarm-orchestration/SKILL.md.
Platform Decision Tree
| Scenario |
Platform |
Why |
| Repo-team agent, auto-delegated by description |
Claude Code .md |
Description-driven routing, shared via .claude/agents/ |
| Codex thread workers |
Codex .toml |
Explicit spawning, sandbox-mode scoped |
| Codex as tool inside an editor or AI orchestrator |
codex mcp-server (stdio) |
Codex acts as an MCP server; editor drives it over MCP wire protocol |
| Non-interactive code review in CI |
codex review subcommand |
Headless, no terminal UI; structured output for pipelines |
| Programmatic, CI, or API integration |
Agent SDK |
Full control, custom tools, hook callbacks |
| Quick prototype |
Claude Code .md |
Fastest path to working agent |
| Multi-agent coordinator team |
Claude Code .md |
Native coordinator mode, fork, and team support |
| Custom orchestration logic |
Agent SDK |
Programmatic control over spawning, routing, results |
| Local-first OSS coding agent, editor-integrated via ACP (Zed, JetBrains, IntelliJ) |
Goose (Rust) + recipe YAML |
ACP server mode; 70+ MCP extensions; custom-distros; Apache-2.0 |
| Enterprise white-label coding agent with pinned providers and extensions |
Goose Custom Distribution |
Distro manifest baked into the binary; supply-chain gates (deny.toml); AAIF/LF governance |
| GitHub-centric repo, lightweight PR-aware agent, no multi-agent need |
GitHub Copilot CLI custom agent (.agent.md) |
Pre-wired GitHub MCP server, PR-scoped agent versioning; see Copilot CLI section below for its ceiling |
See references/platform-patterns.md for side-by-side comparison and porting guide.
Goose as a fourth platform (2026)
Goose (github.com/aaif-goose/goose, formerly github.com/block/goose) is a 50k+-star Rust-based OSS coding agent donated by Block to the Agentic AI Foundation (AAIF) under the Linux Foundation. It is a meaningfully different platform from Claude Code / Codex / Agent SDK:
- Protocols: first-class MCP and ACP. Goose runs as an ACP server (
goose acp) so editors drive it over stdio; Goose can also delegate to external ACP agents (Claude Code, Codex) as providers.
- Unit of work: a recipe — YAML with
version / title / description / instructions / extensions / activities / prompt / parameters. Recipes are portable, statically validated, and declare their extension dependencies inline.
- Distribution: supports custom distros (white-label, pinned providers/extensions, branded binaries) as a first-class shipping class.
- Project hints: uses
.goosehints alongside AGENTS.md — one more member of the narrative-hint family (see ../agents-memory/SKILL.md).
Treat it as the target when a coding agent must be OSS, editor-embedded, locally-operated, or enterprise-forkable. Detailed patterns live in the subsystem skills under "Cross-Platform Patterns (Goose)" sections — most relevantly in ai-coding-agents-provider-runtime (toolshim, agent-as-provider), ai-coding-agents-remote-runtime (ACP stdio, daemon+OpenAPI), ai-coding-agents-tasks (recipes as typed blueprints), and ai-coding-agents-release-distribution (custom distros).
GitHub Copilot CLI — a fifth, lighter-weight platform (revised 2026)
GitHub Copilot CLI outgrew its "explains shell commands" origin during 2026. It now defines custom agents as Markdown files with YAML frontmatter (.agent.md, resolvable at repo or org scope), supports a plugin system (/plugin install owner/repo) that bundles MCP servers, agents, skills, and hooks, and ships with the GitHub MCP server pre-wired plus built-in Explore and Task agents. This makes Track A (define an agent on an existing platform) applicable to Copilot CLI in a way it was not a year earlier — treat the earlier "not a coding-agent platform" framing as retired.
Frontmatter shape: description (required), name, target (vscode | github-copilot), tools (omit or ["*"] for all; empty list disables all; MCP tools namespaced as server-name/tool-name), model, disable-model-invocation, user-invocable. Body is Markdown instructions, capped at 30,000 characters. Versioning rides on git commit SHAs rather than a semantic version field.
Where it still falls short of Track B territory: no native multi-agent orchestration (agents can invoke each other via an agent tool alias, but there is no coordinator/fork/team primitive), no formal session-resume or task-graph model, and no sandbox-mode equivalent to Codex's workspace-write / read-only / network-off. Do not port a coordinator-led team or peer-swarm design onto it — the primitives that make those patterns safe (worktree isolation, mailbox protocol, owned-files enforcement) are absent.
When to prefer Copilot CLI: a GitHub-centric repo where a lightweight, PR-aware custom agent is enough — GitHub MCP tools and PR-scoped agent versioning are first-class — and you do not need multi-agent coordination or fine-grained sandbox modes. Prefer Claude Code or Codex when the task needs a coordinator/team pattern, worktree isolation, or a documented permission-mode ladder. Verify current field names and limits against docs.github.com/en/copilot before depending on specifics — this surface is still moving faster than the rest of the platform list. Use scripts/smoke_test.sh to validate that your primary coding-agent setup (Claude Code, Codex, or Agent SDK) is healthy independent of which platform you pick for a given repo.
Single Agent Archetype Index
| Archetype |
Core Tools |
maxTurns |
Key Constraint |
Template |
| Code Reviewer |
Read, Grep, Glob, Bash |
8 |
Read-only, findings-first output |
code-reviewer.md |
| Test Generator |
Read, Write, Edit, Bash, Grep |
15 |
Must run generated tests |
test-generator.md |
| Refactoring Agent |
Read, Edit, Bash, Grep, Glob |
20 |
Preserve behavior, run existing tests |
refactoring-agent.md |
| Migration Agent |
Read, Write, Edit, Bash, Grep, Glob |
25 |
Pattern-at-a-time, checkpoint between batches |
migration-agent.md |
| Documentation Agent |
Read, Write, Grep, Glob |
12 |
Source-anchored, no invented APIs |
Universal template |
| Security Scanner |
Read, Grep, Glob, Bash |
10 |
Read-only, severity-ordered output |
security-scanner.md |
Each archetype is detailed in references/agent-archetypes.md with full frontmatter, system prompt structure, and failure modes.
Multi-Agent Pattern Index
| Pattern |
Communication |
Isolation |
Best For |
Template |
| Coordinator-Led Team |
<task-notification> XML |
Workers in background |
Research → implement → verify loops |
coordinator-coding-team.md |
| Fork Subagents |
Implicit (context inherited) |
Shared prompt cache |
Parallel background exploration |
See fork guidance below |
| Agent Teams (Peer Swarm) |
Mailbox messaging (SendMessage) |
Git worktrees per teammate |
Self-coordinating specialists |
swarm-investigation.md |
| Background Agents |
Daemon-supervised processes; claude --bg, /bg, claude agents dashboard |
Git worktree per session (auto-created under .claude/worktrees/) |
Long-running parallel tasks, tasks dispatched and monitored without keeping a terminal open |
See background agent guidance below |
| ACP-Delegated Subagent |
ACP stdio (line-delimited JSON) |
Separate process; approvals round-trip through orchestrator |
Cross-platform delegation (Goose → Claude Code, Goose → Codex, etc.) |
See ACP delegation note below |
When to use which pattern
Coordinator-Led Team — You want a single leader that synthesizes findings and directs workers. Workers run in background, report via notifications. The coordinator retains full understanding and authority. Best for structured multi-phase workflows: parallel research → coordinator synthesis → directed implementation → independent verification.
Fork Subagents — You want cheap parallel background work that inherits your current context. Forks share the parent's prompt cache (fast, low cost). The parent doesn't see intermediate work — only the final report. Best for: "search these 5 modules in parallel while I continue thinking."
Agent Teams (Peer Swarm) — You want teammates that communicate directly with each other via mailboxes. Each teammate has its own worktree for isolation. They share a task list and can self-coordinate without the lead directing every step. Best for: complex investigations where specialists need to discuss findings, large-scale migrations with many independent workers.
Background Agents — You want to dispatch tasks that run without a terminal attached and resume at any time. Start with claude --bg "<task>" from the shell, /bg inside a session, or the dispatch input in claude agents. The daemon supervisor keeps sessions alive; each session gets an isolated git worktree under .claude/worktrees/. Monitor all sessions in the claude agents dashboard (grouped by Needs input / Working / Completed); peek without attaching via Space; use claude agents --json to list sessions in CI. Session state lives under ~/.claude/jobs/<id>/state.json; the roster is at ~/.claude/daemon/roster.json. Disable with the disableAgentView managed setting or CLAUDE_CODE_DISABLE_AGENT_VIEW env var. Best for: long parallel tasks, tasks that outlive your terminal session, fleet-style coding work. Source: code.claude.com/docs/en/agent-view and claude.com/blog/agent-view-in-claude-code.
ACP-Delegated Subagent — You want one coding agent to spawn another coding agent over the Agent Client Protocol (stdio) and treat the delegated agent as either a turn-scoped provider or a session-scoped subagent. The orchestrator retains approval authority; approvals raised by the delegated agent round-trip back through ACP. Best for: cross-platform delegation (Goose orchestrating Claude Code; Claude Code delegating a specialist Codex session), heterogeneous teams where different agents have different provider access, and keeping a single approval surface across multi-agent work. The provider-side framing lives in ../ai-coding-agents-provider-runtime/SKILL.md (agent-as-provider); the remote-runtime framing lives in ../ai-coding-agents-remote-runtime/SKILL.md (ACP stdio transport, agent-delegating mode).
See references/multi-agent-coding-patterns.md for full architecture details, coding workflows, and anti-patterns.
Multi-agent principles (from Claude Code source)
These apply across all patterns:
- Never delegate understanding. The coordinator/lead must synthesize findings before directing implementation. Never write "based on your findings, fix it" — include file paths, line numbers, exact changes.
- Freeze interfaces before dispatch. Define contracts, owned files, and expected outputs before launching workers.
- Give every worker exclusive owned_files. Prevents merge conflicts in parallel edit scenarios.
- Use separate verifiers. Never let an agent verify its own work. Spawn a fresh worker with adversarial posture.
- Spawn fresh at phase boundaries. Exploration → implementation is a context rotation point. Don't reuse a research worker for implementation — spawn fresh with synthesized specs.
- Persist state in files. Task graphs, decisions, and dependency outputs go in JSON/YAML/Markdown files, not just conversation memory.
- Escalation, not retry. Worker self-corrects once → escalates to lead → lead diagnoses and reassigns → human if still stuck.
- Background is the default now — plan around notifications, not blocking. As of Claude Code v2.1.198, every
Agent spawn (named or fork) defaults to background execution; Claude only runs a subagent in the foreground when it needs the result immediately. Don't add background: true out of habit — it's the resting state. What still matters: background workers surface their own permission prompts in the main session (since v2.1.186), so a worker needing an approval does not silently stall — expect and handle that interruption in the workflow, not just the happy path.
- Nesting is allowed to depth 5 — that's a ceiling, not a target. Since v2.1.172, subagents (including forks, which count toward the cap since v2.1.187) can spawn their own subagents up to 5 levels below the main conversation; a depth-5 agent loses Agent-tool access entirely. Treat this the way you'd treat recursion depth in code: technically available doesn't mean advisable. Each level compounds cost and loses synthesis fidelity — a depth-3 worker's "findings" have already been summarized twice before the lead sees them. Default to flat coordinator/fork/team patterns (depth 1-2) and only reach for deeper nesting when a sub-problem is itself decomposable into independent, boundable sub-tasks — not as a way to avoid writing a clear brief.
Context Management Essentials
Coding agents consume context differently from general agents because code files are large and interdependent.
Token budget model: Split the context window into three buckets:
- Instructions (~15-20%): System prompt, skill content, agent rules
- Code (~50-60%): File contents the agent reads during work
- Output (~20-30%): The agent's reasoning, tool calls, and generated code
File selection strategy:
- Known paths: Use Read directly when you know which file to examine
- Discovery: Use Grep/Glob first to find relevant files, then Read targeted sections
- Progressive disclosure: Start with directory structure (ls), then key files (package.json, tsconfig), then specific code
The explore-then-act pattern (from Claude Code's built-in architecture): Separate read-only exploration from editing. The Explore agent uses a strict read-only constraint with parallel tool calls for speed. After exploration, a fresh agent receives synthesized findings and makes focused edits.
When to split into subagents: If the task touches more than 5-10 files across different modules, or the agent starts losing track of earlier context, split into focused subagents with clear file ownership.
Skill-subagent context isolation: Skills and subagents can reference each other bidirectionally. A subagent can preload skills via the skills: field (role with baked-in domain knowledge), or a skill can delegate to a subagent via context: fork (task isolation without a full agent file). See agents-subagents for the full pattern and decision table.
See references/context-management.md for detailed strategies including multi-agent context management.
Templates and Entry Points
Single Agent Templates
| Template |
Use Case |
claude-code-agent.md |
Universal Claude Code coding agent starting point |
code-reviewer.md |
Read-only code review with severity-ordered findings |
test-generator.md |
Test creation with self-validation |
refactoring-agent.md |
Behavior-preserving structural changes |
migration-agent.md |
Batch pattern transformation with checkpoints |
security-scanner.md |
Security analysis with evidence-based findings |
Multi-Agent Templates
| Template |
Use Case |
coordinator-coding-team.md |
Leader-directed research → implement → verify team |
swarm-investigation.md |
Peer-coordinated bug investigation with specialists |
parallel-review-team.md |
Parallel code review with security, performance, and style specialists |
Cross-Platform Templates
| Template |
Use Case |
codex-agent.toml |
Codex custom agent definition |
sdk-agent-py.py |
Python Agent SDK scaffolding with custom tools |
sdk-agent-ts.ts |
TypeScript Agent SDK scaffolding |
Checklists
| Checklist |
Use Case |
agent-design-checklist.md |
Pre-creation validation for single agents |
multi-agent-checklist.md |
Pre-dispatch validation for coding teams |
production-readiness.md |
Deployment readiness gate |
Recommended Build Order
For a new CLI coding-agent runtime, implement subsystems in this order:
- settings and policy layering
- command registry and lazy command loading
- provider abstraction, streaming normalization, and context-window policy
- execution sandbox, workspace mounts, network policy, and destructive-command guards
- tool contract, built-in enumeration, and tool-pool assembly
- permission context and approval routing
- central tool-execution pipeline
- session persistence, history, and resume
- remote transport and permission bridging
- task runtime and teammate orchestration
- terminal UI, background-task surfaces, and virtualization
- plugin loading, versioned cache, and managed extension policy
- observability, replay, regression evals, and release gates
- packaging, update channels, migrations, and distribution
Why this order:
- earlier layers define the contracts later layers consume
- permission and session flows are hard to retrofit once tools and UI exist
- remote runtime, tasks, and terminal UI depend on stable command, tool, and settings semantics
- plugins should land after the host runtime has clear ownership of precedence and trust boundaries
Core Runtime Spine
Treat a serious coding-agent runtime as a fixed spine of cooperating subsystems, not as one prompt plus a tool runner.
- settings and policy define what the runtime is allowed to do
- command runtime defines how users and the host invoke higher-level actions
- provider runtime defines how model traffic is normalized and recovered
- execution sandbox defines the real security envelope
- tools define callable capabilities and execution stages
- permissions decide when risky actions are allowed
- sessions decide what state survives and resumes
- remote runtime bridges local UI to remote execution when needed
- tasks represent long-running and delegated work
- terminal UI renders and controls runtime state without owning it
- plugins extend the host through controlled capability points and layered refresh
- observability and evals close the feedback loop
- release and distribution keep upgrades, caches, and compatibility survivable
If one of these is missing, the usual outcome is not “slightly worse UX.” The usual outcome is hidden fragility that appears under reconnects, long sessions, remote control, worker delegation, or upgrades.
Cross-platform validation (2026)
The spine above is rebuilt-and-verified against the Claude Code lineage and, as of 2026-04, cross-checked against Goose (Rust, MCP+ACP, OSS under AAIF/Linux Foundation). Patterns that only appeared in the Claude Code snapshot but missed in Goose have been imported into the subsystem skills as "Cross-Platform Patterns (Goose)" sections. When designing a new runtime, read the Claude-Code-derived core and the Goose additions in each subsystem skill before committing to an architecture.
Core Invariants
- one host-owned state model per subsystem
- typed contracts between subsystems instead of implicit shared assumptions
- cache invalidation is explicit and event-driven, not "restart and hope"
- recovery behavior classified by failure family, not generic retry loops
- approvals and sandboxing treated as runtime architecture, not prompt wording
- resume, remote control, and background work designed before polish layers
- telemetry keeps causal order and low-cardinality dimensions
- observability able to explain why the runtime did what it did
Common False Shortcuts
- building the agent as “LLM + tools + prompt” with no subsystem boundaries
- adding permissions before sandboxing or vice versa and pretending they are interchangeable
- bolting on session resume after tools, UI, and remote flows already exist
- treating remote execution as “the same session over the network”
- memoizing discovery and registry state with no invalidation plan
- shipping plugins before the host owns precedence, trust, and cache policy
- letting cache identity ignore install context, path, or versioned state
- adding evals only after incidents instead of using them as a design constraint
- assuming a good local prototype will survive upgrades, worktrees, and delegation unchanged
Navigation
References
references/creation-workflow.md — End-to-end creation guide
references/platform-patterns.md — Claude Code vs Codex vs Agent SDK
references/agent-archetypes.md — Six single-agent coding patterns
references/multi-agent-coding-patterns.md — Three multi-agent architectures
references/context-management.md — Token budgets and file strategies
references/tool-integration.md — Dev tool wrapping patterns
references/debugging-guide.md — Failure taxonomy and fixes
references/production-patterns.md — Real patterns from Claude Code source
references/claude-code-agent-runtime-patterns.md — Agent file shape, validation, and persistence
references/claude-code-swarm-and-worktree-patterns.md — Team files, teammate spawn inheritance, and worktree rules
references/claude-code-skill-and-plugin-loading.md — Skill frontmatter loading and built-in plugin behavior
references/claude-code-prompt-recipes.md — Named prompt recipes for setup, planning, execution, review, and debug/recovery
references/multi-model-routing-economics.md — Cheap-vs-premium routing pattern and CLI/MCP operational surfaces (time-decaying numbers — re-verify before costing)
Assets
assets/templates/ — Agent definition and team templates
assets/checklists/ — Design, dispatch, and deployment checklists
Data
data/sources.json — Primary documentation and research references
data/claude-code/ — Moved graph/profile/report artifacts from the local claude_code source snapshot
Fact-Checking
- Known bugs, regressions, framework/compiler/runtime footguns, and version-specific crash or workaround guidance must be verified against current primary web sources before being treated as current fact.
- Agent definition field semantics come from the Claude Code source (
BaseAgentDefinition type in `loadA
…(truncated)
1---2name: ai-coding-agents3description: Creates coding agents on Claude Code, Codex, and Agent SDK. Use when defining review, test, refactor, or team agents — not building a runtime.4---5
6# AI Coding Agents — Creation Hub
7
8Use this skill to go from a coding agent idea to a working agent definition, whether a single-purpose agent or a coordinated multi-agent coding team.
9
10This skill owns the coding-domain-specific creation workflow, templates, and patterns. For agent architecture decisions and build-vs-not gates, start with [`../ai-agents/SKILL.md`](../ai-agents/SKILL.md).
11
12## Two Different Tracks
13
14This skill (and its siblings prefixed `ai-coding-agents-*`) split into two tracks with different audiences. Pick the right one before going deeper.
15
16**Track A — Create an agent on an existing platform (this skill).**
17Use this umbrella when the platform exists (Claude Code, Codex, or Agent SDK) and you need to define an agent on top of it: frontmatter, tools, archetype, multi-agent coordination. This is the common case.
18
19**Track B — Build a coding-agent runtime from scratch (the 14 sibling skills).**
20Use the dedicated curriculum when you are building the runtime itself — the thing that loads agents, sandboxes execution, routes tool calls, manages sessions. Each skill captures known traps, patterns, and anti-patterns for one subsystem:
21
22| Concern | Skills |
23|---------|--------|
24| Runtime architecture | [`ai-coding-agents-command-runtime`](../ai-coding-agents-command-runtime/SKILL.md), [`ai-coding-agents-provider-runtime`](../ai-coding-agents-provider-runtime/SKILL.md), [`ai-coding-agents-terminal-ui`](../ai-coding-agents-terminal-ui/SKILL.md) |
25| Execution & safety | [`ai-coding-agents-execution-sandbox`](../ai-coding-agents-execution-sandbox/SKILL.md), [`ai-coding-agents-permissions`](../ai-coding-agents-permissions/SKILL.md), [`ai-coding-agents-settings-policy`](../ai-coding-agents-settings-policy/SKILL.md) |
26| State & lifecycle | [`ai-coding-agents-sessions`](../ai-coding-agents-sessions/SKILL.md), [`ai-coding-agents-tasks`](../ai-coding-agents-tasks/SKILL.md), [`ai-coding-agents-remote-runtime`](../ai-coding-agents-remote-runtime/SKILL.md) |
27| Extensibility | [`ai-coding-agents-plugins`](../ai-coding-agents-plugins/SKILL.md), [`ai-coding-agents-tools`](../ai-coding-agents-tools/SKILL.md) |
28| Delivery | [`ai-coding-agents-release-distribution`](../ai-coding-agents-release-distribution/SKILL.md), [`ai-coding-agents-observability-evals`](../ai-coding-agents-observability-evals/SKILL.md) |
29
30If the request is "how do I add a slash command to my runtime?" or "how should I design approval prompts?", route to Track B. If it's "how do I define a code-review agent on Claude Code?", stay here.
31
32## ASCII Flow
33
34```text
35user need
36 |
37 v
38classify: define agent on existing platform OR build runtime subsystem
39 |
40 +--> existing platform
41 | -> choose platform: Claude Code | Codex | Agent SDK
42 | -> choose archetype or team pattern
43 | -> scope tools + context + verification
44 | -> smoke test on representative coding tasks
45 |
46 +--> runtime subsystem
47 -> route to ai-coding-agents-* sibling skill
48 -> design subsystem contract + invariants + failure modes
49 -> validate with host/runtime-specific tests
50```
51
52## Quick Reference
53
54| Question | Read | Outcome |
55|----------|------|---------|
56| How do I create a coding agent end-to-end? | [`references/creation-workflow.md`](references/creation-workflow.md) | Step-by-step from idea to running agent |
57| Which platform should I target? | [`references/platform-patterns.md`](references/platform-patterns.md) | Decision tree: `.md` vs `.toml` vs SDK |
58| What single-agent archetypes exist? | [`references/agent-archetypes.md`](references/agent-archetypes.md) | Six patterns with frontmatter and tools |
59| When should I use a multi-agent team? | [`references/multi-agent-coding-patterns.md`](references/multi-agent-coding-patterns.md) | Three architectures: coordinator, fork, swarm |
60| How do I manage context for code-heavy work? | [`references/context-management.md`](references/context-management.md) | Token budgets, file selection, progressive disclosure |
61| How do I wrap dev tools for agents? | [`references/tool-integration.md`](references/tool-integration.md) | Linter, formatter, test runner, type checker patterns |
62| My agent is broken | [`references/debugging-guide.md`](references/debugging-guide.md) | Failure taxonomy and fixes |
63| What do production coding agents look like? | [`references/production-patterns.md`](references/production-patterns.md) | Real patterns from Claude Code source |
64| How does Claude Code define and validate agents? | [`references/claude-code-agent-runtime-patterns.md`](references/claude-code-agent-runtime-patterns.md) | File format, validation, and persistence rules |
65| How do swarms, teammates, and worktrees behave? | [`references/claude-code-swarm-and-worktree-patterns.md`](references/claude-code-swarm-and-worktree-patterns.md) | Team files, inherited flags, worktree lifecycle |
66| How are skills and built-in plugins loaded? | [`references/claude-code-skill-and-plugin-loading.md`](references/claude-code-skill-and-plugin-loading.md) | Frontmatter loading, plugin-backed skills, prompt budgets |
67| Which prompt recipes steer a Claude Code session to a specific outcome? | [`references/claude-code-prompt-recipes.md`](references/claude-code-prompt-recipes.md) | 35 named recipes covering setup, planning, execution, review, debug/recovery, and session economics |
68| Should I route a coding task to a cheap or premium model? | [`references/multi-model-routing-economics.md`](references/multi-model-routing-economics.md) | 85/15 routing pattern, cost/context tradeoffs — re-verify live numbers before costing |
69
70## When To Use
71
72- Create a new coding agent from scratch on any supported platform
73- Choose the right archetype for a coding task (review, test generation, refactoring, migration, docs, security)
74- Design a multi-agent team for complex coding tasks (parallel reviews, bug investigation, migration fleets)
75- Design context loading strategy for agents working with large codebases
76- Wrap existing dev tools (linters, formatters, test runners, type checkers) for agent use
77- Debug a coding agent producing poor results, hallucinated files, or scope creep
78- Port a coding agent between platforms (Claude Code ↔ Codex ↔ Agent SDK)
79
80## Use Other Skills
81
82| Need | Use Instead |
83|------|-------------|
84| Agent architecture decisions, build-vs-not | [`../ai-agents/SKILL.md`](../ai-agents/SKILL.md) |
85| Subagent frontmatter, delegation contracts | `agents-subagents` — current fields include `name`, `description`, `model` (alias `fable` valid), `effort`, `maxTurns`, `tools`, `disallowedTools`, `skills`, `memory`, `initialPrompt`, `background`, `isolation` (`worktree` only value), `color`; `permissionMode` field noted but `auto` value and plugin-subagent restrictions apply — see [`../ai-coding-agents-permissions/SKILL.md`](../ai-coding-agents-permissions/SKILL.md); `Agent(type)` tool-scoping syntax gates spawnable subagent types |
86| MCP server setup and integration | [`../agents-mcp/SKILL.md`](../agents-mcp/SKILL.md) |
87| Hook guardrails and lifecycle events | [`../agents-hooks/SKILL.md`](../agents-hooks/SKILL.md) |
88| Skill packaging and SKILL.md conventions | [`../agents-skills/SKILL.md`](../agents-skills/SKILL.md) |
89| Generic multi-agent orchestration, wave dispatch | [`../agents-swarm-orchestration/SKILL.md`](../agents-swarm-orchestration/SKILL.md) |
90| AGENTS.md (Codex-originated convention) and CLAUDE.md (Claude Code equivalent) configuration | [`../agents-memory/SKILL.md`](../agents-memory/SKILL.md) |
91| Slash-command runtime architecture for coding-agent CLIs | [`../ai-coding-agents-command-runtime/SKILL.md`](../ai-coding-agents-command-runtime/SKILL.md) |
92| Trace, replay, regression evals, and cost accounting | [`../ai-coding-agents-observability-evals/SKILL.md`](../ai-coding-agents-observability-evals/SKILL.md) |
93| Plugin and extension architecture for coding agents | [`../ai-coding-agents-plugins/SKILL.md`](../ai-coding-agents-plugins/SKILL.md) |
94| Tool approvals, allow/ask/deny rules, and permission routing | [`../ai-coding-agents-permissions/SKILL.md`](../ai-coding-agents-permissions/SKILL.md) |
95| Model-provider abstraction, streaming normalization, and fallback routing | [`../ai-coding-agents-provider-runtime/SKILL.md`](../ai-coding-agents-provider-runtime/SKILL.md) |
96| Packaging, update channels, cache migrations, and plugin compatibility | [`../ai-coding-agents-release-distribution/SKILL.md`](../ai-coding-agents-release-distribution/SKILL.md) |
97| Session lifecycle, resume, rewind, and transcript restoration | [`../ai-coding-agents-sessions/SKILL.md`](../ai-coding-agents-sessions/SKILL.md) |
98| Local UI plus remote execution architecture | [`../ai-coding-agents-remote-runtime/SKILL.md`](../ai-coding-agents-remote-runtime/SKILL.md) |
99| Process isolation, filesystem policy, network controls, and destructive-command boundaries | [`../ai-coding-agents-execution-sandbox/SKILL.md`](../ai-coding-agents-execution-sandbox/SKILL.md) |
100| Settings precedence, managed policy, and runtime config reload | [`../ai-coding-agents-settings-policy/SKILL.md`](../ai-coding-agents-settings-policy/SKILL.md) |
101| Terminal-first REPL and coding-agent interaction design | [`../ai-coding-agents-terminal-ui/SKILL.md`](../ai-coding-agents-terminal-ui/SKILL.md) |
102| Background task runtimes, teammate queues, and task ownership | [`../ai-coding-agents-tasks/SKILL.md`](../ai-coding-agents-tasks/SKILL.md) |
103| Tool registry, tool search, and tool execution architecture | [`../ai-coding-agents-tools/SKILL.md`](../ai-coding-agents-tools/SKILL.md) |
104| Testing coding agents (evals, regression) | [`../qa-agent-testing/SKILL.md`](../qa-agent-testing/SKILL.md) |
105| Context loading strategies (generic) | [`../dev-context-engineering/SKILL.md`](../dev-context-engineering/SKILL.md) |
106| Measuring coding agent ROI | [`../dev-ai-coding-metrics/SKILL.md`](../dev-ai-coding-metrics/SKILL.md) |
107| Claude API and Agent SDK reference | claude-api skill |
108
109## Default Workflow
110
1111. **Classify the task**: What code does the agent touch? What tools does it need? What is the output?
1122. **Single agent or team?** One bounded task → single agent. Multiple interdependent tasks, parallel reviews, or complex investigation → multi-agent team.
1133. **Pick the archetype** closest to your need from the [archetypes](#single-agent-archetype-index) or [multi-agent patterns](#multi-agent-pattern-index).
1144. **Choose the platform**: Claude Code `.md` for repo-level agents, Codex `.toml` for Codex workflows, Agent SDK for programmatic integration.
1155. **Start from the matching template** in [`assets/templates/`](assets/templates/).
1166. **Scope tools** to the minimum needed. Read-only agents get Read, Grep, Glob. Edit agents add Edit, Write, Bash.
1177. **Design the context strategy**: What files does the agent need? How does it discover them? What is the token budget?
1188. **Add verification**: How does the agent check its own work? For teams: assign a separate verifier.
1199. **Smoke test**: Run on 3+ representative tasks before deploying.
12010. **Test extension robustness**: For edit, refactor, and migration agents, run at least one evolving-spec sequence with 3+ checkpoints. Start each checkpoint in a fresh conversation/context, carry forward the same agent-created workspace, and retain all prior regression tests.
12111. **Iterate**: Observe real behavior, tighten scope, improve prompts.
122
123## Known Traps
124
125- giving a coding agent repo-wide edit authority before the owned files and verification surface are clear
126- asking the same agent to implement, review, and approve its own high-risk changes
127- inheriting parent context blindly across phases instead of re-briefing from current repo truth
128- building a multi-agent coding team before the task graph, file ownership, and merge plan exist
129- assuming Claude Code, Codex, and SDK workers expose equivalent tools, hooks, and approval semantics
130- treating one-shot green tests, a plan-first prompt, or an anti-slop prompt as evidence that edit-capable agents remain extensible over repeated changes
131
132## Common Anti-Patterns
133
134- "full-stack fixer" agents with no bounded artifact, path, or runtime scope
135- tool wrappers that hide destructive commands behind vague natural-language instructions
136- edit-capable workers launched in parallel on the same branch with no ownership contract
137- context strategies that preload too much code instead of progressive disclosure and file selection
138- smoke tests skipped because the prompt "looks right"
139
140## OpenAI Internal Practice (Codex, 2026-05)
141
142Source: [*How OpenAI uses Codex*](https://cdn.openai.com/pdf/6a2631dc-783e-479b-b1a4-af0cfbd38630/how-openai-uses-codex.pdf), May 2026 — internal-usage report across Security, Product, Frontend, API, Infrastructure, and Performance Engineering teams. These patterns are validated by daily use inside OpenAI; cite this source rather than restating as your own observations.
143
144### Two-stage Ask → Code flow for non-trivial changes
145
146- **Pattern:** for any change above the trivial single-file fix, run Ask Mode first to produce an implementation plan. Then switch to Code Mode and feed the plan as input to follow-up prompts.
147- **Why:** keeps the agent grounded; the plan becomes a self-correction surface — if the plan is wrong, the human catches it before generation rather than after.
148- **Anti-pattern:** going straight to Code Mode for a multi-file change. The agent will improvise structure that the human then has to reverse-engineer at review time.
149- **Recipe:** *"Plan the implementation for X. Do not write code yet."* → review plan → *"Execute the plan above, file by file."*
150
151### Environment-as-prompt (compoundable)
152
153- **Pattern:** treat the agent's runtime environment — startup script, env vars, internet access — as part of the persistent prompt. Iterate on env config every time a build error appears and ask whether the env should have prevented it.
154- **Why:** env improvements compound. A startup script that installs the right toolchain once removes a category of errors from every future task in the repo.
155- **Anti-pattern:** treating env failures as one-off prompt fixes. The agent re-discovers the same gap on every new task.
156- **Recipe:** maintain a single `setup.sh` (or equivalent) that the agent runs at session start; add to it when a class of build error recurs.
157
158### Prompt-as-GitHub-Issue
159
160- **Pattern:** structure prompts the way you would write a PR description or issue — file paths, component names, diffs, doc snippets, and "implement this the same way it's done in [module X]" anchors.
161- **Why:** the model already responds well to PR/issue-shaped text from training distribution; this is free signal that doesn't require new tooling.
162- **Anti-pattern:** chat-shaped prompts ("can you change the auth flow?") that omit the repo coordinates the agent needs to act precisely.
163
164### Task queue as lightweight backlog
165
166- **Pattern:** fire off tangential ideas, partial work, or incidental fixes as separate Codex tasks rather than holding them in human working memory. The queue *is* the backlog; no obligation to produce a full PR per task.
167- **Why:** captures drive-by fixes without forcing context switches; staging area mirrors the engineer's working set.
168- **Where this lives in this skill:** see [`../ai-coding-agents-tasks/SKILL.md`](../ai-coding-agents-tasks/SKILL.md) for the task-runtime detail and the sizing heuristic (~1 hour of human work / a few hundred LOC).
169
170### Best-of-N as a generation primitive
171
172- **Pattern:** generate N parallel solutions for a single task and either pick the best or combine parts of multiple outputs.
173- **Why:** for ambiguous or open-ended tasks, the cheapest quality-improving move is variance, not better prompting.
174- **Anti-pattern:** running Best-of-N on tasks with one obviously correct shape (mechanical refactors, type fixes). Wasted compute; pick prompt engineering instead.
175- **Vendor scope:** Codex-specific feature surface. The equivalent on other runtimes is parallel subagent dispatch — see [`../agents-swarm-orchestration/SKILL.md`](../agents-swarm-orchestration/SKILL.md).
176
177## Platform Decision Tree
178
179| Scenario | Platform | Why |
180|----------|----------|-----|
181| Repo-team agent, auto-delegated by description | Claude Code `.md` | Description-driven routing, shared via `.claude/agents/` |
182| Codex thread workers | Codex `.toml` | Explicit spawning, sandbox-mode scoped |
183| Codex as tool inside an editor or AI orchestrator | `codex mcp-server` (stdio) | Codex acts as an MCP server; editor drives it over MCP wire protocol |
184| Non-interactive code review in CI | `codex review` subcommand | Headless, no terminal UI; structured output for pipelines |
185| Programmatic, CI, or API integration | Agent SDK | Full control, custom tools, hook callbacks |
186| Quick prototype | Claude Code `.md` | Fastest path to working agent |
187| Multi-agent coordinator team | Claude Code `.md` | Native coordinator mode, fork, and team support |
188| Custom orchestration logic | Agent SDK | Programmatic control over spawning, routing, results |
189| Local-first OSS coding agent, editor-integrated via ACP (Zed, JetBrains, IntelliJ) | Goose (Rust) + recipe YAML | ACP server mode; 70+ MCP extensions; custom-distros; Apache-2.0 |
190| Enterprise white-label coding agent with pinned providers and extensions | Goose Custom Distribution | Distro manifest baked into the binary; supply-chain gates (`deny.toml`); AAIF/LF governance |
191| GitHub-centric repo, lightweight PR-aware agent, no multi-agent need | GitHub Copilot CLI custom agent (`.agent.md`) | Pre-wired GitHub MCP server, PR-scoped agent versioning; see Copilot CLI section below for its ceiling |
192
193See [`references/platform-patterns.md`](references/platform-patterns.md) for side-by-side comparison and porting guide.
194
195### Goose as a fourth platform (2026)
196
197Goose (github.com/aaif-goose/goose, formerly github.com/block/goose) is a 50k+-star Rust-based OSS coding agent donated by Block to the Agentic AI Foundation (AAIF) under the Linux Foundation. It is a meaningfully different platform from Claude Code / Codex / Agent SDK:
198
199- **Protocols:** first-class MCP *and* ACP. Goose runs as an ACP server (`goose acp`) so editors drive it over stdio; Goose can also delegate to external ACP agents (Claude Code, Codex) as providers.
200- **Unit of work:** a **recipe** — YAML with `version / title / description / instructions / extensions / activities / prompt / parameters`. Recipes are portable, statically validated, and declare their extension dependencies inline.
201- **Distribution:** supports custom distros (white-label, pinned providers/extensions, branded binaries) as a first-class shipping class.
202- **Project hints:** uses `.goosehints` alongside `AGENTS.md` — one more member of the narrative-hint family (see `../agents-memory/SKILL.md`).
203
204Treat it as the target when a coding agent must be OSS, editor-embedded, locally-operated, or enterprise-forkable. Detailed patterns live in the subsystem skills under "Cross-Platform Patterns (Goose)" sections — most relevantly in `ai-coding-agents-provider-runtime` (toolshim, agent-as-provider), `ai-coding-agents-remote-runtime` (ACP stdio, daemon+OpenAPI), `ai-coding-agents-tasks` (recipes as typed blueprints), and `ai-coding-agents-release-distribution` (custom distros).
205
206### GitHub Copilot CLI — a fifth, lighter-weight platform (revised 2026)
207
208GitHub Copilot CLI outgrew its "explains shell commands" origin during 2026. It now defines **custom agents** as Markdown files with YAML frontmatter (`.agent.md`, resolvable at repo or org scope), supports a **plugin system** (`/plugin install owner/repo`) that bundles MCP servers, agents, skills, and hooks, and ships with the GitHub MCP server pre-wired plus built-in `Explore` and `Task` agents. This makes Track A (define an agent on an existing platform) applicable to Copilot CLI in a way it was not a year earlier — treat the earlier "not a coding-agent platform" framing as retired.
209
210**Frontmatter shape:** `description` (required), `name`, `target` (`vscode` | `github-copilot`), `tools` (omit or `["*"]` for all; empty list disables all; MCP tools namespaced as `server-name/tool-name`), `model`, `disable-model-invocation`, `user-invocable`. Body is Markdown instructions, capped at 30,000 characters. Versioning rides on git commit SHAs rather than a semantic `version` field.
211
212**Where it still falls short of Track B territory:** no native multi-agent orchestration (agents can invoke each other via an `agent` tool alias, but there is no coordinator/fork/team primitive), no formal session-resume or task-graph model, and no sandbox-mode equivalent to Codex's `workspace-write` / `read-only` / `network-off`. Do not port a coordinator-led team or peer-swarm design onto it — the primitives that make those patterns safe (worktree isolation, mailbox protocol, owned-files enforcement) are absent.
213
214**When to prefer Copilot CLI:** a GitHub-centric repo where a lightweight, PR-aware custom agent is enough — GitHub MCP tools and PR-scoped agent versioning are first-class — and you do not need multi-agent coordination or fine-grained sandbox modes. Prefer Claude Code or Codex when the task needs a coordinator/team pattern, worktree isolation, or a documented permission-mode ladder. Verify current field names and limits against `docs.github.com/en/copilot` before depending on specifics — this surface is still moving faster than the rest of the platform list. Use [`scripts/smoke_test.sh`](scripts/smoke_test.sh) to validate that your primary coding-agent setup (Claude Code, Codex, or Agent SDK) is healthy independent of which platform you pick for a given repo.
215
216## Single Agent Archetype Index
217
218| Archetype | Core Tools | maxTurns | Key Constraint | Template |
219|-----------|-----------|----------|----------------|----------|
220| Code Reviewer | Read, Grep, Glob, Bash | 8 | Read-only, findings-first output | [`code-reviewer.md`](assets/templates/code-reviewer.md) |
221| Test Generator | Read, Write, Edit, Bash, Grep | 15 | Must run generated tests | [`test-generator.md`](assets/templates/test-generator.md) |
222| Refactoring Agent | Read, Edit, Bash, Grep, Glob | 20 | Preserve behavior, run existing tests | [`refactoring-agent.md`](assets/templates/refactoring-agent.md) |
223| Migration Agent | Read, Write, Edit, Bash, Grep, Glob | 25 | Pattern-at-a-time, checkpoint between batches | [`migration-agent.md`](assets/templates/migration-agent.md) |
224| Documentation Agent | Read, Write, Grep, Glob | 12 | Source-anchored, no invented APIs | Universal template |
225| Security Scanner | Read, Grep, Glob, Bash | 10 | Read-only, severity-ordered output | [`security-scanner.md`](assets/templates/security-scanner.md) |
226
227Each archetype is detailed in [`references/agent-archetypes.md`](references/agent-archetypes.md) with full frontmatter, system prompt structure, and failure modes.
228
229## Multi-Agent Pattern Index
230
231| Pattern | Communication | Isolation | Best For | Template |
232|---------|--------------|-----------|----------|----------|
233| Coordinator-Led Team | `<task-notification>` XML | Workers in background | Research → implement → verify loops | [`coordinator-coding-team.md`](assets/templates/coordinator-coding-team.md) |
234| Fork Subagents | Implicit (context inherited) | Shared prompt cache | Parallel background exploration | See fork guidance below |
235| Agent Teams (Peer Swarm) | Mailbox messaging (SendMessage) | Git worktrees per teammate | Self-coordinating specialists | [`swarm-investigation.md`](assets/templates/swarm-investigation.md) |
236| Background Agents | Daemon-supervised processes; `claude --bg`, `/bg`, `claude agents` dashboard | Git worktree per session (auto-created under `.claude/worktrees/`) | Long-running parallel tasks, tasks dispatched and monitored without keeping a terminal open | See background agent guidance below |
237| ACP-Delegated Subagent | ACP stdio (line-delimited JSON) | Separate process; approvals round-trip through orchestrator | Cross-platform delegation (Goose → Claude Code, Goose → Codex, etc.) | See ACP delegation note below |
238
239### When to use which pattern
240
241**Coordinator-Led Team** — You want a single leader that synthesizes findings and directs workers. Workers run in background, report via notifications. The coordinator retains full understanding and authority. Best for structured multi-phase workflows: parallel research → coordinator synthesis → directed implementation → independent verification.
242
243**Fork Subagents** — You want cheap parallel background work that inherits your current context. Forks share the parent's prompt cache (fast, low cost). The parent doesn't see intermediate work — only the final report. Best for: "search these 5 modules in parallel while I continue thinking."
244
245**Agent Teams (Peer Swarm)** — You want teammates that communicate directly with each other via mailboxes. Each teammate has its own worktree for isolation. They share a task list and can self-coordinate without the lead directing every step. Best for: complex investigations where specialists need to discuss findings, large-scale migrations with many independent workers.
246
247**Background Agents** — You want to dispatch tasks that run without a terminal attached and resume at any time. Start with `claude --bg "<task>"` from the shell, `/bg` inside a session, or the dispatch input in `claude agents`. The daemon supervisor keeps sessions alive; each session gets an isolated git worktree under `.claude/worktrees/`. Monitor all sessions in the `claude agents` dashboard (grouped by Needs input / Working / Completed); peek without attaching via Space; use `claude agents --json` to list sessions in CI. Session state lives under `~/.claude/jobs/<id>/state.json`; the roster is at `~/.claude/daemon/roster.json`. Disable with the `disableAgentView` managed setting or `CLAUDE_CODE_DISABLE_AGENT_VIEW` env var. Best for: long parallel tasks, tasks that outlive your terminal session, fleet-style coding work. Source: `code.claude.com/docs/en/agent-view` and `claude.com/blog/agent-view-in-claude-code`.
248
249**ACP-Delegated Subagent** — You want one coding agent to spawn another coding agent over the **Agent Client Protocol** (stdio) and treat the delegated agent as either a turn-scoped provider or a session-scoped subagent. The orchestrator retains approval authority; approvals raised by the delegated agent round-trip back through ACP. Best for: cross-platform delegation (Goose orchestrating Claude Code; Claude Code delegating a specialist Codex session), heterogeneous teams where different agents have different provider access, and keeping a single approval surface across multi-agent work. The provider-side framing lives in `../ai-coding-agents-provider-runtime/SKILL.md` (agent-as-provider); the remote-runtime framing lives in `../ai-coding-agents-remote-runtime/SKILL.md` (ACP stdio transport, agent-delegating mode).
250
251See [`references/multi-agent-coding-patterns.md`](references/multi-agent-coding-patterns.md) for full architecture details, coding workflows, and anti-patterns.
252
253### Multi-agent principles (from Claude Code source)
254
255These apply across all patterns:
256
2571. **Never delegate understanding.** The coordinator/lead must synthesize findings before directing implementation. Never write "based on your findings, fix it" — include file paths, line numbers, exact changes.
2582. **Freeze interfaces before dispatch.** Define contracts, owned files, and expected outputs before launching workers.
2593. **Give every worker exclusive owned_files.** Prevents merge conflicts in parallel edit scenarios.
2604. **Use separate verifiers.** Never let an agent verify its own work. Spawn a fresh worker with adversarial posture.
2615. **Spawn fresh at phase boundaries.** Exploration → implementation is a context rotation point. Don't reuse a research worker for implementation — spawn fresh with synthesized specs.
2626. **Persist state in files.** Task graphs, decisions, and dependency outputs go in JSON/YAML/Markdown files, not just conversation memory.
2637. **Escalation, not retry.** Worker self-corrects once → escalates to lead → lead diagnoses and reassigns → human if still stuck.
2648. **Background is the default now — plan around notifications, not blocking.** As of Claude Code v2.1.198, every `Agent` spawn (named or fork) defaults to background execution; Claude only runs a subagent in the foreground when it needs the result immediately. Don't add `background: true` out of habit — it's the resting state. What still matters: background workers surface their own permission prompts in the main session (since v2.1.186), so a worker needing an approval does not silently stall — expect and handle that interruption in the workflow, not just the happy path.
2659. **Nesting is allowed to depth 5 — that's a ceiling, not a target.** Since v2.1.172, subagents (including forks, which count toward the cap since v2.1.187) can spawn their own subagents up to 5 levels below the main conversation; a depth-5 agent loses Agent-tool access entirely. Treat this the way you'd treat recursion depth in code: technically available doesn't mean advisable. Each level compounds cost and loses synthesis fidelity — a depth-3 worker's "findings" have already been summarized twice before the lead sees them. Default to flat coordinator/fork/team patterns (depth 1-2) and only reach for deeper nesting when a sub-problem is itself decomposable into independent, boundable sub-tasks — not as a way to avoid writing a clear brief.
266
267## Context Management Essentials
268
269Coding agents consume context differently from general agents because code files are large and interdependent.
270
271**Token budget model**: Split the context window into three buckets:
272- **Instructions** (~15-20%): System prompt, skill content, agent rules
273- **Code** (~50-60%): File contents the agent reads during work
274- **Output** (~20-30%): The agent's reasoning, tool calls, and generated code
275
276**File selection strategy**:
277- **Known paths**: Use Read directly when you know which file to examine
278- **Discovery**: Use Grep/Glob first to find relevant files, then Read targeted sections
279- **Progressive disclosure**: Start with directory structure (ls), then key files (package.json, tsconfig), then specific code
280
281**The explore-then-act pattern** (from Claude Code's built-in architecture): Separate read-only exploration from editing. The Explore agent uses a strict read-only constraint with parallel tool calls for speed. After exploration, a fresh agent receives synthesized findings and makes focused edits.
282
283**When to split into subagents**: If the task touches more than 5-10 files across different modules, or the agent starts losing track of earlier context, split into focused subagents with clear file ownership.
284
285**Skill-subagent context isolation**: Skills and subagents can reference each other bidirectionally. A subagent can preload skills via the `skills:` field (role with baked-in domain knowledge), or a skill can delegate to a subagent via `context: fork` (task isolation without a full agent file). See `agents-subagents` for the full pattern and decision table.
286
287See [`references/context-management.md`](references/context-management.md) for detailed strategies including multi-agent context management.
288
289## Templates and Entry Points
290
291### Single Agent Templates
292
293| Template | Use Case |
294|----------|----------|
295| [`claude-code-agent.md`](assets/templates/claude-code-agent.md) | Universal Claude Code coding agent starting point |
296| [`code-reviewer.md`](assets/templates/code-reviewer.md) | Read-only code review with severity-ordered findings |
297| [`test-generator.md`](assets/templates/test-generator.md) | Test creation with self-validation |
298| [`refactoring-agent.md`](assets/templates/refactoring-agent.md) | Behavior-preserving structural changes |
299| [`migration-agent.md`](assets/templates/migration-agent.md) | Batch pattern transformation with checkpoints |
300| [`security-scanner.md`](assets/templates/security-scanner.md) | Security analysis with evidence-based findings |
301
302### Multi-Agent Templates
303
304| Template | Use Case |
305|----------|----------|
306| [`coordinator-coding-team.md`](assets/templates/coordinator-coding-team.md) | Leader-directed research → implement → verify team |
307| [`swarm-investigation.md`](assets/templates/swarm-investigation.md) | Peer-coordinated bug investigation with specialists |
308| [`parallel-review-team.md`](assets/templates/parallel-review-team.md) | Parallel code review with security, performance, and style specialists |
309
310### Cross-Platform Templates
311
312| Template | Use Case |
313|----------|----------|
314| [`codex-agent.toml`](assets/templates/codex-agent.toml) | Codex custom agent definition |
315| [`sdk-agent-py.py`](assets/templates/sdk-agent-py.py) | Python Agent SDK scaffolding with custom tools |
316| [`sdk-agent-ts.ts`](assets/templates/sdk-agent-ts.ts) | TypeScript Agent SDK scaffolding |
317
318### Checklists
319
320| Checklist | Use Case |
321|-----------|----------|
322| [`agent-design-checklist.md`](assets/checklists/agent-design-checklist.md) | Pre-creation validation for single agents |
323| [`multi-agent-checklist.md`](assets/checklists/multi-agent-checklist.md) | Pre-dispatch validation for coding teams |
324| [`production-readiness.md`](assets/checklists/production-readiness.md) | Deployment readiness gate |
325
326### Recommended Build Order
327
328For a new CLI coding-agent runtime, implement subsystems in this order:
329
3301. settings and policy layering
3312. command registry and lazy command loading
3323. provider abstraction, streaming normalization, and context-window policy
3334. execution sandbox, workspace mounts, network policy, and destructive-command guards
3345. tool contract, built-in enumeration, and tool-pool assembly
3356. permission context and approval routing
3367. central tool-execution pipeline
3378. session persistence, history, and resume
3389. remote transport and permission bridging
33910. task runtime and teammate orchestration
34011. terminal UI, background-task surfaces, and virtualization
34112. plugin loading, versioned cache, and managed extension policy
34213. observability, replay, regression evals, and release gates
34314. packaging, update channels, migrations, and distribution
344
345Why this order:
346
347- earlier layers define the contracts later layers consume
348- permission and session flows are hard to retrofit once tools and UI exist
349- remote runtime, tasks, and terminal UI depend on stable command, tool, and settings semantics
350- plugins should land after the host runtime has clear ownership of precedence and trust boundaries
351
352## Core Runtime Spine
353
354Treat a serious coding-agent runtime as a fixed spine of cooperating subsystems, not as one prompt plus a tool runner.
355
3561. settings and policy define what the runtime is allowed to do
3572. command runtime defines how users and the host invoke higher-level actions
3583. provider runtime defines how model traffic is normalized and recovered
3594. execution sandbox defines the real security envelope
3605. tools define callable capabilities and execution stages
3616. permissions decide when risky actions are allowed
3627. sessions decide what state survives and resumes
3638. remote runtime bridges local UI to remote execution when needed
3649. tasks represent long-running and delegated work
36510. terminal UI renders and controls runtime state without owning it
36611. plugins extend the host through controlled capability points and layered refresh
36712. observability and evals close the feedback loop
36813. release and distribution keep upgrades, caches, and compatibility survivable
369
370If one of these is missing, the usual outcome is not “slightly worse UX.” The usual outcome is hidden fragility that appears under reconnects, long sessions, remote control, worker delegation, or upgrades.
371
372### Cross-platform validation (2026)
373
374The spine above is rebuilt-and-verified against the Claude Code lineage and, as of 2026-04, cross-checked against Goose (Rust, MCP+ACP, OSS under AAIF/Linux Foundation). Patterns that only appeared in the Claude Code snapshot but missed in Goose have been imported into the subsystem skills as "Cross-Platform Patterns (Goose)" sections. When designing a new runtime, read the Claude-Code-derived core *and* the Goose additions in each subsystem skill before committing to an architecture.
375
376## Core Invariants
377
378- one host-owned state model per subsystem
379- typed contracts between subsystems instead of implicit shared assumptions
380- cache invalidation is explicit and event-driven, not "restart and hope"
381- recovery behavior classified by failure family, not generic retry loops
382- approvals and sandboxing treated as runtime architecture, not prompt wording
383- resume, remote control, and background work designed before polish layers
384- telemetry keeps causal order and low-cardinality dimensions
385- observability able to explain why the runtime did what it did
386
387## Common False Shortcuts
388
389- building the agent as “LLM + tools + prompt” with no subsystem boundaries
390- adding permissions before sandboxing or vice versa and pretending they are interchangeable
391- bolting on session resume after tools, UI, and remote flows already exist
392- treating remote execution as “the same session over the network”
393- memoizing discovery and registry state with no invalidation plan
394- shipping plugins before the host owns precedence, trust, and cache policy
395- letting cache identity ignore install context, path, or versioned state
396- adding evals only after incidents instead of using them as a design constraint
397- assuming a good local prototype will survive upgrades, worktrees, and delegation unchanged
398
399## Navigation
400
401### References
402- [`references/creation-workflow.md`](references/creation-workflow.md) — End-to-end creation guide
403- [`references/platform-patterns.md`](references/platform-patterns.md) — Claude Code vs Codex vs Agent SDK
404- [`references/agent-archetypes.md`](references/agent-archetypes.md) — Six single-agent coding patterns
405- [`references/multi-agent-coding-patterns.md`](references/multi-agent-coding-patterns.md) — Three multi-agent architectures
406- [`references/context-management.md`](references/context-management.md) — Token budgets and file strategies
407- [`references/tool-integration.md`](references/tool-integration.md) — Dev tool wrapping patterns
408- [`references/debugging-guide.md`](references/debugging-guide.md) — Failure taxonomy and fixes
409- [`references/production-patterns.md`](references/production-patterns.md) — Real patterns from Claude Code source
410- [`references/claude-code-agent-runtime-patterns.md`](references/claude-code-agent-runtime-patterns.md) — Agent file shape, validation, and persistence
411- [`references/claude-code-swarm-and-worktree-patterns.md`](references/claude-code-swarm-and-worktree-patterns.md) — Team files, teammate spawn inheritance, and worktree rules
412- [`references/claude-code-skill-and-plugin-loading.md`](references/claude-code-skill-and-plugin-loading.md) — Skill frontmatter loading and built-in plugin behavior
413- [`references/claude-code-prompt-recipes.md`](references/claude-code-prompt-recipes.md) — Named prompt recipes for setup, planning, execution, review, and debug/recovery
414- [`references/multi-model-routing-economics.md`](references/multi-model-routing-economics.md) — Cheap-vs-premium routing pattern and CLI/MCP operational surfaces (time-decaying numbers — re-verify before costing)
415
416### Assets
417- [`assets/templates/`](assets/templates/) — Agent definition and team templates
418- [`assets/checklists/`](assets/checklists/) — Design, dispatch, and deployment checklists
419
420### Data
421- [`data/sources.json`](data/sources.json) — Primary documentation and research references
422- [`data/claude-code/`](data/claude-code/) — Moved graph/profile/report artifacts from the local `claude_code` source snapshot
423
424## Fact-Checking
425
426- Known bugs, regressions, framework/compiler/runtime footguns, and version-specific crash or workaround guidance must be verified against current primary web sources before being treated as current fact.
427- Agent definition field semantics come from the Claude Code source (`BaseAgentDefinition` type in `loadA
428
429…(truncated)