Skip to content

feat(core): refine Plan Mode system prompt for agentic execution#18799

Merged
jerop merged 8 commits intomainfrom
ntm/improve-plan-mode-prompt
Feb 12, 2026
Merged

feat(core): refine Plan Mode system prompt for agentic execution#18799
jerop merged 8 commits intomainfrom
ntm/improve-plan-mode-prompt

Conversation

@NTaylorMullen
Copy link
Copy Markdown
Collaborator

@NTaylorMullen NTaylorMullen commented Feb 11, 2026

Summary

Refines the Plan Mode system prompt to make the agent much more fluid and efficient, while simultaneously enforcing a stricter output structure based on learnings from the conductor extension.

Details

  • Removed rigid conversational phase gates from Plan Mode (e.g., "Wait for user input before proceeding"). The agent is now instructed to explore and draft the plan in one fluid, autonomous motion.
  • Enforced Markdown checkboxes for tracking 'Implementation Steps' so that plans are immediately actionable and trackable.
  • Strengthened 'single source of truth' language when an approved plan exists, commanding the LLM to strictly adhere to the established document.
  • Wrapped available tools in an XML tag (<available_tools>) for better semantic parsing by the LLM.
  • Clarified the workflow mechanics of presenting the plan and calling the exit_plan_mode tool concurrently.
  • Clarified that enter_plan_mode should only be used for complex implementation tasks, not for answering questions or simple inquiries.

Related Issues

Closes #18680
Related to #16857

How to Validate

  1. Run the CLI in Plan Mode (npm run start -- --approval-mode plan) and observe the new system prompt instructions (or use GEMINI_WRITE_SYSTEM_MD=plan.md).
  2. Ask the CLI to "Plan a feature to add a new command".
  3. Verify it fluidly searches the codebase and drafts a .md plan with actionable checkboxes for implementation steps.
  4. Verify it asks for approval at the end.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@NTaylorMullen NTaylorMullen requested a review from a team as a code owner February 11, 2026 06:38
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @NTaylorMullen, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refines the Plan Mode system prompt to enhance the agent's efficiency and autonomy during plan generation. It streamlines the planning workflow by removing conversational phase gates, enforces a stricter output structure for plans, and improves tool parsing, ultimately leading to a more fluid and actionable planning experience.

Highlights

  • Removed rigid conversational phase gates: The agent is now instructed to explore and draft plans in one fluid, autonomous motion, eliminating the need for user input between phases.
  • Enforced Markdown checkboxes: Implementation Steps in plans now require Markdown checkboxes for immediate actionability and tracking.
  • Strengthened 'single source of truth' language: The LLM is commanded to strictly adhere to an established approved plan when one exists.
  • Wrapped available tools in an XML tag: Tools are now enclosed in <available_tools> XML tags for improved semantic parsing by the LLM.
  • Clarified workflow mechanics: The process of presenting the plan and concurrently calling the exit_plan_mode tool has been clarified.
  • Clarified enter_plan_mode usage: The enter_plan_mode tool should only be used for complex implementation tasks, not for simple inquiries or questions.
Changelog
  • packages/core/src/prompts/promptProvider.ts
    • Updated the formatting of PLAN_MODE_TOOLS and read-only MCP tools to wrap each tool name in XML tags instead of using a simple markdown list.
  • packages/core/src/prompts/snippets.ts
    • Rewrote the renderPlanningWorkflow function to remove multi-phase workflow instructions, introduce new "Rules" and "Required Plan Structure" sections, and define a simplified "Workflow" for exploration, drafting, review, and approval.
    • Modified the renderApprovedPlanSection to explicitly state the approved plan's path and emphasize reading it first as the "single source of truth."
    • Adjusted the workflowStepResearch and planningPhaseSuggestion functions to clarify that enter_plan_mode is for complex implementation tasks, not simple inquiries.
    • Updated the workflowStepStrategy function to refer to an approved plan as a "single source of truth."
Activity
  • Tests were added or updated.
  • Validation was performed on MacOS using npm run.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-cli gemini-cli Bot added the status/need-issue Pull requests that need to have an associated issue. label Feb 11, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request significantly refines the Plan Mode system prompt, transitioning from a rigid, phased workflow to a more fluid and autonomous one, with improvements like structured plan output using Markdown checkboxes. A high-severity prompt injection vulnerability was identified where Tool names from external MCP servers are not sanitized before inclusion in the system prompt, potentially allowing attacker manipulation. Additionally, minor inconsistencies in the new prompt text should be addressed for better clarity and LLM interpretation.

