Inspiration
On a Sunday, my coding agent built a bill-splitter for me in 34 seconds. It leaned on zod, a free library someone else maintains. Most open source maintainers do it unpaid (6 in 10 call themselves unpaid hobbyists, per Tidelift's 2024 survey), and the tools that do pay them split money across every library in your project file, even ones the code never touches. It's like a music app paying for every album you saved instead of the songs you played. AI agents now write a big share of new code, and they leave a record of exactly what they used. I wanted that record to decide who gets paid.
What it does
- A Claude Code hook records what the agent does in each session: installs, imports, and the library source it reads. Secrets are blanked before anything leaves your machine.
- Meta Muse Spark weighs that evidence and must cite it for every share. Code then drops anything it can't prove, caps any one library at 40% of a session, and pays nothing to a library that only sat in package.json.
- Maintainers prove they own the repo (GitHub access or a one-line FUNDING.yml token). Unclaimed shares are held, never sent to a guess.
- You approve, and one PayPal Payouts batch goes out, after code checks budget, caps and fees. It's funded by PayPal Subscriptions or a one-off Orders top-up, and booked only when PayPal confirms it.
- Money records replays every PayPal-confirmed event, with a Bryntum money timeline and a log of every PayPal API call.
- Insights, built on AG Studio, puts money and attribution on one board. Ask AI runs AG Studio's agents on Muse Spark, and our own ledger auditor agent checks every money widget they build against the books.
- The /check page lets anyone drop a Claude Code session file and see what the agent really relied on. No account needed.
How we built it
- Server: TypeScript, Node and Express with SQLite. The Claude Code hook is plain Node.
- Web: React and Vite, AG Grid and AG Charts for every table and chart, AG Studio for Insights, and the Bryntum Scheduler for the money timeline.
- PayPal (sandbox): Subscriptions and Orders v2 through PayPal's Server SDK, generated by APIMatic. Payouts and Webhooks over REST. Monthly statements issued as PayPal invoices through the PayPal Agent Toolkit.
- AI: Meta Muse Spark (muse-spark-1.3) reviews each session with structured output, and code validates every share it proposes. Muse Spark also runs AG Studio's agents through a small server proxy, so the API key never reaches the browser.
- Hosting: one Render service with a persistent disk. 155 automated tests.
Challenges we ran into
- Meta's API rejects recursive JSON schemas and anything nested deeper than 10 levels, but AG Studio's query tool is both. The proxy unrolls the schema per recursion group to fit.
- An early run of the auditor flagged a "mismatch" on a correct widget, because it had rebuilt the query itself. Now code reads the widget's own measures and filters, and the auditor only compares.
- Render's firewall refused some large session uploads, so the hook, the import and /check now gzip them.
- On Windows, Claude Code runs commands through its PowerShell tool, so the hook and parser had to handle that too.
Accomplishments that we're proud of
- A real end-to-end run: real Claude Code session, Muse Spark review, a FUNDING.yml claim, and PayPal sandbox payout batch D85JLLSK5RWHN ($3.59, PayPal fee $0.25), confirmed by verified webhooks.
- We measured the AI rather than claiming it works: on 6 real sessions with 63 packages labelled blind, Muse Spark found packages about as well as counting imports (F1 0.86 vs 0.87) with about a fifth less error in the shares (0.67 vs 0.86).
- The ledger auditor matched the agents' widget to the cent: $11.00 in, $3.59 paid, $4.97 held, $1.61 fees.
- Nothing can double-pay: a replayed payout batch is refused by PayPal, and ten safety checks re-verify the books on every load.
What we learned
- Evidence beats dependency lists: React sat in package.json untouched, so it gets nothing, while zod, never declared, was used and gets paid.
- An AI in a money flow needs to be checked by code at every step: Muse Spark proposes, code validates, a person approves.
What's next
- Publish the hook as a package, and turn on Log in with PayPal for maintainers.
- Leave the sandbox, and run a pilot with teams that already have an open source budget.
- Add other coding agents besides Claude Code.
Honest limits: everything runs on the PayPal sandbox. The one real payout so far went to a test package we own (split-cents). The labels in the accuracy test were written by Claude from the session transcripts, blind, not by an independent person.
Built With
- ag-charts
- ag-grid
- ag-studio
- apimatic
- bryntum
- claude-code
- express.js
- meta-muse-spark
- node.js
- paypal
- paypal-agent-toolkit
- paypal-orders
- paypal-payouts
- paypal-server-sdk
- paypal-subscriptions
- paypal-webhooks
- react
- render
- sqlite
- typescript
- vite