# Rules for any agent working in `product/`

You are building a **game for a human designer**, using DevTune as a **product**.

## Shift start (every session — re-run)

1. Confirm workspace (`product/` or monorepo root that contains `product/`).
2. Read progress if present (`../INTEGRATION_PROGRESS.md` from product when monorepo).
3. Gates before claiming bootable (**fail closed**):
   - Monorepo: `node product/tools/battery.mjs product/games/<name>`
   - From `product/`: `node tools/verify.mjs games/<name>` (includes smoke)
4. Red gate → **stop**. Paste full command output to the human. Do not work around it.
5. Green → build **one** chunk. Re-read this spine when context feels thin.

## Cadence (long / multi-hour builds)

| When | Gate |
|---|---|
| End of every build chunk | `verify` |
| Every ~30–60 min | `verify` + smoke (or full `battery`) |
| Before “done” / demo claim | full `battery` — **gates decide done, not you** |

**Test ratchet:** never delete or empty smoke/verify/battery tests to go green.

## Allowed reading
- `BRIEF.md` · `docs/*` (STACK, PACKS, PROMPT, CHECKLIST, DUAL_WORLD, START_HERE)
- `scaffold/*` · `medium/**` · `games/**` · `RUN.md` · `README.md`
- Marathon files (`MARATHON.md`, `PASTE_TO_GROK.md`) **only if the human ordered a marathon**

## Forbidden
- Parent monorepo harness, STATE, session logs, shell implementation, testbeds (for “how DevTune works”)
- Raw Rapier worlds instead of `medium/physics`
- Central `CONFIG` objects imported across files
- Working around a red verify/smoke/doctor gate — stop and paste full output (step 6)

## Write only here
- `games/<name>/` — the game

## Non-negotiable
1. Copy `scaffold/` first; leave `src/substrate.js` unchanged.
2. String-literal thing ids + object-literal settings at the call site.
3. Packs for solids, character, follow camera — declare `tune` yourself and pass it in.
4. `collide()` for pack bodies so Make Solid does not dual-own (see `docs/DUAL_WORLD.md`).
5. Run verify (and smoke) after major passes; monorepo agents prefer `battery.mjs`.
6. No **C** as a game key (opens Design). Prefer not to bind **P F K Z G X Tab /** for game actions either.
7. **Never** `bind(id, this.group|root|world|level)` — bind **each mesh**.
8. Bind the **visible body mesh** for the player, not an empty Group.
9. **Pack import paths (product layout):** from `games/<name>/src/` use  
   `../../../medium/physics|movement|camera/pack.js`  
   (resolves to `product/medium`; browser URL `/medium/...` when served as `product/games/<name>`).  
   A game-local `medium` junction + `../medium/...` is an emergency fallback, not the preferred teaching.

## Feel layers (PD2)
- Namespaced things: `physics.world`, `physics.body.<id>`, `movement.<id>`, `camera.<id>`, plus game systems (`shift`, `cargo`, …).
- No single imported `CONFIG` bag for all feel.

## Feel snapshot (PD3)
- Use `medium/feel-snapshot.js` (or monorepo copy) to deep-merge a JSON snapshot **into existing** settings objects by identity — never replace the object the game already re-reads.

## Marathon mode (only if human asked)
If the human pasted `PASTE_TO_GROK.md` or ordered a full context burn: obey `MARATHON.md`  
(PLAN → BUILD → VERIFY → raise bar until ~99% context). **Not** the default for customer installs.

## Report
What you built · live vs deferred · gate output · what you could not own and why.
