Agents and the person

QuotaPulse is worked by a person and by agents, side by side. Neither is a guest of the other: an agent can do anything the person can — by itself, or by asking first — and the person sees everything an agent does, and why. This page is how that works. The full list of what can be called is in operations.md; how the pieces are built is in ARCHITECTURE.md.

Who acts

Every change is made by an actor, and the log says which:

Actor Who Through
The person The owner, signed in to the dashboard. QuotaPulse is a single-person tool: there is one the dashboard
An agent An identity with a key of its own: an AI agent that decides and acts, or an integration — a script that reads or reports and owns nothing MCP, HTTP, the command line
QuotaPulse Itself: an incident opening because a balance fell, a proposal that expired —

An agent is added under Settings → Agents. It has a name, a kind, a line saying what it is for, and its grants. Its key is shown once; it can be replaced (the old one stops at once), the agent switched off (its key is refused, its history kept), or removed (what it owned goes back to nobody, the channels that woke it are switched off, its history stays in the log under its name).

What an agent may do

Four scopes, each held directly, by asking first, or not at all:

Scope Covers
read Everything there is to know, but credentials and channel settings
act Problems — take, acknowledge, note, hand over, give; dates; muting a meter; a fresh reading
ingest Reporting readings
admin Everything the dashboard can do: accounts, rules, channels, agents, settings, export, backup

admin carries the other three. A scope held by asking first — propose in the API — lets the agent call the changes it covers, but each call becomes a proposal the person decides on. Three changes are never asked for — adding an agent, giving one a new key, importing a bundle — because they hand out or bring in keys, and a proposal and what it answered are read by every agent: they need admin held directly. A useful shape for an operations agent: read and act directly, admin by asking first. It handles the routine on its own and asks before it touches a rule or a setting.

An integration — a reporting script, a Prometheus scraper — asks for nothing and owns nothing: it gets ingest or read, directly.

One interface

Everything anyone can do is an operation, defined once in internal/ops: its name, what it is for, its input and answer as JSON Schema, the scope it needs, what it does to the world (reads, changes, removes for good), whether it can be rehearsed. Every door is generated from that one catalog:

So what the person can do and what an agent can do are the same list by construction, and every change — from the dashboard or from an agent — is checked against the caller's grants, carried out in one transaction, and written to the log the same way.

The log

Every change is written down with who made it, through which door, the reason they gave, and what it changed field by field. QuotaPulse writes its own entries too: incidents opening, escalating and resolving. It is one ordered log:

Entries are kept as long as the history (retention_days); their IDs never repeat, so a cursor stays valid.

Work has an owner

A problem — an incident — can be owned: by the person, by an agent, or by nobody. It carries a timeline: who took it, what they noted, what was sent.

Who What happens
take_incident anyone with act It is theirs
assign_incident anyone with act It goes to the person, an agent, or nobody. An agent given one is told on its own channels, with the reason
note_incident anyone with act A note on the timeline, for whoever looks next
acknowledge anyone with act Seen and handled, or being handled: it stays open until its cause is gone, but stops repeating. The reason is the note
hand_over an agent It goes to the person with a note saying what was found, tried, and is needed — and they are told now, through their channels, note first

On the dashboard, every problem says who has it and the latest word on it, and what an agent handed to the person comes first. The digest says it in a few lines: what the agents ask, first; each problem with the agent that has it; and what each agent did over the day or the week — acknowledged, handed over, changed, asked for.

A channel can belong to an agent: a webhook into the agent's own runtime is how it is woken. It hears at once — through quiet hours, through the hold below — and is told when a problem is given to it. The webhook payload says who owns the incident (subject.assignee) and carries the note.

Answering first

The person can let one agent answer first (Settings → Agents, or update_settings with responder and hold_minutes). Then:

  1. A new operational problem — a balance running out, a budget, an account that cannot be read, a reporter gone quiet, a failing channel — is assigned to that agent as it opens.
  2. The agent's channels hear at once. The person's channels wait hold_minutes (15 by default).
  3. If the agent acknowledges it in that time, the waiting messages are dropped: nobody is woken, and the log says what the agent did. If it hands the problem over, the waiting messages are dropped and one message goes to the person instead, with the agent's note. If it does nothing, the person hears when the wait is over, as before.

Critical news never waits for anyone: it reaches the person at once, though the agent still owns the problem. Date reminders are the person's own — they come at the hour the person chose. With nobody set to answer first, everything works as it always did.

Asking first

A change an agent may only ask for — or one it chooses to put to the person, with propose — becomes a proposal:

  1. It is checked and rehearsed at once: a change that could not be made is refused now, not after the person approves it.
  2. It waits as an approval incident: on the person's Now page under "Asks you", in their notifications, and at /incidents/{id}, which shows who asks, why, and exactly what would change, field by field, and what it would set off — an incident opening or resolving.
  3. The person approves or rejects it, with a word for the agent. Approved, it is carried out as the agent's change, approved by the person; if it can no longer be made, the proposal ends as failed, with why. A proposal nobody decides on expires after seven days.
  4. The agent learns the outcome from its feed and its inbox.

Deciding is the person's alone: no agent is offered approve_proposal or reject_proposal, whatever its grants.

Rehearsing

A change that only touches QuotaPulse's own data can be called with dry_run: true. It runs for real, inside a transaction: the answer says what it would change, field by field, which incidents it would open or resolve, and what the operation would have answered — and then everything is rolled back. Nothing is written and nobody is notified. Changes that reach outside — reading a provider, sending a test message, writing a backup — cannot be rehearsed, and say so.

A retried call is safe too: send the header Idempotency-Key over HTTP, and a repeat within a day gets the first answer instead of making the change again. Adding a date with the title and rule of one that exists is refused, naming the one that does.

Connecting an agent

Add the agent under Settings → Agents. Its key is shown once, with what to paste:

{"mcpServers": {"quotapulse": {"type": "http", "url": "https://pulse.example/mcp",
  "headers": {"Authorization": "Bearer qp_…"}}}}

or, for a shell or a script:

export QUOTAPULSE_URL=https://pulse.example QUOTAPULSE_TOKEN=qp_…
quotapulse call whoami
curl -X POST $QUOTAPULSE_URL/api/v1/ops/whoami -H "Authorization: Bearer $QUOTAPULSE_TOKEN"

The agent learns the rest from the server: whoami says what it may do, the tool descriptions say what each does, and the quotapulse skill — served over MCP as skill://quotapulse/SKILL.md, and in this repository under .agents/skills/quotapulse — says how to work.

An agent's loop

whoami                       once: my grants, am I answering first, the person's language
loop:
  inbox                      what is mine: assigned problems, my proposals' outcomes
  for each problem:
    get_incident             its timeline, the meter or date, what I can do now
    … find out, act …        sample_now, get_meter, the platform's own tools
    acknowledge + reason     dealt with: nobody needs waking
    or hand_over + note      the person must act: they are told now
  changes {wait: 50}         sleep until something happens

Before a long or costly job on a metered API: list_meters with the account's name, and read headroom. The skill has the rest.