Skip to content

Agent Architecture

Gemini CLI

Gemini CLI is an open-source terminal-first agent with built-in tools, MCP extension, custom commands, GEMINI.md context, checkpointing, GitHub automation, and a fast-moving release cadence.

Source reviewed #7Checked 2026-07-06
Run type
CLI
Adapter
json-stdio
Source
OSS · google-gemini/gemini-cli
Stars
★ 107k

Archive Context

This page is one host entry inside the full architecture archive and keeps multi-surface products visible instead of collapsing them into a single run type.

42 host archive
Host page
gemini-cli
Run cohort
CLI: 30
Archive route
/agents

Host Surface Perspectives

The host is the primary architecture boundary. Each runnable surface below separates what the host owns from what agent-connector can safely install for Gemini CLI.

1 surface entry

CLI

cli
Host entry
A terminal command owns the process, current working directory, stdin/stdout, shell environment, and project file discovery.
Host owns
The CLI host owns agent loop timing, approval prompts, tool execution, session files, and how hook or MCP subprocesses are launched.
Connector role
agent-connector can only write the host's documented CLI config, prompt, memory, hook, MCP, or package files and point them at the home binary. Current wired connector surfaces: MCP server, Hooks, Commands, Skills, Subagents, Memory.
Implementation consequence
A CLI surface is byte-addressable and smoke-testable from a temporary HOME, but terminal UI behavior still belongs to the host process. No visible host-native gap is currently tracked for this surface.

Verified Architecture

Source-checked on 2026-07-06. These notes are intentionally separate from the generated surface matrix below.

Sequence #7

Source pass

Current source review findings are kept as the first architecture section so readers can separate external evidence from the generated local coverage model.

  • Gemini CLI is explicitly an open-source terminal agent, so the architecture is classified as CLI even though it shares product lineage with Google's desktop Antigravity host.
  • Its wide adapter surface makes it a useful json-stdio reference beside Claude Code and Codex: MCP, hooks, commands, skills, subagents, memory, and marketplace delivery are all tracked.
  • The page keeps Gemini CLI separate from Antigravity CLI/Desktop so lifecycle and marketplace claims do not leak across Google host surfaces.

Runtime boundary

The adapter target is the terminal CLI. Gemini CLI owns the interactive session, authentication, built-in tools, model calls, and optional headless scripting; agent-connector writes host-native config and content so Gemini can discover the connector through its existing runtime.

  • The public repository identifies Gemini CLI as an open-source agent that brings Gemini directly into the terminal.
  • The CLI supports interactive use, headless prompts, stream-json output, and GitHub Action workflows.
  • The archive keeps this separate from Google Antigravity so product-family claims do not leak across adapters.

MCP registration

MCP is a documented extension path for Gemini CLI. The README points users to `~/.gemini/settings.json` for MCP servers, so adapter writes must preserve Gemini's settings shape rather than reuse another host's TOML or JSON layout.

  • MCP extends Gemini CLI with custom integrations beyond built-in file, shell, web fetch, and search tools.
  • The CLI examples address external systems through named MCP servers, which makes server naming and enablement visible to users.

Hook bridge

agent-connector classifies Gemini CLI as a json-stdio runtime host. The page should therefore describe hook support through the local adapter contract while keeping externally documented Gemini capabilities, such as MCP and headless mode, separate from hook event claims.

  • Hook claims must remain adapter-backed because the public README foregrounds tools, MCP, commands, and context files more than lifecycle event schemas.
  • The host's stream-json mode is useful for automation but is not by itself a lifecycle hook boundary.

Content surfaces

Gemini CLI content is centered on GEMINI.md context, custom slash commands, checkpointing, and command-line modes. agent-connector should keep persistent context and command content separate from runtime hooks.

  • GEMINI.md is the persistent context file called out by the public docs.
  • Custom commands and the commands reference are first-class documentation topics.
  • Checkpointing and token caching are host features that affect session ergonomics, not connector install shape.

Marketplace and host-only affordances

Gemini CLI is open source with npm, Homebrew, preview, stable, and nightly release channels. The connector marketplace path should account for a fast-moving host whose extension and release behavior may shift weekly.

  • Built-in Google Search grounding and multimodal file understanding are host-only affordances outside MCP registration.
  • GitHub Action support is a workflow surface, not the same as the local CLI adapter.

Host-specific shape

