Original Reddit post

Claude Code’s built-in Explore subagent skips your CLAUDE.md files on purpose so quick Glob and Grep lookups stay fast and cheap. Custom subagents that you define in .claude/agents/*.md do the exact opposite by default. Every time the main session spawns a custom subagent (like a test runner, log parser, or read-only code reviewer), three things happen unless you override them in the YAML frontmatter: First, the subagent reloads your entire CLAUDE.md and AGENTS.md hierarchy from disk into its own context window on every spawn. If you spawn five subagents in parallel to check five modules, you pay for that root instruction tree five extra times. Second, the subagent inherits /effort from your main session. If your main session is running on high effort for architecture work, a subagent spawned just to parse a test log will also burn high reasoning effort unless its frontmatter pins effort: low . Third, setting disallowedTools: Write, Edit on a read-only subagent still leaves two gaps: Bash stays open (so the worker can still mutate files with sed or shell redirection), and every Skill description plus MCP server instruction block still loads into the startup prompt. Using an explicit tools allowlist with scoped Bash(…) patterns closes both gaps at once. Here is the frontmatter template we use for read-only search and git-history workers in .claude/agents/repo-inspector.md :

name: repo-inspector description: Fast read-only codebase and git history lookup without CLAUDE.md reload model: haiku effort: low omitClaudeMd: true
tools: Read, Grep, Glob, Bash(git log *), Bash(git blame *), Bash(git diff *)
You are a read-only codebase inspector. Search files and git history to answer the parent agent's question concisely with exact file:line references. Never modify files. ```
Because
omitClaudeMd: true
strips the project instruction files, make sure any command or path convention the worker actually needs is written directly inside that subagent's 2-line prompt body (or passed in the task description). And because
tools
is an explicit allowlist containing only
Read
,
Grep
,
Glob
, and read-only
git
commands, Claude Code skips loading the
Skill
catalog and
mcp__
server instructions on startup while blocking arbitrary shell writes.
If you also run OpenAI Codex CLI alongside Claude Code for second-opinion reviews or background builds, Codex has a similar background token drain where
code_mode
yields back to the model every 30 seconds and resends the full chat history while a build is still running. Adding these two blocks to
~/.codex/config.toml
stops the 30-second yields and 1-second subagent polling loops:
```toml [features.code_mode] default_exec_yield_time_ms = 300000
[features.multi_agent_v2] min_wait_timeout_ms = 30000 default_wait_timeout_ms = 120000 max_wait_timeout_ms = 300000 ```
Which custom subagents are you actually keeping in
.claude/agents/
right now, and how do you scope their tool permissions?
submitted by
/u/Independent-Sir3234

Originally posted by u/Independent-Sir3234 on r/ClaudeCode