Inspiration

Independent food truck and pop-up retail vendors are the lifeblood of local culture, yet they operate in an unregulated financial blind spot. Our inspiration came from the devastating real-world story of Tanetta and Iyonna, the founders of Big Fat Vegan in Atlanta. Promised 40,000 attendees by a festival organizer, they invested $23,000 upfront ($6,000 in booth fees and $17,000 in food prep and staffing) plus a 30% gross revenue split. When the festival opened, foot traffic was a fraction of the claim and their booth was trapped in a dead-end bottleneck. They made $400 in total sales, losing over $25,000 in a single weekend.

Traditional banks and fintech underwriters refuse to offer working capital or turnout protection to pop-up merchants because static spreadsheets cannot model physical crowd bottlenecks, queue balking, or organizer hype. We built CrowdTwin so that before a vendor signs a contract—or an underwriter wires a single dollar of working capital—they can simulate the physical event day, interrogate the customers who walked away, and mathematically prove whether the booth can break even.

What it does

CrowdTwin is a dual-view spatial micro-economy simulator and autonomous underwriting engine triggered by a single public Eventbrite or Luma URL:

Live Event & Spatial Evidence Collection (Apify): When a user pastes an event URL, CrowdTwin scrapes platform ticketing tiers, RSVP counts, organizer track records (e.g., flagging organizers with 0 past events claiming massive attendance), and nearby restaurant price bands ($–$$$$). Every run carries an explicit LIVE | CAPTURED | MANUAL provenance badge so facts and assumptions never blur.

Spatial Map & Crowd Synthesis (Anthropic Claude): Supports both outdoor satellite maps and indoor floorplans on a unified 1000×1000 coordinate grid. Claude extracts walkable anchors (Entrance, Main Stage, Exit, Competitors) and synthesizes weighted customer persona archetypes with distinct wallets, hunger decay, category affinities, and queue patience limits.

60FPS Deterministic Rust Simulation (SpacetimeDB): Inside our SpacetimeDB Rust kernel, 300–500 autonomous customer agents navigate the venue, join FIFO queues, get served across parallel servers, or balk when wait times exceed their patience (⏳ Line too long!) or prices exceed their wallet (💸 Too pricey!).

Pause & Click-to-Interrogate: At any moment, a user can pause the simulation, click a specific customer dot who abandoned their line, and ask "Why didn't you buy?" Claude reads that agent's immutable DecisionEvent trace (exact observed wait time, patience threshold, price, and wallet in cents) to give a 100% grounded explanation with zero hallucination.

Dual-View Product Switcher:

View 1 — Vendor Commerce Sandbox (For Merchants / Visa): Merchants test counterfactual interventions—relocating their booth to a main stage artery, adding a parallel server (+$300 labor), or adjusting dynamic menu pricing—and rerun against the exact same per-agent random seeds to measure true conversion and P&L lift.

View 2 — Autonomous Underwriter Desk (For Risk Officers / Hyphenate): Executes a 45-run Monte Carlo batch (LOW, BASE, HIGH turnout scenarios across 15 seeds each) inside the shared Rust kernel, separates accounting Net Profit from Cash Balance (preventing inventory double-counting), and outputs a Factory Droid Underwriting Audit Diff (APPROVE, REFER, REJECT, or NEEDS_INPUT).

How we built it

  1. Factory Droid SDK (@factory/droid-sdk/node) — Autonomous Orchestration & Safety

CrowdTwin uses the official Factory TypeScript SDK at runtime as our constrained Underwriting Coordinator (droidCoordinator.ts), not a chatbot wrapper:

Designed Trigger: Launches automatically when a vendor submits an event URL and unit-economic draft (POST /api/jobs).

Strict Safety & Tool Isolation: Runs in an isolated working directory with AutonomyLevel.Off, a deny-by-default permission handler, and all built-in shell, file-edit, and arbitrary network tools disabled via disabledToolIds.

In-Process Narrow Tools: Registers stage-gated tools via createSdkMcpServer() and Zod 3 schemas (collect_event, draft_map, draft_personas, submit_world_draft, generate_risk_audit). Droid cannot bypass the human AWAITING_APPROVAL gate or overwrite deterministic Rust policy numbers.

Visible Plans, Steps & Diffs: Streams completed tool milestones over Server-Sent Events (SSE) and emits a human-auditable git-style Underwriting Diff comparing the rejected baseline exposure against a safe, capped counter-proposal.

  1. SpacetimeDB + Rust (crates/spacetime-module) — Authoritative Real-Time Engine

Our simulation state lives entirely inside SpacetimeDB compiled from Rust to WebAssembly:

6 Public Tables: RunState, AnchorNodeRow, BoothRow, CustomerAgentRow, DecisionEventRow, and ScenarioResultRow.

Paired-Seed Determinism: Uses a pure splitmix64 PRNG hashed per (seed, agent_id, purpose_tag). When a vendor adds a second server or changes their price, Customer #142 still arrives at the exact same second with the exact same wallet and patience—guaranteeing a mathematically fair A/B comparison.

