Why Single Spending Limits Fail
Giving an AI purchasing agent a single total spending limit (e.g. $1,000) is hazardous: the agent can spend $920 on an overpriced component on day one. It is technically within budget, but the project is rendered impossible to finish.
The 5-Step Fiduciary Flow:
- Plan: AI breaks down the goal into named categories with reference price estimates.
- Sign: Owner signs the envelope; canonical SHA-256 hash locks the mandate.
- Propose: Agent proposes purchases against the active plan.
- Gate: 5 deterministic gates evaluate value-for-money and forward coherence.
- Pay or Deny: Passing purchases capture via the PayPal Orders v2 Sandbox API. Blocked proposals halt with zero PayPal calls made.
The Five Deterministic Value Gates (PDD §7)
Evaluated using pure TypeScript math in integer cents. An LLM never decides whether money moves.
- G1 Total Cap:
total_spent + quote > total_budget → DENY (TOTAL_CAP_EXCEEDED).
- G2 Category Cap: Exceeds category cap. If overflow fits in unused contingency, downgrades to
ESCALATE (CONTINGENCY_DRAW); otherwise DENY.
- G3 Proportionality:
quote / total_budget > 0.50 → DENY (SINGLE_ITEM_DOMINANCE); 0.30–0.50 → ESCALATE.
- G4 Value for Money: Compares quote against curated reference median.
ratio > 1.50 → DENY (PRICE_NOT_VALUE_FOR_MONEY); 1.15–1.50 → ESCALATE.
- G5 Forward Coherence: Verifies remaining budget covers required reserves for unfinished essential categories. If
remaining_after < required_reserve → DENY (PROJECT_LEFT_UNFINISHABLE).
PayPal Orders v2 Sandbox Integration
PrismPay integrates server-side with PayPal's Orders v2 API (api-m.sandbox.paypal.com/v2/checkout/orders) with intent CAPTURE.
- Principle 3 Invariant: A PayPal order is created strictly on
PASS or owner-approved ESCALATE. There is no standalone payment endpoint.
- Idempotency: Proposals with a captured payment cannot execute duplicate orders.
- Traceability: PayPal Order ID and Capture ID are permanently linked to the proposal in the audit trail.
Chain of Trust & Mandate Hashing
PrismPay implements the open Chain of Trust pattern as design inspiration:
- Canonical JSON Mandate Hashing: Category allocations are hashed via SHA-256. Any manual alteration in storage fails with
409 MANDATE_TAMPER_DETECTED.
- Append-Only Hash Chain: Events are chained via
event_hash = SHA-256(prev_hash + canonical_json(seq, type, payload, created_at)) from GENESIS, verifiable on demand.
Judging Criteria Alignment
- Technological Implementation: Server-side PayPal Orders v2 integration, deterministic testable gate engine, and schema-validated AI budget breakdown.
- Design: Unified dashboard cockpit with live updating envelopes, multiple pre-priced project scenarios, and clean verification drawers.
- Potential Impact: Solves runaway spending in autonomous purchasing agents.
- Innovation: Multi-category forward-coherence budgeting ("can the project finish?") rather than primitive single-limit cards.
- Presentation: Scripted walkthrough highlighting the trap denial and fair alternative resolution.