> ## Documentation Index
> Fetch the complete documentation index at: https://docs.compressi.us/llms.txt
> Use this file to discover all available pages before exploring further.

# CMX CLI Reference: All Commands, Flags, and Examples

> Complete reference for all CMX CLI commands: setup, start/stop, stats, harness, sessions, upgrade, and more. Includes flags and example output.

The `cmx` command-line interface provides everything you need to manage your local gateway, connect coding agents, monitor token usage, and update CMX. Run `cmx --help` to see the commands available in your installed version.

***

## Get Started

### `cmx login`

Sign in and pair this device with your CMX account through the browser.

```bash theme={null}
cmx login
```

***

### `cmx setup`

Sign in and connect detected coding agents. This is the recommended command to run the first time you install CMX — it handles browser sign-in, gateway startup, and agent connection in a single guided flow.

```bash theme={null}
cmx setup
```

<Tip>
  Run `cmx setup` immediately after installation. It combines login, gateway
  start, and coding agent connection so you don't have to run each step
  separately.
</Tip>

***

### `cmx harness enable`

Route a detected coding agent through CMX so its traffic passes through the local compression gateway.

```bash theme={null}
cmx harness enable
```

***

### `cmx serve`

Run CMX in the current terminal as a foreground process. The gateway stays active for as long as the terminal session remains open.

```bash theme={null}
cmx serve
```

***

### `cmx doctor`

Diagnose configuration and connectivity issues. This command inspects your installation, checks gateway connectivity, and reports any problems it finds.

```bash theme={null}
cmx doctor
```

<Tip>
  The output of `cmx doctor` may include local file paths and configuration
  details. Review it carefully and remove any sensitive information before
  sharing it with support.
</Tip>

***

## Start and Stop

### `cmx`

Open the interactive terminal interface. Use this to manage connections, configure providers, and adjust preferences through a keyboard-driven UI.

```bash theme={null}
cmx
```

***

### `cmx start`

Start CMX as a background process. The gateway continues running after you close the terminal.

```bash theme={null}
cmx start
```

***

### `cmx stop`

Stop the background CMX process.

```bash theme={null}
cmx stop
```

***

### `cmx status`

Show the current CMX status, including whether the gateway is running and how it is configured.

```bash theme={null}
cmx status [flags]
```

**Flags:**

| Flag     | Description                            |
| -------- | -------------------------------------- |
| `--json` | Output status in machine-readable JSON |

**Examples:**

```bash theme={null}
# Human-readable status
cmx status

# Machine-readable JSON output
cmx status --json
```

***

## Usage and Diagnostics

### `cmx stats`

Show today's token and compression statistics, including tokens handled, estimated net savings, and provider activity.

```bash theme={null}
cmx stats
```

***

### `cmx logs status`

Check whether opt-in raw logging is currently enabled on this device.

```bash theme={null}
cmx logs status
```

***

### `cmx dashboard`

Open the CMX web dashboard in your default browser. The dashboard shows account-level usage history across all your devices.

```bash theme={null}
cmx dashboard
```

***

## Connections and Maintenance

### `cmx harness list`

List all detected coding agent harnesses on this device.

```bash theme={null}
cmx harness list
```

***

### `cmx harness verify`

Verify that saved coding-agent connections are still valid and reachable.

```bash theme={null}
cmx harness verify
```

***

### `cmx harness disable`

Restore the original harness configuration for all connected coding agents, removing CMX from their request path.

```bash theme={null}
cmx harness disable
```

<Tip>
  Run `cmx harness disable` before uninstalling CMX. This restores your coding
  agents to their original configuration so they continue working normally after
  CMX is removed.
</Tip>

***

### `cmx sessions purge`

Delete expired local sessions to free up space and remove stale session data.

```bash theme={null}
cmx sessions purge
```

***

### `cmx upgrade`

Check whether a newer version of CMX is available, or download and install the update immediately.

```bash theme={null}
cmx upgrade [flags]
```

**Flags:**

| Flag        | Description                               |
| ----------- | ----------------------------------------- |
| `--install` | Download and install the available update |

**Examples:**

```bash theme={null}
# Check for an available update
cmx upgrade

# Download and install the update immediately
cmx upgrade --install
```

***

### `cmx logout`

Sign out of your CMX account and clear all locally stored credentials from this device.

```bash theme={null}
cmx logout
```

***

## Global Flags

These flags are available on every `cmx` command.

| Flag              | Description                     |
| ----------------- | ------------------------------- |
| `--help`, `-h`    | Show help for a command         |
| `--version`, `-v` | Print the installed CMX version |

**Examples:**

```bash theme={null}
# Print the installed CMX version
cmx --version

# Show top-level help
cmx --help

# Show help for a specific command
cmx harness --help
```

***

<Note>
  Not all flags may be listed here. Run `cmx --help` or `cmx <command> --help`
  for the complete list of flags available in your installed version.
</Note>


## Related topics

- [Install CMX on Linux, macOS, or Windows — All Methods](/installation.md)
- [Understanding CMX Token Savings and Dashboard Metrics](/understanding-savings.md)
- [CMX Quick Start: Install, Connect, and Save Tokens](/quickstart.md)
