Internal SmartGift build of a Claude Code monitoring dashboard. Lanes: a durable unit of parallel agent work, one per working directory, tracked across session restarts. Managed lanes are git worktrees the dashboard provisions and can reset or remove behind a three-check destroy guard and a counted preflight; adopted lanes are directories you already own and are never destroyable. Pipelines: a lane moves through pipeline stages. A stage the agent declares with evidence renders green; a stage inferred from the tool-event stream renders dashed amber and never counts as done. Detection is forward-only within a 30-minute window, and never writes the declared stage. Workspace: one page at /run with a lane grid, the selected lane's pipeline, and a full Claude console behind a disclosure.
1.6 KiB
description, argument-hint
| description | argument-hint |
|---|---|
| List current cost and token outlier sessions via z-score | [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).
-
Fetch the population:
curl -s "http://localhost:4820/api/sessions?limit=200"→ a session list; each item hasid,status,model,cwd,started_at,cost, andmetadata.
-
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 suminput_tokens + output_tokens + cache_read_tokens + cache_write_tokens; compute mean and stddev of total tokens too.
- Mean and standard deviation of
-
Flag outliers: any session whose
z = (value − mean) / stddevexceeds the threshold (default 2.0) on cost (primary) or tokens (secondary). Skip the calc gracefully if stddev is 0. -
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=" 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.