[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_
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