feat: integrate Plan Mode and extension-native policies into Conductor#133
feat: integrate Plan Mode and extension-native policies into Conductor#133hminooei merged 11 commits intofeat/plan-modefrom
Conversation
Change-Id: Id007e0dd38bdab2520ee0c4de782adb84637e2df
Change-Id: I3d917e54070609dbb20cf13b649951524a8d30db
Change-Id: I00a7c8e61ffc561c24ab6757810b5e1476fff3d5
Change-Id: I0ed92b8ef08f0413b9449a4cc35c0fc28dbf75af
Change-Id: I6d69d99a4cadb84854c3a11484d82d9c2088f565
ada6b8c to
898daa7
Compare
…ch is blocked by plan mode Change-Id: I4cb3daedc2f338b5007e1e3ad07f0ee19f7797bd
…ting Change-Id: I441f41b3f0c3e317bf56e837782a61f3112fafdf
Change-Id: Ic892691becfa25cdc502f6715323df6a90ba0bc5
Change-Id: I49aee4c78a28d048b9e008725de0dce6a03220ca
1cd3821 to
5cf078c
Compare
hminooei
left a comment
There was a problem hiding this comment.
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`. |
There was a problem hiding this comment.
for my learning: what is the path used for?
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
urelated to this PR: what is this line 8 for?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
"Do not defer these actions to a" : what 'actions' are we referring to? Can we clarify
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.** |
There was a problem hiding this comment.
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.** |
Change-Id: Ieb69c7c6291042ee6cd2670cd65ab080bd7e53a3
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):
Agent Robustness:
Fixes Integrate Gemini CLI plan mode into conductor. #121.