Skip to content

feat(plan): add guidance on iterating on approved plans vs creating new plans#18346

Merged
jerop merged 3 commits intomainfrom
feat/plan-approved-reference
Feb 5, 2026
Merged

feat(plan): add guidance on iterating on approved plans vs creating new plans#18346
jerop merged 3 commits intomainfrom
feat/plan-approved-reference

Conversation

@jerop
Copy link
Copy Markdown
Contributor

@jerop jerop commented Feb 4, 2026

This PR adds a new section to the Plan Mode system prompt that references an existing approved plan if available. It provides instructions for the agent to default to iterating on the existing plan rather than creating a new one, unless explicitly requested by the user.

Since the plan file is already mentioned in the chat history, the prompt focuses on guiding the agent on when to update the existing plan versus creating a new one. We can consider passing the path directly in the future but need to carefully address prompt injection risks.

Closes #18260

@jerop jerop requested a review from a team as a code owner February 4, 2026 22:27
@gemini-cli
Copy link
Copy Markdown
Contributor

gemini-cli bot commented Feb 4, 2026

Hi @jerop, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this.

We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines.

Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed.

Thank you for your understanding and for being a part of our community!

@gemini-cli
Copy link
Copy Markdown
Contributor

gemini-cli bot commented Feb 4, 2026

Hi there! Thank you for your contribution to Gemini CLI.

To improve our contribution process and better track changes, we now require all pull requests to be associated with an existing issue, as announced in our recent discussion and as detailed in our CONTRIBUTING.md.

