← 返回 Skills 市场
cl0ckt0wer

Gemini Worker

作者 Trip · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
88
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install gemini-worker
功能描述
Run Gemini CLI as a headless worker agent for long-running or parallelizable tasks. Use when: (1) Anthropic API is overloaded/unavailable (529 errors) and yo...
使用说明 (SKILL.md)

Gemini Worker

Run Gemini CLI headlessly as a background worker. Gemini handles its own OAuth via ~/.gemini/oauth_creds.json — authenticate once interactively, then all headless runs use cached credentials.

Key insight: gemini --acp requires a TTY and hangs headlessly. Use gemini -p "..." --yolo instead — it takes a prompt as argument, runs to completion, and exits. See references/acp-vs-headless.md for the full technical explanation.

Quick Start

# Simple prompt
gemini -p "Your prompt here" --yolo

# With workspace access (required for file reads/writes outside ~/.gemini)
gemini \
  --include-directories /path/to/dir1,/path/to/dir2 \
  --yolo \
  -p "Your prompt here"

# Long prompts via file (recommended for >1KB prompts)
gemini \
  --include-directories /tmp/task-dir \
  --yolo \
  -p "$(cat /tmp/task-dir/prompt.txt)"

Key Flags

Flag Purpose
-p "..." Headless mode — prompt as argument, no TTY needed
--yolo Auto-approve all tool calls (required for headless)
--include-directories a,b Grant read/write access to dirs outside workspace
--model gemini-2.5-pro-preview-03-25 Override model (default: gemini-2.5-pro)

Critical: Gemini CLI restricts file access to its workspace (~/.gemini/tmp/workspace and --cwd). Use --include-directories to grant access to your project directories. /tmp is outside the default workspace — include it explicitly if needed.

Anthropic Fallback Pattern

When Anthropic returns 529 Overloaded, Gemini is a capable drop-in worker:

cat > /tmp/fallback-task.txt \x3C\x3C 'TASK'
You are a senior engineer. Read the spec at /path/to/spec.md.
Implement the feature. Write code to /path/to/output.ts.
Write a summary to /tmp/summary.md.
TASK

timeout 600 gemini \
  --include-directories /path/to/project,/tmp \
  --yolo \
  -p "$(cat /tmp/fallback-task.txt)"

Parallel Workers Pattern

# Spawn 3 parallel Gemini workers
gemini --include-directories /path/to/task1 --yolo -p "$(cat /tmp/task1.txt)" > /tmp/out1.txt &
gemini --include-directories /path/to/task2 --yolo -p "$(cat /tmp/task2.txt)" > /tmp/out2.txt &
gemini --include-directories /path/to/task3 --yolo -p "$(cat /tmp/task3.txt)" > /tmp/out3.txt &
wait  # Wait for all 3

Pre-fetch Pattern (WebFetchTool Workaround)

Gemini CLI's WebFetchTool is unreliable in headless mode. Pre-fetch with curl:

# Pre-fetch a URL to a file Gemini can read
curl -sL https://example.com/doc | python3 -c "
from html.parser import HTMLParser; import sys
class S(HTMLParser):
    def __init__(self): super().__init__(); self.t=[]
    def handle_data(self, d):
        if d.strip(): self.t.append(d.strip())
p=S(); p.feed(sys.stdin.read()); print('\
'.join(p.t[:500]))
" > /tmp/fetched-doc.txt

# Then run Gemini with access to /tmp
gemini --include-directories /tmp --yolo -p "Read /tmp/fetched-doc.txt and ..."

Wrapper Script

Use scripts/gemini-run.sh (Linux/macOS) or scripts/gemini-run.ps1 (Windows/PowerShell) for timeout handling, logging, and output capture:

Linux/macOS (bash)

scripts/gemini-run.sh /tmp/prompt.txt "/path/to/project,/tmp" /tmp/output.txt

Windows (PowerShell)

.\scripts\gemini-run.ps1 C:	mp\prompt.txt "C:\path	o\project,C:	mp" C:	mp\output.txt

Windows (Command Prompt)

scripts\gemini-run.cmd C:	mp\prompt.txt "C:\path	o\project,C:	mp" C:	mp\output.txt

Known Limitations

  • No access to OpenClaw tools (web_search, memory_search, cron, etc.)
  • WebFetchTool unreliable headlessly — pre-fetch with curl instead
  • /tmp outside workspace — add --include-directories /tmp/your-dir
  • Large prompts (>4KB): write to file, reference by path in prompt
  • Auth required once: run gemini interactively to complete OAuth, then headless works
  • Output truncation: ask Gemini to write to file instead of relying on stdout for large outputs

