Skip to content

feat: integrate Plan Mode and extension-native policies into Conductor#133

Merged
hminooei merged 11 commits intofeat/plan-modefrom
task/integrate-plan-mode
Mar 4, 2026
Merged

feat: integrate Plan Mode and extension-native policies into Conductor#133
hminooei merged 11 commits intofeat/plan-modefrom
task/integrate-plan-mode

Conversation

@mahimashanware
Copy link
Contributor

@mahimashanware mahimashanware commented Feb 23, 2026

This PR integrates Gemini CLI's secure Plan Mode into the Conductor extension. It encapsulates the planning and specification phases of project setup and track creation within Plan Mode, enforcing stricter file access policies while significantly improving interactive user prompts.

Key Changes:

Plan Mode Integration:

  • Updated the setup and newTrack prompts to utilize the enter_plan_mode and exit_plan_mode tools, securing the generation of initial project artifacts.

  • Added the plan.directory configuration to gemini-extension.json to officially designate the conductor/ directory for planning.
    Security & Native Policies:

  • Introduced policies/conductor.toml to define extension-native tool rules. It explicitly allows write_file, replace, and specific run_shell_command operations during Plan Mode.

  • Added critical directives warning the agent to use only relative paths (e.g., conductor/product.md) and forbidding shell redirection (>, >>) to adhere to Plan Mode security constraints.

  • Improved User Interaction (ask_user):

    • Refactored interactive flows in setup.toml and newTrack.toml to deeply integrate the ask_user tool.
    • Replaced manual text parsing with native multiple-choice options and batched questions (e.g., for track confirmations and product requirements drafting).
      Agent Robustness:
    • Instructed the agent to attempt intelligent self-correction upon tool failures (like policy violations) before halting execution.
    • Enforced using run_shell_command instead of list_directory when listing external style-guide templates to bypass workspace boundary restrictions.

    Fixes Integrate Gemini CLI plan mode into conductor. #121.

@mahimashanware mahimashanware marked this pull request as draft February 23, 2026 19:13
Mahima Shanware added 5 commits February 24, 2026 00:02
Change-Id: Id007e0dd38bdab2520ee0c4de782adb84637e2df
Change-Id: I3d917e54070609dbb20cf13b649951524a8d30db
Change-Id: I00a7c8e61ffc561c24ab6757810b5e1476fff3d5
Change-Id: I0ed92b8ef08f0413b9449a4cc35c0fc28dbf75af
Change-Id: I6d69d99a4cadb84854c3a11484d82d9c2088f565
@mahimashanware mahimashanware force-pushed the task/integrate-plan-mode branch from ada6b8c to 898daa7 Compare February 24, 2026 03:49
@mahimashanware mahimashanware changed the base branch from main to feat/plan-mode February 24, 2026 03:51
Mahima Shanware added 3 commits February 24, 2026 17:27
…ch is blocked by plan mode

Change-Id: I4cb3daedc2f338b5007e1e3ad07f0ee19f7797bd
…ting

Change-Id: I441f41b3f0c3e317bf56e837782a61f3112fafdf
Change-Id: Ic892691becfa25cdc502f6715323df6a90ba0bc5
@mahimashanware mahimashanware changed the title WIP Task/integrate plan mode feat: integrate Plan Mode and extension-native policies into Conductor Mar 3, 2026
Change-Id: I49aee4c78a28d048b9e008725de0dce6a03220ca
@mahimashanware mahimashanware force-pushed the task/integrate-plan-mode branch from 1cd3821 to 5cf078c Compare March 3, 2026 19:40
@mahimashanware mahimashanware marked this pull request as ready for review March 3, 2026 19:46
Copy link
Contributor

@hminooei hminooei left a comment

Choose a reason for hiding this comment

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

Left some comments.
Thanks

