--- name: pi-game-factory description: Orchestrate a hands-off, one-prompt game build in Pi using vertical gates, one writer, independent review, and durable evidence. --- # Pi Game Factory ## When to Use Use for the Agentic Labs one-prompt challenge run. The parent owns scope, decisions, gates, and final acceptance. Subagents provide bounded implementation, review, and validation. ## Procedure 1. Create a todo list and keep exactly one task in progress. 2. Preflight legality: record the initial tree, reject unexpected code/history/generated artifacts, record effective provider/model, and create `CONTEXT-MANIFEST.md` covering all steering context, installed extension/package versions, and relevant configuration. 3. Record the current `PI_SESSION_FILE` path immediately. Verify it exists and begins with the initial Goal kickoff representing the sole human command. Never copy it live. At the end, report the canonical path plus a post-exit copy/parse/marker/hash command that distinguishes disclosed Goal continuations from human follow-ups. 4. Build vertically: runnable shell → complete scenario 1 → simulation truth tests → interacting adaptation systems → exact persistence → scenarios 2–5 → bounded polish → final audit. 5. Keep one writer for the active checkout. Parallelize only read-only review and validation. 6. Use Pi subagents through `workflowScript`. Give each task a concrete outcome, authority boundary, acceptance criteria, validation, and stop rule. 7. After each implementation milestone, run targeted checks. Launch fresh-context reviewers with distinct angles: correctness/determinism, user flow/accessibility, and simplicity/scope. 8. Synthesize findings. Send accepted fixes to one writer. Repeat broad review only while concrete defects remain, maximum three rounds. If a floor blocker remains, drop optional polish and allow one final focused repair/verification cycle. 9. Exercise the production browser game through public controls, not only tests. Verify start, rotation preview, committed resolution, adaptation benefit/cost/spillover, environmental response, win, collapse, retry, save, page close/reopen, exact Continue, scenario selection, and campaign completion. Never inject game state or localStorage to fake gameplay. 10. Finish only when every floor requirement and repository deliverable passes after the last code edit. Report commands, evidence, paths, final manifest/hash, and residual risks. ## Pitfalls - Never ask the human a follow-up. Resolve routine implementation choices autonomously from the brief. - Never let multiple writers edit the same checkout. - Never trade a complete game floor for optional polish. - Never trust a worker summary without inspecting the resulting files and running checks. - Never claim browser validation from HTTP success or screenshots alone; interact with the game. - Never add code after the final run ends. ## Verification - Build, typecheck, tests, lint, solver/replay checks, and black-box browser tests pass if configured. - The browser user flow demonstrates the required challenge mechanics without crashes or state injection. - `CONTEXT-MANIFEST.md` closes the disclosure boundary for prompt, local skills/context, installed extensions, hooks, subagent definitions, and effective configuration. - `PI_SESSION_FILE` is known; final instructions copy it only after exit, parse every line, prove no parent session, reconstruct the initial prompt from `goal-state.text`, verify every later user entry is a marked Goal-owned continuation rather than a human follow-up, and hash the result. - README, ASSETS, RECORDING, SPEC, context manifest, and every steering file are present before freeze.