This pull request is being closed because it is not currently linked to an issue. Once you have updated the description of this PR to link an issue (e.g., by adding Fixes #123 or Related to #123), it will be automatically reopened.

How to link an issue:
Add a keyword followed by the issue number (e.g., Fixes #123) in the description of your pull request. For more details on supported keywords and how linking works, please refer to the GitHub Documentation on linking pull requests to issues.

Thank you for your understanding and for being a part of our community!

@gemini-cli gemini-cli bot closed this Feb 4, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @jerop, 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 introduces a significant enhancement to the agent's 'Plan Mode' by integrating an 'Approved Plan' section into its system prompt. This modification aims to improve the efficiency and consistency of the planning workflow by guiding the agent to leverage and refine existing approved plans, thereby reducing redundant planning efforts and promoting an iterative development approach.

Highlights

  • Enhanced Plan Mode Prompt: The system prompt for 'Plan Mode' now includes an 'Approved Plan' section.
  • Iterative Planning Guidance: This new section instructs the agent to default to iterating on an existing approved plan, if available, rather than creating a new one.
  • Configuration Integration: The 'approvedPlanPath' is now passed from the configuration through the 'PromptProvider' to the prompt rendering logic.
  • Codebase Updates: 'PlanningWorkflowOptions' and 'renderPlanningWorkflow' in 'snippets.ts' were modified to support the new 'approvedPlanPath'.
  • Test Coverage: New unit tests and updated snapshots ensure the correct generation of the system prompt based on the presence or absence of an approved plan.
Changelog
  • packages/core/src/core/snapshots/prompts.test.ts.snap
    • Updated to include new snapshot tests for the 'Approved Plan' section in the Plan Mode system prompt, covering cases where a plan path is provided and when it is not.
  • packages/core/src/core/prompts.test.ts
    • Added new test suite for 'Approved Plan in Plan Mode' to verify the conditional rendering of the approved plan section within the system prompt.
    • Mocked 'getApprovedPlanPath' in the config for testing purposes.
  • packages/core/src/prompts/promptProvider.ts
    • Modified the 'PromptProvider' to retrieve the 'approvedPlanPath' from the 'config' object and pass it as an option to the 'renderPlanningWorkflow' function.
  • packages/core/src/prompts/snippets.ts
    • Updated the 'PlanningWorkflowOptions' interface to include an optional 'approvedPlanPath' property.
    • The 'renderPlanningWorkflow' function was modified to conditionally inject the 'Approved Plan' instructions into the system prompt based on the presence of 'approvedPlanPath'.
Activity
  • New feature implementation to enhance agent planning capabilities.
  • Updates to core prompt generation logic.
  • Addition of new unit tests to validate prompt behavior.
  • Snapshot updates reflecting changes in system prompt content.
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.

@jerop jerop reopened this Feb 4, 2026
@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. labels Feb 4, 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 adds a new 'Approved Plan' section to the Plan Mode system prompt. A security concern exists where approvedPlanPath is interpolated directly, creating a prompt injection vulnerability if it contains backticks, which violates the guideline to avoid including user-provided input directly in LLM content. Additionally, the template's conditional logic for newlines could be improved for robustness, aligning with best practices for template literal management.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 4, 2026

Size Change: +774 B (0%)

Total Size: 23.7 MB

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

compressed-size-action

@jerop jerop closed this Feb 4, 2026
@jerop jerop reopened this Feb 5, 2026
@jerop jerop enabled auto-merge February 5, 2026 01:17
@jerop jerop requested a review from galz10 February 5, 2026 01:31
@jerop jerop force-pushed the feat/plan-approved-reference branch from af96c0c to 0802de6 Compare February 5, 2026 14:45
@jerop
Copy link
Copy Markdown
Contributor Author

jerop commented Feb 5, 2026

/gemini review

@jerop jerop changed the title feat(plan): add Approved Plan section to Plan Mode system prompt feat(plan): enable iteration on approved plans Feb 5, 2026
@jerop jerop changed the title feat(plan): enable iteration on approved plans feat(plan): add guidance on iteration on approved plans vs creating new plans Feb 5, 2026
@jerop jerop changed the title feat(plan): add guidance on iteration on approved plans vs creating new plans feat(plan): add guidance on iterating on approved plans vs creating new plans Feb 5, 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 adds a new 'Approved Plan' section to the Plan Mode system prompt. This section is conditionally included when an approved plan is available, instructing the agent to iterate on the existing plan by default. The implementation is clean, using a dedicated function to render the new prompt section, and is accompanied by comprehensive snapshot tests.

The changes look solid and align with the goal of guiding the agent's behavior in Plan Mode. The critical comment regarding a missing dependency needs to be addressed for this PR to be mergeable.

@jerop jerop requested review from abhipatel12 and removed request for galz10 February 5, 2026 16:24
@jerop jerop added this pull request to the merge queue Feb 5, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 5, 2026
@jerop jerop added this pull request to the merge queue Feb 5, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 5, 2026
@jerop jerop added this pull request to the merge queue Feb 5, 2026
@jerop jerop removed this pull request from the merge queue due to a manual request Feb 5, 2026
@jerop jerop force-pushed the feat/plan-approved-reference branch from 0802de6 to 19db93a Compare February 5, 2026 18:19
jerop added 2 commits February 5, 2026 13:20
Informs the agent of an existing approved plan when entering Plan Mode and provides instructions on iterating vs creating new plans.
…ctions

Address security vulnerability by removing direct path interpolation from the system prompt to prevent potential prompt injection.
@jerop jerop force-pushed the feat/plan-approved-reference branch from 19db93a to 739466c Compare February 5, 2026 18:21
Simplify the Approved Plan section to be more direct and better integrated with the planning workflow.
@jerop jerop force-pushed the feat/plan-approved-reference branch from 739466c to 3837011 Compare February 5, 2026 18:22
@jerop jerop enabled auto-merge February 5, 2026 18:23
@jerop jerop added this pull request to the merge queue Feb 5, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 5, 2026
@jerop jerop added this pull request to the merge queue Feb 5, 2026
Merged via the queue into main with commit 6860556 Feb 5, 2026
26 checks passed
@jerop jerop deleted the feat/plan-approved-reference branch February 5, 2026 19:23
sidwan02 pushed a commit to sidwan02/gemini-cli-gemma that referenced this pull request Feb 6, 2026
aswinashok44 pushed a commit to aswinashok44/gemini-cli that referenced this pull request Feb 9, 2026
kuishou68 pushed a commit to iOfficeAI/aioncli that referenced this pull request Feb 27, 2026
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.

Update planning workflows to consider approved plan if it exists

3 participants