Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill regression-watch -a claude-code
Open on GitHub

What 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 90 and 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-code

2Manually: put the files in place

~/.claude/skills/regression-watch/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/regression-watch/

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

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set20

time-of-day Sorts sessions and events into hour-of-day and day-of-week bins, then marks peak and low-output windows. Useful when you plan a work schedule. CX Codex +1 ★ 1,114repo stars daily-standup Turns your recent Claude sessions into a standup report: work done per project, errors hit, what it cost. CX Codex +1 ★ 1,114repo stars history-portability Pulls in Claude or Claude history and shifts whole CCAM datasets between machines. Useful when you switch laptops or need a restore. CX Codex +1 ★ 1,114repo stars remote-collection A skill that walks the agent through CCAM remote data sources: connect machines over SSH and pull Claude and Codex history. Useful when sessions live beyond your laptop. CX Codex +1 ★ 1,114repo stars benchmark The benchmark skill takes one session or a few recent ones and compares them with the rolling average from Agent Monitor data: cost, tokens, tool count and workflow complexity. Each metric comes back as a percentile of the population. CX Codex +1 ★ 1,114repo stars session-debug Pulls a single Claude session out of Agent Monitor and reports its event chain, subagent tree, token spend and failures. CX Codex +1 ★ 1,114repo stars event-trace Turns one Claude session into an ordered timeline of its events, flagging gaps, failures and tool calls that never finished. CX Codex +1 ★ 1,114repo stars live-watch Polls the Agent Monitor /api/stats endpoint a few times in a row and reports how the counters shift across that window. Useful when you want motion, not a single snapshot. CX Codex +1 ★ 1,114repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor