Allow configurable inheritance of system prompt and memory for subagents
Description
Currently, subagents always inherit:
- The system prompt
- User memory (personal context)
- Project memory (project-level history)
This behavior leads to huge token overhead, even for very simple subagents.
In one test, a “tiny” subagent that only runs echo success consumed \~60k tokens because it inherited the full parent memory and context.
However, when the same subagent was tested in an environment with no user or project memory, it consumed only \~3k tokens — basically just the system prompt overhead.
This clearly shows how much token usage could be reduced if inheritance were configurable.
Developers need a way to explicitly configure what a subagent inherits, just like how tools are defined.
Here’s a polished description you can place below the “Description” section in the issue to explain the images clearly:
---
To illustrate the problem, here are three test scenarios comparing agent-tiny and agent-mega:
agent-tiny→ can only use the Bash tool.agent-mega→ can use all tools and MCP integrations.
Image 1: Clean environment (no extra context)
- Only the system prompt is present.
- Token usage stays very low (\~3k tokens).
<img width="1101" height="804" alt="Image" src="https://github.com/user-attachments/assets/971d9dba-7192-4819-a5b9-4ae28a86fa89" />
Image 2: MCP added
- MCP tools are included in the context.
- Token usage increases due to the MCP tool metadata.
<img width="712" height="495" alt="Image" src="https://github.com/user-attachments/assets/6a43cbed-76c3-4521-a893-02fa8d841635" />
Image 3: User memory + Project memory + MCP added
- Both user-level and project-level memory, plus MCP tools, are included.
- Token usage skyrockets (\~60k tokens or more) even for trivial subagent calls.
<img width="1093" height="1197" alt="Image" src="https://github.com/user-attachments/assets/a909db88-a619-4b5c-96a3-c5edd75239d2" />
---
Steps to Reproduce
- Create a simple subagent with:
``yaml``
tools: Bash
- Invoke the subagent and run
/context. - Compare the token usage:
- With user/project memory: \~60k tokens consumed.
- Without user/project memory: \~3k tokens consumed.
---
Proposed Syntax
tools: Read, Write, Bash
includes: System, User, Project, Subagent
Suggestion: Just liketools, allow a field such asincludesormemoriesto clearly specify what context is inherited.
Descriptions:
- System: Inherit the parent agent’s system prompt (cannot be disabled if core behavior requires it).
- User: Inherit the user-level memory (personal context/history).
- Project: Inherit the project-level memory (project history and context).
- Subagent: Use independent, persistent memory specific to this subagent.
---
Benefits
- Token efficiency: Prevent wasted tokens when subagents don’t need user or project context.
- Role isolation: Avoid “context pollution” in specialized subagents.
- Lightweight agents: Create extremely small and efficient agents (\~3k tokens usage).
- Flexibility: Still allow full inheritance when necessary for complex workflows.
---
Related Issues
- \#4418 – Discusses subagent memory but doesn’t support explicit inheritance control.
- \#1770 – Focuses on monitoring and parent-child communication, not inheritance configuration.
---
Summary
Introducing an includes (or memories) field — modeled after tools — would make configuration intuitive, consistent, and developer-friendly.
This change would let developers build lighter, isolated subagents with minimal token usage, while preserving full inheritance when complex workflows require it.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