A Bloated CLAUDE.md Teaches Claude to Ignore You

CLAUDE.md pruning, PreToolUse hooks, subagents, and headless CI for Claude Code power users. Updated through v2.1.198.

A Bloated CLAUDE.md Teaches Claude to Ignore You
Share

Two changelog drops in as many days reset the baseline for anyone driving Claude Code hard — and the biggest one quietly changes how much you need to babysit context at all.

Sonnet 5, Chrome GA, Notification Hooks: Catching Up Before You Begin

If you're optimizing your workflow, start from the current build. Claude Code 2.1.197 (June 30, 2026) made Claude Sonnet 5 the default model, with a native 1M-token context window and promotional pricing of $2/$10 per million tokens through August 31, 2026 . That larger ceiling changes the calculus — you can hold more in-session before performance degrades — but it doesn't retire disciplined context management; it just raises the threshold.

The next day, 2.1.198 (July 1, 2026) made Claude in Chrome generally available on isolated Anthropic cloud VMs with no local install, and changed background agents to commit, push, and open draft PRs after working in a worktree . It also added two background-agent notification hook events — agent_needs_input and agent_completed — worth wiring if you run unattended sessions, plus a bundled /dataviz skill .

Version discipline matters: the Homebrew stable cask trails latest by roughly a week, while npm and the native installer auto-update. Confirm with claude --version before trusting any version-gated behavior .

Orientation and Prerequisites

A Bloated CLAUDE.md Teaches Claude to Ignore You

Before wiring Claude Code into anything durable, check three things: version, context budget, and permissions. Several features are version-gated — /run, /verify, and /run-skill-generator need v2.1.145+, while claude mcp login/logout and --no-browser OAuth over SSH need v2.1.186+ . Confirm with claude --version; note that claude --help does not list every flag .

CLAUDE.md has a hard cap: only the first 200 lines or 25KB load per session — anything beyond is silently dropped . Audit before you trust it:

wc -l CLAUDE.md   # line count — must stay under 200
wc -c CLAUDE.md   # byte size — must stay under 25000

Run a headless sanity check before touching CI — it validates your OAuth token, model access, and tool permissions in one call:

claude -p 'echo ok' --output-format json

Finally, know the permissions ladder: default → acceptEdits → plan → auto (a research preview) → dontAsk → bypassPermissions . Reserve bypassPermissions for isolated containers or VMs — it disables all tool-call guards, so never run it in a local environment with live credentials.

Leverage Areas: CLAUDE.md Trim, Slash Commands, Subagents, Hooks

A Bloated CLAUDE.md Teaches Claude to Ignore You

The highest-leverage move is counterintuitive: shrink CLAUDE.md. A bloated file causes Claude to ignore instructions, and the documented fix for a persistently-ignored rule is to prune the file or convert the rule into a hook . Move multi-step procedures into .claude/skills/<name>/SKILL.md with YAML frontmatter — skill bodies load only when the skill is invoked, so they cost nothing until used. On a name conflict between a skill and a slash command, the skill wins . One caveat to plan around: after /compact, invoked skill bodies re-inject capped at 5,000 tokens per skill and 25,000 tokens total , so keep individual SKILL.md bodies tight.

Slash commands add three practical wins. Set disable-model-invocation: true on side-effecting skills you want to trigger manually — /fix-issue 1234, for example — so the model never fires them on its own. Use /btw <question> to answer a side question in a dismissible overlay that never enters conversation history, keeping context clean. And pass custom instructions to /compact so summarization retains what matters instead of guessing .

Subagents live in .claude/agents/<name>.md, each running in a separate context window and returning only a summary to the main session . Pin an adversarial reviewer to a strong model and cheap classifiers to a fast one:

---
name: security-reviewer
model: claude-opus-4-5
tools: [Read, Grep]
---
Review the diff for injection, auth, and secret-handling flaws.
Report only findings and severities.

Because subagents isolate large file reads, they suit high-volume research, a Writer/Reviewer split across two fresh contexts, or any work that would otherwise fill the main session (video: Simon Scrapes).

Hooks in .claude/settings.json (browse via /hooks) are deterministic, not advisory. PreToolUse is the primary security checkpoint, and its exit code decides the tool call:

Exit codeBehavior
2Blocks the tool call outright
1Allows the call, logs a warning
0Allows the call cleanly

Claude Code overrides the hook after 8 consecutive blocks , so never gate on flaky or slow-exit conditions — a hook that blocks unreliably will simply be bypassed. For hard isolation beyond hook logic, /sandbox adds OS-level filesystem and network confinement .

Gotchas to Know About

A Bloated CLAUDE.md Teaches Claude to Ignore You

