-
-
Milestone pays freelancers only after an AI agent has verified the delivered work, with PayPal moving the money.
-
The client pays a milestone into escrow, an agent verifies the work, and PayPal releases it under a fixed policy.
-
Every contract is checked against PayPal's Acceptable Use Policy first, and a flagged one can't be signed or funded.
-
Before signing, both parties agree the release conditions: tests, builds, required files and judgment checks.
-
Each milestone moves along a rail from funded to released, and the client can approve or veto before the review window closes.
-
Every verdict comes with a receipt that cites evidence for each criterion, and a fixed policy rule makes the decision.
-
A milestone counts as released only once PayPal confirms the payout, and an advance is repaid from that payout.
-
Capital partners advance freelancers money against funded milestones and track exposure and repayment on one page.
-
A double-entry ledger in AG Grid records every movement, and the debit and credit totals always match.
-
Operators review contracts flagged by the policy check and reconcile Milestone's records against PayPal's transactions.
-
The agent runs the client's own test suite against the delivery and logs every step live.
-
When checks partly fail or a payout fails, the money stays in escrow until the client or an operator decides.
-
File deliveries like logos and PDFs are checked under the same rules, with each file hashed and every check explained.
-
Clients can delegate to an AI agent with a spending cap, and Milestone refuses and logs anything outside its mandate.
Inspiration
Freelance pay runs on trust, and trust is slow: 85% of 3,300 freelancers surveyed are paid late at least some of the time (Remote, 2025). Escrow exists, but the check on the work is still a person's click, or their silence until a timer runs out (Upwork auto-releases after 14 days, Fiverr after 3). For work that can be checked, like code with a test suite or files with measurable specs, that seemed backwards. What if the money moved when the work checked out?
What it does
Milestone holds the client's PayPal payment for each milestone and grades the delivery with the client's own test suite, measured file checks and Claude's judgment, which must cite evidence. A fixed policy then decides: money is paid out only when every check passed; otherwise it is held or the client is asked.
- Contract. Claude turns a plain-English scope into milestones with checkable criteria; both parties sign.
- Policy check. The contract is checked against PayPal's Acceptable Use Policy before anyone can sign or fund.
- Fund. The client pays through PayPal Checkout, or from a PayPal saved once.
- Deliver and verify. The client's suite grades the code; Claude judges the rest.
- Decide.
decide(), a pure function, applies rules P0 to P6. - Pay. After a review window (approve early or veto), one PayPal payout. It reads Released only when PayPal's webhook confirms it.
PayPal's Acceptable Use Policy. A keyword pass and Claude both check every contract, and each flag must quote the words that triggered it. Any flag sends the contract to an operator, and until it is cleared, signing, PayPal checkout and agent funding are all refused.
If only an optional criterion fails, the passed share is paid and the rest refunded: payout = amount × passed ÷ all criteria. Freelancers can take an advance from a lending partner against money in escrow; the release repays the partner first, in the same PayPal batch. Clients can hand bounded actions to an AI agent through Milestone's MCP server: it funds the next milestone from the saved PayPal within the mandate's caps, and can never cause a release the policy didn't choose.
How we built it
A TypeScript monorepo: packages/verify (contract compiler, test runner, Claude judgment), which never imports packages/money (PayPal client and policy engine), where only execute.ts can move money, enforced in CI. Next.js 16 for the UI, API, MCP server and webhooks; a pg-boss worker on Postgres for the jobs.
PayPal: Orders v2 and JS SDK v6 checkout, Payment Method Tokens v3, Payouts v1, Refunds, Invoicing v2, Disputes, signed webhooks, and PayPal's MCP server (read-only). Money is integer minor units in a double-entry ledger where every transaction sums to zero, shown in four AG Grid grids. Hosted on Render. Built with Claude Code as our coding assistant.
Challenges we ran into
- Stopping the freelancer from grading their own work. The client's baseline tests, runner config and dependencies are put back over the delivered code, added test files are removed, and code that sniffs the test runner or patches assertions is flagged. Red-teamed on 29 deliveries against real open-source repositories; every attack was held or sent to the client. A follow-up round found five subtler variations that would still release if the judgment criterion also passed; they're documented in the repo, and the fix is a per-verification sandbox.
- Prompt injection through the delivery. Commit messages, files and test output are untrusted evidence; an uncited "pass" becomes "unclear", and suspected injection goes to the client.
- Never paying twice. Every PayPal POST carries a
PayPal-Request-Idwritten to the database first; one payout attempt per milestone, under a row lock; a failed item goes to an operator, never a retry.
Accomplishments that we're proud of
- Zero false releases on a 50-case hand-labelled eval (42/50 exact agreement; every miss goes to the client).
- The hosted demo runs end to end on the real PayPal sandbox: checkout, an advance, verification, and one payout that repays the partner first, confirmed by PayPal's webhook.
- The model never decides: a pure, property-tested function does.
What we learned
- PayPal answers a repeated payout with "Batch with given sender_batch_id already exists", so we use one id for both the request id and the batch id and fetch the existing batch on retry.
- "Released" must mean PayPal confirmed it, not that the call returned.
- One prompt rule took the eval from 38/50 to 42/50: evidence Milestone's own checks wrote counts as a measurement; anything the delivery wrote stays untrusted.
What's next for Milestone
A sandbox per verification, the visual verification stage, PayPal multiparty onboarding with delayed disbursement, and calibrated advance pricing.
Built With
- ag-grid
- anthropic
- claude
- drizzle-orm
- fast-check
- github-webhooks
- model-context-protocol
- next.js
- node.js
- openapi
- paypal
- paypal-mcp
- paypal-orders
- paypal-payouts
- paypal-vault
- pg-boss
- postgresql
- react
- render
- tailwindcss
- typescript
- vitest
- zod