Shared Live & Batch Kernel: The same Rust logic drives both the live interactive ticks (step_simulation) streamed to React via auto-generated TypeScript bindings and the synchronous Monte Carlo scenario batch (run_batch_scenarios).

  1. Apify (apify-client) — Grounded Web & Spatial Telemetry

Uses memo23/eventbrite-scraper for direct Eventbrite and Luma (lu.ma / luma.com) event URLs with strict hostname parsing (new URL()) and bounded parameters (maxItems: 1, enrichOrganizer: false).

Enriches venue coordinates with compass/crawler-google-places to ground local food competition and price bands.

Records immutable actorRunId, capturedAtIso, and provenance metadata on every EvidenceRecord, with an automatic disk-caching fallback (fixtures/captured-event.json) for transparent resilience.

  1. Anthropic Claude — Structured Vision, Personas & Trace-Grounded Inspection

Powers three strictly typed specialist roles: A2 Map Specialist (extracting normalized 0..1000 venue anchors), A3 Crowd Specialist (synthesizing weighted PersonaArchetype distributions), and A4 Decision Inspector (translating recorded DecisionEventRow numbers into natural first-person customer feedback).

  1. How Mana.space Changed What We Built

We used Mana.space as our architectural control plane to stress-test our system design before writing code. Mana directly changed our engineering direction in four concrete ways:

Caught an Incompatible Apify Actor Schema: We initially planned to use matyascimbulka/luma-event-scraper for Luma links. Mana inspected the input schemas and caught that it only supports city/category discovery—not direct event URLs—and redirected us to memo23/eventbrite-scraper, which natively supports both direct Eventbrite and Luma URLs.

Eliminated Double-Counted Inventory Accounting: Mana identified that subtracting upfront inventory spend ($17,000) and consumed unit COGS in a single metric double-counted vendor costs. Because of Mana, our Rust engine tracks Net Profit (revenue - consumed COGS - fees - fixed costs) separately from Cash Balance (sales cash - total inventory cash outlay - fees - fixed costs).

Prevented Global RNG Drift in Counterfactual Runs: Mana pointed out that a single global RNG shifts every subsequent customer's traits after the first changed queue decision. We redesigned our Rust kernel around per-agent seeded RNG streams (splitmix64).

Enforced Honest Provenance (LIVE / CAPTURED / MANUAL): Instead of silently falling back to mocked data when a live scrape takes longer than 15 seconds on stage, Mana guided us to build explicit provenance badges and a human approval gate (AWAITING_APPROVAL).

Public Mana Project & Blueprint Links: Brainstorming and refining the workflow approach: https://www.mana.space/home/cwaWYKmyeZTs7SX0NlXLP8V93Ec2/brainstorm Prototype building: https://www.mana.space/home/cwaWYKmyeZTs7SX0NlXLP8V93Ec2/apps/crowdtwin Live Demo Preparation: https://www.mana.space/shared-chats/cwaWYKmyeZTs7SX0NlXLP8V93Ec2/001792870910372ef9536d9579746f4a631

Challenges we ran into

Deterministic Paired Comparisons in Spatial Crowds: In an agent-based simulation, changing a booth's prep time from 90s to 45s alters when the first customer leaves the queue. With a naive random number generator, that single change cascades and randomizes the entire crowd. Implementing stateless splitmix64(seed, agent_id, purpose) streams in Rust solved this cleanly.

Preventing LLM Hallucination in Financial Auditing: If an LLM is allowed to invent attendance counts or calculate profit, its underwriting decision cannot be trusted. We enforced a strict boundary: Apify collects evidence, the human approves the WorldSpec, Rust computes all queue physics and integer-cent financials, deterministic TypeScript code evaluates the policy verdict (APPROVE / REFER / REJECT), and Claude + Factory Droid explain the verified numbers.

Accomplishments that we're proud of

Building a genuine hybrid Rust + TypeScript architecture where live spatial agent physics and 45-run Monte Carlo batches execute inside SpacetimeDB with zero external database dependencies.

Turning a tragic real-world small business failure (Big Fat Vegan's $25,000 festival loss) into an interactive simulation where anyone can see why the baseline setup fails (-$24,600 loss due to queue balking and a 30% organizer cut) and discover a counter-proposal that actually breaks even.

Wiring @factory/droid-sdk/node with production-grade security isolation (AutonomyLevel.Off, disabled shell/file tools, and scoped in-process MCP tools).

What we learned

How to bridge WebAssembly-compiled SpacetimeDB Rust modules with auto-generated TypeScript SDK bindings and HTML5 Canvas interpolation.

How to design trace-grounded AI explanations (DecisionEvent) where LLMs act as interpretable lenses over deterministic simulation state rather than unconstrained chatbots.

Why separating observed platform evidence (platformRsvpCount), promoter claims (organizerClaimedAttendance), and modeled assumptions is essential for real-world underwriting.

What's next for Crowdtwin

Parametric Event Turnout Protection: Partnering with merchant cash advance and micro-insurance providers to automatically bind working-capital advances and weather/turnout protection policies directly from an approved CrowdTwin AuditReport.

POS Hardware Feedback Loop: Integrating live square/stripe terminal transaction timestamps during the festival to recalibrate queue service times in real time and alert vendors when to deploy backup staff.

Built With

Share this project:

Updates

Submission history