gemini
gemini - execute non-interactive Google Gemini prompts
SYNOPSIS
Section titled “SYNOPSIS”state-name: tool: gemini arguments: prompt: <prompt-text> model: <model-name> # optional timeout: <duration> # optional output-format: <format> # optionalDESCRIPTION
Section titled “DESCRIPTION”The gemini tool invokes Google’s Gemini CLI for AI-powered tasks. It sends a prompt using the -p flag and captures the response.
The tool runs in the project root directory for full codebase context.
ARGUMENTS
Section titled “ARGUMENTS”| Argument | Required | Default | Description |
|---|---|---|---|
prompt | Yes | - | The prompt to send to Gemini |
model | No | Default model | Model to use (e.g., gemini-flash) |
timeout | No | 5m | Maximum execution time |
output-format | No | - | Output format |
Timeout Format
Section titled “Timeout Format”30s- 30 seconds5m- 5 minutes1h- 1 hour
EXIT CODES
Section titled “EXIT CODES”| Code | Meaning |
|---|---|
0 | Success |
1 | Gemini error or authentication issue |
2 | Gemini CLI not found |
124 | Timeout exceeded |
OUTPUT
Section titled “OUTPUT”Both stdout and stderr are merged for capture:
analyze: tool: gemini arguments: prompt: "Summarize this document" output: var(summary)EXAMPLES
Section titled “EXAMPLES”Simple Prompt
Section titled “Simple Prompt”quick-question: tool: gemini arguments: prompt: "What's the best practice for error handling in Go?"With File Content
Section titled “With File Content”review-code: tool: gemini arguments: prompt: | Review this code for potential improvements:
{{ file(./src/main.go) }} output: var(review)With Model Selection
Section titled “With Model Selection”fast-task: tool: gemini arguments: prompt: "Generate a brief summary" model: gemini-flashError Handling
Section titled “Error Handling”gemini-task: tool: gemini arguments: prompt: "Analyze codebase architecture" timeout: 10m on-error: 1: check-auth 2: gemini-not-installed 124: handle-timeout _: general-error next: use-result
check-auth: tool: bash arguments: command: | echo "Gemini authentication issue. Run 'gemini' interactively to log in." exit 1
gemini-not-installed: tool: bash arguments: command: | echo "Gemini CLI not found. Install from https://github.com/google-gemini/gemini-cli" exit 1In a Multi-AI Workflow
Section titled “In a Multi-AI Workflow”# Get perspectives from multiple AIsstart-at: get-claude-opinion
states: get-claude-opinion: tool: claude arguments: prompt: "How would you implement {{ feature }}?" output: var(claude_response) next: get-gemini-opinion
get-gemini-opinion: tool: gemini arguments: prompt: "How would you implement {{ feature }}?" output: var(gemini_response) next: compare
compare: tool: bash arguments: command: | echo "=== Claude's Approach ===" echo "{{ claude_response }}" echo "" echo "=== Gemini's Approach ===" echo "{{ gemini_response }}"INSTALLATION
Section titled “INSTALLATION”Install the Gemini CLI:
# Follow instructions at https://github.com/google-gemini/gemini-cliAuthenticate by either:
- Running
geminiinteractively to complete OAuth login - Setting the
GEMINI_API_KEYenvironment variable
RATE LIMITS
Section titled “RATE LIMITS”The free tier has limits:
- 60 requests per minute
- 1,000 requests per day
If rate limited (exit code 1 with rate limit message), consider:
- Using
gemini-flashmodel (lower limits) - Adding delays between requests
- Upgrading to a paid plan
WORKING DIRECTORY
Section titled “WORKING DIRECTORY”The tool runs in the project root directory, giving Gemini access to the full project context.