Skip to content
Agent Workspaces
Command

/anomalies

List current cost and token outlier sessions via z-score

From plugin
claude-code-agent-monitor
1.2k33 skills21 agents33 commands1 MCP
> /plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor

Command definition

anomalies.md
description: List current cost and token outlier sessions via z-score
argument-hint: "[threshold]"

List the current cost/token **outlier** sessions from the Agent Monitor dashboard using a z-score test. **$ARGUMENTS** optionally sets the z-score threshold (default `2.0`; lower = stricter).

1. Fetch the population:

  • `curl -s "http://localhost:4820/api/sessions?limit=200"` → a session list; each item has `id`, `status`, `model`, `cwd`, `started_at`, `cost`, and `metadata`.

2. Compute the baseline over all returned sessions:

  • Mean and standard deviation of `cost`.
  • For sessions where you need token totals, pull `curl -s http://localhost:4820/api/pricing/cost/<id>` and sum `input_tokens + output_tokens + cache_read_tokens + cache_write_tokens`; compute mean and stddev of total tokens too.

3. Flag outliers: any session whose `z = (value − mean) / stddev` exceeds the threshold (default 2.0) on cost (primary) or tokens (secondary). Skip the calc gracefully if stddev is 0.

4. Print the flagged sessions, sorted by descending cost z-score:

  • Session id (short), model, started_at.
  • Cost (USD, 4 decimals) and its z-score.
  • Total tokens and its z-score (when fetched).
  • A flag tag: 🔴 if z > 3, 🟡 if z > 2.

Output rules: a Markdown table of flagged sessions only; currency in USD to 4 decimals; z-scores to 2 decimals; if nothing exceeds the threshold, say "No cost/token outliers above z=<threshold>" and report the top session by cost for context. Cite only API values — never fabricate. If the dashboard is unreachable at `http://localhost:4820`, tell the user to start it with `npm start` from the repo root.

Read more
@hoangsonww
Ships withclaude-code-agent-monitor

🚀 A real-time monitoring dashboard for Claude Code & Codex, built with SQLite3, Node.js, Express, React, Vite, TailwindCSS, & WebSockets. It tracks sessions, agent activity, tool usage, and subagent orchestration, providing live analytics, a Kanban status board, status notifications, a cute buddy, & an interactive web UI/MacOS/Windows native app.

1.2k75 skills21 agents1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
1.2k
Star history of hoangsonww/Claude-Code-Agent-Monitor on GitHub, a chart by star-history.com

Other commands on claude-code-agent-monitor.

More commands from other plugins.

configure

configure

Command

Configure HUD display options (layout, language, presets, display elements) while preserving advanced manual overrides

@jarrodwatts@jarrodwattsInstall Command
superset-automation
Auto-invoked

superset-automation

Command

Manage a single Paradev automation: edit its prompt in $EDITOR, view recent runs, or trigger a one-off run.

paradev3d16k
@superset-sh@superset-shInstall Command