Pinned Claude Code subagents fall through to Fable

Claude Code subagents pinned to Sonnet in their frontmatter had been running on the session model, Fable, without any warning. The author of a post on the Thomas-witt blog, published August 16, caught it and wrote a nine-line PreToolUse hook. The hook refuses any dispatch of a pinned agent that doesn’t name its model explicitly.
The first sign was the bill. The author runs Claude Code on a large session model, Fable or Opus 5, with a set of subagents handling the routine work: gateway agents, formatters, checkers. Token consumption stopped matching what the week had actually involved. “Nothing was broken. Nothing errored. Everything worked. It just cost more than it should have.”
The post doesn’t argue against subagents. A subagent is worth having because it runs in its own context window. It does a noisy job and hands back a short answer, so the noise never reaches the main session. In the author’s words, the ideal job is “fetch a lot, filter, return a little”, and that needs an obedient model more than a brilliant one. Running that work on Fable or Opus 5 is “paying frontier prices for grep with good manners.” These are the agents the author says should never touch a frontier model:
- AWS, especially CloudWatch Logs, where a query for one request ID “returns an ocean” and you want the stack trace and the timestamp;
- GitHub: issues, PR diffs, CI status, which commit touched a file;
- Honeybadger: error occurrences, backtraces, whether this is last Tuesday’s bug again;
- Langfuse, where 95% of every trace has nothing to do with the question being asked;
- static analysis with RubyCritic, RuboCop and similar tools, where a hundred-page report has nine actionable lines;
- test runners, where the job is reading RSpec output and naming the four red specs.
Pinning one of these takes a single line, model: sonnet, in the agent’s file, for example .claude/agents/cloudwatch-digger.md. The author’s point is that the agents you bother to pin are the ones you dispatch most and check least.
According to the post, Claude Code picks a subagent’s model from four layers in order: an environment variable set in the shell or launch config, then a model parameter on the dispatch itself, then the model: field in the agent’s frontmatter, then whatever model the session started with. The frontmatter pin is the one everyone uses because it is documented and only has to be written once, and it sits third of four. The author says that across several releases this layer has silently dropped out, so pinned agents fell through to the session model. An agent dispatched two hundred times a day then ran on the most expensive model available. The transcript looks no different and the agent still does its job. “A crash is polite, it tells you,” the author writes. This failure turns up four weeks later as a number.
Other users have filed similar reports. In one GitHub report, the reporter quotes the Agent tool documentation: “If omitted [the model parameter], uses the agent definition’s model, or inherits from the parent.” The reporter says the frontmatter field is ignored in practice. An agent with model: sonnet in its frontmatter, spawned without a model parameter, reported itself as Opus 4.6, the parent model. Spawned with an explicit “sonnet”, it reported Sonnet 4.6. The reporter estimates that multi-agent frameworks defining 50 or more agents on Sonnet or Haiku end up running all of them on Opus, “costing 5-34x more than intended.” It is also not the first time subagent behavior changed silently between versions: a hardcoded instruction in Claude Code 2.1.219 and 2.1.220 kept Opus 5 from spawning subagents at all unless the user asked for it.
The workaround in these reports is the same every time: pass the model on the dispatch. That is the second layer, which the author says has never been the one that breaks. The GitHub reporter points out the cost of this approach: the orchestrator has to know the right model for every agent type, “defeating the purpose of declaring it in the agent definition.” The author puts the same problem more bluntly. “An orchestrator that reliably remembers a thing forever is not something I’ve met.” So the hook doesn’t rely on the orchestrator remembering. It enforces the pin.
The hook uses PreToolUse, which runs before a tool call goes through and can block it by exiting with code 2. The script, .claude/hooks/enforce-subagent-model.sh, uses jq to read the tool name, the subagent type and any model from the payload on stdin. It acts only on Task and Agent calls. If the dispatch names a subagent but carries no model, awk reads the model: line from that agent’s frontmatter. When a real pin turns up, the script writes a message to stderr and exits 2. The message names the pin and tells Claude Code to re-dispatch with that model, noting that “a deliberate different model also passes, but it must be explicit.” Claude Code reads the message and re-sends the call correctly without being prompted. Setup takes two more steps: make the script executable with chmod +x, and register it in .claude/settings.json under PreToolUse with the matcher Task. To test it, dispatch a pinned agent without a model. You should get the BLOCKED message, and the next dispatch should carry the pin.
Some calls are allowed through on purpose. A dispatch with any explicit model passes, even one that differs from the pin, because the author is guarding against omission, not choice. Agents set to model: inherit or with no model key pass, since inheriting is what they intend. Built-in types such as Explore, Plan and general-purpose pass because they have no file in .claude/agents. If jq can’t parse the payload, all three variables come back empty and the hook exits 0. The author says this is deliberate: it is a cost guardrail, not a security boundary. A hook that fails closed would eventually lock up a session, get disabled, and leave things where they started. An empty or null model, on the other hand, is treated like a missing one. It would fall through to the frontmatter layer, the one under suspicion, so it gets blocked as well.
The post comes with two caveats. Precedence behavior changes between Claude Code releases, so the author advises checking it against the version you run. And a hook that blocks your own dispatches will leave you staring at a blocked Task call if it is wired up wrong.
There is also a gap. Agents spawned with agent() inside workflow tools don’t go through PreToolUse, so the hook never sees them. “I cover those with prose in my reference docs instead, which is a nice way of saying they’re not covered.”
Up next
Claude Code Projects adds shared sessions and threads, Video
Per TestingCatalog, Anthropic’s upcoming Claude Code Projects put several people and Claude in one Claude Desktop session, with threads splitting off per task and repos pinned as context that persists across sessions.
Related stories
- A hardcoded instruction in Claude Code 2.1.219 and 2.1.220 blocks Opus 5 from spawning sub-agents
- Anthropic cut roughly 80% of Claude Code’s system prompt
- A Claude Code mod that reverts its own failed ideas
- Claude Code shipped its own TypeScript in npm source maps
- Show HN: Generate a Claude Code or Codex agent fleet from one HTML file
- pairmark races Claude Code against Codex in your repo
Comments
No comments yet. Be the first.
Join the conversation
Sign in to leave a comment. It appears after moderation.

