Skip to main content
@google/gemini-cli (v0.40.1+).

Install

Auth

Crewship’s apiKeyEnvVarsForAdapter("GEMINI_CLI") accepts either; both are mirrored to the container env so any version of gemini-cli finds its key.

Models

gemini-2.0-flash and gemini-1.5-pro are not available in the current Gemini API catalog — removed from picker. Note the dash-separated ID format (gemini-3-1-pro, not gemini-3.1-pro); Google’s models.list endpoint returns this canonical form.

Command shape

  • -p — non-interactive prompt mode
  • --output-format stream-json — JSONL events (PR #10883)
  • -m — model selector
  • --approval-mode plan — appended only for the MINIMAL profile (Gemini’s read-only mode; its named-tool allowlist --allowed-tools is deprecated in favour of the Policy Engine). CODING/FULL keep the default flow.
  • System prompt folded into prompt body since headless mode has no --system-instruction flag

MCP

Configured at /output/<slug>/.gemini/settings.json:
Crewship prefers httpUrl (HTTP streaming, current) over url (SSE, legacy) — url is only emitted when the source explicitly declares sse transport. Env-var syntax ${VAR} or $VAR (POSIX); both expanded by gemini-cli at MCP spawn.
Crewship also auto-injects two sidecar-hosted servers into .gemini/settings.json (injectMemoryMCP + injectRoutinesMCP): crewship-memory (http://127.0.0.1:9119/mcp/memory/<slug>) and crewship-routines (.../mcp/routines), both emitted as httpUrl entries. A user-declared server of the same name wins.

Memory

Canonical memory set including GEMINI.md (Gemini’s auto-discovery path) at /output/<slug>/.

Output stream

JSONL per geminicli.com/docs/cli/headless:

Troubleshooting

gemini: not found — npm install failed. Auth precedence trap — if both GEMINI_API_KEY (AI Studio) and GOOGLE_API_KEY (Cloud) are in the env, GOOGLE wins silently. Use one or the other. Exit code 52 with no JSON — auth failure (issue #20183). Orchestrator detects exit-without-result and surfaces as run error.