Inspiration
In Taiwan's temples, people draw a fortune stick from a tube, then throw two moon blocks — Pua-h-pue (擲筊) — to confirm the stick is really theirs. One flat, one round: the gods say yes. Both flat: the gods are laughing, ask again. Only after a divine yes may you open the poem.
That ritual is a random number generator with a built-in validation loop — an array of 60 sticks, a random draw, a map from stick number to poem, and a verify-before-commit step that modern software would recognize instantly. We wanted to rebuild it as a decision tool for the questions people keep re-asking at 2 a.m. — should I take the new job? — where the ritual friction itself is the point: it slows you down and makes you state your question clearly before any answer appears.
What it does
- You contemplate your question, shake the tube, and one of 60 sticks falls — server-side, CSPRNG-backed.
- You throw the moon blocks. Sheng bei (one flat, one round) confirms the stick; both flat means rethrow; both round means redraw; a standing block doesn't count. Maximum 3 draws — then the temple stops answering.
- Only after a divine yes does the poem open: one of the sixty Jiazi fortune poems, with plain-language interpretation in English and Traditional Chinese, plus its fortune grade and source attribution.
- A bundled three.js ritual stage plays the shake, the throw, and the cabinet reveal — the server decides every result; the front end only performs it.
How we built it
Spec-first in Kiro, one mechanic per spec: 18 specs in .kiro/specs/ (rng-engine, moon-block-throw, stick-draw, poem-catalog, poem-content, ritual-session, ritual-http, fortune-reveal, scene-foundation, stick-shake-animation, and more), each written as requirements (EARS) → design → tasks before code. Temple rules live in Kiro steering: no poem without confirmation, three draws and the gods go silent, server-side RNG only. Kiro hooks validate the poem catalog on every change and run the build-time translation pipeline. Laravel Boost runs as an MCP server so the agent reads real Laravel documentation instead of guessing. Pest (including property-based tests on RNG fairness and ritual invariants) and Larastan guard every commit in CI.
Kiro features used:
- Specs: 18 specs in .kiro/specs/, one per mechanic, each requirements (EARS) → design → tasks → code → tests; 43+ commits in one build day (2026-12-04), spec-before-code throughout.
- Steering: encodes the temple ritual rules — one throw per draw, divine-yes success, max 3 draws, standing block not counted, server-side RNG only, English-first UI.
- Hooks: poem-catalog validator, poem-translate build-time pipeline, spec-test-skeleton.
- MCP: Laravel Boost MCP configured in .kiro/settings/mcp.json.
AI works at build time only — interpretations and English translations are generated during development, reviewed, and stored as static data — so the app itself runs free, forever, with no runtime AI cost.
The 60 poem texts are the traditional public-domain sixty Jiazi poems, following the widely used Taiwan temple version compiled by Taiwan Hao Miao Wang (temples.tw/stick/fs60), cross-checked character-by-character against two independent transcriptions; each record carries its source and a named reference fortune grade.
Challenges we ran into
- Encoding a ritual as a state machine without flattening it: the standing-block exception, the exact 3-draw circuit breaker, and "no poem without a divine yes" all had to become testable invariants.
- Keeping randomness honest: client-side animation must never decide outcomes, so every result is computed server-side and the 3D stage only plays back the server's stick.
- Sourcing 60 poems responsibly: temple versions differ by transcription variants, and fortune grades have no unified standard — we cross-validated three sources, recorded variants, and attribute every grade to its named source instead of inventing one.
Accomplishments that we're proud of
- A complete ritual loop running end-to-end: contemplate → draw → throw → confirm → reveal, with the poem unreachable before a divine yes.
- Property-based tests proving the ancient RNG is still fair: uniform 1..60 draws and exact moon-block odds (199:199:2 including the rare standing block).
- 60 poems published with source attribution, fortune grades, and reviewed English translations — generated at build time through a Kiro hook pipeline.
What we learned
Steering docs are where a domain's unwritten rules become enforceable: writing "the temple stops answering after three draws" as steering turned a cultural norm into a circuit breaker the agent never violated. Spec-per-mechanic kept a one-night build coherent — each spec stayed small enough to finish, test, and commit before the next began.
What's next
Decision journal (log every question and come back later to grade the god), shareable result links, a poem MCP server so other agents can query the catalog, and the remaining animation specs (block toss, slip cabinet) already written in .kiro/specs/.
Primary working app: https://kiro2026.dindin168.com
Standalone 3D prototype: https://kiro2026.dindin168.com/demo/