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

# dome guards

> Author content-inspection Filters and assign them to model and MCP server connections

`dome guards` manages Guards — content-inspection definitions that redact, omit, or block governed traffic. A Filter is a workspace-scoped, versioned Guard bound to a connection's ordered chain per direction. Text Filters attach to model connections; JSON Filters attach to MCP server (tool) connections.

| Command                                                 |                                                              |
| ------------------------------------------------------- | ------------------------------------------------------------ |
| [Filters list](#filters-list)                           | `dome guards filters list`                                   |
| [Filters get](#filters-get)                             | `dome guards filters get <name-or-id>`                       |
| [Filters versions](#filters-versions)                   | `dome guards filters versions <name-or-id>`                  |
| [Filters create](#filters-create)                       | `dome guards filters create <name>`                          |
| [Filters update](#filters-update)                       | `dome guards filters update <name-or-id>`                    |
| [Filters rollback](#filters-rollback)                   | `dome guards filters rollback <name-or-id> --to-version <n>` |
| [Filters delete](#filters-delete)                       | `dome guards filters delete <name-or-id>`                    |
| [Model guards filters list](#model-guards-filters-list) | `dome model guards filters list <connection>`                |
| [Model guards filters set](#model-guards-filters-set)   | `dome model guards filters set <connection>`                 |
| [Tool guards filters list](#tool-guards-filters-list)   | `dome tool guards filters list <connection>`                 |
| [Tool guards filters set](#tool-guards-filters-set)     | `dome tool guards filters set <connection>`                  |

Editing a Filter deploys a new active version. Assigned connections pick it up on the next gateway sync — history is preserved and can be rolled back to.

## Filter kinds

A Filter's kind is structural and immutable at create time.

| Kind   | Assignable to                 | Component                                                                  | Actions                   |
| ------ | ----------------------------- | -------------------------------------------------------------------------- | ------------------------- |
| `text` | Model connections             | Ordered text-content matchers (substring, SSN, credit card, phone, digits) | `redact`, `block`         |
| `json` | MCP server (tool) connections | Ordered JSON field-actions keyed by field name                             | `redact`, `omit`, `block` |

Both kinds enforce **fail-closed**: a Filter whose stored config fails to decode blocks that `(connection, direction)` until the config is fixed. The gateway never relays unfiltered traffic.

***

## Filters list

`dome guards filters list`

List the workspace's Filters, showing each one's active version and a compact config summary (e.g. `redact[substring:"foo", ssn]; block[substring:"bar"]` or `omit[ssn, dob]; redact[email]`).

## Filters get

`dome guards filters get <name-or-id>`

Show a single Filter's active version and config.

| Arg          | Type   | Required | Description                            |
| ------------ | ------ | -------- | -------------------------------------- |
| `name-or-id` | string | Yes      | Filter name (workspace-scoped) or UUID |

## Filters versions

`dome guards filters versions <name-or-id>`

List the Filter's version history (newest first). Rollback-produced versions cite the source version id.

## Filters create

`dome guards filters create <name>`

Create a Filter — its first active version.

```bash theme={"system"}
# Text Filter: redact SSNs and a substring, then block on another substring
dome guards filters create pii-redact \
  --description "Redact PII in model responses" \
  --redact-ssn \
  --redact-substring "internal-only" \
  --block-substring "TOP-SECRET"

# JSON Filter: omit and redact fields in tool arguments/results (via --config-from)
dome guards filters create tool-scrub --config-from ./tool-scrub.json
```

| Flag                 | Type                | Required                        | Default | Description                                                                                           |
| -------------------- | ------------------- | ------------------------------- | ------- | ----------------------------------------------------------------------------------------------------- |
| `--description`      | string              | No                              | —       | One-line description                                                                                  |
| `--redact-substring` | string (repeatable) | Text only                       | —       | Redact matches of this substring                                                                      |
| `--block-substring`  | string (repeatable) | Text only                       | —       | Block the response on a substring match                                                               |
| `--redact-ssn`       | bool                | Text only                       | `false` | Redact US SSN patterns                                                                                |
| `--block-ssn`        | bool                | Text only                       | `false` | Block the response on an SSN match                                                                    |
| `--config-from`      | path or `-`         | For JSON, or full-fidelity text | —       | Read a protojson `dome.guards.v1.FilterConfig` from a file or stdin. Overrides the convenience flags. |

The convenience flags build at most two components — a `redact` component and a `block` component, redact ordered first — and only produce text Filters. Use `--config-from` to author a JSON Filter or a multi-component text chain.

### JSON Filter config example

```json title="tool-scrub.json" theme={"system"}
{
  "json": {
    "components": [
      {
        "field_actions": [
          { "matcher": { "key": "ssn" },   "action": "FILTER_ACTION_OMIT" },
          { "matcher": { "key": "dob" },   "action": "FILTER_ACTION_OMIT" },
          { "matcher": { "key": "email" }, "action": "FILTER_ACTION_REDACT" },
          { "matcher": { "key": "card" },  "action": "FILTER_ACTION_BLOCK" }
        ]
      }
    ]
  }
}
```

`BLOCK` withholds the whole message. `OMIT` removes the key and value. `REDACT` rewrites the value with a redaction sentinel. When multiple actions target the same key, `BLOCK` > `OMIT` > `REDACT`.

## Filters update

`dome guards filters update <name-or-id>`

Edit metadata in place, or deploy a new active version by passing any config flag. The old version is preserved in history and assigned connections follow the active version on the next gateway sync.

| Flag                                                                                          | Type   | Description                                  |
| --------------------------------------------------------------------------------------------- | ------ | -------------------------------------------- |
| `--name`                                                                                      | string | New name for the logical Filter              |
| `--description`                                                                               | string | New description                              |
| `--redact-substring` / `--block-substring` / `--redact-ssn` / `--block-ssn` / `--config-from` | —      | Any config flag deploys a new active version |

Pass at least one of name, description, or a config flag.

## Filters rollback

`dome guards filters rollback <name-or-id> --to-version <n>`

Roll a Filter back to an earlier version. The target version's config is copied forward into a new active version — history is never mutated.

| Flag           | Type  | Required | Description                    |
| -------------- | ----- | -------- | ------------------------------ |
| `--to-version` | int32 | Yes      | Version number to roll back to |

## Filters delete

`dome guards filters delete <name-or-id>`

Hard-delete a Filter and its connection assignments. Corrupt Filters can still be addressed by UUID even when their config fails to render.

***

## Model guards filters list

`dome model guards filters list <connection>`

List the text Filters assigned to a model connection, in chain order, grouped by direction.

| Arg          | Type   | Required | Description           |
| ------------ | ------ | -------- | --------------------- |
| `connection` | string | Yes      | Model connection name |

## Model guards filters set

`dome model guards filters set <connection>`

Replace the entire ordered Filter chain for one direction on a model connection. Only `text`-kind Filters may be assigned.

```bash theme={"system"}
# Order matters — filters run in the given order
dome model guards filters set claude-prod \
  --direction response \
  --filters pii-redact,secrets-block

# Clear a chain
dome model guards filters set claude-prod --direction request --filters ""
```

| Flag          | Type                 | Required | Description                                                                    |
| ------------- | -------------------- | -------- | ------------------------------------------------------------------------------ |
| `--direction` | string               | Yes      | `response` (completions the agent receives) or `request` (the outbound prompt) |
| `--filters`   | comma-separated list | Yes      | Ordered Filter names or UUIDs; empty clears the chain                          |

`request` runs before dispatch to the upstream provider — a match can redact the prompt or block the call. `response` runs on the streamed completion; multi-chunk patterns are inspected inside the [LLM outbound filter window](/govern/guards#configure-the-streaming-window).

***

## Tool guards filters list

`dome tool guards filters list <connection>`

List the JSON Filters assigned to an MCP server (tool) connection, in chain order, grouped by direction.

| Arg          | Type   | Required | Description                |
| ------------ | ------ | -------- | -------------------------- |
| `connection` | string | Yes      | MCP server connection name |

## Tool guards filters set

`dome tool guards filters set <connection>`

Replace the entire ordered Filter chain for one direction on a tool connection. Only `json`-kind Filters may be assigned.

```bash theme={"system"}
# Scrub PII from tool arguments before they leave, and again from results
dome tool guards filters set github-mcp \
  --direction request \
  --filters tool-scrub

dome tool guards filters set github-mcp \
  --direction response \
  --filters tool-scrub
```

| Flag          | Type                 | Required | Description                                                                                  |
| ------------- | -------------------- | -------- | -------------------------------------------------------------------------------------------- |
| `--direction` | string               | Yes      | `response` (tool result returned to the agent) or `request` (tool arguments before dispatch) |
| `--filters`   | comma-separated list | Yes      | Ordered Filter names or UUIDs; empty clears the chain                                        |

`request` filters run over tool arguments **before** the call reaches the upstream MCP server — matched fields are redacted or omitted, or the whole call is blocked. `response` filters run over the tool result before the agent sees it.
