Plan mode: Add 'Delegate to Agent' option for plan execution
Summary
When a plan is created in plan mode, the current options are:
- Accept and execute
- Clear context and execute
- Edit plan
Missing option: "Delegate to Agent" — spawn a subagent that executes the plan in an isolated context, then returns the result to the planning conversation.
Why this is better than "Clear context and execute"
The "clear context" option (now hidden by default, re-enabled via showClearContextOnPlanAccept) solves the token efficiency problem but creates a new one: the planner loses all context.
Delegating to an agent would give the best of both worlds:
- Isolated context for execution: The agent starts clean with only the plan — same token savings as clearing context
- Planner retains full context: The original conversation keeps all research, discussion, and nuance that informed the plan
- Review capability: The planner can evaluate the agent's results against its deeper understanding — did the agent miss something that was discussed but not explicitly in the plan?
- Targeted follow-up: If the agent completed 18/20 steps correctly, the planner can fix the remaining 2 with full knowledge, instead of starting from scratch
The analogy
"Clear context and execute" = erase your memory, then do the work
"Delegate to agent" = brief a colleague, review their work
The second approach is obviously superior for complex plans.
Token efficiency argument
This is especially relevant given the discussion around #38071. The 1M context window solved the capacity problem, but not the efficiency problem. Users hit session/rate limits faster when carrying unnecessary context through every execution step.
Agent delegation solves both: the agent runs lean (plan-only context), and the planner doesn't waste tokens re-reading files it already knows about.
Implementation
The infrastructure already exists — the Agent tool can spawn subagents with isolated context. Plans are already structured as step-by-step instructions, which is the ideal format for an agent prompt. This would essentially be a fourth menu item in the plan acceptance UI.
---
🤖 Generated with Claude Code
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