feat: Project Polaris - Phased Workflow Engine & Architect Agents#18530
feat: Project Polaris - Phased Workflow Engine & Architect Agents#18530SuccessSoham wants to merge 4 commits intogoogle-gemini:mainfrom
Conversation
…wer Agents
This PR introduces "Project Polaris", an enhancement to the Gemini CLI that implements a specialized, multi-agent workflow for handling complex software engineering tasks.
**Key Features:**
1. **Phased Workflow Engine:**
* Implemented a 7-phase engine (Discovery, Exploration, Clarification, Architecture, Implementation, Quality Review, Summary) in `packages/core/src/workflow/engine.ts`.
* Currently, the engine orchestrates the initial phases using specialized agents.
2. **Specialized Agents:**
* **Architect Agent (`packages/core/src/agents/architect-agent.ts`):** Analyzes the codebase and designs implementation plans. It uses a strict whitelist of native read-only tools to avoid conflicts and ensure safe exploration.
* **Reviewer Agent (`packages/core/src/agents/reviewer-agent.ts`):** Audits code changes for quality, bugs, and compliance.
* **Local Agent Executor:** Enhanced `LocalAgentExecutor` to support `onActivity` callbacks for real-time UI feedback and robust error recovery/fallback for model aliases.
3. **Direct Invocation Command:**
* Added a new `/polaris` slash command (`packages/cli/src/ui/commands/polarisCommand.ts`) to directly trigger the workflow engine.
* This bypasses the need for the LLM to "decide" to use the tool, providing a deterministic entry point for complex tasks.
4. **Windows & Runtime Compatibility Fixes:**
* Resolved bundling issues on Windows by adding a `react-shim.ts` and patching `shellExecutionService.ts` to handle `@xterm/headless` imports correctly.
* Updated `scripts/build.js` to be more resilient to non-essential workspace build failures.
5. **Agent Registration:**
* Registered `ArchitectAgent` and `ReviewerAgent` as built-in agents in `packages/core/src/agents/registry.ts`, ensuring they are available and their model configurations are correctly resolved.
**Usage:**
Run `gemini-cli` and use the command:
`/polaris "Your complex task description here"`
This lays the groundwork for a more autonomous and robust development assistant within the CLI.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary of ChangesHello @SuccessSoham, 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 Project Polaris, a major architectural enhancement to the Gemini CLI that establishes a new phased workflow engine. This engine orchestrates specialized AI agents through a structured development lifecycle, aiming to improve the handling of complex software engineering tasks by providing a more deterministic and observable process. The changes also include critical compatibility fixes for Windows and improvements to build stability. Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces a significant architectural enhancement, Project Polaris, which includes a phased workflow engine and specialized agents. The changes are extensive and well-structured. My review focuses on improving robustness, security, and correctness in several key areas. I've identified a few critical and high-severity issues related to prompt templating, agent output validation, command cancellation, and tool security. Addressing these, with reference to established rules, will make the new architecture more resilient and reliable.
Address all critical and high-priority feedback: 1. Restore robust validation in templateString utility. 2. Make agentId optional in ReviewScoreSchema to prevent validation failures. 3. Utilize context.signal in polarisCommand for proper cancellation support. 4. Implement strict tool whitelisting for ReviewerAgent (consistent with Architect). 5. Add runtime schema validation for PlanProposal using Zod in WorkflowEngine.
|
Hi team, I have addressed all the feedback provided by the
Project Polaris is now more resilient and secure. Looking forward to your final review and merge! Best regards, |
This update completes Phase 2 of Project Polaris, giving the Architect and Reviewer agents "X-ray vision" into the codebase using the Language Server Protocol (LSP).
**Key Enhancements:**
1. **LSP Client Service (`packages/core/src/services/lspService.ts`):** A robust service that can spawn language servers (currently `typescript-language-server` via `npx`) and communicate via JSON-RPC.
2. **Semantic Tools:**
* `lsp_find_references`: Allows agents to find all usages of a symbol across the monorepo.
* `lsp_go_to_definition`: Enables agents to jump to the definition of a symbol.
3. **Agent Upgrades:** Updated `ArchitectAgent` and `ReviewerAgent` to include these new tools in their whitelist, enabling deep semantic analysis instead of just text search.
4. **Core Integration:** Registered the new service and tools in `Config` and `ToolRegistry`.
*Note: A 15-second delay has been added to the LocalExecutor to respect free-tier API rate limits during testing.*
Project Polaris: Phased Workflow Engine & Specialized Agents
This PR introduces Project Polaris, a significant architectural enhancement to Gemini CLI designed to handle complex software engineering tasks through a structured, multi-agent workflow.
Closes #18537
🚀 Key Features
Phased Workflow Engine (
packages/core/src/workflow/engine.ts)Specialized Built-in Agents
read_file,grep_search,glob,lsp_find_references,lsp_go_to_definition) to ensure safe and focused exploration without MCP conflicts.AgentRegistry.New
/polarisSlash Commandpackages/cli/src/ui/commands/polarisCommand.ts./polaris \"Refactor the auth system\"), bypassing the chat model's tool selection loop for a more reliable kickoff.Enhanced
LocalAgentExecutoronActivitycallbacks to stream granular agent events to the UI.architect-config) aren't perfectly resolved in the environment.🌟 Phase 2 Update: Semantic Intelligence (LSP)
This PR now includes deep semantic analysis capabilities:
packages/core/src/services/lspService.ts) that orchestrates language servers via JSON-RPC.lsp_find_referencesandlsp_go_to_definitiontools, allowing agents to understand code structure rather than just matching text.npxto run language servers (e.g.,typescript-language-server) without requiring global installation.🛠️ Compatibility & Runtime Fixes
react-shim.tsand patchingshellExecutionService.tsto correctly handle@xterm/headlessimports.scripts/build.jsto be resilient against non-essential workspace build failures (likevscode-companion), ensuring the CLI bundle is always generated.🧪 Verification
This workflow has been tested locally on Windows.
npm run bundlenode bundle/gemini.js/polaris \"Analyze the codebase...\"-> Successfully spawns Architect, explores files, and generates a plan.Future Work (Phase 3)