Skip to main content
skill CX Codex

spend-forecast — Claude Code skill: project your spend to month-end

Turns the daily session trend on the Agent Monitor dashboard into a spend projection for the end of the week or month.

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

What spend-forecast does

The skill reads three Agent Monitor endpoints. GET /api/analytics supplies daily_sessions covering 365 days, GET /api/pricing/cost gives the authoritative total and a per-model breakdown, and GET /api/sessions?limit=200 returns sessions with inline cost and started_at. There is no native per-day spend field, so the skill assembles one: either session counts multiplied by average cost per session, or — sharper — inline costs summed by start date.

From that series it takes a 7-day mean and a 14-day mean, which tells you whether the pace is climbing or easing. The projection is the average daily spend times the days left, plus what the current period has already cost. When the trend window reaches back past the current period, spend-to-date is narrowed to sessions inside that week or month, so older charges don't inflate the number.

Pass "week", "month" or a date as the argument. With nothing passed, the skill uses the calendar month-end and tells you which horizon it picked. Mention a budget and you also get the delta and the date it is projected to be crossed. The math assumes the recent daily pace holds; with fewer than 7 active days the skill flags the horizon as thin on data.

What it helps with

  • project this month's spend from the current daily pace
  • see whether daily spending is accelerating or cooling
  • find the date a budget will be crossed
  • compare 7-day and 14-day average spend
  • build a per-day cost curve from session records

Example prompts for the agent

  • Forecast my spend through the end of the month
  • Where will my spend land by Sunday?
  • My budget is $200 — when do I cross it?

How to install spend-forecast

1Skills CLI (Vercel)

npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill spend-forecast -a claude-code

2Manually: put the files in place

~/.claude/skills/spend-forecast/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/spend-forecast/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about spend-forecast

How do I install spend-forecast in Claude Code?

Run npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill spend-forecast -a claude-code. The skill file lands at ~/.claude/skills/spend-forecast/SKILL.md.

What does spend-forecast do?

It builds a daily spend series from Agent Monitor data and extends it to the close of the week or month. You get a trend table and a projected total.

What does the skill need to run?

Reachable Agent Monitor endpoints: /api/analytics, /api/pricing/cost and /api/sessions. Without them there is no daily series to extrapolate.

Source text

SKILL.md · MIT
---
name: spend-forecast
description: >
  Forecast Claude Code spend to the end of the week or month from the daily
  session trend on the Agent Monitor dashboard — moving average of daily spend
  × days remaining, added to spend-to-date. Uses /api/analytics daily_sessions,
  /api/pricing/cost, and /api/sessions for a per-day cost curve.
  Use when projecting cost or asking "where will my spend land".
---

# Spend Forecast

Project where Claude Code spend will end up by the close of the current week or month.

## Input

The user provides: **$ARGUMENTS**

This is the forecast horizon — `"week"`, `"month"`, or a specific date. Default to
**month** (calendar month-end) when nothing is given, and state the horizon you used.

## Data Sources

| Endpoint | Returns |
|----------|---------|
| `GET /api/analytics` | `{ total_cost, tokens (effective totals, baselines pre-summed), daily_sessions (365d: [{ date, count }]), daily_events, overview, ... }` — `daily_sessions` is the trend the forecast extrapolates |
| `GET /api/pricing/cost` | `{ total_cost, breakdown: [{ model, input_tokens, output_tokens, cache_read_tokens, cache_write_tokens, cost, matched_rule }] }` — authoritative spend-to-date and avg cost-per-session input |
| `GET /api/sessions?limit=200` | Session list with inline `cost` and `started_at` — group by day for a sharper daily-spend curve than the count-based approximation |

## Forecast method

Spend has no native per-day field, so build a daily-spend series and extrapolate:

1. **Spend-to-date** = `total_cost` from `/api/pricing/cost`.
2. **Avg cost per session** = `total_cost / total_session_count`.
3. **Daily spend series**: for the trailing window, `daily_spend[d] ≈ daily_sessions[d].count × avg_cost_per_session`. For a sharper curve, instead sum inline session `cost` grouped by `DATE(started_at)`.
4. **Moving average**: `avg_daily_spend = mean(daily_spend over the trailing 7 days)`. Also compute a 14-day average to gauge whether the trend is accelerating (▲) or cooling (▼).
5. **Remaining days**: days left until the end of the chosen horizon (week = through Sunday; month = through the last calendar day).
6. **Projection**: `projected_total = spend_to_date_this_period + (avg_daily_spend × days_remaining)`.

> Spend-to-date this period: when the trend covers more than the current period, restrict the spend-to-date term to sessions whose `started_at` falls inside the current week/month so the projection isn't inflated by older spend.

## Report Sections

### 1. Spend to date
`total_cost`, session count, avg cost/session, and how much falls inside the current period.

### 2. Daily trend
The 7-day and 14-day moving averages of daily spend, with a ▲/▼ accelerating-vs-cooling read. Show the last 7 days as a compact table (date, sessions, est. spend).

### 3. Projection
`avg_daily_spend × days_remaining` and the resulting `projected_total` for the horizon. State the days-remaining count explicitly.

### 4. Budget check (if a budget is known)
If the user mentions a budget, show projected vs. budget, the over/under delta, and the date the budget is projected to be crossed (`days_to_budget = (budget − spend_to_date) / avg_daily_spend`).

### 5. Confidence & caveats
Note that the forecast assumes the recent daily pace holds, that daily spend is approximated from session counts unless an inline-cost curve was used, and call out any low-data horizons (e.g. fewer than 7 active days).

## Output

Markdown with the trend table and the projection. Currency as USD to 4 decimal places; show moving averages and the projected total prominently. Deltas with ▲/▼.

© hoangsonww · MIT · hoangsonww/Claude-Code-Agent-Monitor

Similar skills

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

From the same set20

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 cost-alert Walks through the budget rules configured in Agent Monitor and the alerts that already fired, with a plain explanation of what set each one off. CX Codex +1 ★ 1,114repo stars memory-review Walks the agent's file-based memory: CLAUDE.md files and per-project auto-memory. Flags facts that went stale or grew too big. CX Codex +1 ★ 1,114repo stars config-audit Walks your ~/.claude setup and reports what has piled up: skills, subagents, hooks, duplicates and risky shell commands. CX Codex +1 ★ 1,114repo stars productivity-score Turns Agent Monitor metrics into a 0–100 productivity scorecard: session completion, cache efficiency, turn speed, tool success and cost. 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