Plan mode makes AI agents ask clarifying questions and create structured plans before writing code. This prevents wasted time on incorrect implementations and gives you control over the approach.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/21st-dev/1code/llms.txt
Use this file to discover all available pages before exploring further.
Why It Matters
Without planning, agents often:- Make wrong assumptions about requirements
- Pick suboptimal architectures
- Miss edge cases
- Implement features you didn’t actually want
- Asking questions first - Agent clarifies requirements before coding
- Showing the plan - See the approach before execution
- Letting you approve - Review and adjust before any code is written
- Saving time - Avoid backtracking from wrong implementations
How It Works
Two-Phase Execution
Planning Phase
Agent asks clarifying questions and creates a structured plan. No code is written yet.
Enabling Plan Mode
Per Chat:- Start a new chat
- Toggle “Plan Mode” in the header
- Send your prompt - agent enters planning phase
- Go to Settings → Agent Behavior
- Enable “Always use plan mode”
- All new chats will start in planning phase
Planning Phase
Clarifying Questions
The agent identifies gaps in your prompt and asks targeted questions:- Answer all questions at once
- Answer individually (agent asks follow-ups)
- Say “use your judgment” to let the agent decide
Structured Plan
After clarification, the agent creates a markdown plan:src/renderer/features/details-sidebar/sections/plan-widget.tsx:37).
Reviewing the Plan
You can:- Approve - Agent starts execution immediately
- Request changes - “Add 2FA” or “Use OAuth instead of JWT”
- Reject - “This approach won’t work, try X instead”
- Ask questions - “Why bcrypt over Argon2?”
Execution Phase
Once approved, the agent implements the plan step-by-step.Step-by-Step Execution
The agent:- Shows which step it’s working on
- Executes tools for that step
- Moves to the next step
- Reports completion or errors
Plan Deviations
If the agent needs to deviate from the plan:- It explains why
- Proposes an alternative
- Waits for your approval
Plan Tracking
The Plan Widget shows:- Total steps
- Current step
- Completed steps (with checkmarks)
- Pending steps
Plan Mode with Codex
Codex has native plan mode support with enhanced features:Extended Planning
Codex plans include:- Architecture diagrams (in markdown)
- Data flow descriptions
- Error handling strategy
- Performance considerations
Interactive Planning
During planning, you can:- Expand/collapse sections
- Comment on specific steps
- Reorder steps by dragging
- Mark steps as “skip” or “priority”
Plan Exports
Export plans as:- Markdown files
- JIRA tickets (one per step)
- Linear issues (one per step)
- GitHub issues
Best Practices
Start Broad, Then Narrow
Give a high-level prompt first (“Add authentication”). Let the agent ask questions to narrow scope.
Review Plans Carefully
Plans show the agent’s assumptions. Catch misunderstandings early before code is written.
Iterate on Plans
Don’t approve the first plan. Ask “What if we used X instead?” to explore alternatives.
Use Plan Mode for Big Changes
For small tasks (“fix typo”), plan mode adds overhead. Use regular mode instead.
Keyboard Shortcuts
Cmd+Enter- Approve plan and start executionCmd+E- Edit plan before approvalCmd+R- Regenerate planEscape- Cancel planning phase
Example Workflows
Refactoring
Feature Addition
Limitations
Plan mode doesn’t work well for:- Exploratory debugging - “Fix this crash” is better in regular mode
- Trivial changes - “Add a semicolon” doesn’t need planning
- Iterative design - UI tweaks benefit from fast iteration, not planning
Troubleshooting
Agent skips planning phase
Agent skips planning phase
Cause: Plan mode not enabled or prompt is too specific.Fix:
- Toggle “Plan Mode” in the chat header
- Use broader prompts (“Add feature X” not “Change line 42 to Y”)
Plan is too vague
Plan is too vague
Cause: Agent doesn’t have enough context.Fix:
- Answer clarifying questions in detail
- Provide file paths or existing code snippets
- Reference similar existing features
Agent deviates from plan
Agent deviates from plan
Cause: Plan became infeasible during execution.Fix:
- This is normal - approve deviations if they make sense
- Or stop execution and regenerate the plan
Can't edit the plan
Can't edit the plan
Cause: Plan is locked after approval.Fix:
- Stop execution (Cmd+.)
- Click “Regenerate Plan”
- Make changes and approve again
Related Features
- Multi-Agent Support - Codex has best-in-class plan mode
- Visual UI - Review plans in markdown with syntax highlighting
- Background Agents - Long plans can run in the background