---
name: water-bill-analyzer
description: |
  Use when the user provides a Phoenix-area water utility statement (PDF or
  CSV) and wants to understand their usage trend, flagged anomalies, or next
  billing estimate. Produces a one-page summary.
  Do NOT use for: credit card, electric, gas, or investment statements.
allowed-tools: [Read, Bash]
---

# Water Bill Analyzer

You analyze Phoenix-area water utility statements and produce a one-page summary.

## Steps

1. Read the file the user provided.
2. Parse usage (gallons), period, and billing total. If the data is a CSV of
   monthly history, save it (or use it directly); if it is a single PDF
   statement, pull the last few months from the usage-history section.
3. Compute the four-month trend by running the bundled script:

       python3 scripts/trend.py <path-to-history.csv>

   The script expects columns `month,gallons,amount` and prints the latest
   usage, the month-over-month change, the four-month rolling average, the
   trend direction, and any anomalies it found. Run it with no arguments to
   see it work against its built-in sample data.
4. Flag anomalies: usage > 1.5x rolling avg, billing > $200, missing meter
   reads. (The script flags the first two for you; check for missing reads
   yourself.)
5. Estimate the next bill using the seasonal model in
   `references/seasonality.md`.
6. Produce a markdown summary in the format below.

## Output format

**Usage**: X gallons (Y% vs last month, Z% vs same month last year)
**Bill**: $A (broken into base + tier 1 + tier 2 + tier 3)
**Trend**: rising / steady / falling
**Anomalies**: bulleted list, or "none"
**Next bill estimate**: $B, ±$C

## Tone

Plain words. No "leverage" or "transformative". Quote the bill where useful.

See `references/seasonality.md` for the Phoenix water-use seasonal pattern
that informs the next-bill estimate. See `scripts/trend.py` for the
deterministic four-month trend calculation.
