# Usage spike

*A bill is about to jump. Your agent found out why and how to stop it.*

**Type: [Glance](types/glance.md).** One thing worth knowing right now, at a glance. This is one good use of it; the same widget serves your day, what's useful where you are, flight or train status, what your agents did overnight and more. Switch the subject when something else matters more.

Template id `usage-spike` · Agent at work · uses nothing on the phone · for: Agents with access to your cloud or API billing.

## Goal

Bills don't surprise the user: the jump gets caught the same day, with the cause.

## When to offer it

The user pays for hosting, cloud or API usage and you can read it.

## What the user gets

- Watches usage on your cloud and API accounts
- Finds what's causing a jump
- Offers the fix before the invoice arrives

## What each size shows

- **Small**: metric: Today so far = $38.
- **Medium**: metric: Today so far = $38; text (body): "Bots on /api/search since 9:00. A rate limit stops it."; buttons: Add limit (`limit`), Look into it (`dig`), It's fine (`ignore`).
- **Large**: metric: Today so far = $38; text (body): "Bots on /api/search since 9:00. A rate limit stops it."; buttons: Add limit (`limit`), Look into it (`dig`), It's fine (`ignore`); list: Where it's going (2 rows).
- **Lock Screen**: inline "Usage up 4x today".

## Make it theirs

**Look.** Send `look` instead of `theme` and `accent`; every combination is designed to read well:

- `style`: `glass` (default: see-through, adapts to dark mode), `soft` (a calm pale tint) or `bold` (a vivid gradient with dark buttons).
- `accent`: blue, indigo, purple, pink, red, orange, green, teal, graphite, or a hex.
- `font`: default, rounded, serif or mono.

This template's own accent is **red**. To restyle a widget you already saved, send only the look:

```json
{"slug": "usage-spike", "look": {"style": "bold", "accent": "red", "font": "rounded"}}
```

Preview a look without saving: `droplet_preview_widget` with the slug and `look`. When the user says "make it greener", "calmer" or "bolder", change the look; keep the content.

**Their choices.** Ask once (droplet_ask) or use what you know:

- What counts as unusual
- Which accounts

**Search words:** usage, billing, cost, cloud, api, spike, vercel, aws, invoice.


## Before you build

- You need: Agents with access to your cloud or API billing.
- Ask once: Before deploying the fix, or anything that could affect real users.

## Fill it with real data

Start from the template (`droplet_library` with `id: "usage-spike"`), keep the design, and replace each sample value:

| Block | Real value |
|---|---|
| 0 · metric | Today's cost. |
| 1 · text | The cause, and the fix. |
| 2 · buttons | Fix it, investigate, or leave it. |
| 3 · list | Where the money's going. |

Sources:
- Usage and cost from your hosting, cloud or API dashboard.
- What's normal for this account.
- The cause you found in logs or traffic.

## The widget

Sample values; send it with `droplet_set_widget` on your widget's slug (or a new slug with `new_widget: true` if the user asked for a separate widget). Preview it and fix every warning first.

```json
{
  "slug": "usage-spike",
  "title": "Usage up 4x",
  "symbol": "chart.line.uptrend.xyaxis",
  "accent": "#FF453A",
  "blocks": [
    {"type": "metric", "label": "Today so far", "value": "$38", "trend": "up"},
    {"type": "text", "text": "Bots on /api/search since 9:00. A rate limit stops it.", "style": "body"},
    {"type": "buttons", "items": [{"id": "limit", "label": "Add limit", "symbol": "hand.raised.fill"}, {"id": "dig", "label": "Look into it", "symbol": "magnifyingglass"}, {"id": "ignore", "label": "It's fine", "symbol": "checkmark"}]},
    {"type": "list", "title": "Where it's going", "items": [{"title": "/api/search", "detail": "$31"}, {"title": "Everything else", "detail": "$7"}]}
  ],
  "sizes": {"medium": [0, 1, 2], "large": [0, 1, 2, 3]},
  "lock": {"inline": "Usage up 4x today", "circular": 0}
}
```

## Keep it fresh

A scheduled check once or twice a day. Only show this when it's really out of line.

## Handle the taps

Each tap reaches you once on `droplet_get_events` (keep a waker running, SKILL.md Process C). Answer within seconds by updating the widget.

**Add limit** (`limit`)

```json
{"widget": "usage-spike", "kind": "button", "target": "limit", "value": {"label": "Add limit"}}
```

Prepare the change and deploy it after approval, then show the new rate.

**Look into it** (`dig`)

```json
{"widget": "usage-spike", "kind": "button", "target": "dig", "value": {"label": "Look into it"}}
```

Investigate and report back with what you found.

**It's fine** (`ignore`)

```json
{"widget": "usage-spike", "kind": "button", "target": "ignore", "value": {"label": "It's fine"}}
```

Don't flag this cause again this week.

## Ask first

Before deploying the fix, or anything that could affect real users.

For example:

```json
{"question": "Deploy a rate limit to /api/search?", "kind": "decision", "options": ["Deploy", "Hold"], "risk": "medium"}
```

## Phone actions

None unless it's costing real money fast.

## Edge cases

- It's real growth, not a problem: say so, it's good news.
- You can't find the cause: say what you ruled out.

## Never

Never turn a service off to save money without asking.

## Done when

- [ ] Every sample value is replaced with real data (no "Dr. Lee" on a real widget).
- [ ] `droplet_preview_widget` shows no warnings at the sizes the user placed (`placed` in `droplet_whoami`).
- [ ] Every button has a handler and a waker is running.
- [ ] Refresh is set up as above.
- [ ] You told the user in one line what it does on its own and what it asks first.

## Same widget, other uses

- [Your day](day-brief.md): What you need to know, changing through the day: how you slept, what's first, what's left.
- [Here and now](here-now.md): What's useful where you are: your meetings at work, what's nearby when you're out, tomorrow when you're home.
- [While you slept](overnight.md): What your agents finished overnight, and the one thing that needs you.
- [Travel day](travel-day.md): Flight, gate, when to leave and the ride, as one live widget.
