Reference

fabric-cli

Command reference for the Fabric Agents CLI — send messages, list sessions, run one-shot prompts headlessly, automate from scripts and CI.

fabric-cli is the command-line client for Fabric Agents. It talks to a running Fabric Agents server (local or remote) over WebSocket, and has a self-contained run subcommand that spins up its own server for one-shot prompts — handy in scripts, CI, and automations.

When to use it

ScenarioTool
Interactive work with streaming UI, file diffs, tool visualisationDesktop app
Long-running sessions with state you come back toDesktop app
Scripts and CI pipelines that invoke an agent non-interactivelyfabric-cli run
Automations triggered by labels, schedules, or eventsfabric-cli via Automations
Poking at a running server (list workspaces, tail events, send RPC)fabric-cli against a running server

Installing

Fabric Agents CLI is a separate native terminal client, built from the same repository/release as the desktop and server. Published standalone releases are available through the public installers below. Installing the desktop alone does not install a global CLI.

Linux/macOS:

curl -fsSL https://agents.fabric.pro/install-cli.sh | bash

Windows PowerShell:

Invoke-WebRequest https://agents.fabric.pro/install-cli.ps1 -OutFile install-cli.ps1
./install-cli.ps1

The installers verify SHA-256 and the reported version. Unix installs a managed launcher at ~/.local/bin/fabric-cli with versioned binaries under ~/.local/share/fabric-cli; Windows uses %LOCALAPPDATA%\FabricAgentsCLI\bin. Open a new terminal or add the printed bin directory to PATH. They refuse an unrelated existing command. No provider credentials or old profiles are imported. Remote commands need no separately installed Bun.

Run fabric-cli --version and fabric-cli --help. Re-run the installer to update, or select a particular published version (bash install-cli.sh X.Y.Z / ./install-cli.ps1 -Version X.Y.Z). macOS release binaries are signed and notarized; Windows follows the existing unsigned release configuration.

For source development, install dependencies in an authorized checkout and run bun --no-env-file apps/cli/src/index.ts --help. The standalone local run workflow additionally requires Bun and an accessible Fabric server runtime; remote session commands use the existing server instead.

Connecting to a server

fabric-cli reads two env vars to know where to connect:

VariablePurpose
FABRIC_SERVER_URLLoopback ws:// (including an SSH tunnel), or verified wss://.
FABRIC_SERVER_TOKENBearer token, supplied privately through the environment.

Keep probe tokens out of command arguments and URLs: use FABRIC_SERVER_TOKEN from a private environment or mode-600 file. --url may override the URL. Plaintext connections to non-loopback hosts and untrusted TLS certificates are refused. Machine setup uses SSH tunnels or trusted TLS, without self-signed or pinned certificates.

Ordinary commands require an explicit URL and token. The CLI does not discover or read another desktop/server profile automatically. Select the workspace ID explicitly when a server has more than one. Use the hidden token prompts and connection walkthrough; never type a real token into a command line or paste it into a support transcript.

Subcommands

Connection & diagnostics

CommandDescription
fabric-cli pingVerify server connectivity. Prints client ID and round-trip latency.
fabric-cli healthCheck credential store health.
fabric-cli versionsShow server runtime versions.

Workspaces & sessions

CommandDescription
fabric-cli workspacesList all configured workspaces.
fabric-cli sessions [--workspace <id>]List sessions in the current (or specified) workspace.
fabric-cli session create [--name <str>] [--mode safe|ask|allow-all] [--connection <slug>] [--model <id>]Create a session on the selected server; use a slug from connections to select its account.
fabric-cli session messages <session-id>Print the session's full message history.
fabric-cli session delete <session-id>Delete a session.

Communication

CommandDescription
fabric-cli send <session-id> <message>Send a message to a session and stream the response. Reads from stdin if no message argument is given.
fabric-cli cancel <session-id>Cancel in-progress processing on a session.

Sources & connections

CommandDescription
fabric-cli connectionsList configured LLM connections.
fabric-cli sourcesList sources in the current workspace and their health status.

Raw RPC

CommandDescription
fabric-cli invoke <channel> [args-as-json]Low-level RPC call against any channel.
fabric-cli listen <channel>Subscribe to a push channel; prints events as they arrive. Ctrl+C to stop.

Remote subscription accounts

Follow remote provider sign-in once on the server through Add Connection or the profile-aware CLI helper, then select its connection slug with session create --connection SLUG. The CLI checks that slug against the server's connection inventory; it does not send a laptop's provider credentials. The server's account/model/quota rules still apply. send performs an actual model call; ping, workspaces and connections are inspection steps. Resolve pending approvals in a connected Fabric UI; this CLI is not an interactive approval terminal.

fabric-cli run — local one-shot headless prompts

