claw-lens is a local dashboard for OpenClaw agents that combines cost analytics, session inspection, a profiler, cache-trace replay, and a security audit. It is built around the idea that for agent operators, cost rather than latency is the dominant signal, the session rather than the request is the atomic unit, and the failures that matter most (an agent reading files it should not, leaking a credential, or executing injected instructions) never throw exceptions.
It runs entirely on your machine. A Node.js 18+ server reads the files OpenClaw already writes under ~/.openclaw/ (session JSONL, cache traces, cron configs, agent memory), parses session logs into SQLite, and serves an Express API to a React frontend on localhost:4242. The server binds to 127.0.0.1, makes no outbound HTTP calls, sends no telemetry, and writes only its own claw-lens.db; the one network connection is a WebSocket to your local OpenClaw Gateway for the live feed.
Security auditing is rule-based rather than ML: every tool call is risk-scored at ingestion with deterministic rules, and per-agent behavioural baselines over 30 days flag anomalies. The interface is available in English and Chinese.
Features
- Overview: KPI strip (cost today, tokens, sessions, errors, cache efficiency), 7-day trend, week-over-week delta, and model cost breakdown
- Token usage: input, output, cache-read, and cache-write costs by agent, model, and period, with cache hit rate and cron-versus-manual comparison
- Live monitor: real-time agent activity via a WebSocket proxy to the OpenClaw Gateway
- Sessions: filterable session table with a context-health indicator and full tool-call trace per session
- Audit: security event timeline with high/medium/low risk scoring for file access, shell commands, external HTTP calls, sensitive-data exposure (34 regex patterns), and prompt-injection detection (9 patterns)
- Session timeline and profiler: turn-by-turn message trace with token counts and stop reasons; session rankings by token use and tool timing
- Deep turns: detection of long turn sequences with repetitive tool patterns and unique-ratio scoring
- Context breakdown: per-turn context-window fill with system, history, and tool-result splits against a model-accurate capacity gauge
- Cache trace: step-through replay of OpenClaw's cache trace logs showing stage progression and digest changes
- Cron and memory: scheduled task list with run history and cost, plus a viewer for agent workspace and memory files
- Zero configuration: npx claw-lens-cli creates the schema, ingests sessions, and opens the browser; OPENCLAW_HOME overrides the data directory
