Inspiration
Freelance pay is lumpy. A $3,200 month can be followed by a $150 one, and every payment comes with the same chores: move some to rent, hold back tax, pay the person who helped on the job. Doing that by hand after every payment is how it slips. I wanted the split to happen the moment the money lands, without handing the money itself to an AI.
What it does
You route client payments through PayPal. The AI agent looks at how you earn (amounts, dates, how uneven it is) and what you tell it about your month, then proposes envelopes, each with a one-line reason. Code checks the plan before you see it: the shares add up to 100%, it only pays people you added yourself, and no email addresses are hidden in the text. You can try the plan on your past payments, edit it, then approve it.
From then on every payment splits itself when PayPal captures it. In the run shown in the video, a $1,200 client payment became $300 tax, $120 for Lawful (a collaborator), $384 rent, $60 bills, $216 slow-month buffer and $120 for a laptop, to the cent. Envelopes that pay someone go out together as one PayPal payout batch, and the first payout to anyone new waits for your approval. Envelopes that hold money stay in the account under their label. Every step is read back from PayPal, and a payment only shows as done once each part is confirmed.
You can also pay someone from an envelope. When an envelope empties faster than the month passes, Portion tells you with the numbers: "Your Bills pot is 75% used and the month is 34% gone. You have $15.00 left for 20 days."
How I built it
One Next.js app with server actions and Node's built-in SQLite. Money comes in through PayPal Orders v2 (intent CAPTURE) and goes out through the Payouts API. Each payout batch carries a PayPal-Request-Id and a sender_batch_id derived from the payment, so a retry gets the same batch back instead of paying twice. Each part of a batch is read back on its own, because one batch can pay four people and fail on the fifth.
The AI agent runs on Claude (claude-sonnet-5-5) with structured outputs. It has three jobs: propose the plan, decide whether an incoming payment should follow the plan or wait for me, and word the nudges. It never calls PayPal and never produces an amount that gets paid. Code computes every cent. The payer's note reaches the agent only as data, and if the agent is unsure or fails, the payment waits.
The live demo runs on Render. I created the service, set its config and read its deploy logs through Render's MCP server, and it runs on a Starter instance with a persistent disk for the database.
Challenges I ran into
Keeping the AI useful while keeping it away from the money. What worked was shrinking its answers to things code can check: percentages, a fixed set of choices, and a sentence that has to repeat numbers code already computed.
Payout batches. One batch is really several separate outcomes, and a retry must never pay twice. While recording the demo I found that a fresh database reused request IDs PayPal had already seen from an earlier run, so PayPal refused the batch as a duplicate. Request IDs now include an ID made once per database, with a test for it.
What I learned
PayPal remembers a sender_batch_id across the whole account, not per copy of the app, so idempotency keys have to be unique beyond your own database. And a model is much easier to trust when its output is small enough for code to check.
What's next
Bills first with an early shortfall warning, goals with a date, a steady monthly wage drawn from uneven income, and webhooks in place of polling.
Limits
Sandbox only, no real money. Portion only sees money that passes through it. The app's PayPal account receives payments and then pays out, so a real launch would need PayPal's platform approval. The earning history in the demo is seeded and labelled that way. One demo user, no sign-up. Portion gives no investment or tax advice.
Built With
- anthropic
- claude
- next.js
- node.js
- paypal
- render
- sqlite
- typescript
- vitest
- zod