-
-
-
Landing Page
-
Contracts Overview Ledger & Active Retainers
-
New Contract Creator
-
SLA Linter (Tier Overlap Error, Advisory Flags & CSV Backtest)
-
Live Retainer Timeline & Real-Time Prober Telemetry Feed
-
Settlement Statement (PayPal Capture ID & PDF Download)
-
Demo Control (Chaos injection)
-
MCP Audit Ledger
-
MCP Full Documentation & Tool Schema Specifications
-
Customer Evidence Mode (Add any vendor without enrollment)
-
Claim Pack
-
PayPal Orders v2 Authorization Modal
-
Client Live Retainer Timeline & Refund Potential Gauge
-
Client Settlement Statement
Inspiration
Almost every web development retainer, hosting SLA, and maintenance contract promises uptime, and credits when service fails. Yet in reality, over 95% of SLA credits go completely unclaimed.
Claiming a credit requires a client to manually notice an outage, collect log timestamps, open a contentious support ticket, and argue over contractual percentages. Most clients simply do not bother, and agencies have little incentive to calculate penalties proactively.
I built Retainer Referee on a single foundational philosophy: "AI reads the contract. Code decides the money."
By coupling PayPal's two-step Authorization platform with automated SLA probing and strict algorithmic guardrails, I turned subjective retainer agreements into self-enforcing, dispute-free escrow.
What it does
Retainer Referee provides an end-to-end autonomous escrow lifecycle for service level agreements:
- Contract Extraction and SLA Linter: An agency pastes an unstructured proposal, email, or chat thread. AI extracts the structured terms: monthly fee, target uptime, tiered credits, and exclusions. Before activation, a deterministic SLA Linter validates the terms, detecting issues like overlapping tier thresholds and blocking activation until resolved.
- The PayPal Hold: The client approves the monthly fee via PayPal Orders API v2 using intent AUTHORIZE. Zero dollars are charged upfront; the funds are held on the funding source throughout the billing window.
- Telemetry Probing: A background worker monitors the client endpoint every minute, recording HTTP status codes, SSL certificate health, and response latencies. Agreed maintenance windows (for example, Sunday 02:00 to 04:00 UTC) are automatically excluded.
- Deterministic Settlement Math: At period close, pure TypeScript code computes the exact uptime mathematically. For example, across a standard 30-day billing cycle (43,200 minutes) with 164 minutes of recorded downtime, uptime lands at 99.62%, triggering Tier 1 (an agreed 10% credit).
- Dual PayPal Execution: The backend calls PayPal Payments API v2 in real time. For example, on an $800 held fee with a 10% credit, PayPal captures $720.00 to the agency and automatically releases the remaining $80.00 back to the client. An itemized statement and PDF are generated with zero manual negotiation.
- Customer Evidence Mode: If an agency has not enrolled yet, a client can independently monitor any domain. When an outage occurs, the system compiles a Claim Pack with raw incident logs, a SHA-256 integrity hash, and a ready-to-send draft letter with an invite link to onboard the vendor.
- Agentic Commerce via MCP: Autonomous AI agents can manage retainers through an integrated Model Context Protocol server. Strict guardrails ensure no MCP tool accepts a monetary amount, and unauthorized money movements are strictly rejected.
How we built it
- PayPal Developer Platform: Implemented PayPal Orders API v2 (intent AUTHORIZE) for holding funds and Payments API v2 for partial multi-party captures and void operations. Included a realistic offline Sandbox Simulator to allow judges to evaluate the entire flow locally without requiring external merchant credentials.
- AI and Structured Extraction: Integrated Google Gemini and OpenAI with strict Zod schema validation, accompanied by deterministic regex fallback extractors to ensure 100% reliability offline.
- Backend and Storage: Built with Node.js, TypeScript, Express, and native SQLite (DatabaseSync with WAL mode). Integrated PDFKit for programmatic generation of cryptographically hashed settlement statements.
- Agentic Guardrails: Implemented a Model Context Protocol (MCP) server that exposes safe contract preview tools to LLM agents while forbidding agents from defining currency amounts or executing settlements without human confirmation.
- Frontend: Developed a dual-portal interface (Agency and Client portals) using React, Vite, and Tailwind CSS, styled with an editorial financial aesthetic using Newsreader serif and JetBrains Mono monospace typefaces.
Challenges we ran into
- Eliminating AI Hallucination in Financial Operations: Language models are adept at linguistic comprehension but cannot be trusted to perform deterministic monetary math. The biggest architectural challenge was establishing a strict boundary: the AI extracts contractual definitions, but compiled TypeScript code calculates the penalty tiers and exact dollar splits.
- PayPal Authorization Lifecycle Nuances: Handling the distinction between PayPal's 3-day honor period and the overarching 29-day authorization validity window required designing a reliable state machine for multi-week retainer periods.
- Dual-Mode Simulator Architecture: Developing a robust internal simulator that accurately mirrors PayPal Orders v2 and Payments v2 responses, complete with realistic IDs, while maintaining identical interfaces for live sandbox API calls.
Accomplishments that we're proud of
- Complete End-to-End Core Loop: Successfully implemented the entire flow from contract paste, linting, PayPal authorization, live chaos injection, outage tracking, deterministic settlement, to dual capture/refund execution.
- Strict Financial Guardrails: Built an MCP server where autonomous agents can assist with contract operations without any possibility of hallucinating transaction amounts or stealing funds.
- Growth-Oriented Evidence Mode: Built a unilateral workflow where clients can generate court-ready proof packs and invite un-enrolled vendors to join the platform, turning client friction into organic platform growth.
What we learned
- Designing for Agentic Commerce: As AI agents begin conducting commercial operations, security lies in immutable code constraints rather than prompt engineering. Guardrails must exist at the tool schema level.
- Unilateral Value Creation: In two-sided platforms, software adoption accelerates when one side can derive complete standalone utility (such as Evidence Mode) before the second party ever signs up.
- Depth of PayPal Developer Platform: Gained deep practical expertise in PayPal's two-step authorization and capture architecture, partial captures, and void mechanics.
What's next for Retainer Referee.
- Multi-Cloud Synthetic Probing: Expanding the single-worker prober into a multi-region consensus network (monitoring from AWS, GCP, and Cloudflare simultaneously) to eliminate false positives from local ISP routing errors.
- Automatic 29-Day Reauthorization: Automating the PayPal Payments v2 reauthorization endpoint to seamlessly roll over retainers month-to-month without requiring client intervention.
- Multi-Vendor Enterprise Portals: Allowing engineering departments to monitor dozens of third-party vendors and API providers under a single dashboard with automated credit reconciliations.
Built With
- agentic-commerce
- ai
- express.js
- gemini
- mcp
- node.js
- openai
- paypal
- react
- sqlite
- tailwind
- typescript
- vite