QuotaPulse

ci release

Tells you before something you depend on runs out or comes due.

A small self-hosted service that watches two kinds of things:

It says something when that changes: when a balance is on course to run out, when it gets worse, when it recovers, when a date is near. Not every morning. One binary, one SQLite file, a dashboard — and agents working beside you: everything you can do in the dashboard, an agent can do over MCP, by itself or by asking you first, and everything it does is written down with why.

简体中文

The overview: what needs attention, how long each meter lasts, what is coming up

What it does

It forecasts instead of comparing to a threshold. "430 left" means little; "at this pace, gone on the 22nd" is something to act on. The burn rate weights recent days more, so a one-off job fades and a new habit shows up within days. A threshold is still there as a last line.

It knows a quota from a balance. A coding plan's five-hour window and its monthly tool quota are separate meters, each with its reset time — and with the window's length known, whether it will last until it resets.

It notices a leak without crying wolf. A burst of spend becomes an incident only if it is both a real jump and fast enough to empty the balance within days. Spending 2.50 after a quiet week is not news on a balance of 500.

It speaks on change. An incident opens, may escalate, and resolves; those are the messages. A warning is said once. Only an unacknowledged critical incident repeats. Quiet hours hold back what can wait, and a problem that fixes itself overnight is never announced.

Dates, with the lunar calendar done properly. Weekly, monthly, yearly, every N, one-off. A lunar birthday lands on the right day every year, including the ones whose month is a day short.

A meter: its history, where it is heading, and the rules that watch it Dates: each one with the day it lands on this time

It tells you where you are. Feishu/Lark, DingTalk, WeCom, Slack, Telegram, ntfy, Bark, a plain webhook, or the browser itself. Each channel picks its topics and how severe something must be. Delivery is retried from an outbox, and a channel that keeps failing is itself reported — through the others.

Agents work beside you. An agent can check headroom before a long run, keep your renewal dates, and take the routine problems itself: it answers first, deals with what it can, says what it did — and hands you the rest with a note, waking you only then. What it may do you decide per agent: directly, only by asking you first, or not at all. A change it asks for waits on your Now page, rehearsed, field by field; the log says who did what and why. See docs/agents-and-the-person.md.

Anything can report in. No API for it? Push the number: POST /api/v1/ingest. A pushed meter gets the same forecast and rules.

Try it

No credentials needed — the demo runs the real engine against a fake internet:

docker run --rm -p 8080:8080 ghcr.io/itswl/quotapulse demo
# http://localhost:8080, password: demo

Run it

One file, and nothing to set:

curl -fsSLO https://raw.githubusercontent.com/itswl/quotapulse/main/docker-compose.yml
docker compose up -d

Open http://localhost:8080 — or the server's own address — and choose a password; the language and time zone are filled in from your device. Then add an account, a notification channel and a date. Everything is configured in the dashboard.

Settings from the environment

All optional: what to watch, where to notify and how to behave live in the database and are edited in the dashboard.

Variable Default
QUOTAPULSE_PASSWORD chosen in the dashboard The password, set here instead; the dashboard then cannot change it
QUOTAPULSE_DATA ./data (/data in the image) The database, its daily backups, and the key file
QUOTAPULSE_LISTEN :8080
QUOTAPULSE_SECRET a key file in the data directory Encrypts stored credentials. Set once; never change it
QUOTAPULSE_BOOTSTRAP — A bundle to import into an empty database
QUOTAPULSE_MUTE — 1 records notifications without sending them
QUOTAPULSE_LOG, QUOTAPULSE_LOG_LEVEL text, info json for structured logs
TZ, QUOTAPULSE_LANG asked when it is set up Time zone and language (en, zh) of a new install, instead of asking; change them later in the dashboard

Platforms

Built in: DeepSeek, Zhipu GLM Coding Plan, OpenRouter, SiliconFlow, Moonshot (Kimi), Volcengine, Alibaba Cloud, TikHub and UniAPI.

A platform is one HTTP request and one jq expression, so adding yours takes a few lines and no code — in the dashboard, with a live test against your own key. See docs/providers.md, which also says how each built-in definition was verified.

Agents

Add an agent under Settings → Agents, and choose what it may do: read to ask, act to handle problems and dates, ingest to report readings, admin for everything else — each directly, by asking you first, or not at all. Its key is shown once, with what to paste into an MCP client:

{"mcpServers": {"quotapulse": {"type": "http", "url": "https://pulse.example/mcp",
  "headers": {"Authorization": "Bearer qp_…"}}}}
whoami, inbox What it may do, whether it answers first; what is its own to handle
attention, list_meters What is open and coming up; every meter with a one-word headroom: ok, low, exhausted, unknown
get_incident, acknowledge, note_incident, hand_over Work a problem: its timeline, saying what was done, handing it to you with a note
changes What happened since it last looked — a long poll that sleeps until something does
add_date, update_meter, … Every change takes a reason for the log, and most take dry_run to rehearse it

That is a handful of about sixty operations — everything the dashboard can do. The same operations answer over HTTP at POST /api/v1/ops/{name}, and from a shell: quotapulse call whoami.

Let one agent answer first, and new problems go to it before you: your channels wait a few minutes, and if it deals with the problem you are never woken. Critical news reaches you at once regardless. docs/agents-and-the-person.md has the whole model.

The tools say what they return. How to work QuotaPulse — reading a runway honestly, checking an account before a costly job, turning "Mom's lunar birthday" into the right rule, working a problem and handing it over — is in a skill: .agents/skills/quotapulse. An MCP client that speaks the Skills extension gets it from /mcp as the quotapulse skill, with nothing to install; any other client can read the same files as resources under skill://quotapulse/. To use it elsewhere, install it with npx skills add itswl/quotapulse, or copy the directory into your agent's skills folder.

Reporting from a script

curl -X POST https://pulse.example/api/v1/ingest \
  -H "Authorization: Bearer qp_…" -H "Content-Type: application/json" \
  -d '{"meter": "claude-code", "kind": "counter", "unit": "USD", "value": 61.75}'

scripts/claude-code-usage.py reports what Claude Code has cost this month; run it from cron. Give the meter a monthly budget to be warned when the month is heading past it, and a "silent for" limit to hear when the script stops running.

Backups

The database is backed up into data/backups/ once a day; the last seven are kept. Those files hold no key on purpose — a stolen backup is useless on its own — so they restore the history, not the stored credentials, unless data/secret.key goes with them (or QUOTAPULSE_SECRET is set and kept safe). For a copy you can read, or to move to another machine:

docker compose exec quotapulse /quotapulse export --secrets > backup.json

Everything is in the data directory. Back it up as a whole — the key file with it, or the stored credentials cannot be read. Should the key file be lost anyway, the server refuses to start rather than make a new one over stored credentials — nothing saved afterwards could be read with either key. quotapulse export still runs, with a key of its own that is written nowhere, and saves everything that can be read without the credentials.

More

Development

npm --prefix web ci && npm --prefix web run build
go test -race ./...
(cd tools/legacy-import && go test -mod=mod ./...)
npm --prefix web run typecheck && npm --prefix web test

go run ./cmd/quotapulse demo --lang zh                        # try a change
QUOTAPULSE_WEB_DIR=web/dist go run ./cmd/quotapulse demo      # with `npm --prefix web run watch` alongside

License

MIT — see LICENSE.