✨ Add Planning Mode support with /plan and /code commands#615
Conversation
Implements Planning Mode feature that allows users to switch between
planning-only mode and normal code execution mode via slash commands.
Changes:
- Add agent_mode reactive property to ConversationContainer ('plan' or 'code')
- Add /plan and /code slash commands to switch modes
- Add SetAgentMode message and handler in ConversationManager
- Add PLANNING_MODE_INSTRUCTIONS to guide agent behavior in plan mode
- Add blue mode indicator in WorkingStatusLine when in planning mode
- Add blue border color for InputField when in planning mode
- Update tests for new commands and add planning mode tests
In Planning Mode:
- Agent focuses on understanding requirements and asking questions
- Agent generates PLAN.md instead of executing code
- UI shows blue indicator and border to match GUI behavior
Closes OpenHands#613
Co-authored-by: openhands <openhands@all-hands.dev>
|
I am able to enter /plan mode as described and it starts out well with the input bar turning blue, but while it was working on the plan it actually made some file edits! It seems to be able to escape the plan mode cage and eventually proceeded to implement its changes just like it normally does in code mode. Also, if it made plan steps, they did not show up in the 'plan' pane on the right, it stayed empty. Please let me know if there is anyway I could help debug this as I think the feature will be awesome |
|
I can confirm it did create the PLAN.md in the root of the repo, but that seems to not be the location where OpenHands CLI stores the plans it uses to for the 'Agent Plan' pane on the right? not sure if/how these two things are connected, but it feels like they should be |
…pt, fix state reset - Switch to AlwaysConfirm policy when entering /plan mode so every agent action requires explicit user approval (hard safety net) - Restore user's original confirmation policy on /code - Reset agent_mode to 'code' in reset_conversation_state() so /new doesn't leave user stuck in planning mode - Harden PLANNING_MODE_INSTRUCTIONS with explicit forbidden action names (CmdRunAction, FileWriteAction, FileEditAction, etc.) - Apply planning instructions to refinement messages too (closes bypass through system-generated follow-ups) - Expand tests from 8 to 15: state reset, policy save/restore lifecycle, forbidden action assertions

Hey! 👋
This adds Planning Mode to the CLI - now you can have the agent focus on planning before jumping into code.
The gist
Type
/plan→ agent plans instead of codingType
/code→ back to normalIn planning mode, the agent will ask questions, understand your requirements, and create a
PLAN.mdfile - no code execution until you're ready.Visual cues
When you're in planning mode:
Testing
All 1270 tests pass ✅
Closes #613