Multi-agent orchestration extension for Gemini CLI. Maestro delegates work to 12 specialized subagents — with support for parallel dispatch of independent phases — coordinated by a TechLead orchestrator through structured design, planning, and execution workflows.
- Overview
- Features
- Getting Started
- Commands
- Configuration
- Architecture
- Agents
- Skills
- Parallel Execution
- Session State & Project Output
- Documentation
- Troubleshooting
- Contributing
- License
Maestro transforms Gemini CLI into a multi-agent orchestration platform. Instead of a single AI session handling everything, Maestro delegates work to 12 specialized subagents — each with its own context, tools, and expertise — coordinated by a TechLead orchestrator through a structured 4-phase workflow: Design, Plan, Execute, Complete.
- Guided Design Dialogue — Structured requirements gathering with multiple-choice questions and architectural approach proposals
- Automated Planning — Generates implementation plans with phase dependencies, agent assignments, and parallelization opportunities
- Parallel Execution — Independent phases run concurrently through shell-based parallel dispatch
- Session Persistence — All orchestration state tracked in YAML+Markdown files for reliable resumption
- Hooks-Based Lifecycle Middleware — Lifecycle hooks for active-agent tracking and handoff validation
- Least-Privilege Security — Each subagent receives only the tools required for its role
- Standalone Commands — Direct access to code review, debugging, security audit, and performance analysis without full orchestration
- Configurable Settings — 14 environment-variable-driven parameters for model selection, timeouts, validation strictness, and dispatch behavior
Maestro relies on Gemini CLI's experimental subagent system. Enable it in your Gemini CLI settings:
{
"experimental": {
"enableAgents": true
}
}Warning: Parallel-dispatched agents run in autonomous mode (
--approval-mode=yolo). Sequential delegation uses your current Gemini CLI approval mode. Review the subagents documentation for details.
The settings.json file is located at:
- macOS/Linux:
~/.gemini/settings.json - Windows:
%USERPROFILE%\.gemini\settings.json
Maestro does not auto-edit settings.json. Enable experimental.enableAgents manually before running orchestration commands.
From Git Repository:
gemini extensions install https://github.com/josstei/maestro-geminiLocal Development:
git clone https://github.com/josstei/maestro-gemini
cd maestro-gemini
gemini extensions link .Restart Gemini CLI after installation for the extension to load.
/maestro:orchestrate Build a REST API for a task management system with user authentication
Maestro will:
- Engage you in a structured design dialogue
- Present 2-3 architectural approaches with trade-offs
- Generate a design document for your approval
- Create a detailed implementation plan with agent assignments
- Execute the plan phase by phase, delegating to specialized agents
- Track all progress in session state files
| Command | Purpose |
|---|---|
/maestro:orchestrate |
Full orchestration workflow (design → plan → execute → complete) |
/maestro:execute |
Execute an existing implementation plan |
/maestro:resume |
Resume an interrupted session |
/maestro:review |
Standalone code review |
/maestro:debug |
Standalone debugging session |
/maestro:security-audit |
Standalone security assessment |
/maestro:perf-check |
Standalone performance analysis |
/maestro:status |
View current session status |
/maestro:archive |
Archive the active session |
Initiates the full Maestro orchestration workflow.
Usage: /maestro:orchestrate <task description>
Behavior:
- Checks for existing active sessions in
<MAESTRO_STATE_DIR>/state/(default:.gemini/state/) - If an active session exists, offers to resume or archive it
- Begins the four-phase orchestration workflow:
- Phase 1: Design Dialogue
- Phase 2: Team Assembly & Planning
- Phase 3: Execution
- Phase 4: Completion & Archival
Executes an existing implementation plan, skipping design and planning phases.
Usage: /maestro:execute <path-to-implementation-plan>
Behavior:
- Reads the specified implementation plan file
- Creates a session state file for tracking
- Presents an execution summary for user confirmation
- Executes phases according to the plan with full progress tracking
- Archives the session on completion
Resumes an interrupted orchestration session.
Usage: /maestro:resume
Behavior:
- Reads active session state through
scripts/read-active-session.js(default path:.gemini/state/active-session.md) - Parses session metadata and phase statuses
- Presents a status summary with completed/pending/failed phases
- If errors exist from the previous run, presents them and asks for guidance
- Continues execution from the last active phase using the execution and delegation skills
Runs a standalone code review on staged changes, last commit, or specified paths.
Usage: /maestro:review [file paths or glob patterns]
Behavior:
- Auto-detects review scope: user-specified paths > staged changes > last commit diff
- Confirms detected scope with the user
- Delegates to the code_reviewer agent
- Presents findings classified by severity (Critical, Major, Minor, Suggestion)
- Every finding references a specific file and line number
Focused debugging session to investigate and diagnose an issue.
Usage: /maestro:debug <issue description>
Behavior:
- Delegates to the debugger agent with the issue description
- Follows systematic methodology: reproduce, hypothesize, investigate, isolate, verify
- Presents root cause analysis with evidence, execution trace, and recommended fix
Runs a security assessment on the specified scope.
Usage: /maestro:security-audit <scope>
Behavior:
- Delegates to the security_engineer agent
- Reviews for OWASP Top 10 vulnerabilities, traces data flow, audits authentication/authorization
- Presents findings with CVSS-aligned severity, proof of concept, and remediation steps
Runs a performance analysis on the specified scope.
Usage: /maestro:perf-check <scope>
Behavior:
- Delegates to the performance_engineer agent
- Establishes baseline, profiles hotspots, analyzes bottlenecks
- Presents optimization recommendations ranked by impact-to-effort ratio
Displays the current orchestration session status.
Usage: /maestro:status
Behavior:
- Reads the active session state via file injection
- Presents phase-by-phase status, file manifest, token usage, and errors
- Read-only — does not modify state or continue execution
Archives the current active orchestration session.
Usage: /maestro:archive
Behavior:
- Checks for an active session
- Presents a summary and asks for confirmation
- Moves design document, implementation plan, and session state to archive directories
- Verifies archival was successful
Maestro works out of the box with sensible defaults. To customize behavior, set any of these environment variables in your shell profile or project .env file:
| Environment Variable | Default | Description |
|---|---|---|
MAESTRO_DEFAULT_MODEL |
(inherit) | Model override for parallel-dispatched agents (sequential delegation inherits main session model) |
MAESTRO_WRITER_MODEL |
(inherit) | Model override for technical_writer agent in parallel dispatch only |
MAESTRO_DEFAULT_TEMPERATURE |
(inherit) | Temperature override for delegation prompts (agents define own defaults in frontmatter) |
MAESTRO_MAX_TURNS |
(inherit) | Max turns override per agent (agents define own defaults in frontmatter) |
MAESTRO_AGENT_TIMEOUT |
10 |
Timeout in minutes per subagent |
MAESTRO_DISABLED_AGENTS |
(none) | Comma-separated list of agents to exclude |
MAESTRO_MAX_RETRIES |
2 |
Retry attempts per phase before escalation |
MAESTRO_AUTO_ARCHIVE |
true |
Archive sessions on completion |
MAESTRO_VALIDATION_STRICTNESS |
normal |
strict / normal / lenient |
MAESTRO_STATE_DIR |
.gemini |
Directory for session state and plans |
MAESTRO_MAX_CONCURRENT |
0 (unlimited) |
Max simultaneous agents in parallel dispatch |
MAESTRO_STAGGER_DELAY |
5 |
Seconds between parallel agent launches |
MAESTRO_GEMINI_EXTRA_ARGS |
(none) | Extra Gemini CLI args forwarded to each parallel dispatch process (prefer --policy) |
MAESTRO_EXECUTION_MODE |
ask |
Phase 3 dispatch: parallel / sequential / ask |
All settings are optional. The orchestrator uses the defaults shown above when a variable is not set.
Script-backed setting precedence is: exported env var -> workspace .env -> extension .env -> default.
You can configure extension-scoped settings interactively with gemini extensions config maestro.
| Role | Model | Purpose |
|---|---|---|
| Inherited | (main session model) | All agents inherit the model from the main Gemini CLI session |
| Override | MAESTRO_DEFAULT_MODEL |
Set to a specific model (e.g., gemini-2.5-pro) to override parallel-dispatched agents |
All agents omit the model field by default, inheriting the main session's model selection. Override via MAESTRO_DEFAULT_MODEL or MAESTRO_WRITER_MODEL environment variables. These overrides apply to parallel dispatch only — sequentially delegated subagents always inherit the main session model.
Maestro uses Gemini CLI's hooks system for lifecycle middleware. Tool permissions are enforced natively via agent frontmatter tools: declarations — hooks handle supplementary lifecycle concerns:
| Hook | Purpose |
|---|---|
| SessionStart | Initialize hook state, prune stale sessions |
| BeforeAgent | Track active agent identity, inject session context |
| AfterAgent | Validate handoff report format, clear agent tracking |
| SessionEnd | Clean up hook state for ended session |
Hook handlers are in hooks/ and registered via hooks/hooks.json.
graph TB
User([User]) -->|/maestro:orchestrate| TL[TechLead Orchestrator]
TL -->|Phase 1| DD[Design Dialogue]
TL -->|Phase 2| IP[Implementation Planning]
TL -->|Phase 3| EX[Execution]
TL -->|Phase 4| CO[Completion]
EX -->|Sequential| DA[Gemini CLI Delegation]
EX -->|Parallel| PD[parallel-dispatch.js]
DA --> Agents
PD --> Agents
subgraph Agents [Specialized Subagents]
direction LR
A1[architect]
A2[coder]
A3[tester]
A4[debugger]
A5[+ 8 more]
end
Agents -->|Results| TL
TL -->|State| SS[(Session State)]
Maestro is built from seven layers, each with a distinct responsibility:
| Layer | Directory | Format | Purpose |
|---|---|---|---|
| Orchestrator | GEMINI.md |
Markdown | TechLead persona, phase transitions, delegation rules |
| Commands | commands/ |
TOML | CLI command definitions mapping user commands to prompts/skills |
| Agents | agents/ |
Markdown + YAML frontmatter | 12 subagent persona definitions with tool permissions and model config |
| Skills | skills/ |
Markdown (SKILL.md per directory) |
Reusable methodology modules with embedded protocols |
| Scripts | scripts/ |
Node.js | Execution infrastructure (workspace setup, state management, parallel dispatch, version sync) |
| Hooks | hooks/ |
JSON + Node.js | Lifecycle middleware for active-agent tracking and handoff validation |
| Templates | templates/ |
Markdown | Structure templates for generated artifacts (designs, plans, sessions) |
The TechLead engages you in a structured conversation to understand requirements:
- Asks one question at a time, preferring multiple-choice format
- Covers problem scope, constraints, technology preferences, quality requirements, and deployment context
- Presents 2-3 architectural approaches with pros, cons, and recommendations
- Builds the design document section by section, validating each with you
After design approval, the TechLead:
- Analyzes the design for components, interfaces, and dependencies
- Assigns phases to specialized agents based on task domain
- Identifies parallel execution opportunities
- Generates a detailed implementation plan for your approval
With plan approval, the TechLead:
- Delegates work to subagents phase by phase
- Runs parallel phases concurrently when dependencies allow
- Updates session state after each phase completion
- Handles errors with up to 2 automatic retries before escalating
After all phases complete:
- Final
code_reviewerquality gate — blocks completion on unresolved Critical/Major findings - Session state marked as completed
- Plans and state files archived to
archive/subdirectories - Summary delivered with files changed, token usage, and next steps
Maestro coordinates 12 specialized subagents:
All agents share a baseline tool set: read_file, list_directory, glob, grep_search, read_many_files, ask_user. The table below shows additional tools granted beyond that baseline.
| Agent | Specialization | Additional Tools | Model |
|---|---|---|---|
| architect | System design, technology selection, component design | web search/fetch | inherit |
| api_designer | REST/GraphQL endpoint design, API contracts | web search/fetch | inherit |
| coder | Feature implementation, clean code, SOLID principles | write, replace, shell, todos, skills | inherit |
| code_reviewer | Code quality review, best practices, security | (baseline only) | inherit |
| data_engineer | Schema design, query optimization, ETL pipelines | write, replace, shell, todos, web search | inherit |
| debugger | Root cause analysis, log analysis, execution tracing | shell, todos | inherit |
| devops_engineer | CI/CD pipelines, containerization, infrastructure | write, replace, shell, todos, web search/fetch | inherit |
| performance_engineer | Profiling, bottleneck identification, optimization | shell, todos, web search/fetch | inherit |
| refactor | Code modernization, technical debt, design patterns | write, replace, todos, skills | inherit |
| security_engineer | Vulnerability assessment, OWASP, threat modeling | shell, todos, web search/fetch | inherit |
| tester | Unit/integration/E2E tests, TDD, coverage analysis | write, replace, shell, todos, skills, web search | inherit |
| technical_writer | API docs, READMEs, architecture documentation | write, replace, todos, web search | inherit |
All agents can ask the user clarifying questions via ask_user (not available during parallel dispatch where agents run non-interactively).
- Read-only agents (architect, api_designer, code_reviewer): Produce analysis and recommendations
- Read + Shell agents (debugger, performance_engineer, security_engineer): Investigate without modifying files
- Read + Write agents (refactor, technical_writer): Modify code/docs without shell access
- Full access agents (coder, data_engineer, devops_engineer, tester): Complete implementation capabilities
Maestro uses skills to encapsulate detailed methodologies that are activated on demand, keeping the base context lean.
| Skill | Purpose | Activated By |
|---|---|---|
design-dialogue |
Structured requirements gathering and architectural design convergence | /maestro:orchestrate (Phase 1) |
implementation-planning |
Phase decomposition, agent assignment, and plan generation | /maestro:orchestrate (Phase 2) |
execution |
Phase execution protocols, error handling, and completion workflows | /maestro:orchestrate (Phase 3), /maestro:execute, /maestro:resume |
delegation |
Subagent prompt construction, scope boundaries, and parallel delegation | Any phase involving subagent delegation |
session-management |
Session creation, state updates, resume protocol, and archival | /maestro:orchestrate, /maestro:resume, /maestro:archive |
code-review |
Scope detection, severity classification, and structured review output | /maestro:review |
validation |
Build/lint/test pipeline, project type detection, and result interpretation | Post-phase validation during execution |
Maestro uses Node.js-based parallel dispatch, enabling independent implementation phases to run concurrently instead of sequentially.
The TechLead orchestrator uses scripts/parallel-dispatch.js to spawn concurrent Gemini CLI processes that execute independently. This bypasses the sequential subagent tool invocation pattern, which processes one delegation at a time.
Dispatch flow:
- The orchestrator writes self-contained delegation prompts to a dispatch directory
- Invokes
parallel-dispatch.jsvia shell - The script spawns one
gemini --approval-mode=yolo --output-format jsonprocess per prompt file, streaming prompt content over stdin - All agents execute concurrently as independent OS processes
- Results are collected with exit codes, logs, and structured JSON output
- The orchestrator reads results and updates session state
| Use Parallel Dispatch | Use Sequential Delegation |
|---|---|
| Phases at the same dependency depth | Phases with shared file dependencies |
| Non-overlapping file ownership | Phases that may need interactive clarification |
| Fully self-contained prompts | Single-phase execution |
| Batch size of 2-4 agents | Fallback when parallel dispatch fails |
<state_dir>/parallel/<batch-id>/
├── prompts/
│ ├── agent-a.txt # Full delegation prompt
│ └── agent-b.txt
└── results/
├── agent-a.json # Structured JSON output
├── agent-a.exit # Exit code (0=success, 124=timeout)
├── agent-a.log # stderr/debug output
├── agent-b.json
├── agent-b.exit
├── agent-b.log
└── summary.json # Batch summary with status per agent
Parallel agents run as independent CLI processes with no shared context. Each prompt must be complete and self-contained — agents cannot ask follow-up questions or access results from other agents in the same batch.
Maestro creates the following directories in your project:
<your-project>/
└── .gemini/
├── parallel/ # Parallel dispatch batches
├── plans/ # Active design docs and implementation plans
│ ├── archive/ # Completed plans
│ ├── YYYY-MM-DD-<topic>-design.md
│ └── YYYY-MM-DD-<topic>-impl-plan.md
└── state/ # Session tracking
├── archive/ # Completed sessions
└── active-session.md # Current orchestration state
Maestro tracks orchestration progress in <MAESTRO_STATE_DIR>/state/active-session.md (default: .gemini/state/active-session.md) with:
- Phase status tracking: pending, in_progress, completed, failed, skipped
- File manifest: Files created, modified, and deleted per phase
- Error tracking: Per-phase error logs with retry counts and resolution records
- Token usage: Per-agent, per-phase token consumption metrics
All state files use YAML frontmatter for machine-readable metadata and Markdown body for human-readable logs.
- Usage Guide — Comprehensive guide to installing, configuring, and using Maestro
- System Overview — Extension entry point, component model, and configuration system
- Agent System — Agent definitions, tool permissions, model assignment, and delegation
- Skills & Commands — Skill activation, command definitions, and protocol contracts
- State Management & Scripts — Session state, parallel dispatch, and execution infrastructure
- Comprehensive Map — High-level architectural map connecting all components
- Verify the extension is linked:
gemini extensions list - Restart Gemini CLI after installation or linking
- Check
gemini-extension.jsonexists in the maestro directory
- Ensure GEMINI.md is present in the maestro directory
- Check that
commands/maestro/orchestrate.tomlexists - Restart Gemini CLI
- Verify
active-session.mdexists under your configured state directory (.gemini/state/by default) - Check the YAML frontmatter is valid (no syntax errors)
- If corrupted, manually fix the YAML or delete and start fresh with
/maestro:orchestrate
- Maestro automatically retries failed phases up to 2 times
- If retries are exhausted, you'll be asked for guidance
- Check the session state file for detailed error logs
- Common causes: file conflicts, missing dependencies, validation failures
Agents timing out:
- Check
MAESTRO_AGENT_TIMEOUTsetting (default: 10 minutes) - Review agent logs in
<dispatch-dir>/results/<agent>.log - Reduce batch size to 2 agents if system resources are constrained
Empty or missing results:
- Verify prompt files are non-empty in
<dispatch-dir>/prompts/ - Check that
geminiCLI is on PATH and accessible - Review
summary.jsonfor per-agent status and exit codes
Parallel dispatch script not found:
- Verify
scripts/parallel-dispatch.jsexists in the extension directory - Ensure Node.js is available on PATH (provided by Gemini CLI)
- Fork the repository
- Create a feature branch:
git checkout -b feat/your-feature - Make your changes
- Test manually by linking the extension:
gemini extensions link . - Verify commands work in Gemini CLI
- Submit a pull request
Run the test suite with node tests/run-all.js. All other changes are validated manually via Gemini CLI.
MIT