# DevTune product pack — open this folder in Grok

> **Horizon Courier** under `games/` is an **integration fixture** — do not wipe unless ordered.  
> Factory kit + monorepo CLI are **built**. Customer design: [`../CUSTOMER_PIPELINE.md`](../CUSTOMER_PIPELINE.md).  
> Joins: [`../INTEGRATION_AUDIT.md`](../INTEGRATION_AUDIT.md) · forever: [`../INTEGRATION_FOREVER_STATUS.md`](../INTEGRATION_FOREVER_STATUS.md).  
> Ops residuals closed as non-eng: [`PUBLISH.md`](PUBLISH.md) · [`PAYMENTS.md`](PAYMENTS.md) · [`PD4_HUMAN.md`](PD4_HUMAN.md).

**What this is:** the **product surface** an AI uses to build a three.js game that is
**born owned** — tunable in the DevTune desk the moment it boots. No archaeology.

**What this is not:** the full monorepo, harness history, or shell internals.
Do not invent a second engine. Build **with** this product.

---

## Open this as the Grok workspace

Point Grok (or any coding model) at:

```
…/devtune/product/
```

That directory is the whole answer for generation.

### Marathon (full context burn)

```powershell
cd …\devtune\product
.\launch-marathon.ps1
# paste PASTE_TO_GROK.md
```

Settings: **[`GROK_SETTINGS.md`](GROK_SETTINGS.md)** · project **`.grok/config.toml`** · user marathon knobs in `~/.grok/config.toml` (auto-compact 99%, long idle).  
Rules: **[`MARATHON.md`](MARATHON.md)** · paste block: **[`PASTE_TO_GROK.md`](PASTE_TO_GROK.md)**

### Play a product game (after AI build)

```powershell
cd …\devtune\product
.\start-desk.ps1
# or: .\start-desk.ps1 -Game horizon-courier -Port 5430
```

Runs **verify + smoke + doctor**, frees stuck ports, starts bridge, serves with `--shell`.  
Full desk path + red-gate table: **[`RUN.md`](RUN.md)**.  
**Desk behavior + shell function map (for UI redesign):** **[`CLAUDE_DESK_HANDOFF.md`](CLAUDE_DESK_HANDOFF.md)**.

---

## Read first (in order)

| # | File | Why |
|---|---|---|
| 1 | [`BRIEF.md`](BRIEF.md) | **This run’s game** — extensive AA brief |
| 2 | [`docs/STACK.md`](docs/STACK.md) | The four contracts. Complete. No prior knowledge. |
| 3 | [`docs/PACKS.md`](docs/PACKS.md) | Physics · movement · camera medium (default for walk-around games) |
| 4 | [`docs/PROMPT.md`](docs/PROMPT.md) | Generation rules + non-negotiables |
| 5 | [`scaffold/`](scaffold/) | Start here. Copy → `games/<name>/`. Match the shape. |
| 6 | [`docs/CHECKLIST.md`](docs/CHECKLIST.md) | Self-check before “done” |

**Optional detail (still product):** `medium/*/PHYSICS.md` · `MOVEMENT.md` · `CAMERA.md`

**Do not read for generation:** monorepo `TEAM_HARNESS/`, `STATE.md`, session logs, shell source, testbeds.

---

## Layout

```
product/
  README.md          ← you are here
  BRIEF.md           ← the AA game to build
  AGENTS.md          ← short rules for any agent in this folder
  docs/              ← STACK · PACKS · PROMPT · CHECKLIST
  scaffold/          ← copy to games/<name>/ and build into it
  medium/            ← physics / movement / camera packs (import these)
  vendor/rapier.mjs  ← solver (browser loads via host)
  games/             ← WRITE THE GAME HERE
  tools/             ← verify helper
  RUN.md             ← human: how to play with the DevTune desk after
```

---

## How the AI builds

```bash
# 1. Copy scaffold
cp -r scaffold games/horizon   # or PowerShell Copy-Item -Recurse

# 2. Implement the BRIEF into games/horizon/ using contracts + medium packs
#    - src/substrate.js  → copy unchanged
#    - import packs from ../../medium/physics/pack.js etc.

# 3. Static gate (from monorepo root — needs DevTune checkout)
node tools/verify.mjs games/horizon
# expect: ✓ BORN OWNED
```

Import pattern from a game under `games/<name>/src/`:

```js
import { thing, bind, collide } from './substrate.js';
import { ensurePhysicsWorld } from '../../../medium/physics/pack.js';
import { createMovementPack } from '../../../medium/movement/pack.js';
import { createCameraPack } from '../../../medium/camera/pack.js';

const RAPIER_URL = '/__devtune/shell/vendor/rapier.mjs';
```

⚠️ **Declare every `tune` with `thing('literal.id', { … })` at YOUR call site and pass it in.**
If the pack builds the settings object for you, the desk never sees the dials.

---

## How a human runs the desk (after generation)

**Prefer:** [`RUN.md`](RUN.md) · `.\start-desk.ps1` from `product/`.

Manual (monorepo root) only if splitting processes:

```bash
node bridge/bridge-server.js
node product/tools/verify.mjs product/games/<name>
node product/tools/doctor.mjs
node adapters/serve/serve.mjs product/games/<name> --port 5430 --shell
```

Open `http://127.0.0.1:5430/` · play · press **`C`** (Design).

---

## Success for this experiment

1. `verify` → ✓ BORN OWNED (0 fatal) **and** smoke/doctor green
2. Game is **playable** and feels like a small AA slice (not a spinning cube)
3. Desk fills with real pack + game dials; **live** knobs change feel
4. **Keep** one number → reload still true
5. Report what could **not** be owned and why

If the model needs monorepo lore to succeed, **the product docs failed** — log that residual.
