Event types
Thetype field is one of:
| Type | When it fires |
|---|---|
decision | Reasoning step, user prompt, agent finishing a turn. Anything that isn’t a tool execution or transaction. |
action | A tool call was attempted or completed (PreToolUse / PostToolUse from Claude Code). |
tool | Same as action — legacy label, library mode often uses this. |
tx | An on-chain transaction was signed and submitted. |
reasoning | Free-form thinking trace, often paired with tool calls. |
error | A tool failed, or the agent crashed. |
Event payload
Every event includes:What gets captured at each privacy level
| Field | Minimal | Standard | Full |
|---|---|---|---|
toolExecuted, outcome, durationMs | ✓ | ✓ | ✓ |
tokens, metadata.tokensBreakdown, model | ✓ | ✓ | ✓ |
metadata.sessionId, metadata.traceId, metadata.phase | ✓ | ✓ | ✓ |
reasoning, metadata.detail | ✗ | ✓ scrubbed | ✓ raw |
errorMessage, metadata.response_preview | ✗ | ✓ scrubbed | ✓ raw |
metadata.cwd, metadata.git | ✗ | ✓ | ✓ |
input.prompt, Stop event responseText/thinkingPreview | ✗ | ✓ scrubbed | ✓ raw |
Cost attribution
Voight computes USD cost per event from the token breakdown:- Path A — exact (
metadata.tokensBreakdownfrom SDK 0.3.3+): each token flavour priced at its real rate.cacheReadat 0.10× base input,cacheCreationat 1.25× base,inputBaseat 1.00×,outputat the output rate. - Path B — heuristic (
metadata.tokenswithsource: 'claude-code'): assumes 95% of input iscache_read, applies approximate discount. Used as fallback for older SDK versions. - Path C — flat (library callers): no breakdown, prices
inputandoutputat full rates.
Anomaly detection
A scheduler runs every 5 minutes and computes 4 anomaly rules per agent over the last 7 days:| Rule | Trigger |
|---|---|
event_surge | Events in last hour > 3× the 7-day hourly baseline (autonomous agents only — coding sessions are too bursty) |
error_rate_high | ≥10% failed runs in 1h with ≥5 completed runs |
cost_spike | Today’s spend ≥3× the daily 7-day average AND today’s spend ≥$1 |
orphan_spike | ≥20% orphaned PreToolUse events with no matching PostToolUse, AND ≥2× baseline |
Alert row is created/updated with severity (low / medium / high based on deviation), dedup by <type>|<agentId> fingerprint. Alerts have a full lifecycle: triggeredAt, lastTriggeredAt, acknowledgedAt, snoozedUntil, resolvedAt.
Alert delivery channels (Telegram, email, webhooks) ship in v1.0. Today alerts persist + surface in the dashboard’s Alerts page.
Pre/Post pairing
Each tool call fires two hook events from Claude Code:PreToolUse(before execution) — outcomepending, fingerprintsessionId|toolName|toolInputPostToolUse(after execution) — same fingerprint, withdurationMsandoutcomefilled in
PreToolUse is orphaned for >120s (no matching Post), Voight classifies it as orphanedPre and counts it toward the error rate.