No Receipt, No Haunting: Testing 1990s USSD Banking with Kiro Property Tests and AI Callers

2026-12-05来源 dev.toEnglish

Written for **Kiroween 2026* (Resurrection category). AI disclosure: Ghost Callers was designed, specified, and built using Kiro IDE's spec-driven workflow, steering docs, hooks, and MCP tooling, with live eval runs powered by an LLM caller engine and re-verified deterministically offline.*

Silicon Valley wrote off USSD twenty years ago. Across Africa, hundreds of millions of people still use *737# and *919# menus on basic phones to move money, buy airtime, and pay bills with no smartphone and no data plan.

According to GSMA's State of the Industry Report on Mobile Money 2026 (2025 data), mobile money crossed 2.3 billion registered accounts and $2 trillion in yearly transaction volume, with 593 million accounts active in 30 days. Sub-Saharan Africa accounts for roughly two-thirds of that global value. (GSMA tracks mobile money overall rather than USSD sessions specifically, so treat those numbers as the size of the stakes, not a USSD session count.)

Building for USSD is unforgiving:

  • 182 septets per screen under GSM 03.38 / 3GPP TS 23.038 and 3GPP TS 23.090. Drop a single ₦ symbol into a reply and the whole screen flips to UCS-2, cutting your room roughly in half.
  • 10 seconds to reply to an Africa's Talking USSD callback with CON or END.
  • Hard session cutoffs (180 seconds on Kenyan operators per Africa's Talking's help centre) that kill calls mid-transfer for slow readers on weak 2G.

Most USSD flows get tested by a developer tapping keys on fast Wi-Fi. I built Ghost Callers to test them as the people who actually dial them, without taking an LLM's word for anything.

No Receipt, No Haunting

Ghosts testify. Code keeps the receipts.

Other DEV builders working on agent QA have hit the same wall. As Introducing DriftCatch — behavioural testing Framework for AI agents points out, an LLM's prose summary alone cannot prove what happened in a run.

In Ghost Callers, every caller is a JSON persona with a body (network profile like 2G-Weak or 2G-Rural, reading WPM, keypress speed, optional large-text paging) and a lens (which measurable bugs apply to them):

  • Mama Ngozi, a market trader on weak 2G speaking Nigerian Pidgin
  • Musa, an interstate driver on rural 2G who drops and redials, speaking Hausa first
  • Chidi, a partially sighted retired teacher on 3G urban using large-text mode

The LLM only plays the human: reading each screen, pressing keys, and complaining in the caller's voice. Plain deterministic simulator code measures every turn (over_length, slow_reply, session_timeout, deep_menu, no_way_back, unclear_confirmation, pin_exposed, double_charge, goal_not_completed).

After the visit, a pure offline Guard (packages/guard/src/guard.ts) checks every complaint without even looking at the model's prose text. A 300-run fast-check iff property verifies that no complaint slips past it:

const PROVABLE_BY_SAME_KIND = { over_length: true, slow_reply: true, session_timeout: true, deep_menu: true, no_way_back: true, input_kills_session: true, unclear_confirmation: true, pin_exposed: true, double_charge: true, goal_not_completed: true, } as const satisfies Record<EvidenceKind, true>; function judge( complaint: Complaint, byId: ReadonlyMap<string, readonly EvidenceItem[]>, ): Verdict { const cited = uniqueInOrder(complaint.cites); if (cited.length === 0) { return { complaint, verdict: "whisper", rule: 1, reason: "cites no measurement" }; } const measured = cited.filter((id) => byId.has(id)); if (measured.length === 0) { return { complaint, verdict: "whisper", rule: 2, reason: `cites ${cited.join(", ")}, which was never measured` }; } const claimed = claimedKindOf(complaint.kind); if (claimed === null || !isProvableKind(claimed)) { return { complaint, verdict: "whisper", rule: 3, reason: `'${claimed ?? "unspecified"}' isn't measurable` }; } const matching = measured.flatMap((id) => (byId.get(id) ?? []).filter((item) => item.kind === claimed)); if (matching.length === 0) { return { complaint, verdict: "whisper", rule: 4, reason: `cited measurements don't show ${claimed}` }; } return { complaint, verdict: "haunting", rule: 5, evidence: matching }; } 

Unproven complaints stay on screen greyed out as Whispers with the exact rule reason. Nothing gets silently swept away. Zero proven hauntings gives you LINE EXORCISED · 0 HAUNTINGS.

What Happened When I Ran the Eval (pnpm eval:score)

I built Haunted Bank *919# with two modes: Broken (8 planted bugs) and Fixed (0 planted bugs), plus a test-only ledger route so double_charge is checked against actual debits instead of guessed.

Twelve live runs sit committed as raw JSON in eval/runs/ (3 callers, 2 seeds each, broken and fixed). Running pnpm eval:score reproduces all 12/12 runs offline with zero LLM calls:

