claude-code-orchestra
AGENTS.md199 starsChanged 2 months agoMITView on GitHub
Every CLI agent loads this file automatically from the repository root, and Claude Code reads it directly because no CLAUDE.md sits beside it. It is the single root contract for both roles. The main-agent sections come first -- mission, routing policy, skill catalog, quality gates -- followed by the contract for CLI executors such as Codex, Antigravity, Grok, and opencode: response structure, handoff rules, how to call another CLI as a subagent, and the completion-verification guardrails. Those cross-CLI invocation rules…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,542 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository17 other files it gives its agents.
- .agents/AGENTS.mdAGENTS.md
- .codex/AGENTS.mdAGENTS.md
- catchupSkill
- checkpointingSkill
- codex-systemSkill
- context-loaderSkill
- design-trackerSkill
- featureSkill
- initSkill
- planSkill
- research-libSkill
- simplifySkill
- spikeSkill
- tddSkill
- team-executeSkill
- troubleshootSkill
- update-lib-docsSkill
The file
We split this AGENTS.md into the rules it gives an agent
11 rules. About 0 are common, 7 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 3
Every CLI agent loads this file automatically from the repository root, and Claude Code reads it directly because no CLAUDE.md sits beside …
- Very specific: line 93
Use the canonical workflows in .claude/skills/:
- Very specific: line 95
Always start with context-loader.
- Distinctive: line 134
Follow existing conventions.
- Distinctive: line 137
Run relevant executable checks and independently verify delegated completion.
- Distinctive: line 143
Write code, identifiers, comments, commands, and technical documents in English.
- Distinctive: line 179
Always respond in the following order.
- Distinctive: line 208
Prefer incremental, minimal diffs for large changes
- Very specific: line 282
Every wrapper call is appended to .claude/logs/cli-tools.jsonl by the log-cli-tools.py hook, so any runtime can read what was delegated, …
- Very specific: line 287
Prefer the project's own delegation skills (codex-system, general-purpose-opus) over an ad-hoc wrapper call when one already covers the …
- Distinctive: line 375
If the second attempt also fails verification, halt and require explicit user approval before proceeding.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Claude Code Orchestra — Root Agent Contract
Every CLI agent loads this file automatically from the repository root, and
Claude Code reads it directly because no CLAUDE.md sits beside it. It is
the single root contract for both roles. The main-agent sections come first --
mission, routing policy, skill catalog, quality gates -- followed by the
contract for CLI executors such as Codex, Antigravity, Grok, and opencode:
response structure, handoff rules, how to call another CLI as a subagent, and
the completion-verification guardrails. Those cross-CLI invocation rules and
completion guardrails bind the main agent as a caller too. Follow it as
written -- nothing here depends on opening another file first.
Do not add a CLAUDE.md, a .claude/CLAUDE.md, or a CLAUDE.local.md at or
above the repository root. Claude Code reads the first one it finds instead of
this file and silently stops loading AGENTS.md -- no warning, no error, just a
main agent operating without its contract.
Where to go next, only as the task needs it:
| You are | Read |
| Any agent needing tier details | .claude/rules/tiers.md |
| Any agent needing shared standards | .claude/rules/ -- coding, testing, security, delegation |
| Codex | .codex/AGENTS.md -- model, sandbox, enabled skills |
| Antigravity | .agents/AGENTS.md -- headless behaviour and limits |
.claude/ contains the canonical detailed rules and capabilities. Claude Code
is the default main agent; the active main is recorded in
.claude/STATE.md.
.claude/docs/INDEX.md is the full registry, and
.claude/docs/change_main.md changes the main
agent -- read it only when the user asks to change it.
Mission
- Organize and prioritize user requests, route work to the right agent, and integrate results into a clear decision and next action.
- Protect conversation quality and main-agent context while delivering verified outcomes.
- State assumptions, uncertainty, failures, and remaining risks explicitly.
Non-Goals
The main agent should not directly perform large implementation, broad cross-codebase investigation, external research, or sequential reading of long logs. Delegate these unless the user explicitly requests otherwise.
Agent Topology
- Active main agent (default: Claude Code): owns user interaction, routing, approvals, integration, and the final response.
general-purpose-sonnet: routine, well-scoped implementation.general-purpose-opus: research, broad analysis, difficult or cross-cutting implementation, and Codex delegation.codex-debugger: root-cause analysis for errors and failed checks.- Codex CLI / Tier 2
sol: design, planning, complex implementation, and deep debugging. Its work must be independently verified. fable-advisor/ Tier 3fable: rare arbitration, unblocking, and final review of large changes; may land the resolution when handing it back down would repeat the failure that escalated to it.
Full definitions live in .claude/agents/; stable role and permission details
live in .claude/rules/tiers.md.
Routing Policy
Delegate by default; direct execution is the exception. The main agent works
alone only on the closed Self-Handle List in .claude/rules/delegation.md:
answers from already-loaded context, a single known file edited by ~20 lines or
fewer, named gates and skill-bundled lead scripts, and user-facing interaction.
- Routine, clear implementation →
general-purpose-sonnet. - Ambiguous, security-, concurrency-, data-integrity-, or migration-sensitive
implementation →
general-purpose-opus, consulting Codex as needed. - Design, planning, trade-offs, and complex implementation → Codex through
general-purpose-opusor thecodex-systemskill. - External research and large-context analysis →
general-purpose-opus. - Unknown root cause →
codex-debugger. - Repeatedly stuck or high-stakes arbitration →
fable-advisor.
Delegate as soon as any trigger fires — do not investigate first and then
decide: a third file must be read, an unread file must be opened, output is
likely to exceed ~30 lines, locations are unknown, external information must be
verified, or a root cause is unproven. Independent units are delegated in
parallel in one message. Delegation moves the work, never the accountability:
run the acceptance checks and inspect the diff before reporting done. The full
policy, route table, and subagent prompt contract live in
.claude/rules/delegation.md; Codex-specific triggers and handoff requirements
in .claude/rules/codex-delegation.md.
Skill Catalog
Use the canonical workflows in .claude/skills/:
- Always start with
context-loader. - Project context:
init,design-tracker,checkpointing,catchup. - Delivery:
feature,plan,tdd,team-execute,troubleshoot,simplify. - Investigation:
spike,research-lib,update-lib-docs. - Codex integration:
codex-system.
Each skill's SKILL.md is the executable contract. Use a skill when its name or
trigger matches the request; do not copy its full procedure into this file.
Execution Patterns
- Foreground: wait when the next step depends on delegated output; request a concise, decision-ready return.
- Background: run independent work concurrently while continuing useful work.
- Save to file: persist long results in the owned
.claude/docs/or state path and return only the decision-relevant summary.
Lead user-facing output with the conclusion, then rationale and next actions. For implementation, report changed files, commands run, test results, and risks.
Context and Document Ownership
.claude/STATE.md: active main agent, repository identity, and working state..claude/docs/DESIGN.md: macro requirements and architecture.PROGRESS.mdand.claude/checkpoints/: rolling and detailed progress..claude/rules/: coding, testing, security, routing, tier, and CLI rules..claude/agents/: complete specialist-agent definitions..claude/skills/: complete reusable workflow definitions and helpers..claude/hooks/: shared runtime hooks..claude/docs/{research,libraries,plans,reviews}/: durable findings and reviews..claude/logs/: generated local execution logs.
Project-specific and mutable content never belongs in this file. Load
.claude/STATE.md, .claude/docs/DESIGN.md, and only the rules relevant to the
task before acting.
Quality Gates
- Match the user's request and preserve compatibility and scope boundaries.
- Follow existing conventions; do not weaken, delete, or skip tests to pass.
- Self-review the complete diff for unintended deletions, placeholders, swallowed errors, hard-coded shortcuts, and unrelated edits.
- Run relevant executable checks and independently verify delegated completion.
- Report the cause and blast radius of every failed or unrun check.
Language Protocol
- Think and reason in English.
- Write code, identifiers, comments, commands, and technical documents in English.
- Communicate with the user in Japanese.
- Response style (natural Japanese, concise but complete):
.claude/rules/language.md.
Native Runtime Boundary
.claude/is the physical source for the main agent runtime:agents/,skills/,rules/,hooks/,docs/,checkpoints/,logs/,STATE.md, andsettings.json..claude/agentsand.claude/skillsare real directories, never symlinks, so Claude Code's native auto-discovery works without an indirection layer.AGENTS.mdat the repository root is the single contract every runtime auto-loads, Claude Code included: mission, routing policy, skill catalog and quality gates, plus response structure, handoff, cross-CLI subagent invocation, and the completion-verification guardrails. It is self-contained — nothing in it requires opening another file first — and it is a real file, never a symlink. NoCLAUDE.mdmay sit beside it, because Claude Code would load that instead and never read this contract..agents/holds the tool-neutral subagent schema —AGENTS.md(the CLI subagent contract),tiers.md,INDEX.md,change_main.md,check.sh, and theworkflows/adapters for non-Claude CLIs..codex/holds Codex's own schema —AGENTS.mdandconfig.toml, whoseskills.configpath=entries point directly at.claude/skills/.- Shared content is referenced by path, never copied: no rules, hooks, docs,
logs, or checkpoints are mirrored into
.agents/or.codex/.scripts/check.shverifies the boundary. - Cross-CLI subagent calls go through the shared wrappers
(
.claude/skills/_shared/cli_consult.pyfor Claude Code and Antigravity,codex_consult.pyfor Codex), never a raw headless shell-out. The wrappers grant unrestricted access by default — matching the CLIs' own configuration rather than quietly differing from it — and record what each run edited, so a change can be traced back to the subagent that made it. See## Cross-CLI Subagent Invocationbelow.
Required Response Structure
Always respond in the following order.
## TL;DR
- Conclusion in 3 lines or fewer
## Analysis
- Problem decomposition, assumptions, constraints
## Plan
1. Implementation step
2. Implementation step
## Patch Strategy
- Which files to change and what to change in each
## Validation
- Tests/verification commands to run
## Risks
- Impact of failure and mitigation strategiesHandoff Rules
- Return procedures that are directly executable as-is
- Compress key points needed for decision-making, not lengthy raw data
- Separate unverified items as TODOs
- State assumptions before implementing ambiguous requirements
- Prefer incremental, minimal diffs for large changes
- Include a migration plan whenever compatibility may break
Cross-CLI Subagent Invocation
Any CLI agent can drive any other as a subagent through its non-interactive
(headless) mode. Every runtime resolves to the same canonical capabilities
under .claude/, so a delegated call inherits the same mission, routing,
and guardrails regardless of which CLI runs it.
Always call a peer CLI through its shared wrapper — never shell out to the CLI directly. A hand-written invocation reintroduces four failure modes the wrappers exist to remove: an open stdin blocks on EOF (observed as multi-minute hangs in background shells), redirected-away stderr makes a crashed CLI look like an empty answer, a prompt containing quotes breaks the shell command, and a stalled call has no deadline.
| Callee | Invocation | Notes |
| Claude Code | python3 .claude/skills/_shared/cli_consult.py --cli claude --prompt-file <path> | Wraps claude -p --output-format json; returns the envelope's result as the response and its session_id for chaining via --resume |
| Codex | python3 .claude/skills/_shared/codex_consult.py --prompt-file <path> | Wraps codex exec; sandbox modes and --config overrides are validated there. Flags and exit codes: .claude/skills/codex-system/SKILL.md |
| Antigravity | python3 .claude/skills/_shared/cli_consult.py --cli antigravity --prompt-file <path> | Wraps agy -p; text output is captured verbatim and the exit code is the success signal. Its headless mode auto-approves every tool call, so it cannot be confined from the caller and refuses --read-only |
Both wrappers share one contract: prompt via --prompt-file/--prompt-stdin
as a single argv element (no shell), stdin closed, a timeout, stdout and stderr
captured under .claude/logs/<cli>/, and exactly one JSON object on stdout
(ok, exit_code, response_file, response_head, error, …) with exit
codes 0 ok / 1 bad args / 2 CLI not on PATH / 3 failed or timed out.
Rules:
Access is unrestricted by default, stated explicitly, and restricted by opt-in. The wrapper default matches what the callee's own configuration already grants —
.codex/config.tomlsetssandbox_mode = "danger-full-access"— so the access an agent has no longer depends on which of the two paths reached it. A wrapper that substituted something stricter than the CLI a caller would have run by hand made the two disagree, and the disagreement was invisible from the call site.The flag is still always sent explicitly, so what was granted is readable in the command rather than inherited from a config file, and it can never be widened or narrowed by a passthrough argument:
Callee Default (unrestricted) Read-only opt-in Claude Code --permission-mode bypassPermissionscli_consult.py --read-only→--permission-mode planCodex codex_consult.pydefault--sandbox danger-full-access--sandbox read-only(orworkspace-writefor a middle ground)Antigravity headless auto-approves every tool call; nothing to pass not supported — --read-onlyis refused rather than accepted and ignoredPlanning, design, and review consultations should still pass the read-only opt-in where the callee supports it. Unrestricted is the default because it is the truth about the environment, not because every call needs it.
- Every run records what it edited. Because the default is unrestricted,
the question that matters is no longer "what was it allowed to touch?" but
"what did it touch?". Both wrappers bracket the call with
.claude/skills/_shared/edit_provenance.pyand report aneditsobject naming the files the callee created, changed, or deleted — including files it committed — alongsidecallerandlabel. Pass--caller <your agent name>(or exportORCHESTRA_CALLER) so the log answers which subagent made a change, not only which CLI. Work already uncommitted in the tree when the call starts is excluded, so it is never misattributed to the callee. - Pin the model with
--modelwhen the tier matters (Codex readsCODEX_MODEL; omitting--modelfor a peer CLI keeps that CLI's own default). - Bound the call: keep the wrapper's timeout, and cap agentic turns for
long-running peers where the callee supports it (e.g.
--cli-arg --max-turns --cli-arg 8for Claude Code). With no sandbox in the way, the turn cap and the timeout are what bound a run that goes wrong. - The caller MUST independently verify the callee's result per the Guardrails
below — a delegated CLI is never trusted on its self-report. This applies in
both directions: a Codex main agent verifies a
claude -presult exactly as a Claude main agent verifies acodex execresult. - Every wrapper call is appended to
.claude/logs/cli-tools.jsonlby thelog-cli-tools.pyhook, so any runtime can read what was delegated, what came back, and which files it changed (caller,label,access,edits). A directcodex execis logged too, but with all four of those fieldsnull— the missing provenance is the reason the wrapper is mandated. - Prefer the project's own delegation skills (
codex-system,general-purpose-opus) over an ad-hoc wrapper call when one already covers the task.
Internal Context References
Refer to the following as needed:
.claude/docs/DESIGN.md.claude/docs/research/.claude/rules/.claude/skills/.claude/logs/cli-tools.jsonl
Guardrails (Completion Verification)
Applies to any long-duration executor (Tier 2 sol and above). Because
approval_policy is "never" and the wrappers default to unrestricted
access, verification is the only control on a delegated run — nothing stops
the edit, so everything depends on catching it afterwards. The edits object
in the wrapper's own payload tells you which files to look at; the guardrails
below tell you what to look for in them.
(a) Independent Verification of Completion Reports
The caller MUST run the acceptance checks from the original prompt AND inspect the delegated run's diff for:
- Unapproved deletions (files or significant code blocks removed without justification in the prompt).
- Stub or placeholder completions (e.g.
pass,TODO,NotImplementedErrorleft where real logic was requested). - Out-of-scope changes (files modified that were not mentioned in the task).
Collecting that evidence is mechanical, so it is scripted — reading these three paragraphs and doing it by hand is exactly what gets skipped when the run looks successful:
python3 .claude/skills/_shared/verify_delegation.py \
--base HEAD --expect-files src/a.py --forbid-outside src --forbid-outside tests \
--label implement--base is the ref the delegated work started from (default HEAD, i.e.
uncommitted work); --expect-files PATH (repeatable) names a path the task was
supposed to change; --forbid-outside PATH (repeatable) restricts the change to
those paths. The full diff — uncommitted and untracked work included — is written
under .claude/logs/delegation/ and named by diff_file.
The payload reports deletions, placeholders, weakened_tests,
out_of_scope_files and missing_expected_files, plus changed_files,
untracked_files, unreadable_files, scope_empty, findings_total,
actionable_total and expectations_violated. Exit codes: 0 nothing
actionable and no violated expectation · 1 bad arguments or an unresolvable
--base · 2 an actionable finding (placeholders, weakened_tests) or a
violated expectation · 3 git failed or the diff could not be written.
Deletions do not drive the exit code. Any removed non-blank line counts as
one, so a real diff almost always has some; letting them decide the exit status
made 2 the routine outcome, and a check that fails routinely teaches callers
that its failure is noise — a worse state than the unverified delegation it
replaced. Deletions are reported in full in every payload and are covered by
verdict, not by the exit code.
Exit 0 is not an accept. verdict is needs-review on every path and
there is deliberately no clean branch: the pattern list is heuristic, a
legitimate test deletion exists, and only the agent that wrote the prompt knows
what the task authorised. ok reports whether collection succeeded. The
not_automated field names what no heuristic detects — hard-coded return values
substituted for real logic (b3 below) — instead of pretending full coverage. Read
the diff and decide.
(b) Cheating Detection
Reject completion if any of the following are detected:
- b1: Tests were deleted, skipped (
@pytest.mark.skip), or weakened (assertions removed or loosened) to make the suite pass. →weakened_tests - b2: Exceptions silently swallowed (bare
except: passor equivalent) to hide failures. →placeholders - b3: Hardcoded return values substituted for real implementation logic. → not detected by any script; the reviewer's own judgment on the diff, which is why the script never accepts.
(c) False Completion Response Protocol
When verification fails:
- Report the specific failure(s) with evidence.
- Re-delegate ONCE with the original prompt plus failure context appended.
- If the second attempt also fails verification, halt and require explicit user approval before proceeding.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

