Subagents lack deterministic context injection for platform, tools, and environment constraints

Resolved 💬 3 comments Opened Feb 15, 2026 by fodurrr Closed Feb 19, 2026

Problem

Claude Code spawns subagents (both built-in types like statusline-setup and Task-spawned agents) without injecting platform context, tool availability, or environment constraints. The parent session has this information — from the system prompt, CLAUDE.md, and detected environment — but does not pass it through to subagents.

This is not about making CLAUDE.md directly visible to subagents. It's about Claude Code lacking a deterministic mechanism to extract and inject the relevant operational context from the parent session into every subagent automatically.

Expected behavior

Claude Code should have a deterministic mechanism that automatically injects into every subagent prompt:

  • OS and shell (e.g., Windows 11 + Git Bash — not Linux)
  • Tool inventory (what's available, what's explicitly NOT available)
  • Verification requirements (don't report success without testing)
  • User-defined constraints from CLAUDE.md that affect execution (not the whole file — just operational rules)

Actual behavior

Subagents start with a blank slate. They assume Linux defaults, use tools like \jq\, \python\, \curl\ without checking availability, and report "done" without any verification.

Concrete example

The \statusline-setup\ built-in subagent on a Windows 11 corporate laptop (no admin, no WSL):

  1. Generated a bash script depending on \jq\ — a tool explicitly listed as unavailable in CLAUDE.md
  2. Assumed a Linux environment throughout
  3. Reported "success" without the target file being created
  4. Never ran any verification command (\where jq\, \command -v jq\, or checking the output file exists)

The parent session knew all of this — OS, shell, tool inventory, verification rules — but none of it was passed to the subagent.

Current workaround

The user must add:

  • PreToolUse hooks to block the Task tool entirely
  • CLAUDE.md rules refusing subagent delegation
  • Manual instructions to paste full context into every subagent prompt

This defeats the purpose of having subagents.

Impact

Claude Code feels significantly degraded for anyone with non-default environments (Windows, corporate restrictions, custom tool inventories). The more work gets delegated internally to context-blind subagents, the worse the results become. Users on standard Linux/macOS setups may not notice, but Windows and restricted-environment users are hit hard.

Proposed solution

A deterministic context-injection layer that:

  1. Extracts platform facts from the parent session (OS, shell, tool inventory, detected environment)
  2. Extracts relevant CLAUDE.md constraints — not the whole file, just operational rules that affect execution (e.g., "verify before reporting done", "these tools are NOT available")
  3. Injects this as a structured context block into every subagent system prompt — automatically, without user intervention
  4. Works for all subagent types — both built-in (statusline-setup, etc.) and user-spawned Task agents

This would make subagents context-aware by default, rather than requiring users to manually compensate for lost context on every delegation.

Environment

  • Windows 11 Enterprise (no admin rights, no WSL/WSL2)
  • Shell: Git Bash (via Git for Windows)
  • Claude Code: latest
  • Corporate laptop with TLS inspection, restricted network, no Docker

View original on GitHub ↗

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