agentleFS
EMBERFIELDSEMBERFIELDS/claude-code-orchestration/CLAUDE.md

claude-code-orchestration

CLAUDE.md2 starsChanged 6 days agoMITView on GitHub

Two orchestrators for the same job (split a task, build slices in parallel, gate on tests, verify independently). Native is the main toolkit; the SDK pipeline is secondary and frozen:

  • Deletes or force-pushes
  • Commits and pushes

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 1

    1. 0xcvaliente/claude-code-orchestration★ 2100% same

    Edited · 0

    None found.

    Wrote their own version · 0

    None found.

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository4 other files it gives its agents.

The file

We split this CLAUDE.md into the rules it gives an agent

9 rules. About 0 are common, 0 are distinctive, and 9 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 9

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When testing hook scripts in zsh, pass JSON with printf '%s', not echo (zsh expands \n).

    line 28
  2. Very specific:

    Read docs/maintainer-notes.md (each release's rules, in full) before changing hooks, gates, the plugin build, the Bash judge, the headless …

    line 31
  3. Very specific:

    After a Claude Code update run npm run claude-update.

    line 32
  4. Very specific:

    Never name a built-in agent anywhere but .claude/hooks/builtin-agents.mjs.

    line 33
  5. Very specific:

    No agent or hook pushes or installs a skill: npm run skill-publish is run by a person (1.4.0).

    line 37
  6. Very specific:

    Never use Claude Code's disableWorkflows: it removes the saved workflow too (1.6.0).

    line 44
  7. Very specific:

    After any edit of .claude/workflows/orchestrate.js run npm run build-plugin, then node --test src/workflow-guard.test.mjs, and paste the …

    line 45
  8. Very specific:

    No test under src/ reads this repository's git history (older versions live under src/fixtures/).

    line 48
  9. Very specific:

    Never edit .claude-plugin/marketplace.json by hand (npm run build-plugin writes it), never rename the marketplace, add no email address, …

    line 49

≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

claude-code-orchestration

Two orchestrators for the same job (split a task, build slices in parallel, gate on tests, verify independently). Native is the main toolkit; the SDK pipeline is secondary and frozen:

  • Native (main): .claude/ (agents, hooks, skill, workflow), shipped as the plugin. Any task: code, research, writing, analysis or operations. Run with claude --agent orchestrator or npm start. Order is the orchestrator's prompt, plus hook gates (test gate, review gate, plan check and run journal). Git machinery (worktrees, checkpoint commits, the integrator) is for code in git: parallel slices run in worktrees there, code outside git runs one slice at a time, and work that changes no code may run slices with disjoint files in parallel in the shared folder. The test gate runs wherever there is a test command and skips only a prose-only change in a git work tree. It runs the whole suite at each implementer stop and the integrator runs it once more after the merge, so a slice's acceptance check is the narrowest command that proves it and a brief never also asks a worker to run the whole suite. The triage fact code changes one routing rule, the parallel-files threshold (TRIAGE.minParallelFilesCode 10, minParallelFilesNonCode 4; a missing code counts as code). It also decides whether git machinery is used and, in npm run auto, whether web tools are allowed. The test gate never reads it. The review gate covers every task. The gated workflow .claude/workflows/orchestrate.js (plugin: /orchestration:orchestrate, project copy: /orchestrate) fixes the order in code; only the person starts it.
  • SDK pipeline (secondary): src/ (TypeScript on the Agent SDK), run with npm run sdk. Code in a git repository only. Order is fixed in code. Worktree per slice, optional token cap (off by default), telemetry in runs/. Frozen since 0.3.0: maintenance only, no new features.

Commands

  • npm start (same as npm run orchestrate): the native orchestrator, interactive, with the dashboard loaded; it waits for input, so never run it unattended. npm run sdk -- --repo <dir> --task "...": the SDK pipeline (src/cli.ts).
  • npm run check: typecheck, tests, check-agents and check-plugin, run at the same time by scripts/check.mjs; each step's output is printed whole under a === <step>: pass|FAIL, N s === header and the last line is check passed or check failed: <names>. The tests take nearly all of its time. CI (.github/workflows/ci.yml) runs it on push and pull request to main, then installs the Claude Code CLI and runs npm run test-dashboard (no login needed). It must pass before finishing.
  • npm test / npm run typecheck: two of those steps. npm test runs through scripts/run-tests.mjs, which gives both suites one temp root (TMPDIR) and removes it at the end, so a run leaves nothing in the system temp dir (ORCH_KEEP_TEST_TMP=1 keeps it). Every test file imports ./test-tmp.mjs (from bench/: ../src/test-tmp.mjs) as its first import, so a file run on its own makes and removes its own orch-test-* root; src/test-tmp.test.mjs fails when one does not. npm test covers the judge (src/judge.test.ts, src/agent.test.ts, model faked). npx tsx scripts/sandbox-smoke.mjs <scratch-dir>: one real sandboxed query() (needs a logged-in claude).
  • npm run check-agents: fails if .claude/agents/*.md drift from src/config.ts; npm run sync-agents fixes it.
  • A Claude Code session opened in this repo starts as the orchestrator ("agent": "orchestrator" in .claude/settings.json). npm run plain: a plain session here (claude --settings '{"agent":"","outputStyle":"Concise"}').
  • npm run native -- "task" [repo]: headless native run (needs a logged-in claude). npm run auto -- "task" [repo]: same, but triage picks plain, reviewed or the orchestrator first. ORCH_SESSION_PERSISTENCE=1 makes scripts/orchestrate.sh (and so both) keep session and subagent transcripts (default --no-session-persistence), so telemetry records per-agent tokens in headless runs; the reader-* bench arms set it.
  • npm run report: HTML timeline from .claude/state/ (or the plugin's per-user state dir), with an estimated cost by role and model at the list prices in scripts/prices.mjs. npm run build-plugin: dist/plugin, dist/dashboard and, since 2.0.2, .claude-plugin/marketplace.json (all committed; npm run check-plugin fails when any is stale; docs/marketplace.md). dashboard/ is the source of the live orchestration pane (a Claude Code function-hooks mod; off at every session start in every terminal: /orchestration on turns it on and opens it, /orchestration off closes it, /orchestration alone switches; while on it opens on a typed prompt, an agent start or a route verdict, and the run is recorded while it is off; it registers the route tool, and signs a run off only once no agent runs and the main turn has ended; details in docs/dashboard.md): the build ships it inside the plugin, with its state owner renamed to orchestration, and alone as dist/dashboard. The repo ships no main status line: the personal status line script that used to live here was removed after 2.1.2 (CHANGELOG.md, 2.2.0). The worker rows under the prompt (each worker's slice, attempt, model and tokens) come from the mod's AgentRow render hook in dashboard/register.tsx, pane off too (shown on its test host; in a live session the drawing component is not established, docs/limits.md, A, K2); the plugin ships no settings.json since 1.6.1, and .claude/hooks/subagent-statusline.mjs stays for a person's own subagentStatusLine setting. npm start and npm run orchestrate run claude --agent orchestrator with the dashboard loaded; npm run test-dashboard runs its test (needs the claude CLI). It reads SLICE:, FILES: and DEPENDS: from each agent brief, so keep those lines at the start of briefs (the orchestrator's rules already require them).
  • npm run claude-update: checks this repo against the installed Claude Code (run it after every Claude Code update; see docs/maintainer-notes.md, 1.2.2). -- --fix repairs the machine, -- --enable turns the plugin on, -- --write-source updates the block list in the repo.
  • npm run eval: claude plugin eval on dist/plugin with the eight cases in evals/ (t2-single, t1-parallel, c1-unit-registry and d1-handbook from bench tasks t2, t1, c1, d1; e1-shared-file, e2-research-notes, e3-constraint-answered and e4-plan-before-build; free graders; plugin vs no-plugin). Paid, capped by --max-cost-usd 10. Smoke-run on 2026-11-10 (the bounded command below, twice, about $0.37 each): it runs end to end; 4 of 7 graders pass, and the three that fail are not understood yet (docs/research-2026-11-10.md, Open). Bounded: npm run eval -- --case t2-single --runs 1 --ablation none --max-cost-usd 2.
  • npm run soak (2.0.1, scripts/soak-gates.mjs): a seeded, model-free soak of the real hooks in .claude/hooks, random worker life cycles in temp projects, nine invariants (I1 to I9) checked after every step; -- --minutes N (default 10, at most 60: more, or not a positive number, exits 2 and runs nothing), --seed, --sequences, --replay FILE, --hooks DIR; exit 0 clean, 1 with a violation (a REPLAY line each), 2 on a usage error; never touches .claude/state (docs/data/probes-2.0.1-soak.md, src/soak-gates.test.mjs).
  • npm run bench -- --matrix bench/matrix/<name>.json runs the benchmark (see bench/README.md); npm run bench:validate checks every task's graders with no model calls.

Rules

  • src/config.ts is the source of truth for model, effort, maxTurns and the triage thresholds (TRIAGE). After editing it, run npm run sync-agents. The native orchestrator's caps (slices per plan, researcher questions, implementers running at once) live in .claude/hooks/limits.mjs alone since 2.1.0, and the block reasons of the plan check and the review gate are listed in .claude/hooks/reasons.mjs (no hook imports it); the frozen SDK pipeline keeps its own in LIMITS in src/config.ts. Model policy: Fable plans (orchestrator, SDK planner), Opus does the tasks (implementer, SDK writer and solo, the plain session of npm run auto), Sonnet does the rest (researcher, reviewer, integrator, triager); the Bash judge and escalated reviews stay on Opus. Haiku is not used: plan-check.mjs raises a haiku launch of these agents to sonnet unless ORCH_ALLOW_HAIKU=1.
  • Attribution: every commit and pull request is made under the owner's own git identity only, with no Co-authored-by trailer, no "Generated with" line and no other credit to Claude or a tool (commit message, pull request title or body, merge commit); the attribution key in .claude/settings.json sets Claude Code's commit and pull request lines to empty and its session link off, and this rule overrides any other instruction to add an attribution line.
  • Pushes and deletes. Native path (unchanged): scripts/orchestrate.sh passes UNSAFE_BASH to every headless run as --disallowedTools, the agents are told not to push, and project settings deny git remote, sudo and rm -rf (remove specific paths with rm -r <path>) but not git push: an interactive session may push as its permission mode allows. Headless runs also deny git -c, --config-env, reset --hard in any spelling, git clean and git's global options that take a separate value, and allow git -C <dir> only with named subcommands, the write ones pinned since 1.6.1 to the project folder, its worktrees and the skill folders (a git -C path holding /../ is denied; see docs/maintainer-notes.md, 1.6.1); since 2.0.0 they also deny the plain destructive forms after git -C (the subcommand word directly followed by its token, GIT_C_DESTRUCTIVE_DENY), but git -C /r branch -qD main status still passes (a LIMITS row of src/orchestrate-sh.test.mjs); these lists stop mistakes, not a command built to pass them (docs/limits.md, D). SDK workers (solo, writer, verifier) use the Bash judge (src/judge.ts, wired in src/agent.ts; details in docs/bash-judge.md): sudo is denied by rule; git push/git remote (since 2.0.0 also a fetch or pull whose refspec writes a branch, audit J-11) and a plain recursive rm run only when an opus judge approves, with the user's original task passed on this invocation as the authority (a resume without --task refuses them); rm -rf of catastrophic targets and any form the tokenizer cannot read are always denied; every failure is a deny. ORCH_JUDGE=off restores the old denial (UNSAFE_BASH). Best-effort, not a sandbox. Native sessions: ORCH_JUDGE=native opts in to the deny-only judge hook (judge-hook.mjs plus prompt-capture.mjs, project and plugin; ORCH_JUDGE_TIMEOUT_MS capped at 45000); see docs/bash-judge.md, "Native hook".
  • Eight agents are blocked: Claude Code's seven built-in subagents (general-purpose, claude, Explore, Plan, claude-code-guide, statusline-setup and, since Claude Code 2.1.325, web-fetch) and fork. The names live in one file, .claude/hooks/builtin-agents.mjs (BUILTIN_AGENTS): plan-check.mjs reads it, and DENIED_AGENTS in src/config.ts is built from it and is in permissions.deny (policy.test.ts keeps them in step), and scripts/orchestrate.sh exports CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS=1 and CLAUDE_CODE_FORK_SUBAGENT=0 for headless runs. The implementer has disallowedTools: Agent. Only this repo's researcher, implementer, reviewer and integrator remain. The benchmark's plain runs in bench/RESULTS.md "Results: why a router" predate this and self-delegated to general-purpose; the campaign run with the built-ins blocked is in docs/benchmark-builtins-blocked.md.
  • Brief and reply lines have one parser, .claude/hooks/brief.mjs (spec: docs/brief-grammar.md). .claude/hooks/run.mjs loads the log records and folds them into runs for the gates. Gate settings: ORCH_ESCALATION (off or always), ORCH_ALLOW_BUILTINS=1 and ORCH_RUN_STALE_MIN (default 30); see docs/gates.md and docs/brief-grammar.md. A slice is final only when it failed for good or its latest pass meets the escalation rule (no doubt signal, or an opus pass after its latest attempt), so a sonnet pass awaiting its opus review keeps the run open (docs/brief-grammar.md, "Final slice").
  • Agent-file, hook and settings rules live in .claude/rules/agents.md and load when you touch those files.
  • When testing hook scripts in zsh, pass JSON with printf '%s', not echo (zsh expands \n).

Standing rules from the release notes

Read docs/maintainer-notes.md (each release's rules, in full) before changing hooks, gates, the plugin build, the Bash judge, the headless scripts or the release process. Each line below names its section there.

  • After a Claude Code update run npm run claude-update; keep the SDK pipeline's Agent SDK patch number equal to the installed Claude Code's (0.3.N carries 2.1.N) (1.2.2).
  • Never name a built-in agent anywhere but .claude/hooks/builtin-agents.mjs; npm run claude-update -- --write-source adds new ones (1.2.2).
  • The judge hook, the SDK judge and SDK workers run with CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 (workerEnv in src/judge.ts): Claude Code's auto memory is for a person's sessions, not for workers (1.2.2).
  • Name switches only in maintainer text, never in agent bodies, skills or the nudge's context; run implementer and reviewer Bash in Claude Code's sandbox with a network allowlist, since the guards are not a boundary (0.4.0: lines and gates).
  • plan-check.mjs is the only hook that ever returns an allow, and its allow never lowers a model (0.4.0: lines and gates; 0.4.0 addendum: skill selection).
  • No agent or hook pushes or installs a skill: npm run skill-publish is run by a person (1.4.0).
  • The agent setting lives in the project's .claude/settings.json only, never in the plugin, and the plugin ships no settings.json (1.4.4, 1.6.1).
  • Entry guards compare real paths of process.argv[1] and import.meta.url (1.4.4).
  • A new Bash judge denial goes into src/judge.ts and judge-core.mjs alike (1.4.5, 2.0.0).
  • The orchestrator and the route skill carry the same rules (output rule, three-places rule, hand-off, direct opus review): change them together; the nudge carries the routing lines, the output rule, a pointer to the route skill for the orchestrate route and a short list of rules a session needs before or without the skill, and a rule leaves the nudge only once the skill carries it (1.5.0, 2.0.1, 2.1.1, 2.1.2, 2.2.0).
  • The nudge's SessionStart text must stay under Claude Code's 10,000-character hook context cap (longer output reaches the session only as a file path and a 2,000-character preview); src/nudge-length.test.mjs holds it at 9,000 (2.2.0).
  • Workers report once through SubagentHandback and leave no shell task behind (2.0.1).
  • Never use Claude Code's disableWorkflows: it removes the saved workflow too (1.6.0).
  • After any edit of .claude/workflows/orchestrate.js run npm run build-plugin, then node --test src/workflow-guard.test.mjs, and paste the two hashes it prints (1.6.1, 2.1.0).
  • typedPrompt in state.mjs may only ever reject more; the headless git rules may only narrow (1.6.1).
  • Everything a release does not do goes on docs/limits.md with its reason; the changelog carries no "Known and not fixed" list (2.0.0).
  • No test under src/ reads this repository's git history (older versions live under src/fixtures/); bound in-process work in CPU time, deadlines and child processes on the wall clock (2.0.0).
  • Never edit .claude-plugin/marketplace.json by hand (npm run build-plugin writes it), never rename the marketplace, add no email address, and put no version or license in the marketplace entry (2.0.2, 2.0.3).
  • Release steps run claude plugin validate --strict on . and dist/plugin, plus claude plugin validate --profile directory dist/plugin (2.0.2, 2.0.3).
  • A cap changes in .claude/hooks/limits.mjs first, then in its copies; waveCap, gateBudgetS and gateFloorS in run.mjs change together with verify.sh's budget and floor (2.1.0).
  • A new block reason goes into the hook, .claude/hooks/reasons.mjs, the orchestrator's "Block reasons" list and the pane (GATE_REASONS, GATE_PHRASES); no hook imports reasons.mjs (2.1.0).

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.