Install
$ agentstack add skill-hoangsonww-claude-code-agent-monitor-spend-forecast ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
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:
- Spend-to-date =
total_costfrom/api/pricing/cost. - Avg cost per session =
total_cost / total_session_count. - 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 sessioncostgrouped byDATE(started_at). - 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 (▼). - Remaining days: days left until the end of the chosen horizon (week = through Sunday; month = through the last calendar day).
- 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 ▲/▼.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: hoangsonww
- Source: hoangsonww/Claude-Code-Agent-Monitor
- License: MIT
- Homepage: https://hoangsonww.github.io/Claude-Code-Agent-Monitor/
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.