> ## 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.

# Guards

> Inspect, redact, and constrain content on tool and model connections

export const guard = "Guards inspect request and response content on tool and model connections. They can redact, omit, or block sensitive text before it reaches an agent or upstream backend.";

<p>
  {guard}
</p>

## Overview

Guards sit on Dome's content path and decide what of an authorized call's body may leave a backend or reach the agent. They attach to a model or tool connection and to a direction (`request` or `response`). When an assigned Guard cannot be evaluated, the gateway blocks that connection and direction.

**Filters** are a Guard type. Model connections accept only `text` Filters. Tool connections accept only `json` Filters.

The typical workflow is:

1. [Create a Filter](#create-a-filter) for the connection kind you need.
2. [Assign ordered Filter chains](#assign-ordered-filter-chains) on the connection and direction.
3. [Configure the streaming window](#configure-the-streaming-window) when model response Filters need more context.

## Requirements

Before you begin:

* Authenticate to Dome and select a workspace
* Have at least one [model](/connect/resources/models) or [tool](/connect/resources/tools) connection to assign

### Permissions

Guard Filter operations require platform permissions. Each operation restates its permission inline.

| Default roles       | Permission       | Grants                                                                 |
| ------------------- | ---------------- | ---------------------------------------------------------------------- |
| All workspace roles | `filters.view`   | List Filters and assignments                                           |
| `admin`, `operator` | `filters.manage` | Create, update, roll back, or delete Filters and set assignment chains |
| `admin`, `operator` | `gateway.manage` | Set a per-model filter window                                          |
| `admin`, `operator` | `config.manage`  | Set the workspace streaming filter window floor                        |

## Filters

Filters are a Guard type. Create and version Filters here, assign them to connections, and tune the streaming window used when response Filters inspect model output.

### Create a Filter

Create a Filter to define its first active version. Text Filters use convenience flags. JSON Filters use a config file.

<Callout icon="key">Requires `filters.manage`.</Callout>

When more than one JSON action targets the same path, precedence is `BLOCK` > `OMIT` > `REDACT`. `REDACT` rewrites the matched span or value, `OMIT` removes a JSON field, and `BLOCK` withholds the whole message and stops the chain.

<Tabs>
  <Tab title="CLI">
    ```bash title="Text Filter" theme={"system"}
    dome guards filters create pii-redact \
      --description "Redact PII in model responses" \
      --redact-ssn \
      --redact-substring "internal-only" \
      --block-substring "TOP-SECRET"
    ```

    ```bash title="JSON Filter" theme={"system"}
    dome guards filters create tool-scrub \
      --config-from ./tool-scrub.json
    ```

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

    Convenience flags build at most two text components. Redact runs first, then block. Use `--config-from` for a JSON Filter or a multi-component text chain.

    <Callout icon="terminal">Reference: [`dome guards filters create`](/cli/secure/guards#filters-create)</Callout>
  </Tab>

  <Tab title="MCP">
    Tool: `dome_guards_create_filter`

    ```json theme={"system"}
    {
      "name": "pii-redact",
      "description": "Redact PII in model responses",
      "redact_ssn": true,
      "redact_substrings": ["internal-only"],
      "block_substrings": ["TOP-SECRET"]
    }
    ```

    Pass `config_json` with a protojson `dome.guards.v1.FilterConfig` to author a JSON Filter or a multi-component text chain. Convenience params only produce text Filters.

    <Callout icon="cpu">Reference: [`dome_guards_create_filter`](/reference/mcp/guards#create-filter)</Callout>
  </Tab>

  <Tab title="Agent">
    ```text title="Create a Filter" theme={"system"}
    Create a text Filter named "pii-redact" that redacts SSNs and the substring "internal-only", and blocks on "TOP-SECRET".
    ```
  </Tab>
</Tabs>

### Update a Filter

Update Filter metadata in place, or pass any config flag to deploy a new active version. The previous version remains in history. Assigned connections follow the active version on the next gateway sync.

<Callout icon="key">Requires `filters.manage`.</Callout>

<Tabs>
  <Tab title="CLI">
    ```bash theme={"system"}
    dome guards filters update pii-redact \
      --description "Redact PII and secrets in model responses" \
      --redact-ssn \
      --block-substring "TOP-SECRET"
    ```

    <Callout icon="terminal">Reference: [`dome guards filters update`](/cli/secure/guards#filters-update)</Callout>
  </Tab>

  <Tab title="MCP">
    Tool: `dome_guards_update_filter`

    ```json theme={"system"}
    {
      "filter": "pii-redact",
      "description": "Redact PII and secrets in model responses",
      "redact_ssn": true,
      "block_substrings": ["TOP-SECRET"]
    }
    ```

    <Callout icon="cpu">Reference: [`dome_guards_update_filter`](/reference/mcp/guards#update-filter)</Callout>
  </Tab>
</Tabs>

### Roll back a Filter

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.

<Callout icon="key">Requires `filters.manage`.</Callout>

<Tabs>
  <Tab title="CLI">
    ```bash theme={"system"}
    dome guards filters rollback pii-redact --to-version 1
    ```

    <Callout icon="terminal">Reference: [`dome guards filters rollback`](/cli/secure/guards#filters-rollback)</Callout>
  </Tab>

  <Tab title="MCP">
    Tool: `dome_guards_rollback_filter`

    ```json theme={"system"}
    {
      "filter": "pii-redact",
      "to_version": 1
    }
    ```

    <Callout icon="cpu">Reference: [`dome_guards_rollback_filter`](/reference/mcp/guards#rollback-filter)</Callout>
  </Tab>
</Tabs>

### Delete a Filter

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

<Callout icon="key">Requires `filters.manage`.</Callout>

<Warning>
  Delete removes the Filter and every assignment that references it.
</Warning>

<Tabs>
  <Tab title="CLI">
    ```bash theme={"system"}
    dome guards filters delete pii-redact
    ```

    <Callout icon="terminal">Reference: [`dome guards filters delete`](/cli/secure/guards#filters-delete)</Callout>
  </Tab>

  <Tab title="MCP">
    Tool: `dome_guards_delete_filter`

    ```json theme={"system"}
    {
      "filter": "pii-redact"
    }
    ```

    <Callout icon="cpu">Reference: [`dome_guards_delete_filter`](/reference/mcp/guards#delete-filter)</Callout>
  </Tab>
</Tabs>

### Assign ordered Filter chains

Each assignment binds Filters to a `(connection, direction)` slot. Setting a chain replaces the complete ordered list for that slot. Clear a chain with an empty filter list.

<Callout icon="key">Requires `filters.manage`.</Callout>

Model connections accept only `text` Filters. Tool connections accept only `json` Filters.

<Tabs>
  <Tab title="CLI">
    ```bash title="Model connection" theme={"system"}
    dome model guards filters set claude-prod \
      --direction response \
      --filters pii-redact,secrets-block
    ```

    ```bash title="Tool connection" theme={"system"}
    dome tool guards filters set github-mcp \
      --direction request \
      --filters tool-scrub
    ```

    ```bash title="Clear a chain" theme={"system"}
    dome model guards filters set claude-prod \
      --direction request \
      --filters ""
    ```

    Inspect assignments with:

    ```bash theme={"system"}
    dome model guards filters list <connection>
    dome tool guards filters list <connection>
    ```

    <Callout icon="terminal">Reference: [`dome model guards filters set`](/cli/secure/guards#model-guards-filters-set) · [`dome tool guards filters set`](/cli/secure/guards#tool-guards-filters-set)</Callout>
  </Tab>

  <Tab title="MCP">
    Tool: `dome_model_guards_filters_set`

    ```json theme={"system"}
    {
      "connection": "claude-prod",
      "direction": "response",
      "filters": ["pii-redact", "secrets-block"]
    }
    ```

    Tool: `dome_tool_guards_filters_set`

    ```json theme={"system"}
    {
      "connection": "github-mcp",
      "direction": "request",
      "filters": ["tool-scrub"]
    }
    ```

    <Callout icon="cpu">Reference: [`dome_model_guards_filters_set`](/reference/mcp/guards#set-model-connection-filters) · [`dome_tool_guards_filters_set`](/reference/mcp/guards#set-tool-connection-filters)</Callout>
  </Tab>

  <Tab title="Agent">
    ```text title="Assign Filter chains" theme={"system"}
    Assign Filters "pii-redact" and "secrets-block" in that order to the response direction on model connection "claude-prod".
    ```
  </Tab>
</Tabs>

### Configure the streaming window

Configure how much streamed model output the gateway buffers before applying response Filters. Layering rules are on the [Guards](/concepts/controls/guards#streaming-model-responses) concept and [streaming window](/reference/controls/guards#streaming-window) reference.

<Callout icon="key">Requires `config.manage` for the workspace floor. Per-connection windows require `gateway.manage`. Per-request overrides are set by the calling agent in the request body.</Callout>

In the dashboard, set the workspace floor under **Settings → Config**. From the API:

```http theme={"system"}
POST /dome.mgmt.v1.Management/UpdateWorkspaceLLMFilterWindow
Content-Type: application/json

{
  "tenant_id": "<tenant-uuid>",
  "workspace_id": "<workspace-uuid>",
  "llm_filter_window_bytes": 4096,
  "llm_filter_window_tokens": 1024
}
```

<Callout icon="code">Reference: [`UpdateWorkspaceLLMFilterWindow`](/api/management/update-workspace-llm-filter-window)</Callout>

Agents can request a wider buffer for a single call by adding a `_dome` block to the OpenAI- or Anthropic-shaped body:

```json theme={"system"}
{
  "model": "production",
  "messages": [{"role": "user", "content": "Summarize the notes."}],
  "_dome": {"filter_window_bytes": 8192, "filter_window_tokens": 64}
}
```

The override is validated against the same bounds the workspace floor uses and is invisible to the upstream provider. Refer to [Models](/connect/resources/models) for the per-connection flags.

## Next steps

* [Guards](/concepts/controls/guards) concept for how content inspection works
* [Guards](/reference/controls/guards) reference for Filter kinds, actions, path syntax, and streaming layers
* [Connect Tools](/connect/resources/tools) to add tool connections
* [Models](/connect/resources/models) to set per-connection filter windows
* [Authorize Access](/govern/rules) when a call should be allowed or denied before Guards run
* [Architecture](/concepts/architecture#guards) concept for where Guards sit in the request path
