TL;DR: Replace the flat monthly average with a baseline-plus-uplift model that treats quarter-close weeks as their own period. Averaging spreads the close spike across all weeks, which overstates normal weeks and understates close weeks at the same time. Model each month as normal weeks plus close weeks with separate rates, then backtest against the last four closes.

```text
agent's budget model used a flat monthly average  -  it never accounted for the end-of-quarter close that triples analytics spend
```

1. Pull 12 months of analytics spend and mark the quarter-close weeks. Expected: spend roughly triples in the last one to two weeks of each quarter against a flat baseline the rest of the time.
2. Rebuild the forecast as a baseline plus a close-period uplift, not a single monthly average. Model each month as normal weeks plus close weeks with their own rate. Expected: the forecast predicts the spike within 15 to 20 percent instead of missing it entirely.
3. Set budget alerts per period type: one threshold for normal weeks, a higher one for close weeks. Expected: alerts fire on genuine overruns instead of paging every quarter or staying silent during one.
4. Backtest against the last four quarter-closes before trusting the model. Expected: the model would have predicted each close within your tolerance band, with no false alarms in normal weeks.

## Use this when
- Budget forecasts miss recurring business-cycle spikes (quarter close, month-end, tax season)
- Alerts fire every quarter on expected spend, or miss real overruns hiding inside the spike
- A flat-average model is driving budget decisions for spiky workloads

## Not for this skill when
- Spend is genuinely flat and the model is accurate - do not add seasonality it does not need
- The spike already happened and you are doing variance analysis - that is a post-mortem, not a model fix
- Finance sets budgets top-down regardless of the model - align on the process before tuning the math

## Variant phrasings
- budget forecast missed quarter end analytics spike
- flat average budget model wrong for seasonal spend
- how to model end of quarter close in cloud budget
- cost anomaly alerts fire every quarter close

## Why it happens
A flat monthly average is the simplest forecast and it is exactly wrong for cyclical workloads. Averaging spreads the quarter-close spike across all weeks, which simultaneously overstates normal weeks and understates close weeks. The model looks reasonable on a monthly total while being wrong about every individual week.

## Edge cases
- Quarter-close timing shifts (an early close in December). Keep the close calendar editable, not hardcoded.
- One-off spikes (a migration, a load test) inside a quarter poison the uplift estimate. Exclude annotated one-offs from the training data.
- If finance accrues the close cost differently from when the usage happens, reconcile the model's timing against the invoice timing.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_K1k7ChyodWu7y-qEoJ12Qg
