[BUG] Subagents reading outdated versions of files

Resolved 💬 5 comments Opened Jul 5, 2025 by milobird Closed Jan 3, 2026

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other:
  • Claude CLI version: 1.0.43 (Claude Code)
  • Operating System: macOS Darwin 24.5.0
  • Terminal: Terminal.app

Bug Description

Subagents are reading stale/outdated versions of files instead of the current file system state. When a file is modified and saved, subagents continue to use the old content, causing them to execute outdated commands. This appears to be a caching or file synchronization issue specific to how subagents access the file system.

Note that we have confirmed that the prompt given by the parent Claude to the subagent did not contain the flags which were removed from the commands in CLAUDE.md, so the subagent should not have seen them anywhere.

Steps to Reproduce

  1. Create a file with specific instructions (e.g., CLAUDE.md with build/test commands)
  2. Have Claude execute commands from this file via subagents - verify they work
  3. Modify the file to change the commands (in our case, removed GCC_WARN_INHIBIT_ALL_WARNINGS=YES SWIFT_SUPPRESS_WARNINGS=YES flags)
  4. Verify the changes are saved:
  • Run grep -n "GCC_WARN_INHIBIT_ALL_WARNINGS" CLAUDE.md → No results
  • Run git status → Shows clean working tree
  • Have main Claude read the file → Sees updated content correctly
  1. Launch a new subagent Task to execute commands from the same file
  2. Observe subagent executes the OLD version of commands (with removed flags still present)

Expected Behavior

Subagents should read the current file contents from disk, matching what the main Claude instance sees and what filesystem tools (grep, cat, etc.) show.

Actual Behavior

  • Main Claude correctly sees updated file without the flags
  • Filesystem tools (grep, cat) confirm flags are removed
  • Git shows file is saved and clean
  • But subagents still execute commands WITH the removed flags

Additional Context

  • The file CLAUDE.md is tracked in git and shows a clean working tree
  • Multiple edits were made to remove these flags from different sections
  • The main Claude instance can read the updated file correctly
  • Only subagents appear to be affected by this caching issue
  • This makes it impossible to update instructions that subagents follow from files
  • The issue persists across multiple subagent invocations

Timeline of events:

  1. Original CLAUDE.md had warning suppression flags
  2. We removed them to fix a timeout issue
  3. Main Claude verified removal via grep/cat
  4. Subagent still used old version with flags
  5. Issue is reproducible - new subagents continue using stale content

Potential root causes to investigate:

  • Subagents may be reading from a snapshot/cache of the workspace
  • Different file access methods between main Claude and subagents
  • Context/memory persistence across subagent invocations (though they shouldn't have memory)

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