Inspiration

Picture an agency in the Philippines that pays 60 virtual assistants on the 15th and the 30th. It sends 48 PayPal invoices a month to US clients, one in five is overdue, and the founder bridges payroll from personal savings while the clients pay net-30. Or a studio of 24 editors whose founder writes every chase to US clients himself, because the team's English is not good enough. (Both are simulated buyer personas from a discovery exercise, not customers.) Neither needs a smarter dashboard; they need the awkward email written, shown to them word for word, and sent only when they say so. The constraints have to live in code: there is no path that sends without the click, the tone ladder and the chase-worth score are deterministic and unit-tested, and the model can be switched off entirely for a templates-only desk. PayPal already has the invoices and a reminder endpoint. What was missing is the desk.

What it does

Collections Desk syncs every PayPal invoice, ages it, and scores chase-worth deterministically (amount due × an age weight). A ladder picks the tone: wait, friendly, firm, final notice, write-off candidate. The whole ledger lives in one AG Studio workspace: KPIs, aging and debtor charts, and a custom Collections queue widget, all cross-filtering each other. Ask the desk a question, "Who's 30+ days late and worth chasing?", and Claude returns a view spec (filters, sort, grouping) that the queue applies as state; the agent builds the view, it never touches the data. Select an invoice, the collector drafts the reminder from the facts in the ladder's tone, you approve, and PayPal's remind endpoint sends it. When the customer pays, the INVOICING.INVOICE.PAID webhook clears the row.

How I built it

Go, Preact with AG Studio 3.1 (a pre-built report in state, a custom queue widget on the widget API and studioGridTheme, live data through data-engine transactions, a light/dark brand theme, edit mode), Postgres, the shared paypalgo library. The seed creates 24 real sandbox invoices across five customers and five age bands (not yet due, 1–30, 31–60, 61–90 and 90+ days), so every row, reminder and status in the demo is a real PayPal object. The scoring ladder is unit-tested.

Challenges

A Studio widget with no data mapping returned zero rows until I queried with the engine's own field objects from getSchema() rather than field ids, and Studio hung on load until the custom widget had a form. PayPal's sandbox intermittently answers invoice sends with 406; a retry fixes it.

Accomplishments

A question became a correct grid view on the first try. A $1,428.80 invoice more than two months late got a final notice that cited only its invoice number, amount, due date and days late, and PayPal accepted the reminder.

What I learned

"Agent builds the view" is the right shape for AI in a data tool: the model outputs grid state, the grid stays the source of truth, and nothing it says can corrupt a number.

Templates-only mode

A header toggle (Drafting: AI | Templates, or LLM_MODE=off) switches Claude off. Drafts then come from fixed templates built from the invoice facts (number, amount, due date, days late, customer, pay link) in the tone the ageing ladder picks (gentle, firm, final), overridable per draft. Every draft carries a template or model badge, and the preview is the exact text PayPal will send. The chat panel answers with a short "drafting is off" message rather than a model call.

What's next

Per-client holds, approve-once cadence, CSV import of non-PayPal invoices into the same ageing view, a DSO baseline and 30-day report, and the payroll runway view (inflows against payout dates).

Built With

Share this project:

Updates

Submission history