Gemini CLI is a broad json-stdio example with MCP, hooks, commands, skills, subagents, memory, and marketplace delivery; it remains useful as the legacy terminal sibling to Antigravity.

  • Form factor: CLI.
  • Native surfaces: MCP server, Hooks, Commands, Skills, Subagents, Memory.
  • Wired surfaces: MCP server, Hooks, Commands, Skills, Subagents, Memory.
  • Visible gaps: none.

Hooks

Hooks enter through a host-launched command that exchanges event JSON over stdio.

MCP

The adapter writes this host's native MCP registration dialect, including its root key, scope, transport fields, and environment syntax.

Memory

Managed memory text is written into the rules or memory file this host actually reads, with ownership markers for reversible uninstall.

Marketplace and affordances

A marketplace or plugin-driver path is wired, so install/update/uninstall can be driven rather than only emitted as files.

  • Runtime handlers: none.
  • User-visible affordances: Users see managed commands + skills + subagents + memory surfaces after install; runtime-only surfaces stay behind the host boundary..

Known Limits

  • This page documents Gemini CLI, not Antigravity CLI or Antigravity desktop.
  • Lifecycle hook details should be verified against the local adapter and any current Gemini hook documentation before adding event-level claims.
  • Release-channel information is intentionally treated as host cadence, not as connector compatibility proof.

Architecture Diagram

Host-specific flow for the CLI surface.

json-stdio
Host-owned architecture flowHost surfaceCLIRuntimejson-stdioNative artifactsMCP + hooks + content + memoryConnector boundarystdio eventsUser surfacecmds + skills + agents + memoryagent-connector writes only documented host artifacts; the host owns the agent loop.
  1. 1
    Entry point: CLI

    Terminal agent process reads user/project config and invokes the connector home binary for runtime callbacks.

  2. 2
    Connector package

    defineConnector package declares server, hooks, content, memory, and actions.

  3. 3
    Adapter module: gemini-cli

    json-stdio renderer at src/adapters/gemini-cli/index.ts.

  4. 4
    Native host artifacts

    Adapter writes MCP config + hook config + content files + memory/rules + marketplace bundle through this host's native file, package, or marketplace surface.

  5. 5
    Runtime boundary

    host launches JSON-stdio hook command

  6. 6
    User-visible surface

    Users see managed commands + skills + subagents + memory surfaces after install; runtime-only surfaces stay behind the host boundary.

  7. 7
    Coverage ceiling

    6/6 native surfaces wired. No visible host-native gap in the current coverage matrix.

Component Diagram

Static parts of the Gemini CLI integration and which side owns each one.

Components and ownershipGemini CLI hosthostagent-connector packageconnectorgemini-cli adapterjson-stdioNative artifactsartifactsRuntime bridgeruntimeUser-visible surfaceuser
  • Gemini CLI host

    CLI surface owns the model loop, UI shell, config discovery, and native lifecycle for this integration.

  • agent-connector package

    Normalizes connector declarations into MCP, hook, memory, content, and action payloads before delegating to a host adapter.

  • gemini-cli adapter

    Implements the json-stdio translation layer in src/adapters/gemini-cli/index.ts.

  • Native artifacts

    Adapter writes MCP config + hook config + content files + memory/rules + marketplace bundle through this host's native file, package, or marketplace surface.

  • Runtime bridge

    host launches JSON-stdio hook command

  • User-visible surface

    Users see managed commands + skills + subagents + memory surfaces after install; runtime-only surfaces stay behind the host boundary.

Runtime Sequence Flow

Message order from install to runtime for the CLI surface.

User / projectagent-connectorgemini-cli adapterGemini CLIAgent runtimeCoverage matrix1. Choose host adapter2. Resolve connector declaration3. Render host-native shape4. Host loads artifacts5. Run through host boundary6. Expose remaining ceiling
  1. 1 · User / project
    Choose host adapter

    Install or update starts against Gemini CLI; the selected surface is CLI.

  2. 2 · agent-connector
    Resolve connector declaration

    The package reads connector metadata and routes it to the gemini-cli adapter instead of exposing a generic host contract.

  3. 3 · gemini-cli adapter
    Render host-native shape

    Adapter writes MCP config + hook config + content files + memory/rules + marketplace bundle through this host's native file, package, or marketplace surface.

  4. 4 · Gemini CLI
    Host loads artifacts

    host launches JSON-stdio hook command

  5. 5 · Agent runtime
    Run through host boundary

    Users see managed commands + skills + subagents + memory surfaces after install; runtime-only surfaces stay behind the host boundary.

  6. 6 · Coverage matrix
    Expose remaining ceiling

    6/6 native surfaces wired. No visible host-native gap in the current coverage matrix.

Architecture Archive