Comment thread packages/core/src/prompts/promptProvider.ts
Comment thread packages/core/src/prompts/snippets.ts Outdated
Comment thread packages/core/src/prompts/snippets.ts Outdated
@NTaylorMullen NTaylorMullen force-pushed the ntm/improve-plan-mode-prompt branch 2 times, most recently from c03c784 to aa453ac Compare February 11, 2026 09:09
- Remove rigid conversational phase gates from Plan Mode in favor of fluid discovery and drafting.
- Enforce Markdown checkboxes for tracking 'Implementation Steps' based on learnings from Conductor.
- Strengthen 'single source of truth' language when an approved plan exists.
- Clarify mechanics of presenting the plan and calling the exit tool.
- Wrap available tools in an XML tag for better semantic structure.
- Clarify that 'enter_plan_mode' should only be used for complex implementation tasks, not answering questions.
… ambiguous requests

- Updates 'workflowStepResearch' to replace weak 'consider using' language with a strong 'MUST' directive when a request is ambiguous, broad, or involves creating a new feature/application.
- Updates 'planningPhaseSuggestion' (used in new application workflows) to strictly mandate drafting a design document before scaffolding.
- Explicitly tells the agent NOT to use Plan Mode for simple inquiries, questions, or straightforward bug fixes to avoid unnecessary plan generation.
…xecution

- Modifies Act Mode execution instructions ('workflowStepStrategy' and 'newApplicationSteps') when an approved plan exists.
- Explicitly mandates that the agent MUST use 'edit' or 'write_file' to check off Markdown checkboxes (e.g., from `- [ ]` to `- [x]`) as steps are completed.
- Ensures the approved plan remains a living document that accurately reflects progress.
…tion phase

- Integrates checking off Markdown checkboxes directly into the generic 'Validate' step of the 'Plan -> Act -> Validate' execution loop for any approved plan.
- Explictly states that checking off boxes is 'NOT considered tool call overhead' but rather a mandatory step to maintain the single source of truth, combatting prompt compliance biases.
- Mandates the same plan tracking requirement in the 'newApplicationSteps' workflow.
- Reverts the requirement to use '- [ ]' checkboxes when creating a plan, instead requesting simple numbered/iterative steps.
- Removes the requirement for the agent to check off boxes during the 'Validate' execution loop.
- Removes the 'ALWAYS_PASSES' behavioral evaluation enforcing checkbox usage.
…enabled

- Simplifies the `newApplicationSteps` instructions by eliminating redundant conversational scaffolding steps when `enableEnterPlanModeTool` is active.
- For new applications, the agent is now given a concise 3-step mandate: Plan (using the tool), adhere to design constraints, and Execute using the standard cycle.
- Maintains the legacy, full-scaffolding prompt as a fallback for when Plan Mode is globally disabled.
@NTaylorMullen NTaylorMullen force-pushed the ntm/improve-plan-mode-prompt branch from aa453ac to 978116d Compare February 12, 2026 00:50
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 12, 2026

Size Change: +1.14 kB (0%)

Total Size: 24.3 MB

Filename Size Change
./bundle/gemini.js 24.3 MB +1.14 kB (0%)
ℹ️ View Unchanged
Filename Size
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB

compressed-size-action

- Restores instructions for the agent to identify at least two implementation approaches for complex tasks.
- Mandates presenting a summary of approaches with pros/cons and a recommendation to the user via `ask_user`.
- Maintains the fluid 'Agentic' core while ensuring healthy design-level consultation for non-trivial changes.
@gemini-cli gemini-cli Bot added area/core Issues related to User Interface, OS Support, Core Functionality area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. and removed status/need-issue Pull requests that need to have an associated issue. labels Feb 12, 2026
@jerop jerop added this pull request to the merge queue Feb 12, 2026
Merged via the queue into main with commit 27a1bae Feb 12, 2026
29 checks passed
@jerop jerop deleted the ntm/improve-plan-mode-prompt branch February 12, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Agent] Improve agent to not suggest entering plan mode for simple changes

2 participants