run starts a local server. A configured FABRIC_SERVER_URL / --url is rejected for this command instead of silently ignoring the remote target. Use session/create/send for remote work. Local run requires its own runtime/profile; it defaults to unattended permissions and may consume the configured account's allowance. It is not a remote subscription-login shortcut.

run is the self-contained mode. It spawns a server, creates a session, sends your prompt, streams the response, and exits.

fabric-cli run "Summarise the latest commit"

Common flags

FlagDefaultPurpose
--workspace-dir <path>—Register this directory as the working workspace for the session.
--source <slug>—Enable a source for this run. Repeatable.
--mode safe|ask|allow-allallow-allPermission mode.
--model <id>provider defaultSpecific model to use.
--provider anthropic|openai|google|openrouter|groq|mistral|xai|…anthropicLLM provider.
--api-key <key>$LLM_API_KEY or provider-specific env varCredential for the provider.
--base-url <url>—Custom endpoint (proxies, self-hosted LLMs, Vercel AI Gateway).
--output-format text|stream-jsontextWhat gets written to stdout. Use stream-json when piping into another script.
--no-cleanupfalseKeep the session on disk after the run for later inspection.
--codingfalseRun the session in Coding mode: a shorter prompt with tools for coding and session coordination.

Example: one-shot API call

fabric-cli run \
  --workspace-dir ~/code/my-app \
  --source github \
  --mode ask \
  --output-format stream-json \
  "Summarise open PRs assigned to me and group by repo."

Example: against a specific model and endpoint

LLM_API_KEY=sk-... fabric-cli run \
  --provider openai \
  --model gpt-4o \
  --base-url https://gateway.example.com/v1 \
  "Draft release notes from this changelog."

Global flags

These work on every subcommand (not just run):

FlagDefaultPurpose
--url <ws-url>$FABRIC_SERVER_URLServer URL.
--token <token>$FABRIC_SERVER_TOKENSupported override; use the environment for probes to keep tokens out of argv.
--workspace <id>(current)Workspace the command operates in.
--jsonfalseEmit JSON output.
--timeout <ms>10000Request timeout.
--send-timeout <ms>300000Max wait for a send / run stream to complete.
--tls-ca <path>$FABRIC_TLS_CAAdditional trusted CA bundle; does not disable verification. Machine setup uses trusted TLS without this override.

Exit codes

CodeMeaning
0Success.
1Error (network, RPC, validation, or a structured provider error such as retries exhausted). Stderr has the details. In text mode a discarded partial response is marked explicitly; stream-json keeps the original events.
130Interrupted by the user (Ctrl+C) or the server sent an interrupted event.

Output modes

  • text (default) — Streams the assistant's visible text. Good for humans and simple scripts.
  • stream-json — One JSON object per line, mirroring the session event stream (user messages, tool calls, tool results, assistant messages, errors). Good for piping into jq or downstream processing.

Use cases

CI: run a prompt on every PR

- name: Agent review
  run: |
    fabric-cli run \
      --workspace-dir . \
      --source github \
      --mode safe \
      "Summarise the risks in this PR and flag anything touching auth."

Automation: react to a Linear issue assignment

Configure an automation on LabelAdd for the triage label and let it invoke fabric-cli run with the relevant $FABRIC_* environment variables injected. See Environment variables.

Headless server validation

fabric-cli --validate-server

Runs a 21-step integration test against a locally-spawned server — handy for debugging a broken install.

Replacing Fabric Code

Fabric Agents CLI replaces the deprecated Fabric Code product as Fabric's maintained terminal interface. It shares the server/workspaces with Desktop and Web rather than maintaining a second agent implementation.

Existing workflowSupported replacement
Interactive terminal UIFabric Desktop or Web UI for interactive sessions; CLI for commands/scripts
Remote tasks and historyExplicit server connection, session create, send, session messages, cancel
Local unattended taskrun with a local Fabric server runtime/profile, deliberately selected permissions
Provider/subscription setupAdd Connection on the server where execution happens
CLI updatesRe-run the standalone installer; versions track Fabric releases

This is a product replacement, not an automatic data-format migration. Legacy conversation/history/config files are not imported by the installer. Preserve that checkout and its data for reference; do not copy its credential directories into a Fabric server profile. A separate, explicit migration would need its own format and recovery checks.

The canonical new command is fabric-cli. Existing fabriccode, fabric-code or fabric commands are not silently repointed: their flags and interactive behavior may differ. Update scripts deliberately, test them against a disposable workspace first, and keep the selected session ID after an uncertain send.

To uninstall the Unix CLI, remove its managed ~/.local/bin/fabric-cli launcher and ~/.local/share/fabric-cli binaries after inspecting ownership. On Windows, remove the dedicated FabricAgentsCLI directory and its user-PATH entry. These steps do not remove server workspaces or provider accounts.

On this page