Skip to content

v2.1.84+: subagents lose CLAUDE.md context (omitClaudeMd:true), reduced instruction adherence with prompt caching #40459

@alessandropcostabr

Description

@alessandropcostabr

Summary

Since v2.1.84, Claude Code subagents (Explore, Plan, built-in agents) no longer receive the user's CLAUDE.md instructions. This causes subagents to ignore project-specific rules (language preferences, environment configurations, code conventions).

Additionally, the prompt caching change for ToolSearch users means CLAUDE.md content in the main prompt receives less model attention as cached tokens vs. fresh tokens.

Root cause (binary analysis)

I extracted and compared cli.js from npm packages v2.1.83 through v2.1.87. Three changes were introduced in v2.1.84:

1. omitClaudeMd: true on built-in subagents (NEW in v2.1.84)

// v2.1.83: omitClaudeMd did NOT exist
// v2.1.84+: two built-in agents have omitClaudeMd:true
{agentType:"Explore", model:"haiku", omitClaudeMd:true, ...}
{model:"inherit", omitClaudeMd:true, ...}

Combined with the new feature flag tengu_slim_subagent_claudemd (default: true), subagents are stripped of CLAUDE.md context.

2. System prompt global cache now enabled with ToolSearch

// v2.1.83: ANY MCP tool → skip global cache
W = tools.some(t => t.isMcp === true)
G = globalCacheEnabled && (W || Z)
mode = globalCacheEnabled ? (G ? "none" : "system_prompt") : "none"

// v2.1.84: only NON-deferred MCP tools → skip global cache
Z = t => isDeferred(t) || isToolSearch(t)
G = globalCacheEnabled && tools.some(t => t.isMcp && !Z(t))
mode = globalCacheEnabled ? (G ? "none" : "system_prompt") : "none"

For users with MCP tools + ToolSearch (all tools deferred), the system prompt (including CLAUDE.md) is now globally cached. Cached tokens receive less attention from the model.

3. deferLoading changed from global flag to per-tool

// v2.1.83: global decision
deferLoading: toolSearchEnabled && (isDeferred(tool) || otherCondition(tool))

// v2.1.84: per-tool decision
deferLoading: isDeferred(tool)

Observed impact

In a real work session after updating to v2.1.85/86, with 6+ MCP servers configured:

Issue Before (v2.1.83) After (v2.1.84+)
Subagent follows CLAUDE.md language rules Yes No — responded in English during skill execution
Subagent knows project environments Yes No — confused DEV/PROD labels, required 5+ user corrections
Model makes categorical claims from partial data Rare Frequent — declared "zero data for 7+ days" from cancelled parallel queries
User corrections needed per session ~0 5+

Specific example

My CLAUDE.md explicitly states:

- DEV: ~/project-dev → branch develop, port 3001 (ServerA .254)
- PROD: ~/project-prod → branch main, port 3100 (ServerB .253, SSH access)

After v2.1.84, the model:

  1. SSH'd to the correct PROD server but labeled results as "DEV" in the analysis table
  2. Declared 3 "bugs" in the metrics pipeline — one was actually a TODO, not a bug
  3. Required multiple corrections: "Don't look at DEV, look at PROD!!!! .253 ~/project-prod!!!!"

Workaround

Patching cli.js from the npm package:

# Patch 1: Give subagents their CLAUDE.md back
sed -i 's/omitClaudeMd:!0/omitClaudeMd:!1/g' cli.js

# Patch 2: Disable slim subagent feature
sed -i 's/"tengu_slim_subagent_claudemd",!0/"tengu_slim_subagent_claudemd",!1/g' cli.js

After applying these patches, re-running the same analysis task showed:

  • 100% correct DEV/PROD labels
  • No fabricated bugs — properly separated "observations" from "bugs"
  • Correct language throughout (including subagent outputs)

Suggestion

  1. Make omitClaudeMd configurable — either via env var or settings.json. Users with project-specific CLAUDE.md rules need subagents to follow them.
  2. Consider a CLAUDE_CODE_DISABLE_SUBAGENT_CLAUDEMD_TRIM env var — similar to CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS but targeted.
  3. Cached tokens attention: Document the trade-off between cost savings from prompt caching and reduced instruction adherence, especially for users with detailed CLAUDE.md files.

Environment

  • Claude Code v2.1.84 through v2.1.87
  • Linux x86_64
  • 6 MCP servers configured (ToolSearch enabled, all tools deferred)
  • Detailed CLAUDE.md with language, environment, and code convention rules

Versions analyzed

Version Date Key change
2.1.83 2026-03-24 Baseline (no issues)
2.1.84 2026-03-25 omitClaudeMd, cache with ToolSearch, per-tool deferLoading
2.1.85 2026-03-26 Compact retry fix, tree-sitter expansion
2.1.86 2026-03-27 File read dedup, compact line prefix
2.1.87 2026-03-28 Same flags as 2.1.86

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:agentbugSomething isn't workinghas reproHas detailed reproduction stepsplatform:linuxIssue specifically occurs on LinuxregressionstaleIssue is inactive

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions