grok-cli
An open-source terminal coding agent that connects to xAI's Grok API with X and web search, sub-agents, and Telegram remote control.
At a Glance
About grok-cli
grok-cli is a community-built, open-source terminal coding agent published by the superagent-ai organization on GitHub. It connects to xAI's Grok API and offers an interactive terminal UI as well as a headless mode for scripts and CI. The project states it is not affiliated with, endorsed by, or sponsored by xAI Corp.
What It Is
grok-cli is a command-line coding agent built with TypeScript, Bun and OpenTUI. You run grok in a project directory to start an interactive session, or use --prompt to run a single task and exit. It uses a Grok API key and exposes tools for X search, web search, image and video generation, and delegating work to sub-agents.
How the Agent Workflow Works
- Sub-agents are on by default: foreground
taskdelegation (explore, general, computer) and backgrounddelegatefor read-only deep dives. Custom named sub-agents can be defined in user settings. - Headless runs support structured newline-delimited JSON output, saved-session continuation, and an optional Batch API mode for lower-cost unattended runs.
- Schedules let the agent run a headless prompt once or on a recurring basis, with a background daemon for recurring jobs.
- Hooks run shell commands at lifecycle events such as PreToolUse and SessionStart, and can block actions.
- Skills, MCP servers and AGENTS.md instructions extend and guide the agent.
Verification, Sandbox and Computer Use
The /verify command or --verify flag inspects an app, builds and runs it in a sandbox, and produces a report with screenshots and video. An optional Shuru microVM sandbox isolates shell commands from the host, with configurable network, ports and resource limits; it requires macOS 14+ on Apple Silicon. A built-in computer sub-agent automates the host desktop on macOS through accessibility snapshots and refs.
Remote Control via Telegram
A Telegram bot can be paired from the TUI so you can drive the running CLI from your phone. Voice notes and audio attachments are transcribed with the Grok Speech-to-Text API before reaching the agent. The CLI process must stay running for the bot to respond.
Community Discussions
Be the first to start a conversation about grok-cli
Share your experience with grok-cli, ask questions, or help others learn from your insights.
Pricing
Open Source (MIT)
Open-source terminal coding agent released under the MIT License. A Grok API key from x.ai is required, and API usage is billed separately by xAI.
- MIT License
- Interactive OpenTUI terminal agent and headless mode
- Sub-agents on by default
- Remote control via Telegram
- Shuru microVM sandbox support
Capabilities
Key Features
- Interactive OpenTUI terminal coding agent
- Headless prompt mode with JSON event output
- X search and web search tools
- Image and video generation tools
- Built-in and custom sub-agents
- Verify mode with screenshots and video report
- Computer sub-agent for macOS desktop automation
- Telegram remote control with voice transcription
- Scheduled headless runs via background daemon
- Lifecycle hooks
- Agent Skills and MCP server support
- Persistent sessions
- Shuru microVM sandbox mode
- Batch API mode for lower-cost unattended runs
