Edge Connector architecture
Learn how the Edge Connector evaluates calls: local checks, verdict caching, Fleet escalation over MQTT, HMAC-chained audit trail and OTA policy updates.
Preview. This page describes the Edge Connector, a Preview feature.
System overview
List view for small screens. Use the expand button to open the drawing.
- AI agentPicoClaw, LangChain, …
- tool call + contentIntegration layer
- Integration layeradapter, hook or MCP proxy
- asks (socket, FFI)Edge Connector engine
- Edge Connector enginelibdclaw_core.so5 local checks + cache
- records each decisionAudit ring
- MQTT over TLSMQTT broker
- MQTT brokerTLS, per-device ACLs
- verdicts, updatesFleet gateway
- MQTT over TLSEdge Connector engine
- Audit ringHMAC-chained, on flash
- Fleet gatewayverdict cache, policy push
- verdicts, updatesMQTT broker
Text version of this diagram
- AI agent: PicoClaw, LangChain, … (agent)
- tool call + content to Integration layer
- Integration layer: adapter, hook or MCP proxy (connector)
- asks (socket, FFI) to Edge Connector engine
- Edge Connector engine: libdclaw_core.so, 5 local checks + cache (policy layer)
- records each decision to Audit ring
- MQTT over TLS both ways with MQTT broker
- MQTT broker: TLS, per-device ACLs (component). Used only when local policy cannot decide, and to deliver policy updates.
- verdicts, updates both ways with Fleet gateway
- Audit ring: HMAC-chained, on flash (data store)
- Fleet gateway: verdict cache, policy push (gateway)
The integration layer maps tool_name to a capability, extracts the destination and content, sets the direction (request or response) and calls the engine over the Unix socket or the shared library. The engine returns ALLOW, BLOCK, WARN or PENDING.
Evaluation pipeline
Checks 1 to 5 are local and stop at the first block. Checks 6 and 7 decide what the local checks leave open.
Stage 1 — Input validation
Rejects malformed requests at the IPC boundary (IPC schema).
- The request needs
tool_name, its 64-character SHA-256tool_hash,capabilitiesandsession_id.destinationis optional on the wire, but local policy requires it for network capabilities. - The engine checks that the hash matches the name, and replaces the caller's capabilities with its reviewed C mapping.
- An unknown tool name is blocked before the verdict cache or a Fleet request. A custom tool name needs a reviewed C capability mapping; a Python adapter mapping alone does not authorize it.
Stage 2 — Rate limiting
Three independent token buckets, each refilled per minute. The limits are fixed in the build; policy cannot change them.
| Bucket | Default | Controls |
|---|---|---|
| Tool calls | 60/min | All tool invocations |
| Network requests | 30/min | NET_FETCH and SEND_MSG capabilities |
| Actuations | 10/min | ACTUATE capability (physical world) |
When a bucket is empty, the verdict is BLOCK with reason RATE_LIMIT.
Stage 3 — Content scanning
When the request has a content field, the scanner runs built-in DFA and structural checks on it:
| Category | Detects |
|---|---|
secrets | API keys, tokens, private keys, passwords |
pii | SSN, credit cards, email addresses, phone numbers |
credentials | AWS keys, GCP service accounts, database connection URIs |
exfiltration | Base64-encoded blobs, hex dumps, data URI payloads |
injection | Prompt injection, jailbreak attempts, system prompt overrides |
commands | Shell commands, SQL statements, code execution patterns |
- A finding at or above the built-in severity threshold blocks at once.
- A scanner
WARNdoes not change the final verdict; the request goes on to the next checks. - The
directionfield selects the content scope and severity threshold. The structural exfiltration check applies to request and user-input scope. The keyword patterns run in both directions. - The patterns are fixed in the build. OTA policy cannot configure them.
The C path has no local tool-hash deny list. The Fleet gateway checks tool hashes it receives over MQTT and blocks unknown hashes by default.
Stage 4 — Destination filtering + SSRF validation
For network capabilities the engine requires a destination, runs the SSRF checks first, then matches the compiled allowlist.
- Hostname destinations are blocked on every build profile.
- Only canonical public IPv4 or globally scoped IPv6 literals can reach the allowlist. Write an IPv6 entry without brackets; the policy compiler refuses a bracketed one. This parsing does not prove an address is routable.
- Private and link-local addresses, numeric aliases (octal, hex or decimal forms) and malformed ports are blocked.
- An unlisted destination is blocked with reason
DEST_DENY. There is nodestination_denylist.
The built-in SSRF check blocks:
- private ranges (
10.x,172.16–31.x,192.168.x,127.x); - cloud metadata endpoints (
169.254.169.254,metadata.google.internal); - link-local addresses (
fe80::/10).
Stage 5 — Sequence correlation
A finite state machine tracks capability calls per session. When a configured dangerous sequence completes, for example net_fetch then exec_shell, the verdict is BLOCK with reason CAP_SEQUENCE. The policy compiler builds the tables from the policy's capability_sequences (Capability sequences).
Stage 6 — Verdict cache
An in-memory LRU cache holds Fleet verdicts, keyed by the 32-byte tool hash alone. A cache hit saves a Fleet request; the local checks above have already run.
- The Fleet verdict carries a TTL in minutes. Zero removes any earlier entry for the tool and is not cached.
- The device caps the TTL at 60 minutes for
ALLOW, seven days forBLOCKand four hours forWARN. - Entries expire on the monotonic clock, not wall-clock time. Policy YAML cannot set these TTLs.
Stage 7 — Fleet escalation
When local policy cannot decide, the device sends a verdict request to the Fleet gateway over MQTT 3.1.1. The request carries:
- the tool hash, a shortened tool name, the capability and the destination;
- a truncated content snippet (up to
DCLAW_ESCALATION_PAYLOAD_MAX); - session risk and capability metadata, and request nonces.
The gateway decides by tool hash through its verdict cache. It does not send the snippet or destination to a separate model, and it blocks unknown hashes by default. The findings wire field is a zero placeholder.
| Mode | While waiting | On timeout or publish failure |
|---|---|---|
sync_block | The call is blocked until a verdict arrives. | Stays blocked. |
speculative | The call can run at once. | Already ran; a later BLOCK cannot undo it. |
Choose the mode by the consequence of the tool call (capability mapping).
Audit trail
An HMAC-chained ring in flash records compact decisions. Each entry holds:
- a monotonic tick timestamp, the session ID and a 32-bit prefix of the tool hash;
- the action and reason;
- a 16-byte HMAC tag chained to the entry before it.
The ring does not store full tool names, capabilities or content findings. The chain detects changes within the retained history. Non-BLOCK entries are buffered to save flash writes. BLOCK entries are written at once, and kept in RAM for a retry when a write fails and space remains.
Cloud components
The fleet management and verdict cache run as Go services alongside the main DefenseClaw gateway:
| Component | Path | Description |
|---|---|---|
| Fleet Manager | internal/fleet/manager/ | Device registry, heartbeat, anomaly detection |
| Verdict Cache | internal/fleet/verdict/ | LRU verdict cache with TTL |
| REST API | internal/fleet/api.go | /api/v1/fleet/ endpoints |
| Metrics | internal/fleet/metrics.go | Prometheus metrics for fleet health |
OTA policy updates
Policy updates arrive over MQTT. A production build accepts an HMAC-signed update only when built with DCLAW_ALLOW_HMAC_OTA=ON and given a separate HMAC key (DCLAW_OTA_HMAC_KEY).
| Protection | What it does |
|---|---|
| HMAC-SHA256 signature | Every update is signed. |
| Anti-rollback | A monotonic version counter refuses a downgrade. |
| Local canary window | Each device watches its block rate for ten minutes and can restore its previous policy after a sustained spike (Canary deployment). |
| Replay protection | A duplicate or out-of-order update is refused. |