agentleFS
vasuag09vasuag09/harness-claude/rules/agents.md

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.

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
  1. Distinctive:

    Default to Sonnet for ~90% of coding.

    line 18
  2. Distinctive:

    Don't skip phases. Compact/clear between heavy phases.

    line 38
  3. Distinctive:

    If insufficient/ambiguous, ask a focused follow-up.

    line 44
  4. Distinctive:

    Use only when sub-tasks are genuinely independent — 3+ files, disjoint write-sets, no dependency between them.

    line 57

≈ “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.

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

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 typeModel
Exploration / search / simple single-file editsHaiku
Multi-file implementation, code review, most codingSonnet
Architecture, security analysis, debugging hard bugs, first attempt failedOpus

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 → VERIFY

Rules:

  1. Each agent gets one clear input, produces one clear output.
  2. Outputs become the next phase's input; store intermediates in files.
  3. 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:

  1. Orchestrator evaluates the subagent's return against the real objective.
  2. If insufficient/ambiguous, ask a focused follow-up.
  3. Subagent goes back to source, returns refined answer.
  4. 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.

  1. 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.
  2. The one-writer-per-file invariant holds by assignment (disjoint owners), checked before every parallel batch — not by isolation.
  3. 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:

ModeWhat it looks likeResponse
Null / diedthrew, timed out, returned nothingretry once with the same brief; still null → surface it and continue the batch (one dead worker doesn't block the rest)
Partialdid some of the work, not allkeep what's valid; re-dispatch only the missing slice, not the whole task
Contradictiontwo workers disagreedon't pick blindly — re-check the source yourself, or surface both with the conflict named
Off-targetanswered, but missed the purposeiterative-retrieval (≤3 cycles): re-ask with the objective, not just the literal query
Runawaynot terminating, loopingcap and abort (the /harness-claude:operate drift/budget/iteration guardrail)
Oversizeddumped raw output instead of a summaryreject 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.

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.