CLI Reference
Thecraft-cli is a terminal client that connects to a running Craft Agent headless server over WebSocket. It provides commands for listing resources, managing sessions, sending messages with real-time streaming, and validating server health.
Installation
Quick Start
The fastest way to try it out — no server setup needed:Connection Options
Flags override environment variables. If
--workspace is omitted, the first available workspace is used automatically.
Commands
Info & Health
Resource Listing
Session Operations
Send Message (Streaming)
send command subscribes to session:event and streams the AI response to stdout in real time:
Raw RPC
invoke sends a request to any channel and prints the response. listen subscribes to a push channel and prints events as they arrive (Ctrl+C to stop).
Run (Self-Contained)
run command is fully self-contained — it spawns a headless server, creates a session, sends the prompt, streams the response, and exits. No separate server setup needed. An API key is resolved from --api-key, $LLM_API_KEY, or a provider-specific env var (e.g., $ANTHROPIC_API_KEY, $OPENAI_API_KEY).
LLM Configuration:
Validate Server
--url is provided, --validate-server automatically spawns a local headless server, runs the validation, and shuts it down.
Runs a 21-step integration test covering the full server lifecycle including source and skill creation:
- Connect + handshake
credentials:healthChecksystem:versionssystem:homeDirworkspaces:getsessions:getLLM_Connection:listsources:getsessions:create(temporary__cli-validate-*session)sessions:getMessages- Send message + stream (text response)
- Send message + tool use (Bash tool)
sources:create(temporary Cat Facts API source)- Send + source mention (uses the created source)
- Send + skill create (writes SKILL.md via Bash)
skills:get(verify skill appears)- Send + skill mention (invokes the created skill)
skills:delete(cleanup)sources:delete(cleanup)sessions:delete(cleanup)- Disconnect
--json for machine-readable output: