Summary
Add an execution mode property (plan / normal / auto-accept) to workflow group nodes, enabling automatic mode verification at group entry with user-guided mode switching when a mismatch is detected.
This feature applies only to Claude Code Export/Run — it does not affect other AI agent integrations (Copilot CLI, Codex CLI, etc.) or the MCP-based AI editing workflow.
Motivation
Different phases of a workflow require different levels of Claude Code's execution mode:
- Phase A (design/review): Plan mode — read-only planning, no file modifications
- Phase B (implementation): Auto-accept mode — execute changes without confirmation prompts
By associating an expected mode with each group, workflows can enforce the appropriate safety level per phase.
Investigation Results
Mode Control Feasibility
| Mode |
CLI/API Control |
Prompt Control |
Feasibility |
| Plan mode |
EnterPlanMode tool is invoked by Claude itself; no external CLI flag |
Can be prompted via instructions |
○ Feasible |
| Normal mode |
ExitPlanMode is registered in AVAILABLE_TOOLS |
Default behavior |
◎ Feasible |
| Auto-accept |
CLI flag (--dangerously-skip-permissions) only at session startup; no dynamic toggle |
Cannot be controlled via prompt |
× Not programmable |
Mode Detection
- Claude Code can self-report its current mode (Plan / Normal) at runtime
- There is no dedicated API/tool to return the mode, but prompting "check your current mode" reliably works
- Auto-accept mode status is not detectable from within the session
Key Constraint
Auto-accept cannot be toggled mid-session. The proposed UX handles this by prompting the user to switch modes manually and verifying the result, rather than attempting programmatic control.
Proposed UX Flow
Group entry
↓
Check current mode → Compare with expected mode
↓
├─ Match → Proceed with execution
└─ Mismatch
↓
Display: "Expected: Plan mode / Current: Normal mode"
"Please press Shift+Tab to switch to Plan mode"
↓
AskUserQuestion:
1. I've switched — re-check
2. Ignore and proceed as-is
↓
├─ 1 → Re-check mode (loop)
└─ 2 → Continue with current mode
Implementation Plan
1. Schema Update (resources/workflow-schema.json)
Add mode property to group.fields:
"group": {
"fields": {
"label": { "type": "string", "required": true, "default": "Group" },
"mode": {
"type": "enum",
"values": ["plan", "normal", "auto-accept", "none"],
"required": false,
"default": "none",
"description": "Expected Claude Code execution mode for this group. Only used during Claude Code Export/Run."
}
}
}
2. Type Update (src/shared/types/workflow-definition.ts)
export interface GroupNodeData {
label: string;
mode?: 'plan' | 'normal' | 'auto-accept' | 'none';
}
3. Prompt Generation (src/extension/services/workflow-prompt-generator.ts)
Claude Code Export/Run only. When a group has a mode set, generate instructions at group entry to:
- Self-check current mode
- Compare with expected mode
- If mismatch: display switching instructions and present re-check / skip options via
AskUserQuestion
Other AI agent export formats (Copilot, Codex, etc.) will ignore the mode property.
4. UI (Webview)
Add a mode dropdown to the group node configuration panel.
Scope
- In scope: Plan / Normal / Auto-accept mode verification and user-guided switching during Claude Code Export/Run
- Out of scope:
- Programmatic auto-accept toggling (technically impossible mid-session)
- Mode control for non-Claude Code agents (Copilot CLI, Codex CLI, etc.)
- MCP-based AI editing workflow
Summary
Add an execution mode property (
plan/normal/auto-accept) to workflow group nodes, enabling automatic mode verification at group entry with user-guided mode switching when a mismatch is detected.This feature applies only to Claude Code Export/Run — it does not affect other AI agent integrations (Copilot CLI, Codex CLI, etc.) or the MCP-based AI editing workflow.
Motivation
Different phases of a workflow require different levels of Claude Code's execution mode:
By associating an expected mode with each group, workflows can enforce the appropriate safety level per phase.
Investigation Results
Mode Control Feasibility
EnterPlanModetool is invoked by Claude itself; no external CLI flagExitPlanModeis registered inAVAILABLE_TOOLS--dangerously-skip-permissions) only at session startup; no dynamic toggleMode Detection
Key Constraint
Auto-accept cannot be toggled mid-session. The proposed UX handles this by prompting the user to switch modes manually and verifying the result, rather than attempting programmatic control.
Proposed UX Flow
Implementation Plan
1. Schema Update (
resources/workflow-schema.json)Add
modeproperty togroup.fields:2. Type Update (
src/shared/types/workflow-definition.ts)3. Prompt Generation (
src/extension/services/workflow-prompt-generator.ts)Claude Code Export/Run only. When a group has a
modeset, generate instructions at group entry to:AskUserQuestionOther AI agent export formats (Copilot, Codex, etc.) will ignore the
modeproperty.4. UI (Webview)
Add a
modedropdown to the group node configuration panel.Scope