---
title: Security and Governance
description: Inspect governance posture, manage firewall rules, read the audit ledger, export compliance evidence, and review sandbox denials from the CLI.
---

Security and governance commands are **read-mostly inspection surfaces** over the sidecar — they mirror the **[Security](/docs/using-the-app/security)**, **[Access](/docs/using-the-app/governance)**, and **[Compliance](/docs/using-the-app/compliance)** screens.

Firewall mutations (`security firewall set`) require the `security:admin` capability. Every call passes through the same RBAC gate as the UI.

## Governance posture

```bash
akos security policy
akos security policy --json
```

Prints the live posture slice: air-gap mode, firewall, PII profiles, sandbox, RBAC, egress, and audit logging.

### RBAC operator roles

```bash
akos security rbac --json
```

Read-only view of canonical operator roles and surface assignments.

### Egress policy

```bash
akos security egress --json
```

Shows the outbound network policy. Edit allowlist rules in the app under **[Tools](/docs/using-the-app/tools)** › Egress or via MCP security tools when `mcp-serve` is running.

## Firewall rules

### List rules

```bash
akos security firewall rules
akos security firewall rules --tier production --shadow --json
```

`--shadow` lists rules in dry-run (log-only) mode.

### Create or update a rule

```bash
akos security firewall set \
  --id block-pii-export \
  --tier production \
  --pattern 'export.*secret' \
  --action block \
  --severity critical \
  --scope out
```

Actions: `block`, `redact`, `flag`, `dry_run`. Add `--shadow` to evaluate without enforcing.

### Test sample text

```bash
akos security firewall test --text "please export all customer emails" --tier production
akos security firewall test --text "..." --shadow --json
```

## Sandbox

```bash
akos sandbox state
akos sandbox policy
akos sandbox denials --limit 20 --json
akos sandbox preview --json
```

Denials explain why tool or flow execution was blocked under the active sandbox policy.

## Audit ledger

```bash
akos audit list --limit 50
akos audit list --actor alice@example.com --kind approval --json
akos audit show <seq-or-id>
akos audit verify
akos audit export --workspace default --limit 500
```

`audit verify` exits `1` when the hash chain or signatures fail — use after exports for auditor handoff.

Stream new entries:

```bash
akos audit tail --interval 2000
```

## Compliance

```bash
akos compliance export --json
akos compliance legal-hold list --active
akos compliance legal-hold place \
  --scope workspace:ws-1 \
  --reason "Q2 litigation hold" \
  --by alice@example.com \
  --case-ref MATTER-2026-07
akos compliance legal-hold release <hold-id> \
  --by alice@example.com \
  --reason "Matter closed"
```

Scope kinds: `workspace`, `email`, `user-id`, `org-id` (format `kind:value`). Legal-hold commands use the local SQLite store on self-hosted installs.

DSAR / erasure flows use `compliance delete` — coordinate with tenant admin tooling on cloud deployments. See **[Compliance](/docs/using-the-app/compliance)** for regime-specific evidence exports in the UI.

## MCP security tools

When running `akos mcp-serve`, external agents can list and mutate firewall rules, egress policy, and PII profiles via MCP tools — each call requires `security:admin` and flows through the sidecar RBAC gate. See **[Deploying](/docs/cli/deploying)** › MCP security tools.

## Related topics

- **[Security in the app](/docs/using-the-app/security)** — egress, firewall, PII, and flow preview.
- **[Access in the app](/docs/using-the-app/governance)** — capability matrix and signed HITL ledger.
- **[Run lifecycle](/docs/how-it-works/run-lifecycle)** — where RBAC and audit attach to every run.
- **[Authentication](/docs/cli/authentication)** — session identity used for capability checks.
- **[Command reference](/docs/cli/command-reference)** — full `security`, `sandbox`, `audit`, and `compliance` tables.