CLI
@grackle-ai/cli is how you drive Grackle from a terminal. Environments, sessions, tasks, credentials, schedules — every lever the server exposes, you pull from here. The web UI is the same machine with a face on it; this is the bare metal.
Install it with the rest of the stack — see Installation.
This page is a full reference. Every command group, every flag. The prose around the tables is thin on purpose; the tables are the contract.
Connection
The CLI talks to the server over gRPC. Point it somewhere, hand it a key, tell it where home is.
| Setting | Default | Environment Variable |
|---|---|---|
| Server URL | http://127.0.0.1:7434 | GRACKLE_URL |
| API key | ~/.grackle/api-key | GRACKLE_API_KEY |
| Home directory | ~/.grackle | GRACKLE_HOME |
Server
grackle serve
Start the server: gRPC, web UI, WebSocket, and MCP, all in one process.
| Flag | Default | Description |
|---|---|---|
--port <port> | 7434 | Server port |
--web-port <port> | 3000 | Web UI port |
--mcp-port <port> | 7435 | MCP server port |
--mcp-origin <origin> | — | Browser-facing MCP origin (e.g. https://mcp.example.com) for reverse-proxy/TLS deployments; trusted asset/CSP origin for widgets |
--sandbox-port <port> | 7436 | MCP Apps widget sandbox port |
--sandbox-origin <origin> | — | Browser-facing MCP Apps sandbox origin (e.g. https://sandbox.example.com) for reverse-proxy/TLS deployments |
--powerline-port <port> | 7433 | Local PowerLine port |
--allow-network | off | Bind to all interfaces (0.0.0.0). Requires TLS or --insecure (see below). |
--insecure | off | Deliberately accept cleartext on a non-loopback bind. Sets GRACKLE_ALLOW_INSECURE=1. Logged at warn level on every startup. |
By default the server binds to 127.0.0.1 — it answers only to the machine it runs on. --allow-network opens it to the LAN. Non-loopback binds require TLS or an explicit insecure opt-in (advisory GHSA-wcpf-6gwv-47c8): the startup gate accepts (a) GRACKLE_TLS_CERT + GRACKLE_TLS_KEY, (b) GRACKLE_PUBLIC_URL=https://… (fronting TLS proxy), or (c) --insecure / GRACKLE_ALLOW_INSECURE=1. Without one, --allow-network fails fast with the three satisfiers listed in the error. The Docker image bakes in the insecure opt-in so docker run is unchanged.
grackle pair
Generate a pairing code for web UI authentication. Prints the code, a URL, and a QR code. Codes expire after 5 minutes.
Environments
An environment is a machine an agent runs on — a wire. Add one, provision it, and it's ready to take work.
grackle env list
List all environments with ID, type, status, and bootstrap state.
grackle env add <name>
Add an environment. Defaults to the Docker adapter when no adapter flag is given.
| Flag | Description |
|---|---|
--codespace | Codespace adapter |
--docker | Docker adapter |
--ssh | SSH adapter |
--local | Local PowerLine adapter |
--repo <repo> | GitHub repo to clone (docker) |
--image <image> | Docker image |
--attach <container> | Attach to an existing container by name/ID instead of creating one (docker) |
--host <host> | SSH host / local host |
--port <port> | PowerLine port (local adapter) |
--user <user> | SSH user |
--volume <volumes...> | Docker volume mounts (format: host:container[:ro], repeatable) |
--gpu [gpus] | Enable GPU passthrough (default: all) |
--ssh-port <sshPort> | SSH port (default: 22) |
--identity-file <path> | SSH identity file (private key) |
--codespace-name <name> | Codespace name (from gh codespace list) |
--github-account <label> | GitHub account label to use for gh CLI operations (codespace/docker adapters) |
--ssh requires --host; --codespace requires --codespace-name.
grackle env provision <id>
Provision and connect an environment. Streams progress.
| Flag | Description |
|---|---|
--force | Force full reprovision, killing active sessions |
grackle env wake <id>
Wake a sleeping environment (same provisioning flow as provision).
grackle env stop <id>
Stop an environment.
grackle env destroy <id>
Destroy an environment.
grackle env remove <id>
Remove an environment from the registry.
Sessions
A task runs as a session. Spawn one, watch it work, kill it when it strays. Detaching doesn't stop it — the agent stays on the wire; you just stop looking.
grackle spawn <env-id> <prompt>
Start a new agent session and stream its output (Ctrl+C to detach).
| Flag | Description |
|---|---|
--max-turns <n> | Maximum turns |
--persona <id> | Persona to use (falls back to app default) |
--workspace <id> | Workspace to associate with this session (enables workspace-scoped MCP tools) |
grackle attach <session-id>
Attach to a live session. Interactive — prompts for input when the session is waiting. Ctrl+C to detach.
grackle resume <session-id>
Resume a paused session.
grackle send-input <session-id> <text>
Send input to a waiting session.
grackle kill <session-id>
Stop a running session.
| Flag | Description |
|---|---|
-g, --graceful | Send SIGTERM for graceful shutdown instead of hard kill |
grackle status
List agent sessions.
| Flag | Description |
|---|---|
--env <id> | Filter by environment |
--all | Show all sessions including stopped |
grackle session events <session-id>
Show a session's durable, server-sequenced action log (oldest first / replay order).
| Flag | Description |
|---|---|
--from <seq> | Only actions after this seq (resume from a cursor) |
--limit <n> | Max actions to return (default: 500) |
For the deeper model of sessions and the work they carry, see Tasks & Sessions.
Workspaces
A workspace is the context an agent works inside — a repo, a budget, an environment to run on. Bind sessions to one and they share that ground.
grackle workspace list
List all active workspaces.
| Flag | Description |
|---|---|
--env <id> | Filter by environment ID |
grackle workspace create <name>
| Flag | Description |
|---|---|
--env <id> | Environment ID (required, auto-linked as the initial environment) |
--repo <url> | Repository URL |
--desc <text> | Description |
--no-worktrees | Disable worktree isolation |
--working-directory <path> | Working directory / repo root on the environment |
--token-budget <n> | Aggregate token cap across all tasks; 0 = unlimited |
--cost-budget-millicents <n> | Aggregate cost cap in millicents ($0.00001 units); 0 = unlimited |
grackle workspace get <id>
Show full workspace details.