Inspiration Over 80% of small agencies and dev studios fail not from a lack of talent or work, but from cash flow volatility. When client payments arrive late, agency owners face an existential dilemma: do they wait, work at risk without being paid, or pull developers onto other projects? A single wrong guess means bouncing employee payroll. Today, owners try to manage this panic with spreadsheets and intuition. We built Ballast to turn cash flow defense into an autonomous, mathematically solved equation. What It Does Ballast monitors unpaid client milestones and simulates the operational and financial ripple effects across the entire agency:

  1. Constraint-Based Scheduler: Formulates 4 distinct, mathematically valid recovery plans:
  2. Plan A (Wait): Maintain status quo; 100% chance of missing Day 14 payroll.
  3. Plan B (Reallocate Capacity): Reassigns developer Asha to client Brightly, accelerating its build to unlock a $4,000 milestone on Day 13—right before Day 14 payroll, slashing payroll breach risk to 34%.
  4. Plan C (Work At Risk): Waives the payment gate to protect the deadline, but risks $1,800 in unpaid labor against client default risk.
  5. Plan D (Early-Pay Incentive): Offers a 3% discount ($180 off) to settle immediately for $5,820.
  6. 2,000-Run Monte Carlo Simulation: Replays each plan against 2,000 simulated futures using empirical client payment reliability distributions (on-time, late, default) to compute exact Value-at-Risk metrics.

  7. Interactive What-If Stress Testing: A real-time slider executes 2,000 runs in less than 200ms in the browser with zero server latency.

  8. Bryntum Gantt Integration: Dynamically visualizes task dependencies, resource reassignments, splittable tasks, and payment gates alongside a real-time cash liquidity curve.

  9. Governed Google Gemini AI: Synthesizes trade-offs, recommends optimal plans, and drafts client messages across Diplomatic, Firm, and Urgent tones. Enforces a zero-hallucination validation layer that rejects any generated text with unverified figures.

  10. PayPal Payment Rails: Connects to PayPal Orders v2 with dynamic discounting (Plan D), listens for cryptographically verified PAYMENT.CAPTURE.COMPLETED webhooks, and commits to an idempotent, forward-only ledger to reflow the agency back to safety. How We Built It

  11. Frontend & Visualization: Built with Vite and the Bryntum Gantt enterprise component, paired with an SVG cash balance runway chart.

  12. Engine & Monte Carlo: Pure deterministic JavaScript module running in both Node.js and client-side browsers using a Mersenne-Twister PRNG.

  13. AI Intelligence: Google Gemini 2.5 Flash with structured JSON output, wrapped in a programmatic number validator (validateExplanation).

  14. Payment & Security Infrastructure: PayPal Orders v2 API, webhook HMAC signature verification via PayPal's verify-webhook-signature endpoint, and an idempotent forward-only ledger state machine (src/ledger.js).

  15. Production Hosting: Full-stack Node.js deployment live on Render. Challenges We Faced

  16. Zero-Hallucination AI Governance: Ensuring Gemini never invented dates, dollars, or probabilities required designing an AST/regex number parser that cross-references every single number against the deterministic engine before text is shown.

  17. Idempotent Webhook Rails: Designing a forward-only state machine that cleanly handles out-of-order webhook deliveries, duplicate retries, and multi-tab browser redirects without double-counting transactions. Accomplishments We're Proud Of

  18. Running 2,000 Monte Carlo simulations in under 200ms directly in the browser for smooth, zero-latency slider interactions.

  19. Seamless end-to-end recovery: approving Plan D creates a discounted $5,820 PayPal checkout, and upon webhook verification, the entire Gantt schedule and cash curve instantly turn green ("Back on track"). What We Learned

  20. How combining predictive simulation with autonomous LLM reasoning creates actionable decision systems that business owners can actually trust with their payroll.

  21. The power of enterprise Gantt components (Bryntum) when paired with reactive payment rails. What's Next for Ballast

  22. Connecting to live accounting integrations (QuickBooks, Xero) to pull real invoice history.

  23. Training reinforcement learning models on historical client payment patterns to dynamically calibrate early-pay discount percentages.

Built With

Share this project:

Updates

Submission history