[FEATURE] Resumable Subagent Sessions (Persistent Multi-Turn Context via Session ID)
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Claude Code subagents are stateless: each invocation starts with a clean slate, so you can’t “continue” a prior subagent exchange. Any follow-up requires replaying context, which increases latency and token/compute cost. By contrast, the main Claude Code session can be resumed by ID, but that capability doesn’t exist for subagents.
Proposed Solution
Introduce stateful subagent sessions:
• On first invocation, the subagent returns a subagent_session_id.
• Subsequent calls can pass that ID to resume the subagent with full prior turns (messages, tool outputs, scratch state) restored.
• Provide CLI ergonomics (e.g., --agent <name> --agent-resume <id>) and programmatic APIs to create/continue/close sessions; include TTL, max-turn, and size limits.
This mirrors existing main-session resume semantics while remaining scoped to each subagent.
Alternative Solutions
Replay everything: Re-invoke the subagent with the original prompt plus the new ask. This burns tokens, adds latency, and risks prompt drift or omissions.
Priority
Medium - Would be very helpful
Feature Category
CLI commands and flags
Use Case Example
You’re shipping a feature that spans backend and frontend. You invoke two subagents: backend-specialist and frontend-specialist. After initial outputs, integration breaks.
- Resume the backend subagent with its subagent_session_id and ask a targeted follow-up; it replies with the fix approach.
- Resume the frontend subagent with its own subagent_session_id, reference the backend’s answer, and apply the corresponding UI change.
Because both conversations are continued (not restarted), neither subagent has to re-rebuild context, so the loop is faster, cheaper, and more reliable.
Additional Context
_No response_
7 Comments
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Commenting to keep open.
Any other tools which already do this that could inspire the design of this feature?
https://github.com/BeehiveInnovations/pal-mcp-server
PAL MCP (formerly Zen) has this concept and it works well.
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Please upvote that issue, so maybe it gets noticed.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.