[BUG] Subagent ignores system_prompt when generating execution prompts

Resolved 💬 6 comments Opened Sep 12, 2025 by yaleh Closed Jan 8, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Summary

Claude Code's subagent feature is not properly utilizing the system_prompt field when generating prompts for task execution. Instead, it appears to only use the name and description fields, resulting in prompts that don't follow the specified system instructions.

Environment

  • Product: Claude Code
  • Feature: Subagents
  • Agent Configuration: .claude/agents/ directory structure

Bug Description

When executing tasks through subagents, Claude Code generates prompts based only on the agent's name and description fields, completely ignoring the system_prompt field that contains the core behavioral instructions.

What Should Happen?

  • Subagent execution prompts should incorporate the full system_prompt content
  • The generated prompt should reflect the specific methodology and instructions defined in the agent's system prompt
  • Agent behavior should align with the defined system prompt specifications

Error Messages/Logs

● prompt-rewriter(Task: Rewrite stage-executor.md (using prompt-rewriter agent)

                 Prompt: Please rewrite the content of the file
                 stage-executor.md. First read the current content of this file
                 to understand what it contains, then rewrite it to improve clarity, structure,
                 and effectiveness while maintaining its core purpose and functionality. The
                 rewritten version should be more polished and professional while preserving all
                  essential information and instructions.)
  ⎿  Read(file_path: "/workspaces/prompt_evaluating/stage-executor.md")
     ---
       You are a Stage Executor agent that implements development plan stages with strict
     adherence to specifications.

       ## Execution Protocol

Steps to Reproduce

Reproduction Steps

  1. Create a subagent configuration file (e.g., .claude/agents/prompt-rewriter.md) with:
---
name: prompt-rewriter
description: Rewrite prompts.
---

You are a semantic-preserving prompt rewriter focused on maximizing information density while maintaining complete functional equivalence.

When invoked:
1. Parse the input prompt to extract core intent, domain context, and methodology
2. Identify all explicit requirements and infer implicit constraints
3. Begin compression analysis immediately

Compression checklist:
- Intent and functionality fully preserved
- Domain-specific best practices integrated
- Mathematical/logical notation used where applicable
- Lambda calculus and set theory notation preferred over prose
- Pattern recognition applied (SOLID, PDCA, FSM principles)
- Information density maximized per token
- All original requirements mapped to compressed form
- Zero semantic loss verified

Provide output organized by sections:
- **Compressed Version** (optimized prompt)
- **Coverage Analysis** (requirement mapping table)
- **Enhancement Log** (additions and improvements made)
- **Verification Proof** (semantic equivalence confirmation)

Include specific examples showing how original concepts were preserved in compressed form.

Apply recursive optimization: use these same principles to compress subsequent prompts, learning from each iteration to improve compression ratios while maintaining perfect semantic fidelity.
  1. Invoke the subagent with a task:

``
Rewrite @stage-executor.md with prompt-rewriter .
``

  1. Press Ctrl-R to show the detailed transcript.

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

1.0.112 (Claude Code)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

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