DEV Community

Rulestack
Rulestack

Posted on

Your CLAUDE.md loads into every subagent — the context multiplier nobody budgets for

You split your workflow into subagents to save context. Each worker gets a fresh window, does its job, returns a summary. Clean.

Here's the part that doesn't show up in the mental model: every one of those workers re-loads your entire CLAUDE.md hierarchy at startup. Ten subagents means your CLAUDE.md is paid for ten times — before any of them does a single unit of work.

I measured subagent fixed overhead at roughly ~436k tokens per agent in a previous experiment. A commenter (@skillselion) pointed out a variable I'd held constant without pricing it: CLAUDE.md rides along with every custom subagent, so its size gets multiplied by headcount. They're right, and the docs are explicit about it. This post is the follow-up: what exactly loads into a subagent, which agents are exempt, and how to shrink the multiplicand.

What actually loads into a subagent at startup

Per the official subagents doc, a non-fork subagent's initial context contains:

  • System prompt — the agent's own prompt plus environment details. Notably not the full Claude Code system prompt.
  • Task message — the delegation prompt the main conversation writes.
  • CLAUDE.md files — quoting the doc: "every level of the CLAUDE.md hierarchy the main conversation loads, including ~/.claude/CLAUDE.md, project rules, CLAUDE.local.md, and managed policy files."
  • Git status — a snapshot from the parent session's start.
  • Preloaded skills — full content of anything in the agent's skills frontmatter field.
  • Sibling roster — a small system reminder, only when relevant.

The line that matters for budgeting: your user-level CLAUDE.md, your project CLAUDE.md, your .claude/rules/ files without paths frontmatter, and your CLAUDE.local.md all board every subagent you spawn.

The two exemptions — and why you can't add more

The built-in Explore and Plan agents skip CLAUDE.md and git status. The doc's phrasing: "Explore and Plan are the only subagents that omit CLAUDE.md and git status. There is no frontmatter field or per-agent setting to change which agents skip them."

Two consequences:

  1. You can't opt a custom subagent out. If your review pipeline spawns 12 custom agents, all 12 carry your full instruction hierarchy. There's no skipMemory: true.
  2. Read-only research is cheap by design. When the task is "find where X is defined," delegating to Explore genuinely avoids the multiplier. Reaching for a custom agent for pure lookup work forfeits that discount.

The arithmetic

Say your CLAUDE.md hierarchy totals 6,000 tokens — a 400-line project file plus a user-level file plus a couple of unscoped rules. That's unremarkable; project instruction files grow monotonically because nobody ever deletes a rule.

  • Single conversation: 6,000 tokens, paid once.
  • A 10-agent fan-out (parallel review, migration sweep): 60,000 tokens of CLAUDE.md before any file is read.
  • Run that pipeline 5 times a day: 300k tokens/day of pure instruction re-delivery.

In my earlier measurement, per-agent fixed overhead (~436k tokens) dwarfed the content I explicitly embedded (~46k). The CLAUDE.md hierarchy is part of that fixed slice — and unlike the harness portion, it's the part you control.

Measure yours in 30 seconds

Run /context in a session. The Memory files list shows every CLAUDE.md-family file that loaded and what it weighs. That number, times your typical concurrent agent count, is your real instruction overhead per fan-out.

If the number surprises you, the doc's own size guidance is the fix-list.

Shrinking the multiplicand

The memory doc targets under 200 lines per CLAUDE.md file, and warns that longer files both consume context and reduce adherence. Three moves actually reduce the multiplied cost, one popular move doesn't:

1. Path-scoped rules load on demand. Rules in .claude/rules/ with a paths frontmatter field only enter context when Claude works with matching files. A rule about your Terraform layout doesn't need to ride into a subagent that's reviewing TypeScript. This is the highest-leverage move: it subtracts from every agent's startup load.

2. Skills load when invoked. A multi-step procedure ("how we cut a release") doesn't belong in CLAUDE.md at all — the memory doc says to move procedures to skills or path-scoped rules. A skill's cost is its description line until something actually invokes it. One caveat in reverse: a subagent's skills frontmatter field injects the full skill content at startup — preloading is the opposite of lazy-loading, use it only when the agent always needs that knowledge.

3. Delete rules that no longer earn their tokens. I wrote a separate method for finding dead rules. With the multiplier in view, a dead rule isn't one wasted line — it's one wasted line × every agent × every run.

What doesn't help: @path imports. The doc is blunt: imports help organization "but doesn't reduce context, since imported files load at launch." Splitting a 600-line CLAUDE.md into six imported files ships the same 600 lines to every agent, just in prettier luggage.

The checklist

  • Run /context, note total Memory files weight.
  • Multiply by your typical fan-out size. That's the real number.
  • Anything procedural → skill. Anything area-specific → path-scoped rule. Anything dead → deleted.
  • Use Explore/Plan for pure research tasks; they're the only free riders.
  • Don't confuse imports with savings.

The subagent isn't expensive because it's an agent. It's expensive because it's a full re-reader of everything you never trimmed, times however many of them you launch.


I maintain Rulestack — practical packs of Claude Code skills, hooks, and rules files, kept current against how these tools actually load things. Daily AI-coding-workflow notes on Bluesky: @ai-shop.bsky.social.

Top comments (0)