@-imports in CLAUDE.md not expanded in subagent context (Agent tool): docs say they are loaded at launch

Resolved 💬 3 comments Opened May 14, 2026 by changyu87 Closed May 17, 2026

Summary

The official Claude Code documentation states that @-imported files in CLAUDE.md are expanded and loaded into context at launch. Our controlled experiment shows this does not happen when a subagent is launched via the Agent tool with a working directory that contains a CLAUDE.md using @-imports.

Documentation Claims

From the official Claude Code docs:

"Imported files are expanded and loaded into context at launch alongside the CLAUDE.md that references them." "Imported files can recursively import other files, with a maximum depth of five hops" "Both relative and absolute paths are allowed."

Reproduction Steps

  1. Create /home/cyxu/workflow-dev/rabbit-marathon/import-test/CLAUDE.md containing only three @-import lines:

``
@/home/cyxu/workflow-dev/stash/alpha.md
@/home/cyxu/workflow-dev/stash/beta.md
@/home/cyxu/workflow-dev/stash/gamma.md
``

  1. Create the three imported files, each with a single unique fact (deliberately obscure, impossible to guess):
  • alpha.md: "what I'm looking at is a bus running by"
  • beta.md: "universe is made from nothing"
  • gamma.md: "Beyond is my favorite band"
  1. Launch a Claude Code subagent via the Agent tool with the working directory set to import-test/.
  1. Ask the agent:
  • (1) What am I looking at?
  • (2) What is the universe made from?
  • (3) Who is my favorite band?

Expected Behavior

The agent should have answered all three questions correctly, because according to the documentation the @-imports in CLAUDE.md are expanded and loaded into the agent's context at launch time.

Actual Behavior

The agent answered none of the three correctly. It had no knowledge of the facts from the imported files. The CLAUDE.md was treated as if it contained no instructions — @-imports were not expanded.

Analysis

It is unclear whether this is:

  • A bug in the Agent tool: subagents launched via Agent do not honor the working directory's CLAUDE.md @-imports the way a top-level Claude Code session would, or
  • A documentation error: @-import expansion only works in the top-level Claude Code session, not in subagents launched via Agent.

Either way, the observed behavior does not match what the documentation leads users to expect.

Impact

This affects architectural decisions for multi-agent workflows. If CLAUDE.md @-imports are expected to carry instructions into subagent context (a reasonable expectation given the docs), teams building subagent-driven pipelines will silently lose those instructions. The failure is invisible — the subagent receives no error, it simply ignores the imported content.

This is particularly impactful for workflows that rely on modular CLAUDE.md composition via @-imports to deliver policies, schemas, or behavioral constraints to dispatched subagents.

Environment

  • Platform: Linux
  • Shell: tcsh
  • Subagent launch method: Agent tool with explicit cwd pointing to the directory containing the CLAUDE.md with @-imports

View original on GitHub ↗

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