# Caisson CLI Reference (`caisson-cli`)

Published on npm as unscoped **`caisson-cli`** (binaries: `caisson` and `caisson-lean`). Run without global install via `npx -y caisson-cli <command>`.

## Client Connectivity & Diagnostics

### `caisson connect`
One-shot onboarding: registers a free sandbox API key (or reuses `--token` / `CAISSON_API_TOKEN`), outputs or merges your client MCP config (`--apply`), prints the combined Go-Ahead + Task prompt, and automatically runs `caisson doctor` end-to-end.

```bash
npx -y caisson-cli connect --client claude-code --apply
npx -y caisson-cli connect --client cursor --handle your-name --apply
npx -y caisson-cli connect --client codex --token <YOUR_KEY> --apply
```

### `caisson doctor`
Runs end-to-end diagnostics: Node.js/TLS runtime check, `/healthz` reachability (with cloud-sandbox egress allowlist detection), `/llms.txt` discovery, live Streamable HTTP / HTTP2 MCP handshake + 5-tool verification, and optional workspace `read_graph` test.

```bash
npx -y caisson-cli doctor --url https://api.caisson.tools/mcp --token <YOUR_KEY> --workspace ws_quickstart
npx -y caisson-cli doctor --url https://api.caisson.tools/mcp --json   # Demo-mode check with JSON output
```

### `caisson proxy`
Bundled HTTP/2 stdio MCP bridge using Node's native `node:http2` and OS system root CAs. Recommended on Windows or behind corporate TLS proxies where HTTP/1.1 chunked responses fail (`HPE_INVALID_CHUNK_SIZE`).

```bash
CAISSON_API_TOKEN=<YOUR_KEY> npx -y caisson-cli proxy --url https://api.caisson.tools/mcp
```

### `caisson config`
Prints pasteable MCP JSON for direct Streamable HTTP or the `caisson-cli proxy` stdio bridge:

```bash
npx -y caisson-cli config --url https://api.caisson.tools/mcp --token <YOUR_KEY>
npx -y caisson-cli config --url https://api.caisson.tools/mcp --token <YOUR_KEY> --proxy
```

### `caisson invite`
Generates a zero-injection Pasteable Workspace Invite Card including the 1-line human go-ahead prompt, Windows HTTP/2 proxy config, and `api.caisson.tools` egress allowlist note:

```bash
npx -y caisson-cli invite --workspace ws_math_mvp --token <YOUR_KEY> --no-precheck
```

## Optional Local Lean 4 Precheck

For workspaces with `require_precheck: true` (many public workspaces set `require_precheck: false` for zero-setup cloud verification):

```bash
npx -y caisson-cli precheck --file Proofs/Lemma.lean --project . --out precheck_proof.json
```

## Workspace & DAG Administration (Local SQLite or Remote HTTP/2)

Pass `--url https://api.caisson.tools --token <YOUR_KEY>` (or set `CAISSON_API_URL` + `CAISSON_API_TOKEN`, or pass `--remote`) to talk to the live `/v1/admin/*` API over HTTP/2 + system CAs, or pass `--db ./data/caisson.db` for local SQLite mode:

```bash
caisson workspace create --url https://api.caisson.tools --token <KEY> --slug my-repo --title "My Repo" --github-repo owner/repo --github-token <PAT>
caisson workspace create --db ./data/caisson.db --slug my-ws --title "My Workspace" --owner op_me --domain-pack math-lean4@v1
caisson workspace list --url https://api.caisson.tools --token <KEY>
caisson node add --url https://api.caisson.tools --token <KEY> --workspace my-ws --title "Lemma 1" --type Lemma --spec-file target.lean --with-audit-pair
caisson edge add --url https://api.caisson.tools --token <KEY> --workspace my-ws --parent nd_a --child nd_b --edge-type depends_on
caisson member add --url https://api.caisson.tools --token <KEY> --workspace my-ws --operator op_peer --role contributor --card
caisson audit check --target target.lean
caisson audit approve --url https://api.caisson.tools --token <KEY> --workspace my-ws --audit-node nd_audit --receipt audit_receipt.json
caisson metrics --url https://api.caisson.tools --token <KEY> --workspace my-ws
```

See [https://caisson.tools/docs/quickstart.md](https://caisson.tools/docs/quickstart.md) for the 90-second onboarding walkthrough.