- [Metadata](./metadata.json)
```
6. **Update Tracks Registry:**
6. **Exit Plan Mode:** Call the `exit_plan_mode` tool with the path: `<Tracks Directory>/<track_id>/index.md`.
Copy link
Contributor

Choose a reason for hiding this comment

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

for my learning: what is the path used for?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for us, nothing but the exit plan mode tool requires a path for the user to approve before exiting.

CRITICAL: You must validate the success of every tool call. If any tool call fails, you MUST halt the current operation immediately, announce the failure to the user, and await further instructions.
CRITICAL: You must validate the success of every tool call. If a tool call fails (e.g., due to a policy restriction or path error), you should attempt to intelligently self-correct by reviewing the error message or checking the local `.gemini/policies/conductor.toml` file. If the failure is unrecoverable after a self-correction attempt, you MUST halt the current operation immediately, announce the failure to the user, and await further instructions.

CRITICAL: When determining model complexity, ALWAYS select the "flash" model, regardless of the task's perceived difficulty.
Copy link
Contributor

Choose a reason for hiding this comment

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

urelated to this PR: what is this line 8 for?

Copy link
Contributor

@moisgobg moisgobg Mar 3, 2026

Choose a reason for hiding this comment

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

In the early days of Conductor, free-tier users were consuming too many tokens due to overuse of the pro model. Since there was no feature to dynamically select the model for certain instructions, this was an attempt to tell the agent to select the Flash agent more often.

Let's brainstorm the best way to tackle this issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i needed to beef up to instructions to get it to stop spiraling if plan mode wasn't available - instead of stopping, conductor should try to navigate around it

Copy link
Contributor

Choose a reason for hiding this comment

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

Given that it's about model quota concerns, I think we should now remove line 8 (in a separate PR though).


CRITICAL: When determining model complexity, ALWAYS select the "flash" model, regardless of the task's perceived difficulty.

PLAN MODE PROTOCOL: This setup process runs entirely within Plan Mode. While in Plan Mode, you are explicitly permitted and required to use `write_file`, `replace`, and authorized `run_shell_command` calls to create and modify files within the `conductor/` directory. **CRITICAL: You MUST use relative paths starting with `conductor/` (e.g., `conductor/product.md`) for all file operations. Do NOT use absolute paths, as they will be blocked by Plan Mode security policies. REDIRECTION (e.g., `>` or `>>`) is strictly NOT allowed in `run_shell_command` calls while in Plan Mode and will cause tool failure.** Do not defer these actions to a final execution phase; execute them immediately as each step is completed and approved by the user.
Copy link
Contributor

Choose a reason for hiding this comment

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

"Do not defer these actions to a" : what 'actions' are we referring to? Can we clarify

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the plan mode instructions on gemini cli seem to encourage postponing non-readonly tool calls until after plan mode is executed. i added this to make sure the agent executes the tool call right away

Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we tell this to the model too? e.g. ".... Do not defer these actions to a final execution phase..." -> "... Do not defer needed tool calls in this phase to a final execution phase ..."


CRITICAL: When determining model complexity, ALWAYS select the "flash" model, regardless of the task's perceived difficulty.

PLAN MODE PROTOCOL: This setup process runs entirely within Plan Mode. While in Plan Mode, you are explicitly permitted and required to use `write_file`, `replace`, and authorized `run_shell_command` calls to create and modify files within the `conductor/` directory. **CRITICAL: You MUST use relative paths starting with `conductor/` (e.g., `conductor/product.md`) for all file operations. Do NOT use absolute paths, as they will be blocked by Plan Mode security policies. REDIRECTION (e.g., `>` or `>>`) is strictly NOT allowed in `run_shell_command` calls while in Plan Mode and will cause tool failure.** Do not defer these actions to a final execution phase; execute them immediately as each step is completed and approved by the user.
Copy link
Contributor

@moisgobg moisgobg Mar 3, 2026

Choose a reason for hiding this comment

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

Let's evaluate how impactful our instructions are, so we can use fewer tokens and make our commands easier to read and maintain.

In the second paragraph before the CRITICAL section, since policies are the source of truth for allowing tools, how important is it to reiterate to the agent which tools are permitted and required?

This is a note to open the discussion on evaluating, avoiding, and removing noisy instructions.

Other cases:
Model selection instructions

1. **Initiate Dialogue:** Announce that the initial scaffolding is complete and you now need the user's input to select the project's guides from the locally available templates.
2. **Select Code Style Guides:**
- List the available style guides by running `ls ~/.gemini/extensions/conductor/templates/code_styleguides/`.
- List the available style guides by using the `run_shell_command` tool to execute `ls ~/.gemini/extensions/conductor/templates/code_styleguides/`. **CRITICAL: You MUST use `run_shell_command` for this step. Do NOT use the `list_directory` tool, as the templates directory resides outside of your allowed workspace and the call will fail.**
Copy link
Contributor

@moisgobg moisgobg Mar 3, 2026

Choose a reason for hiding this comment

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

Let's discuss if we want to keep using explicit tool names in our prompts. This also applies to other cases like ask_user tool for questions.

Should we write more flexible prompts that allow the assistant to choose the best tool for the job, or should we tell it exactly which tool to use?

Notes
@hminooei also suggested we could improve the tool name invocation in custom commands, maybe through injection functionality (see examples)


CRITICAL: You must validate the success of every tool call. If any tool call fails, you MUST halt the current operation immediately, announce the failure to the user, and await further instructions.

PLAN MODE PROTOCOL: Parts of this process run within Plan Mode. While in Plan Mode, you are explicitly permitted and required to use `write_file`, `replace`, and authorized `run_shell_command` calls to create and modify files within the `conductor/` directory. **CRITICAL: You MUST use relative paths starting with `conductor/` (e.g., `conductor/product.md`) for all file operations. Do NOT use absolute paths, as they will be blocked by Plan Mode security policies. REDIRECTION (e.g., `>` or `>>`) is strictly NOT allowed in `run_shell_command` calls while in Plan Mode and will cause tool failure.**
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: see review comment here.

Change-Id: Ieb69c7c6291042ee6cd2670cd65ab080bd7e53a3
@hminooei hminooei merged commit 4a4d9b2 into feat/plan-mode Mar 4, 2026
1 check passed
@moisgobg moisgobg deleted the task/integrate-plan-mode branch March 4, 2026 18:15
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.

Add planning policies and settings in Conductor extension

3 participants