regression-watch — Claude Code skill: catch metric regressions
Compares an older baseline window of session history with a recent one and reports which metrics got worse: errors, cache, compactions, cost per session.
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill regression-watch -a claude-codeWhat regression-watch does
The skill pulls Agent Monitor data and splits your history into two windows: an older baseline and a newer recent one. Defaults are the last 30 days for recent and the 30–90 day range before it for baseline. Then it measures four things in each window and flags what moved in the wrong direction.
Those four: error share (APIError against total events), cache hit rate as total_cache_read / (total_cache_read + total_input), compactions per session, and cost per session. A dropping hit rate means more uncached input tokens, so the bill goes up. More compactions per session means context overflows more often.
You get a Markdown table with metric, baseline, recent, delta, direction and verdict. Each metric is tagged 🔴, 🟡 or 🟢, money in USD to four decimals, rates to two. The report names the session IDs behind the worst movement and closes with the single regression to fix first plus a next step. It is read-only — it reports what the API returns and never invents a baseline. Without Agent Monitor running and answering its endpoints, there is nothing to compute.
Leave the argument empty to check everything, or narrow it to errors, cache, compaction, cost. Window sizes go in as last 30d or 30 vs 90.
What it helps with
- see whether the API error share is climbing week over week
- catch a falling cache hit rate before the bill grows
- spot sessions that started compacting more often
- compare cost per session against an earlier period
- pin down which sessions drag the metrics down
Example prompts for the agent
- Check all regression metrics for the last 30 days
- Compare windows
30 vs 90and tell me what got worse - Run the cache regression and name the sessions behind it
How to install regression-watch
1Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill regression-watch -a claude-code2Manually: put the files in place
~/.claude/skills/regression-watch/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/regression-watch/
1Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill regression-watch -a codex2Manually: put the files in place
.agents/skills/regression-watch/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill regression-watch -a cursor2Manually: put the files in place
.cursor/skills/regression-watch/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install hoangsonww/Claude-Code-Agent-Monitor regression-watch2Manually: put the files in place
.github/skills/regression-watch/SKILL.md1Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill regression-watch -a gemini-cli2Platform CLI
gemini skills install https://github.com/hoangsonww/Claude-Code-Agent-Monitor --path plugins/ccam-insights/skills/regression-watchManually: put the files in place
.devin/skills/regression-watch/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill regression-watch -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about regression-watch
How do I install regression-watch in Claude Code?
Run npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill regression-watch -a claude-code. The skill lands at ~/.claude/skills/regression-watch/SKILL.md.
What does regression-watch do?
It compares a baseline window of session history with a recent one and reports which metrics worsened: error rate, cache hit rate, compaction frequency, cost per session. It ends with the top regression and a next step.
What arguments does the skill take?
Empty or all checks every metric; errors, cache, compaction and cost narrow it to one. Windows are set as last 30d or 30 vs 90.
Source text
SKILL.md · MIT
---
name: regression-watch
description: >
Detect quality and efficiency regressions over time using Agent Monitor data —
rising error rate (APIError events), falling cache hit rate, growing compaction
frequency, and climbing cost-per-session. Splits history into an earlier
baseline window and a recent window and reports which metrics are getting
worse, by how much, and where. Use when checking whether things are degrading
or trending in the wrong direction.
---
# Regression Watch
Detect whether Claude Code sessions are getting worse over time across quality and
efficiency metrics, using Agent Monitor data.
## Input
The user provides: **$ARGUMENTS**
This may be:
- empty or "all" — check every regression metric (default)
- "errors" — error-rate regression only
- "cache" — cache hit-rate regression only
- "compaction" — compaction-frequency regression only
- "cost" — cost-per-session regression only
- A window like "last 30d" or "30 vs 90" — set the recent vs baseline window sizes
## Data Sources
| Endpoint | Returns |
|----------|---------|
| `GET /api/analytics` | `daily_events` (365d), `daily_sessions` (365d), `event_types`, `tokens` (total_input, total_output, total_cache_read, total_cache_write — baselines pre-summed), `avg_events_per_session` |
| `GET /api/events?session_id=X` | Event stream incl. `APIError`, `Compaction`, `PreToolUse`/`PostToolUse` — used to localize regressions to specific sessions |
| `GET /api/pricing/cost` | `{ total_cost, breakdown[...] }` — total cost to derive cost-per-session |
| `GET /api/pricing/cost/{sessionId}` | Per-session cost — used to compare recent vs baseline session cost |
| `GET /api/workflows/{sessionId}` | `compaction` (impact), `errorPropagation` (by depth), `effectiveness` — per-session quality signals |
| `GET /api/sessions?limit=N` | Sessions with `started_at`, `cost`, `metadata` — to bucket sessions into time windows |
## Report Sections
### 1. Windowing
Split history into a **baseline window** (older) and a **recent window** (newer).
Default: recent = last 30 days, baseline = the 30–90 day range before it. Use
`daily_events`/`daily_sessions` for series metrics and `GET /api/sessions?limit=N`
to assign sessions to each window by `started_at`.
### 2. Error Rate Regression
- Recent error rate = `APIError count / total events` in the recent window
(from `event_types` and `daily_events`, or per-session `GET /api/events`).
- Compare to the baseline rate. Flag if recent is higher.
- Report the absolute and relative change and which sessions contributed most
`APIError` events.
### 3. Cache Hit Rate Regression
- Cache hit rate = `total_cache_read / (total_cache_read + total_input)`.
- Compute for each window (per-window input/cache_read from session metadata or
the pricing breakdown). Flag a **falling** hit rate — that means more
uncached input tokens and higher cost.
### 4. Compaction Frequency Regression
- Compaction frequency = `Compaction events / session` per window (from
`event_types` / `daily_events`, confirmed via per-session
`GET /api/workflows/{id}` `compaction`). Flag a **rising** rate — context is
overflowing more often.
### 5. Cost-per-Session Regression
- Cost-per-session = window total cost / window session count, using
`GET /api/pricing/cost` overall and `GET /api/pricing/cost/{id}` for the
sessions in each window. Flag a **climbing** value.
### 6. Verdict
Roll up which metrics regressed, rank by relative worsening, and name the most
likely driver (e.g., cache hit rate fell → cost per session climbed).
## Output
- A Markdown table: metric | baseline | recent | Δ | direction (▲ worse / ▼ better) | verdict.
- Tag each regressed metric 🔴 (clear regression), 🟡 (mild/within noise), or 🟢 (improved).
- Currency in USD to 4 decimals; rates as percentages to 2 decimals.
- List the specific session IDs that contributed most to any regression.
- End with the single highest-priority regression to address and a concrete next step.
- Read-only: only report what the API returns; never fabricate baselines.
© hoangsonww · MIT · hoangsonww/Claude-Code-Agent-Monitor