harness-claude / rules
AGENTS.md2 starsChanged 6 months agoMITView on GitHub
How the orchestrator (main Claude) delegates, and how this harness keeps token cost and context rot low. Delegate sub-tasks to the cheapest model sufficient for the task, and have subagents return summaries, not raw dumps. The orchestrator's context stays lean, which cuts both token cost and context rot. This is the always-on strategy. Default to Sonnet for ~90% of coding. Escalate to Opus when the task spans 5+ files, is architecturally load-bearing, is security-critical, or the first attempt failed. Benchmarking…
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 35,337 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 repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
We split this agents.md into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Default to Sonnet for ~90% of coding.
- Distinctive: line 38
Don't skip phases. Compact/clear between heavy phases.
- Distinctive: line 44
If insufficient/ambiguous, ask a focused follow-up.
- Distinctive: line 57
Use only when sub-tasks are genuinely independent — 3+ files, disjoint write-sets, no dependency between them.
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 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
Subagent Strategy & Token Optimization
How the orchestrator (main Claude) delegates, and how this harness keeps token cost and context rot low.
Token optimization — primary lever: subagent architecture
Delegate sub-tasks to the cheapest model sufficient for the task, and have subagents return summaries, not raw dumps. The orchestrator's context stays lean, which cuts both token cost and context rot. This is the always-on strategy.
| Task type | Model |
| Exploration / search / simple single-file edits | Haiku |
| Multi-file implementation, code review, most coding | Sonnet |
| Architecture, security analysis, debugging hard bugs, first attempt failed | Opus |
Default to Sonnet for ~90% of coding. Escalate to Opus when the task spans 5+ files, is architecturally load-bearing, is security-critical, or the first attempt failed.
Benchmarking is a separate, complementary tool — not the day-one token strategy. Use it to measure whether a skill/agent earns its keep (fork + worktree + diff, with vs. without the component, pass@k / pass^k). It belongs to the future "evaluation loops" phase, not to runtime token reduction. See ROADMAP.md.
Two orchestration modes — choose by use case
Sequential phases (default)
For linear, well-scoped work. The pipeline itself is the canonical example:
RESEARCH → PLAN → IMPLEMENT → REVIEW → VERIFYRules:
- Each agent gets one clear input, produces one clear output.
- Outputs become the next phase's input; store intermediates in files.
- Don't skip phases. Compact/clear between heavy phases.
Iterative retrieval (when a return is insufficient)
For exploratory/uncertain tasks where the first answer likely misses the purpose:
- Orchestrator evaluates the subagent's return against the real objective.
- If insufficient/ambiguous, ask a focused follow-up.
- Subagent goes back to source, returns refined answer.
- Loop ≤ 3 cycles, then accept or escalate.
Key: pass the subagent the objective/purpose, not just the literal query — it lacks the orchestrator's semantic context.
Parallel fan-out (the third mode — opt-in)
For one task that splits into independent sub-tasks across many files. Invoke
/harness-claude:orchestrate: it decomposes the task, assigns one writer per file,
verifies the write-sets are pairwise disjoint, fans out the independent sub-tasks via the
platform Workflow tool, and reconciles the workers' structured summaries into one result.
- Use only when sub-tasks are genuinely independent — 3+ files, disjoint write-sets, no dependency between them. If one sub-task needs another's output, it's sequential/iterative.
- The one-writer-per-file invariant holds by assignment (disjoint owners), checked before every parallel batch — not by isolation.
- Workers honor the standing rules: cheapest-sufficient model, summaries not raw dumps, minimum tool scope (read-only unless they own a writable file).
Decision rule
- Linear, scope clear, output shape known → sequential.
- Open-ended research, ambiguous result, "find out X then decide" → iterative.
- Independent sub-tasks, disjoint write-sets across many files → parallel fan-out
(
/harness-claude:orchestrate). - A phase may use both: sequential overall, iterative within a research step.
When a delegate comes back wrong
Delegation fails in distinct ways that need distinct responses — don't treat every bad return the same. Name the mode, then apply the response:
| Mode | What it looks like | Response |
| Null / died | threw, timed out, returned nothing | retry once with the same brief; still null → surface it and continue the batch (one dead worker doesn't block the rest) |
| Partial | did some of the work, not all | keep what's valid; re-dispatch only the missing slice, not the whole task |
| Contradiction | two workers disagree | don't pick blindly — re-check the source yourself, or surface both with the conflict named |
| Off-target | answered, but missed the purpose | iterative-retrieval (≤3 cycles): re-ask with the objective, not just the literal query |
| Runaway | not terminating, looping | cap and abort (the /harness-claude:operate drift/budget/iteration guardrail) |
| Oversized | dumped raw output instead of a summary | reject and re-brief — summaries-not-dumps is a contract, not a preference |
Fallback ladder (when a retry is warranted): retry with a sharper brief → escalate the model one tier (Sonnet → Opus) → surface to the user. Cap the whole ladder at the ≤3-cycle iterative-retrieval limit; past that, stop and report rather than burning more turns.
Scoping
Give each agent the minimum tool set it needs. Reviewers are read-only; resolvers may edit. Never grant an agent more reach than its job requires.
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.