The same five study axes are rendered for every host: runtime shape, hooks, MCP, memory, and host-only affordances.

Host-specific shape

Gemini CLI is a broad json-stdio example with MCP, hooks, commands, skills, subagents, memory, and marketplace delivery; it remains useful as the legacy terminal sibling to Antigravity.

  • Form factor: CLI.
  • Native surfaces: MCP server, Hooks, Commands, Skills, Subagents, Memory.
  • Wired surfaces: MCP server, Hooks, Commands, Skills, Subagents, Memory.
  • Visible gaps: none.

Hooks

Hooks enter through a host-launched command that exchanges event JSON over stdio.

MCP

The adapter writes this host's native MCP registration dialect, including its root key, scope, transport fields, and environment syntax.

Memory

Managed memory text is written into the rules or memory file this host actually reads, with ownership markers for reversible uninstall.

Marketplace and affordances

A marketplace or plugin-driver path is wired, so install/update/uninstall can be driven rather than only emitted as files.

  • Runtime handlers: none.
  • User-visible affordances: Users see managed commands + skills + subagents + memory surfaces after install; runtime-only surfaces stay behind the host boundary..

Special Feature Inventory

Host-specific capabilities separated from the generic surface matrix: lifecycle hooks, MCP registration, memory/rules, marketplace delivery, and UI or content affordances owned by the host.

Lifecycle hooks

Wired

Hooks enter through a host-launched command that exchanges event JSON over stdio.

MCP registration

Wired

The adapter writes this host's native MCP registration dialect, including its root key, scope, transport fields, and environment syntax.

Memory and rules

Wired

Managed memory text is written into the rules or memory file this host actually reads, with ownership markers for reversible uninstall.

Marketplace delivery

Driver wired

A marketplace or plugin-driver path is wired, so install/update/uninstall can be driven rather than only emitted as files.

Host-only affordances

3/3 wired

Wired host affordances: Commands, Skills, Subagents. Host-native gaps: none. Not confirmed: Statusline handler, Action affordances.

Source Review Notes

Latest source pass for host-specific architecture details. This is separate from generated adapter coverage and local drift guards.

Checked 2026-07-06Open review source
google-gemini/gemini-cli repository
  • Gemini CLI is explicitly an open-source terminal agent, so the architecture is classified as CLI even though it shares product lineage with Google's desktop Antigravity host.
  • Its wide adapter surface makes it a useful json-stdio reference beside Claude Code and Codex: MCP, hooks, commands, skills, subagents, memory, and marketplace delivery are all tracked.
  • The page keeps Gemini CLI separate from Antigravity CLI/Desktop so lifecycle and marketplace claims do not leak across Google host surfaces.

Evidence Map

Each host page ties public source evidence to the local adapter and drift guards that keep the rendered archive aligned with code.

Public source: google-gemini/gemini-cli

Primary public repository or product source used for current host status and source links.

external
Open source

Local adapter implementation

Defines the install/uninstall behavior, native config rendering, capability flags, and any runtime parse/format bridge for this host.

local
src/adapters/gemini-cli/index.ts

Platform metadata and host-native matrix

Records the form factor, public source target, ranking source, native host surfaces, and current agent-connector coverage cells.

local
site/src/platform-data.ts

Architecture drift guard

Asserts that every registered host has a page, diagram, host-specific brief, source link, form-factor band, and adapter-aligned surface data.

local
tests/docs/platform-drift.test.ts

Marketplace driver registry

Shows this host has a drivable package/plugin install path beyond direct native-file writes.

local
src/core/marketplace-drivers/registry.ts

Runtime Shape

Hooks are dispatched through a host-launched command. The adapter parses host JSON, calls the connector handler, and formats the reply back to the host contract.

MCP registration
Wired through this adapter
Hook bridge
Wired

Connector Surfaces

Static content

MCP server, Hooks, Commands, Skills, Subagents, Memory

Runtime handlers

No runtime handler surfaces wired

Surface Matrix

Wired means agent-connector installs it now. Host native marks support we know about but have not wired yet.

SurfaceStatus
MCP server
Static content
agent-connector installs this surface today.
Wired
Hooks
Static content
agent-connector installs this surface today.
Wired
Commands
Static content
agent-connector installs this surface today.
Wired
Skills
Static content
agent-connector installs this surface today.
Wired
Subagents
Static content
agent-connector installs this surface today.
Wired
Memory
Static content
agent-connector installs this surface today.
Wired
Statusline handler
Runtime handler
No confirmed host-native surface.
N/A
Action affordances
Runtime handler
No confirmed host-native surface.
N/A