Most of these traps are silent — Claude Code does not warn you when a limit truncates your config or when a checkpoint fails to capture side effects. Five ceilings and boundaries are worth memorizing before you lean on the automation described above .

  • Skill token ceiling after compaction. Once the context is compacted, re-injected skill bodies are capped at 5,000 tokens per skill and 25,000 tokens total . An oversized SKILL.md hits this ceiling silently and loses its tail content — split long procedures into smaller skills instead of one monolith.
  • Checkpoints are undo, not version control. /rewind snapshots files before each change but tracks only Claude's edits, not external processes like seed scripts, DB migrations, or build artifacts . Commit to git separately before running destructive automation.
  • Hook override at 8 blocks. A Stop hook that fires every turn is bypassed after 8 consecutive blocks . Design hooks to pass quickly on nominal cases and block only on genuine violations.
  • --add-dir does not trigger CLAUDE.md discovery. The flag grants file read/write access to an extra directory but does not auto-load that path's project CLAUDE.md . Reference it explicitly with @path/to/CLAUDE.md.
  • Auto memory has a load window. Captured build commands and debugging notes only load the first 200 lines or 25KB per session . Audit periodically so stale entries do not crowd out current ones.

What Comes After: Headless CI, Fan-out, and Adversarial Subagents

Once your interactive setup is stable, the next leverage is unattended scale. Headless mode runs Claude Code non-interactively for CI, pre-commit hooks, and batch jobs. Scope the blast radius explicitly and pipe context in rather than pasting it:

cat error.log | claude -p "triage this stack trace" --output-format stream-json --verbose

git diff | claude -p "review for regressions"

claude -p "migrate to the new API" --allowedTools "Edit,Bash(git commit *)"

The --allowedTools allowlist is the safety boundary for unattended runs — it caps what an agent can touch across many files.

Fan-out per file: create a git worktree per target file and run claude -p in each, or offload to Claude Code on the web, which runs in isolated cloud VMs for true process isolation without local git overhead. Background agents launched from claude agents work in a worktree, then commit, push, and open draft PRs on their own as of Claude Code 2.1.198 (July 1, 2026).

Adversarial review: add .claude/agents/security-reviewer.md pinned to model: claude-opus-4-5. It runs in separate context and receives only summaries from the main session, so its critique carries no normalization bias from having watched you build.

"Subagents run in separate context and return only summaries — ideal for adversarial review that keeps large file reads out of the main context," per Anthropic's best-practices documentation.

MCP and plugins: claude mcp add <name> <server-url> wires Notion, Figma, GitHub, Slack, and databases into tool calls; use claude mcp login --no-browser for OAuth over SSH (v2.1.186+) . Plugins (/plugin) bundle skills, hooks, subagents, and MCP servers into one installable unit. The takeaway: trim CLAUDE.md, scope permissions, and push repeatable work into headless runs and fresh-context subagents — that is where the leverage compounds.

Frequently asked questions

Does /compact save tokens or just reorganize context?

It does both, but net savings are not guaranteed. /compact summarizes the conversation and discards granular history, shrinking the context window. The catch: after compaction, any active skill bodies re-inject, capped at 5,000 tokens per skill and 25,000 tokens total . So if you have several skills loaded, the reclaimed space is smaller than expected. Pass custom instructions — /compact focus on the auth refactor — to steer what the summary keeps.

When should I use a subagent instead of a skill?

Choose by context boundary. Skills run inside the main session and return full output, so they suit templated prompts and domain logic that benefit from the current conversation history. Subagents run in a separate context and return only a summary . Reach for a subagent when you need isolation: adversarial review with a fresh perspective, parallel tasks, or high-volume research that would otherwise flood the main context with large file reads.

How do I wire a PreToolUse hook to block a specific tool call?

Add a PreToolUse entry under hooks in .claude/settings.json. The shell command receives the tool name and arguments as JSON on stdin, and its exit code decides the outcome: 2 blocks the call, 1 warns and allows, 0 allows clean . Watch the 8-consecutive-block override — Claude Code bypasses the hook after eight straight blocks, so never gate on intermittent or slow conditions you expect to fail repeatedly.

Is Claude Code in Chrome the same as the terminal version?

Functionally close, but not identical. Chrome uses the same model and tool primitives, yet runs in isolated Anthropic cloud VMs with no local install. Background agents launched there commit, push, and open draft PRs after working in a worktree . Claude in Chrome reached general availability in Claude Code 2.1.198 on July 1, 2026 .

Why is my Homebrew Claude Code version behind?

The Homebrew stable cask tracks releases roughly one week behind latest, and it needs manual upgrades . For same-day auto-updates, use the native direct installer, which updates in the background. Whatever the channel, confirm with claude --version before relying on version-gated features — /run and /verify need v2.1.145+, and claude mcp login needs v2.1.186+ .