Skip to content

Subagents do not inherit CLAUDE.md / AGENTS.md context #623

Closed

Description

@carlos-algms

Subagents dispatched via the Agent tool over ACP do not receive project memory (CLAUDE.md / AGENTS.md). The standalone claude CLI dispatches the same subagent with the context loaded.

Repro

Project root:

CLAUDE.md:

CLAUDE_MD_PROBE_TOKEN = "tangerine-orbit-7421"

AGENTS.md:

AGENTS_MD_PROBE_TOKEN = "saffron-glacier-9038"

Prompt to subagent:

What is the value of CLAUDE_MD_PROBE_TOKEN, and AGENTS_MD_PROBE_TOKEN? Do NOT run commands or tools. Answer from context only. If absent, say "not in context".

ACP path (broken)

Subagent (haiku, sonnet, opus — same result):

CLAUDE_MD_PROBE_TOKEN: not in context
AGENTS_MD_PROBE_TOKEN: not in context

CLI path (works)

claude --print --dangerously-skip-permissions --model claude-opus-4-7 \
  'Use Agent tool, subagent_type=general-purpose, model=haiku. Ask: "What is the value of CLAUDE_MD_PROBE_TOKEN, and AGENTS_MD_PROBE_TOKEN? Do NOT run commands or tools. Answer from context only. If absent, say not in context." Report the answer.'

Output:

CLAUDE_MD_PROBE_TOKEN = "tangerine-orbit-7421"
AGENTS_MD_PROBE_TOKEN = "saffron-glacier-9038"

Workaround

Prepend Read CLAUDE.md first. to the subagent prompt:

Read CLAUDE.md first. What is the value of CLAUDE_MD_PROBE_TOKEN, and AGENTS_MD_PROBE_TOKEN? If absent, say "not in context".

Subagent then resolves both values via the @AGENTS.md import chain. The loader works; only auto-injection on ACP dispatch is missing.

Activity

  1. benbrandt commented on May 3, 2026

    @benbrandt
    Member

    I suspect this is a claude sdk issue as we aren't doing anything special here

  2. unitedideas commented on May 13, 2026

    @unitedideas

    The repro is useful because it separates two different failures: the loader can resolve the @AGENTS.md chain, but the ACP-spawned subagent does not receive the same injected instruction context as the CLI-spawned subagent.

    One validation row that might make the fix easier to hold: record instruction provenance on each child-agent spawn, not only the final text. For example:

    1. Root CLAUDE.md discovered: yes/no + path.
    2. AGENTS.md import chain resolved: yes/no + path list.
    3. Context delivery mode: auto-injected vs explicit Read CLAUDE.md first. workaround.
    4. Child-visible probe tokens before any tool call.

    That keeps this from being treated as a generic AGENTS.md parsing bug when the real gap is spawn-time context delivery. We use the same distinction in no-data Claude Code -> Codex migration checks: https://bringyour.ai/codex-import-checklist.json

  3. benbrandt commented on May 21, 2026

    @benbrandt
    Member

    I looked at this and for whatever reason the agent sdk isn't propagating this, but it isn't a misconfiguration of the sdk as far as I can tell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions