Setup commands

DefenseClaw setup and configuration surfaces in one place — from the central guardrail wizard to keys, webhooks, registries, observability, legacy sandbox cleanup, and per-connector hooks.

defenseclaw setup is the main family of operator commands that takes DefenseClaw from "binary on disk" to "actively defending an agent". Mutating commands update only the configuration or owned integration surface they manage; restart, prompting, and audit behavior is command-specific. The top-level keys, registry, and sandbox groups are included here because they are part of the same operator workflow.

The one-line summary

Run defenseclaw setup guardrail once. Reach for the auxiliary surfaces when you want to wire a chat notifier, registry, observability destination, or custom LLM key into a guardrail that is already running.

The central command

defenseclaw setup guardrail

The wizard. Picks the connector, observe or action mode, hook fail mode, scanner backend, optional LLM judge and HITL severity, then restarts the gateway.

Connector setup aliases

Each alias selects one connector and exposes a smaller connector-oriented option surface than setup guardrail. Pass --mode observe to run one in audit-only mode. On a host with another hook connector already active, the setup flow can add the new connector to the roster instead of replacing the old one. Use the central command when you need the complete guardrail flag surface.

Proxy connectors

Auxiliary configuration commands

These commands each own a focused slice of the configuration surface. Some are top-level command groups rather than setup subcommands; the matrix below shows which ones are interactive and which ones are designed for scripts.

defenseclaw keys

Stash DEFENSECLAW_LLM_KEY (and any per-component overrides) in ~/.defenseclaw/.env. Top-level group: list, set, remove, fill-missing, check. Not a setup subcommand.

setup routing

Route OpenAI Chat Completions traffic between configured model backends with the managed vLLM Semantic Router sidecar. Proxy connectors only.

setup webhook

Add Slack, PagerDuty, Webex, or generic HMAC notifiers for high-severity alerts. Test deliveries, list, enable/disable, remove.

defenseclaw registry

Subscribe to public or internal skill / MCP catalogs (clawhub, smithery, skills_sh, http_yaml, http_json, git, file). Sync, scan, promote into asset_policy.

setup splunk

Configure local Splunk, Splunk Enterprise HEC, or Splunk Observability Cloud. V8 exports use the selected routes and redaction profile; review the unredacted fresh default.

setup local-observability

Bring up the bundled OTLP collector + Grafana stack so you can see decisions live without leaving your laptop.

setup redaction

Guided v8 policy editor with a simple remove-all choice plus advanced global, bucket, profile, destination, and ordered-route settings.

setup skill-scanner

Choose the cisco-ai-skill-scanner analyzers, scan policy and optional LLM, VirusTotal and Cisco AI Defense checks.

setup mcp-scanner

Choose the cisco-ai-mcp-scanner analyzers and whether scans also cover MCP prompts, resources and instructions.

defenseclaw sandbox legacy-cleanup

Linux-only removal of the retired standalone OpenShell sandbox (openshell-sandbox 0.0.x). Restores host OpenClaw networking, ownership, and config.

OpenShell sandbox

defenseclaw sandbox setup prepares a Linux machine or an Apple-silicon Mac to run Claude Code and Codex inside NVIDIA OpenShell 0.1 sandboxes, and defenseclaw sandbox run claude starts one on the current project folder. On a Mac, sandboxes are OpenShell MicroVMs and every run works on a copy (see macOS). The same setup is the Sandboxes (OpenShell) wizard in the TUI's Setup and the Sandbox wizard in the macOS app; the TUI Sandboxes panel (key 7) shows live activity. Run defenseclaw sandbox --help for every command. defenseclaw sandbox legacy-cleanup removes the retired openshell-sandbox 0.0.x install from Linux hosts. The sandbox guide covers setup, runs and legacy cleanup.

Deployment and policy references

These pages explain operator policy and deployment architecture in more depth than the command cards above.

Interactive vs non-interactive

The operator commands do not all share one interaction model. This table lists the interactive and scripted form of each.

