Skip to content
Back to skills

grok

ASecurity

Run headless xAI Grok CLI turns over the iii bus — shell, file edits, and tools against any host directory — with verbatim event feeds and session resume.

  • 120 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added November 30, 2026
toolsshellapibackend

Works with

  • terminal
  • cli
  • api

Security analysis

A100/100

Scanned November 30, 2026

npx -y skills add iii-hq/workers --skill skills --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of grok?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for grok
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/iii-hq-grok/badge)](https://www.skillsdirectory.com/skills/iii-hq-grok)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: grok
description: >-
  Run headless xAI Grok CLI turns over the iii bus — shell, file edits, and
  tools against any host directory — with verbatim event feeds and session
  resume.
---

# grok

The grok worker exposes the xAI Grok CLI as iii functions. One `grok::run`
call executes one headless Grok turn (`grok --single <prompt> --output-format
streaming-json`) — the same agent the user runs in their terminal, with the
same `XAI_API_KEY`, filesystem, and working directory — in a chosen directory,
and returns the final result. Every Grok event is
delivered untouched on `grok::on-raw-event`; a translated AgentEvent view is
delivered on `grok::on-agent-event`, which is what the acp worker renders.

Requires the `grok` CLI on the host with `XAI_API_KEY` in the worker
environment. When a turn needs a capability beyond Grok itself, add another iii
worker to the bus instead of bolting anything onto this one.

## When to Use

- Delegate a whole coding task ("add an endpoint and run the tests") in one
  call, instead of orchestrating individual `coder::*` / `shell::*` calls
  yourself: `grok::run` with `prompt` and `cwd`.
- Continue a conversation across calls: pass the same `session_id` again and
  the worker resumes the underlying Grok session with full context.
- Run long jobs without holding the call open: `grok::start` returns
  `{session_id, started}` immediately; observe `grok::on-raw-event` with
  args `{ session_id }` for raw progress or `grok::on-agent-event` for the
  rendered view (or poll `grok::status`); interrupt with `grok::stop`.
- Act on the whole backend: turns carry the iii runtime context by default
  (prepended to the first prompt of a session), so the agent discovers and
  calls any registered function through the iii CLI (engine::functions::list,
  `iii call <fn> --help`); disable per turn with `iii_context: false`.

## Boundaries

- Spawns the host `grok` CLI per turn — needs Grok installed and
  authenticated (`XAI_API_KEY`); not available inside a bare container without
  it.
- Tool/command execution is the Grok CLI's own; headless turns auto-approve
  by default (`always_approve: true`) so they don't block on an interactive
  approval prompt. Set `always_approve: false` to let the CLI's approval
  policy gate execution.
- One turn per session at a time: check `grok::status` (`live: true`)
  before sending another `grok::run` for the same `session_id`; parallel
  runs against one session race on the underlying session resume.
- `grok::on-agent-event` carries whole-message frames; per-item progress
  detail exists only on `grok::on-raw-event`. Both feeds are ephemeral (not
  stored or replayed); order by `(epoch, seq)`. Each accepts at most 256
  observers.

## Functions

- `grok::run` — run one Grok turn and wait; accepts `prompt` (or a
  `messages` array whose last user entry becomes the prompt), plus `model`,
  `cwd`, `always_approve`, and `iii_context`; returns
  `{session_id, grok_thread_id, result, stop_reason, num_turns}`.
- `grok::start` — same payload, returns `{session_id, started}`
  immediately; progress arrives on the event feeds.
- `grok::stop` — interrupt the live run for a session.
- `grok::status` — point-in-time session view: live flag, status, turn
  count.
- `grok::sessions::list` — every session this worker has run.
- `grok::on-agent-event` — observable event feed of one session's
  translated AgentEvent frames: args `{ session_id }`, event
  `{session_id, event_id, seq, epoch, source, event}`. Private: observe it,
  never call it.
- `grok::on-raw-event` — the same for the raw streaming-json events.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in tools →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.