Gemini Runtime

April 30, 2026 · View on GitHub

The Gemini CLI extension lives at the repository root. It is the primary runtime target.

Configuration

Manifest: gemini-extension.json Version: generated from package.json Context File: GEMINI.md

MCP Server

{
  "command": "node",
  "args": ["${extensionPath}/mcp/maestro-server.js"],
  "cwd": "${extensionPath}",
  "env": {
    "MAESTRO_RUNTIME": "gemini",
    "MAESTRO_WORKSPACE_PATH": "${workspacePath}"
  }
}

The public server at mcp/maestro-server.js is a thin adapter. The manifest launches it with MAESTRO_RUNTIME=gemini; the adapter also defaults to Gemini if that env var is absent. It requires canonical src/mcp/maestro-server.js directly and runs the Gemini runtime against shared source in src/. Gemini declares primary: filesystem and fallback: none.

Agent Naming

Gemini uses snake_case for agent names: code_reviewer, api_designer, accessibility_specialist.

Agent files are generated at agents/*.md with snake_case filenames.

Delegation

Direct function call syntax:

coder(query: "Implement the user service...")
architect(query: "Design the auth system...")

Commands

12 TOML commands in commands/maestro/:

CommandSource
orchestrate.tomlCore command registry
execute.tomlCore command registry
resume.tomlCore command registry
review.tomlEntry-point registry
debug.tomlEntry-point registry
archive.tomlEntry-point registry
status.tomlEntry-point registry
security-audit.tomlEntry-point registry
perf-check.tomlEntry-point registry
seo-audit.tomlEntry-point registry
a11y-audit.tomlEntry-point registry
compliance-check.tomlEntry-point registry

Hooks

4 hook events, no matchers, 10-second timeout:

EventScriptPurpose
SessionStarthooks/hook-runner.js gemini session-startInitialize hook state, prune stale sessions
BeforeAgenthooks/hook-runner.js gemini before-agentDetect agent, inject session context
AfterAgenthooks/hook-runner.js gemini after-agentValidate Task Report + Downstream Context
SessionEndhooks/hook-runner.js gemini session-endClean up hook state

AfterAgent Validation

Gemini has a post-delegation validation hook that Claude lacks:

  • Checks for ## Task Report (or # Task Report) and ## Downstream Context headings
  • First failure: blocks and requests retry
  • Second failure (stopHookActive=true): allows through with warning

Hook Adapter

hooks/adapters/gemini-adapter.js normalizes Gemini CLI JSON input:

Gemini FieldInternal Field
session_idsessionId
cwdcwd
hook_event_nameevent
(hardcoded null)agentName
promptagentInput
prompt_responseagentResult
stop_hook_activestopHookActive

Output format: { continue: boolean, systemMessage?: string }

Policies

policies/maestro.toml — TOML-based shell guardrails evaluated by Gemini's native policy engine:

Deny (priority 950):

  • rm -rf, rm -fr, sudo rm -rf, sudo rm -fr
  • git reset --hard, git checkout --
  • git clean -fd, git clean -df, git clean -xfd, git clean -xdf
  • Heredocs (<<)

Ask User (priority 850):

  • tee commands
  • Output redirection (>, >>)

Tool Mapping

Gemini tools use canonical names (identity mapping):

CanonicalGemini
read_fileread_file
read_many_filesread_file (called per-file)
list_directorylist_directory
globglob
grep_searchgrep_search
google_web_searchgoogle_web_search
web_fetchweb_fetch
write_filewrite_file
replacereplace
run_shell_commandrun_shell_command
ask_userask_user
write_todosnot available — track progress in model context
activate_skillactivate_skill
enter_plan_modeenter_plan_mode
exit_plan_modeexit_plan_mode
codebase_investigatorcodebase_investigator

Feature Flags

The canonical feature set (same 4 flags across all runtimes, values per runtime):

exampleBlocks:             false
claudeStateContract:       false
scriptBasedStateContract:  true
codexStateContract:        false

See src/platforms/gemini/runtime-config.js for the authoritative values.

Agent Frontmatter

Gemini agent stubs include:

---
name: coder
kind: local
description: "..."
tools: [read_file, write_file, ...]
temperature: 0.2
max_turns: 25
timeout_mins: 10
---

Fields: kind (always "local"), temperature, max_turns, timeout_mins.

Generated Files

agents/                    39 agent stubs (snake_case)
commands/maestro/          12 TOML commands
hooks/                     thin hook runner, adapter wrapper, hooks.json
mcp/                       thin MCP entrypoint
policies/                  1 TOML policy file
README.md, GEMINI.md, gemini-extension.json, .geminiignore