agentleFS
gordon1210gordon1210/agent-goodies/skills/grok-cli/SKILL.md

grok-cli

Skill0 starsChanged 4 months agoMITView on GitHub

Operate and orchestrate the xAI Grok Build CLI as a bounded coding collaborator. Use when invoking `grok`, especially `grok -p` for headless prompts, `grok agent` for ACP integrations, exact session continuation, delegated implementation or review, agent pairing, consulting, rubber-duck dialogue, structured output, or CLI configuration and diagnostics. Do not use for the Grok web app or direct xAI API integration unless Grok Build CLI behavior is involved.

6 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. 0 are common, 13 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 13

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use the installed Grok Build CLI as a deliberately scoped collaborator.

    line 14
  2. Very specific:

    Run grok <command> --help for every subcommand used.

    line 37
  3. Very specific:

    Do not hard-code a current model ID or copy an old example flag without this check.

    line 46
  4. Distinctive:

    Do not start an interactive login, sign out, fetch managed setup, or mutate configuration merely to complete a consulting call.

    line 52
  5. Very specific:

    Prefer grok -p for delegation, review, pair-agent turns, consulting, and rubber-duck work.

    line 71
  6. Distinctive:

    Default to advisory, read-only access.

    line 83
  7. Distinctive:

    Before a call, determine:

    line 87
  8. Distinctive:

    Read Permissions, sandbox, and trust before granting edits, shell access, web access, MCP tools, plugins, or always-approve.

    line 104
  9. Distinctive:

    Do not paste an entire host-agent transcript when a concise packet is enough.

    line 125
  10. Distinctive:

    Do not include credentials, unrelated private files, or hidden reasoning.

    line 126
  11. Distinctive:

    Use the ready-made packets and command shapes in Collaboration patterns.

    line 130
  12. Distinctive:

    Treat sandbox application as a startup result, not as intent expressed by a flag.

    line 143
  13. Distinctive:

    Use a fresh session for independent review.

    line 152
  14. Distinctive:

    Check the process exit code, terminal event or result object, stop reason, incomplete-usage markers, and requested deliverable.

    line 155
  15. Distinctive:

    Verify factual claims, diffs, and test results in the host environment.

    line 157
  16. Distinctive:

    Treat Grok's answer as advisory until that verification passes.

    line 158

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Grok CLI

Use the installed Grok Build CLI as a deliberately scoped collaborator. Choose the smallest mode that fits the interaction, give Grok a complete task packet, and independently verify its result before accepting it.

Resolve version drift first

This skill supports the current stable CLI, not older releases. Establish that contract before relying on a flag or output field:

command -v grok
grok version --json
grok update --check --json
grok --help
grok inspect --json

Proceed only when the installed version, the updater's latest stable version, and metadata.tested-cli-version agree. If the installation is older, report that an update is required; do not add compatibility branches. If stable has moved ahead of this skill, refresh the skill before using version-sensitive guidance. Never update the CLI without separate user authorization.

Run grok <command> --help for every subcommand used. If present, the bundled guide under ~/.grok/docs/user-guide/ is normally closer to the installed binary than the website. Apply sources in this order:

  1. The installed binary's version and command help.
  2. The guide bundled with that installation.
  3. Current official documentation, changelog, and source.
  4. This skill's tested patterns.

Do not hard-code a current model ID or copy an old example flag without this check. In particular, do not pass speculative prompt flags such as --best-of-n, --check, or --self-verify to grok -p unless its current help advertises them. A similarly named flag can have a separate valid meaning; for example, the tested grok update --check only checks for an update.

Do not start an interactive login, sign out, fetch managed setup, or mutate configuration merely to complete a consulting call. Those are separate user-authorized operations. An ACP client still has to send the protocol's authenticate request when Grok advertises an existing cached or environment-backed method; that selects already available credentials and is distinct from initiating grok login.

Choose the operating mode

NeedModeWhy
Human-led interactive workgrok [PROMPT]Full TUI, approvals, slash commands, and direct supervision
One bounded task or a scripted follow-upgrok -p ...Starts, returns an answer, and exits; easiest delegation primitive
A persistent local client integrationgrok agent stdioLong-lived bidirectional ACP over JSON-RPC stdio
A local WebSocket servicegrok agent servePersistent ACP server for one or more trusted clients
A remote relay connectiongrok agent headlessConnects the agent through a Grok WebSocket relay
Shared backend processgrok agent leaderCoordinates compatible clients through a leader process
Grok itself needs child workersGrok subagentsChild sessions inside one Grok session, distinct from grok agent

Prefer grok -p for delegation, review, pair-agent turns, consulting, and rubber-duck work. Choose grok agent only when a client needs a long-lived, bidirectional protocol, streamed tool lifecycle, permission callbacks, or mid-turn control. For status, steering, cancellation, and permissions from a host agent, use the bundled stdlib-only JSONL bridge instead of hand-writing JSON-RPC. Read Headless mode or Agent mode and ACP before invoking the selected mode; read ACP bridge client before using the helper.

Establish the authority envelope

Default to advisory, read-only access. A request to ask Grok for an opinion is not authority for Grok to edit files, run write-capable commands, contact external systems through MCP, or fan out into its own subagents.

Before a call, determine:

  • The exact working directory and project root.
  • Which repository and user instructions Grok will discover there.
  • Whether Grok may only read, may edit named paths, or may run named validation commands.
  • Whether web, MCP, plugins, hooks, memory, or nested subagents are needed.
  • Which existing worktree changes belong to the user or another agent.
  • The expected output, evidence, turn limit, and stop conditions.

For write delegation, give Grok exclusive ownership of explicit files or a dedicated host-created worktree. Never assume grok -p --worktree provides isolation: in Grok Build 1.0.13, current grok --help explicitly says headless mode does not create a worktree from that flag. Create and inspect the worktree outside Grok, then pass its absolute path with --cwd. Do not delete or clean it automatically afterward.

Read Permissions, sandbox, and trust before granting edits, shell access, web access, MCP tools, plugins, or always-approve.

Build a complete task packet

Give Grok only the context required for the assignment, organized as:

Role: <consultant, reviewer, navigator, driver, implementer, rubber duck>
Objective: <one concrete outcome>
Working directory: <absolute path and relevant project root>
Scope: <owned files, symbols, diff, or questions>
Known facts: <evidence already established>
Constraints: <repo rules, compatibility, safety, no-go actions>
Allowed actions: <read, edit paths, exact commands, web/MCP if needed>
Deliverable: <format, detail, schema, or patch expectations>
Validation: <evidence and commands required>
Stop conditions: <ambiguity, destructive action, scope expansion, turn cap>

Do not paste an entire host-agent transcript when a concise packet is enough. Do not include credentials, unrelated private files, or hidden reasoning. For an independent second opinion, ask Grok before revealing the host agent's conclusion; compare evidence afterward instead of deciding by vote.

Use the ready-made packets and command shapes in Collaboration patterns.

Run and evaluate the call

  1. Inspect the current worktree and effective Grok configuration without changing either.
  2. Select the least-capable tool set, permission mode, sandbox, and extension set that can complete the task. Headless grok -p exposes the strongest per-invocation controls. The tested grok agent surface does not expose the same --tools, --no-subagents, or permission-mode flags, so use an audited effective configuration or agent profile there; choose grok -p when a strict per-call read-only boundary is required.
  3. Treat sandbox application as a startup result, not as intent expressed by a flag. If a requested sandbox warns, fails, or exits before the model turn, never retry automatically without it. A fresh, explicit --sandbox off tool-free consultation is allowed only when the complete bounded input is supplied in the prompt and effective hooks, plugins, MCP, web, memory, permissions, configuration, and subagents have been disabled or independently reviewed. If Grok needs any local tool capability, or an executable extension cannot be proven inactive or non-mutating, stop until the intended sandbox can be enforced.
  4. Use a fresh session for independent review. Resume the exact returned session ID for pairing or rubber-duck continuity.
  5. Capture stderr separately from structured stdout when automating.
  6. Check the process exit code, terminal event or result object, stop reason, incomplete-usage markers, and requested deliverable.
  7. Verify factual claims, diffs, and test results in the host environment.
  8. Treat Grok's answer as advisory until that verification passes.

An exit code of zero means the prompt completed, not that the proposed change is correct. An interrupted run does not roll back file changes.

Load the relevant reference

TaskReference
-p, prompt inputs, output formats, JSON/NDJSON, sessions, automationheadless.md
ACP lifecycle, stdio, WebSocket server, relay, leader, client designagent-acp.md
Bundled ACP bridge, JSONL commands/events, status, steering, cancellation, permissionsacp-client.md
Delegation, pairing, consulting, rubber duck, review, parallel workcollaboration-patterns.md
Permissions, tools, sandbox, secrets, hooks, MCP, plugins, trustpermissions-sandbox-trust.md
TUI, sessions, agents, rules, memory, configuration, operational commandscli-areas.md
Exact behavior specific to the supported stable CLIGrok Build 1.0.13
Source hierarchy, official links, version notes, maintenancesources.md

Report the outcome

State the mode, working directory, authority granted, session ID when useful, Grok's conclusion or changes, host-side verification performed, and any unresolved uncertainty. Do not claim that Grok used a tool, passed a check, or made no edits unless the captured events, diff, or local verification support that claim. If a tool-free call follows a failed sandbox start, report the two attempts separately: the requested sandbox and its startup failure; whether the later call explicitly used --sandbox off; that it was tool-free rather than filesystem-read-only; which extension surfaces were inspected or disabled; and whether a model turn occurred and which session ID belongs to it. Attribute conclusions and usage or cost only to the output that actually contains them; do not assign a conclusion, session ID, tool audit, usage, or cost to the failed start unless its captured output contains that field.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.