Skip to content

feat: implement plan_enter tool and inject plan content into build agent (#512)#623

Open
MrRealORG wants to merge 1 commit into
XiaomiMiMo:mainfrom
MrRealORG:fix/auto-202606150037-plan-enter-tool
Open

feat: implement plan_enter tool and inject plan content into build agent (#512)#623
MrRealORG wants to merge 1 commit into
XiaomiMiMo:mainfrom
MrRealORG:fix/auto-202606150037-plan-enter-tool

Conversation

@MrRealORG

Copy link
Copy Markdown

Summary

Partially addresses #512

Problem

The plan mode workflow had two gaps:

  1. 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.

  2. 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: ()

  • Implements the missing tool using the existing description
  • Asks the user via the Question system whether to switch to plan agent
  • Returns which the TUI already handles (line 237-239 in session/index.tsx)

Improved: ()

  • Now reads the plan file content before asking the user
  • Includes the full plan content in the synthetic user message sent to the build agent
  • The build agent now has the complete plan in context without needing to re-read the file

Updated: Tool registry ()

  • Renamed ambiguous key to explicit and
  • Registered in the default tool set

Updated: Manual agent switch hint ()

  • When user manually switches to build agent after a plan session (via Tab key), the hint now explicitly tells the build agent to read the plan file first

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant