[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BWSY0JE9DMCVMBAK0B0WVR":3,"skill-same:01M7BWSY0JE9DMCVMBAK0B0WVR":64},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":43,"commitSha":44,"skillDirectory":45,"forksCount":14,"repositoryHtmlUrl":46,"repositoryHomepageUrl":6,"ownerHtmlUrl":47,"ownerBlogUrl":6,"ownerDescription":48,"updatedAt":49,"install":50,"resources":63},"01M7BWSY0JE9DMCVMBAK0B0WVR","grok",null,"Delegate coding to xAI Grok Build CLI (features, PRs).","yuxua24\u002Fworkspace","yuxua24","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F145311182?v=4","01M7BWRX3SGTW32KC66ZKHKKJT","Yuxuan Ao","01M7BWRX4GD7VN7NV8WQPWHQJE",0,"MIT","https:\u002F\u002Fgithub.com\u002Fyuxua24\u002Fworkspace\u002Fblob\u002Fautoresearch\u002Fpi-agent-merchantbench-net-assets-workspace-omp-20260901\u002Fhermes-agent\u002Foptional-skills\u002Fautonomous-ai-agents\u002Fgrok\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: grok\ndescription: \"Delegate coding to xAI Grok Build CLI (features, PRs).\"\nversion: 0.1.0\nauthor: Matt Maximo (MattMaximo), Hermes Agent\nlicense: MIT\nplatforms: [linux, macos, windows]\nmetadata:\n  hermes:\n    tags: [Coding-Agent, Grok, xAI, Code-Review, Refactoring, Automation]\n    related_skills: [codex, claude-code, hermes-agent]\n---\n\n# Grok Build CLI — Hermes Orchestration Guide\n\nDelegate coding tasks to [Grok Build](https:\u002F\u002Fdocs.x.ai\u002Fbuild\u002Foverview) (xAI's\nautonomous coding agent CLI, the `grok` command) via the Hermes terminal. Grok\ncan read files, write code, run shell commands, spawn subagents, and manage git\nworkflows. It runs three ways: an interactive TUI, **headless** (`-p`), and as\nan **ACP agent** over JSON-RPC.\n\nThis is the third sibling to `codex` and `claude-code`. The orchestration\npattern is nearly identical — **prefer headless `-p` for one-shots**, use a PTY\nfor interactive sessions.\n\n## When to use\n\n- Building features\n- Refactoring\n- PR reviews\n- Batch issue fixing\n- Any task where you'd otherwise reach for Codex \u002F Claude Code but want Grok\n\n## Prerequisites\n\n- **Install (preferred):** `npm install -g @xai-official\u002Fgrok`\n  - The official installer `curl -fsSL https:\u002F\u002Fx.ai\u002Fcli\u002Finstall.sh | bash` also\n    works, but the `x.ai` host is Cloudflare-walled in some environments. The\n    npm path avoids that dependency entirely.\n- **Auth — SuperGrok \u002F X Premium+ subscription (primary path):**\n  - Run `grok login` once → opens a browser for OAuth → token cached in\n    `~\u002F.grok\u002Fauth.json`. This uses your **SuperGrok or X Premium+** subscription\n    (no per-token API billing).\n  - Check sign-in state by looking for `~\u002F.grok\u002Fauth.json`, or run a cheap\n    headless smoke test: `grok --no-auto-update -p \"Say ok.\"`\n  - In the TUI, `\u002Flogout` signs out and `\u002Flogin` (or relaunching) signs back in.\n- **No git repo required** — unlike Codex, Grok runs fine outside a git\n  directory (good for scratch\u002Fthrowaway tasks).\n- **Claude Code \u002F AGENTS.md compatible with zero config** — Grok auto-reads\n  `CLAUDE.md`, `.claude\u002F` (skills, agents, MCPs, hooks, rules), and the\n  `AGENTS.md` family. Existing project context just works.\n\n> **API-key fallback (not the default for this user):** Grok also supports\n> setting the `XAI_API_KEY` environment variable for pay-as-you-go billing\n> via `api.x.ai`. Only use\n> this if `grok login` \u002F SuperGrok auth is unavailable. The subscription path\n> (`grok login`) is the intended setup here.\n\n## Two Orchestration Modes\n\n### Mode 1: Headless (`-p`) — Non-Interactive (PREFERRED)\n\nRuns a one-shot task, prints the result, and exits. No PTY, no interactive\ndialogs to navigate. This is the cleanest integration path — the analog of\n`claude -p` and `codex exec`.\n\n```\nterminal(command=\"grok --no-auto-update -p 'Add a dark mode toggle to settings'\", workdir=\"\u002Fpath\u002Fto\u002Fproject\", timeout=180)\n```\n\nAlways pass `--no-auto-update` in automation to skip background update checks.\n\n**When to use headless:**\n- One-shot coding tasks (fix a bug, add a feature, refactor)\n- CI\u002FCD automation and scripting\n- Structured output parsing with `--output-format json`\n- Any task that doesn't need multi-turn conversation\n\n### Mode 2: Interactive PTY — Multi-Turn TUI Sessions\n\nThe TUI is a fullscreen, mouse-interactive app. Drive it with `pty=true`. For\nrobust monitoring\u002Finput use tmux (same pattern as the `claude-code` skill).\n\n```\n# Launch in a tmux session for capture-pane monitoring\nterminal(command=\"tmux new-session -d -s grok-work -x 140 -y 40\")\nterminal(command=\"tmux send-keys -t grok-work 'cd \u002Fpath\u002Fto\u002Fproject && grok' Enter\")\n\n# Wait for startup, then send a task\nterminal(command=\"sleep 5 && tmux send-keys -t grok-work 'Refactor the auth module to use JWT' Enter\")\n\n# Monitor progress\nterminal(command=\"sleep 15 && tmux capture-pane -t grok-work -p -S -50\")\n\n# Exit when done\nterminal(command=\"tmux send-keys -t grok-work '\u002Fquit' Enter && sleep 1 && tmux kill-session -t grok-work\")\n```\n\n**Tip for headless-but-inline output:** if you want TUI-style output without the\nfullscreen alt-screen takeover (e.g. for cleaner logs), add `--no-alt-screen`.\nFor pure automation, headless `-p` is still cleaner than the TUI.\n\n## Headless Deep Dive\n\n### Common Flags\n\n| Flag | Effect |\n|------|--------|\n| `-p, --single \u003CPROMPT>` | Send one prompt, run headless, exit |\n| `-m, --model \u003CMODEL>` | Choose a model |\n| `-s, --session-id \u003CID>` | Create or resume a named headless session |\n| `-r, --resume \u003CID>` | Resume an existing session |\n| `-c, --continue` | Continue the most recent session in the current directory |\n| `--cwd \u003CPATH>` | Set the working directory |\n| `--output-format \u003CFMT>` | `plain` (default), `json`, or `streaming-json` |\n| `--always-approve` | Auto-approve all tool executions (the `--full-auto` \u002F `--yolo` equivalent) |\n| `--no-alt-screen` | Run inline, no fullscreen TUI takeover |\n| `--no-auto-update` | Skip background update checks (use in all automation) |\n\n### Output Formats\n\n- `plain` — human-readable text (default)\n- `json` — one JSON object at the end of the run (parse the result cleanly)\n- `streaming-json` — newline-delimited JSON events as they arrive\n\n```\n# Structured result for parsing\nterminal(command=\"grok --no-auto-update -p 'List all TODO comments in src\u002F' --output-format json\", workdir=\"\u002Fproject\", timeout=120)\n\n# Auto-approve for autonomous building\nterminal(command=\"grok --no-auto-update --always-approve -p 'Refactor the database layer and run the tests'\", workdir=\"\u002Fproject\", timeout=300)\n```\n\n### Background Mode (Long Tasks)\n\n```\n# Start headless in background\nterminal(command=\"grok --no-auto-update --always-approve -p 'Refactor the auth module'\", workdir=\"\u002Fproject\", background=true, notify_on_complete=true)\n# Returns session_id\n\n# Monitor\nprocess(action=\"poll\", session_id=\"\u003Cid>\")\nprocess(action=\"log\", session_id=\"\u003Cid>\")\n\n# Kill if needed\nprocess(action=\"kill\", session_id=\"\u003Cid>\")\n```\n\nFor an interactive (TUI) background session, use `pty=true` + tmux and monitor\nwith `tmux capture-pane`, exactly like the `claude-code` \u002F `codex` skills.\n\n### Session Continuation\n\n```\n# Start a named session\nterminal(command=\"grok --no-auto-update -s refactor-db -p 'Start refactoring the database layer' --always-approve\", workdir=\"\u002Fproject\", timeout=240)\n\n# Resume it later\nterminal(command=\"grok --no-auto-update -r refactor-db -p 'Now add connection pooling' --always-approve\", workdir=\"\u002Fproject\", timeout=180)\n\n# Or continue the most recent session in this directory\nterminal(command=\"grok --no-auto-update -c -p 'What did you change last time?'\", workdir=\"\u002Fproject\", timeout=60)\n```\n\n## Read-Only Audit → Markdown Note Pattern\n\nTo have Grok review local artifacts and return a clean markdown note (for\nObsidian or a repo) without mutating anything:\n\n1. Prepare stable input files first with Hermes tools (`read_file`,\n   `write_file`). Snapshot only the relevant context into a temp file rather\n   than dumping raw paths.\n2. Run Grok headless **without** `--always-approve` so it cannot auto-write, and\n   demand `markdown only, no preamble`.\n3. Save Grok's stdout straight into the destination note with `write_file()`.\n\n```\ngrok --no-auto-update -p \"Read \u002Ftmp\u002Fcurrent.md and \u002Ftmp\u002Finventory.md. Produce markdown only, no preamble. Output a clean note titled 'Cleanup Review'.\" --output-format plain\n```\n\n**Pitfall (same as Claude Code):** for document rewrites, a loose \"rewrite this\"\nprompt may return a change summary instead of the full file. Instead: pipe the\nfile in, and demand `Return ONLY the full revised markdown document. No intro,\nno explanation, no code fences. Start immediately with '# Title'.` Verify the\nfirst lines with `read_file()` before overwriting the destination.\n\n## PR Review Patterns\n\n### Quick Review (Headless)\n\n```\nterminal(command=\"cd \u002Fpath\u002Fto\u002Frepo && git diff main...feature-branch | grok --no-auto-update -p 'Review this diff for bugs, security issues, and style problems. Be thorough.'\", timeout=120)\n```\n\n### Clone-to-temp Review (safe, no repo mutation)\n\n```\nterminal(command=\"REVIEW=$(mktemp -d) && git clone https:\u002F\u002Fgithub.com\u002Fuser\u002Frepo.git $REVIEW && cd $REVIEW && gh pr checkout 42 && grok --no-auto-update -p 'Review the changes vs origin\u002Fmain. Check bugs, security, race conditions, missing tests.'\", pty=true, timeout=300)\n```\n\n### Post the review\n\n```\nterminal(command=\"gh pr comment 42 --body '\u003Creview text>'\", workdir=\"\u002Fpath\u002Fto\u002Frepo\")\n```\n\n## Parallel Issue Fixing with Worktrees\n\n```\n# Create worktrees\nterminal(command=\"git worktree add -b fix\u002Fissue-78 \u002Ftmp\u002Fissue-78 main\", workdir=\"~\u002Fproject\")\nterminal(command=\"git worktree add -b fix\u002Fissue-99 \u002Ftmp\u002Fissue-99 main\", workdir=\"~\u002Fproject\")\n\n# Launch Grok headless in each (background)\nterminal(command=\"grok --no-auto-update --always-approve -p 'Fix issue #78: \u003Cdescription>. Commit when done.'\", workdir=\"\u002Ftmp\u002Fissue-78\", background=true, notify_on_complete=true)\nterminal(command=\"grok --no-auto-update --always-approve -p 'Fix issue #99: \u003Cdescription>. Commit when done.'\", workdir=\"\u002Ftmp\u002Fissue-99\", background=true, notify_on_complete=true)\n\n# Monitor\nprocess(action=\"list\")\n\n# After completion: push and open PRs\nterminal(command=\"cd \u002Ftmp\u002Fissue-78 && git push -u origin fix\u002Fissue-78\")\nterminal(command=\"gh pr create --repo user\u002Frepo --head fix\u002Fissue-78 --title 'fix: ...' --body '...'\")\n\n# Cleanup\nterminal(command=\"git worktree remove \u002Ftmp\u002Fissue-78\", workdir=\"~\u002Fproject\")\n```\n\n## Useful Subcommands & TUI Commands\n\n| Command | Purpose |\n|---------|---------|\n| `grok` | Start the interactive TUI |\n| `grok -p \"query\"` | Headless one-shot |\n| `grok login` \u002F `grok logout` | Sign in \u002F out (SuperGrok \u002F X Premium+ OAuth) |\n| `grok inspect` | Show what Grok discovered in cwd: config sources, instructions, skills, plugins, hooks, MCP servers |\n| `grok agent stdio` | Run as an ACP agent over JSON-RPC (for IDE\u002Ftool integration) |\n| `grok update` | Update the CLI (needs the `x.ai` host; skip in automation) |\n\nTUI slash commands (interactive only): `\u002Fmodel \u003Cname>`, `\u002Falways-approve`,\n`\u002Fplan`, `\u002Fcontext`, `\u002Fcompact`, `\u002Fresume`, `\u002Fsessions`, `\u002Ffork`, `\u002Fusage`,\n`\u002Fquit`. `Shift+Tab` cycles session modes (including Plan mode, which blocks\nwrite tools except the session plan file).\n\n## Config (`~\u002F.grok\u002Fconfig.toml`)\n\n```toml\n[cli]\nauto_update = false          # skip background update checks persistently\n\n[ui]\npermission_mode = \"ask\"      # or \"always-approve\" to skip tool prompts by default\n\n[models]\ndefault = \"grok-build-0.1\"\n```\n\nPut global preferences in `~\u002F.grok\u002Fconfig.toml` (not project-scoped\n`.grok\u002Fconfig.toml`). `permission_mode` supersedes the legacy `approval_mode` \u002F\n`yolo = true` keys.\n\n## Pitfalls & Gotchas\n\n1. **Auth is subscription-gated.** `grok login` requires a SuperGrok or X\n   Premium+ subscription. If login fails or there's no `~\u002F.grok\u002Fauth.json`,\n   confirm the subscription is active before falling back to `XAI_API_KEY`.\n2. **Don't conflate Hermes' xAI auth with the `grok` CLI's auth.** Hermes'\n   `x_search` runs on its own xAI OAuth; the standalone `grok` CLI has a\n   separate token in `~\u002F.grok\u002Fauth.json`. A working `x_search` does NOT mean\n   `grok` is logged in.\n3. **Always pass `--no-auto-update` in automation** — otherwise Grok phones home\n   for update checks (and `x.ai`\u002F`storage.googleapis.com` may be unreachable).\n4. **Prefer npm install over the curl installer** — `npm install -g\n   @xai-official\u002Fgrok` avoids the Cloudflare-walled `x.ai` host.\n5. **`--always-approve` is the autonomous-build switch.** Without it, headless\n   runs may stall waiting on tool-approval prompts. Omit it deliberately for\n   read-only review\u002Faudit work so Grok can't mutate files.\n6. **Headless `-p` skips TUI dialogs**; the TUI needs `pty=true` (+ tmux for\n   monitoring), just like Claude Code.\n7. **Use `--no-alt-screen`** if you run the TUI inline and the fullscreen\n   alt-screen takeover garbles captured output.\n8. **No git repo needed**, but for PR\u002Fcommit workflows you still want one — use\n   `mktemp -d && git init` for scratch commit tasks.\n9. **Clean up tmux sessions** with `tmux kill-session -t \u003Cname>` when done.\n\n## Rules for Hermes Agents\n\n1. **Prefer headless `-p`** for single tasks — cleanest integration, structured\n   output via `--output-format json`.\n2. **Always set `workdir`** (or `--cwd`) so Grok targets the right project.\n3. **Pass `--no-auto-update`** in every automated invocation.\n4. **Use `--always-approve` only when Grok should write autonomously**; omit it\n   for read-only reviews and audits.\n5. **Background long tasks** with `background=true, notify_on_complete=true` and\n   monitor via the `process` tool.\n6. **Use tmux for multi-turn interactive work** and monitor with\n   `tmux capture-pane -t \u003Csession> -p -S -50`.\n7. **Verify auth before relying on it** — check `~\u002F.grok\u002Fauth.json` or run a\n   cheap `grok -p \"Say ok.\"` smoke test; don't assume Hermes' xAI auth carries\n   over.\n8. **Report results to the user** — summarize what Grok changed and what's left.\n","# Grok Build CLI — Hermes Orchestration Guide\n\nDelegate coding tasks to [Grok Build](https:\u002F\u002Fdocs.x.ai\u002Fbuild\u002Foverview) (xAI's\nautonomous coding agent CLI, the `grok` command) via the Hermes terminal. Grok\ncan read files, write code, run shell commands, spawn subagents, and manage git\nworkflows. It runs three ways: an interactive TUI, **headless** (`-p`), and as\nan **ACP agent** over JSON-RPC.\n\nThis is the third sibling to `codex` and `claude-code`. The orchestration\npattern is nearly identical — **prefer headless `-p` for one-shots**, use a PTY\nfor interactive sessions.\n\n## When to use\n\n- Building features\n- Refactoring\n- PR reviews\n- Batch issue fixing\n- Any task where you'd otherwise reach for Codex \u002F Claude Code but want Grok\n\n## Prerequisites\n\n- **Install (preferred):** `npm install -g @xai-official\u002Fgrok`\n  - The official installer `curl -fsSL https:\u002F\u002Fx.ai\u002Fcli\u002Finstall.sh | bash` also\n    works, but the `x.ai` host is Cloudflare-walled in some environments. The\n    npm path avoids that dependency entirely.\n- **Auth — SuperGrok \u002F X Premium+ subscription (primary path):**\n  - Run `grok login` once → opens a browser for OAuth → token cached in\n    `~\u002F.grok\u002Fauth.json`. This uses your **SuperGrok or X Premium+** subscription\n    (no per-token API billing).\n  - Check sign-in state by looking for `~\u002F.grok\u002Fauth.json`, or run a cheap\n    headless smoke test: `grok --no-auto-update -p \"Say ok.\"`\n  - In the TUI, `\u002Flogout` signs out and `\u002Flogin` (or relaunching) signs back in.\n- **No git repo required** — unlike Codex, Grok runs fine outside a git\n  directory (good for scratch\u002Fthrowaway tasks).\n- **Claude Code \u002F AGENTS.md compatible with zero config** — Grok auto-reads\n  `CLAUDE.md`, `.claude\u002F` (skills, agents, MCPs, hooks, rules), and the\n  `AGENTS.md` family. Existing project context just works.\n\n> **API-key fallback (not the default for this user):** Grok also supports\n> setting the `XAI_API_KEY` environment variable for pay-as-you-go billing\n> via `api.x.ai`. Only use\n> this if `grok login` \u002F SuperGrok auth is unavailable. The subscription path\n> (`grok login`) is the intended setup here.\n\n## Two Orchestration Modes\n\n### Mode 1: Headless (`-p`) — Non-Interactive (PREFERRED)\n\nRuns a one-shot task, prints the result, and exits. No PTY, no interactive\ndialogs to navigate. This is the cleanest integration path — the analog of\n`claude -p` and `codex exec`.\n\n```\nterminal(command=\"grok --no-auto-update -p 'Add a dark mode toggle to settings'\", workdir=\"\u002Fpath\u002Fto\u002Fproject\", timeout=180)\n```\n\nAlways pass `--no-auto-update` in automation to skip background update checks.\n\n**When to use headless:**\n- One-shot coding tasks (fix a bug, add a feature, refactor)\n- CI\u002FCD automation and scripting\n- Structured output parsing with `--output-format json`\n- Any task that doesn't need multi-turn conversation\n\n### Mode 2: Interactive PTY — Multi-Turn TUI Sessions\n\nThe TUI is a fullscreen, mouse-interactive app. Drive it with `pty=true`. For\nrobust monitoring\u002Finput use tmux (same pattern as the `claude-code` skill).\n\n```\n# Launch in a tmux session for capture-pane monitoring\nterminal(command=\"tmux new-session -d -s grok-work -x 140 -y 40\")\nterminal(command=\"tmux send-keys -t grok-work 'cd \u002Fpath\u002Fto\u002Fproject && grok' Enter\")\n\n# Wait for startup, then send a task\nterminal(command=\"sleep 5 && tmux send-keys -t grok-work 'Refactor the auth module to use JWT' Enter\")\n\n# Monitor progress\nterminal(command=\"sleep 15 && tmux capture-pane -t grok-work -p -S -50\")\n\n# Exit when done\nterminal(command=\"tmux send-keys -t grok-work '\u002Fquit' Enter && sleep 1 && tmux kill-session -t grok-work\")\n```\n\n**Tip for headless-but-inline output:** if you want TUI-style output without the\nfullscreen alt-screen takeover (e.g. for cleaner logs), add `--no-alt-screen`.\nFor pure automation, headless `-p` is still cleaner than the TUI.\n\n## Headless Deep Dive\n\n### Common Flags\n\n| Flag | Effect |\n|------|--------|\n| `-p, --single \u003CPROMPT>` | Send one prompt, run headless, exit |\n| `-m, --model \u003CMODEL>` | Choose a model |\n| `-s, --session-id \u003CID>` | Create or resume a named headless session |\n| `-r, --resume \u003CID>` | Resume an existing session |\n| `-c, --continue` | Continue the most recent session in the current directory |\n| `--cwd \u003CPATH>` | Set the working directory |\n| `--output-format \u003CFMT>` | `plain` (default), `json`, or `streaming-json` |\n| `--always-approve` | Auto-approve all tool executions (the `--full-auto` \u002F `--yolo` equivalent) |\n| `--no-alt-screen` | Run inline, no fullscreen TUI takeover |\n| `--no-auto-update` | Skip background update checks (use in all automation) |\n\n### Output Formats\n\n- `plain` — human-readable text (default)\n- `json` — one JSON object at the end of the run (parse the result cleanly)\n- `streaming-json` — newline-delimited JSON events as they arrive\n\n```\n# Structured result for parsing\nterminal(command=\"grok --no-auto-update -p 'List all TODO comments in src\u002F' --output-format json\", workdir=\"\u002Fproject\", timeout=120)\n\n# Auto-approve for autonomous building\nterminal(command=\"grok --no-auto-update --always-approve -p 'Refactor the database layer and run the tests'\", workdir=\"\u002Fproject\", timeout=300)\n```\n\n### Background Mode (Long Tasks)\n\n```\n# Start headless in background\nterminal(command=\"grok --no-auto-update --always-approve -p 'Refactor the auth module'\", workdir=\"\u002Fproject\", background=true, notify_on_complete=true)\n# Returns session_id\n\n# Monitor\nprocess(action=\"poll\", session_id=\"\u003Cid>\")\nprocess(action=\"log\", session_id=\"\u003Cid>\")\n\n# Kill if needed\nprocess(action=\"kill\", session_id=\"\u003Cid>\")\n```\n\nFor an interactive (TUI) background session, use `pty=true` + tmux and monitor\nwith `tmux capture-pane`, exactly like the `claude-code` \u002F `codex` skills.\n\n### Session Continuation\n\n```\n# Start a named session\nterminal(command=\"grok --no-auto-update -s refactor-db -p 'Start refactoring the database layer' --always-approve\", workdir=\"\u002Fproject\", timeout=240)\n\n# Resume it later\nterminal(command=\"grok --no-auto-update -r refactor-db -p 'Now add connection pooling' --always-approve\", workdir=\"\u002Fproject\", timeout=180)\n\n# Or continue the most recent session in this directory\nterminal(command=\"grok --no-auto-update -c -p 'What did you change last time?'\", workdir=\"\u002Fproject\", timeout=60)\n```\n\n## Read-Only Audit → Markdown Note Pattern\n\nTo have Grok review local artifacts and return a clean markdown note (for\nObsidian or a repo) without mutating anything:\n\n1. Prepare stable input files first with Hermes tools (`read_file`,\n   `write_file`). Snapshot only the relevant context into a temp file rather\n   than dumping raw paths.\n2. Run Grok headless **without** `--always-approve` so it cannot auto-write, and\n   demand `markdown only, no preamble`.\n3. Save Grok's stdout straight into the destination note with `write_file()`.\n\n```\ngrok --no-auto-update -p \"Read \u002Ftmp\u002Fcurrent.md and \u002Ftmp\u002Finventory.md. Produce markdown only, no preamble. Output a clean note titled 'Cleanup Review'.\" --output-format plain\n```\n\n**Pitfall (same as Claude Code):** for document rewrites, a loose \"rewrite this\"\nprompt may return a change summary instead of the full file. Instead: pipe the\nfile in, and demand `Return ONLY the full revised markdown document. No intro,\nno explanation, no code fences. Start immediately with '# Title'.` Verify the\nfirst lines with `read_file()` before overwriting the destination.\n\n## PR Review Patterns\n\n### Quick Review (Headless)\n\n```\nterminal(command=\"cd \u002Fpath\u002Fto\u002Frepo && git diff main...feature-branch | grok --no-auto-update -p 'Review this diff for bugs, security issues, and style problems. Be thorough.'\", timeout=120)\n```\n\n### Clone-to-temp Review (safe, no repo mutation)\n\n```\nterminal(command=\"REVIEW=$(mktemp -d) && git clone https:\u002F\u002Fgithub.com\u002Fuser\u002Frepo.git $REVIEW && cd $REVIEW && gh pr checkout 42 && grok --no-auto-update -p 'Review the changes vs origin\u002Fmain. Check bugs, security, race conditions, missing tests.'\", pty=true, timeout=300)\n```\n\n### Post the review\n\n```\nterminal(command=\"gh pr comment 42 --body '\u003Creview text>'\", workdir=\"\u002Fpath\u002Fto\u002Frepo\")\n```\n\n## Parallel Issue Fixing with Worktrees\n\n```\n# Create worktrees\nterminal(command=\"git worktree add -b fix\u002Fissue-78 \u002Ftmp\u002Fissue-78 main\", workdir=\"~\u002Fproject\")\nterminal(command=\"git worktree add -b fix\u002Fissue-99 \u002Ftmp\u002Fissue-99 main\", workdir=\"~\u002Fproject\")\n\n# Launch Grok headless in each (background)\nterminal(command=\"grok --no-auto-update --always-approve -p 'Fix issue #78: \u003Cdescription>. Commit when done.'\", workdir=\"\u002Ftmp\u002Fissue-78\", background=true, notify_on_complete=true)\nterminal(command=\"grok --no-auto-update --always-approve -p 'Fix issue #99: \u003Cdescription>. Commit when done.'\", workdir=\"\u002Ftmp\u002Fissue-99\", background=true, notify_on_complete=true)\n\n# Monitor\nprocess(action=\"list\")\n\n# After completion: push and open PRs\nterminal(command=\"cd \u002Ftmp\u002Fissue-78 && git push -u origin fix\u002Fissue-78\")\nterminal(command=\"gh pr create --repo user\u002Frepo --head fix\u002Fissue-78 --title 'fix: ...' --body '...'\")\n\n# Cleanup\nterminal(command=\"git worktree remove \u002Ftmp\u002Fissue-78\", workdir=\"~\u002Fproject\")\n```\n\n## Useful Subcommands & TUI Commands\n\n| Command | Purpose |\n|---------|---------|\n| `grok` | Start the interactive TUI |\n| `grok -p \"query\"` | Headless one-shot |\n| `grok login` \u002F `grok logout` | Sign in \u002F out (SuperGrok \u002F X Premium+ OAuth) |\n| `grok inspect` | Show what Grok discovered in cwd: config sources, instructions, skills, plugins, hooks, MCP servers |\n| `grok agent stdio` | Run as an ACP agent over JSON-RPC (for IDE\u002Ftool integration) |\n| `grok update` | Update the CLI (needs the `x.ai` host; skip in automation) |\n\nTUI slash commands (interactive only): `\u002Fmodel \u003Cname>`, `\u002Falways-approve`,\n`\u002Fplan`, `\u002Fcontext`, `\u002Fcompact`, `\u002Fresume`, `\u002Fsessions`, `\u002Ffork`, `\u002Fusage`,\n`\u002Fquit`. `Shift+Tab` cycles session modes (including Plan mode, which blocks\nwrite tools except the session plan file).\n\n## Config (`~\u002F.grok\u002Fconfig.toml`)\n\n```toml\n[cli]\nauto_update = false          # skip background update checks persistently\n\n[ui]\npermission_mode = \"ask\"      # or \"always-approve\" to skip tool prompts by default\n\n[models]\ndefault = \"grok-build-0.1\"\n```\n\nPut global preferences in `~\u002F.grok\u002Fconfig.toml` (not project-scoped\n`.grok\u002Fconfig.toml`). `permission_mode` supersedes the legacy `approval_mode` \u002F\n`yolo = true` keys.\n\n## Pitfalls & Gotchas\n\n1. **Auth is subscription-gated.** `grok login` requires a SuperGrok or X\n   Premium+ subscription. If login fails or there's no `~\u002F.grok\u002Fauth.json`,\n   confirm the subscription is active before falling back to `XAI_API_KEY`.\n2. **Don't conflate Hermes' xAI auth with the `grok` CLI's auth.** Hermes'\n   `x_search` runs on its own xAI OAuth; the standalone `grok` CLI has a\n   separate token in `~\u002F.grok\u002Fauth.json`. A working `x_search` does NOT mean\n   `grok` is logged in.\n3. **Always pass `--no-auto-update` in automation** — otherwise Grok phones home\n   for update checks (and `x.ai`\u002F`storage.googleapis.com` may be unreachable).\n4. **Prefer npm install over the curl installer** — `npm install -g\n   @xai-official\u002Fgrok` avoids the Cloudflare-walled `x.ai` host.\n5. **`--always-approve` is the autonomous-build switch.** Without it, headless\n   runs may stall waiting on tool-approval prompts. Omit it deliberately for\n   read-only review\u002Faudit work so Grok can't mutate files.\n6. **Headless `-p` skips TUI dialogs**; the TUI needs `pty=true` (+ tmux for\n   monitoring), just like Claude Code.\n7. **Use `--no-alt-screen`** if you run the TUI inline and the fullscreen\n   alt-screen takeover garbles captured output.\n8. **No git repo needed**, but for PR\u002Fcommit workflows you still want one — use\n   `mktemp -d && git init` for scratch commit tasks.\n9. **Clean up tmux sessions** with `tmux kill-session -t \u003Cname>` when done.\n\n## Rules for Hermes Agents\n\n1. **Prefer headless `-p`** for single tasks — cleanest integration, structured\n   output via `--output-format json`.\n2. **Always set `workdir`** (or `--cwd`) so Grok targets the right project.\n3. **Pass `--no-auto-update`** in every automated invocation.\n4. **Use `--always-approve` only when Grok should write autonomously**; omit it\n   for read-only reviews and audits.\n5. **Background long tasks** with `background=true, notify_on_complete=true` and\n   monitor via the `process` tool.\n6. **Use tmux for multi-turn interactive work** and monitor with\n   `tmux capture-pane -t \u003Csession> -p -S -50`.\n7. **Verify auth before relying on it** — check `~\u002F.grok\u002Fauth.json` or run a\n   cheap `grok -p \"Say ok.\"` smoke test; don't assume Hermes' xAI auth carries\n   over.\n8. **Report results to the user** — summarize what Grok changed and what's left.\n",{"name":5,"author":24,"license":15,"version":25,"metadata":26,"platforms":39,"description":7},"Matt Maximo (MattMaximo), Hermes Agent","0.1.0",{"hermes":27},{"tags":28,"related_skills":35},[29,30,31,32,33,34],"Coding-Agent","Grok","xAI","Code-Review","Refactoring","Automation",[36,37,38],"codex","claude-code","hermes-agent",[40,41,42],"linux","macos","windows","autoresearch\u002Fpi-agent-merchantbench-net-assets-workspace-omp-20260901","762e83a83bedbed565e95e7d42d39204c367c9eb","hermes-agent\u002Foptional-skills\u002Fautonomous-ai-agents\u002Fgrok","https:\u002F\u002Fgithub.com\u002Fyuxua24\u002Fworkspace","https:\u002F\u002Fgithub.com\u002Fyuxua24","I am Ao Yuxuan, a student in Xi'an Jiaotong University. I am eager to learn on GitHub and contribute my part to this community.","2026-09-01 17:37:09",{"source":8,"skillName":5,"commands":51,"prompt":61,"zipAvailable":62},[52,55,58],{"tool":53,"command":54},"npx","npx skills add yuxua24\u002Fworkspace --skill grok",{"tool":56,"command":57},"bunx","bunx skills add yuxua24\u002Fworkspace --skill grok",{"tool":59,"command":60},"pnpm","pnpm dlx skills add yuxua24\u002Fworkspace --skill grok","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fyuxua24\u002Fworkspace\u002Fblob\u002Fautoresearch\u002Fpi-agent-merchantbench-net-assets-workspace-omp-20260901\u002Fhermes-agent\u002Foptional-skills\u002Fautonomous-ai-agents\u002Fgrok\u002FSKILL.md",true,[],[65,72,79,86,93,100],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M7BXERWENH07XE9XAV53QZ2D","test-driven-development","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002Fyuxua24\u002Fworkspace\u002Fblob\u002Fautoresearch\u002Fpi-agent-merchantbench-net-assets-workspace-omp-20260901\u002Fhermes-agent\u002Fskills\u002Fsoftware-development\u002Ftest-driven-development\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":19},"01M7BXEMHAJQA0RVGZ43ZNDFH2","systematic-debugging","4-phase root cause debugging: understand bugs before fixing.","https:\u002F\u002Fgithub.com\u002Fyuxua24\u002Fworkspace\u002Fblob\u002Fautoresearch\u002Fpi-agent-merchantbench-net-assets-workspace-omp-20260901\u002Fhermes-agent\u002Fskills\u002Fsoftware-development\u002Fsystematic-debugging\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":19},"01M7BXEGNTY1MJD5W8GSWT7MAP","spike","Throwaway experiments to validate an idea before build.","https:\u002F\u002Fgithub.com\u002Fyuxua24\u002Fworkspace\u002Fblob\u002Fautoresearch\u002Fpi-agent-merchantbench-net-assets-workspace-omp-20260901\u002Fhermes-agent\u002Fskills\u002Fsoftware-development\u002Fspike\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M7BXEE77341X1N35WV5CBXAY","simplify-code","Parallel 3-agent cleanup of recent code changes.","https:\u002F\u002Fgithub.com\u002Fyuxua24\u002Fworkspace\u002Fblob\u002Fautoresearch\u002Fpi-agent-merchantbench-net-assets-workspace-omp-20260901\u002Fhermes-agent\u002Fskills\u002Fsoftware-development\u002Fsimplify-code\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":19},"01M7BXEASY2T61Y8FRYTXGMKWY","requesting-code-review","Pre-commit review: security scan, quality gates, auto-fix.","https:\u002F\u002Fgithub.com\u002Fyuxua24\u002Fworkspace\u002Fblob\u002Fautoresearch\u002Fpi-agent-merchantbench-net-assets-workspace-omp-20260901\u002Fhermes-agent\u002Fskills\u002Fsoftware-development\u002Frequesting-code-review\u002FSKILL.md",[],[],{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":19},"01M7BXE6H4KWMW0DKVXR5G61E4","python-debugpy","Debug Python: pdb REPL + debugpy remote (DAP).","https:\u002F\u002Fgithub.com\u002Fyuxua24\u002Fworkspace\u002Fblob\u002Fautoresearch\u002Fpi-agent-merchantbench-net-assets-workspace-omp-20260901\u002Fhermes-agent\u002Fskills\u002Fsoftware-development\u002Fpython-debugpy\u002FSKILL.md",[],[]]