feat: implement plan_enter tool and inject plan content into build agent (#512)#623
Open
MrRealORG wants to merge 1 commit into
Open
feat: implement plan_enter tool and inject plan content into build agent (#512)#623MrRealORG wants to merge 1 commit into
MrRealORG wants to merge 1 commit into
Conversation
…ent (XiaomiMiMo#512) Three fixes for the plan mode workflow: 1. **Implement PlanEnterTool**: The plan_enter tool was referenced in agent permissions, TUI event handlers, and had a description file (plan-enter.txt), but no actual implementation existed. The model could never programmatically suggest switching to plan mode. Now it asks the user via the Question system and returns metadata with switched:true, which the TUI already handles to switch agents. 2. **Include plan content in plan_exit context**: When the user approves switching from plan to build agent via plan_exit, the full plan file content is now read and included in the synthetic user message sent to the build agent. Previously only the file path was passed, forcing the build agent to re-read the plan file (which it sometimes didn't do, leading to implementation without plan awareness). 3. **Include plan content in manual agent switch**: When the user manually switches to build agent (via Tab) after a plan session, the prompt injection in prompt.ts now also reads and includes the plan file content, providing the same context improvement. Additionally, the tool registry now uses explicit tool names (plan_exit, plan_enter) instead of the ambiguous 'plan' key.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Partially addresses #512
Problem
The plan mode workflow had two gaps:
Missing tool implementation: A description file () existed, agent permissions granted to build/max agents, and the TUI already handled tool calls to switch to the plan agent — but no actual tool implementation existed. The model could never programmatically suggest switching to plan mode.
Plan content not passed to build agent: When switching from plan to build agent (via ), only the plan file path was included in the build agent context. The build agent was expected to re-read the plan file itself, which it sometimes didn't do — leading to implementation without full plan awareness.
Changes
New: ()
Improved: ()
Updated: Tool registry ()
Updated: Manual agent switch hint ()