Install
$ agentstack add skill-yrzhe-claude-skills-grok-cli ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
grok-cli
Use this skill when the user or an agent needs a local CLI wrapper around Grok/xAI with:
- Browser-based xAI / SuperGrok OAuth login using Authorization Code + PKCE.
- Optional
XAI_API_KEYfallback. - xAI
/v1/responseschat calls. - Grok Imagine image generation (sync) and video generation (async poll).
- X/Twitter search through xAI's server-side
x_searchResponses tool. - Persistent local session history in SQLite.
- Multi-session switching, export, and summarization.
Safety and credential rules
Never ask the user to paste their xAI password. Use grok-cli login to open the xAI authorization URL in a browser. Do not scrape browser cookies, automate grok.com, or capture interactive login credentials. OAuth tokens are stored locally under ~/.grok-cli/auth.json with owner-only file permissions when supported by the OS.
Prefer OAuth for SuperGrok users. API keys are supported only as fallback through XAI_API_KEY or grok-cli key set.
Do not print access tokens, refresh tokens, API keys, or ID tokens. grok-cli status sanitizes credential output.
Image and video generation are paid xAI operations (≈ $0.02 / image, ≈ $0.40 / 8s video — video is ~20x an image). The CLI refuses paid generation in non-interactive mode unless --yes is passed; never auto-pass --yes for an agent without the user's intent. No credentials are bundled in this package — each user logs in with their own SuperGrok / X Premium account via grok-cli login.
Installation
From the skill folder:
python -m venv .venv
source .venv/bin/activate
pip install -e .
Smoke test without network:
grok-cli --help
grok-cli status
Login
Local machine with browser:
grok-cli login
Remote SSH/container session:
# On your local machine, in a separate terminal:
ssh -N -L 56121:127.0.0.1:56121 user@remote-host
# On the remote host:
grok-cli login --no-browser
# Open the printed URL locally.
Alternative API key fallback:
export XAI_API_KEY="..."
# or store locally:
grok-cli key set
Main commands
# Single-turn chat, saved to current/default session
grok-cli ask "What is the meaning of life?"
# Interactive chat
grok-cli chat -s research
# Image generation (Grok Imagine, sync) — paid, needs --yes
grok-cli image "a neon cyberpunk fox, sticker art" --yes -o fox.jpg -n 2
# Video generation (Grok Imagine, async poll) — paid ~20x an image, needs --yes
grok-cli video "a paper plane gliding over a city at sunset" --yes -o plane.mp4
grok-cli video --fetch --json # check an existing job
# X Search via Grok server-side x_search
grok-cli search "What are people on X saying about the latest xAI algorithm update?" --save
# Limit search to handles
grok-cli search "Grok image feature reactions" --allowed xai elonmusk --from 2026-05-01
# Enable image/video understanding for matching posts
grok-cli search "Show visual reactions to Grok features" --images --videos
# Sessions
grok-cli session new ai-market --use
grok-cli session list
grok-cli session use thesis
grok-cli session export ai-market -o ai-market.md
# Summarize long session for future compact context
grok-cli summarize -s ai-market
Agent invocation contract
For Codex or another agent, call the CLI rather than importing internals unless you need a custom integration.
Preferred machine-readable calls:
grok-cli ask "" --session "" --json
grok-cli search "" --allowed xai --from 2026-05-01 --json --save
grok-cli status
JSON responses include the response id, model, answer, citations, inline citations, status, and usage where available.
Data layout
Default local state:
~/.grok-cli/
auth.json # OAuth/API-key credential state, sanitized by status output
config.json # base_url, default_model, search_model, current_session
sessions.sqlite3 # sessions, messages, citations, summaries
Set GROK_CLI_HOME=/path/to/state to isolate state for tests or a specific agent workspace.
Implementation notes for agents
grok-cli loginuses the xAI OIDC discovery document and Authorization Code + PKCE.- OAuth defaults are based on the public Hermes Agent implementation for
xai-oauth. - X Search is implemented by sending
tools: [{"type":"x_search"}]to/v1/responses, matching Hermes' documented behavior. - xAI's public Responses API documents
/v1/responses, response ids, retrieval, deletion, and server-side response storage. This skill defaults tostore:falsefor data-sovereignty reasons. - If
x_searchreturns a provider/model error, switchsearch_modeltogrok-4.20-reasoningor another model with x_search entitlement.
Troubleshooting
No xAI credentials available: rungrok-cli login, setXAI_API_KEY, or usegrok-cli key set.- Login callback cannot connect on a remote host: forward local port 56121 to the remote host before opening the URL.
state_mismatch: rerun login; do not reuse old authorization URLs.invalid_grantor refresh failure: rungrok-cli loginagain.x_searchnot enabled for this model/account: verify that your SuperGrok account has access and trygrok-cli config set search_model grok-4.20-reasoning.
Source basis
This package is based on public behavior documented by Hermes Agent and xAI docs, not on private credentials or browser-cookie scraping. See docs/sources.md for references.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: Yrzhe
- Source: Yrzhe/claude-skills
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.