# Adaptive Loop A calm deterministic microfluidic strategy puzzle. Rotate three overlapping hexagonal loops to move culture chambers and redirect nutrient/toxin flow; each tick resolves growth, feeding, migration, evolution, and environmental pressure in a fixed order. Provoke adaptations, then exploit their costs. Five handcrafted scenarios form one campaign with persistent lineage traits (gifts and burdens). Deterministic: no runtime randomness. One pure serializable transition `nextState(state, action)` owns every rule and is shared identically by preview and commit. Exact save/load and action-replay reproduction are proven by tests. ## Stack Vite + TypeScript + Vitest + Playwright. No backend, no game engine, no downloaded assets, no network after install. Procedural SVG/CSS only. ## Install ```bash npm install npm approve-scripts esbuild # one-time: allow esbuild's postinstall (vite needs it) ``` ## Run / play ```bash npm run dev # dev server (Vite), open the printed URL # or production: npm run build && npm run preview # serves dist at http://127.0.0.1:4173 ``` **Controls**: select a loop rotation (click / focus / hover / tap) to preview exactly one turn, then press **Commit** (or Enter on Commit). The selection persists until you commit, pick a different rotation, or cancel (Escape). Keyboard, touch, and mouse all work. ## Build / typecheck / test ```bash npm run build # tsc --noEmit, then vite build → dist/ npm run typecheck # tsc --noEmit npm run test # vitest: behavior + solver/replay + persistence (fast) npm run test:e2e # Playwright black-box browser tests against the prod build npm run verify # typecheck + unit tests + build + e2e (the aggregate gate) ``` The unit suite is fast and deterministic. The heavy offline solver search runs once via `NODE_OPTIONS="--max-old-space-size=6144" npx tsx scripts/gen-solver-fixtures.ts` and its results are stored in `tests/fixtures/solver-results.json`; the solver test replays those routes to re-verify them. ## Project layout ``` src/domain/ types, constants (board topology), serialize, derived, pipeline (nextState), scenario, solver src/content/ declarative scenarios + species/pressure tables src/persistence/ versioned save/load + replay (localStorage adapter + in-memory for tests) src/presentation/ board geometry (three interlocking hexagonal rings) src/main.ts presentation controller (views, preview/commit, controls, a11y) src/styles.css procedural dark-lab aesthetic; responsive + reduced-motion tests/ behavior (truth), solver, persistence (+ fixtures/) e2e/ Playwright black-box browser proof scripts/ one-shot solver-fixture generator docs/ board-layout, scenario-tuning, brainstorming-summary ``` ## Scenario tuning & residual risk Some baselines/inheritance combos were solver-proven impossible and tuned within SPEC §9's permitted knobs (starting resources, fixture locations, ±1 thresholds). Every change is documented in `docs/scenario-tuning.md`, including one documented residual-risk class (inheriting producer Dormancy into the finale overgrows producers past the sustained ceiling). ## Post-exit (operator-owned — not part of the in-session freeze) The authoritative session JSONL is **not** copied or parsed during the run. After exit, the operator: 1. Records/links one uncut take following `RECORDING.md`. 2. DMs `PROMPT.md` per competition rules. 3. Copies the session JSONL from the path in `CONTEXT-MANIFEST.md`, then parses every `role:user` entry to classify provenance: one initial `pi-goal-prompt` kickoff reconstructs `PROMPT.md` (its `goal-state.text` byte-equals the file without the leading `/goal `), and every later user entry must be a matching disclosed `pi-goal-continuation` for the same objective/goal id (not a human follow-up). Verifies no `parentSession`. Hashes prompt and log copy. ## Steering context Authoritative spec: `SPEC.md`. Steering skills and the binding board-layout reference remain at their original project-local paths under `.agents/skills/` and `docs/`.