01 designer
emits a full solved topology for the level.
Sonnet 5 (basic/advanced) · Opus 4.8 (complex)
→ builder
imn@dev:~/flow$ cat case-study.md
route the data. don't melt the cpu. a mobile puzzle game in a backend-developer aesthetic — and the LLM pipeline that designs its levels.
// the signal above is the whole game. hover to replay.
imn@dev:~/flow$ cat 01-what-it-is.md
you rotate pipe tiles — corners, tees, bridges, splitters — until the data flow reaches the sink. in the way: firewalls gated by boolean formulas (SW1∧SW2), one-way diodes, viruses that corrupt the stream, overheating tiles, and a patrolling saboteur AGENT that re-rotates your work.
difficulty runs BASIC → LEGEND. daily puzzles with streaks, leaderboards, achievements, RU/EN localization.
built with React Native / Expo + Supabase.
S source · D sink · ▦ firewall (SW1∧SW2) · ▷ diode · ✳ virus
// mock board — rotate tiles until the flow reaches the sink
imn@dev:~/flow$ cat 02-engine.md
packages/game is pure TypeScript with zero dependencies — no React, no Supabase, no Node builtins. the invariant is enforced by a unit test: if a dependency sneaks in, CI fails.
the same engine runs everywhere:
// packages/game/package.json
{
"name": "@flow/game",
"dependencies": {} ← enforced by a unit test
}imn@dev:~/flow$ cat 03-level-pipeline.md
a workflow, not an agent: four stateless stages, no tools, no memory for the models. all state lives in the database.
01 designer
emits a full solved topology for the level.
Sonnet 5 (basic/advanced) · Opus 4.8 (complex)
→ builder
02 builder
deterministically finalizes: canonicalization, rotations, scramble.
no LLM — pure code
→ evaluator
03 evaluator
BFS solver with witness solutions + difficulty metrics M1–M8. verdict: auto-accept / reject / borderline.
no LLM — solver + metrics
→ critic (borderline only)
04 critic
targeted repair of borderline levels.
Sonnet 5
↺ back to evaluator
structured output — Vercel AI SDK generateObject + Zod schemas at every stage boundary.
state — only in the DB. stages are stateless and restartable.
config — thresholds and prompts live in YAML, not code.
curation — human review loop via an internal /review UI.
imn@dev:~/flow$ cat 04-extra-legend.md
the hardest tiers don't go through the automatic pipeline. they're built manually: builder scripts + subagents, plus a separate prover that proves solution minimality — not "looks hard", but mathematically minimal.
// prover output
LEGEND pair 8 … minimality proven ∎ LEGEND pair 13 … minimality proven ∎ LEGEND pair 21 … minimality proven ∎
// proven, not vibes.
imn@dev:~/flow$ cat 05-takeaways.md
$ treat LLM systems as workflows with typed contracts — stateless stages, state in the DB, structured outputs validated at every gate.
$ keep the deterministic core dependency-free; let AI live at the edges.
$ evaluate before you ship — solvers, metrics and auto-accept thresholds beat manual QA.
$ human-in-the-loop where it pays: a /review UI turns curation into minutes.
// the same shape powers client pipelines: scraping → llm analysis → checks → review.