Overview
The "Edit Plan" operation of the Gemini CLI node allows users to modify an existing AI-generated execution plan based on specific instructions. This node interacts with the Google Gemini CLI, which is an AI-powered tool designed to create, edit, approve, and execute detailed coding or project plans.
Typical use cases include:
- Updating an existing execution plan by adding new steps, modifying descriptions, or adjusting commands.
- Refining a plan to improve error handling, optimize performance, or incorporate additional requirements.
- Collaboratively iterating on a plan before approval and execution.
For example, a user might have a plan for a software deployment process and want to add instructions to increase timeout values or add error handling to certain steps. Using this node, they provide the plan ID and edit instructions, and the node returns the updated plan structure.
Properties
| Name | Meaning |
|---|---|
| Plan ID | The unique identifier of the plan to be edited. Required to specify which existing plan to modify. |
| Edit Instructions | Text instructions describing how to modify the plan (e.g., "Add error handling to step 2 and increase timeout for step 4"). These guide the AI in updating the plan accordingly. |
| Model | Choice of Gemini AI model to use: • Gemini 2.5 Pro — Most capable model with 1M token context window • Gemini 2.5 Flash — Fast and efficient model for quick responses |
| Max Turns | Maximum number of conversation turns allowed during interaction with Gemini CLI. Controls the back-and-forth exchanges limit. |
| Timeout | Maximum time in seconds to wait for Gemini CLI completion before aborting the operation. |
| Project Path | Directory path where Gemini CLI should run, allowing access to project files and commands. If empty, defaults to current working directory. |
| Output Format | Format of the output data returned by the node: • Messages — Raw array of all messages exchanged • Plan — Execution plan structure • Plan Status — Progress and status of plan execution • Structured — Object containing messages, summary, result, and metrics • Text — Only the final result text |
| Additional Options | Collection of optional settings: • API Key — Gemini API key if not set via environment variable • Use Vertex AI — Whether to use Vertex AI instead of Gemini API • System Prompt — Extra context/instructions for Gemini CLI • Debug Mode — Enable debug logging |
| Tools Configuration | Configure built-in tools and external integrations: • Enable Built-in Tools — File system, shell commands, web fetch, web search • Security Mode — Safe mode (confirmations), auto-approve (YOLO), sandbox mode • Enable Checkpointing — Save conversation state |
| MCP Servers | Configure external MCP servers for extended functionality: Multiple server configurations including command or HTTP connection, environment variables, included/excluded tools, trust level, working directory, etc. |
Output
The output JSON object for the "Edit Plan" operation contains the updated execution plan with the following structure:
plan: The full execution plan object, including:id: Plan identifier.title: Brief title of the task.description: Detailed description of the task.steps: Array of step objects, each with:id: Step identifier.description: Description of the step.command: Optional command to run.files: Optional list of files involved.estimated_duration: Estimated duration in seconds.status: Current status of the step (e.g., "pending").
created_at: Timestamp when the plan was created.modified_at: Timestamp of last modification.status: Current status of the plan (e.g., "draft").original_prompt: Original prompt used to generate the plan.configuration: Configuration details such as model, project path, and tools enabled.
operation: The string"edit_plan"indicating the performed operation.success: Boolean indicating whether the edit was successful.
This structured output enables downstream nodes or workflows to consume the updated plan for further processing, approval, or execution.
Dependencies
- Requires the Google Gemini CLI installed and accessible in the system PATH.
- An API key credential for Gemini API may be required, either provided explicitly or via environment variable.
- Optionally supports using Vertex AI instead of Gemini API.
- Access to the specified project directory if
projectPathis set. - Optional configuration of built-in tools (file system, shell, web fetch/search) and external MCP servers.
- Node requires permission to read/write files in
.gemini/plansdirectory under the project path or current working directory.
Troubleshooting
- Gemini CLI Not Found: Error indicating Gemini CLI is not installed or not accessible. Solution: Install Gemini CLI globally (
npm install -g @google/gemini-cli) and ensure it is in the system PATH. - Invalid Project Path: If the specified project path does not exist, is not a directory, or lacks read/write permissions, the node will throw an error. Verify the path and permissions.
- Plan Not Found: When editing, if the given Plan ID does not correspond to any saved plan, an error is thrown. Confirm the Plan ID is correct and the plan exists.
- Timeouts: Operations may time out if Gemini CLI takes longer than the configured timeout. Increase the timeout value if needed.
- Invalid Plan Structure: If Gemini CLI returns malformed or incomplete JSON for the plan, parsing errors occur. Ensure the AI response format matches expectations.
- API Key Issues: Missing or invalid API keys can cause authentication failures. Provide a valid API key or set the appropriate environment variable.
- Security Mode Cautions: Using "Auto-Approve (YOLO Mode)" can lead to unintended destructive operations. Use with caution.
Links and References
- Google Gemini CLI GitHub Repository (for installation and usage)
- n8n Documentation (general node development and usage)
- Node.js Child Process Documentation (underlying process spawning)
- Model Context Protocol (MCP) (for MCP server integration)