CClawMetryDocs

Guard & governance

Enforcement proxy#

Observation does not need it. Enforcement of spend, in the moment, does.

bash
clawmetry proxy start --daily-budget 25 --monthly-budget 400

The proxy listens on port 4100 by default and sits in front of your model calls.

What it can do that nothing else can#

Block a call before it costs anything. A budget alert tells you afterwards. A detector tells you after a window of events. The proxy is the only place where a limit is a limit.

See a loop in flight. Repeated identical calls are visible at the request level immediately, rather than after enough events have accumulated for the transcript-based detectors to see the shape.

Route by model. Send a call to a cheaper model rather than refusing it, which keeps the agent working instead of failing.

Make an OpenClaw pause real. OpenClaw has no pause primitive; ClawMetry's pause is a flag file that only the proxy enforces. With no proxy, a paused OpenClaw session keeps running and Guard reports advisory_only.

Budget actions#

bash
clawmetry proxy config --daily-budget 50 --action warn
ActionAt the limit
warnThe call goes through; it is recorded and surfaced
blockThe call is refused
downgradeThe call is routed to a cheaper model

Start with warn until you trust the numbers. downgrade is usually the right production setting: the work continues, more cheaply, and the dashboard tells you it happened. block is for the case where an over-budget agent should genuinely stop.

Configuration#

bash
clawmetry proxy status --json
clawmetry proxy config --loop-detection on
clawmetry proxy stop
VariableEffect
CLAWMETRY_PROXY_DAILY_USDDaily budget
CLAWMETRY_PROXY_MONTHLY_USDMonthly budget
CLAWMETRY_PROXY_AUTO_ROUTEAutomatic model routing
CLAWMETRY_HARD_BLOCKHard block behaviour
CLAWMETRY_HARD_BLOCK_ESCAPEThe escape hatch for a hard block

Pointing agents at it#

The proxy is an HTTP proxy for provider endpoints. Configure the runtime's base URL to point at it — the same override you would use for any gateway. The mechanism differs per runtime and per SDK; the concept does not.

Proxy versus detectors#

They catch different shapes and you want both:

ProxyDetectors
SeesIndividual requests, in flightWindows of events, after the fact
CatchesTight identical loops, budget breachesNo-progress, repeated tool failures, blast radius, egress
ActsImmediately, before the spendThrough a policy
RequiresRouting traffic through itNothing

A tight loop costs money fast and the proxy stops it early. A session that is busy but going nowhere never trips a request-level rule at all, and only a window of events reveals it.

When you do not need it#

If your agents are on providers you cannot easily reroute, or you are happy with alerting rather than blocking, skip it. Everything else in ClawMetry works without it. The one thing you lose besides hard limits is a real OpenClaw pause.

Logging#

bash
clawmetry proxy start --log-requests

Logs every proxied request. Useful when setting it up and verifying that traffic is actually flowing through it — a proxy nothing routes to is a very quiet failure.

Cookie preferences