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

# CLI reference

> warden serve, debug attach, audit, policy lint, and keygen.

```
warden <command> [flags]
```

Run `warden <command> -h` for a command's flags.

## warden serve

```bash theme={null}
warden serve --config /etc/warden/warden.yaml
warden serve --config ./warden.yaml --listen 127.0.0.1:9999   # override the address
```

Runs the gateway. At startup it prints, in order: configuration warnings, each connection's capability ladder, the state directory, and any recovery notes from the journals. It refuses to start when a connection cannot meet its policy, when the audit chain is broken, or when a non-loopback listener has no TLS and no explicit permission.

Shuts down cleanly on `SIGINT`/`SIGTERM`: in-flight operations finish, journals are closed.

## warden debug attach

```bash theme={null}
export WARDEN_OPERATOR_TOKEN=wc_live_…
warden debug attach --connection shop --filter writes
```

| Flag | Default | Meaning |
| - | - | - |
| `--connection` | *(required)* | Which connection to debug |
| `--filter` | `all` | `all`, `reads`, `writes`, `ddl`, or `unbounded` |
| `--url` | `http://127.0.0.1:9470` | Gateway address |
| `--token` | `$WARDEN_OPERATOR_TOKEN` | Operator token |
| `--timeout` | `60` | Seconds an operation waits for your decision |
| `--ttl` | `30` | Minutes before the session expires on its own |

Starts a Debug Mode session and streams paused operations to your terminal. For each one you see the statement, the parameters, the blast radius, and the agent's stated reason, and you answer:

| Key | Action |
| - | - |
| `s` / Enter | Step — allow this one |
| `c` | Continue — stop pausing and let the session run on |
| `r` | Reject — refuse it, with a reason |
| `q` | Quit — end the session; anything still waiting is refused |

See [Debug Mode](https://warden.buildlab.in/operate/debug-mode.md).

## warden audit

```bash theme={null}
warden audit tail                          # follow the log as decisions happen
warden audit tail --agent agent:support    # one agent only
warden audit tail --follow=false           # print what exists and exit
warden audit verify                        # walk the hash chain, report the first break
```

`--url` and `--token` work as they do for `debug attach`. `verify` exits non-zero on a break and names the event where the chain stops matching. See [audit](https://warden.buildlab.in/operate/audit.md).

## warden policy lint

```bash theme={null}
warden policy lint ./policies/shop.yaml
```

Takes the policy file as an argument and checks shape and internal consistency: resources, scope bindings, masking rules, approval classes, and combinations that are individually valid but dangerous together — a granted table with no scopable column, for instance. Exits non-zero when the report is not clean.

> [!NOTE]
>
> Linting here does not probe a live connection, so it cannot check the `require:` block — those levels need an engine. `warden serve` performs that check at startup and refuses to start when the engine falls short.

## warden keygen

```bash theme={null}
warden keygen                  # an agent key (the default)
warden keygen --kind operator  # an operator token
```

Prints the credential once, with the hash to paste into `warden.yaml`. Store the plaintext in your secret manager; the configuration file should carry only the hash, so that the file is not itself a credential.

## warden version

```bash theme={null}
warden version
```

Prints the version stamped at build time. `dev` means a build from a branch or a working tree rather than a tagged release.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.