跳到正文
Skillpedia
通用编程260k · #442

grok

它能做什么

它指导你的智能体在编程任务上运行 Grok Build 命令行工具。它适合希望由 Grok 担任某项工作的编程智能体的开发者。

适用场景

  • ✓你希望 Grok 构建功能或重构部分代码的时候。
  • ✓你希望 Grok 审阅某个拉取请求的时候。
  • ✓你希望由 Grok 而不是其他编程智能体来批量修复议题的时候。

技能链接

https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/autonomous-ai-agents/grok/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/autonomous-ai-agents/grok/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请让 Grok 审阅支付模块中未关闭的拉取请求,并告诉我它发现了什么。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体对一次性任务以无界面模式运行 Grok,对较长的会话则在交互式终端中运行。技能说明登录时使用 SuperGrok 或 X Premium 订阅。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Grok Build CLI — Hermes Orchestration Guide

Delegate coding tasks to Grok Build (xAI's autonomous coding agent CLI, the grok command) via the Hermes terminal. Grok can read files, write code, run shell commands, spawn subagents, and manage git workflows. It runs three ways: an interactive TUI, headless (-p), and as an ACP agent over JSON-RPC.

This is the third sibling to codex and claude-code. The orchestration pattern is nearly identical — prefer headless -p for one-shots, use a PTY for interactive sessions.

When to use

  • Building features
  • Refactoring
  • PR reviews
  • Batch issue fixing
  • Any task where you'd otherwise reach for Codex / Claude Code but want Grok

Prerequisites

  • Install (preferred): npm install -g @xai-official/grok
    • The official installer curl -fsSL https://x.ai/cli/install.sh | bash also works, but the x.ai host is Cloudflare-walled in some environments. The npm path avoids that dependency entirely.
  • Auth — SuperGrok / X Premium+ subscription (primary path):
    • Run grok login once → opens a browser for OAuth → token cached in ~/.grok/auth.json. This uses your SuperGrok or X Premium+ subscription (no per-token API billing).
    • Check sign-in state by looking for ~/.grok/auth.json, or run a cheap headless smoke test: grok --no-auto-update -p "Say ok."
    • In the TUI, /logout signs out and /login (or relaunching) signs back in.
  • No git repo required — unlike Codex, Grok runs fine outside a git directory (good for scratch/throwaway tasks).
  • Claude Code / AGENTS.md compatible with zero config — Grok auto-reads CLAUDE.md, .claude/ (skills, agents, MCPs, hooks, rules), and the AGENTS.md family. Existing project context just works.

API-key fallback (not the default for this user): Grok also supports setting the XAI_API_KEY environment variable for pay-as-you-go billing via api.x.ai. Only use this if grok login / SuperGrok auth is unavailable. The subscription path (grok login) is the intended setup here.

Two Orchestration Modes

Mode 1: Headless (-p) — Non-Interactive (PREFERRED)

Runs a one-shot task, prints the result, and exits. No PTY, no interactive dialogs to navigate. This is the cleanest integration path — the analog of claude -p and codex exec.

terminal(command="grok --no-auto-update -p 'Add a dark mode toggle to settings'", workdir="/path/to/project", timeout=180)

Always pass --no-auto-update in automation to skip background update checks.

When to use headless:

  • One-shot coding tasks (fix a bug, add a feature, refactor)
  • CI/CD automation and scripting
  • Structured output parsing with --output-format json
  • Any task that doesn't need multi-turn conversation

Mode 2: Interactive PTY — Multi-Turn TUI Sessions

The TUI is a fullscreen, mouse-interactive app. Drive it with pty=true. For robust monitoring/input use tmux (same pattern as the claude-code skill).

# Launch in a tmux session for capture-pane monitoring
terminal(command="tmux new-session -d -s grok-work -x 140 -y 40")
terminal(command="tmux send-keys -t grok-work 'cd /path/to/project && grok' Enter")

# Wait for startup, then send a task
terminal(command="sleep 5 && tmux send-keys -t grok-work 'Refactor the auth module to use JWT' Enter")

# Monitor progress
terminal(command="sleep 15 && tmux capture-pane -t grok-work -p -S -50")

# Exit when done
terminal(command="tmux send-keys -t grok-work '/quit' Enter && sleep 1 && tmux kill-session -t grok-work")

Tip for headless-but-inline output: if you want TUI-style output without the fullscreen alt-screen takeover (e.g. for cleaner logs), add --no-alt-screen. For pure automation, headless -p is still cleaner than the TUI.

Headless Deep Dive

Common Flags

Flag Effect
-p, --single <PROMPT> Send one prompt, run headless, exit
-m, --model <MODEL> Choose a model
-s, --session-id <UUID> Assign a NEW valid UUID to a fresh conversation (must not already exist). Does not resume — use --resume/--continue for that. Only valid with --resume/--continue when paired with --fork-session
-r, --resume [<UUID>] Resume an existing session by its UUID (or the most recent if omitted)
-c, --continue Continue the most recent session in the current directory
--fork-session When resuming, create a n
常见问题

我如何登录?

运行一次 grok login,它会打开浏览器完成登录,并把令牌保存在你的用户文件夹中。

它使用哪种套餐?

技能说明它使用 SuperGrok 或 X Premium 订阅,而不是按令牌计费的 API。

如何安装?

技能优先使用 npm 安装,并使用官方包名。

详情

作者的原始描述

Delegate coding to xAI Grok Build CLI (features, PRs).

repo: NousResearch/hermes-agent

热度

GitHub 星标
260k
排名
#442
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能