-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Bug Description
Feature Request: Non-Interactive Planning Mode Enhancements
Problem Statement
When running Claude Code in planning mode (--permission-mode plan) with the -p flag for non-interactive/headless execution, the CLI still prompts for user approval before proceeding. This blocks automation workflows and background job usage.
Additionally, plan files are written to ~/.claude/plan/.md with no way to specify a custom location, making it difficult to programmatically retrieve the generated plan.
Proposed Solution
Add the following CLI flags:
| Flag | Description |
|---|---|
| --plan-file | Specify custom output path for the plan file |
| --plan-only | Generate plan and exit without prompting for approval |
Example Usage
Generate plan to specific file and exit
claude --permission-mode plan
-p "Create migration plan for OAuth"
--plan-file ./plans/oauth-migration.md
--plan-only
Use in CI/scripts
claude --permission-mode plan
-p "$(cat requirements.md)"
--plan-file /tmp/plan.md
--plan-only && cat /tmp/plan.md
Use Cases
- Background jobs - Generate plans overnight for review next morning
- CI pipelines - Auto-generate implementation plans from issue descriptions
- Batch processing - Queue multiple planning requests
- Documentation - Automatically save plans to project directories
- Review workflows - Generate plans for team review before execution
Current Workarounds
- Watching ~/.claude/plan/ for new files (brittle, race conditions)
- Using --max-turns to limit execution (doesn't guarantee clean exit)
- Symlinking the plan directory (doesn't solve the approval prompt)
Additional Context
The -p flag successfully enables non-interactive mode for normal operations, so extending this to planning mode would be consistent with existing CLI behavior.
Environment Info
- Platform: darwin
- Terminal: tmux
- Version: 2.0.76
- Feedback ID: 4f337205-7261-400a-b442-5bb9158e479f
Errors
[]