CommandInteractiveNon-interactiveNotes
inityes, on a TTY--non-interactive --yes + per-option flagsGuided first run. --fail-mode, --observe-all and --action-connectors cover the choices it asks about.
quickstartnoalwaysZero-prompt first run by design; use init for the wizard.
setup guardrailyes (default)--non-interactive + flagsMissing flags fall back to the wizard defaults. Hook fail mode and judge fallback models have no flag here; see Prompt-flag mapping.
setup <connector>yesflags + --yesAdds or reconfigures a connector. With other connectors configured the default, also under --yes, is to add; --replace switches. With --mode, a TTY run does not ask for the mode again.
setup routingno--enable, --disable or --statusRequires Docker. Applies only to proxy-mode OpenAI Chat Completions traffic.
keys sethidden prompt when no value is given--value-stdin (or --value, which is visible in ps)See Unified LLM key.
keys fill-missingyes--yes skips the opening confirmationPrompts for every required key that is not set.
keys list / keys checknoalwayskeys check exits non-zero when a required key is missing.
keys removeasks to confirm--yesSee Keys.
setup webhook add <type>yes (default)--non-interactive + flagsURL and secret env are prompt-or-flag; the type is always positional.
setup webhook test <name>noalwaysSafe to re-run; --dry-run formats without delivering.
registry add <id>yes (default)--non-interactive + flagsregistry wizard is the first-run add-and-sync flow.
registry sync / entries / approve / rejectnoflags onlyDesigned for cron and scripts.
setup splunkyes, when no mode flag is given--non-interactive + --logs, --enterprise or --o11yThe HEC token comes from --hec-token or the DEFENSECLAW_SETUP_SPLUNK_HEC_TOKEN env var; the env var keeps it out of ps.
setup local-observabilitynosubcommandsup is the default; down stops the stack and keeps its data; reset also deletes the data. status, logs, url and env read state.
setup redactionyes (bare command)subcommands + flagsThe simple flow leads into Show advanced settings? for buckets, profiles, destinations and routes.
setup skill-scanner / setup mcp-scanneryes--non-interactive + flagsThe skill scanner SDK is a hard dependency; the MCP scanner SDK is installed on Python 3.11 and newer.
sandbox setupyes (default)--non-interactive, or --yes to take every defaultOne-time setup for OpenShell sandboxes on Linux, or on a Mac with Apple silicon. See the sandbox guide.
sandbox legacy-cleanupyes (prints the plan, then asks once)--yes; --dry-run prints the plan onlyLinux-only removal of the retired standalone sandbox.
doctoronly with --fix--fix --yesA plain run is read-only and never prompts.
alertsno--limit, --connector, --show <n>, --json; acknowledge / dismiss subcommandsA snapshot of recent alerts, not a live tail.
tuifull-screen dashboardnoneInteractive only.
defenseclaw-gatewayno--host, --portRun bare for the foreground daemon; start, stop and restart manage the background daemon. setup guardrail --restart restarts it for you.

Redaction is its own workflow

defenseclaw setup redaction edits the v8 bucket, profile, destination and route policy for telemetry. See Redaction for the interactive and scripted workflow, which is also in TUI → 0 Setup → Guardrail & scanning → Redaction and in the macOS app under Logs → Redaction policy….

See it for yourself

The interactive flow for the central command is replayed end-to-end on the Setup guardrail page. Interactive auxiliary commands follow the same prompt-or-flag rhythm; use the matrix above for script-only commands.

What gets written where

Setup and auxiliary configuration commands write files under ~/.defenseclaw/, depending on the feature being configured, including:

~/.defenseclaw/
  config.yaml             # canonical configuration (edited by commands that own config)
  .env                    # secret values: never committed, never logged
  audit.db                # SQLite audit store (configuration changes land here too)
  picked_connector        # last connector picked by install.sh or connector setup
  custom-providers.json   # custom LLM providers (setup provider add)
  hooks/                  # connector hook scripts, written when the gateway starts
  policies/               # rule packs and admission policies
  registries/<id>/        # cached manifest + scanner verdicts for each registry source
  semantic-router/        # generated router config (setup routing)
  gateway.jsonl           # optional: only when an explicit kind: jsonl destination uses this path

The list covers the common files, not every one. See Configuration for the full layout.

Next steps: defenseclaw setup guardrail is the right starting point if you have not run it yet. Already running? defenseclaw keys set DEFENSECLAW_LLM_KEY is the most common follow-up — it unlocks the LLM judge and the LLM-backed scanners. The full guided workflow lives at Unified LLM key.