References

  • references/acp-vs-headless.md — Why ACP fails, how -p --yolo works, decision matrix
  • references/prompt-patterns.md — Reusable prompt templates
  • references/troubleshooting.md — Common errors and fixes
  • scripts/gemini-run.sh — Wrapper with timeout and error handling
安全使用建议
This skill appears to do exactly what it claims: run Gemini CLI headlessly as a worker. That requires granting the Gemini process explicit read/write access to whatever paths you pass via --include-directories and running with --yolo (auto-approve tool calls). Before installing or using it: 1) Limit --include-directories to the minimal directories needed (avoid including /, your home dir, or other sensitive paths). 2) Do not pass untrusted input directly into -p; prefer writing untrusted content to a file and point Gemini at that file as the docs recommend. 3) Be aware that any file paths you include can be read or written by the Gemini process (and the model can be instructed to run commands via tool calls when --yolo is set). 4) Install @google/gemini-cli only from the official npm package and verify provenance if possible. 5) Consider running the worker in an isolated environment (container, CI runner, or dedicated service account) if you will include project or system directories. If you want stronger assurance, ask the maintainer for a homepage or repository signature, or request a signed release link so you can verify the upstream source.
功能分析
Type: OpenClaw Skill Name: gemini-worker Version: 1.0.0 The skill provides a legitimate framework for using the Gemini CLI as a headless background worker for OpenClaw. It includes a bash wrapper script (scripts/gemini-run.sh) and extensive documentation (SKILL.md, README.md) explaining how to use Gemini's single-shot execution mode (-p) with auto-approval (--yolo) to bypass TTY requirements. While the use of --yolo and broad directory access (--include-directories) represents a high-privilege capability, it is aligned with the stated purpose of running a parallel worker agent, and the documentation includes proactive security advice regarding prompt injection risks.
能力标签
cryptorequires-oauth-token
能力评估
Purpose & Capability
Name/description, SKILL.md, README, and the included shell wrapper all consistently implement the stated goal: run Google Gemini CLI as a headless worker. The suggested npm install of @google/gemini-cli, the gemini binary usage, and the wrapper script are appropriate and proportional to the described functionality.
Instruction Scope
Instructions legitimately require passing prompts, granting directory access via --include-directories, and auto-approving tool calls with --yolo. Those behaviors are necessary for headless worker use but expand the agent's ability to read/write and have Gemini execute tool calls. SKILL.md does mention prompt-injection risks and gives safer patterns, but the guidance still encourages running with --yolo and absolute include paths — both sensible for the use case but sensitive if misused.
Install Mechanism
No platform-level install spec is provided (instruction-only), which is lower risk. The documentation recommends installing @google/gemini-cli via npm, which is an expected and traceable install for this skill's purpose. No obscure download URLs or extracted archives are present.
Credentials
The skill does not request secrets or external credentials through requires.env. It expects the user to bootstrap OAuth interactively (credentials cached at ~/.gemini/oauth_creds.json) and supports optional GEMINI_TIMEOUT/GEMINI_MODEL env vars in the wrapper script. These are proportionate, though the presence of cached OAuth credentials on disk means the Gemini process will have access to any files you explicitly include.
Persistence & Privilege
always:false and no modifications to other skills or system-wide agent settings. The wrapper will create include directories if missing and relies on the user's cached OAuth file in ~/.gemini — this is normal for a CLI-based worker and not an escalation of platform privileges.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install gemini-worker
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /gemini-worker 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of gemini-worker: headless Gemini CLI agent for background or parallel tasks. - Run Gemini CLI non-interactively for automation, fallback, or parallel batch jobs. - Designed for scenarios where Anthropic API is overloaded (529 errors), deep analysis, or validation outside the main agent loop. - Supports prompt-as-argument mode with `-p "..." --yolo` and custom directory access via `--include-directories`. - CLI authentication managed once interactively; subsequent runs use cached credentials. - Known limitations: no OpenClaw integration, unreliable headless WebFetchTool, workspace directory restrictions. - Includes bash, PowerShell, and CMD wrapper scripts and extensive usage guides and troubleshooting docs.
元数据
Slug gemini-worker
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Gemini Worker 是什么?

Run Gemini CLI as a headless worker agent for long-running or parallelizable tasks. Use when: (1) Anthropic API is overloaded/unavailable (529 errors) and yo... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 88 次。

如何安装 Gemini Worker?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install gemini-worker」即可一键安装,无需额外配置。

Gemini Worker 是免费的吗?

是的,Gemini Worker 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Gemini Worker 支持哪些平台?

Gemini Worker 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Gemini Worker?

由 Trip(@cl0ckt0wer)开发并维护,当前版本 v1.0.0。

💬 留言讨论