Add hook or customization point for Plan Mode exit/plan delivery
Problem
When Plan Mode exits and the user accepts a plan, Claude Code sends the plan to the agent with hardcoded text like:
Implement the following plan:
[plan content]
This bypasses any custom workflows that projects may have set up via hooks. For example:
- A
PreToolUsehook onExitPlanModecan injectadditionalContextwith governance instructions - But the agent receives the plan as a direct prompt with "Implement the following plan:"
- The agent focuses on implementation and may skip the governance steps in the advisory context
- Result: Plans get implemented but GitHub issues aren't updated, acceptance criteria aren't checked, etc.
Current Behavior
- User enters Plan Mode (Shift+Tab)
- Agent creates a plan
- User accepts the plan
- Claude Code sends plan to agent with hardcoded "Implement the following plan:" instruction
- Any
PreToolUsehooks onExitPlanModeprovide only advisoryadditionalContext - Agent may ignore advisory context and jump straight to implementation
Requested Solution
One of:
Option A: New Hook Event
Add a hook event like PlanAccepted or PostPlanMode that fires when a plan is accepted, allowing projects to:
- Transform or augment the plan delivery prompt
- Inject mandatory steps before implementation begins
- Trigger external workflows (GitHub issue creation, etc.)
Option B: Customizable Plan Delivery Template
Allow projects to customize the text sent with the plan via settings:
{
"planMode": {
"deliveryTemplate": "Before implementing, update GitHub issue #{{issue_number}} with this plan. Then implement:\n\n{{plan_content}}"
}
}
Option C: Make ExitPlanMode Hook Output More Actionable
Currently additionalContext is advisory. Consider allowing hooks to specify requiredActions or preConditions that the agent must complete before proceeding with implementation.
Use Case
Our project uses GitHub Issues as the source of truth for plans. When Plan Mode exits, we need to:
- Create/update a GitHub issue with the plan content
- Run validators (plan-validator, issue-scoper)
- Add
readylabel if Definition of Ready passes - Only then proceed with implementation
Currently, we have an exit-plan-mode.ts hook that injects these instructions, but they're often skipped because the agent sees "Implement the following plan:" and jumps to coding.
Environment
- Claude Code version: Latest
- OS: macOS
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