[FEATURE] Resumable Subagent Sessions (Persistent Multi-Turn Context via Session ID)

Status Closed — not planned
Maintainer reply None cached
Activity 7 comments · opened Sep 8, 2025 · closed Jan 29, 2026

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.

  1. Resume the backend subagent with its subagent_session_id and ask a targeted follow-up; it replies with the fix approach.
  2. 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_

View original on GitHub ↗

7 Comments

github-actions[bot] · 10 months ago

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.

ohcedar · 10 months ago

Commenting to keep open.

tiptenbrink · 9 months ago

Any other tools which already do this that could inspire the design of this feature?

ohcedar · 9 months ago
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.

github-actions[bot] · 8 months ago

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.

marcindulak · 8 months ago

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.

github-actions[bot] · 8 months ago

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.