Skip to content
Cisco AI Defense logo
CiscoAI Security

Developer overview — DefenseClaw

Overview

This section is for contributors and integrators. If you're running DefenseClaw to protect agents, start with Install methods. If you're building DefenseClaw — adding scanners, adapting the gateway, or changing the OpenClaw plugin — you're in the right place.

Two languages, three processes

DefenseClaw is split between Python and Go by design. Each language owns what it does best:

LanguageRoleWhere
Python (Click)Operator CLI, human-facing UX, scanner SDKs (skill, MCP)cli/defenseclaw/
GoGateway sidecar, guardrail proxy, audit store, OPA host, sandbox supervisor, TUIinternal/ and cmd/
Node.js/TSOpenClaw plugin that forwards LLM traffic to the guardrailextensions/defenseclaw/

Section map

PageWhat it's for
ArchitectureProcess topology, data flow, boundaries
Package tourEvery top-level package with 1-line purpose
Inspection pipelineHow a request flows through the guardrail
Bifrost provider adapterHow the gateway delegates LLM provider calls to Bifrost
Plugin protocolHow the OpenClaw plugin and the guardrail communicate
RPC contractStable JSON-RPC methods and their invariants
Telemetry contractSpan names, metric names, attribute keys
TestingTest suites, harnesses, conventions
BuildingLocal dev loop, cross-compile, release builds
ReleaseVersioning, changelog, tag flow
ContributingCoding standards, review expectations, CI gates

Contracts you should not break

If you're touching DefenseClaw, memorize these boundaries:

  1. REST sidecar and proxy routes — stable once documented; see Endpoints.
  2. OpenClaw gateway WebSocket methods — stable; see RPC contract.
  3. Span and metric names — stable; see Telemetry contract.
  4. Audit event schema — stable; additions are allowed, removals and type changes are not.
  5. Exit codes — stable; see Exit codes.
  6. Plugin protocol — versioned; bump the protocol version before shipping incompatible changes.
  7. Rule-pack YAML schema — versioned via schema_version; bump on any breaking change.

The repo layout at a glance

.
├── cli/defenseclaw/            # Python operator CLI
├── cmd/                        # Go entrypoints (gateway, docgen)
├── internal/                   # Go private packages (gateway, tui, ...)
├── extensions/defenseclaw/     # Node.js OpenClaw plugin
├── policies/                   # Rego modules + default rule packs
├── scripts/                    # installers, docgen, verification, E2E helpers
├── test/                       # E2E data, fixtures, unit helpers
└── docs-site/                  # This documentation

Where to start

  • Fixing a bug — open an issue, add a failing test, fix it, make test. See Contributing.
  • Adding a scanner — see Custom scanners for the runtime contract and the Add a custom scanner cookbook for packaging.
  • Extending the API — see REST endpoints and RPC contract first; additions to /v1 are welcome when documented and tested.
  • Shipping a release — see Release. Changelog and version bump are required before tagging.