Metric Model alone (raw complaints) With Guard (proven hauntings)
Planted bugs found on Broken (of 8) 7 7
False alarms on Fixed (6 runs) 7 0
Whispers demoted n/a 10 (7 fixed, 3 broken)

On Broken *919#, the callers proved 26 hauntings across 7 of 8 planted bugs. On Musa's seed 18 run, rural 2G dropped the reply right after the bank recorded debit D1, so his redial opened a new session and debited D2 (E8: 2 debits of NGN 5,000 in one visit). On Fixed *919#, the raw model still invented 7 false alarms, and the guard demoted every single one to a whisper (0 false alarms).

Why You Still Need Both Property Tests and AI Callers

Like Lazarus: Proving a COBOL port is right, one penny at a time, I paired Kiro specs and hooks with property-based testing. Six dual-mode fast-check properties (seed 919, 100 runs each, drift-checked inside pnpm test) must pass on Fixed and fail on Broken:

Planted bug fast-check PBT Ghost Callers (Guard-proven)
over_length caught proved
deep_menu not caught proved
no_way_back caught proved
input_kills_session not caught not proved
slow_reply caught proved
unclear_confirmation caught proved
pin_exposed caught proved
double_charge caught proved
Total 6 of 8 7 of 8

Property tests catch universal protocol rules in under a second. deep_menu sits on the human side of the line: how many menus feel too deep depends on who is calling. Neither approach replaces the other.

Five Bugs Caught Before Shipping

I kept a dated build log in docs/KIRO_JOURNAL.md with every spec, steering doc, hook, and agent config committed under .kiro/. Five catches paid for the whole setup:

  1. Intl.NumberFormat silently breaking GSM-7: Spec review flagged that locale formatters can emit non-breaking spaces (U+00A0), which knock a USSD reply into UCS-2 and halve the character limit. I hand-wrote formatNaira instead.
  2. The 0000 PIN shrink: A naive "no PIN substring on screen" property failed on the fixed bank because fast-check generated PIN 0000, which matched the synthetic account number 0000000001. Splitting into PIN non-interference (Property 6a) and a literal check (Property 6b) kept fixed green and shrank broken cleanly to 0000 vs 0001.
  3. JSON escape spoofing (\u0045 3): A property test caught that \u0045 3 in a raw model reply decodes to E3 even though E3 never appeared as a literal token. Citation extraction now checks raw reply tokens.
  4. Partial PIN leakage on truncation: A unit test caught screenLabel slicing summaries at 40 characters before masking the PIN, turning 1234 into ...with PIN 12. It now masks, slices, and masks again.
  5. Kiro haunting its own bank over MCP: On the first live #MCP ghost_callers run, Mama Ngozi hit a bank-and-branch screen she didn't recognize and looped 1 -> 0 -> 2 -> 0 -> 3 -> 0 for ~100 seconds until the line dropped. I opened a real Kiro Bugfix Spec (caller-branch-loop), fixed the decision prompt rule without loosening the guard, and watched her push straight to the PIN screen and prove 5 hauntings.

The Kiro Setup Behind the Repo

  • 9 scoped steering docs (always, auto, and fileMatch), with persona-voice.md linking live to packages/callers/src/schema.ts.
  • 10 specs: 5 requirements-first, 2 Design-First (caller-engine, brick-phone-ui), 2 quick specs (ci-haunting, web-polish), and 1 real Bugfix Spec (caller-branch-loop), adding up to 1,564 passing tests.
  • 6 v1 Agent Hooks: a PreToolUse gate (no-real-numbers.json) that blocks real Nigerian phone numbers and API keys with exit code 2 before any file write lands, plus a PostTaskExec hook logging completed tasks to docs/TASK_LOG.md. (Windows gotcha: PowerShell 5.1's Set-Content -Encoding UTF8 writes a BOM that silently hides `.kiro/hooks/.json` from Kiro until you strip it.)*
  • Stdio MCP Server + Portable Kiro Power (power/) + Custom Agent (.kiro/agents/ghost-director.json) so any Kiro user can run the same Build-and-Haunt loop on their own Africa's Talking callback URL.

Try It Live

Open ghost-callers-ruddy.vercel.app with sound on. Watch Mama Ngozi, Musa, and Chidi hit *919# (drag the bottom radio-tuner rail to hear live synthesized DTMF tones), switch to Dial *919# Yourself, or drop your own CLI run.json onto the deck.

Inspired by my earlier project Ghost Visitors, which sends AI personas through websites. Ghost Callers is a brand-new project built from an empty repo for Kiroween 2026, for USSD instead of the web.

原文:https://www.a8q9.cn/en/article/no-receipt-no-haunting-testing-1990s-ussd-banking-with-kiro-property-tests-and-a-116ec9.html

相关文章