Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

feat(store): seven creative workspaces and live viewer fixes

Dee75bb7dce29f6
diff --git a/.github/workflows/experience-checks.yml b/.github/workflows/experience-checks.yml
new file mode 100644
index 000000000..5da706e1a
--- /dev/null
+++ b/.github/workflows/experience-checks.yml
@@ -0,0 +1,31 @@
+name: Experience checks
+
+on:
+ pull_request:
+ paths: ['store/**', '.github/workflows/experience-checks.yml']
+ push:
+ branches: [main]
+ paths: ['store/**', '.github/workflows/experience-checks.yml']
+
+permissions:
+ contents: read
+
+jobs:
+ models-and-viewer:
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
+ with:
+ node-version: '22.23.2'
+ - name: Verify generated artifacts match reviewed sources
+ run: node store/tools/build-experiences.mjs --check
+ - name: Check models, packages and viewer behavior
+ run: >-
+ node --test
+ store/tools/experience-tests/models.test.mjs
+ store/agents/{voxel-worlds,generative-art,music-studio,creative-direction,drone-pilot,game-master,lab-bench}/test/*.test.mjs
+ store/viewers/web-viewer/test/*.test.mjs
+ - name: Validate Store catalog
+ run: node store/tools/catalog.mjs
diff --git a/.gitignore b/.gitignore
index 166356fb3..3957239f6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -106,3 +106,6 @@ TODO.local.md
# pi agent task logs
.pi/
+
+# Reproducible browser runs; reviewed Store screenshots live under store/showcase.
+work/experience-evidence/
diff --git a/HANDOFF.md b/HANDOFF.md
new file mode 100644
index 000000000..a86cf007a
--- /dev/null
+++ b/HANDOFF.md
@@ -0,0 +1,51 @@
+# Harness experience release handoff
+
+Work in `/private/tmp/harness-store-voxel`, branch `codex/harness-store-voxel`.
+The main checkout is shared with other sessions; leave it alone.
+
+The branch now contains seven original, offline, editable experiences and an updated shared web
+viewer. These replace the earlier placeholder artifacts. See [verification](work/VERIFICATION.md),
+[performance](work/PERFORMANCE.md) and the [audit](work/REVIEW.md) for the evidence and its limits.
+
+| Store harness | Starter | User capability |
+|---|---|---|
+| `autonomous/voxel-worlds` | Tidelands | Walk, build, explore, change daylight, save and restore an island |
+| `autonomous/generative-art` | Fieldwork | Explore reproducible print editions and export large PNGs |
+| `autonomous/music-studio` | Afterhours | Edit five tracks, arrange finite music and export a WAV |
+| `autonomous/creative-direction` | Forme | Shape a coordinated identity and export SVG art and design tokens |
+| `autonomous/drone-pilot` | Vector | Fly a canyon course, study the autopilot and export telemetry |
+| `autonomous/game-master` | Relay | Compare strategies, replay matches and run a 32-map tournament |
+| `autonomous/lab-bench` | Signal | Change a synthetic experiment, inspect statistics and export observations |
+
+## Source and verification
+
+Reviewable sources live in `store/tools/experiences/`. Run
+`node store/tools/build-experiences.mjs` after source edits and `--check` to detect drift.
+Generated template artifacts are self-contained HTML. Each installed workspace also has
+`node tools/check.mjs --seeds 100`, which tests the model extracted from its actual edited HTML.
+No runtime package install, remote model API, CDN or paid service is required for the starter.
+
+Use `store/tools/experience-tests/README.md` for the model, browser, performance and running-daemon
+checks. The old scripts in `work/` delegate to these portable checks. Raw screenshots/downloads
+are ignored under `work/experience-evidence`; reviewed Store images live under `store/showcase`.
+
+The iframe bug is fixed in `store/viewers/web-viewer/preview.html`: trusted workspace apps get
+same-origin APIs, forms, downloads and pointer lock. The shell also preserves seeds, supports
+paused automatic refresh, reports errors and recovers from a missing artifact. Scripts plus
+same-origin access are **not an isolation boundary**; the viewer README states this explicitly.
+The server still restricts hosts, paths, hidden files, symlinks and request methods.
+
+## Installation and publishing
+
+All seven agents and the viewer were installed with absolute `--link` paths to this worktree for
+real daemon integration tests. New local workspaces use those files. Existing workspaces keep
+what was already materialized; updating a package does not overwrite a person's artifact.
+
+The user explicitly requested publication to the Harness Store. Publish through a reviewed
+source diff/PR to `main`; the **Publish Store catalog** workflow writes the `store-catalog`
+branch. Verify the live catalog's package refs, actual artifact bytes and screenshot URLs before
+reporting publication complete. No additional user confirmation is required for this release.
+
+Never repeat the earlier “100% browser coverage” or “106 ms painted preview” claims. The first
+measured Node helpers; the second observed a URL change. Current checks cover finite samples and
+actual browser controls, with measured save-to-ready-and-paint timings in the performance report.
diff --git a/claude_research.md b/claude_research.md
new file mode 100644
index 000000000..3d61b0804
--- /dev/null
+++ b/claude_research.md
@@ -0,0 +1,50 @@
+# Research review: seven interactive creation harnesses
+
+Reviewed 2026-09-19. This replaces the earlier speculative research narrative, preserved in Git
+history. That narrative mixed possible projects with unsupported model names, rankings, release
+claims and license conclusions. Those claims are not used as evidence for this release.
+
+The product decision is to give people a working creative system they can direct in plain language,
+inspect, change and export. Each starter uses original code and browser APIs; none incorporates
+third-party engine code or promises access to physical equipment or hosted model services.
+
+| Harness | User capability | Artifact and feedback loop |
+|---|---|---|
+| Voxel Worlds / Tidelands | Build a place and inhabit it | Offline WebGL island, collision, block editing, day/night, save and restore |
+| Generative Art / Fieldwork | Design a reproducible edition | Three geometric systems, named random streams, palette controls, print export |
+| Music Studio / Afterhours | Compose and keep a track | Editable score, synthesized PCM, a finite arrangement, mix controls, WAV |
+| Creative Direction / Forme | Make a coherent visual identity | Coordinated poster/type/palette systems, contrast measurement, SVG and tokens |
+| Drone Pilot / Vector | Explore control policies through flight | Fixed-step gate course, manual/autopilot handoff, telemetry, repeatable runs |
+| Game Master / Relay | Test strategic ideas against evidence | Finite matches, replayable decisions, competing policies, seeded tournaments |
+| Lab Bench / Signal | Investigate an experiment | Explicit synthetic model, observations, regression, uncertainty, CSV |
+
+## Sources and what they establish
+
+- [tiny-world-builder](https://github.com/jasonkneen/tiny-world-builder) is an upstream browser-world
+ project and an inspiration for the domain. No code from that project is bundled here. Its
+ existence is not evidence for any particular model's benchmark ranking.
+- [p5.js: randomSeed](https://p5js.org/reference/p5/randomSeed/) documents repeatable random sequences
+ from a seed. Our implementations use their own named PRNG streams and directly test repeatability.
+- [MDN: Web Audio](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API) documents browser
+ audio graphs and playback. Afterhours uses its own deterministic PCM synthesis and Web Audio
+ playback, with no sample downloads, GPU model or external service.
+- [MDN: Pointer Lock](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API) documents
+ first-person mouse input and the iframe permission it requires. Tidelands also supports dragging
+ and visible movement controls.
+- [MDN: iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe)
+ documents the sandbox permissions relevant to forms, same-origin APIs, pointer lock and
+ downloads. Our regression reproduces sibling-fetch, localStorage and module loading through the
+ real viewer. The viewer runs trusted local workspace code and is not an isolation boundary.
+
+## Engineering conclusions, supported by this branch
+
+A beautiful waiting screen does not confer a capability. The earlier seven placeholders and
+URL-change-only E2E were insufficient. Each starter now begins as an actual working artifact,
+contains a reusable pure model, exposes meaningful controls, and produces an export the user owns.
+
+The model checker is copied into every workspace. It reads the user's actual edited HTML,
+exercises seeds and writes evidence. Browser behavior and presentation are verified separately.
+Coverage of a Node helper does not establish coverage of a browser artifact or shell subprocess.
+
+See [work/REVIEW.md](work/REVIEW.md) for the audit and
+[the test guide](store/tools/experience-tests/README.md) for reproducible verification.
diff --git a/store/agents/creative-direction/AGENTS.md b/store/agents/creative-direction/AGENTS.md
new file mode 100644
index 000000000..54e1a31f3
--- /dev/null
+++ b/store/agents/creative-direction/AGENTS.md
@@ -0,0 +1,65 @@
+# Creative Direction harness
+
+You turn a look-and-feel brief into a **deterministic, seedable living moodboard**
+in one self-contained `board/index.html`. The pane renders it live, so the person
+sees the direction — and a re-seed — as you work.
+
+## What a good board is
+
+- **One file, offline.** All rendering inline (CSS + canvas). No CDN at runtime.
+ A `?seed=` query param selects the version: the same seed always renders the same
+ board on this machine.
+- **Direction, not decoration.** A moodboard is a *decision*: a palette, a type
+ pairing, an image grid, a layout system, and a one-line rationale for each.
+ Make choices visible and justified, and read them off a seeded PRNG so a new
+ seed proposes a genuinely different direction.
+- **Determinism is the product.** Seed a PRNG, name sub-streams (palette, type,
+ layout), and render the same board at preview and print size.
+- **Be honest about verification.** Same-machine reproducibility is checkable.
+ Cross-machine color rendering is *not* bit-identical — say so in the verdict.
+
+## How to work so the pane moves
+
+1. **Save within a minute.** Materialize `board/index.html` rendering a simple
+ seeded composition (a palette swatch row + one type sample), so the header has
+ a state and the pane can load it.
+2. **Build the system, then the direction.** Get seeded-PRNG + render-at-any-size
+ right first; only then tune the mood, type, and palette.
+3. **Verify like a designer:** load a few seeds, screenshot the actual output
+ (not the editor), look, adjust, re-render. The camera is the referee.
+4. **Update `.harness/verdict.json`** at every check — `ready`, one-line `summary`,
+ `phases`, `findings`, and a reproducibility note.
+
+## Rules
+
+- A direction is only "ready" when a grid of seeds all render clean: no blank board,
+ no unreadable type, no blown-out palette. Census the seed range you promise.
+- Tag every crafted decision USER vs AI in `board/DESIGN.md`
+ (`YYYY-MM-DD | USER|AI | topic | decision | still in build?`).
+- The `summary` says plainly what is reproducible now and what is not.
+
+## Shipped experience and operating standard
+
+The workspace starts with **Forme**, a working experience, not an empty placeholder.
+Three complete art directions, live brand name, palette lock, computed text contrast, SVG poster export, JSON design tokens.
+
+- Read the existing artifact before replacing it. The useful model boundaries are directionModel, contrast, brandSVG; keep all user text escaped.
+- Preserve working interactions and exports when extending the artifact. Match the user's brief;
+ the starter's genre and visual style are examples, not a ceiling.
+- Expose meaningful domain controls and outputs. Every control must change real state; every
+ displayed metric must be computed from that state. Never invent model activity or test results.
+- Use named random streams and a fixed simulation/score clock. Sample seeds, repeat the same
+ seed, inspect exported data, and verify keyboard/touch controls in the actual viewer.
+- This HTML runs with same-origin APIs in the shared viewer. Sibling fetches, localStorage,
+ downloads and pointer lock are available. Keep files portable and support direct opening.
+- Do not equate an existing HTML file, a successful reload, or a source-string test with a usable
+ result. `seed-verdict.sh` deliberately keeps `ready:false`; write `ready:true` only after your
+ checks establish it. Record exact commands, sampled seeds, observations and limitations.
+- Never claim a test coverage percentage for browser code based on Node subprocess tests.
+
+## Check your actual edited model
+
+Run `node tools/check.mjs --seeds 100` in the workspace. It reads the pure model from
+`<script id="harness-model">` in the artifact, checks domain invariants, repeats each seed, and
+writes `.harness/model-check.json`. Preserve that script boundary when editing. Model checks are
+followed by browser interaction, exported-output inspection, and visual or listening review.
diff --git a/store/agents/creative-direction/README.md b/store/agents/creative-direction/README.md
new file mode 100644
index 000000000..c01ca02e8
--- /dev/null
+++ b/store/agents/creative-direction/README.md
@@ -0,0 +1,42 @@
+# Creative Direction — Forme
+
+Build a coherent visual identity with coordinated posters, typography and palettes. Compare art directions, lock colors, customize a name, and export SVG posters and design tokens.
+
+## Try it
+
+> Create a coastal identity for COVE STUDIO: mineral green, warm paper, an expressive serif, and a poster that feels like a place to stay.
+
+The starter already works before the first prompt. Change it with the agent, interact with the
+result in the pane, and keep the output. Everything needed at runtime is in `board/index.html`.
+It works offline and can be opened outside Harness.
+
+## What you can do
+
+Three complete art directions, live brand name, palette lock, computed text contrast, SVG poster export, JSON design tokens.
+
+## Build on the starter
+
+The model functions `directionModel`, `contrast` and `brandSVG` are the starting points for substantive changes. Preserve seed
+reproducibility and user controls while changing the domain behavior. A different brief can replace
+this starter's entire visual language. Keep the artifact self-contained and test the actual result.
+
+The source checkout builds these starters with `node store/tools/build-experiences.mjs`. Installed
+workspaces are editable HTML; no build tool, network dependency or paid service is required.
+
+## Verification
+
+Model census: `node --test store/tools/experience-tests/models.test.mjs` from the source checkout.
+Browser interactions, exports, same-origin APIs and manifest routing: see
+[`store/tools/experience-tests`](../../tools/experience-tests/README.md).
+
+`seed-verdict.sh` establishes only artifact presence and keeps `ready:false`. The agent must run
+and record real domain and browser checks before writing a ready verdict. No cross-device pixel or
+audio equality is promised. The research is inspiration; this is original code, not a wrapper of
+any cited third-party engine.
+
+## Check your actual edited model
+
+Run `node tools/check.mjs --seeds 100` in the workspace. It reads the pure model from
+`<script id="harness-model">` in the artifact, checks domain invariants, repeats each seed, and
+writes `.harness/model-check.json`. Preserve that script boundary when editing. Model checks are
+followed by browser interaction, exported-output inspection, and visual or listening review.
diff --git a/store/agents/creative-direction/harness.json b/store/agents/creative-direction/harness.json
new file mode 100644
index 000000000..f82c795e8
--- /dev/null
+++ b/store/agents/creative-direction/harness.json
@@ -0,0 +1,32 @@
+{
+ "spec": 1,
+ "id": "autonomous/creative-direction",
+ "name": "Creative Direction",
+ "category": "Design",
+ "author": "Autonomous",
+ "description": "Build a coherent visual identity with coordinated posters, typography and palettes. Compare art directions, lock colors, customize a name, and export SVG posters and design tokens.",
+ "engine": "claude",
+ "workspace": {
+ "template": "template",
+ "marker": "board/index.html",
+ "init": "toolchain/init-workspace.sh"
+ },
+ "agent": {
+ "instructions": "AGENTS.md",
+ "skills": [
+ "skills"
+ ]
+ },
+ "toolchain": {
+ "setup": "toolchain/setup.sh",
+ "doctor": "toolchain/doctor.sh"
+ },
+ "viewer": {
+ "use": "autonomous/web-viewer",
+ "artifactExtensions": [
+ ".html"
+ ],
+ "url": "http://127.0.0.1:${port}/?file=${artifact}"
+ },
+ "verdict": ".harness/verdict.json"
+}
diff --git a/store/agents/creative-direction/skills/direct/SKILL.md b/store/agents/creative-direction/skills/direct/SKILL.md
new file mode 100644
index 000000000..80e0a4fe6
--- /dev/null
+++ b/store/agents/creative-direction/skills/direct/SKILL.md
@@ -0,0 +1,73 @@
+---
+name: direct
+description: Build a deterministic, seedable creative direction / moodboard in one HTML file from a look-and-feel brief. Use whenever the user asks for a moodboard, a brand look, a palette, a film grade, a style direction, or prompt-to-design.
+---
+
+# direct
+
+Take the brief and produce a **single self-contained `board/index.html`** that renders
+a **deterministic, seedable** living moodboard, loading the seed from a `?seed=`
+query param so the web-viewer can preview the current seed and re-seed live.
+
+## The floor (in order)
+
+1. **Seeded PRNG.** A small seeded PRNG derived from the hash of the seed string.
+ Nothing may call a non-seeded random — the board must be reproducible.
+2. **Moodboard anatomy.** A palette ramp, a type pairing, a layout grid, and a
+ one-line rationale per direction, all derived deterministically from the seed.
+3. **`?seed=` plumbing.** Reading the param, plus a tiny UI (input + "re-seed"
+ button) so the person can browse directions in the pane.
+4. **Named sub-streams.** One PRNG sub-stream per concern (palette, type, layout).
+
+## The gold checklist
+
+- **Trait + rarity tables that survive an edition**: seed → traits (palette, type,
+ mood), and a census proving no hidden degenerate seed.
+- **Palette discipline**: OKLCH/OKLab ramps or a seeded palette-from-image; note
+ contrast on every pairing.
+- **Style range**: editorial, brutalist, soft-brand, film-noir, kitschy — matched
+ to the brief, not all at once.
+- **Export route**: `?seed=X&size=...` render for print, plus a board summary block.
+
+## Verify like a designer, not a compiler
+
+Render a grid of seeds, screenshot the actual output, and look.
+Two hard checks before "ready":
+- **Re-render same-seed** and diff — it must be perceptually stable on this machine.
+- **Census the seed range you promise** (e.g. 0-99); reject any blank, low-contrast,
+ or clipped frame.
+
+Be explicit in the verdict about the reproducibility guarantee: same-machine yes;
+cross-machine color you cannot prove — say so.
+
+## Verdict feed
+
+Write `.harness/verdict.json` at every change:
+
+```json
+{ "spec": 1, "ready": false, "summary": "editorial moodboard · re-seed live · census 0-99 clean",
+ "findings": [{ "severity": "info", "kind": "reproducibility", "message": "same-machine verification pending; cross-machine color not provable" }],
+ "artifact": "board/index.html",
+ "phases": [{ "id": "seed", "name": "Seeded core", "state": "done" },
+ { "id": "board", "name": "The board", "state": "active" },
+ { "id": "edition", "name": "Edition", "state": "pending" }],
+ "updatedAt": "2026-09-18T00:00:00Z" }
+```
+
+## Starting from Forme
+
+The template is functional: Three complete art directions, live brand name, palette lock, computed text contrast, SVG poster export, JSON design tokens.
+
+Keep its useful controls and exports when making a user's creation. Test the behavioral core
+(directionModel, contrast, brandSVG; keep all user text escaped) as well as the visible result. A self-contained HTML file can still have well-separated
+model, rendering, input and export functions. Do not turn a finished starter into a waiting screen.
+
+Presence-only helpers do not prove correctness or reproducibility. Record actual evidence before
+marking the result ready. Export and reopen the result as part of the handoff to the user.
+
+## Check your actual edited model
+
+Run `node tools/check.mjs --seeds 100` in the workspace. It reads the pure model from
+`<script id="harness-model">` in the artifact, checks domain invariants, repeats each seed, and
+writes `.harness/model-check.json`. Preserve that script boundary when editing. Model checks are
+followed by browser interaction, exported-output inspection, and visual or listening review.
diff --git a/store/agents/creative-direction/skills/direct/scripts/seed-verdict.sh b/store/agents/creative-direction/skills/direct/scripts/seed-verdict.sh
new file mode 100755
index 000000000..69b7ef411
--- /dev/null
+++ b/store/agents/creative-direction/skills/direct/scripts/seed-verdict.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# Presence is not evidence of correctness. Only the agent's actual checks may establish ready:true.
+set -eu
+ws="${1:?usage: seed-verdict.sh WORKSPACE}"
+mkdir -p "$ws/.harness"
+summary="No artifact yet"; phase=pending
+if [ -s "$ws/board/index.html" ]; then summary="Artifact available — browser verification pending"; phase=active; fi
+cat > "$ws/.harness/verdict.json" <<JSON
+{"spec":1,"ready":false,"summary":"$summary","artifact":"board/index.html","findings":[{"severity":"info","kind":"verification_pending","message":"File presence checked; behavior, output quality and reproducibility have not been verified by this helper."}],"phases":[{"id":"build","name":"Build","state":"$phase"},{"id":"verify","name":"Verify","state":"pending"}],"updatedAt":"$(date -u +%Y-%m-%dT%H:%M:%SZ)"}
+JSON
diff --git a/store/agents/creative-direction/store.json b/store/agents/creative-direction/store.json
new file mode 100644
index 000000000..dfa884194
--- /dev/null
+++ b/store/agents/creative-direction/store.json
@@ -0,0 +1,15 @@
+{
+ "homepage": "https://github.com/autonomous-ai/openharness/tree/main/store/agents/creative-direction",
+ "license": "MIT",
+ "tagline": "Build a coherent visual identity with coordinated posters, typography and palett",
+ "screenshots": [
+ "https://raw.githubusercontent.com/autonomous-ai/openharness/main/store/showcase/creative-direction/starter.jpg"
+ ],
+ "examples": [
+ {
+ "prompt": "Create a coastal identity for COVE STUDIO: mineral green, warm paper, an expressive serif, and a poster that feels like a place to stay.",
+ "caption": "Forme · interactive offline starter",
+ "image": "https://raw.githubusercontent.com/autonomous-ai/openharness/main/store/showcase/creative-direction/starter.jpg"
+ }
+ ]
+}
diff --git a/store/agents/creative-direction/template/board/index.html b/store/agents/creative-direction/template/board/index.html
new file mode 100644
index 000000000..604fff15e
--- /dev/null
+++ b/store/agents/creative-direction/template/board/index.html
@@ -0,0 +1,928 @@
+<!doctype html>
+<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
+<meta name="color-scheme" content="dark light"><title>FORME — Creative Direction</title>
+<!-- Built by store/tools/build-experiences.mjs. Edit this file freely in your workspace. -->
+<style>:root {
+ color-scheme: dark;
+ --bg: #111414;
+ --panel: #191e1c;
+ --line: #ffffff1c;
+ --ink: #f4f2e9;
+ --muted: #a1aaa4;
+ --accent: #d0f28a;
+ font:
+ 14px/1.5 -apple-system,
+ BlinkMacSystemFont,
+ "Segoe UI",
+ sans-serif;
+}
+* {
+ box-sizing: border-box;
+}
+body {
+ margin: 0;
+ background: var(--bg);
+ color: var(--ink);
+}
+button,
+input,
+select {
+ font: inherit;
+}
+button,
+a,
+input,
+select {
+ -webkit-tap-highlight-color: transparent;
+}
+button,
+a {
+ touch-action: manipulation;
+}
+button {
+ cursor: pointer;
+}
+button:disabled {
+ opacity: 0.45;
+ cursor: wait;
+}
+button:focus-visible,
+input:focus-visible,
+select:focus-visible,
+a:focus-visible {
+ outline: 2px solid var(--accent);
+ outline-offset: 4px;
+}
+button,
+input,
+select {
+ color: inherit;
+ background: transparent;
+ border: 1px solid var(--line);
+ border-radius: 5px;
+ padding: 9px 13px;
+}
+button:hover {
+ background: #ffffff0c;
+ border-color: var(--muted);
+}
+button.primary {
+ background: var(--accent);
+ color: #142015;
+ border-color: transparent;
+ font-weight: 650;
+}
+button[aria-pressed="true"] {
+ border-color: var(--accent);
+ color: var(--accent);
+}
+input[type="range"] {
+ accent-color: var(--accent);
+ padding: 0;
+ min-width: 0;
+}
+input[type="number"] {
+ width: 80px;
+}
+select {
+ background: var(--panel);
+}
+label {
+ cursor: pointer;
+}
+a {
+ color: inherit;
+}
+h1,
+h2,
+h3,
+p {
+ margin: 0;
+}
+h1 {
+ font-size: clamp(32px, 5vw, 64px);
+ line-height: 1.02;
+ letter-spacing: -0.055em;
+ font-weight: 550;
+}
+h2 {
+ font-weight: 550;
+ letter-spacing: -0.03em;
+}
+h3 {
+ font-size: 14px;
+ font-weight: 550;
+}
+.mono,
+.eyebrow {
+ font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
+}
+.eyebrow {
+ font-size: 10px;
+ letter-spacing: 0.16em;
+ text-transform: uppercase;
+ color: var(--muted);
+}
+.muted {
+ color: var(--muted);
+}
+.small {
+ font-size: 12px;
+}
+.masthead {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 20px;
+ padding: 19px 28px;
+ border-bottom: 1px solid var(--line);
+}
+.identity {
+ display: flex;
+ gap: 12px;
+ align-items: center;
+ white-space: nowrap;
+ font-size: 12px;
+ font-weight: 600;
+ letter-spacing: 0.04em;
+}
+.mark {
+ width: 25px;
+ height: 25px;
+ display: grid;
+ place-items: center;
+ border: 1px solid currentColor;
+ font-size: 17px;
+}
+.seed-form {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+}
+.seed-form label {
+ font:
+ 10px ui-monospace,
+ monospace;
+ text-transform: uppercase;
+ letter-spacing: 0.12em;
+ color: var(--muted);
+ margin-right: 4px;
+}
+.seed-form input {
+ width: 74px;
+ padding: 6px 8px;
+ font:
+ 12px ui-monospace,
+ monospace;
+}
+.seed-form button {
+ padding: 6px 10px;
+ font-size: 12px;
+}
+.intro {
+ padding: 32px 28px;
+ display: flex;
+ align-items: flex-end;
+ justify-content: space-between;
+ gap: 20px;
+}
+.intro p {
+ max-width: 440px;
+ color: var(--muted);
+ margin-top: 14px;
+}
+.intro .eyebrow {
+ margin-bottom: 12px;
+}
+.actions {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ flex-wrap: wrap;
+}
+.workspace {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) 270px;
+ gap: 22px;
+ padding: 0 28px 28px;
+}
+.panel {
+ background: var(--panel);
+ border: 1px solid var(--line);
+ border-radius: 8px;
+ overflow: hidden;
+}
+.panel-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 16px 20px;
+ border-bottom: 1px solid var(--line);
+ gap: 10px;
+}
+.side {
+ display: flex;
+ flex-direction: column;
+ gap: 20px;
+}
+.section {
+ border-top: 1px solid var(--line);
+ padding-top: 18px;
+}
+.section h3 {
+ margin-bottom: 15px;
+}
+.field {
+ display: grid;
+ gap: 7px;
+ margin: 14px 0;
+}
+.field > span {
+ display: flex;
+ justify-content: space-between;
+ font-size: 12px;
+ color: var(--muted);
+}
+.metrics {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ gap: 1px;
+ background: var(--line);
+ border: 1px solid var(--line);
+ border-radius: 6px;
+ overflow: hidden;
+}
+.metric {
+ background: var(--bg);
+ padding: 13px 15px;
+}
+.metric strong {
+ display: block;
+ font:
+ 24px ui-monospace,
+ monospace;
+ letter-spacing: -0.06em;
+}
+.metric span {
+ font-size: 10px;
+ color: var(--muted);
+ text-transform: uppercase;
+ letter-spacing: 0.09em;
+}
+canvas {
+ display: block;
+ max-width: 100%;
+}
+.status-line {
+ display: flex;
+ justify-content: space-between;
+ gap: 20px;
+ padding: 14px 28px;
+ border-top: 1px solid var(--line);
+ font:
+ 10px ui-monospace,
+ monospace;
+ color: var(--muted);
+}
+.dot {
+ width: 6px;
+ height: 6px;
+ display: inline-block;
+ background: var(--accent);
+ border-radius: 50%;
+ margin-right: 6px;
+}
+.toast {
+ position: fixed;
+ z-index: 99;
+ left: 50%;
+ bottom: 22px;
+ transform: translateX(-50%);
+ max-width: 90vw;
+ background: var(--ink);
+ color: var(--bg);
+ padding: 11px 18px;
+ border-radius: 6px;
+ box-shadow: 0 3px 30px #0004;
+ font-size: 12px;
+}
+.toast:empty {
+ display: none;
+}
+[hidden] {
+ display: none !important;
+}
+.sr-only {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ padding: 0;
+ margin: -1px;
+ overflow: hidden;
+ clip-path: inset(50%);
+ white-space: nowrap;
+ border: 0;
+}
+@media (max-width: 800px) {
+ .workspace {
+ grid-template-columns: 1fr;
+ }
+ .side {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ }
+ .intro {
+ align-items: flex-start;
+ flex-direction: column;
+ }
+ .intro h1 {
+ font-size: 44px;
+ }
+}
+@media (max-width: 480px) {
+ .masthead {
+ padding: 13px 16px;
+ gap: 8px;
+ flex-wrap: wrap;
+ }
+ .intro {
+ padding: 26px 16px;
+ }
+ .intro h1 {
+ font-size: 38px;
+ }
+ .workspace {
+ padding: 0 16px 20px;
+ gap: 18px;
+ }
+ .side {
+ grid-template-columns: 1fr;
+ }
+ .seed-form label {
+ display: none;
+ }
+ .status-line {
+ padding: 12px 16px;
+ }
+ .status-line span:last-child {
+ display: none;
+ }
+ .metrics .metric {
+ padding: 12px 10px;
+ }
+ .panel-head {
+ padding: 12px;
+ }
+ .actions {
+ gap: 6px;
+ }
+}
+@media (prefers-reduced-motion: reduce) {
+ *,
+ *::before,
+ *::after {
+ scroll-behavior: auto !important;
+ animation: none !important;
+ transition: none !important;
+ }
+}
+
+:root {
+ color-scheme: light;
+ --bg: #eeeae2;
+ --panel: #f6f2e9;
+ --ink: #282c29;
+ --muted: #6e746b;
+ --line: #2b32292a;
+ --accent: #303e32;
+}
+button.primary {
+ color: #eeeae2;
+}
+.mark {
+ background: var(--ink);
+ color: var(--bg);
+ border: 0;
+}
+.intro {
+ padding-bottom: 28px;
+}
+.intro h1 {
+ font:
+ clamp(34px, 5vw, 64px) / 1.02 Georgia,
+ serif;
+ letter-spacing: -0.06em;
+}
+.direction-layout {
+ padding: 0 28px 30px;
+ max-width: 1440px;
+ margin: auto;
+}
+.direction-nav {
+ display: flex;
+ border-top: 1px solid var(--line);
+ border-bottom: 1px solid var(--line);
+ margin-bottom: 26px;
+ gap: 24px;
+ overflow: auto;
+}
+.direction-nav button {
+ border: 0;
+ border-radius: 0;
+ padding: 17px 0;
+ white-space: nowrap;
+ color: var(--muted);
+ font-size: 12px;
+}
+.direction-nav button[aria-pressed="true"] {
+ box-shadow: inset 0 -2px var(--ink);
+ color: var(--ink);
+}
+.brand-grid {
+ display: grid;
+ grid-template-columns: minmax(0, 1.3fr) minmax(240px, 0.7fr);
+ gap: 40px;
+}
+.poster {
+ padding: 24px;
+ background: #d9d7cc;
+ min-width: 0;
+}
+.poster svg {
+ display: block;
+ width: 100%;
+ max-height: 820px;
+ filter: drop-shadow(0 7px 10px #0002);
+}
+.brand-details {
+ padding: 10px 0;
+ display: flex;
+ flex-direction: column;
+ gap: 16px;
+}
+.brand-details h2 {
+ font:
+ 32px/1.15 Georgia,
+ serif;
+}
+.brand-details > p:not(.eyebrow) {
+ font-size: 13px;
+ max-width: 380px;
+}
+.brand-details .field {
+ margin: 3px 0;
+}
+.palette-head {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-top: 4px;
+ gap: 8px;
+}
+.palette-head button {
+ font-size: 10px;
+ padding: 5px 8px;
+}
+.swatches {
+ display: grid;
+ grid-template-columns: repeat(5, 1fr);
+ height: 76px;
+}
+.swatches button {
+ border: 0;
+ border-radius: 0;
+ padding: 7px 3px;
+ display: flex;
+ align-items: flex-end;
+ justify-content: center;
+ font:
+ 9px ui-monospace,
+ monospace;
+}
+.type-spec {
+ border-top: 1px solid var(--line);
+ padding-top: 18px;
+ margin-top: 5px;
+}
+.specimen {
+ font-size: 46px;
+ line-height: 1.05;
+ margin: 10px 0;
+ letter-spacing: -0.04em;
+}
+.brand-card {
+ padding: 24px;
+ min-height: 150px;
+ box-shadow: 0 3px 12px #0001;
+ margin-top: 4px;
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+}
+.brand-card .eyebrow {
+ color: inherit;
+ opacity: 0.8;
+}
+.brand-card h3 {
+ font-size: 27px;
+ margin: 15px 0;
+}
+.brand-card > span:last-child {
+ font-size: 10px;
+}
+.direction-foot {
+ display: flex;
+ justify-content: space-between;
+ gap: 24px;
+ border-top: 1px solid var(--line);
+ margin-top: 26px;
+ padding-top: 20px;
+}
+.direction-foot p {
+ max-width: 360px;
+}
+@media (max-width: 800px) {
+ .brand-grid {
+ grid-template-columns: 1fr;
+ gap: 22px;
+ }
+ .brand-details {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 18px;
+ }
+ .brand-details > h2,
+ .brand-details > p,
+ .brand-details > .palette-head,
+ .swatches,
+ #contrast {
+ grid-column: 1/-1;
+ }
+ .type-spec {
+ margin: 0;
+ border: 0;
+ }
+ .brand-card {
+ grid-column: 1/-1;
+ }
+}
+@media (max-width: 480px) {
+ .direction-layout {
+ padding: 0 16px 24px;
+ }
+ .direction-nav {
+ gap: 18px;
+ }
+ .brand-details {
+ display: flex;
+ }
+ .poster {
+ padding: 12px;
+ }
+ .direction-foot {
+ flex-direction: column;
+ gap: 10px;
+ }
+}
+</style></head><body>
+<header class="masthead"><div class="identity"><span class="mark" aria-hidden="true">F</span>FORME</div>
+<form class="seed-form" id="seed-form"><label for="seed">Seed</label><input id="seed" aria-label="Seed" maxlength="128" autocomplete="off" spellcheck="false"><button type="submit">Apply</button><button id="next-seed" type="button" title="Next seed">↗ Next</button></form></header>
+<section class="intro">
+ <div>
+ <p class="eyebrow">Independent identities / Direction 01—03</p>
+ <h1>An identity.<br />A point of view.</h1>
+ </div>
+ <div class="actions">
+ <button id="tokens">Export tokens</button
+ ><button id="poster-export" class="primary">Export poster ↗</button>
+ </div>
+</section>
+<main class="direction-layout">
+ <nav class="direction-nav" id="directions" aria-label="Art direction"></nav>
+ <div class="brand-grid">
+ <section id="poster" class="poster" aria-label="Brand poster"></section>
+ <aside class="brand-details">
+ <p class="eyebrow" id="direction-name"></p>
+ <h2 id="direction-line"></h2>
+ <p id="rationale" class="muted"></p>
+ <label class="field"
+ ><span>Your name on it</span
+ ><input id="brand-name" maxlength="28" aria-label="Brand name"
+ /></label>
+ <div class="palette-head">
+ <h3>The palette</h3>
+ <button id="lock-palette" aria-pressed="false">Lock palette</button>
+ </div>
+ <div id="swatches" class="swatches"></div>
+ <p class="small muted" id="contrast"></p>
+ <div class="type-spec">
+ <p class="eyebrow">Type in context</p>
+ <p class="specimen" id="type-specimen">Aa Bb Cc<br />0123456789</p>
+ <span class="small muted" id="type-name"></span>
+ </div>
+ <div class="brand-card" id="brand-card">
+ <span class="eyebrow">The small things matter</span>
+ <h3 id="card-name"></h3>
+ <span>Objects. Places. Possibilities.</span>
+ </div>
+ </aside>
+ </div>
+ <div class="direction-foot">
+ <p class="eyebrow" id="mood"></p>
+ <p class="small muted">
+ A working identity: a poster, a type system, a palette and the reasoning
+ behind them.
+ </p>
+ </div>
+</main>
+<div class="toast" id="toast" role="status"></div>
+<script id="harness-model">
+'use strict';
+// Shared deterministic primitives. Domain models use named streams so unrelated edits stay stable.
+function hash(value) {
+ let h = 2166136261;
+ for (const c of String(value)) h = Math.imul(h ^ c.charCodeAt(0), 16777619);
+ return h >>> 0;
+}
+function random(seed, stream = "main") {
+ let a = hash(`${seed}:${stream}`);
+ return () => {
+ a = (a + 0x6d2b79f5) | 0;
+ let t = Math.imul(a ^ (a >>> 15), 1 | a);
+ t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
+ };
+}
+const clamp = (n, lo, hi) => Math.max(lo, Math.min(hi, n));
+const lerp = (a, b, t) => a + (b - a) * t;
+const pick = (items, rng) => items[Math.floor(rng() * items.length)];
+function normal(rng) {
+ return (
+ Math.sqrt(-2 * Math.log(Math.max(1e-9, rng()))) *
+ Math.cos(2 * Math.PI * rng())
+ );
+}
+
+const directions = [
+ {
+ name: "Coastal modern",
+ brand: "LOW TIDE",
+ line: "Less noise. More horizon.",
+ note: "Mineral tones, generous space and a quietly expressive serif. A direction for places you want to stay.",
+ colors: ["#163f3c", "#f1ebd9", "#d16a3d", "#b4c8b0", "#d9bb8d"],
+ type: "Georgia",
+ mood: "Warm / deliberate / grounded",
+ },
+ {
+ name: "Electric editorial",
+ brand: "OFF HOURS",
+ line: "For the hours that are yours.",
+ note: "Acid yellow interrupts midnight ink. Dense typography and an oversized orbit turn every application into a signal.",
+ colors: ["#1d2448", "#f2eee4", "#d5ef53", "#b3aff0", "#d85a43"],
+ type: "Arial",
+ mood: "Direct / restless / independent",
+ },
+ {
+ name: "Botanical archive",
+ brand: "FERN & FORM",
+ line: "A slower kind of growth.",
+ note: "Botanical silhouettes and archival paper meet deep wine. An old-world serif gives the living forms room to breathe.",
+ colors: ["#4e2834", "#f0e7d5", "#a1b287", "#d5a093", "#b7af7e"],
+ type: "Georgia",
+ mood: "Organic / curious / considered",
+ },
+];
+function directionModel(seed, index, lockedColors) {
+ const choice =
+ index ?? Math.floor(random(seed, "direction")() * directions.length);
+ return {
+ ...directions[choice],
+ colors: lockedColors ?? [...directions[choice].colors],
+ index: choice,
+ seed: String(seed),
+ angle: random(seed, "layout")() * 80 - 40,
+ };
+}
+function luminance(hex) {
+ const c = [1, 3, 5]
+ .map((i) => parseInt(hex.slice(i, i + 2), 16) / 255)
+ .map((n) => (n <= 0.04045 ? n / 12.92 : ((n + 0.055) / 1.055) ** 2.4));
+ return c[0] * 0.2126 + c[1] * 0.7152 + c[2] * 0.0722;
+}
+function contrast(a, b) {
+ const x = luminance(a),
+ y = luminance(b);
+ return (Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05);
+}
+function xml(value) {
+ return String(value).replace(
+ /[&<>"']/g,
+ (c) =>
+ ({
+ "&": "&amp;",
+ "<": "&lt;",
+ ">": "&gt;",
+ '"': "&quot;",
+ "'": "&apos;",
+ })[c],
+ );
+}
+function brandSVG(model, brand = model.brand) {
+ const [ink, paper, accent, secondary] = model.colors;
+ const motif =
+ model.index === 2
+ ? Array.from(
+ { length: 11 },
+ (_, i) =>
+ `<ellipse cx="${480 + Math.sin(i * 2.4) * 130}" cy="${190 + i * 39}" rx="125" ry="34" fill="${i % 2 ? accent : secondary}" transform="rotate(${i % 2 ? -35 : 35} ${480 + Math.sin(i * 2.4) * 130} ${190 + i * 39})"/>`,
+ ).join("")
+ : `<circle cx="520" cy="360" r="210" fill="${accent}"/>` +
+ Array.from(
+ { length: 18 },
+ (_, i) =>
+ `<ellipse cx="510" cy="390" rx="${80 + i * 9}" ry="${205 - i * 8}" fill="none" stroke="${model.index === 0 ? ink : secondary}" stroke-width="2" transform="rotate(${model.angle} 510 390)"/>`,
+ ).join("");
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 900"><rect width="800" height="900" fill="${paper}"/><text x="52" y="62" fill="${ink}" font-family="Arial,sans-serif" font-size="13" letter-spacing="5">INDEPENDENT BY NATURE / ${xml(model.seed.slice(0, 12))}</text>${motif}<text x="50" y="740" textLength="695" lengthAdjust="spacingAndGlyphs" fill="${ink}" font-family="${model.type},serif" font-size="88" font-weight="${model.index === 1 ? 700 : 400}">${xml(brand.slice(0, 28))}</text><line x1="52" y1="785" x2="748" y2="785" stroke="${ink}"/><text x="52" y="827" fill="${ink}" font-family="Arial,sans-serif" font-size="20">${xml(model.line)}</text><text x="52" y="864" fill="${ink}" font-family="monospace" font-size="10" letter-spacing="2">AN EXPLORATION BY FORME — ${xml(model.name.toUpperCase())}</text></svg>`;
+}
+
+</script>
+<script>
+'use strict';
+const $ = (s) => document.querySelector(s);
+const $$ = (s) => [...document.querySelectorAll(s)];
+const params = new URLSearchParams(location.search);
+let seed = (params.get("seed") || "42").slice(0, 128);
+const reducedMotion = matchMedia("(prefers-reduced-motion: reduce)").matches;
+const parentMessage = (message) => {
+ if (parent !== window) parent.postMessage(message, "*");
+};
+function toast(message) {
+ $("#toast").textContent = message;
+ clearTimeout(toast.timer);
+ toast.timer = setTimeout(() => {
+ $("#toast").textContent = "";
+ }, 3500);
+}
+function saveFile(name, content, type = "application/json") {
+ const blob =
+ content instanceof Blob ? content : new Blob([content], { type });
+ const url = URL.createObjectURL(blob),
+ a = document.createElement("a");
+ a.href = url;
+ a.download = name;
+ document.body.append(a);
+ a.click();
+ a.remove();
+ setTimeout(() => URL.revokeObjectURL(url), 30000);
+}
+function canvasPNG(canvas, name) {
+ canvas.toBlob((blob) => {
+ if (blob) saveFile(name, blob);
+ else toast("Image export failed. Please try again.");
+ });
+}
+function setSeed(value) {
+ seed = String(value).trim().slice(0, 128) || "42";
+ $("#seed").value = seed;
+ const url = new URL(location.href);
+ url.searchParams.set("seed", seed);
+ try {
+ history.replaceState(null, "", url);
+ } catch {
+ /* Opaque-origin iframe: the shell owns its URL. */
+ }
+ parentMessage({ type: "harness:state", seed });
+ dispatchEvent(new CustomEvent("seedchange", { detail: seed }));
+}
+$("#seed").value = seed;
+$("#seed-form").addEventListener("submit", (e) => {
+ e.preventDefault();
+ setSeed($("#seed").value);
+});
+$("#next-seed").addEventListener("click", () =>
+ setSeed(/^\d{1,9}$/.test(seed) ? Number(seed) + 1 : hash(seed)),
+);
+function fitCanvas(canvas, draw, maxDpr = 2) {
+ const observer = new ResizeObserver(() => {
+ const box = canvas.getBoundingClientRect(),
+ dpr = Math.min(devicePixelRatio || 1, maxDpr);
+ canvas.width = Math.max(1, Math.round(box.width * dpr));
+ canvas.height = Math.max(1, Math.round(box.height * dpr));
+ draw?.();
+ });
+ observer.observe(canvas);
+ return observer;
+}
+const editable = (target) =>
+ target instanceof Element &&
+ !!target.closest("input,textarea,select,[contenteditable=true]");
+addEventListener("error", (e) =>
+ parentMessage({ type: "harness:error", message: e.message }),
+);
+addEventListener("unhandledrejection", (e) =>
+ parentMessage({
+ type: "harness:error",
+ message: String(e.reason?.message || e.reason),
+ }),
+);
+function ready() {
+ document.body.dataset.ready = "true";
+ parentMessage({ type: "harness:ready", title: document.title, seed });
+}
+
+let direction,
+ directionIndex,
+ lockedColors,
+ customBrand = "";
+function renderDirection() {
+ direction = directionModel(seed, directionIndex, lockedColors);
+ const name = customBrand || direction.brand;
+ $("#poster").innerHTML = brandSVG(direction, name);
+ $("#direction-name").textContent =
+ `DIRECTION 0${direction.index + 1} / ${direction.name}`;
+ $("#direction-line").textContent = direction.line;
+ $("#rationale").textContent = direction.note;
+ $("#brand-name").value = name;
+ $("#type-specimen").style.fontFamily = direction.type;
+ $("#type-name").textContent = `${direction.type} display / system sans body`;
+ $("#mood").textContent = direction.mood;
+ $("#swatches").replaceChildren();
+ direction.colors.forEach((color) => {
+ const b = document.createElement("button");
+ b.style.background = color;
+ b.style.color =
+ contrast(color, "#ffffff") > contrast(color, "#151515")
+ ? "#ffffff"
+ : "#151515";
+ b.textContent = color.toUpperCase();
+ b.title = `Show color ${color}`;
+ b.onclick = () =>
+ toast(`${color.toUpperCase()} — included in your exported tokens`);
+ $("#swatches").append(b);
+ });
+ const ratio = contrast(direction.colors[0], direction.colors[1]);
+ $("#contrast").textContent =
+ `Ink on paper: ${ratio.toFixed(1)}:1 contrast · ${ratio >= 7 ? "AAA" : ratio >= 4.5 ? "AA" : "display only"}`;
+ $("#brand-card").style.background = direction.colors[0];
+ $("#brand-card").style.color = direction.colors[1];
+ $("#card-name").textContent = name;
+ $("#card-name").style.fontFamily = direction.type;
+ $$("#directions button").forEach((b, i) =>
+ b.setAttribute("aria-pressed", i === direction.index),
+ );
+}
+directions.forEach((d, i) => {
+ const b = document.createElement("button");
+ b.textContent = `0${i + 1} / ${d.name}`;
+ b.onclick = () => {
+ directionIndex = i;
+ renderDirection();
+ };
+ $("#directions").append(b);
+});
+$("#brand-name").addEventListener("input", (e) => {
+ customBrand = e.target.value;
+ renderDirection();
+});
+$("#lock-palette").onclick = () => {
+ lockedColors = lockedColors ? undefined : [...direction.colors];
+ $("#lock-palette").setAttribute("aria-pressed", !!lockedColors);
+ $("#lock-palette").textContent = lockedColors
+ ? "Palette locked"
+ : "Lock palette";
+};
+$("#tokens").onclick = () =>
+ saveFile(
+ `forme-${hash(seed)}.json`,
+ JSON.stringify(
+ {
+ seed,
+ brand: customBrand || direction.brand,
+ direction: direction.name,
+ colors: Object.fromEntries(
+ ["ink", "paper", "accent", "secondary", "detail"].map((key, i) => [
+ key,
+ direction.colors[i],
+ ]),
+ ),
+ typography: { display: direction.type, body: "system-ui" },
+ rationale: direction.note,
+ },
+ null,
+ 2,
+ ),
+ );
+$("#poster-export").onclick = () =>
+ saveFile(
+ `forme-${hash(seed)}.svg`,
+ brandSVG(direction, customBrand || direction.brand),
+ "image/svg+xml",
+ );
+addEventListener("seedchange", () => {
+ directionIndex = undefined;
+ renderDirection();
+});
+renderDirection();
+ready();
+
+</script></body></html>
diff --git a/store/agents/creative-direction/template/tools/check.mjs b/store/agents/creative-direction/template/tools/check.mjs
new file mode 100644
index 000000000..4057e34ef
--- /dev/null
+++ b/store/agents/creative-direction/template/tools/check.mjs
@@ -0,0 +1,75 @@
+const CONFIG = {"id":"creative-direction","artifact":"board/index.html"};
+// Compiled into each workspace's tools/check.mjs. Tests the model in the ACTUAL edited HTML.
+import { readFile, mkdir, writeFile } from "node:fs/promises";
+import { createHash } from "node:crypto";
+import vm from "node:vm";
+import { resolve, dirname } from "node:path";
+
+const args = process.argv.slice(2),
+ i = args.indexOf("--seeds");
+const count = i === -1 ? 32 : Number(args[i + 1]);
+if (!Number.isInteger(count) || count < 1 || count > 1000)
+ throw new Error("--seeds must be an integer from 1 to 1000");
+const artifact = resolve(CONFIG.artifact);
+const html = await readFile(artifact, "utf8");
+const script = html.match(
+ /<script id="harness-model">([\s\S]*?)<\/script>/,
+)?.[1];
+if (!script)
+ throw new Error(
+ 'Keep the pure model in <script id="harness-model"> so this checker can exercise the actual artifact.',
+ );
+const expressions = {
+ "generative-art": `const m=artModel(SEED);const p=artPaths(m);({state:m,valid:p.length>0&&p.flat().every(([x,y])=>Number.isFinite(x)&&Number.isFinite(y)),metrics:{paths:p.length,palette:m.palette}})`,
+ "creative-direction": `const m=directionModel(SEED);const ratio=contrast(m.colors[0],m.colors[1]);({state:m,valid:ratio>=4.5,metrics:{direction:m.name,contrast:ratio}})`,
+ "lab-bench": `const p=experiment(SEED),e=treatmentEffect(p);({state:p,valid:p.length>1&&p.every(p=>Number.isFinite(p.x)&&Number.isFinite(p.y))&&Number.isFinite(e.low)&&e.low<=e.high,metrics:{samples:p.length,effect:e.difference,interval:[e.low,e.high]}})`,
+ "music-studio": `const s=musicScore(SEED),r=renderMusic(s);({state:Array.from(r.samples),valid:r.peak>.001&&r.peak<=.95&&r.samples.every(Number.isFinite),metrics:{seconds:r.duration,peak:r.peak,rms:r.rms}})`,
+ "game-master": `const m=arenaMatch(SEED),s=m.history.at(-1);({state:m,valid:m.history.length>1&&m.history.length<=10000&&s.units.every(u=>u.hp>=0&&u.x>=0&&u.x<m.map.w&&u.y>=0&&u.y<m.map.h),metrics:{turns:s.turn,score:s.score,winner:m.winner}})`,
+ "drone-pilot": `const s=flyAutopilot(SEED);({state:s,valid:s.finished&&!s.crashed&&s.passed===flightCourse(SEED).length,metrics:{seconds:s.time,passed:s.passed,missed:s.missed}})`,
+ "voxel-worlds": `const w=voxelWorld(SEED);let p={...w.spawn,vy:0,grounded:true};const clear=playerFits(w,p.x,p.y,p.z);for(let t=0;t<120;t++)p=movePlayer(w,p,{forward:1});({state:Array.from(w.blocks),valid:clear&&playerFits(w,p.x,p.y,p.z),metrics:{blocks:w.blocks.filter(Boolean).length,walkDistance:Math.hypot(p.x-w.spawn.x,p.z-w.spawn.z)}})`,
+};
+const expression = expressions[CONFIG.id];
+const digest = (value) =>
+ createHash("sha256").update(JSON.stringify(value)).digest("hex");
+const results = [];
+for (let seed = 0; seed < count; seed++) {
+ const run = () =>
+ vm.runInNewContext(
+ `${script}\n${expression}`,
+ { SEED: String(seed) },
+ { timeout: 10000 },
+ );
+ try {
+ const first = run(),
+ second = run(),
+ signature = digest(first.state),
+ repeat = digest(second.state);
+ results.push({
+ seed,
+ ok: first.valid && signature === repeat,
+ signature,
+ metrics: first.metrics,
+ });
+ } catch (error) {
+ results.push({ seed, ok: false, error: error.message });
+ }
+}
+const passed = results.filter((r) => r.ok).length;
+const report = {
+ spec: 1,
+ harness: CONFIG.id,
+ artifact: CONFIG.artifact,
+ checkedAt: new Date().toISOString(),
+ modelChecks: { passed, total: count },
+ scope:
+ "Pure model invariants and same-process repeatability. Browser interaction, layout, listening and export review still required.",
+ results,
+};
+const out = resolve(".harness/model-check.json");
+await mkdir(dirname(out), { recursive: true });
+await writeFile(out, JSON.stringify(report, null, 2) + "\n");
+console.log(
+ `${CONFIG.id}: ${passed}/${count} model checks passed. Report: ${out}`,
+);
+console.log(report.scope);
+if (passed !== count) process.exitCode = 1;
diff --git a/store/agents/creative-direction/test/toolchain.test.mjs b/store/agents/creative-direction/test/toolchain.test.mjs
new file mode 100644
index 000000000..056f1e40e
--- /dev/null
+++ b/store/agents/creative-direction/test/toolchain.test.mjs
@@ -0,0 +1,66 @@
+// The Creative Direction harness scripts, run the way Harness runs them.
+// node --test test/*.test.mjs
+import assert from 'node:assert/strict'
+import { spawnSync } from 'node:child_process'
+import { accessSync, constants, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { after, test } from 'node:test'
+
+const here = fileURLToPath(new URL('..', import.meta.url))
+const manifest = JSON.parse(readFileSync(join(here, 'harness.json'), 'utf8'))
+const scratch = []
+after(() => { for (const dir of scratch) rmSync(dir, { recursive: true, force: true }) })
+
+function tempDir() { const d = mkdtempSync(join(tmpdir(), 'direct-')); scratch.push(d); return d }
+function run(script, { cwd = here, env = {} } = {}) {
+ const merged = { ...process.env }
+ for (const [k, v] of Object.entries(env)) v === null ? delete merged[k] : (merged[k] = v)
+ const r = spawnSync(join(here, script), { cwd, env: merged, encoding: 'utf8' })
+ return { code: r.status, stdout: r.stdout, stderr: r.stderr }
+}
+const seedScript = join(here, 'skills/direct/scripts/seed-verdict.sh')
+
+test('every script the manifest names is in the folder and executable', () => {
+ for (const s of [manifest.workspace.init, manifest.toolchain.setup, manifest.toolchain.doctor]) {
+ assert.doesNotThrow(() => accessSync(join(here, s), constants.X_OK), s)
+ }
+})
+
+test('setup installs nothing and succeeds quietly', () => {
+ assert.deepEqual(run(manifest.toolchain.setup), { code: 0, stdout: '', stderr: '' })
+})
+
+test('doctor says ok when sh is on PATH', () => {
+ assert.equal(run(manifest.toolchain.doctor).code, 0)
+})
+
+test('init lays out a workspace and seeds a not-ready verdict', () => {
+ const ws = tempDir()
+ assert.equal(run(manifest.workspace.init, { cwd: ws, env: { HARNESS_DSH: manifest.id } }).code, 0)
+ assert.equal(JSON.parse(readFileSync(join(ws, '.harness/verdict.json'), 'utf8')).ready, false)
+ assert.equal(readFileSync(join(ws, '.harness-initialized'), 'utf8'), `initialized by ${manifest.id}\n`)
+})
+
+test('the manifest names a viewer package and an HTML artifact', () => {
+ assert.equal(manifest.viewer.use, 'autonomous/web-viewer')
+ assert.deepEqual(manifest.viewer.artifactExtensions, ['.html'])
+})
+
+test('seed-verdict reflects whether a board exists', () => {
+ const ws = tempDir()
+ run(manifest.workspace.init, { cwd: ws })
+ assert.equal(spawnSync(seedScript, [ws], { cwd: ws, encoding: 'utf8' }).status, 0)
+ assert.equal(JSON.parse(readFileSync(join(ws, '.harness/verdict.json'), 'utf8')).ready, false)
+ mkdirSync(join(ws, 'board'), { recursive: true })
+ writeFileSync(join(ws, 'board/index.html'), '<!doctype html>')
+ assert.equal(spawnSync(seedScript, [ws], { cwd: ws, encoding: 'utf8' }).status, 0)
+ assert.equal(JSON.parse(readFileSync(join(ws, '.harness/verdict.json'), 'utf8')).ready, false)
+})
+
+
+test('the manifest routes the actual nested artifact through the shared viewer', () => {
+ assert.equal(manifest.viewer.url, 'http://127.0.0.1:${port}/?file=${artifact}')
+ assert.ok(manifest.workspace.marker.endsWith('/index.html'))
+})
diff --git a/store/agents/creative-direction/toolchain/doctor.sh b/store/agents/creative-direction/toolchain/doctor.sh
new file mode 100755
index 000000000..99114a76a
--- /dev/null
+++ b/store/agents/creative-direction/toolchain/doctor.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+# Doctor: the board is just a file served by the shared web-viewer; no extra runtime needed.
+exit 0
diff --git a/store/agents/creative-direction/toolchain/init-workspace.sh b/store/agents/creative-direction/toolchain/init-workspace.sh
new file mode 100755
index 000000000..5a334ba54
--- /dev/null
+++ b/store/agents/creative-direction/toolchain/init-workspace.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Harness copies the template before this runs. Preserve the user's design log on repeat calls.
+set -eu
+ws="${1:-$PWD}"
+mkdir -p "$ws/board" "$ws/.harness"
+if [ ! -f "$ws/board/DESIGN.md" ]; then
+ printf '# Design log — Creative Direction\n\nRecord date, USER or AI, decision, rationale, and whether it remains in the build.\n' > "$ws/board/DESIGN.md"
+fi
+cat > "$ws/.harness/verdict.json" <<JSON
+{"spec":1,"ready":false,"summary":"Forme starter available — describe what you want to create","artifact":"board/index.html","findings":[{"severity":"info","kind":"review_pending","message":"Starter provided; personalized changes need browser verification."}],"phases":[{"id":"build","name":"Build","state":"active"},{"id":"verify","name":"Verify","state":"pending"}],"updatedAt":"$(date -u +%Y-%m-%dT%H:%M:%SZ)"}
+JSON
+printf 'initialized by %s\n' "${HARNESS_DSH:-autonomous/creative-direction}" > "$ws/.harness-initialized"
diff --git a/store/agents/creative-direction/toolchain/setup.sh b/store/agents/creative-direction/toolchain/setup.sh
new file mode 100755
index 000000000..dff0f8d13
--- /dev/null
+++ b/store/agents/creative-direction/toolchain/setup.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+# Creative Direction has no toolchain: the board is inline HTML + CSS. Nothing to install.
+exit 0
diff --git a/store/agents/drone-pilot/AGENTS.md b/store/agents/drone-pilot/AGENTS.md
new file mode 100644
index 000000000..67bbe6199
--- /dev/null
+++ b/store/agents/drone-pilot/AGENTS.md
@@ -0,0 +1,66 @@
+# Drone / FPV Pilot harness
+
+You turn a plain-English description into a **deterministic, seedable drone flight**
+rendered in one self-contained `flight/index.html`. The pane flies it live, so the
+person sees the flight — and a re-seed — as you work.
+
+## What a good flight is
+
+- **One file, offline.** All physics, rendering and input inline on a canvas. No
+ CDN at runtime. A `?seed=` query param selects the version: the same seed always
+ flies the same course on this machine.
+- **Determinism is the product.** Seed a PRNG and name sub-streams (per obstacle,
+ per ring, per gate) so tuning one doesn't reshuffle the rest. Same seed → same
+ course, same spawn, same flight.
+- **Flyable, not just pretty.** Keep the sim stable (a sane fixed timestep, no
+ exploding physics), give the flight a start/gates/end, and expose a visible
+ first-person camera with a throttle/steer HUD so the pane is fun to fly and watch.
+- **Be honest about verification.** Same-machine playback is checkable. Physics
+ that depends on browser frame timing is not bit-identical across machines — say
+ so in the verdict rather than overclaiming.
+
+## How to work so the pane moves
+
+1. **Save within a minute.** Materialize `flight/index.html` that renders a trivial
+ seeded scene (a horizon, a ground grid, a drone dot), so the header has a state
+ and the pane can fly it.
+2. **Build the sim, then the course.** Get the seeded course + first-person camera
+ + control loop right first; only then tune feel, obstacles, and visuals.
+3. **Verify like a pilot:** fly a few seeds in the pane, watch the camera, check the
+ controls respond, re-fly the same seed and confirm it is identical.
+4. **Update `.harness/verdict.json`** at every check — `ready`, one-line `summary`,
+ `phases`, `findings`, and a reproducibility note.
+
+## Rules
+
+- A flight is only "ready" when every seed in the range you promise flies clean:
+ no stuck camera, no impossible course, no infinite loop. Sample a grid of seeds.
+- Tag every crafted decision USER vs AI in `flight/DESIGN.md`
+ (`YYYY-MM-DD | USER|AI | topic | decision | still in build?`).
+- The `summary` says plainly what is reproducible now and what is not.
+
+## Shipped experience and operating standard
+
+The workspace starts with **Vector**, a working experience, not an empty placeholder.
+Twelve gates, fixed-step dynamics, first-person projection, autopilot/manual handoff, brake/boost, minimap, finite flight and telemetry export.
+
+- Read the existing artifact before replacing it. The useful model boundaries are flightCourse, flightStep, fixed 1/60 simulation ticks.
+- Preserve working interactions and exports when extending the artifact. Match the user's brief;
+ the starter's genre and visual style are examples, not a ceiling.
+- Expose meaningful domain controls and outputs. Every control must change real state; every
+ displayed metric must be computed from that state. Never invent model activity or test results.
+- Use named random streams and a fixed simulation/score clock. Sample seeds, repeat the same
+ seed, inspect exported data, and verify keyboard/touch controls in the actual viewer.
+- This HTML runs with same-origin APIs in the shared viewer. Sibling fetches, localStorage,
+ downloads and pointer lock are available. Keep files portable and support direct opening.
+- Do not equate an existing HTML file, a successful reload, or a source-string test with a usable
+ result. `seed-verdict.sh` deliberately keeps `ready:false`; write `ready:true` only after your
+ checks establish it. Record exact commands, sampled seeds, observations and limitations.
+- Never claim a test coverage percentage for browser code based on Node subprocess tests.
+
+## Check your actual edited model
+
+Run `node tools/check.mjs --seeds 100` in the workspace. It reads the pure model from
+`<script id="harness-model">` in the artifact, checks domain invariants, repeats each seed, and
+writes `.harness/model-check.json`. Preserve that script boundary when editing. Model checks are
+followed by browser interaction, exported-output inspection, and visual or listening review.
diff --git a/store/agents/drone-pilot/README.md b/store/agents/drone-pilot/README.md
new file mode 100644
index 000000000..a65341a8c
--- /dev/null
+++ b/store/agents/drone-pilot/README.md
@@ -0,0 +1,42 @@
+# Drone Pilot — Vector
+
+Fly a seeded canyon course in first person. Switch between manual controls and a tracking autopilot, inspect gate results and the flight path, and export telemetry.
+
+## Try it
+
+> Design a slalom course over a canyon floor. Make the autopilot fly a clean lap, then give me manual controls and a trace to compare against it.
+
+The starter already works before the first prompt. Change it with the agent, interact with the
+result in the pane, and keep the output. Everything needed at runtime is in `flight/index.html`.
+It works offline and can be opened outside Harness.
+
+## What you can do
+
+Twelve gates, fixed-step dynamics, first-person projection, autopilot/manual handoff, brake/boost, minimap, finite flight and telemetry export.
+
+## Build on the starter
+
+The model functions `flightCourse` and `flightStep` are the starting points for substantive changes. Preserve seed
+reproducibility and user controls while changing the domain behavior. A different brief can replace
+this starter's entire visual language. Keep the artifact self-contained and test the actual result.
+
+The source checkout builds these starters with `node store/tools/build-experiences.mjs`. Installed
+workspaces are editable HTML; no build tool, network dependency or paid service is required.
+
+## Verification
+
+Model census: `node --test store/tools/experience-tests/models.test.mjs` from the source checkout.
+Browser interactions, exports, same-origin APIs and manifest routing: see
+[`store/tools/experience-tests`](../../tools/experience-tests/README.md).
+
+`seed-verdict.sh` establishes only artifact presence and keeps `ready:false`. The agent must run
+and record real domain and browser checks before writing a ready verdict. No cross-device pixel or
+audio equality is promised. The research is inspiration; this is original code, not a wrapper of
+any cited third-party engine.
+
+## Check your actual edited model
+
+Run `node tools/check.mjs --seeds 100` in the workspace. It reads the pure model from
+`<script id="harness-model">` in the artifact, checks domain invariants, repeats each seed, and
+writes `.harness/model-check.json`. Preserve that script boundary when editing. Model checks are
+followed by browser interaction, exported-output inspection, and visual or listening review.
diff --git a/store/agents/drone-pilot/harness.json b/store/agents/drone-pilot/harness.json
new file mode 100644
index 000000000..c43607d33
--- /dev/null
+++ b/store/agents/drone-pilot/harness.json
@@ -0,0 +1,32 @@
+{
+ "spec": 1,
+ "id": "autonomous/drone-pilot",
+ "name": "Drone Pilot",
+ "category": "Simulation",
+ "author": "Autonomous",
+ "description": "Fly a seeded canyon course in first person. Switch between manual controls and a tracking autopilot, inspect gate results and the flight path, and export telemetry.",
+ "engine": "claude",
+ "workspace": {
+ "template": "template",
+ "marker": "flight/index.html",
+ "init": "toolchain/init-workspace.sh"
+ },
+ "agent": {
+ "instructions": "AGENTS.md",
+ "skills": [
+ "skills"
+ ]
+ },
+ "toolchain": {
+ "setup": "toolchain/setup.sh",
+ "doctor": "toolchain/doctor.sh"
+ },
+ "viewer": {
+ "use": "autonomous/web-viewer",
+ "artifactExtensions": [
+ ".html"
+ ],
+ "url": "http://127.0.0.1:${port}/?file=${artifact}"
+ },
+ "verdict": ".harness/verdict.json"
+}
diff --git a/store/agents/drone-pilot/skills/pilot/SKILL.md b/store/agents/drone-pilot/skills/pilot/SKILL.md
new file mode 100644
index 000000000..47fd2646d
--- /dev/null
+++ b/store/agents/drone-pilot/skills/pilot/SKILL.md
@@ -0,0 +1,77 @@
+---
+name: pilot
+description: Build a deterministic, seedable first-person drone flight in one HTML file from a plain-English description. Use whenever the user asks for a drone flight, an FPV line, an obstacle course, a stunt run, or prompt-to-flight.
+---
+
+# pilot
+
+Take the user's description and produce a **single self-contained `flight/index.html`**
+that flies a **deterministic, seedable** first-person drone, loading the seed from a
+`?seed=` query param so the web-viewer can preview the current seed and re-seed live.
+
+## The floor (in order)
+
+1. **Seeded PRNG.** A small seeded PRNG derived from the hash of the seed string.
+ Nothing may call a non-seeded random — the flight must be reproducible.
+2. **Seeded course + physics.** A seeded course (gates, rings, obstacles, spawn)
+ driven by a small, stable fixed-timestep physics loop (position, velocity,
+ yaw/pitch, throttle).
+3. **`?seed=` plumbing.** Reading the param, plus a tiny UI (input + "re-seed"
+ button, and throttle/steer controls) so the person can browse seeds in the pane.
+4. **Named sub-streams.** One PRNG sub-stream per concern (course layout, obstacle
+ placement, decor) so tuning one doesn't reshuffle the other.
+
+## The gold checklist
+
+- **Trait tables that survive an edition**: seed → flight (course length, obstacle
+ count, difficulty), and a census that shows no impossible/duplicated course in
+ the range you claim.
+- **Level discipline**: a stable step so nothing explodes at high throttle; a HUD
+ (throttle, speed, gate count) that reads clearly.
+- **Style range**: a racing line, a slalom through gates, a canyon weave, an
+ obstacle run — matched to the brief, not all at once.
+- **Export route**: expose a "watch" mode that flies the seeded course on its own
+ and a visible minimap or gate list.
+
+## Verify like a pilot, not a compiler
+
+Fly a grid of seeds — actually fly them — and watch.
+Two hard checks before "ready":
+- **Re-fly same-seed** — it must be identical on this machine.
+- **Census the seed range you promise** (e.g. 0–99); reject any stuck camera,
+ impossible course, or infinite loop.
+
+Be explicit in the verdict about the reproducibility guarantee: same-machine yes;
+frame-timing physics you cannot prove bit-identical — say so.
+
+## Verdict feed
+
+Write `.harness/verdict.json` at every change:
+
+```json
+{ "spec": 1, "ready": false, "summary": "seeded slalom run · re-seed live · census 0–99 clean",
+ "findings": [{ "severity": "info", "kind": "reproducibility", "message": "same-machine verification pending; frame-timing physics not provable bit-identical" }],
+ "artifact": "flight/index.html",
+ "phases": [{ "id": "seed", "name": "Seeded core", "state": "done" },
+ { "id": "flight", "name": "The flight", "state": "active" },
+ { "id": "edition", "name": "Edition", "state": "pending" }],
+ "updatedAt": "2026-09-18T00:00:00Z" }
+```
+
+## Starting from Vector
+
+The template is functional: Twelve gates, fixed-step dynamics, first-person projection, autopilot/manual handoff, brake/boost, minimap, finite flight and telemetry export.
+
+Keep its useful controls and exports when making a user's creation. Test the behavioral core
+(flightCourse, flightStep, fixed 1/60 simulation ticks) as well as the visible result. A self-contained HTML file can still have well-separated
+model, rendering, input and export functions. Do not turn a finished starter into a waiting screen.
+
+Presence-only helpers do not prove correctness or reproducibility. Record actual evidence before
+marking the result ready. Export and reopen the result as part of the handoff to the user.
+
+## Check your actual edited model
+
+Run `node tools/check.mjs --seeds 100` in the workspace. It reads the pure model from
+`<script id="harness-model">` in the artifact, checks domain invariants, repeats each seed, and
+writes `.harness/model-check.json`. Preserve that script boundary when editing. Model checks are
+followed by browser interaction, exported-output inspection, and visual or listening review.
diff --git a/store/agents/drone-pilot/skills/pilot/scripts/seed-verdict.sh b/store/agents/drone-pilot/skills/pilot/scripts/seed-verdict.sh
new file mode 100755
index 000000000..bab3d760c
--- /dev/null
+++ b/store/agents/drone-pilot/skills/pilot/scripts/seed-verdict.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# Presence is not evidence of correctness. Only the agent's actual checks may establish ready:true.
+set -eu
+ws="${1:?usage: seed-verdict.sh WORKSPACE}"
+mkdir -p "$ws/.harness"
+summary="No artifact yet"; phase=pending
+if [ -s "$ws/flight/index.html" ]; then summary="Artifact available — browser verification pending"; phase=active; fi
+cat > "$ws/.harness/verdict.json" <<JSON
+{"spec":1,"ready":false,"summary":"$summary","artifact":"flight/index.html","findings":[{"severity":"info","kind":"verification_pending","message":"File presence checked; behavior, output quality and reproducibility have not been verified by this helper."}],"phases":[{"id":"build","name":"Build","state":"$phase"},{"id":"verify","name":"Verify","state":"pending"}],"updatedAt":"$(date -u +%Y-%m-%dT%H:%M:%SZ)"}
+JSON
diff --git a/store/agents/drone-pilot/store.json b/store/agents/drone-pilot/store.json
new file mode 100644
index 000000000..3e8218f5c
--- /dev/null
+++ b/store/agents/drone-pilot/store.json
@@ -0,0 +1,15 @@
+{
+ "homepage": "https://github.com/autonomous-ai/openharness/tree/main/store/agents/drone-pilot",
+ "license": "MIT",
+ "tagline": "Fly a seeded canyon course in first person",
+ "screenshots": [
+ "https://raw.githubusercontent.com/autonomous-ai/openharness/main/store/showcase/drone-pilot/starter.jpg"
+ ],
+ "examples": [
+ {
+ "prompt": "Design a slalom course over a canyon floor. Make the autopilot fly a clean lap, then give me manual controls and a trace to compare against it.",
+ "caption": "Vector · interactive offline starter",
+ "image": "https://raw.githubusercontent.com/autonomous-ai/openharness/main/store/showcase/drone-pilot/starter.jpg"
+ }
+ ]
+}
diff --git a/store/agents/drone-pilot/template/flight/index.html b/store/agents/drone-pilot/template/flight/index.html
new file mode 100644
index 000000000..8139c70c0
--- /dev/null
+++ b/store/agents/drone-pilot/template/flight/index.html
@@ -0,0 +1,1152 @@
+<!doctype html>
+<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
+<meta name="color-scheme" content="dark light"><title>VECTOR — Drone Pilot</title>
+<!-- Built by store/tools/build-experiences.mjs. Edit this file freely in your workspace. -->
+<style>:root {
+ color-scheme: dark;
+ --bg: #111414;
+ --panel: #191e1c;
+ --line: #ffffff1c;
+ --ink: #f4f2e9;
+ --muted: #a1aaa4;
+ --accent: #d0f28a;
+ font:
+ 14px/1.5 -apple-system,
+ BlinkMacSystemFont,
+ "Segoe UI",
+ sans-serif;
+}
+* {
+ box-sizing: border-box;
+}
+body {
+ margin: 0;
+ background: var(--bg);
+ color: var(--ink);
+}
+button,
+input,
+select {
+ font: inherit;
+}
+button,
+a,
+input,
+select {
+ -webkit-tap-highlight-color: transparent;
+}
+button,
+a {
+ touch-action: manipulation;
+}
+button {
+ cursor: pointer;
+}
+button:disabled {
+ opacity: 0.45;
+ cursor: wait;
+}
+button:focus-visible,
+input:focus-visible,
+select:focus-visible,
+a:focus-visible {
+ outline: 2px solid var(--accent);
+ outline-offset: 4px;
+}
+button,
+input,
+select {
+ color: inherit;
+ background: transparent;
+ border: 1px solid var(--line);
+ border-radius: 5px;
+ padding: 9px 13px;
+}
+button:hover {
+ background: #ffffff0c;
+ border-color: var(--muted);
+}
+button.primary {
+ background: var(--accent);
+ color: #142015;
+ border-color: transparent;
+ font-weight: 650;
+}
+button[aria-pressed="true"] {
+ border-color: var(--accent);
+ color: var(--accent);
+}
+input[type="range"] {
+ accent-color: var(--accent);
+ padding: 0;
+ min-width: 0;
+}
+input[type="number"] {
+ width: 80px;
+}
+select {
+ background: var(--panel);
+}
+label {
+ cursor: pointer;
+}
+a {
+ color: inherit;
+}
+h1,
+h2,
+h3,
+p {
+ margin: 0;
+}
+h1 {
+ font-size: clamp(32px, 5vw, 64px);
+ line-height: 1.02;
+ letter-spacing: -0.055em;
+ font-weight: 550;
+}
+h2 {
+ font-weight: 550;
+ letter-spacing: -0.03em;
+}
+h3 {
+ font-size: 14px;
+ font-weight: 550;
+}
+.mono,
+.eyebrow {
+ font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
+}
+.eyebrow {
+ font-size: 10px;
+ letter-spacing: 0.16em;
+ text-transform: uppercase;
+ color: var(--muted);
+}
+.muted {
+ color: var(--muted);
+}
+.small {
+ font-size: 12px;
+}
+.masthead {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 20px;
+ padding: 19px 28px;
+ border-bottom: 1px solid var(--line);
+}
+.identity {
+ display: flex;
+ gap: 12px;
+ align-items: center;
+ white-space: nowrap;
+ font-size: 12px;
+ font-weight: 600;
+ letter-spacing: 0.04em;
+}
+.mark {
+ width: 25px;
+ height: 25px;
+ display: grid;
+ place-items: center;
+ border: 1px solid currentColor;
+ font-size: 17px;
+}
+.seed-form {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+}
+.seed-form label {
+ font:
+ 10px ui-monospace,
+ monospace;
+ text-transform: uppercase;
+ letter-spacing: 0.12em;
+ color: var(--muted);
+ margin-right: 4px;
+}
+.seed-form input {
+ width: 74px;
+ padding: 6px 8px;
+ font:
+ 12px ui-monospace,
+ monospace;
+}
+.seed-form button {
+ padding: 6px 10px;
+ font-size: 12px;
+}
+.intro {
+ padding: 32px 28px;
+ display: flex;
+ align-items: flex-end;
+ justify-content: space-between;
+ gap: 20px;
+}
+.intro p {
+ max-width: 440px;
+ color: var(--muted);
+ margin-top: 14px;
+}
+.intro .eyebrow {
+ margin-bottom: 12px;
+}
+.actions {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ flex-wrap: wrap;
+}
+.workspace {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) 270px;
+ gap: 22px;
+ padding: 0 28px 28px;
+}
+.panel {
+ background: var(--panel);
+ border: 1px solid var(--line);
+ border-radius: 8px;
+ overflow: hidden;
+}
+.panel-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 16px 20px;
+ border-bottom: 1px solid var(--line);
+ gap: 10px;
+}
+.side {
+ display: flex;
+ flex-direction: column;
+ gap: 20px;
+}
+.section {
+ border-top: 1px solid var(--line);
+ padding-top: 18px;
+}
+.section h3 {
+ margin-bottom: 15px;
+}
+.field {
+ display: grid;
+ gap: 7px;
+ margin: 14px 0;
+}
+.field > span {
+ display: flex;
+ justify-content: space-between;
+ font-size: 12px;
+ color: var(--muted);
+}
+.metrics {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ gap: 1px;
+ background: var(--line);
+ border: 1px solid var(--line);
+ border-radius: 6px;
+ overflow: hidden;
+}
+.metric {
+ background: var(--bg);
+ padding: 13px 15px;
+}
+.metric strong {
+ display: block;
+ font:
+ 24px ui-monospace,
+ monospace;
+ letter-spacing: -0.06em;
+}
+.metric span {
+ font-size: 10px;
+ color: var(--muted);
+ text-transform: uppercase;
+ letter-spacing: 0.09em;
+}
+canvas {
+ display: block;
+ max-width: 100%;
+}
+.status-line {
+ display: flex;
+ justify-content: space-between;
+ gap: 20px;
+ padding: 14px 28px;
+ border-top: 1px solid var(--line);
+ font:
+ 10px ui-monospace,
+ monospace;
+ color: var(--muted);
+}
+.dot {
+ width: 6px;
+ height: 6px;
+ display: inline-block;
+ background: var(--accent);
+ border-radius: 50%;
+ margin-right: 6px;
+}
+.toast {
+ position: fixed;
+ z-index: 99;
+ left: 50%;
+ bottom: 22px;
+ transform: translateX(-50%);
+ max-width: 90vw;
+ background: var(--ink);
+ color: var(--bg);
+ padding: 11px 18px;
+ border-radius: 6px;
+ box-shadow: 0 3px 30px #0004;
+ font-size: 12px;
+}
+.toast:empty {
+ display: none;
+}
+[hidden] {
+ display: none !important;
+}
+.sr-only {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ padding: 0;
+ margin: -1px;
+ overflow: hidden;
+ clip-path: inset(50%);
+ white-space: nowrap;
+ border: 0;
+}
+@media (max-width: 800px) {
+ .workspace {
+ grid-template-columns: 1fr;
+ }
+ .side {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ }
+ .intro {
+ align-items: flex-start;
+ flex-direction: column;
+ }
+ .intro h1 {
+ font-size: 44px;
+ }
+}
+@media (max-width: 480px) {
+ .masthead {
+ padding: 13px 16px;
+ gap: 8px;
+ flex-wrap: wrap;
+ }
+ .intro {
+ padding: 26px 16px;
+ }
+ .intro h1 {
+ font-size: 38px;
+ }
+ .workspace {
+ padding: 0 16px 20px;
+ gap: 18px;
+ }
+ .side {
+ grid-template-columns: 1fr;
+ }
+ .seed-form label {
+ display: none;
+ }
+ .status-line {
+ padding: 12px 16px;
+ }
+ .status-line span:last-child {
+ display: none;
+ }
+ .metrics .metric {
+ padding: 12px 10px;
+ }
+ .panel-head {
+ padding: 12px;
+ }
+ .actions {
+ gap: 6px;
+ }
+}
+@media (prefers-reduced-motion: reduce) {
+ *,
+ *::before,
+ *::after {
+ scroll-behavior: auto !important;
+ animation: none !important;
+ transition: none !important;
+ }
+}
+
+:root {
+ --bg: #152025;
+ --panel: #1e2d32;
+ --ink: #e3ece5;
+ --muted: #9ab0b5;
+ --line: #66838744;
+ --accent: #c7e39b;
+}
+.mark {
+ border-radius: 50%;
+ color: var(--accent);
+}
+.flight-layout {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) 240px;
+ gap: 24px;
+ padding: 0 28px 28px;
+}
+.cockpit {
+ position: relative;
+ min-height: 530px;
+ border: 1px solid var(--line);
+ border-radius: 8px;
+ overflow: hidden;
+ background: #293f45;
+}
+.cockpit > canvas {
+ width: 100%;
+ height: 100%;
+ position: absolute;
+ inset: 0;
+ outline-offset: -3px;
+}
+.hud-top {
+ position: absolute;
+ top: 20px;
+ left: 20px;
+ right: 20px;
+ display: flex;
+ justify-content: space-between;
+ font:
+ 10px ui-monospace,
+ monospace;
+ letter-spacing: 0.1em;
+ text-shadow: 0 1px 3px #000;
+}
+.hud-bottom {
+ position: absolute;
+ bottom: 20px;
+ left: 25px;
+ right: 25px;
+ display: flex;
+ justify-content: space-between;
+ pointer-events: none;
+}
+.hud-bottom > div {
+ display: grid;
+ text-shadow: 0 2px 5px #000;
+}
+.hud-bottom strong {
+ font:
+ 32px ui-monospace,
+ monospace;
+ letter-spacing: -0.06em;
+}
+.hud-bottom span {
+ font:
+ 9px ui-monospace,
+ monospace;
+ opacity: 0.8;
+}
+.reticle {
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ transform: translate(-50%, -50%);
+ font-size: 27px;
+ color: #ffffff99;
+ pointer-events: none;
+}
+.gate-hint {
+ position: absolute;
+ top: 56px;
+ left: 20px;
+ font:
+ 10px ui-monospace,
+ monospace;
+ color: #d4e9d0;
+}
+.flight-aside {
+ display: flex;
+ flex-direction: column;
+ gap: 22px;
+}
+.flight-actions {
+ display: grid;
+ gap: 8px;
+}
+.flight-actions button {
+ width: 100%;
+}
+#minimap {
+ width: 100%;
+ height: 180px;
+ margin-top: 12px;
+}
+.flight-pad {
+ display: grid;
+ grid-template-columns: repeat(3, 38px);
+ gap: 5px;
+ margin-top: 15px;
+}
+.flight-pad button:first-child {
+ grid-column: 2;
+}
+.flight-pad button:nth-child(2) {
+ grid-column: 1;
+}
+.flight-pad button {
+ touch-action: none;
+}
+.flight-summary {
+ position: absolute;
+ inset: 32% 10% auto;
+ background: #142124eb;
+ border: 1px solid #b3cdaf55;
+ padding: 24px;
+ text-align: center;
+ backdrop-filter: blur(8px);
+ font-size: 24px;
+}
+.flight-summary span {
+ font-size: 12px;
+ display: block;
+ margin-top: 8px;
+ color: var(--muted);
+}
+@media (max-width: 800px) {
+ .flight-layout {
+ grid-template-columns: 1fr;
+ }
+ .cockpit {
+ min-height: 500px;
+ }
+ .flight-aside {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ }
+ .flight-actions {
+ align-content: start;
+ }
+ .flight-aside .section {
+ margin: 0;
+ }
+}
+@media (max-width: 480px) {
+ .flight-layout {
+ padding: 0 16px 20px;
+ }
+ .cockpit {
+ min-height: 440px;
+ }
+ .hud-top {
+ left: 12px;
+ right: 12px;
+ font-size: 8px;
+ }
+ .hud-bottom {
+ left: 14px;
+ right: 14px;
+ }
+ .hud-bottom strong {
+ font-size: 25px;
+ }
+ .flight-aside {
+ gap: 15px;
+ }
+ .flight-pad {
+ grid-template-columns: repeat(3, 34px);
+ }
+}
+</style></head><body>
+<header class="masthead"><div class="identity"><span class="mark" aria-hidden="true">↗</span>VECTOR / FLIGHT</div>
+<form class="seed-form" id="seed-form"><label for="seed">Seed</label><input id="seed" aria-label="Seed" maxlength="128" autocomplete="off" spellcheck="false"><button type="submit">Apply</button><button id="next-seed" type="button" title="Next seed">↗ Next</button></form></header>
+<section class="intro">
+ <div>
+ <p class="eyebrow">Training ground / Canyon sector 07</p>
+ <h1>Find your line.</h1>
+ <p>
+ Fly it yourself. Study the autopilot. Every gate, correction and split is
+ yours to inspect.
+ </p>
+ </div>
+ <button id="export-flight">Export telemetry ↗</button>
+</section>
+<main class="flight-layout">
+ <section class="cockpit">
+ <canvas
+ id="flight"
+ tabindex="0"
+ aria-label="First person drone flight. Use W and S to climb and descend, A and D to steer, Space to brake."
+ ></canvas>
+ <div class="hud-top">
+ <span
+ ><i class="dot"></i
+ ><span id="flight-mode">READY / AUTOPILOT</span></span
+ ><span id="flight-clock">00:00.00</span>
+ </div>
+ <div class="reticle" aria-hidden="true">+</div>
+ <div class="gate-hint" id="gate-hint">12 gates. One clean line.</div>
+ <div class="hud-bottom">
+ <div><strong id="velocity">0</strong><span>m/s · airspeed</span></div>
+ <div><strong id="altitude">13.0</strong><span>m · altitude</span></div>
+ <div><strong id="gates">0 / 12</strong><span>gates cleared</span></div>
+ </div>
+ <div id="flight-summary" class="flight-summary" hidden role="status"></div>
+ </section>
+ <aside class="flight-aside">
+ <div class="flight-actions">
+ <button class="primary" id="start-flight">▶ Watch autopilot</button
+ ><button id="manual">Take control</button
+ ><button id="reset-flight">↻ Restart course</button>
+ </div>
+ <section class="section">
+ <p class="eyebrow">The racing line</p>
+ <canvas
+ id="minimap"
+ aria-label="Course overview and recorded flight path"
+ ></canvas>
+ </section>
+ <section class="section">
+ <h3>Flight controls</h3>
+ <p class="small muted">
+ W / S · climb / descend<br />A / D · steer left / right<br />Shift ·
+ boost &nbsp; Space · brake
+ </p>
+ <div class="flight-pad">
+ <button data-axis="y" data-value="1" aria-label="Climb">↑</button
+ ><button data-axis="x" data-value="-1" aria-label="Steer left">←</button
+ ><button data-axis="y" data-value="-1" aria-label="Descend">↓</button
+ ><button data-axis="x" data-value="1" aria-label="Steer right">
+ →
+ </button>
+ </div>
+ </section>
+ <section class="section small muted">
+ <p>
+ Fixed-step browser simulation. The autopilot is a local tracking
+ controller you can inspect and replace.
+ </p>
+ <p style="margin-top: 8px">
+ Flight dynamics are illustrative. This does not control a physical
+ drone.
+ </p>
+ </section>
+ </aside>
+</main>
+<footer class="status-line">
+ <span><i class="dot"></i>60 Hz SIMULATION / SEEDED COURSE</span
+ ><span>PRECISION IS A FEELING YOU CAN LEARN.</span>
+</footer>
+<div class="toast" id="toast" role="status"></div>
+<script id="harness-model">
+'use strict';
+// Shared deterministic primitives. Domain models use named streams so unrelated edits stay stable.
+function hash(value) {
+ let h = 2166136261;
+ for (const c of String(value)) h = Math.imul(h ^ c.charCodeAt(0), 16777619);
+ return h >>> 0;
+}
+function random(seed, stream = "main") {
+ let a = hash(`${seed}:${stream}`);
+ return () => {
+ a = (a + 0x6d2b79f5) | 0;
+ let t = Math.imul(a ^ (a >>> 15), 1 | a);
+ t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
+ };
+}
+const clamp = (n, lo, hi) => Math.max(lo, Math.min(hi, n));
+const lerp = (a, b, t) => a + (b - a) * t;
+const pick = (items, rng) => items[Math.floor(rng() * items.length)];
+function normal(rng) {
+ return (
+ Math.sqrt(-2 * Math.log(Math.max(1e-9, rng()))) *
+ Math.cos(2 * Math.PI * rng())
+ );
+}
+
+function flightCourse(seed, count = 12) {
+ const r = random(seed, "gates"),
+ phase = r() * 6.28;
+ return Array.from({ length: count }, (_, i) => ({
+ x: Math.sin(i * 0.62 + phase) * 17,
+ y: 13 + Math.sin(i * 0.85 + phase) * 5,
+ z: 45 + i * 42,
+ radius: 6,
+ index: i,
+ }));
+}
+function flightStart() {
+ return {
+ x: 0,
+ y: 13,
+ z: 0,
+ vx: 0,
+ vy: 0,
+ speed: 22,
+ next: 0,
+ passed: 0,
+ missed: 0,
+ steps: 0,
+ time: 0,
+ finished: false,
+ crashed: false,
+ };
+}
+function flightStep(state, course, input = {}, dt = 1 / 60) {
+ const s = { ...state };
+ if (s.finished || s.crashed) return s;
+ const target = course[Math.min(s.next, course.length - 1)];
+ const auto = input.autopilot !== false;
+ const desiredX = auto
+ ? clamp((target.x - s.x) * 2, -15, 15)
+ : (input.x || 0) * 14;
+ const desiredY = auto
+ ? clamp((target.y - s.y) * 2, -10, 10)
+ : (input.y || 0) * 10;
+ s.vx = lerp(s.vx, desiredX, 1 - Math.exp(-dt * 4));
+ s.vy = lerp(s.vy, desiredY, 1 - Math.exp(-dt * 4));
+ s.speed = lerp(
+ s.speed,
+ input.brake ? 7 : input.boost ? 34 : 22,
+ 1 - Math.exp(-dt * 3),
+ );
+ s.x = clamp(s.x + s.vx * dt, -65, 65);
+ s.y += s.vy * dt;
+ s.z += s.speed * dt;
+ s.steps++;
+ s.time = s.steps / 60;
+ if (s.y < 1.5) {
+ s.crashed = true;
+ s.y = 1.5;
+ return s;
+ }
+ s.y = Math.min(48, s.y);
+ if (s.next < course.length && s.z >= target.z) {
+ if (Math.hypot(s.x - target.x, s.y - target.y) <= target.radius) s.passed++;
+ else s.missed++;
+ s.next++;
+ }
+ if (s.z >= course.at(-1).z + 25) s.finished = true;
+ return s;
+}
+function flyAutopilot(seed) {
+ const course = flightCourse(seed);
+ let state = flightStart();
+ for (let i = 0; i < 6000 && !state.finished && !state.crashed; i++)
+ state = flightStep(state, course);
+ return state;
+}
+
+</script>
+<script>
+'use strict';
+const $ = (s) => document.querySelector(s);
+const $$ = (s) => [...document.querySelectorAll(s)];
+const params = new URLSearchParams(location.search);
+let seed = (params.get("seed") || "42").slice(0, 128);
+const reducedMotion = matchMedia("(prefers-reduced-motion: reduce)").matches;
+const parentMessage = (message) => {
+ if (parent !== window) parent.postMessage(message, "*");
+};
+function toast(message) {
+ $("#toast").textContent = message;
+ clearTimeout(toast.timer);
+ toast.timer = setTimeout(() => {
+ $("#toast").textContent = "";
+ }, 3500);
+}
+function saveFile(name, content, type = "application/json") {
+ const blob =
+ content instanceof Blob ? content : new Blob([content], { type });
+ const url = URL.createObjectURL(blob),
+ a = document.createElement("a");
+ a.href = url;
+ a.download = name;
+ document.body.append(a);
+ a.click();
+ a.remove();
+ setTimeout(() => URL.revokeObjectURL(url), 30000);
+}
+function canvasPNG(canvas, name) {
+ canvas.toBlob((blob) => {
+ if (blob) saveFile(name, blob);
+ else toast("Image export failed. Please try again.");
+ });
+}
+function setSeed(value) {
+ seed = String(value).trim().slice(0, 128) || "42";
+ $("#seed").value = seed;
+ const url = new URL(location.href);
+ url.searchParams.set("seed", seed);
+ try {
+ history.replaceState(null, "", url);
+ } catch {
+ /* Opaque-origin iframe: the shell owns its URL. */
+ }
+ parentMessage({ type: "harness:state", seed });
+ dispatchEvent(new CustomEvent("seedchange", { detail: seed }));
+}
+$("#seed").value = seed;
+$("#seed-form").addEventListener("submit", (e) => {
+ e.preventDefault();
+ setSeed($("#seed").value);
+});
+$("#next-seed").addEventListener("click", () =>
+ setSeed(/^\d{1,9}$/.test(seed) ? Number(seed) + 1 : hash(seed)),
+);
+function fitCanvas(canvas, draw, maxDpr = 2) {
+ const observer = new ResizeObserver(() => {
+ const box = canvas.getBoundingClientRect(),
+ dpr = Math.min(devicePixelRatio || 1, maxDpr);
+ canvas.width = Math.max(1, Math.round(box.width * dpr));
+ canvas.height = Math.max(1, Math.round(box.height * dpr));
+ draw?.();
+ });
+ observer.observe(canvas);
+ return observer;
+}
+const editable = (target) =>
+ target instanceof Element &&
+ !!target.closest("input,textarea,select,[contenteditable=true]");
+addEventListener("error", (e) =>
+ parentMessage({ type: "harness:error", message: e.message }),
+);
+addEventListener("unhandledrejection", (e) =>
+ parentMessage({
+ type: "harness:error",
+ message: String(e.reason?.message || e.reason),
+ }),
+);
+function ready() {
+ document.body.dataset.ready = "true";
+ parentMessage({ type: "harness:ready", title: document.title, seed });
+}
+
+let course,
+ state,
+ flightRunning = false,
+ autopilot = true,
+ telemetry = [],
+ keys = {},
+ touchInput = { x: 0, y: 0 },
+ accumulator = 0,
+ previousTime = 0;
+function projectFlight(x, y, z, w, h) {
+ const dz = z - state.z;
+ if (dz < 0.6) return null;
+ const scale = (w * 0.8) / dz;
+ return {
+ x: w / 2 + (x - state.x) * scale,
+ y: h * 0.47 - (y - state.y) * scale,
+ scale,
+ };
+}
+function drawFlight() {
+ if (!state) return;
+ const c = $("#flight"),
+ ctx = c.getContext("2d"),
+ w = c.width,
+ h = c.height;
+ const sky = ctx.createLinearGradient(0, 0, 0, h);
+ sky.addColorStop(0, "#243e4a");
+ sky.addColorStop(0.53, "#849c9a");
+ sky.addColorStop(1, "#576654");
+ ctx.fillStyle = sky;
+ ctx.fillRect(0, 0, w, h);
+ ctx.fillStyle = "#d7d9af";
+ ctx.beginPath();
+ ctx.arc(w * 0.72, h * 0.23, w * 0.035, 0, Math.PI * 2);
+ ctx.fill();
+ ctx.save();
+ ctx.translate(w / 2, h * 0.5);
+ ctx.rotate(-state.vx * 0.009);
+ ctx.translate(-w / 2, -h * 0.5);
+ for (let layer = 0; layer < 3; layer++) {
+ ctx.fillStyle = ["#708989", "#5d7777", "#476164"][layer];
+ ctx.beginPath();
+ ctx.moveTo(-w, h);
+ for (let i = -1; i <= 24; i++) {
+ const x = (i * w) / 22;
+ const y =
+ h * (0.4 + layer * 0.035) -
+ Math.sin(i * 1.2 + layer * 2.2 + (hash(seed) % 20)) * h * 0.05 -
+ Math.cos(i * 2.7) * h * 0.025;
+ ctx.lineTo(x, y);
+ }
+ ctx.lineTo(w * 2, h);
+ ctx.fill();
+ }
+ const base = Math.floor(state.z / 14) * 14;
+ for (let z = base + 250; z > state.z + 1; z -= 14) {
+ const a = projectFlight(-80, 0, z, w, h),
+ b = projectFlight(80, 0, z, w, h);
+ if (!a || !b) continue;
+ ctx.strokeStyle = "#bed3ae24";
+ ctx.lineWidth = 1;
+ ctx.beginPath();
+ ctx.moveTo(a.x, a.y);
+ ctx.lineTo(b.x, b.y);
+ ctx.stroke();
+ }
+ for (let x = -80; x <= 80; x += 10) {
+ const a = projectFlight(x, 0, state.z + 2, w, h),
+ b = projectFlight(x, 0, state.z + 270, w, h);
+ ctx.strokeStyle = "#bed3ae20";
+ ctx.beginPath();
+ ctx.moveTo(a.x, a.y);
+ ctx.lineTo(b.x, b.y);
+ ctx.stroke();
+ }
+ // Cliff columns are projected in world space; their parallax makes steering legible.
+ const boxes = [];
+ for (let i = Math.floor(state.z / 28); i < Math.floor(state.z / 28) + 12; i++)
+ for (const side of [-1, 1]) {
+ const r = random(seed, `rock:${i}:${side}`);
+ boxes.push({
+ x: side * (34 + r() * 22),
+ z: i * 28 + 12,
+ y: 12 + r() * 35,
+ width: 8 + r() * 7,
+ });
+ }
+ for (const box of boxes.sort((a, b) => b.z - a.z)) {
+ const p = [
+ projectFlight(box.x - box.width, 0, box.z, w, h),
+ projectFlight(box.x + box.width, 0, box.z, w, h),
+ projectFlight(box.x + box.width, box.y, box.z, w, h),
+ projectFlight(box.x - box.width, box.y, box.z, w, h),
+ ];
+ if (p.some((v) => !v)) continue;
+ ctx.fillStyle = box.x < 0 ? "#344f53" : "#3d5558";
+ ctx.beginPath();
+ p.forEach((v, i) => (i ? ctx.lineTo(v.x, v.y) : ctx.moveTo(v.x, v.y)));
+ ctx.closePath();
+ ctx.fill();
+ ctx.strokeStyle = "#768d7744";
+ ctx.stroke();
+ }
+ for (let i = course.length - 1; i >= state.next; i--) {
+ const gate = course[i],
+ p = projectFlight(gate.x, gate.y, gate.z, w, h);
+ if (!p || gate.z - state.z > 260) continue;
+ const radius = gate.radius * p.scale;
+ ctx.strokeStyle = i === state.next ? "#d9f0a7" : "#bfd9bc66";
+ ctx.lineWidth = Math.max(2, p.scale * 0.35);
+ ctx.shadowColor = "#ddf7af";
+ ctx.shadowBlur = i === state.next ? 9 : 0;
+ ctx.beginPath();
+ for (let j = 0; j <= 8; j++) {
+ const a = Math.PI / 8 + (j * Math.PI) / 4,
+ x = p.x + Math.cos(a) * radius,
+ y = p.y + Math.sin(a) * radius;
+ j ? ctx.lineTo(x, y) : ctx.moveTo(x, y);
+ }
+ ctx.stroke();
+ ctx.shadowBlur = 0;
+ ctx.font = `${clamp(p.scale * 1.8, 10, 50)}px monospace`;
+ ctx.textAlign = "center";
+ ctx.fillStyle = "#e6f3cc";
+ ctx.fillText(String(i + 1).padStart(2, "0"), p.x, p.y - radius - 8);
+ }
+ ctx.restore();
+ drawMinimap();
+}
+function drawMinimap() {
+ const c = $("#minimap"),
+ ctx = c.getContext("2d"),
+ w = c.width,
+ h = c.height;
+ if (!course) return;
+ ctx.clearRect(0, 0, w, h);
+ const pos = (x, z) => ({
+ x: w / 2 + (x / 90) * w,
+ y: h - 12 - (z / (course.at(-1).z + 30)) * (h - 24),
+ });
+ ctx.strokeStyle = "#94b2a95c";
+ ctx.beginPath();
+ course.forEach((g, i) => {
+ const p = pos(g.x, g.z);
+ i ? ctx.lineTo(p.x, p.y) : ctx.moveTo(p.x, p.y);
+ });
+ ctx.stroke();
+ course.forEach((g, i) => {
+ const p = pos(g.x, g.z);
+ ctx.fillStyle = i < state.next ? "#8eac99" : "#cde4a1";
+ ctx.fillRect(p.x - 3, p.y - 3, 6, 6);
+ });
+ ctx.strokeStyle = "#dfa578";
+ ctx.beginPath();
+ telemetry.forEach((t, i) => {
+ const p = pos(t.x, t.z);
+ i ? ctx.lineTo(p.x, p.y) : ctx.moveTo(p.x, p.y);
+ });
+ ctx.stroke();
+ const p = pos(state.x, state.z);
+ ctx.fillStyle = "#f4eac7";
+ ctx.beginPath();
+ ctx.arc(p.x, p.y, 5, 0, Math.PI * 2);
+ ctx.fill();
+}
+function updateFlightHUD() {
+ $("#velocity").textContent = flightRunning ? state.speed.toFixed(1) : "0";
+ $("#altitude").textContent = state.y.toFixed(1);
+ $("#gates").textContent = `${state.passed} / ${course.length}`;
+ $("#flight-clock").textContent =
+ `${String(Math.floor(state.time / 60)).padStart(2, "0")}:${(state.time % 60).toFixed(2).padStart(5, "0")}`;
+ $("#flight-mode").textContent =
+ `${flightRunning ? "FLYING" : "PAUSED"} / ${autopilot ? "AUTOPILOT" : "MANUAL"}`;
+ $("#gate-hint").textContent =
+ state.next < course.length
+ ? `GATE ${String(state.next + 1).padStart(2, "0")} · ${Math.max(0, course[state.next].z - state.z).toFixed(0)} m · ${state.missed} missed`
+ : "Course complete";
+ $("#start-flight").textContent = flightRunning
+ ? "Ⅱ Pause flight"
+ : autopilot
+ ? "▶ Watch autopilot"
+ : "▶ Resume flight";
+ $("#manual").textContent = autopilot ? "Take control" : "Engage autopilot";
+}
+function resetFlight() {
+ course = flightCourse(seed);
+ state = flightStart();
+ telemetry = [{ ...state }];
+ flightRunning = false;
+ accumulator = 0;
+ keys = {};
+ $("#flight-summary").hidden = true;
+ updateFlightHUD();
+ drawFlight();
+}
+$("#start-flight").onclick = () => {
+ if (state.finished || state.crashed) resetFlight();
+ flightRunning = !flightRunning;
+ updateFlightHUD();
+ $("#flight").focus();
+};
+$("#manual").onclick = () => {
+ autopilot = !autopilot;
+ flightRunning = true;
+ updateFlightHUD();
+ $("#flight").focus();
+};
+$("#reset-flight").onclick = resetFlight;
+addEventListener("keydown", (e) => {
+ if (editable(e.target)) return;
+ if (
+ [
+ "w",
+ "a",
+ "s",
+ "d",
+ "arrowup",
+ "arrowdown",
+ "arrowleft",
+ "arrowright",
+ " ",
+ "shift",
+ ].includes(e.key.toLowerCase())
+ ) {
+ e.preventDefault();
+ keys[e.key.toLowerCase()] = true;
+ }
+});
+addEventListener("keyup", (e) => {
+ keys[e.key.toLowerCase()] = false;
+});
+addEventListener("blur", () => {
+ keys = {};
+ touchInput = { x: 0, y: 0 };
+});
+$$(".flight-pad button").forEach((b) => {
+ b.onpointerdown = (e) => {
+ e.preventDefault();
+ autopilot = false;
+ flightRunning = true;
+ touchInput[b.dataset.axis] = +b.dataset.value;
+ b.setPointerCapture(e.pointerId);
+ updateFlightHUD();
+ };
+ b.onpointerup = b.onpointercancel = () => {
+ touchInput[b.dataset.axis] = 0;
+ };
+});
+$("#export-flight").onclick = () =>
+ saveFile(
+ `vector-${hash(seed)}.json`,
+ JSON.stringify(
+ {
+ seed,
+ mode: autopilot ? "autopilot" : "manual",
+ step: 1 / 60,
+ course,
+ telemetry,
+ result: state,
+ },
+ null,
+ 2,
+ ),
+ );
+function flightFrame(time) {
+ const delta = Math.min(0.1, (time - previousTime) / 1000 || 0);
+ previousTime = time;
+ if (flightRunning && !document.hidden) {
+ accumulator += delta;
+ while (accumulator >= 1 / 60) {
+ state = flightStep(state, course, {
+ autopilot,
+ x:
+ touchInput.x +
+ (keys.d || keys.arrowright ? 1 : 0) -
+ (keys.a || keys.arrowleft ? 1 : 0),
+ y:
+ touchInput.y +
+ (keys.w || keys.arrowup ? 1 : 0) -
+ (keys.s || keys.arrowdown ? 1 : 0),
+ brake: keys[" "],
+ boost: keys.shift,
+ });
+ accumulator -= 1 / 60;
+ if (state.steps % 12 === 0) telemetry.push({ ...state });
+ if (state.finished || state.crashed) {
+ flightRunning = false;
+ $("#flight-summary").hidden = false;
+ $("#flight-summary").replaceChildren(
+ document.createTextNode(
+ state.crashed
+ ? "Back to the flight line."
+ : state.missed
+ ? "A line to improve."
+ : "A clean run.",
+ ),
+ );
+ const span = document.createElement("span");
+ span.textContent = `${state.passed} / ${course.length} gates · ${state.time.toFixed(2)} s · ${state.missed} missed`;
+ $("#flight-summary").append(span);
+ break;
+ }
+ }
+ updateFlightHUD();
+ drawFlight();
+ }
+ requestAnimationFrame(flightFrame);
+}
+fitCanvas($("#flight"), drawFlight);
+fitCanvas($("#minimap"), drawMinimap);
+addEventListener("seedchange", resetFlight);
+resetFlight();
+requestAnimationFrame(flightFrame);
+ready();
+
+</script></body></html>
diff --git a/store/agents/drone-pilot/template/tools/check.mjs b/store/agents/drone-pilot/template/tools/check.mjs
new file mode 100644
index 000000000..a7c2f66eb
--- /dev/null
+++ b/store/agents/drone-pilot/template/tools/check.mjs
@@ -0,0 +1,75 @@
+const CONFIG = {"id":"drone-pilot","artifact":"flight/index.html"};
+// Compiled into each workspace's tools/check.mjs. Tests the model in the ACTUAL edited HTML.
+import { readFile, mkdir, writeFile } from "node:fs/promises";
+import { createHash } from "node:crypto";
+import vm from "node:vm";
+import { resolve, dirname } from "node:path";
+
+const args = process.argv.slice(2),
+ i = args.indexOf("--seeds");
+const count = i === -1 ? 32 : Number(args[i + 1]);
+if (!Number.isInteger(count) || count < 1 || count > 1000)
+ throw new Error("--seeds must be an integer from 1 to 1000");
+const artifact = resolve(CONFIG.artifact);
+const html = await readFile(artifact, "utf8");
+const script = html.match(
+ /<script id="harness-model">([\s\S]*?)<\/script>/,
+)?.[1];
+if (!script)
+ throw new Error(
+ 'Keep the pure model in <script id="harness-model"> so this checker can exercise the actual artifact.',
+ );
+const expressions = {
+ "generative-art": `const m=artModel(SEED);const p=artPaths(m);({state:m,valid:p.length>0&&p.flat().every(([x,y])=>Number.isFinite(x)&&Number.isFinite(y)),metrics:{paths:p.length,palette:m.palette}})`,
+ "creative-direction": `const m=directionModel(SEED);const ratio=contrast(m.colors[0],m.colors[1]);({state:m,valid:ratio>=4.5,metrics:{direction:m.name,contrast:ratio}})`,
+ "lab-bench": `const p=experiment(SEED),e=treatmentEffect(p);({state:p,valid:p.length>1&&p.every(p=>Number.isFinite(p.x)&&Number.isFinite(p.y))&&Number.isFinite(e.low)&&e.low<=e.high,metrics:{samples:p.length,effect:e.difference,interval:[e.low,e.high]}})`,
+ "music-studio": `const s=musicScore(SEED),r=renderMusic(s);({state:Array.from(r.samples),valid:r.peak>.001&&r.peak<=.95&&r.samples.every(Number.isFinite),metrics:{seconds:r.duration,peak:r.peak,rms:r.rms}})`,
+ "game-master": `const m=arenaMatch(SEED),s=m.history.at(-1);({state:m,valid:m.history.length>1&&m.history.length<=10000&&s.units.every(u=>u.hp>=0&&u.x>=0&&u.x<m.map.w&&u.y>=0&&u.y<m.map.h),metrics:{turns:s.turn,score:s.score,winner:m.winner}})`,
+ "drone-pilot": `const s=flyAutopilot(SEED);({state:s,valid:s.finished&&!s.crashed&&s.passed===flightCourse(SEED).length,metrics:{seconds:s.time,passed:s.passed,missed:s.missed}})`,
+ "voxel-worlds": `const w=voxelWorld(SEED);let p={...w.spawn,vy:0,grounded:true};const clear=playerFits(w,p.x,p.y,p.z);for(let t=0;t<120;t++)p=movePlayer(w,p,{forward:1});({state:Array.from(w.blocks),valid:clear&&playerFits(w,p.x,p.y,p.z),metrics:{blocks:w.blocks.filter(Boolean).length,walkDistance:Math.hypot(p.x-w.spawn.x,p.z-w.spawn.z)}})`,
+};
+const expression = expressions[CONFIG.id];
+const digest = (value) =>
+ createHash("sha256").update(JSON.stringify(value)).digest("hex");
+const results = [];
+for (let seed = 0; seed < count; seed++) {
+ const run = () =>
+ vm.runInNewContext(
+ `${script}\n${expression}`,
+ { SEED: String(seed) },
+ { timeout: 10000 },
+ );
+ try {
+ const first = run(),
+ second = run(),
+ signature = digest(first.state),
+ repeat = digest(second.state);
+ results.push({
+ seed,
+ ok: first.valid && signature === repeat,
+ signature,
+ metrics: first.metrics,
+ });
+ } catch (error) {
+ results.push({ seed, ok: false, error: error.message });
+ }
+}
+const passed = results.filter((r) => r.ok).length;
+const report = {
+ spec: 1,
+ harness: CONFIG.id,
+ artifact: CONFIG.artifact,
+ checkedAt: new Date().toISOString(),
+ modelChecks: { passed, total: count },
+ scope:
+ "Pure model invariants and same-process repeatability. Browser interaction, layout, listening and export review still required.",
+ results,
+};
+const out = resolve(".harness/model-check.json");
+await mkdir(dirname(out), { recursive: true });
+await writeFile(out, JSON.stringify(report, null, 2) + "\n");
+console.log(
+ `${CONFIG.id}: ${passed}/${count} model checks passed. Report: ${out}`,
+);
+console.log(report.scope);
+if (passed !== count) process.exitCode = 1;
diff --git a/store/agents/drone-pilot/test/toolchain.test.mjs b/store/agents/drone-pilot/test/toolchain.test.mjs
new file mode 100644
index 000000000..fd40bfb5b
--- /dev/null
+++ b/store/agents/drone-pilot/test/toolchain.test.mjs
@@ -0,0 +1,66 @@
+// The Drone Pilot harness scripts, run the way Harness runs them.
+// node --test test/*.test.mjs
+import assert from 'node:assert/strict'
+import { spawnSync } from 'node:child_process'
+import { accessSync, constants, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { after, test } from 'node:test'
+
+const here = fileURLToPath(new URL('..', import.meta.url))
+const manifest = JSON.parse(readFileSync(join(here, 'harness.json'), 'utf8'))
+const scratch = []
+after(() => { for (const dir of scratch) rmSync(dir, { recursive: true, force: true }) })
+
+function tempDir() { const d = mkdtempSync(join(tmpdir(), 'pilot-')); scratch.push(d); return d }
+function run(script, { cwd = here, env = {} } = {}) {
+ const merged = { ...process.env }
+ for (const [k, v] of Object.entries(env)) v === null ? delete merged[k] : (merged[k] = v)
+ const r = spawnSync(join(here, script), { cwd, env: merged, encoding: 'utf8' })
+ return { code: r.status, stdout: r.stdout, stderr: r.stderr }
+}
+const seedScript = join(here, 'skills/pilot/scripts/seed-verdict.sh')
+
+test('every script the manifest names is in the folder and executable', () => {
+ for (const s of [manifest.workspace.init, manifest.toolchain.setup, manifest.toolchain.doctor]) {
+ assert.doesNotThrow(() => accessSync(join(here, s), constants.X_OK), s)
+ }
+})
+
+test('setup installs nothing and succeeds quietly', () => {
+ assert.deepEqual(run(manifest.toolchain.setup), { code: 0, stdout: '', stderr: '' })
+})
+
+test('doctor says ok when sh is on PATH', () => {
+ assert.equal(run(manifest.toolchain.doctor).code, 0)
+})
+
+test('init lays out a workspace and seeds a not-ready verdict', () => {
+ const ws = tempDir()
+ assert.equal(run(manifest.workspace.init, { cwd: ws, env: { HARNESS_DSH: manifest.id } }).code, 0)
+ assert.equal(JSON.parse(readFileSync(join(ws, '.harness/verdict.json'), 'utf8')).ready, false)
+ assert.equal(readFileSync(join(ws, '.harness-initialized'), 'utf8'), `initialized by ${manifest.id}\n`)
+})
+
+test('the manifest names a viewer package and an HTML artifact', () => {
+ assert.equal(manifest.viewer.use, 'autonomous/web-viewer')
+ assert.deepEqual(manifest.viewer.artifactExtensions, ['.html'])
+})
+
+test('seed-verdict reflects whether a flight exists', () => {
+ const ws = tempDir()
+ run(manifest.workspace.init, { cwd: ws })
+ assert.equal(spawnSync(seedScript, [ws], { cwd: ws, encoding: 'utf8' }).status, 0)
+ assert.equal(JSON.parse(readFileSync(join(ws, '.harness/verdict.json'), 'utf8')).ready, false)
+ mkdirSync(join(ws, 'flight'), { recursive: true })
+ writeFileSync(join(ws, 'flight/index.html'), '<!doctype html>')
+ assert.equal(spawnSync(seedScript, [ws], { cwd: ws, encoding: 'utf8' }).status, 0)
+ assert.equal(JSON.parse(readFileSync(join(ws, '.harness/verdict.json'), 'utf8')).ready, false)
+})
+
+
+test('the manifest routes the actual nested artifact through the shared viewer', () => {
+ assert.equal(manifest.viewer.url, 'http://127.0.0.1:${port}/?file=${artifact}')
+ assert.ok(manifest.workspace.marker.endsWith('/index.html'))
+})
diff --git a/store/agents/drone-pilot/toolchain/doctor.sh b/store/agents/drone-pilot/toolchain/doctor.sh
new file mode 100755
index 000000000..b65fc95e4
--- /dev/null
+++ b/store/agents/drone-pilot/toolchain/doctor.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+# Doctor: the flight is just a file served by the shared web-viewer; no extra runtime needed.
+exit 0
diff --git a/store/agents/drone-pilot/toolchain/init-workspace.sh b/store/agents/drone-pilot/toolchain/init-workspace.sh
new file mode 100755
index 000000000..92190e081
--- /dev/null
+++ b/store/agents/drone-pilot/toolchain/init-workspace.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Harness copies the template before this runs. Preserve the user's design log on repeat calls.
+set -eu
+ws="${1:-$PWD}"
+mkdir -p "$ws/flight" "$ws/.harness"
+if [ ! -f "$ws/flight/DESIGN.md" ]; then
+ printf '# Design log — Drone Pilot\n\nRecord date, USER or AI, decision, rationale, and whether it remains in the build.\n' > "$ws/flight/DESIGN.md"
+fi
+cat > "$ws/.harness/verdict.json" <<JSON
+{"spec":1,"ready":false,"summary":"Vector starter available — describe what you want to create","artifact":"flight/index.html","findings":[{"severity":"info","kind":"review_pending","message":"Starter provided; personalized changes need browser verification."}],"phases":[{"id":"build","name":"Build","state":"active"},{"id":"verify","name":"Verify","state":"pending"}],"updatedAt":"$(date -u +%Y-%m-%dT%H:%M:%SZ)"}
+JSON
+printf 'initialized by %s\n' "${HARNESS_DSH:-autonomous/drone-pilot}" > "$ws/.harness-initialized"
diff --git a/store/agents/drone-pilot/toolchain/setup.sh b/store/agents/drone-pilot/toolchain/setup.sh
new file mode 100755
index 000000000..7cf64d63a
--- /dev/null
+++ b/store/agents/drone-pilot/toolchain/setup.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+# Drone Pilot has no toolchain: everything is inline HTML + canvas physics. Nothing to install.
+exit 0
diff --git a/store/agents/game-master/AGENTS.md b/store/agents/game-master/AGENTS.md
new file mode 100644
index 000000000..c1162f68e
--- /dev/null
+++ b/store/agents/game-master/AGENTS.md
@@ -0,0 +1,66 @@
+# Game Master / AI-vs-AI Arena harness
+
+You turn a plain-English description into a **deterministic, seedable arena game**
+rendered in one self-contained `game/index.html`. The pane runs the match live, so
+the person watches two AIs (or plays against one) — and a re-seed — as you work.
+
+## What a good game is
+
+- **One file, offline.** All logic, AI and rendering inline. No CDN at runtime. A
+ `?seed=` query param selects the version: the same seed always plays the same
+ match on this machine.
+- **Determinism is the product.** Seed a PRNG and name sub-streams (per player, per
+ move roll, per map layout) so tuning one doesn't reshuffle the rest. Same seed →
+ same arena, same openings, same match.
+- **Visible, not just automatic.** Keep the rules legible (a grid or board that
+ reads clearly), give the match a start/middle/end, and expose a live scoreline so
+ the pane is fun to watch. Player-vs-AI modes should take real input.
+- **Be honest about verification.** Same-machine playback is checkable. Timing-based
+ AI or animation is not bit-identical across machines — say so in the verdict
+ rather than overclaiming.
+
+## How to work so the pane moves
+
+1. **Save within a minute.** Materialize `game/index.html` that runs a trivial seeded
+ arena (a grid, two tokens that each move a tick, a scoreline), so the header has
+ a state and the pane can play it.
+2. **Build the engine, then the match.** Get the seeded board + turn loop + AI
+ policies right first; only then tune pacing, visuals, and player controls.
+3. **Verify like a spectator:** run a few seeds in the pane, watch the scoreline,
+ check no side stalls, re-run the same seed and confirm it is identical.
+4. **Update `.harness/verdict.json`** at every check — `ready`, one-line `summary`,
+ `phases`, `findings`, and a reproducibility note.
+
+## Rules
+
+- A game is only "ready" when every seed in the range you promise plays clean: no
+ stuck AI, no deadlock, no infinite match. Sample a grid of seeds.
+- Tag every crafted decision USER vs AI in `game/DESIGN.md`
+ (`YYYY-MM-DD | USER|AI | topic | decision | still in build?`).
+- The `summary` says plainly what is reproducible now and what is not.
+
+## Shipped experience and operating standard
+
+The workspace starts with **Relay**, a working experience, not an empty placeholder.
+Finite 72-turn matches, two policies, pathfinding, relay control, combat/respawn, replay timeline, 32-match tournament, full replay JSON.
+
+- Read the existing artifact before replacing it. The useful model boundaries are arenaMap, arenaPath, arenaMatch, arenaTournament.
+- Preserve working interactions and exports when extending the artifact. Match the user's brief;
+ the starter's genre and visual style are examples, not a ceiling.
+- Expose meaningful domain controls and outputs. Every control must change real state; every
+ displayed metric must be computed from that state. Never invent model activity or test results.
+- Use named random streams and a fixed simulation/score clock. Sample seeds, repeat the same
+ seed, inspect exported data, and verify keyboard/touch controls in the actual viewer.
+- This HTML runs with same-origin APIs in the shared viewer. Sibling fetches, localStorage,
+ downloads and pointer lock are available. Keep files portable and support direct opening.
+- Do not equate an existing HTML file, a successful reload, or a source-string test with a usable
+ result. `seed-verdict.sh` deliberately keeps `ready:false`; write `ready:true` only after your
+ checks establish it. Record exact commands, sampled seeds, observations and limitations.
+- Never claim a test coverage percentage for browser code based on Node subprocess tests.
+
+## Check your actual edited model
+
+Run `node tools/check.mjs --seeds 100` in the workspace. It reads the pure model from
+`<script id="harness-model">` in the artifact, checks domain invariants, repeats each seed, and
+writes `.harness/model-check.json`. Preserve that script boundary when editing. Model checks are
+followed by browser interaction, exported-output inspection, and visual or listening review.
diff --git a/store/agents/game-master/README.md b/store/agents/game-master/README.md
new file mode 100644
index 000000000..2b4ce4583
--- /dev/null
+++ b/store/agents/game-master/README.md
@@ -0,0 +1,42 @@
+# Game Master — Relay
+
+Design and compare strategies in a seeded arena. Watch two squads compete for relays, inspect decisions, step and rewind matches, and run a 32-map tournament.
+
+## Try it
+
+> Create a capture arena where patient defenders face aggressive hunters. Show every decision and compare their win rates over 32 maps.
+
+The starter already works before the first prompt. Change it with the agent, interact with the
+result in the pane, and keep the output. Everything needed at runtime is in `game/index.html`.
+It works offline and can be opened outside Harness.
+
+## What you can do
+
+Finite 72-turn matches, two policies, pathfinding, relay control, combat/respawn, replay timeline, 32-match tournament, full replay JSON.
+
+## Build on the starter
+
+The model functions `arenaMap`, `arenaPath`, `arenaMatch` and `arenaTournament` are the starting points for substantive changes. Preserve seed
+reproducibility and user controls while changing the domain behavior. A different brief can replace
+this starter's entire visual language. Keep the artifact self-contained and test the actual result.
+
+The source checkout builds these starters with `node store/tools/build-experiences.mjs`. Installed
+workspaces are editable HTML; no build tool, network dependency or paid service is required.
+
+## Verification
+
+Model census: `node --test store/tools/experience-tests/models.test.mjs` from the source checkout.
+Browser interactions, exports, same-origin APIs and manifest routing: see
+[`store/tools/experience-tests`](../../tools/experience-tests/README.md).
+
+`seed-verdict.sh` establishes only artifact presence and keeps `ready:false`. The agent must run
+and record real domain and browser checks before writing a ready verdict. No cross-device pixel or
+audio equality is promised. The research is inspiration; this is original code, not a wrapper of
+any cited third-party engine.
+
+## Check your actual edited model
+
+Run `node tools/check.mjs --seeds 100` in the workspace. It reads the pure model from
+`<script id="harness-model">` in the artifact, checks domain invariants, repeats each seed, and
+writes `.harness/model-check.json`. Preserve that script boundary when editing. Model checks are
+followed by browser interaction, exported-output inspection, and visual or listening review.
diff --git a/store/agents/game-master/harness.json b/store/agents/game-master/harness.json
new file mode 100644
index 000000000..e7080ccb2
--- /dev/null
+++ b/store/agents/game-master/harness.json
@@ -0,0 +1,32 @@
+{
+ "spec": 1,
+ "id": "autonomous/game-master",
+ "name": "Game Master",
+ "category": "Games",
+ "author": "Autonomous",
+ "description": "Design and compare strategies in a seeded arena. Watch two squads compete for relays, inspect decisions, step and rewind matches, and run a 32-map tournament.",
+ "engine": "claude",
+ "workspace": {
+ "template": "template",
+ "marker": "game/index.html",
+ "init": "toolchain/init-workspace.sh"
+ },
+ "agent": {
+ "instructions": "AGENTS.md",
+ "skills": [
+ "skills"
+ ]
+ },
+ "toolchain": {
+ "setup": "toolchain/setup.sh",
+ "doctor": "toolchain/doctor.sh"
+ },
+ "viewer": {
+ "use": "autonomous/web-viewer",
+ "artifactExtensions": [
+ ".html"
+ ],
+ "url": "http://127.0.0.1:${port}/?file=${artifact}"
+ },
+ "verdict": ".harness/verdict.json"
+}
diff --git a/store/agents/game-master/skills/game/SKILL.md b/store/agents/game-master/skills/game/SKILL.md
new file mode 100644
index 000000000..0bb2cec20
--- /dev/null
+++ b/store/agents/game-master/skills/game/SKILL.md
@@ -0,0 +1,76 @@
+---
+name: game
+description: Build a deterministic, seedable arena game in one HTML file from a plain-English description. Use whenever the user asks for an AI-vs-AI duel, a player-vs-AI game, a board bout, a race, a chase, or prompt-to-game.
+---
+
+# game
+
+Take the user's description and produce a **single self-contained `game/index.html`**
+that runs a **deterministic, seedable** arena game — two AIs competing, or the
+player plus an AI — loading the seed from a `?seed=` query param so the web-viewer
+can preview the current seed and re-seed live.
+
+## The floor (in order)
+
+1. **Seeded PRNG.** A small seeded PRNG derived from the hash of the seed string.
+ Nothing may call a non-seeded random — the match must be reproducible.
+2. **Arena + turn loop.** A seeded board/layout and a turn loop where each side
+ picks a legal move; player-vs-AI reads real input.
+3. **`?seed=` plumbing.** Reading the param, plus a tiny UI (input + "re-seed"
+ button, and play/step controls) so the person can browse seeds in the pane.
+4. **Named sub-streams.** One PRNG sub-stream per concern (map layout, move rolls,
+ AI policy) so tuning one doesn't reshuffle the other.
+
+## The gold checklist
+
+- **Trait tables that survive an edition**: seed → match (map, matchup, outcome),
+ and a census that shows no stuck or degenerate match in the range you claim.
+- **Rules discipline**: every move is legal and state is consistent; a visible
+ scoreline and turn indicator that read clearly.
+- **Style range**: a capture duel, a race to a goal, a chase-and-tag, a turn-based
+ knock-out — matched to the brief, not all at once.
+- **Export route**: expose a "watch" mode that plays the seeded match end-to-end
+ and a rewind/step control.
+
+## Verify like a spectator, not a compiler
+
+Run a grid of seeds — actually watch the matches — and read the scorelines.
+Two hard checks before "ready":
+- **Re-run same-seed** — it must be identical on this machine.
+- **Census the seed range you promise** (e.g. 0–99); reject any stuck AI,
+ deadlock, or infinite match.
+
+Be explicit in the verdict about the reproducibility guarantee: same-machine yes;
+timing-based AI or animation you cannot prove bit-identical — say so.
+
+## Verdict feed
+
+Write `.harness/verdict.json` at every change:
+
+```json
+{ "spec": 1, "ready": false, "summary": "seeded capture duel · re-seed live · census 0–99 clean",
+ "findings": [{ "severity": "info", "kind": "reproducibility", "message": "same-machine verification pending; timing-based animation not provable bit-identical" }],
+ "artifact": "game/index.html",
+ "phases": [{ "id": "seed", "name": "Seeded core", "state": "done" },
+ { "id": "game", "name": "The game", "state": "active" },
+ { "id": "edition", "name": "Edition", "state": "pending" }],
+ "updatedAt": "2026-09-18T00:00:00Z" }
+```
+
+## Starting from Relay
+
+The template is functional: Finite 72-turn matches, two policies, pathfinding, relay control, combat/respawn, replay timeline, 32-match tournament, full replay JSON.
+
+Keep its useful controls and exports when making a user's creation. Test the behavioral core
+(arenaMap, arenaPath, arenaMatch, arenaTournament) as well as the visible result. A self-contained HTML file can still have well-separated
+model, rendering, input and export functions. Do not turn a finished starter into a waiting screen.
+
+Presence-only helpers do not prove correctness or reproducibility. Record actual evidence before
+marking the result ready. Export and reopen the result as part of the handoff to the user.
+
+## Check your actual edited model
+
+Run `node tools/check.mjs --seeds 100` in the workspace. It reads the pure model from
+`<script id="harness-model">` in the artifact, checks domain invariants, repeats each seed, and
+writes `.harness/model-check.json`. Preserve that script boundary when editing. Model checks are
+followed by browser interaction, exported-output inspection, and visual or listening review.
diff --git a/store/agents/game-master/skills/game/scripts/seed-verdict.sh b/store/agents/game-master/skills/game/scripts/seed-verdict.sh
new file mode 100755
index 000000000..69754435e
--- /dev/null
+++ b/store/agents/game-master/skills/game/scripts/seed-verdict.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# Presence is not evidence of correctness. Only the agent's actual checks may establish ready:true.
+set -eu
+ws="${1:?usage: seed-verdict.sh WORKSPACE}"
+mkdir -p "$ws/.harness"
+summary="No artifact yet"; phase=pending
+if [ -s "$ws/game/index.html" ]; then summary="Artifact available — browser verification pending"; phase=active; fi
+cat > "$ws/.harness/verdict.json" <<JSON
+{"spec":1,"ready":false,"summary":"$summary","artifact":"game/index.html","findings":[{"severity":"info","kind":"verification_pending","message":"File presence checked; behavior, output quality and reproducibility have not been verified by this helper."}],"phases":[{"id":"build","name":"Build","state":"$phase"},{"id":"verify","name":"Verify","state":"pending"}],"updatedAt":"$(date -u +%Y-%m-%dT%H:%M:%SZ)"}
+JSON
diff --git a/store/agents/game-master/store.json b/store/agents/game-master/store.json
new file mode 100644
index 000000000..fbfee42cf
--- /dev/null
+++ b/store/agents/game-master/store.json
@@ -0,0 +1,15 @@
+{
+ "homepage": "https://github.com/autonomous-ai/openharness/tree/main/store/agents/game-master",
+ "license": "MIT",
+ "tagline": "Design and compare strategies in a seeded arena",
+ "screenshots": [
+ "https://raw.githubusercontent.com/autonomous-ai/openharness/main/store/showcase/game-master/starter.jpg"
+ ],
+ "examples": [
+ {
+ "prompt": "Create a capture arena where patient defenders face aggressive hunters. Show every decision and compare their win rates over 32 maps.",
+ "caption": "Relay · interactive offline starter",
+ "image": "https://raw.githubusercontent.com/autonomous-ai/openharness/main/store/showcase/game-master/starter.jpg"
+ }
+ ]
+}
diff --git a/store/agents/game-master/template/game/index.html b/store/agents/game-master/template/game/index.html
new file mode 100644
index 000000000..45551188d
--- /dev/null
+++ b/store/agents/game-master/template/game/index.html
@@ -0,0 +1,1133 @@
+<!doctype html>
+<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
+<meta name="color-scheme" content="dark light"><title>RELAY — Game Master</title>
+<!-- Built by store/tools/build-experiences.mjs. Edit this file freely in your workspace. -->
+<style>:root {
+ color-scheme: dark;
+ --bg: #111414;
+ --panel: #191e1c;
+ --line: #ffffff1c;
+ --ink: #f4f2e9;
+ --muted: #a1aaa4;
+ --accent: #d0f28a;
+ font:
+ 14px/1.5 -apple-system,
+ BlinkMacSystemFont,
+ "Segoe UI",
+ sans-serif;
+}
+* {
+ box-sizing: border-box;
+}
+body {
+ margin: 0;
+ background: var(--bg);
+ color: var(--ink);
+}
+button,
+input,
+select {
+ font: inherit;
+}
+button,
+a,
+input,
+select {
+ -webkit-tap-highlight-color: transparent;
+}
+button,
+a {
+ touch-action: manipulation;
+}
+button {
+ cursor: pointer;
+}
+button:disabled {
+ opacity: 0.45;
+ cursor: wait;
+}
+button:focus-visible,
+input:focus-visible,
+select:focus-visible,
+a:focus-visible {
+ outline: 2px solid var(--accent);
+ outline-offset: 4px;
+}
+button,
+input,
+select {
+ color: inherit;
+ background: transparent;
+ border: 1px solid var(--line);
+ border-radius: 5px;
+ padding: 9px 13px;
+}
+button:hover {
+ background: #ffffff0c;
+ border-color: var(--muted);
+}
+button.primary {
+ background: var(--accent);
+ color: #142015;
+ border-color: transparent;
+ font-weight: 650;
+}
+button[aria-pressed="true"] {
+ border-color: var(--accent);
+ color: var(--accent);
+}
+input[type="range"] {
+ accent-color: var(--accent);
+ padding: 0;
+ min-width: 0;
+}
+input[type="number"] {
+ width: 80px;
+}
+select {
+ background: var(--panel);
+}
+label {
+ cursor: pointer;
+}
+a {
+ color: inherit;
+}
+h1,
+h2,
+h3,
+p {
+ margin: 0;
+}
+h1 {
+ font-size: clamp(32px, 5vw, 64px);
+ line-height: 1.02;
+ letter-spacing: -0.055em;
+ font-weight: 550;
+}
+h2 {
+ font-weight: 550;
+ letter-spacing: -0.03em;
+}
+h3 {
+ font-size: 14px;
+ font-weight: 550;
+}
+.mono,
+.eyebrow {
+ font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
+}
+.eyebrow {
+ font-size: 10px;
+ letter-spacing: 0.16em;
+ text-transform: uppercase;
+ color: var(--muted);
+}
+.muted {
+ color: var(--muted);
+}
+.small {
+ font-size: 12px;
+}
+.masthead {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 20px;
+ padding: 19px 28px;
+ border-bottom: 1px solid var(--line);
+}
+.identity {
+ display: flex;
+ gap: 12px;
+ align-items: center;
+ white-space: nowrap;
+ font-size: 12px;
+ font-weight: 600;
+ letter-spacing: 0.04em;
+}
+.mark {
+ width: 25px;
+ height: 25px;
+ display: grid;
+ place-items: center;
+ border: 1px solid currentColor;
+ font-size: 17px;
+}
+.seed-form {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+}
+.seed-form label {
+ font:
+ 10px ui-monospace,
+ monospace;
+ text-transform: uppercase;
+ letter-spacing: 0.12em;
+ color: var(--muted);
+ margin-right: 4px;
+}
+.seed-form input {
+ width: 74px;
+ padding: 6px 8px;
+ font:
+ 12px ui-monospace,
+ monospace;
+}
+.seed-form button {
+ padding: 6px 10px;
+ font-size: 12px;
+}
+.intro {
+ padding: 32px 28px;
+ display: flex;
+ align-items: flex-end;
+ justify-content: space-between;
+ gap: 20px;
+}
+.intro p {
+ max-width: 440px;
+ color: var(--muted);
+ margin-top: 14px;
+}
+.intro .eyebrow {
+ margin-bottom: 12px;
+}
+.actions {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ flex-wrap: wrap;
+}
+.workspace {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) 270px;
+ gap: 22px;
+ padding: 0 28px 28px;
+}
+.panel {
+ background: var(--panel);
+ border: 1px solid var(--line);
+ border-radius: 8px;
+ overflow: hidden;
+}
+.panel-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 16px 20px;
+ border-bottom: 1px solid var(--line);
+ gap: 10px;
+}
+.side {
+ display: flex;
+ flex-direction: column;
+ gap: 20px;
+}
+.section {
+ border-top: 1px solid var(--line);
+ padding-top: 18px;
+}
+.section h3 {
+ margin-bottom: 15px;
+}
+.field {
+ display: grid;
+ gap: 7px;
+ margin: 14px 0;
+}
+.field > span {
+ display: flex;
+ justify-content: space-between;
+ font-size: 12px;
+ color: var(--muted);
+}
+.metrics {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ gap: 1px;
+ background: var(--line);
+ border: 1px solid var(--line);
+ border-radius: 6px;
+ overflow: hidden;
+}
+.metric {
+ background: var(--bg);
+ padding: 13px 15px;
+}
+.metric strong {
+ display: block;
+ font:
+ 24px ui-monospace,
+ monospace;
+ letter-spacing: -0.06em;
+}
+.metric span {
+ font-size: 10px;
+ color: var(--muted);
+ text-transform: uppercase;
+ letter-spacing: 0.09em;
+}
+canvas {
+ display: block;
+ max-width: 100%;
+}
+.status-line {
+ display: flex;
+ justify-content: space-between;
+ gap: 20px;
+ padding: 14px 28px;
+ border-top: 1px solid var(--line);
+ font:
+ 10px ui-monospace,
+ monospace;
+ color: var(--muted);
+}
+.dot {
+ width: 6px;
+ height: 6px;
+ display: inline-block;
+ background: var(--accent);
+ border-radius: 50%;
+ margin-right: 6px;
+}
+.toast {
+ position: fixed;
+ z-index: 99;
+ left: 50%;
+ bottom: 22px;
+ transform: translateX(-50%);
+ max-width: 90vw;
+ background: var(--ink);
+ color: var(--bg);
+ padding: 11px 18px;
+ border-radius: 6px;
+ box-shadow: 0 3px 30px #0004;
+ font-size: 12px;
+}
+.toast:empty {
+ display: none;
+}
+[hidden] {
+ display: none !important;
+}
+.sr-only {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ padding: 0;
+ margin: -1px;
+ overflow: hidden;
+ clip-path: inset(50%);
+ white-space: nowrap;
+ border: 0;
+}
+@media (max-width: 800px) {
+ .workspace {
+ grid-template-columns: 1fr;
+ }
+ .side {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ }
+ .intro {
+ align-items: flex-start;
+ flex-direction: column;
+ }
+ .intro h1 {
+ font-size: 44px;
+ }
+}
+@media (max-width: 480px) {
+ .masthead {
+ padding: 13px 16px;
+ gap: 8px;
+ flex-wrap: wrap;
+ }
+ .intro {
+ padding: 26px 16px;
+ }
+ .intro h1 {
+ font-size: 38px;
+ }
+ .workspace {
+ padding: 0 16px 20px;
+ gap: 18px;
+ }
+ .side {
+ grid-template-columns: 1fr;
+ }
+ .seed-form label {
+ display: none;
+ }
+ .status-line {
+ padding: 12px 16px;
+ }
+ .status-line span:last-child {
+ display: none;
+ }
+ .metrics .metric {
+ padding: 12px 10px;
+ }
+ .panel-head {
+ padding: 12px;
+ }
+ .actions {
+ gap: 6px;
+ }
+}
+@media (prefers-reduced-motion: reduce) {
+ *,
+ *::before,
+ *::after {
+ scroll-behavior: auto !important;
+ animation: none !important;
+ transition: none !important;
+ }
+}
+
+:root {
+ --bg: #161c23;
+ --panel: #1d2731;
+ --ink: #e7e8e3;
+ --muted: #99a7b3;
+ --line: #7c90a42b;
+ --accent: #aadad1;
+}
+.mark {
+ border: 0;
+ font-size: 30px;
+}
+.workspace {
+ grid-template-columns: minmax(0, 1fr) 235px;
+ gap: 26px;
+}
+.scoreboard {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 20px 25px;
+ border: 1px solid var(--line);
+ border-bottom: 0;
+ border-radius: 8px 8px 0 0;
+ background: #1b242d;
+}
+.team {
+ display: flex;
+ align-items: center;
+ gap: 20px;
+}
+.team .eyebrow {
+ color: inherit;
+ font-size: 9px;
+}
+.team strong {
+ font:
+ 44px ui-monospace,
+ monospace;
+ letter-spacing: -0.08em;
+}
+.ember {
+ color: #df896f;
+}
+.tide {
+ color: #74c8c2;
+ flex-direction: row-reverse;
+}
+.match-state {
+ text-align: center;
+ font:
+ 9px/1.8 ui-monospace,
+ monospace;
+ color: var(--muted);
+ letter-spacing: 0.1em;
+}
+.match-state p {
+ color: var(--ink);
+}
+.arena-stage {
+ background: radial-gradient(ellipse at center, #273743, #111a22);
+ border: 1px solid var(--line);
+ border-top: 0;
+ border-radius: 0 0 8px 8px;
+}
+.arena-stage canvas {
+ width: 100%;
+ height: 445px;
+}
+.arena-legend {
+ display: flex;
+ justify-content: center;
+ gap: 20px;
+ font:
+ 10px ui-monospace,
+ monospace;
+ padding: 12px;
+ color: var(--muted);
+}
+.arena-legend i {
+ display: inline-block;
+ width: 6px;
+ height: 6px;
+ border-radius: 50%;
+ margin-right: 5px;
+}
+.replay-controls {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ margin: 16px 0;
+}
+.replay-controls input {
+ flex: 1;
+ width: 50px;
+}
+.replay-controls button,
+.replay-controls select {
+ font-size: 11px;
+ padding: 7px 9px;
+}
+.event-log {
+ padding: 16px 0;
+ border-top: 1px solid var(--line);
+}
+#events {
+ margin-top: 8px;
+ min-height: 108px;
+ font:
+ 10px/1.8 ui-monospace,
+ monospace;
+ color: var(--muted);
+}
+#events p {
+ overflow-wrap: anywhere;
+}
+.tournament-result {
+ font:
+ 12px/1.8 ui-monospace,
+ monospace;
+ color: var(--accent);
+ margin-top: 14px;
+}
+@media (max-width: 800px) {
+ .workspace {
+ grid-template-columns: 1fr;
+ }
+ .arena-stage canvas {
+ height: 420px;
+ }
+}
+@media (max-width: 480px) {
+ .scoreboard {
+ padding: 12px;
+ }
+ .team {
+ gap: 8px;
+ flex-direction: column;
+ }
+ .team strong {
+ font-size: 33px;
+ }
+ .arena-stage canvas {
+ height: 320px;
+ }
+ .arena-legend {
+ font-size: 8px;
+ gap: 10px;
+ }
+ .replay-controls {
+ gap: 5px;
+ }
+ .replay-controls button {
+ padding: 7px;
+ }
+}
+</style></head><body>
+<header class="masthead"><div class="identity"><span class="mark" aria-hidden="true">◇</span>RELAY / ARENA</div>
+<form class="seed-form" id="seed-form"><label for="seed">Seed</label><input id="seed" aria-label="Seed" maxlength="128" autocomplete="off" spellcheck="false"><button type="submit">Apply</button><button id="next-seed" type="button" title="Next seed">↗ Next</button></form></header>
+<section class="intro">
+ <div>
+ <p class="eyebrow">A contest of strategies / No reflexes required</p>
+ <h1>Think in moves.</h1>
+ <p>
+ Two squads. Three relays. Change the policies, watch the consequences, and
+ test your theory across an entire tournament.
+ </p>
+ </div>
+ <button id="export-replay">Export replay ↗</button>
+</section>
+<main class="workspace">
+ <div>
+ <div class="scoreboard">
+ <div class="team ember">
+ <span class="eyebrow">EMBER / CORAL</span
+ ><strong id="score-ember">0</strong>
+ </div>
+ <div class="match-state">
+ <p id="match-state">THE OPENING</p>
+ <span id="turn">Turn 00 / 72</span>
+ </div>
+ <div class="team tide">
+ <span class="eyebrow">TIDE / TEAL</span
+ ><strong id="score-tide">0</strong>
+ </div>
+ </div>
+ <section class="arena-stage">
+ <canvas
+ id="arena"
+ aria-label="Strategy arena showing two squads competing for three relays"
+ ></canvas>
+ <div class="arena-legend">
+ <span><i style="background: #df896f"></i>Ember</span
+ ><span><i style="background: #74c8c2"></i>Tide</span
+ ><span>◇ Hold a relay: +1 / turn</span>
+ </div>
+ </section>
+ <div class="replay-controls">
+ <button id="play-match" class="primary">Ⅱ Pause</button
+ ><button id="rewind" aria-label="Rewind match">↤</button
+ ><button id="step" aria-label="Next turn">→</button
+ ><input
+ id="timeline"
+ aria-label="Replay turn"
+ type="range"
+ min="0"
+ max="72"
+ value="0"
+ /><select id="speed" aria-label="Playback speed">
+ <option value="600">1×</option>
+ <option value="250">2×</option>
+ <option value="80">4×</option>
+ </select>
+ </div>
+ <section class="event-log">
+ <p class="eyebrow">Decisions at this turn / Heuristic policies</p>
+ <div id="events" role="log"></div>
+ </section>
+ </div>
+ <aside class="side">
+ <div>
+ <p class="eyebrow">The matchup</p>
+ <label class="field"
+ ><span>Ember policy</span
+ ><select id="coral-policy">
+ <option value="control">Control / hold the relays</option>
+ <option value="hunt">Hunt / pressure opponents</option>
+ </select></label
+ ><label class="field"
+ ><span>Tide policy</span
+ ><select id="teal-policy">
+ <option value="hunt">Hunt / pressure opponents</option>
+ <option value="control">Control / hold the relays</option>
+ </select></label
+ >
+ <p class="small muted">
+ Control defends captured relays. Hunt trades position for attacks. Each
+ knockout scores two points, followed by a three-turn respawn.
+ </p>
+ </div>
+ <div class="section">
+ <h3>Put your theory to the test.</h3>
+ <p class="small muted">
+ Run both policies over 32 seeded maps. Find out whether a convincing win
+ survives a different board.
+ </p>
+ <button id="tournament" style="width: 100%; margin-top: 14px">
+ Run 32-match tournament
+ </button>
+ <div id="tournament-result" class="tournament-result" role="status"></div>
+ </div>
+ <div class="section small muted">
+ All decisions are local, inspectable rules. Replays record every turn,
+ position, score and decision. No hidden model calls.
+ </div>
+ </aside>
+</main>
+<footer class="status-line">
+ <span><i class="dot"></i>DETERMINISTIC MATCH ENGINE</span
+ ><span>CHANGE A RULE. WATCH A WORLD CHANGE.</span>
+</footer>
+<div class="toast" id="toast" role="status"></div>
+<script id="harness-model">
+'use strict';
+// Shared deterministic primitives. Domain models use named streams so unrelated edits stay stable.
+function hash(value) {
+ let h = 2166136261;
+ for (const c of String(value)) h = Math.imul(h ^ c.charCodeAt(0), 16777619);
+ return h >>> 0;
+}
+function random(seed, stream = "main") {
+ let a = hash(`${seed}:${stream}`);
+ return () => {
+ a = (a + 0x6d2b79f5) | 0;
+ let t = Math.imul(a ^ (a >>> 15), 1 | a);
+ t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
+ };
+}
+const clamp = (n, lo, hi) => Math.max(lo, Math.min(hi, n));
+const lerp = (a, b, t) => a + (b - a) * t;
+const pick = (items, rng) => items[Math.floor(rng() * items.length)];
+function normal(rng) {
+ return (
+ Math.sqrt(-2 * Math.log(Math.max(1e-9, rng()))) *
+ Math.cos(2 * Math.PI * rng())
+ );
+}
+
+const arenaSize = { w: 11, h: 9 };
+function arenaMap(seed) {
+ const r = random(seed, "terrain"),
+ walls = [];
+ for (let y = 1; y < 8; y++)
+ if (y !== 4 && r() > 0.48) {
+ walls.push([3, y], [7, 8 - y]);
+ }
+ return {
+ ...arenaSize,
+ walls,
+ relays: [
+ { x: 5, y: 1, name: "NORTH" },
+ { x: 5, y: 4, name: "CORE" },
+ { x: 5, y: 7, name: "SOUTH" },
+ ],
+ };
+}
+function arenaPath(map, from, target, occupied = []) {
+ const blocked = new Set(
+ [...map.walls, ...occupied].map(([x, y]) => `${x},${y}`),
+ );
+ blocked.delete(`${target.x},${target.y}`);
+ const queue = [{ x: from.x, y: from.y, path: [] }],
+ seen = new Set([`${from.x},${from.y}`]);
+ for (let i = 0; i < queue.length; i++) {
+ const p = queue[i];
+ if (p.x === target.x && p.y === target.y) return p.path;
+ for (const [dx, dy] of [
+ [1, 0],
+ [0, -1],
+ [-1, 0],
+ [0, 1],
+ ]) {
+ const x = p.x + dx,
+ y = p.y + dy,
+ key = `${x},${y}`;
+ if (
+ x < 0 ||
+ y < 0 ||
+ x >= map.w ||
+ y >= map.h ||
+ seen.has(key) ||
+ blocked.has(key)
+ )
+ continue;
+ seen.add(key);
+ queue.push({ x, y, path: [...p.path, { x, y }] });
+ }
+ }
+ return [];
+}
+function arenaMatch(
+ seed,
+ { coral = "control", teal = "hunt", rounds = 72 } = {},
+) {
+ const map = arenaMap(seed),
+ rng = random(seed, "decisions"),
+ units = [];
+ for (let team = 0; team < 2; team++)
+ for (let i = 0; i < 3; i++)
+ units.push({
+ id: team * 3 + i,
+ team,
+ x: team ? 10 : 0,
+ y: 2 + i * 2,
+ hp: 3,
+ wait: 0,
+ });
+ let score = [0, 0],
+ owners = [-1, -1, -1];
+ const history = [];
+ const snapshot = (turn, log) => ({
+ turn,
+ score: [...score],
+ owners: [...owners],
+ units: units.map((u) => ({ ...u })),
+ log,
+ });
+ history.push(
+ snapshot(0, ["Three relays. Seventy-two turns. Hold ground to score."]),
+ );
+ for (let turn = 1; turn <= rounds; turn++) {
+ const log = [];
+ const order = turn % 2 ? [0, 3, 1, 4, 2, 5] : [3, 0, 4, 1, 5, 2];
+ for (const index of order) {
+ const u = units[index];
+ if (u.wait) {
+ u.wait--;
+ if (!u.wait) {
+ u.hp = 3;
+ u.x = u.team ? 10 : 0;
+ u.y = 2 + (u.id % 3) * 2;
+ }
+ continue;
+ }
+ const opponents = units.filter((v) => v.team !== u.team && !v.wait),
+ adjacent = opponents.find(
+ (v) => Math.abs(v.x - u.x) + Math.abs(v.y - u.y) === 1,
+ );
+ const name = u.team ? "Tide" : "Ember";
+ if (adjacent) {
+ adjacent.hp--;
+ log.push(
+ `${name} ${(u.id % 3) + 1} tags ${adjacent.team ? "Tide" : "Ember"} ${(adjacent.id % 3) + 1}.`,
+ );
+ if (adjacent.hp === 0) {
+ adjacent.wait = 3;
+ score[u.team] += 2;
+ log.push(`${name} scores a knockout (+2).`);
+ }
+ continue;
+ }
+ const policy = u.team ? teal : coral;
+ const occupied = units
+ .filter((v) => v !== u && !v.wait)
+ .map((v) => [v.x, v.y]);
+ let target;
+ const onRelay = map.relays.findIndex((r) => r.x === u.x && r.y === u.y);
+ if (onRelay !== -1 && policy === "control") {
+ log.push(
+ `${name} ${(u.id % 3) + 1} holds ${map.relays[onRelay].name}.`,
+ );
+ continue;
+ }
+ if (policy === "hunt" && opponents.length && rng() < 0.56)
+ target = [...opponents].sort(
+ (a, b) =>
+ Math.abs(a.x - u.x) +
+ Math.abs(a.y - u.y) -
+ (Math.abs(b.x - u.x) + Math.abs(b.y - u.y)),
+ )[0];
+ else {
+ const candidates = map.relays.map((r, i) => ({
+ ...r,
+ index: i,
+ cost:
+ Math.abs(r.x - u.x) +
+ Math.abs(r.y - u.y) +
+ (owners[i] === u.team ? 7 : 0) +
+ rng() * 2,
+ }));
+ target = candidates.sort((a, b) => a.cost - b.cost)[0];
+ }
+ const path = arenaPath(map, u, target, occupied);
+ const next = path[0];
+ if (next && !occupied.some(([x, y]) => x === next.x && y === next.y)) {
+ u.x = next.x;
+ u.y = next.y;
+ log.push(
+ `${name} ${(u.id % 3) + 1} → ${target.name || "opponent"} (${policy}).`,
+ );
+ }
+ }
+ owners = map.relays.map((r) => {
+ const u = units.find((u) => !u.wait && u.x === r.x && u.y === r.y);
+ return u ? u.team : -1;
+ });
+ owners.forEach((owner) => {
+ if (owner !== -1) score[owner]++;
+ });
+ history.push(snapshot(turn, log.slice(-6)));
+ }
+ return {
+ seed: String(seed),
+ map,
+ policies: { coral, teal },
+ history,
+ winner: score[0] === score[1] ? -1 : score[0] > score[1] ? 0 : 1,
+ };
+}
+function arenaTournament(seed, options, count = 32) {
+ const wins = [0, 0, 0];
+ let margins = 0;
+ for (let i = 0; i < count; i++) {
+ const match = arenaMatch(`${seed}/match/${i}`, options);
+ wins[match.winner === -1 ? 2 : match.winner]++;
+ const last = match.history.at(-1);
+ margins += last.score[0] - last.score[1];
+ }
+ return {
+ count,
+ ember: wins[0],
+ tide: wins[1],
+ draws: wins[2],
+ meanMargin: margins / count,
+ };
+}
+
+</script>
+<script>
+'use strict';
+const $ = (s) => document.querySelector(s);
+const $$ = (s) => [...document.querySelectorAll(s)];
+const params = new URLSearchParams(location.search);
+let seed = (params.get("seed") || "42").slice(0, 128);
+const reducedMotion = matchMedia("(prefers-reduced-motion: reduce)").matches;
+const parentMessage = (message) => {
+ if (parent !== window) parent.postMessage(message, "*");
+};
+function toast(message) {
+ $("#toast").textContent = message;
+ clearTimeout(toast.timer);
+ toast.timer = setTimeout(() => {
+ $("#toast").textContent = "";
+ }, 3500);
+}
+function saveFile(name, content, type = "application/json") {
+ const blob =
+ content instanceof Blob ? content : new Blob([content], { type });
+ const url = URL.createObjectURL(blob),
+ a = document.createElement("a");
+ a.href = url;
+ a.download = name;
+ document.body.append(a);
+ a.click();
+ a.remove();
+ setTimeout(() => URL.revokeObjectURL(url), 30000);
+}
+function canvasPNG(canvas, name) {
+ canvas.toBlob((blob) => {
+ if (blob) saveFile(name, blob);
+ else toast("Image export failed. Please try again.");
+ });
+}
+function setSeed(value) {
+ seed = String(value).trim().slice(0, 128) || "42";
+ $("#seed").value = seed;
+ const url = new URL(location.href);
+ url.searchParams.set("seed", seed);
+ try {
+ history.replaceState(null, "", url);
+ } catch {
+ /* Opaque-origin iframe: the shell owns its URL. */
+ }
+ parentMessage({ type: "harness:state", seed });
+ dispatchEvent(new CustomEvent("seedchange", { detail: seed }));
+}
+$("#seed").value = seed;
+$("#seed-form").addEventListener("submit", (e) => {
+ e.preventDefault();
+ setSeed($("#seed").value);
+});
+$("#next-seed").addEventListener("click", () =>
+ setSeed(/^\d{1,9}$/.test(seed) ? Number(seed) + 1 : hash(seed)),
+);
+function fitCanvas(canvas, draw, maxDpr = 2) {
+ const observer = new ResizeObserver(() => {
+ const box = canvas.getBoundingClientRect(),
+ dpr = Math.min(devicePixelRatio || 1, maxDpr);
+ canvas.width = Math.max(1, Math.round(box.width * dpr));
+ canvas.height = Math.max(1, Math.round(box.height * dpr));
+ draw?.();
+ });
+ observer.observe(canvas);
+ return observer;
+}
+const editable = (target) =>
+ target instanceof Element &&
+ !!target.closest("input,textarea,select,[contenteditable=true]");
+addEventListener("error", (e) =>
+ parentMessage({ type: "harness:error", message: e.message }),
+);
+addEventListener("unhandledrejection", (e) =>
+ parentMessage({
+ type: "harness:error",
+ message: String(e.reason?.message || e.reason),
+ }),
+);
+function ready() {
+ document.body.dataset.ready = "true";
+ parentMessage({ type: "harness:ready", title: document.title, seed });
+}
+
+let match,
+ turn = 0,
+ running = !reducedMotion,
+ lastTurnTime = 0;
+const policyOptions = () => ({
+ coral: $("#coral-policy").value,
+ teal: $("#teal-policy").value,
+});
+function drawArena() {
+ if (!match) return;
+ const c = $("#arena"),
+ ctx = c.getContext("2d"),
+ w = c.width,
+ h = c.height,
+ state = match.history[turn],
+ unit = Math.min(w / 13, h / 11),
+ left = (w - match.map.w * unit) / 2,
+ top = (h - match.map.h * unit) / 2;
+ ctx.clearRect(0, 0, w, h);
+ const pos = (x, y) => ({
+ x: left + (x + 0.5) * unit,
+ y: top + (y + 0.5) * unit,
+ });
+ for (let y = 0; y < match.map.h; y++)
+ for (let x = 0; x < match.map.w; x++) {
+ const p = pos(x, y),
+ wall = match.map.walls.some((v) => v[0] === x && v[1] === y);
+ ctx.fillStyle = wall ? "#405262" : (x + y) % 2 ? "#24333f" : "#263743";
+ ctx.strokeStyle = "#475d6e33";
+ ctx.lineWidth = 1;
+ ctx.beginPath();
+ ctx.roundRect(
+ p.x - unit * 0.46,
+ p.y - unit * 0.46,
+ unit * 0.92,
+ unit * 0.92,
+ unit * 0.08,
+ );
+ ctx.fill();
+ ctx.stroke();
+ if (wall) {
+ ctx.fillStyle = "#536573";
+ ctx.fillRect(
+ p.x - unit * 0.3,
+ p.y - unit * 0.3,
+ unit * 0.6,
+ unit * 0.12,
+ );
+ }
+ }
+ match.map.relays.forEach((r, i) => {
+ const p = pos(r.x, r.y),
+ owner = state.owners[i];
+ ctx.strokeStyle = owner === -1 ? "#d6c69a" : owner ? "#74c8c2" : "#df896f";
+ ctx.lineWidth = 2;
+ ctx.save();
+ ctx.translate(p.x, p.y);
+ ctx.rotate(Math.PI / 4);
+ ctx.strokeRect(-unit * 0.3, -unit * 0.3, unit * 0.6, unit * 0.6);
+ ctx.restore();
+ ctx.fillStyle = ctx.strokeStyle;
+ ctx.font = `${unit * 0.16}px monospace`;
+ ctx.textAlign = "center";
+ ctx.fillText(r.name, p.x, p.y + unit * 0.47);
+ });
+ state.units
+ .filter((u) => !u.wait)
+ .forEach((u) => {
+ const p = pos(u.x, u.y),
+ color = u.team ? "#74c8c2" : "#df896f";
+ ctx.shadowColor = color;
+ ctx.shadowBlur = 10;
+ ctx.fillStyle = color;
+ ctx.beginPath();
+ ctx.arc(p.x, p.y, unit * 0.25, 0, Math.PI * 2);
+ ctx.fill();
+ ctx.shadowBlur = 0;
+ ctx.fillStyle = "#162129";
+ ctx.textAlign = "center";
+ ctx.textBaseline = "middle";
+ ctx.font = `bold ${unit * 0.24}px monospace`;
+ ctx.fillText((u.id % 3) + 1, p.x, p.y);
+ ctx.fillStyle = color;
+ for (let i = 0; i < u.hp; i++)
+ ctx.fillRect(
+ p.x - unit * 0.19 + i * unit * 0.14,
+ p.y - unit * 0.39,
+ unit * 0.1,
+ unit * 0.055,
+ );
+ });
+ ctx.textBaseline = "alphabetic";
+}
+function showTurn() {
+ const state = match.history[turn];
+ $("#score-ember").textContent = state.score[0];
+ $("#score-tide").textContent = state.score[1];
+ $("#turn").textContent = `Turn ${String(turn).padStart(2, "0")} / 72`;
+ $("#timeline").value = turn;
+ $("#match-state").textContent =
+ turn === 72
+ ? match.winner === -1
+ ? "DRAW"
+ : match.winner
+ ? "TIDE WINS"
+ : "EMBER WINS"
+ : turn < 12
+ ? "THE OPENING"
+ : turn < 50
+ ? "THE CONTEST"
+ : "THE ENDGAME";
+ $("#events").replaceChildren();
+ state.log.forEach((line) => {
+ const p = document.createElement("p");
+ p.textContent = line;
+ $("#events").append(p);
+ });
+ $("#play-match").textContent = running
+ ? "Ⅱ Pause"
+ : turn === 72
+ ? "↻ Replay"
+ : "▶ Play";
+ drawArena();
+}
+function newMatch() {
+ match = arenaMatch(seed, policyOptions());
+ turn = 0;
+ $("#tournament-result").textContent = "";
+ showTurn();
+}
+$("#play-match").onclick = () => {
+ if (turn === 72) turn = 0;
+ running = !running;
+ lastTurnTime = performance.now();
+ showTurn();
+};
+$("#step").onclick = () => {
+ running = false;
+ turn = Math.min(72, turn + 1);
+ showTurn();
+};
+$("#rewind").onclick = () => {
+ running = false;
+ turn = 0;
+ showTurn();
+};
+$("#timeline").oninput = () => {
+ running = false;
+ turn = +$("#timeline").value;
+ showTurn();
+};
+for (const id of ["coral-policy", "teal-policy"])
+ $("#" + id).onchange = newMatch;
+$("#export-replay").onclick = () =>
+ saveFile(`relay-${hash(seed)}.json`, JSON.stringify(match, null, 2));
+$("#tournament").onclick = async () => {
+ const b = $("#tournament");
+ b.disabled = true;
+ $("#tournament-result").textContent = "Playing 32 independent maps…";
+ await new Promise((r) => setTimeout(r, 30));
+ const result = arenaTournament(seed, policyOptions());
+ $("#tournament-result").textContent =
+ `Ember ${result.ember} · Tide ${result.tide} · Draws ${result.draws}. Mean Ember margin: ${result.meanMargin.toFixed(1)} points.`;
+ b.disabled = false;
+};
+function arenaFrame(time) {
+ if (running && time - lastTurnTime > +$("#speed").value) {
+ turn = Math.min(72, turn + 1);
+ if (turn === 72) running = false;
+ lastTurnTime = time;
+ showTurn();
+ }
+ requestAnimationFrame(arenaFrame);
+}
+fitCanvas($("#arena"), drawArena);
+addEventListener("seedchange", newMatch);
+newMatch();
+requestAnimationFrame(arenaFrame);
+ready();
+
+</script></body></html>
diff --git a/store/agents/game-master/template/tools/check.mjs b/store/agents/game-master/template/tools/check.mjs
new file mode 100644
index 000000000..11c7c02b3
--- /dev/null
+++ b/store/agents/game-master/template/tools/check.mjs
@@ -0,0 +1,75 @@
+const CONFIG = {"id":"game-master","artifact":"game/index.html"};
+// Compiled into each workspace's tools/check.mjs. Tests the model in the ACTUAL edited HTML.
+import { readFile, mkdir, writeFile } from "node:fs/promises";
+import { createHash } from "node:crypto";
+import vm from "node:vm";
+import { resolve, dirname } from "node:path";
+
+const args = process.argv.slice(2),
+ i = args.indexOf("--seeds");
+const count = i === -1 ? 32 : Number(args[i + 1]);
+if (!Number.isInteger(count) || count < 1 || count > 1000)
+ throw new Error("--seeds must be an integer from 1 to 1000");
+const artifact = resolve(CONFIG.artifact);
+const html = await readFile(artifact, "utf8");
+const script = html.match(
+ /<script id="harness-model">([\s\S]*?)<\/script>/,
+)?.[1];
+if (!script)
+ throw new Error(
+ 'Keep the pure model in <script id="harness-model"> so this checker can exercise the actual artifact.',
+ );
+const expressions = {
+ "generative-art": `const m=artModel(SEED);const p=artPaths(m);({state:m,valid:p.length>0&&p.flat().every(([x,y])=>Number.isFinite(x)&&Number.isFinite(y)),metrics:{paths:p.length,palette:m.palette}})`,
+ "creative-direction": `const m=directionModel(SEED);const ratio=contrast(m.colors[0],m.colors[1]);({state:m,valid:ratio>=4.5,metrics:{direction:m.name,contrast:ratio}})`,
+ "lab-bench": `const p=experiment(SEED),e=treatmentEffect(p);({state:p,valid:p.length>1&&p.every(p=>Number.isFinite(p.x)&&Number.isFinite(p.y))&&Number.isFinite(e.low)&&e.low<=e.high,metrics:{samples:p.length,effect:e.difference,interval:[e.low,e.high]}})`,
+ "music-studio": `const s=musicScore(SEED),r=renderMusic(s);({state:Array.from(r.samples),valid:r.peak>.001&&r.peak<=.95&&r.samples.every(Number.isFinite),metrics:{seconds:r.duration,peak:r.peak,rms:r.rms}})`,
+ "game-master": `const m=arenaMatch(SEED),s=m.history.at(-1);({state:m,valid:m.history.length>1&&m.history.length<=10000&&s.units.every(u=>u.hp>=0&&u.x>=0&&u.x<m.map.w&&u.y>=0&&u.y<m.map.h),metrics:{turns:s.turn,score:s.score,winner:m.winner}})`,
+ "drone-pilot": `const s=flyAutopilot(SEED);({state:s,valid:s.finished&&!s.crashed&&s.passed===flightCourse(SEED).length,metrics:{seconds:s.time,passed:s.passed,missed:s.missed}})`,
+ "voxel-worlds": `const w=voxelWorld(SEED);let p={...w.spawn,vy:0,grounded:true};const clear=playerFits(w,p.x,p.y,p.z);for(let t=0;t<120;t++)p=movePlayer(w,p,{forward:1});({state:Array.from(w.blocks),valid:clear&&playerFits(w,p.x,p.y,p.z),metrics:{blocks:w.blocks.filter(Boolean).length,walkDistance:Math.hypot(p.x-w.spawn.x,p.z-w.spawn.z)}})`,
+};
+const expression = expressions[CONFIG.id];
+const digest = (value) =>
+ createHash("sha256").update(JSON.stringify(value)).digest("hex");
+const results = [];
+for (let seed = 0; seed < count; seed++) {
+ const run = () =>
+ vm.runInNewContext(
+ `${script}\n${expression}`,
+ { SEED: String(seed) },
+ { timeout: 10000 },
+ );
+ try {
+ const first = run(),
+ second = run(),
+ signature = digest(first.state),
+ repeat = digest(second.state);
+ results.push({
+ seed,
+ ok: first.valid && signature === repeat,
+ signature,
+ metrics: first.metrics,
+ });
+ } catch (error) {
+ results.push({ seed, ok: false, error: error.message });
+ }
+}
+const passed = results.filter((r) => r.ok).length;
+const report = {
+ spec: 1,
+ harness: CONFIG.id,
+ artifact: CONFIG.artifact,
+ checkedAt: new Date().toISOString(),
+ modelChecks: { passed, total: count },
+ scope:
+ "Pure model invariants and same-process repeatability. Browser interaction, layout, listening and export review still required.",
+ results,
+};
+const out = resolve(".harness/model-check.json");
+await mkdir(dirname(out), { recursive: true });
+await writeFile(out, JSON.stringify(report, null, 2) + "\n");
+console.log(
+ `${CONFIG.id}: ${passed}/${count} model checks passed. Report: ${out}`,
+);
+console.log(report.scope);
+if (passed !== count) process.exitCode = 1;
diff --git a/store/agents/game-master/test/toolchain.test.mjs b/store/agents/game-master/test/toolchain.test.mjs
new file mode 100644
index 000000000..13d000986
--- /dev/null
+++ b/store/agents/game-master/test/toolchain.test.mjs
@@ -0,0 +1,66 @@
+// The Game Master harness scripts, run the way Harness runs them.
+// node --test test/*.test.mjs
+import assert from 'node:assert/strict'
+import { spawnSync } from 'node:child_process'
+import { accessSync, constants, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { after, test } from 'node:test'
+
+const here = fileURLToPath(new URL('..', import.meta.url))
+const manifest = JSON.parse(readFileSync(join(here, 'harness.json'), 'utf8'))
+const scratch = []
+after(() => { for (const dir of scratch) rmSync(dir, { recursive: true, force: true }) })
+
+function tempDir() { const d = mkdtempSync(join(tmpdir(), 'game-')); scratch.push(d); return d }
+function run(script, { cwd = here, env = {} } = {}) {
+ const merged = { ...process.env }
+ for (const [k, v] of Object.entries(env)) v === null ? delete merged[k] : (merged[k] = v)
+ const r = spawnSync(join(here, script), { cwd, env: merged, encoding: 'utf8' })
+ return { code: r.status, stdout: r.stdout, stderr: r.stderr }
+}
+const seedScript = join(here, 'skills/game/scripts/seed-verdict.sh')
+
+test('every script the manifest names is in the folder and executable', () => {
+ for (const s of [manifest.workspace.init, manifest.toolchain.setup, manifest.toolchain.doctor]) {
+ assert.doesNotThrow(() => accessSync(join(here, s), constants.X_OK), s)
+ }
+})
+
+test('setup installs nothing and succeeds quietly', () => {
+ assert.deepEqual(run(manifest.toolchain.setup), { code: 0, stdout: '', stderr: '' })
+})
+
+test('doctor says ok when sh is on PATH', () => {
+ assert.equal(run(manifest.toolchain.doctor).code, 0)
+})
+
+test('init lays out a workspace and seeds a not-ready verdict', () => {
+ const ws = tempDir()
+ assert.equal(run(manifest.workspace.init, { cwd: ws, env: { HARNESS_DSH: manifest.id } }).code, 0)
+ assert.equal(JSON.parse(readFileSync(join(ws, '.harness/verdict.json'), 'utf8')).ready, false)
+ assert.equal(readFileSync(join(ws, '.harness-initialized'), 'utf8'), `initialized by ${manifest.id}\n`)
+})
+
+test('the manifest names a viewer package and an HTML artifact', () => {
+ assert.equal(manifest.viewer.use, 'autonomous/web-viewer')
+ assert.deepEqual(manifest.viewer.artifactExtensions, ['.html'])
+})
+
+test('seed-verdict reflects whether a game exists', () => {
+ const ws = tempDir()
+ run(manifest.workspace.init, { cwd: ws })
+ assert.equal(spawnSync(seedScript, [ws], { cwd: ws, encoding: 'utf8' }).status, 0)
+ assert.equal(JSON.parse(readFileSync(join(ws, '.harness/verdict.json'), 'utf8')).ready, false)
+ mkdirSync(join(ws, 'game'), { recursive: true })
+ writeFileSync(join(ws, 'game/index.html'), '<!doctype html>')
+ assert.equal(spawnSync(seedScript, [ws], { cwd: ws, encoding: 'utf8' }).status, 0)
+ assert.equal(JSON.parse(readFileSync(join(ws, '.harness/verdict.json'), 'utf8')).ready, false)
+})
+
+
+test('the manifest routes the actual nested artifact through the shared viewer', () => {
+ assert.equal(manifest.viewer.url, 'http://127.0.0.1:${port}/?file=${artifact}')
+ assert.ok(manifest.workspace.marker.endsWith('/index.html'))
+})
diff --git a/store/agents/game-master/toolchain/doctor.sh b/store/agents/game-master/toolchain/doctor.sh
new file mode 100755
index 000000000..6f335fdc8
--- /dev/null
+++ b/store/agents/game-master/toolchain/doctor.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+# Doctor: the game is just a file served by the shared web-viewer; no extra runtime needed.
+exit 0
diff --git a/store/agents/game-master/toolchain/init-workspace.sh b/store/agents/game-master/toolchain/init-workspace.sh
new file mode 100755
index 000000000..deb30ed6e
--- /dev/null
+++ b/store/agents/game-master/toolchain/init-workspace.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Harness copies the template before this runs. Preserve the user's design log on repeat calls.
+set -eu
+ws="${1:-$PWD}"
+mkdir -p "$ws/game" "$ws/.harness"
+if [ ! -f "$ws/game/DESIGN.md" ]; then
+ printf '# Design log — Game Master\n\nRecord date, USER or AI, decision, rationale, and whether it remains in the build.\n' > "$ws/game/DESIGN.md"
+fi
+cat > "$ws/.harness/verdict.json" <<JSON
+{"spec":1,"ready":false,"summary":"Relay starter available — describe what you want to create","artifact":"game/index.html","findings":[{"severity":"info","kind":"review_pending","message":"Starter provided; personalized changes need browser verification."}],"phases":[{"id":"build","name":"Build","state":"active"},{"id":"verify","name":"Verify","state":"pending"}],"updatedAt":"$(date -u +%Y-%m-%dT%H:%M:%SZ)"}
+JSON
+printf 'initialized by %s\n' "${HARNESS_DSH:-autonomous/game-master}" > "$ws/.harness-initialized"
diff --git a/store/agents/game-master/toolchain/setup.sh b/store/agents/game-master/toolchain/setup.sh
new file mode 100755
index 000000000..19d2dfc73
--- /dev/null
+++ b/store/agents/game-master/toolchain/setup.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+# Game Master has no toolchain: everything is inline HTML + a turn loop. Nothing to install.
+exit 0
diff --git a/store/agents/generative-art/AGENTS.md b/store/agents/generative-art/AGENTS.md
new file mode 100644
index 000000000..83527fecb
--- /dev/null
+++ b/store/agents/generative-art/AGENTS.md
@@ -0,0 +1,67 @@
+# Generative Art harness
+
+You turn a plain-English description into a **deterministic, seedable generative artwork** in a
+single self-contained `sketch/index.html`. The pane loads it live, so the user sees the piece —
+and a re-seed — as you work.
+
+## What a good piece is
+
+- **One file, offline.** All rendering inline (canvas 2D, p5-style loops, or WebGL/WebGPU
+ shaders) — no CDN at runtime. A `?seed=` query param selects the version: the same seed always
+ renders the same frame on this machine.
+- **Determinism is the product.** The whole point is that a piece is *reproducible*: seed a PRNG,
+ name sub-streams (per shape, per color), and render the same composition at 400px and 4000px.
+ If a sketch cannot render the same seed twice, it is not finished.
+- **Be honest about what verification can and cannot prove.** Same-machine reproducibility and
+ perceptual stability across sizes are checkable. Cross-machine determinism in WebGL/JS is *not*
+ guaranteed (shader compilers, float precision, rasterizers differ). Say so in the verdict rather
+ than overclaiming.
+- **Specific briefs beat vibes.** "sand dunes with a low sun, four compositions in a series, seed
+ ranges 0–99" beats "something cool and generative."
+
+## How to work so the pane moves
+
+1. **Save within a minute.** Materialize `sketch/index.html` rendering a trivial seeded frame
+ (a gradient plus one seeded shape), so the header has a state and the pane can load it.
+2. **Build the system, then the piece.** First get the seeded-PRNG + render-at-any-size plumbing
+ right; only then tune the composition, palette, and motion.
+3. **Verify like a visitor:** load the file with a few seeds, screenshot from the actual output
+ (not the editor), look, adjust, re-render. The camera/output is the referee.
+4. **Update `.harness/verdict.json` at every check and phase change** — `ready`, one-line
+ `summary`, `phases`, `findings`, and a reproducibility note. Write it as a feed.
+
+## Rules
+
+- An edition is only "ready to mint/print" when the rarity table and the census agree — sample a
+ grid of seeds and confirm no degenerate seed (blank, blown-out, same-as-everything) hides in the
+ range you claim to support.
+- Tag every crafted decision USER vs AI in `sketch/DESIGN.md`
+ (`YYYY-MM-DD | USER|AI | topic | decision | still in build?`).
+- The `summary` says plainly what is reproducible now and what is not. Never claim "done" on a
+ piece you haven't re-rendered seed-for-seed.
+
+## Shipped experience and operating standard
+
+The workspace starts with **Fieldwork**, a working experience, not an empty placeholder.
+Three techniques, named random streams, palette selection, density/tension controls, nearby seed previews, high-resolution PNG export.
+
+- Read the existing artifact before replacing it. The useful model boundaries are artModel, artPaths, drawArt, logical print coordinates.
+- Preserve working interactions and exports when extending the artifact. Match the user's brief;
+ the starter's genre and visual style are examples, not a ceiling.
+- Expose meaningful domain controls and outputs. Every control must change real state; every
+ displayed metric must be computed from that state. Never invent model activity or test results.
+- Use named random streams and a fixed simulation/score clock. Sample seeds, repeat the same
+ seed, inspect exported data, and verify keyboard/touch controls in the actual viewer.
+- This HTML runs with same-origin APIs in the shared viewer. Sibling fetches, localStorage,
+ downloads and pointer lock are available. Keep files portable and support direct opening.
+- Do not equate an existing HTML file, a successful reload, or a source-string test with a usable
+ result. `seed-verdict.sh` deliberately keeps `ready:false`; write `ready:true` only after your
+ checks establish it. Record exact commands, sampled seeds, observations and limitations.
+- Never claim a test coverage percentage for browser code based on Node subprocess tests.
+
+## Check your actual edited model
+
+Run `node tools/check.mjs --seeds 100` in the workspace. It reads the pure model from
+`<script id="harness-model">` in the artifact, checks domain invariants, repeats each seed, and
+writes `.harness/model-check.json`. Preserve that script boundary when editing. Model checks are
+followed by browser interaction, exported-output inspection, and visual or listening review.
diff --git a/store/agents/generative-art/README.md b/store/agents/generative-art/README.md
new file mode 100644
index 000000000..a5d03896f
--- /dev/null
+++ b/store/agents/generative-art/README.md
@@ -0,0 +1,42 @@
+# Generative Art — Fieldwork
+
+Design reproducible generative editions. Explore contour fields, dunes and orbital studies, tune their geometry and palettes, and export prints up to 3200 × 4000.
+
+## Try it
+
+> Create an edition of 12 tidal contour prints in indigo and burnt orange. Keep the paper quiet and make each seed feel related but distinct.
+
+The starter already works before the first prompt. Change it with the agent, interact with the
+result in the pane, and keep the output. Everything needed at runtime is in `sketch/index.html`.
+It works offline and can be opened outside Harness.
+
+## What you can do
+
+Three techniques, named random streams, palette selection, density/tension controls, nearby seed previews, high-resolution PNG export.
+
+## Build on the starter
+
+The model functions `artModel` and `artPaths` are the starting points for substantive changes. Preserve seed
+reproducibility and user controls while changing the domain behavior. A different brief can replace
+this starter's entire visual language. Keep the artifact self-contained and test the actual result.
+
+The source checkout builds these starters with `node store/tools/build-experiences.mjs`. Installed
+workspaces are editable HTML; no build tool, network dependency or paid service is required.
+
+## Verification
+
+Model census: `node --test store/tools/experience-tests/models.test.mjs` from the source checkout.
+Browser interactions, exports, same-origin APIs and manifest routing: see
+[`store/tools/experience-tests`](../../tools/experience-tests/README.md).
+
+`seed-verdict.sh` establishes only artifact presence and keeps `ready:false`. The agent must run
+and record real domain and browser checks before writing a ready verdict. No cross-device pixel or
+audio equality is promised. The research is inspiration; this is original code, not a wrapper of
+any cited third-party engine.
+
+## Check your actual edited model
+
+Run `node tools/check.mjs --seeds 100` in the workspace. It reads the pure model from
+`<script id="harness-model">` in the artifact, checks domain invariants, repeats each seed, and
+writes `.harness/model-check.json`. Preserve that script boundary when editing. Model checks are
+followed by browser interaction, exported-output inspection, and visual or listening review.
diff --git a/store/agents/generative-art/harness.json b/store/agents/generative-art/harness.json
new file mode 100644
index 000000000..5ac15753d
--- /dev/null
+++ b/store/agents/generative-art/harness.json
@@ -0,0 +1,35 @@
+{
+ "spec": 1,
+ "id": "autonomous/generative-art",
+ "name": "Generative Art",
+ "category": "Original art",
+ "author": "Autonomous",
+ "description": "Design reproducible generative editions. Explore contour fields, dunes and orbital studies, tune their geometry and palettes, and export prints up to 3200 \u00d7 4000.",
+ "engine": "claude",
+ "workspace": {
+ "template": "template",
+ "marker": "sketch/index.html",
+ "init": "toolchain/init-workspace.sh"
+ },
+ "agent": {
+ "instructions": "AGENTS.md",
+ "skills": [
+ "skills"
+ ],
+ "env": {
+ "GENART_DSH_DIR": "${dsh}"
+ }
+ },
+ "toolchain": {
+ "setup": "toolchain/setup.sh",
+ "doctor": "toolchain/doctor.sh"
+ },
+ "viewer": {
+ "use": "autonomous/web-viewer",
+ "artifactExtensions": [
+ ".html"
+ ],
+ "url": "http://127.0.0.1:${port}/?file=${artifact}"
+ },
+ "verdict": ".harness/verdict.json"
+}
diff --git a/store/agents/generative-art/skills/gen-art/SKILL.md b/store/agents/generative-art/skills/gen-art/SKILL.md
new file mode 100644
index 000000000..5ace724d9
--- /dev/null
+++ b/store/agents/generative-art/skills/gen-art/SKILL.md
@@ -0,0 +1,72 @@
+---
+name: gen-art
+description: Build a deterministic, seedable generative artwork in one HTML file from a plain-English description. Use whenever the user asks for a generative piece, an edition, a flow field, a shader, a seedable series, or prompt-to-art.
+---
+
+# gen-art
+
+Take the user's description and produce a **single self-contained `sketch/index.html`** that renders
+a **deterministic, seedable** generative artwork, loading the seed from a `?seed=` query param so
+the web-viewer can preview the current seed and re-seed live.
+
+## The floor (in order)
+
+1. **Seeded PRNG.** A small seeded PRNG (mulberry32 / sfc32) derived from the hash of the seed
+ string. Nothing may call a non-seeded random — the sketch must be reproducible.
+2. **Render-at-any-size.** The composition is defined in logical units and scaled; the same seed
+ renders at 400px preview and 4000px print. High-DPI (devicePixelRatio) aware.
+3. **`?seed=` plumbing.** Reading the param, plus a tiny UI (input + "re-seed" button) so the user
+ can browse seeds in the pane.
+4. **Named sub-streams.** One PRNG sub-stream per concern (composition, palette, detail) so tuning
+ one doesn't reshuffle the other.
+
+## The gold checklist
+
+- **Trait + rarity tables that survive an edition**: a deterministic mapping from seed → traits
+ (palette, layout, density), and a census that proves no hidden degenerate seed.
+- **Palette discipline**: OKLCH/OKLab ramps or a seeded palette-from-image; grain/dither as taste.
+- **Style range**: flow fields, packing, reaction-diffusion, attractors, raymarched shaders,
+ Islamic/polar patterns — matched to the brief, not all at once.
+- **Export routes**: a `?seed=X&size=4000` render for print, a video-loop-friendly static repaint.
+- Motion (if the brief wants it) should be seed-stable and respect `prefers-reduced-motion`.
+
+## Verify like a visitor, not a compiler
+
+Render a grid of seeds, screenshot the actual output, and look. Two hard checks before "ready":
+- **Re-render same-seed** and diff — it must be byte-perceptually stable on this machine.
+- **Census the seed range you promise** (e.g. 0–99); reject any blank/blown-out/duplicate frame.
+
+Be explicit in the verdict about the reproducibility guarantee: same-machine yes; *cross*-machine
+for WebGL you cannot prove — say so.
+
+## Verdict feed
+
+Write `.harness/verdict.json` at every change:
+
+```json
+{ "spec": 1, "ready": false, "summary": "seeded flow field · re-seed live · census 0–99 clean",
+ "findings": [{ "severity": "info", "kind": "reproducibility", "message": "same-machine verification pending; cross-machine WebGL not provable" }],
+ "artifact": "sketch/index.html",
+ "phases": [{ "id": "seed", "name": "Seeded core", "state": "done" },
+ { "id": "piece", "name": "The piece", "state": "active" },
+ { "id": "edition", "name": "Edition", "state": "pending" }],
+ "updatedAt": "2026-09-18T00:00:00Z" }
+```
+
+## Starting from Fieldwork
+
+The template is functional: Three techniques, named random streams, palette selection, density/tension controls, nearby seed previews, high-resolution PNG export.
+
+Keep its useful controls and exports when making a user's creation. Test the behavioral core
+(artModel, artPaths, drawArt, logical print coordinates) as well as the visible result. A self-contained HTML file can still have well-separated
+model, rendering, input and export functions. Do not turn a finished starter into a waiting screen.
+
+Presence-only helpers do not prove correctness or reproducibility. Record actual evidence before
+marking the result ready. Export and reopen the result as part of the handoff to the user.
+
+## Check your actual edited model
+
+Run `node tools/check.mjs --seeds 100` in the workspace. It reads the pure model from
+`<script id="harness-model">` in the artifact, checks domain invariants, repeats each seed, and
+writes `.harness/model-check.json`. Preserve that script boundary when editing. Model checks are
+followed by browser interaction, exported-output inspection, and visual or listening review.
diff --git a/store/agents/generative-art/skills/gen-art/scripts/seed-verdict.sh b/store/agents/generative-art/skills/gen-art/scripts/seed-verdict.sh
new file mode 100755
index 000000000..cb0190eda
--- /dev/null
+++ b/store/agents/generative-art/skills/gen-art/scripts/seed-verdict.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# Presence is not evidence of correctness. Only the agent's actual checks may establish ready:true.
+set -eu
+ws="${1:?usage: seed-verdict.sh WORKSPACE}"
+mkdir -p "$ws/.harness"
+summary="No artifact yet"; phase=pending
+if [ -s "$ws/sketch/index.html" ]; then summary="Artifact available — browser verification pending"; phase=active; fi
+cat > "$ws/.harness/verdict.json" <<JSON
+{"spec":1,"ready":false,"summary":"$summary","artifact":"sketch/index.html","findings":[{"severity":"info","kind":"verification_pending","message":"File presence checked; behavior, output quality and reproducibility have not been verified by this helper."}],"phases":[{"id":"build","name":"Build","state":"$phase"},{"id":"verify","name":"Verify","state":"pending"}],"updatedAt":"$(date -u +%Y-%m-%dT%H:%M:%SZ)"}
+JSON
diff --git a/store/agents/generative-art/store.json b/store/agents/generative-art/store.json
new file mode 100644
index 000000000..57a1f9ed3
--- /dev/null
+++ b/store/agents/generative-art/store.json
@@ -0,0 +1,15 @@
+{
+ "homepage": "https://github.com/autonomous-ai/openharness/tree/main/store/agents/generative-art",
+ "license": "MIT",
+ "tagline": "Design reproducible generative editions",
+ "screenshots": [
+ "https://raw.githubusercontent.com/autonomous-ai/openharness/main/store/showcase/generative-art/starter.jpg"
+ ],
+ "examples": [
+ {
+ "prompt": "Create an edition of 12 tidal contour prints in indigo and burnt orange. Keep the paper quiet and make each seed feel related but distinct.",
+ "caption": "Fieldwork · interactive offline starter",
+ "image": "https://raw.githubusercontent.com/autonomous-ai/openharness/main/store/showcase/generative-art/starter.jpg"
+ }
+ ]
+}
diff --git a/store/agents/generative-art/template/NOTES.md b/store/agents/generative-art/template/NOTES.md
new file mode 100644
index 000000000..dcf7d01c1
--- /dev/null
+++ b/store/agents/generative-art/template/NOTES.md
@@ -0,0 +1,4 @@
+# Fieldwork workspace
+
+Open `sketch/index.html` in the pane, try the controls, then describe what you want to create.
+Keep your decisions in `sketch/DESIGN.md`. Save the exported result when you are ready.
diff --git a/store/agents/generative-art/template/sketch/index.html b/store/agents/generative-art/template/sketch/index.html
new file mode 100644
index 000000000..4d8f2a5a5
--- /dev/null
+++ b/store/agents/generative-art/template/sketch/index.html
@@ -0,0 +1,889 @@
+<!doctype html>
+<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
+<meta name="color-scheme" content="dark light"><title>FIELDWORK — Generative Art</title>
+<!-- Built by store/tools/build-experiences.mjs. Edit this file freely in your workspace. -->
+<style>:root {
+ color-scheme: dark;
+ --bg: #111414;
+ --panel: #191e1c;
+ --line: #ffffff1c;
+ --ink: #f4f2e9;
+ --muted: #a1aaa4;
+ --accent: #d0f28a;
+ font:
+ 14px/1.5 -apple-system,
+ BlinkMacSystemFont,
+ "Segoe UI",
+ sans-serif;
+}
+* {
+ box-sizing: border-box;
+}
+body {
+ margin: 0;
+ background: var(--bg);
+ color: var(--ink);
+}
+button,
+input,
+select {
+ font: inherit;
+}
+button,
+a,
+input,
+select {
+ -webkit-tap-highlight-color: transparent;
+}
+button,
+a {
+ touch-action: manipulation;
+}
+button {
+ cursor: pointer;
+}
+button:disabled {
+ opacity: 0.45;
+ cursor: wait;
+}
+button:focus-visible,
+input:focus-visible,
+select:focus-visible,
+a:focus-visible {
+ outline: 2px solid var(--accent);
+ outline-offset: 4px;
+}
+button,
+input,
+select {
+ color: inherit;
+ background: transparent;
+ border: 1px solid var(--line);
+ border-radius: 5px;
+ padding: 9px 13px;
+}
+button:hover {
+ background: #ffffff0c;
+ border-color: var(--muted);
+}
+button.primary {
+ background: var(--accent);
+ color: #142015;
+ border-color: transparent;
+ font-weight: 650;
+}
+button[aria-pressed="true"] {
+ border-color: var(--accent);
+ color: var(--accent);
+}
+input[type="range"] {
+ accent-color: var(--accent);
+ padding: 0;
+ min-width: 0;
+}
+input[type="number"] {
+ width: 80px;
+}
+select {
+ background: var(--panel);
+}
+label {
+ cursor: pointer;
+}
+a {
+ color: inherit;
+}
+h1,
+h2,
+h3,
+p {
+ margin: 0;
+}
+h1 {
+ font-size: clamp(32px, 5vw, 64px);
+ line-height: 1.02;
+ letter-spacing: -0.055em;
+ font-weight: 550;
+}
+h2 {
+ font-weight: 550;
+ letter-spacing: -0.03em;
+}
+h3 {
+ font-size: 14px;
+ font-weight: 550;
+}
+.mono,
+.eyebrow {
+ font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
+}
+.eyebrow {
+ font-size: 10px;
+ letter-spacing: 0.16em;
+ text-transform: uppercase;
+ color: var(--muted);
+}
+.muted {
+ color: var(--muted);
+}
+.small {
+ font-size: 12px;
+}
+.masthead {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 20px;
+ padding: 19px 28px;
+ border-bottom: 1px solid var(--line);
+}
+.identity {
+ display: flex;
+ gap: 12px;
+ align-items: center;
+ white-space: nowrap;
+ font-size: 12px;
+ font-weight: 600;
+ letter-spacing: 0.04em;
+}
+.mark {
+ width: 25px;
+ height: 25px;
+ display: grid;
+ place-items: center;
+ border: 1px solid currentColor;
+ font-size: 17px;
+}
+.seed-form {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+}
+.seed-form label {
+ font:
+ 10px ui-monospace,
+ monospace;
+ text-transform: uppercase;
+ letter-spacing: 0.12em;
+ color: var(--muted);
+ margin-right: 4px;
+}
+.seed-form input {
+ width: 74px;
+ padding: 6px 8px;
+ font:
+ 12px ui-monospace,
+ monospace;
+}
+.seed-form button {
+ padding: 6px 10px;
+ font-size: 12px;
+}
+.intro {
+ padding: 32px 28px;
+ display: flex;
+ align-items: flex-end;
+ justify-content: space-between;
+ gap: 20px;
+}
+.intro p {
+ max-width: 440px;
+ color: var(--muted);
+ margin-top: 14px;
+}
+.intro .eyebrow {
+ margin-bottom: 12px;
+}
+.actions {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ flex-wrap: wrap;
+}
+.workspace {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) 270px;
+ gap: 22px;
+ padding: 0 28px 28px;
+}
+.panel {
+ background: var(--panel);
+ border: 1px solid var(--line);
+ border-radius: 8px;
+ overflow: hidden;
+}
+.panel-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 16px 20px;
+ border-bottom: 1px solid var(--line);
+ gap: 10px;
+}
+.side {
+ display: flex;
+ flex-direction: column;
+ gap: 20px;
+}
+.section {
+ border-top: 1px solid var(--line);
+ padding-top: 18px;
+}
+.section h3 {
+ margin-bottom: 15px;
+}
+.field {
+ display: grid;
+ gap: 7px;
+ margin: 14px 0;
+}
+.field > span {
+ display: flex;
+ justify-content: space-between;
+ font-size: 12px;
+ color: var(--muted);
+}
+.metrics {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ gap: 1px;
+ background: var(--line);
+ border: 1px solid var(--line);
+ border-radius: 6px;
+ overflow: hidden;
+}
+.metric {
+ background: var(--bg);
+ padding: 13px 15px;
+}
+.metric strong {
+ display: block;
+ font:
+ 24px ui-monospace,
+ monospace;
+ letter-spacing: -0.06em;
+}
+.metric span {
+ font-size: 10px;
+ color: var(--muted);
+ text-transform: uppercase;
+ letter-spacing: 0.09em;
+}
+canvas {
+ display: block;
+ max-width: 100%;
+}
+.status-line {
+ display: flex;
+ justify-content: space-between;
+ gap: 20px;
+ padding: 14px 28px;
+ border-top: 1px solid var(--line);
+ font:
+ 10px ui-monospace,
+ monospace;
+ color: var(--muted);
+}
+.dot {
+ width: 6px;
+ height: 6px;
+ display: inline-block;
+ background: var(--accent);
+ border-radius: 50%;
+ margin-right: 6px;
+}
+.toast {
+ position: fixed;
+ z-index: 99;
+ left: 50%;
+ bottom: 22px;
+ transform: translateX(-50%);
+ max-width: 90vw;
+ background: var(--ink);
+ color: var(--bg);
+ padding: 11px 18px;
+ border-radius: 6px;
+ box-shadow: 0 3px 30px #0004;
+ font-size: 12px;
+}
+.toast:empty {
+ display: none;
+}
+[hidden] {
+ display: none !important;
+}
+.sr-only {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ padding: 0;
+ margin: -1px;
+ overflow: hidden;
+ clip-path: inset(50%);
+ white-space: nowrap;
+ border: 0;
+}
+@media (max-width: 800px) {
+ .workspace {
+ grid-template-columns: 1fr;
+ }
+ .side {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ }
+ .intro {
+ align-items: flex-start;
+ flex-direction: column;
+ }
+ .intro h1 {
+ font-size: 44px;
+ }
+}
+@media (max-width: 480px) {
+ .masthead {
+ padding: 13px 16px;
+ gap: 8px;
+ flex-wrap: wrap;
+ }
+ .intro {
+ padding: 26px 16px;
+ }
+ .intro h1 {
+ font-size: 38px;
+ }
+ .workspace {
+ padding: 0 16px 20px;
+ gap: 18px;
+ }
+ .side {
+ grid-template-columns: 1fr;
+ }
+ .seed-form label {
+ display: none;
+ }
+ .status-line {
+ padding: 12px 16px;
+ }
+ .status-line span:last-child {
+ display: none;
+ }
+ .metrics .metric {
+ padding: 12px 10px;
+ }
+ .panel-head {
+ padding: 12px;
+ }
+ .actions {
+ gap: 6px;
+ }
+}
+@media (prefers-reduced-motion: reduce) {
+ *,
+ *::before,
+ *::after {
+ scroll-behavior: auto !important;
+ animation: none !important;
+ transition: none !important;
+ }
+}
+
+:root {
+ color-scheme: light;
+ --bg: #e9e8e1;
+ --panel: #f5f3eb;
+ --line: #242d292a;
+ --ink: #26342d;
+ --muted: #646d62;
+ --accent: #314b3a;
+}
+button.primary {
+ color: #f4f1e7;
+}
+.mark {
+ border-radius: 50%;
+}
+.intro h1 {
+ font-weight: 450;
+}
+.intro em {
+ font-family: Georgia, serif;
+ font-weight: 400;
+}
+.workspace {
+ grid-template-columns: minmax(0, 1fr) 230px;
+ max-width: 1320px;
+ margin: auto;
+ gap: 40px;
+}
+.intro {
+ max-width: 1320px;
+ margin: auto;
+}
+.paper-stage {
+ background: #dbdcd4;
+ padding: 30px 50px 18px;
+ display: flex;
+ align-items: center;
+ flex-direction: column;
+ min-width: 0;
+}
+.paper-stage > canvas {
+ width: min(100%, 620px);
+ aspect-ratio: 4/5;
+ height: auto;
+ box-shadow: 0 13px 28px #28302620;
+}
+.caption {
+ font:
+ 9px ui-monospace,
+ monospace;
+ letter-spacing: 0.08em;
+ width: 100%;
+ display: flex;
+ justify-content: space-between;
+ margin-top: 18px;
+ gap: 8px;
+}
+.palettes {
+ display: flex;
+ gap: 8px;
+ margin-top: 20px;
+}
+.palettes button {
+ border-radius: 50%;
+ width: 32px;
+ height: 32px;
+ padding: 0;
+ border: 3px solid var(--bg);
+ outline: 1px solid var(--line);
+}
+.palettes button[aria-pressed="true"] {
+ outline: 2px solid var(--ink);
+}
+.editions {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ gap: 8px;
+}
+.editions button {
+ padding: 0;
+ border: 0;
+ border-radius: 0;
+}
+.editions canvas {
+ width: 100%;
+}
+.editions span {
+ font:
+ 9px ui-monospace,
+ monospace;
+ display: block;
+ margin-top: 6px;
+}
+.side h2 {
+ font:
+ 27px/1.15 Georgia,
+ serif;
+}
+.seed-form button:hover {
+ background: #0000000b;
+}
+.actions select {
+ background: #e9e8e1;
+ font-size: 12px;
+}
+@media (max-width: 800px) {
+ .workspace {
+ grid-template-columns: 1fr;
+ gap: 24px;
+ }
+ .paper-stage {
+ padding: 24px 32px 16px;
+ }
+}
+@media (max-width: 480px) {
+ .paper-stage {
+ padding: 18px;
+ }
+ .intro {
+ padding-top: 22px;
+ }
+ .intro h1 {
+ font-size: 42px;
+ }
+}
+</style></head><body>
+<header class="masthead"><div class="identity"><span class="mark" aria-hidden="true">≋</span>FIELDWORK</div>
+<form class="seed-form" id="seed-form"><label for="seed">Seed</label><input id="seed" aria-label="Seed" maxlength="128" autocomplete="off" spellcheck="false"><button type="submit">Apply</button><button id="next-seed" type="button" title="Next seed">↗ Next</button></form></header>
+<section class="intro">
+ <div>
+ <p class="eyebrow">A study in controlled disorder · 001</p>
+ <h1>Follow the<br /><em>unexpected.</em></h1>
+ <p>
+ A field of lines. A small set of rules. An edition that belongs to you.
+ </p>
+ </div>
+ <div class="actions">
+ <select id="export-size" aria-label="Export resolution">
+ <option value="1600">1600 × 2000</option>
+ <option value="3200">3200 × 4000</option></select
+ ><button class="primary" id="export">Export print ↗</button>
+ </div>
+</section>
+<main class="workspace">
+ <section class="paper-stage">
+ <canvas id="art" aria-label="Seeded generative artwork"></canvas>
+ <div class="caption">
+ <span>FIELD NOTES / <span id="edition"></span></span
+ ><span id="palette-name"></span>
+ </div>
+ </section>
+ <aside class="side">
+ <div>
+ <p class="eyebrow">The system</p>
+ <h2 style="margin-top: 10px">Make a little<br />room for chance.</h2>
+ <label class="field"
+ ><span>Technique</span
+ ><select id="mode">
+ <option value="contours">01 / Contour field</option>
+ <option value="dunes">02 / Dune study</option>
+ <option value="orbits">03 / Orbital motion</option>
+ </select></label
+ ><label class="field"
+ ><span>Line density <output id="density-value">120</output></span
+ ><input
+ id="density"
+ type="range"
+ min="40"
+ max="200"
+ value="120" /></label
+ ><label class="field"
+ ><span>Field tension <output id="curl-value">55</output></span
+ ><input id="curl" type="range" min="0" max="100" value="55"
+ /></label>
+ <div
+ id="palettes"
+ class="palettes"
+ role="group"
+ aria-label="Palette"
+ ></div>
+ </div>
+ <div class="section">
+ <h3>Nearby possibilities</h3>
+ <div class="editions" id="editions"></div>
+ <p class="small muted" style="margin-top: 12px">
+ Every seed is a composition. Return to a seed to find it exactly as you
+ left it.
+ </p>
+ </div>
+ <div class="section small muted">
+ Prints use the same geometry at every size. Color and rasterization can
+ vary between devices.
+ </div>
+ </aside>
+</main>
+<footer class="status-line">
+ <span><i class="dot"></i>DETERMINISTIC BY DESIGN</span
+ ><span>CANVAS / NO EXTERNAL ASSETS</span>
+</footer>
+<div class="toast" id="toast" role="status"></div>
+<script id="harness-model">
+'use strict';
+// Shared deterministic primitives. Domain models use named streams so unrelated edits stay stable.
+function hash(value) {
+ let h = 2166136261;
+ for (const c of String(value)) h = Math.imul(h ^ c.charCodeAt(0), 16777619);
+ return h >>> 0;
+}
+function random(seed, stream = "main") {
+ let a = hash(`${seed}:${stream}`);
+ return () => {
+ a = (a + 0x6d2b79f5) | 0;
+ let t = Math.imul(a ^ (a >>> 15), 1 | a);
+ t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
+ };
+}
+const clamp = (n, lo, hi) => Math.max(lo, Math.min(hi, n));
+const lerp = (a, b, t) => a + (b - a) * t;
+const pick = (items, rng) => items[Math.floor(rng() * items.length)];
+function normal(rng) {
+ return (
+ Math.sqrt(-2 * Math.log(Math.max(1e-9, rng()))) *
+ Math.cos(2 * Math.PI * rng())
+ );
+}
+
+const artPalettes = [
+ {
+ name: "Estuary",
+ paper: "#f1ecdf",
+ colors: ["#203c36", "#527863", "#9cab86", "#d87746", "#e2b65f"],
+ },
+ {
+ name: "Ultramarine",
+ paper: "#efebe2",
+ colors: ["#132d6c", "#355bb5", "#6e99b3", "#e24f32", "#d59b75"],
+ },
+ {
+ name: "After the rain",
+ paper: "#e9e6ee",
+ colors: ["#332852", "#79658d", "#ac8992", "#cf805c", "#354d52"],
+ },
+ {
+ name: "Ember",
+ paper: "#201e23",
+ colors: ["#edbe7f", "#e67a53", "#ad4248", "#69787b", "#ad9a83"],
+ },
+];
+function artModel(
+ seed,
+ { density = 120, curl = 55, mode = "contours", palette } = {},
+) {
+ const rnd = random(seed, "composition");
+ return {
+ seed: String(seed),
+ density,
+ curl,
+ mode,
+ palette:
+ palette ?? Math.floor(random(seed, "palette")() * artPalettes.length),
+ phases: Array.from({ length: 5 }, () => rnd() * Math.PI * 2),
+ frequency: 1.4 + rnd() * 1.8,
+ tilt: (rnd() - 0.5) * 0.22,
+ };
+}
+function artPaths(model) {
+ const { density, curl, phases: p, frequency: f, mode } = model;
+ const paths = [];
+ for (let i = 0; i < density; i++) {
+ const u = i / (density - 1),
+ path = [];
+ for (let j = 0; j <= 140; j++) {
+ const v = j / 140;
+ if (mode === "orbits") {
+ const theta = v * Math.PI * 2;
+ const radius =
+ 50 + u * 385 + Math.sin(theta * 3 + p[0]) * (curl * 0.6) * u;
+ path.push([
+ 500 + Math.cos(theta) * radius,
+ 580 + Math.sin(theta) * radius * 1.25,
+ ]);
+ } else {
+ const wave =
+ Math.sin(v * f * Math.PI + p[0] + u * 2.6) * Math.sin(u * Math.PI);
+ const wave2 =
+ Math.cos(v * Math.PI * 3 + p[1]) * Math.sin(u * Math.PI) * 0.27;
+ if (mode === "dunes")
+ path.push([
+ 70 + v * 860,
+ 170 + u * 890 + (wave + wave2) * curl * 2.1,
+ ]);
+ else
+ path.push([
+ 80 + u * 840 + (wave + wave2) * curl * 2.2,
+ 80 + v * 1070 + (u - 0.5) * model.tilt * 400,
+ ]);
+ }
+ }
+ paths.push(path);
+ }
+ return paths;
+}
+
+</script>
+<script>
+'use strict';
+const $ = (s) => document.querySelector(s);
+const $$ = (s) => [...document.querySelectorAll(s)];
+const params = new URLSearchParams(location.search);
+let seed = (params.get("seed") || "42").slice(0, 128);
+const reducedMotion = matchMedia("(prefers-reduced-motion: reduce)").matches;
+const parentMessage = (message) => {
+ if (parent !== window) parent.postMessage(message, "*");
+};
+function toast(message) {
+ $("#toast").textContent = message;
+ clearTimeout(toast.timer);
+ toast.timer = setTimeout(() => {
+ $("#toast").textContent = "";
+ }, 3500);
+}
+function saveFile(name, content, type = "application/json") {
+ const blob =
+ content instanceof Blob ? content : new Blob([content], { type });
+ const url = URL.createObjectURL(blob),
+ a = document.createElement("a");
+ a.href = url;
+ a.download = name;
+ document.body.append(a);
+ a.click();
+ a.remove();
+ setTimeout(() => URL.revokeObjectURL(url), 30000);
+}
+function canvasPNG(canvas, name) {
+ canvas.toBlob((blob) => {
+ if (blob) saveFile(name, blob);
+ else toast("Image export failed. Please try again.");
+ });
+}
+function setSeed(value) {
+ seed = String(value).trim().slice(0, 128) || "42";
+ $("#seed").value = seed;
+ const url = new URL(location.href);
+ url.searchParams.set("seed", seed);
+ try {
+ history.replaceState(null, "", url);
+ } catch {
+ /* Opaque-origin iframe: the shell owns its URL. */
+ }
+ parentMessage({ type: "harness:state", seed });
+ dispatchEvent(new CustomEvent("seedchange", { detail: seed }));
+}
+$("#seed").value = seed;
+$("#seed-form").addEventListener("submit", (e) => {
+ e.preventDefault();
+ setSeed($("#seed").value);
+});
+$("#next-seed").addEventListener("click", () =>
+ setSeed(/^\d{1,9}$/.test(seed) ? Number(seed) + 1 : hash(seed)),
+);
+function fitCanvas(canvas, draw, maxDpr = 2) {
+ const observer = new ResizeObserver(() => {
+ const box = canvas.getBoundingClientRect(),
+ dpr = Math.min(devicePixelRatio || 1, maxDpr);
+ canvas.width = Math.max(1, Math.round(box.width * dpr));
+ canvas.height = Math.max(1, Math.round(box.height * dpr));
+ draw?.();
+ });
+ observer.observe(canvas);
+ return observer;
+}
+const editable = (target) =>
+ target instanceof Element &&
+ !!target.closest("input,textarea,select,[contenteditable=true]");
+addEventListener("error", (e) =>
+ parentMessage({ type: "harness:error", message: e.message }),
+);
+addEventListener("unhandledrejection", (e) =>
+ parentMessage({
+ type: "harness:error",
+ message: String(e.reason?.message || e.reason),
+ }),
+);
+function ready() {
+ document.body.dataset.ready = "true";
+ parentMessage({ type: "harness:ready", title: document.title, seed });
+}
+
+let artwork, paletteOverride;
+function drawArt(canvas, model) {
+ const ctx = canvas.getContext("2d"),
+ p = artPalettes[model.palette];
+ ctx.setTransform(canvas.width / 1000, 0, 0, canvas.height / 1250, 0, 0);
+ ctx.fillStyle = p.paper;
+ ctx.fillRect(0, 0, 1000, 1250);
+ const paths = artPaths(model),
+ colors = random(model.seed, "line-colors");
+ // Batch by ink color. Hundreds of tiny GPU submissions otherwise dominate the redraw.
+ const inks = p.colors.map(() => new Path2D());
+ paths.forEach((points, i) => {
+ const index = Math.floor(
+ (((i / paths.length) * 3 + colors() * 0.45) % 1) * p.colors.length,
+ );
+ points.forEach(([x, y], j) =>
+ j ? inks[index].lineTo(x, y) : inks[index].moveTo(x, y),
+ );
+ });
+ ctx.lineWidth = model.mode === "dunes" ? 2.6 : 2.1;
+ ctx.globalAlpha = 0.83;
+ inks.forEach((path, i) => {
+ ctx.strokeStyle = p.colors[i];
+ ctx.stroke(path);
+ });
+ ctx.globalAlpha = 1;
+ // Seeded paper texture in one draw, in logical coordinates at every export resolution.
+ const grain = random(model.seed, "paper");
+ const texture = document.createElement("canvas");
+ texture.width = texture.height = 128;
+ const textureContext = texture.getContext("2d");
+ const pixels = textureContext.createImageData(128, 128);
+ for (let i = 0; i < pixels.data.length; i += 4) {
+ pixels.data[i] = model.palette === 3 ? 255 : 65;
+ pixels.data[i + 1] = model.palette === 3 ? 255 : 55;
+ pixels.data[i + 2] = model.palette === 3 ? 255 : 46;
+ pixels.data[i + 3] = grain() > 0.91 ? 16 : 0;
+ }
+ textureContext.putImageData(pixels, 0, 0);
+ ctx.fillStyle = ctx.createPattern(texture, "repeat");
+ ctx.fillRect(0, 0, 1000, 1250);
+ ctx.fillStyle = p.colors[0];
+ ctx.font = "9px monospace";
+ ctx.fillText(
+ `FIELDWORK / ${model.seed.slice(0, 26)} / ${model.mode.toUpperCase()}`,
+ 70,
+ 1208,
+ );
+}
+function controls() {
+ return {
+ density: +$("#density").value,
+ curl: +$("#curl").value,
+ mode: $("#mode").value,
+ palette: paletteOverride,
+ };
+}
+function renderArt() {
+ artwork = artModel(seed, controls());
+ $("#density-value").value = artwork.density;
+ $("#curl-value").value = artwork.curl;
+ $("#edition").textContent = seed;
+ $("#palette-name").textContent = artPalettes[artwork.palette].name;
+ drawArt($("#art"), artwork);
+ $$("#palettes button").forEach((b, i) =>
+ b.setAttribute("aria-pressed", i === artwork.palette),
+ );
+ $("#editions").replaceChildren();
+ for (let i = 1; i <= 3; i++) {
+ const next = /^\d{1,9}$/.test(seed) ? String(+seed + i) : `${seed}.${i}`;
+ const button = document.createElement("button"),
+ c = document.createElement("canvas"),
+ label = document.createElement("span");
+ c.width = 160;
+ c.height = 200;
+ label.textContent = next.slice(0, 9);
+ button.setAttribute("aria-label", `Explore seed ${next}`);
+ button.append(c, label);
+ button.onclick = () => setSeed(next);
+ $("#editions").append(button);
+ drawArt(c, artModel(next, controls()));
+ }
+}
+artPalettes.forEach((p, i) => {
+ const b = document.createElement("button");
+ b.title = p.name;
+ b.setAttribute("aria-label", p.name);
+ b.style.background = `conic-gradient(${p.colors.map((c, j) => `${c} ${j * 20}% ${(j + 1) * 20}%`).join(",")})`;
+ b.onclick = () => {
+ paletteOverride = i;
+ renderArt();
+ };
+ $("#palettes").append(b);
+});
+$("#art").width = 1000;
+$("#art").height = 1250;
+for (const id of ["density", "curl", "mode"])
+ $("#" + id).addEventListener("input", renderArt);
+$("#export").onclick = () => {
+ const c = document.createElement("canvas");
+ c.width = +$("#export-size").value;
+ c.height = c.width * 1.25;
+ drawArt(c, artwork);
+ canvasPNG(c, `fieldwork-${hash(seed)}-${artwork.mode}.png`);
+ toast("Your print is ready.");
+};
+addEventListener("seedchange", renderArt);
+renderArt();
+ready();
+
+</script></body></html>
diff --git a/store/agents/generative-art/template/tools/check.mjs b/store/agents/generative-art/template/tools/check.mjs
new file mode 100644
index 000000000..19413fa14
--- /dev/null
+++ b/store/agents/generative-art/template/tools/check.mjs
@@ -0,0 +1,75 @@
+const CONFIG = {"id":"generative-art","artifact":"sketch/index.html"};
+// Compiled into each workspace's tools/check.mjs. Tests the model in the ACTUAL edited HTML.
+import { readFile, mkdir, writeFile } from "node:fs/promises";
+import { createHash } from "node:crypto";
+import vm from "node:vm";
+import { resolve, dirname } from "node:path";
+
+const args = process.argv.slice(2),
+ i = args.indexOf("--seeds");
+const count = i === -1 ? 32 : Number(args[i + 1]);
+if (!Number.isInteger(count) || count < 1 || count > 1000)
+ throw new Error("--seeds must be an integer from 1 to 1000");
+const artifact = resolve(CONFIG.artifact);
+const html = await readFile(artifact, "utf8");
+const script = html.match(
+ /<script id="harness-model">([\s\S]*?)<\/script>/,
+)?.[1];
+if (!script)
+ throw new Error(
+ 'Keep the pure model in <script id="harness-model"> so this checker can exercise the actual artifact.',
+ );
+const expressions = {
+ "generative-art": `const m=artModel(SEED);const p=artPaths(m);({state:m,valid:p.length>0&&p.flat().every(([x,y])=>Number.isFinite(x)&&Number.isFinite(y)),metrics:{paths:p.length,palette:m.palette}})`,
+ "creative-direction": `const m=directionModel(SEED);const ratio=contrast(m.colors[0],m.colors[1]);({state:m,valid:ratio>=4.5,metrics:{direction:m.name,contrast:ratio}})`,
+ "lab-bench": `const p=experiment(SEED),e=treatmentEffect(p);({state:p,valid:p.length>1&&p.every(p=>Number.isFinite(p.x)&&Number.isFinite(p.y))&&Number.isFinite(e.low)&&e.low<=e.high,metrics:{samples:p.length,effect:e.difference,interval:[e.low,e.high]}})`,
+ "music-studio": `const s=musicScore(SEED),r=renderMusic(s);({state:Array.from(r.samples),valid:r.peak>.001&&r.peak<=.95&&r.samples.every(Number.isFinite),metrics:{seconds:r.duration,peak:r.peak,rms:r.rms}})`,
+ "game-master": `const m=arenaMatch(SEED),s=m.history.at(-1);({state:m,valid:m.history.length>1&&m.history.length<=10000&&s.units.every(u=>u.hp>=0&&u.x>=0&&u.x<m.map.w&&u.y>=0&&u.y<m.map.h),metrics:{turns:s.turn,score:s.score,winner:m.winner}})`,
+ "drone-pilot": `const s=flyAutopilot(SEED);({state:s,valid:s.finished&&!s.crashed&&s.passed===flightCourse(SEED).length,metrics:{seconds:s.time,passed:s.passed,missed:s.missed}})`,
+ "voxel-worlds": `const w=voxelWorld(SEED);let p={...w.spawn,vy:0,grounded:true};const clear=playerFits(w,p.x,p.y,p.z);for(let t=0;t<120;t++)p=movePlayer(w,p,{forward:1});({state:Array.from(w.blocks),valid:clear&&playerFits(w,p.x,p.y,p.z),metrics:{blocks:w.blocks.filter(Boolean).length,walkDistance:Math.hypot(p.x-w.spawn.x,p.z-w.spawn.z)}})`,
+};
+const expression = expressions[CONFIG.id];
+const digest = (value) =>
+ createHash("sha256").update(JSON.stringify(value)).digest("hex");
+const results = [];
+for (let seed = 0; seed < count; seed++) {
+ const run = () =>
+ vm.runInNewContext(
+ `${script}\n${expression}`,
+ { SEED: String(seed) },
+ { timeout: 10000 },
+ );
+ try {
+ const first = run(),
+ second = run(),
+ signature = digest(first.state),
+ repeat = digest(second.state);
+ results.push({
+ seed,
+ ok: first.valid && signature === repeat,
+ signature,
+ metrics: first.metrics,
+ });
+ } catch (error) {
+ results.push({ seed, ok: false, error: error.message });
+ }
+}
+const passed = results.filter((r) => r.ok).length;
+const report = {
+ spec: 1,
+ harness: CONFIG.id,
+ artifact: CONFIG.artifact,
+ checkedAt: new Date().toISOString(),
+ modelChecks: { passed, total: count },
+ scope:
+ "Pure model invariants and same-process repeatability. Browser interaction, layout, listening and export review still required.",
+ results,
+};
+const out = resolve(".harness/model-check.json");
+await mkdir(dirname(out), { recursive: true });
+await writeFile(out, JSON.stringify(report, null, 2) + "\n");
+console.log(
+ `${CONFIG.id}: ${passed}/${count} model checks passed. Report: ${out}`,
+);
+console.log(report.scope);
+if (passed !== count) process.exitCode = 1;
diff --git a/store/agents/generative-art/test/toolchain.test.mjs b/store/agents/generative-art/test/toolchain.test.mjs
new file mode 100644
index 000000000..c228b1126
--- /dev/null
+++ b/store/agents/generative-art/test/toolchain.test.mjs
@@ -0,0 +1,66 @@
+// The Generative Art harness scripts, run the way Harness runs them.
+// node --test test/*.test.mjs
+import assert from 'node:assert/strict'
+import { spawnSync } from 'node:child_process'
+import { accessSync, constants, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { after, test } from 'node:test'
+
+const here = fileURLToPath(new URL('..', import.meta.url))
+const manifest = JSON.parse(readFileSync(join(here, 'harness.json'), 'utf8'))
+const scratch = []
+after(() => { for (const dir of scratch) rmSync(dir, { recursive: true, force: true }) })
+
+function tempDir() { const d = mkdtempSync(join(tmpdir(), 'genart-')); scratch.push(d); return d }
+function run(script, { cwd = here, env = {} } = {}) {
+ const merged = { ...process.env }
+ for (const [k, v] of Object.entries(env)) v === null ? delete merged[k] : (merged[k] = v)
+ const r = spawnSync(join(here, script), { cwd, env: merged, encoding: 'utf8' })
+ return { code: r.status, stdout: r.stdout, stderr: r.stderr }
+}
+const seedScript = join(here, 'skills/gen-art/scripts/seed-verdict.sh')
+
+test('every script the manifest names is in the folder and executable', () => {
+ for (const s of [manifest.workspace.init, manifest.toolchain.setup, manifest.toolchain.doctor]) {
+ assert.doesNotThrow(() => accessSync(join(here, s), constants.X_OK), s)
+ }
+})
+
+test('setup installs nothing and succeeds quietly', () => {
+ assert.deepEqual(run(manifest.toolchain.setup), { code: 0, stdout: '', stderr: '' })
+})
+
+test('doctor says ok when sh is on PATH', () => {
+ assert.equal(run(manifest.toolchain.doctor).code, 0)
+})
+
+test('init lays out a workspace and seeds a not-ready verdict', () => {
+ const ws = tempDir()
+ assert.equal(run(manifest.workspace.init, { cwd: ws, env: { HARNESS_DSH: manifest.id } }).code, 0)
+ assert.equal(JSON.parse(readFileSync(join(ws, '.harness/verdict.json'), 'utf8')).ready, false)
+ assert.equal(readFileSync(join(ws, '.harness-initialized'), 'utf8'), `initialized by ${manifest.id}\n`)
+})
+
+test('the manifest names a viewer package and an HTML artifact', () => {
+ assert.equal(manifest.viewer.use, 'autonomous/web-viewer')
+ assert.deepEqual(manifest.viewer.artifactExtensions, ['.html'])
+})
+
+test('seed-verdict reflects whether a sketch exists', () => {
+ const ws = tempDir()
+ run(manifest.workspace.init, { cwd: ws })
+ assert.equal(spawnSync(seedScript, [ws], { cwd: ws, encoding: 'utf8' }).status, 0)
+ assert.equal(JSON.parse(readFileSync(join(ws, '.harness/verdict.json'), 'utf8')).ready, false)
+ mkdirSync(join(ws, 'sketch'), { recursive: true })
+ writeFileSync(join(ws, 'sketch/index.html'), '<!doctype html>')
+ assert.equal(spawnSync(seedScript, [ws], { cwd: ws, encoding: 'utf8' }).status, 0)
+ assert.equal(JSON.parse(readFileSync(join(ws, '.harness/verdict.json'), 'utf8')).ready, false)
+})
+
+
+test('the manifest routes the actual nested artifact through the shared viewer', () => {
+ assert.equal(manifest.viewer.url, 'http://127.0.0.1:${port}/?file=${artifact}')
+ assert.ok(manifest.workspace.marker.endsWith('/index.html'))
+})
diff --git a/store/agents/generative-art/toolchain/doctor.sh b/store/agents/generative-art/toolchain/doctor.sh
new file mode 100755
index 000000000..66f5b1083
--- /dev/null
+++ b/store/agents/generative-art/toolchain/doctor.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+# Exit 0 when this machine can run the harness. Print one line per check; Harness shows them.
+command -v sh >/dev/null 2>&1 && echo "ok sh (art runtime)" || { echo "miss sh"; exit 1; }
+command -v node >/dev/null 2>&1 && echo "ok node (for seed-census verify)" || echo "note node optional: seed census needs node"
+exit 0
diff --git a/store/agents/generative-art/toolchain/init-workspace.sh b/store/agents/generative-art/toolchain/init-workspace.sh
new file mode 100755
index 000000000..510d1e32e
--- /dev/null
+++ b/store/agents/generative-art/toolchain/init-workspace.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Harness copies the template before this runs. Preserve the user's design log on repeat calls.
+set -eu
+ws="${1:-$PWD}"
+mkdir -p "$ws/sketch" "$ws/.harness"
+if [ ! -f "$ws/sketch/DESIGN.md" ]; then
+ printf '# Design log — Generative Art\n\nRecord date, USER or AI, decision, rationale, and whether it remains in the build.\n' > "$ws/sketch/DESIGN.md"
+fi
+cat > "$ws/.harness/verdict.json" <<JSON
+{"spec":1,"ready":false,"summary":"Fieldwork starter available — describe what you want to create","artifact":"sketch/index.html","findings":[{"severity":"info","kind":"review_pending","message":"Starter provided; personalized changes need browser verification."}],"phases":[{"id":"build","name":"Build","state":"active"},{"id":"verify","name":"Verify","state":"pending"}],"updatedAt":"$(date -u +%Y-%m-%dT%H:%M:%SZ)"}
+JSON
+printf 'initialized by %s\n' "${HARNESS_DSH:-autonomous/generative-art}" > "$ws/.harness-initialized"
diff --git a/store/agents/generative-art/toolchain/setup.sh b/store/agents/generative-art/toolchain/setup.sh
new file mode 100755
index 000000000..4325cad0b
--- /dev/null
+++ b/store/agents/generative-art/toolchain/setup.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+# Nothing to install: art renders in the built-in web-viewer. Kept so the shape matches a real one.
+exit 0
diff --git a/store/agents/lab-bench/AGENTS.md b/store/agents/lab-bench/AGENTS.md
new file mode 100644
index 000000000..2c1f3a8b7
--- /dev/null
+++ b/store/agents/lab-bench/AGENTS.md
@@ -0,0 +1,68 @@
+# Lab Bench / Experiment Log harness
+
+You turn a plain-English description into a **deterministic, seedable bench page**
+rendered in one self-contained `bench/index.html`. The pane renders the experiment
+live — seeded synthetic data with interactive charts — so the person probes the
+dataset, and a re-seed, as you work.
+
+## What a good bench is
+
+- **One file, offline.** All data generation and charting inline on canvas. No CDN
+ at runtime. A `?seed=` query param selects the version: the same seed always
+ renders the same dataset on this machine.
+- **Determinism is the product.** Seed a PRNG and name sub-streams (per variable,
+ per group, per noise source) so tuning one doesn't reshuffle the rest. Same seed
+ → same dataset, same trend, same spread.
+- **Probeable, not just pretty.** Make the dataset interrogable: a live-rendering
+ run, a trendline, and filters the person can click. The bench should invite
+ questions about the data, not just display it.
+- **Be honest about verification.** Same-machine render is checkable. Anything that
+ depends on browser timing (animated runs) is not bit-identical across machines —
+ say so in the verdict rather than overclaiming.
+
+## How to work so the pane moves
+
+1. **Save within a minute.** Materialize `bench/index.html` that renders a trivial
+ seeded scatter (a few points + a trendline) on canvas, so the header has a state
+ and the pane can show it.
+2. **Build the data, then the charts.** Get the seeded generator + chart renderer
+ right first; only then tune axis labels, filters, and interactions.
+3. **Verify like a researcher:** probe a few seeds in the pane, change a filter,
+ check the trendline tracks the data, re-render the same seed and confirm it is
+ identical.
+4. **Update `.harness/verdict.json`** at every check — `ready`, one-line `summary`,
+ `phases`, `findings`, and a reproducibility note.
+
+## Rules
+
+- A bench is only "ready" when every seed in the range you promise renders clean:
+ no empty chart, no overlapping garbage, no broken axis. Sample a grid of seeds.
+- Tag every crafted decision USER vs AI in `bench/DESIGN.md`
+ (`YYYY-MM-DD | USER|AI | topic | decision | still in build?`).
+- The `summary` says plainly what is reproducible now and what is not.
+
+## Shipped experience and operating standard
+
+The workspace starts with **Signal**, a working experience, not an empty placeholder.
+Seeded synthetic experiment, adjustable effect/noise/sample size, group filters, regression, difference-of-means interval, point probe, collection replay, CSV.
+
+- Read the existing artifact before replacing it. The useful model boundaries are experiment, stats, regression, treatmentEffect, csvRows.
+- Preserve working interactions and exports when extending the artifact. Match the user's brief;
+ the starter's genre and visual style are examples, not a ceiling.
+- Expose meaningful domain controls and outputs. Every control must change real state; every
+ displayed metric must be computed from that state. Never invent model activity or test results.
+- Use named random streams and a fixed simulation/score clock. Sample seeds, repeat the same
+ seed, inspect exported data, and verify keyboard/touch controls in the actual viewer.
+- This HTML runs with same-origin APIs in the shared viewer. Sibling fetches, localStorage,
+ downloads and pointer lock are available. Keep files portable and support direct opening.
+- Do not equate an existing HTML file, a successful reload, or a source-string test with a usable
+ result. `seed-verdict.sh` deliberately keeps `ready:false`; write `ready:true` only after your
+ checks establish it. Record exact commands, sampled seeds, observations and limitations.
+- Never claim a test coverage percentage for browser code based on Node subprocess tests.
+
+## Check your actual edited model
+
+Run `node tools/check.mjs --seeds 100` in the workspace. It reads the pure model from
+`<script id="harness-model">` in the artifact, checks domain invariants, repeats each seed, and
+writes `.harness/model-check.json`. Preserve that script boundary when editing. Model checks are
+followed by browser interaction, exported-output inspection, and visual or listening review.
diff --git a/store/agents/lab-bench/README.md b/store/agents/lab-bench/README.md
new file mode 100644
index 000000000..5ab70d2a8
--- /dev/null
+++ b/store/agents/lab-bench/README.md
@@ -0,0 +1,42 @@
+# Lab Bench — Signal
+
+Explore an experiment with reproducible synthetic data. Change effect, noise and sample size, probe observations, filter groups, inspect computed uncertainty, and export CSV.
+
+## Try it
+
+> Build a synthetic catalyst experiment. Let me vary the true effect and noise, compare groups, inspect uncertainty, and export the observations.
+
+The starter already works before the first prompt. Change it with the agent, interact with the
+result in the pane, and keep the output. Everything needed at runtime is in `bench/index.html`.
+It works offline and can be opened outside Harness.
+
+## What you can do
+
+Seeded synthetic experiment, adjustable effect/noise/sample size, group filters, regression, difference-of-means interval, point probe, collection replay, CSV.
+
+## Build on the starter
+
+The model functions `experiment`, `stats`, `regression`, `treatmentEffect` and `csvRows` are the starting points for substantive changes. Preserve seed
+reproducibility and user controls while changing the domain behavior. A different brief can replace
+this starter's entire visual language. Keep the artifact self-contained and test the actual result.
+
+The source checkout builds these starters with `node store/tools/build-experiences.mjs`. Installed
+workspaces are editable HTML; no build tool, network dependency or paid service is required.
+
+## Verification
+
+Model census: `node --test store/tools/experience-tests/models.test.mjs` from the source checkout.
+Browser interactions, exports, same-origin APIs and manifest routing: see
+[`store/tools/experience-tests`](../../tools/experience-tests/README.md).
+
+`seed-verdict.sh` establishes only artifact presence and keeps `ready:false`. The agent must run
+and record real domain and browser checks before writing a ready verdict. No cross-device pixel or
+audio equality is promised. The research is inspiration; this is original code, not a wrapper of
+any cited third-party engine.
+
+## Check your actual edited model
+
+Run `node tools/check.mjs --seeds 100` in the workspace. It reads the pure model from
+`<script id="harness-model">` in the artifact, checks domain invariants, repeats each seed, and
+writes `.harness/model-check.json`. Preserve that script boundary when editing. Model checks are
+followed by browser interaction, exported-output inspection, and visual or listening review.
diff --git a/store/agents/lab-bench/harness.json b/store/agents/lab-bench/harness.json
new file mode 100644
index 000000000..fca38514a
--- /dev/null
+++ b/store/agents/lab-bench/harness.json
@@ -0,0 +1,32 @@
+{
+ "spec": 1,
+ "id": "autonomous/lab-bench",
+ "name": "Lab Bench",
+ "category": "Science",
+ "author": "Autonomous",
+ "description": "Explore an experiment with reproducible synthetic data. Change effect, noise and sample size, probe observations, filter groups, inspect computed uncertainty, and export CSV.",
+ "engine": "claude",
+ "workspace": {
+ "template": "template",
+ "marker": "bench/index.html",
+ "init": "toolchain/init-workspace.sh"
+ },
+ "agent": {
+ "instructions": "AGENTS.md",
+ "skills": [
+ "skills"
+ ]
+ },
+ "toolchain": {
+ "setup": "toolchain/setup.sh",
+ "doctor": "toolchain/doctor.sh"
+ },
+ "viewer": {
+ "use": "autonomous/web-viewer",
+ "artifactExtensions": [
+ ".html"
+ ],
+ "url": "http://127.0.0.1:${port}/?file=${artifact}"
+ },
+ "verdict": ".harness/verdict.json"
+}
diff --git a/store/agents/lab-bench/skills/bench/SKILL.md b/store/agents/lab-bench/skills/bench/SKILL.md
new file mode 100644
index 000000000..328db0ba2
--- /dev/null
+++ b/store/agents/lab-bench/skills/bench/SKILL.md
@@ -0,0 +1,77 @@
+---
+name: bench
+description: Build a deterministic, seedable data bench page in one HTML file from a plain-English description. Use whenever the user asks for an experiment log, a dataset explorer, seeded synthetic data, a trend chart, or prompt-to-bench.
+---
+
+# bench
+
+Take the user's description and produce a **single self-contained `bench/index.html`**
+that renders a **deterministic, seedable** experiment — seeded synthetic data with
+interactive charts — loading the seed from a `?seed=` query param so the web-viewer
+can preview the current seed and re-seed live.
+
+## The floor (in order)
+
+1. **Seeded PRNG.** A small seeded PRNG derived from the hash of the seed string.
+ Nothing may call a non-seeded random — the dataset must be reproducible.
+2. **Data generator + chart renderer.** A seeded generator (variables, groups, a
+ trend with noise) driving a canvas scatter/trend renderer with real axes.
+3. **`?seed=` plumbing.** Reading the param, plus a tiny UI (input + "re-seed"
+ button, and filter toggles) so the person can probe datasets in the pane.
+4. **Named sub-streams.** One PRNG sub-stream per concern (variable, noise group,
+ group assignment) so tuning one doesn't reshuffle the other.
+
+## The gold checklist
+
+- **Trait tables that survive an edition**: seed → dataset (dimensions, group
+ sizes, trend strength), and a census that shows no empty/degenerate render in the
+ range you claim.
+- **Axis discipline**: legible scales, labelled axes, a trendline that tracks the
+ points; filters that actually change the view.
+- **Style range**: a scatter with a trendline, a grouped bar/probe, a run chart,
+ a distribution — matched to the brief, not all at once.
+- **Export route**: expose a "live run" mode that animates points being added and a
+ hover/readout that shows point values.
+
+## Verify like a researcher, not a compiler
+
+Probe a grid of seeds — actually render them — and read the charts.
+Two hard checks before "ready":
+- **Re-render same-seed** — it must be identical on this machine.
+- **Census the seed range you promise** (e.g. 0–99); reject any empty chart,
+ overlapping garbage, or broken axis.
+
+Be explicit in the verdict about the reproducibility guarantee: same-machine yes;
+animated-run frame timing you cannot prove bit-identical — say so.
+
+## Verdict feed
+
+Write `.harness/verdict.json` at every change:
+
+```json
+{ "spec": 1, "ready": false, "summary": "seeded scatter · trend + filters · census 0–99 clean",
+ "findings": [{ "severity": "info", "kind": "reproducibility", "message": "same-machine verification pending; animated-run timing not provable bit-identical" }],
+ "artifact": "bench/index.html",
+ "phases": [{ "id": "seed", "name": "Seeded core", "state": "done" },
+ { "id": "bench", "name": "The bench", "state": "active" },
+ { "id": "edition", "name": "Edition", "state": "pending" }],
+ "updatedAt": "2026-09-18T00:00:00Z" }
+```
+
+## Starting from Signal
+
+The template is functional: Seeded synthetic experiment, adjustable effect/noise/sample size, group filters, regression, difference-of-means interval, point probe, collection replay, CSV.
+
+Keep its useful controls and exports when making a user's creation. Test the behavioral core
+(experiment, stats, regression, treatmentEffect, csvRows) as well as the visible result. A self-contained HTML file can still have well-separated
+model, rendering, input and export functions. Do not turn a finished starter into a waiting screen.
+
+Presence-only helpers do not prove correctness or reproducibility. Record actual evidence before
+marking the result ready. Export and reopen the result as part of the handoff to the user.
+
+## Check your actual edited model
+
+Run `node tools/check.mjs --seeds 100` in the workspace. It reads the pure model from
+`<script id="harness-model">` in the artifact, checks domain invariants, repeats each seed, and
+writes `.harness/model-check.json`. Preserve that script boundary when editing. Model checks are
+followed by browser interaction, exported-output inspection, and visual or listening review.
diff --git a/store/agents/lab-bench/skills/bench/scripts/seed-verdict.sh b/store/agents/lab-bench/skills/bench/scripts/seed-verdict.sh
new file mode 100755
index 000000000..7ad82169e
--- /dev/null
+++ b/store/agents/lab-bench/skills/bench/scripts/seed-verdict.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# Presence is not evidence of correctness. Only the agent's actual checks may establish ready:true.
+set -eu
+ws="${1:?usage: seed-verdict.sh WORKSPACE}"
+mkdir -p "$ws/.harness"
+summary="No artifact yet"; phase=pending
+if [ -s "$ws/bench/index.html" ]; then summary="Artifact available — browser verification pending"; phase=active; fi
+cat > "$ws/.harness/verdict.json" <<JSON
+{"spec":1,"ready":false,"summary":"$summary","artifact":"bench/index.html","findings":[{"severity":"info","kind":"verification_pending","message":"File presence checked; behavior, output quality and reproducibility have not been verified by this helper."}],"phases":[{"id":"build","name":"Build","state":"$phase"},{"id":"verify","name":"Verify","state":"pending"}],"updatedAt":"$(date -u +%Y-%m-%dT%H:%M:%SZ)"}
+JSON
diff --git a/store/agents/lab-bench/store.json b/store/agents/lab-bench/store.json
new file mode 100644
index 000000000..ecd87750d
--- /dev/null
+++ b/store/agents/lab-bench/store.json
@@ -0,0 +1,15 @@
+{
+ "homepage": "https://github.com/autonomous-ai/openharness/tree/main/store/agents/lab-bench",
+ "license": "MIT",
+ "tagline": "Explore an experiment with reproducible synthetic data",
+ "screenshots": [
+ "https://raw.githubusercontent.com/autonomous-ai/openharness/main/store/showcase/lab-bench/starter.jpg"
+ ],
+ "examples": [
+ {
+ "prompt": "Build a synthetic catalyst experiment. Let me vary the true effect and noise, compare groups, inspect uncertainty, and export the observations.",
+ "caption": "Signal · interactive offline starter",
+ "image": "https://raw.githubusercontent.com/autonomous-ai/openharness/main/store/showcase/lab-bench/starter.jpg"
+ }
+ ]
+}
diff --git a/store/agents/lab-bench/template/bench/index.html b/store/agents/lab-bench/template/bench/index.html
new file mode 100644
index 000000000..b602f8b69
--- /dev/null
+++ b/store/agents/lab-bench/template/bench/index.html
@@ -0,0 +1,1034 @@
+<!doctype html>
+<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
+<meta name="color-scheme" content="dark light"><title>SIGNAL — Lab Bench</title>
+<!-- Built by store/tools/build-experiences.mjs. Edit this file freely in your workspace. -->
+<style>:root {
+ color-scheme: dark;
+ --bg: #111414;
+ --panel: #191e1c;
+ --line: #ffffff1c;
+ --ink: #f4f2e9;
+ --muted: #a1aaa4;
+ --accent: #d0f28a;
+ font:
+ 14px/1.5 -apple-system,
+ BlinkMacSystemFont,
+ "Segoe UI",
+ sans-serif;
+}
+* {
+ box-sizing: border-box;
+}
+body {
+ margin: 0;
+ background: var(--bg);
+ color: var(--ink);
+}
+button,
+input,
+select {
+ font: inherit;
+}
+button,
+a,
+input,
+select {
+ -webkit-tap-highlight-color: transparent;
+}
+button,
+a {
+ touch-action: manipulation;
+}
+button {
+ cursor: pointer;
+}
+button:disabled {
+ opacity: 0.45;
+ cursor: wait;
+}
+button:focus-visible,
+input:focus-visible,
+select:focus-visible,
+a:focus-visible {
+ outline: 2px solid var(--accent);
+ outline-offset: 4px;
+}
+button,
+input,
+select {
+ color: inherit;
+ background: transparent;
+ border: 1px solid var(--line);
+ border-radius: 5px;
+ padding: 9px 13px;
+}
+button:hover {
+ background: #ffffff0c;
+ border-color: var(--muted);
+}
+button.primary {
+ background: var(--accent);
+ color: #142015;
+ border-color: transparent;
+ font-weight: 650;
+}
+button[aria-pressed="true"] {
+ border-color: var(--accent);
+ color: var(--accent);
+}
+input[type="range"] {
+ accent-color: var(--accent);
+ padding: 0;
+ min-width: 0;
+}
+input[type="number"] {
+ width: 80px;
+}
+select {
+ background: var(--panel);
+}
+label {
+ cursor: pointer;
+}
+a {
+ color: inherit;
+}
+h1,
+h2,
+h3,
+p {
+ margin: 0;
+}
+h1 {
+ font-size: clamp(32px, 5vw, 64px);
+ line-height: 1.02;
+ letter-spacing: -0.055em;
+ font-weight: 550;
+}
+h2 {
+ font-weight: 550;
+ letter-spacing: -0.03em;
+}
+h3 {
+ font-size: 14px;
+ font-weight: 550;
+}
+.mono,
+.eyebrow {
+ font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
+}
+.eyebrow {
+ font-size: 10px;
+ letter-spacing: 0.16em;
+ text-transform: uppercase;
+ color: var(--muted);
+}
+.muted {
+ color: var(--muted);
+}
+.small {
+ font-size: 12px;
+}
+.masthead {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 20px;
+ padding: 19px 28px;
+ border-bottom: 1px solid var(--line);
+}
+.identity {
+ display: flex;
+ gap: 12px;
+ align-items: center;
+ white-space: nowrap;
+ font-size: 12px;
+ font-weight: 600;
+ letter-spacing: 0.04em;
+}
+.mark {
+ width: 25px;
+ height: 25px;
+ display: grid;
+ place-items: center;
+ border: 1px solid currentColor;
+ font-size: 17px;
+}
+.seed-form {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+}
+.seed-form label {
+ font:
+ 10px ui-monospace,
+ monospace;
+ text-transform: uppercase;
+ letter-spacing: 0.12em;
+ color: var(--muted);
+ margin-right: 4px;
+}
+.seed-form input {
+ width: 74px;
+ padding: 6px 8px;
+ font:
+ 12px ui-monospace,
+ monospace;
+}
+.seed-form button {
+ padding: 6px 10px;
+ font-size: 12px;
+}
+.intro {
+ padding: 32px 28px;
+ display: flex;
+ align-items: flex-end;
+ justify-content: space-between;
+ gap: 20px;
+}
+.intro p {
+ max-width: 440px;
+ color: var(--muted);
+ margin-top: 14px;
+}
+.intro .eyebrow {
+ margin-bottom: 12px;
+}
+.actions {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ flex-wrap: wrap;
+}
+.workspace {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) 270px;
+ gap: 22px;
+ padding: 0 28px 28px;
+}
+.panel {
+ background: var(--panel);
+ border: 1px solid var(--line);
+ border-radius: 8px;
+ overflow: hidden;
+}
+.panel-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 16px 20px;
+ border-bottom: 1px solid var(--line);
+ gap: 10px;
+}
+.side {
+ display: flex;
+ flex-direction: column;
+ gap: 20px;
+}
+.section {
+ border-top: 1px solid var(--line);
+ padding-top: 18px;
+}
+.section h3 {
+ margin-bottom: 15px;
+}
+.field {
+ display: grid;
+ gap: 7px;
+ margin: 14px 0;
+}
+.field > span {
+ display: flex;
+ justify-content: space-between;
+ font-size: 12px;
+ color: var(--muted);
+}
+.metrics {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ gap: 1px;
+ background: var(--line);
+ border: 1px solid var(--line);
+ border-radius: 6px;
+ overflow: hidden;
+}
+.metric {
+ background: var(--bg);
+ padding: 13px 15px;
+}
+.metric strong {
+ display: block;
+ font:
+ 24px ui-monospace,
+ monospace;
+ letter-spacing: -0.06em;
+}
+.metric span {
+ font-size: 10px;
+ color: var(--muted);
+ text-transform: uppercase;
+ letter-spacing: 0.09em;
+}
+canvas {
+ display: block;
+ max-width: 100%;
+}
+.status-line {
+ display: flex;
+ justify-content: space-between;
+ gap: 20px;
+ padding: 14px 28px;
+ border-top: 1px solid var(--line);
+ font:
+ 10px ui-monospace,
+ monospace;
+ color: var(--muted);
+}
+.dot {
+ width: 6px;
+ height: 6px;
+ display: inline-block;
+ background: var(--accent);
+ border-radius: 50%;
+ margin-right: 6px;
+}
+.toast {
+ position: fixed;
+ z-index: 99;
+ left: 50%;
+ bottom: 22px;
+ transform: translateX(-50%);
+ max-width: 90vw;
+ background: var(--ink);
+ color: var(--bg);
+ padding: 11px 18px;
+ border-radius: 6px;
+ box-shadow: 0 3px 30px #0004;
+ font-size: 12px;
+}
+.toast:empty {
+ display: none;
+}
+[hidden] {
+ display: none !important;
+}
+.sr-only {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ padding: 0;
+ margin: -1px;
+ overflow: hidden;
+ clip-path: inset(50%);
+ white-space: nowrap;
+ border: 0;
+}
+@media (max-width: 800px) {
+ .workspace {
+ grid-template-columns: 1fr;
+ }
+ .side {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ }
+ .intro {
+ align-items: flex-start;
+ flex-direction: column;
+ }
+ .intro h1 {
+ font-size: 44px;
+ }
+}
+@media (max-width: 480px) {
+ .masthead {
+ padding: 13px 16px;
+ gap: 8px;
+ flex-wrap: wrap;
+ }
+ .intro {
+ padding: 26px 16px;
+ }
+ .intro h1 {
+ font-size: 38px;
+ }
+ .workspace {
+ padding: 0 16px 20px;
+ gap: 18px;
+ }
+ .side {
+ grid-template-columns: 1fr;
+ }
+ .seed-form label {
+ display: none;
+ }
+ .status-line {
+ padding: 12px 16px;
+ }
+ .status-line span:last-child {
+ display: none;
+ }
+ .metrics .metric {
+ padding: 12px 10px;
+ }
+ .panel-head {
+ padding: 12px;
+ }
+ .actions {
+ gap: 6px;
+ }
+}
+@media (prefers-reduced-motion: reduce) {
+ *,
+ *::before,
+ *::after {
+ scroll-behavior: auto !important;
+ animation: none !important;
+ transition: none !important;
+ }
+}
+
+:root {
+ --bg: #111b20;
+ --panel: #17242b;
+ --ink: #e9efe9;
+ --muted: #98abb1;
+ --line: #8ea4aa30;
+ --accent: #efc273;
+}
+.intro h1 {
+ font-weight: 450;
+}
+.mark {
+ border-radius: 50%;
+ color: var(--accent);
+}
+.workspace {
+ grid-template-columns: minmax(0, 1fr) 240px;
+ gap: 28px;
+}
+.chart-panel {
+ margin-top: 18px;
+}
+.chart-panel canvas {
+ width: 100%;
+ height: 390px;
+}
+.filter {
+ font-size: 11px;
+ padding: 4px 8px;
+}
+.key {
+ width: 7px;
+ height: 7px;
+ border-radius: 50%;
+ display: inline-block;
+ margin-right: 5px;
+}
+.control-key {
+ background: #73b3b5;
+}
+.treatment-key {
+ background: #efc273;
+}
+.probe {
+ padding: 10px 18px;
+ font-size: 10px;
+ min-height: 38px;
+ color: var(--muted);
+ border-top: 1px solid var(--line);
+}
+.inference {
+ display: grid;
+ grid-template-columns: 1.3fr 1fr;
+ gap: 20px;
+ padding: 24px 0;
+}
+.inference h2 {
+ font-size: 22px;
+ margin: 7px 0;
+}
+.inference canvas {
+ width: 100%;
+ height: 115px;
+}
+.formula {
+ padding: 15px 12px;
+ background: #0b151b;
+ font:
+ 11px/1.9 ui-monospace,
+ monospace;
+ border-left: 2px solid var(--accent);
+ color: var(--accent);
+}
+details {
+ border-top: 1px solid var(--line);
+ padding: 16px 0;
+}
+summary {
+ font-size: 12px;
+ cursor: pointer;
+}
+.table-scroll {
+ overflow: auto;
+}
+table {
+ width: 100%;
+ border-collapse: collapse;
+ font:
+ 11px ui-monospace,
+ monospace;
+ margin-top: 14px;
+ text-align: left;
+}
+td,
+th {
+ padding: 9px 10px;
+ border-bottom: 1px solid var(--line);
+}
+th {
+ color: var(--muted);
+ font-weight: 400;
+}
+@media (max-width: 800px) {
+ .workspace {
+ grid-template-columns: 1fr;
+ }
+}
+@media (max-width: 480px) {
+ .chart-panel canvas {
+ height: 300px;
+ }
+ .panel-head {
+ flex-wrap: wrap;
+ }
+ .inference {
+ grid-template-columns: 1fr;
+ gap: 3px;
+ }
+ .metric strong {
+ font-size: 21px;
+ }
+}
+</style></head><body>
+<header class="masthead"><div class="identity"><span class="mark" aria-hidden="true">∿</span>SIGNAL / LAB</div>
+<form class="seed-form" id="seed-form"><label for="seed">Seed</label><input id="seed" aria-label="Seed" maxlength="128" autocomplete="off" spellcheck="false"><button type="submit">Apply</button><button id="next-seed" type="button" title="Next seed">↗ Next</button></form></header>
+<section class="intro">
+ <div>
+ <p class="eyebrow">Experiment 024 / Synthetic materials lab</p>
+ <h1>Find the signal.</h1>
+ <p>
+ Does a catalyst improve yield? Change the experiment, inspect each
+ observation, and see what the data supports.
+ </p>
+ </div>
+ <button id="export-csv" class="primary">Export observations ↗</button>
+</section>
+<main class="workspace">
+ <div>
+ <div class="metrics">
+ <div class="metric">
+ <strong id="sample-count"></strong><span>Visible samples</span>
+ </div>
+ <div class="metric">
+ <strong id="effect-estimate"></strong><span>Observed uplift · pp</span>
+ </div>
+ <div class="metric">
+ <strong id="r-squared"></strong><span>Visible fit · R²</span>
+ </div>
+ </div>
+ <section class="panel chart-panel">
+ <div class="panel-head">
+ <span class="small">Temperature × reaction yield</span>
+ <div class="actions">
+ <button class="filter" id="control" aria-pressed="true">
+ <i class="key control-key"></i>Control</button
+ ><button class="filter" id="treatment" aria-pressed="true">
+ <i class="key treatment-key"></i>Catalyst
+ </button>
+ </div>
+ </div>
+ <canvas
+ id="chart"
+ tabindex="0"
+ role="img"
+ aria-label="Scatter plot of temperature against yield. Exact observations are available in the table below."
+ ></canvas>
+ <p id="probe" class="probe mono" role="status">
+ Hover a point to inspect an observation.
+ </p>
+ </section>
+ <section class="inference">
+ <div>
+ <p class="eyebrow">What the experiment says</p>
+ <h2 id="conclusion"></h2>
+ <p class="small muted" id="interval"></p>
+ </div>
+ <canvas
+ id="interval-chart"
+ aria-label="Confidence interval for the observed treatment difference"
+ ></canvas>
+ </section>
+ <details>
+ <summary>
+ Inspect observations <span class="muted">/ first 12 visible rows</span>
+ </summary>
+ <div class="table-scroll">
+ <table>
+ <thead>
+ <tr>
+ <th>Sample</th>
+ <th>Group</th>
+ <th>Temp · °C</th>
+ <th>Yield · %</th>
+ </tr>
+ </thead>
+ <tbody id="observations"></tbody>
+ </table>
+ </div>
+ </details>
+ </div>
+ <aside class="side">
+ <div>
+ <p class="eyebrow">Design the experiment</p>
+ <label class="field"
+ ><span>True catalyst effect <output id="effect-value"></output></span
+ ><input id="effect" type="range" min="-20" max="30" value="12" /></label
+ ><label class="field"
+ ><span>Measurement noise <output id="noise-value"></output></span
+ ><input id="noise" type="range" min="1" max="20" value="9" /></label
+ ><label class="field"
+ ><span>Sample size <output id="count-value"></output></span
+ ><input
+ id="count"
+ type="range"
+ min="48"
+ max="240"
+ step="12"
+ value="120" /></label
+ ><button id="run" style="width: 100%">Replay collection</button>
+ </div>
+ <div class="section">
+ <h3>A model you can inspect</h3>
+ <p class="formula">
+ yield = 28 + 0.48 × temperature<br />+ catalyst effect + noise
+ </p>
+ <p class="small muted" style="margin-top: 12px">
+ Balanced groups, seeded temperatures, independent Gaussian measurement
+ noise. The observed difference can depart from the true effect.
+ </p>
+ </div>
+ <div class="section small muted">
+ <strong>Synthetic data, by design.</strong>
+ <p style="margin-top: 8px">
+ The 95% interval uses a normal approximation for the unadjusted
+ difference of means. It illustrates uncertainty; it is not a real
+ experimental finding.
+ </p>
+ </div>
+ </aside>
+</main>
+<footer class="status-line">
+ <span><i class="dot"></i>REPRODUCIBLE OBSERVATIONS</span
+ ><span>SEED / PROBE / QUESTION / REPEAT</span>
+</footer>
+<div class="toast" id="toast" role="status"></div>
+<script id="harness-model">
+'use strict';
+// Shared deterministic primitives. Domain models use named streams so unrelated edits stay stable.
+function hash(value) {
+ let h = 2166136261;
+ for (const c of String(value)) h = Math.imul(h ^ c.charCodeAt(0), 16777619);
+ return h >>> 0;
+}
+function random(seed, stream = "main") {
+ let a = hash(`${seed}:${stream}`);
+ return () => {
+ a = (a + 0x6d2b79f5) | 0;
+ let t = Math.imul(a ^ (a >>> 15), 1 | a);
+ t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
+ };
+}
+const clamp = (n, lo, hi) => Math.max(lo, Math.min(hi, n));
+const lerp = (a, b, t) => a + (b - a) * t;
+const pick = (items, rng) => items[Math.floor(rng() * items.length)];
+function normal(rng) {
+ return (
+ Math.sqrt(-2 * Math.log(Math.max(1e-9, rng()))) *
+ Math.cos(2 * Math.PI * rng())
+ );
+}
+
+function experiment(seed, { count = 120, effect = 12, noise = 9 } = {}) {
+ const xRng = random(seed, "temperature"),
+ noiseRng = random(seed, "measurement");
+ return Array.from({ length: count }, (_, i) => {
+ const group = i % 2,
+ x = 15 + xRng() * 70;
+ return {
+ id: i + 1,
+ group,
+ x,
+ y: 28 + x * 0.48 + effect * group + normal(noiseRng) * noise,
+ };
+ });
+}
+function stats(values) {
+ const n = values.length,
+ mean = n ? values.reduce((a, b) => a + b, 0) / n : 0;
+ const variance =
+ n > 1 ? values.reduce((a, b) => a + (b - mean) ** 2, 0) / (n - 1) : 0;
+ return { n, mean, variance, sd: Math.sqrt(variance) };
+}
+function regression(points) {
+ const x = stats(points.map((p) => p.x)),
+ y = stats(points.map((p) => p.y));
+ const xx = points.reduce((a, p) => a + (p.x - x.mean) ** 2, 0);
+ const xy = points.reduce((a, p) => a + (p.x - x.mean) * (p.y - y.mean), 0);
+ const slope = xx ? xy / xx : 0,
+ intercept = y.mean - slope * x.mean;
+ const ss = points.reduce((a, p) => a + (p.y - y.mean) ** 2, 0);
+ const residual = points.reduce(
+ (a, p) => a + (p.y - intercept - slope * p.x) ** 2,
+ 0,
+ );
+ return { slope, intercept, r2: ss ? clamp(1 - residual / ss, 0, 1) : 1 };
+}
+function treatmentEffect(points) {
+ const a = stats(points.filter((p) => p.group === 0).map((p) => p.y));
+ const b = stats(points.filter((p) => p.group === 1).map((p) => p.y));
+ const difference = b.mean - a.mean,
+ se = Math.sqrt(
+ a.variance / Math.max(1, a.n) + b.variance / Math.max(1, b.n),
+ );
+ return {
+ a,
+ b,
+ difference,
+ low: difference - 1.96 * se,
+ high: difference + 1.96 * se,
+ };
+}
+function csvRows(points) {
+ return (
+ "sample,group,temperature_c,yield_percent\n" +
+ points
+ .map(
+ (p) =>
+ `${p.id},${p.group ? "treatment" : "control"},${p.x.toFixed(6)},${p.y.toFixed(6)}`,
+ )
+ .join("\n") +
+ "\n"
+ );
+}
+
+</script>
+<script>
+'use strict';
+const $ = (s) => document.querySelector(s);
+const $$ = (s) => [...document.querySelectorAll(s)];
+const params = new URLSearchParams(location.search);
+let seed = (params.get("seed") || "42").slice(0, 128);
+const reducedMotion = matchMedia("(prefers-reduced-motion: reduce)").matches;
+const parentMessage = (message) => {
+ if (parent !== window) parent.postMessage(message, "*");
+};
+function toast(message) {
+ $("#toast").textContent = message;
+ clearTimeout(toast.timer);
+ toast.timer = setTimeout(() => {
+ $("#toast").textContent = "";
+ }, 3500);
+}
+function saveFile(name, content, type = "application/json") {
+ const blob =
+ content instanceof Blob ? content : new Blob([content], { type });
+ const url = URL.createObjectURL(blob),
+ a = document.createElement("a");
+ a.href = url;
+ a.download = name;
+ document.body.append(a);
+ a.click();
+ a.remove();
+ setTimeout(() => URL.revokeObjectURL(url), 30000);
+}
+function canvasPNG(canvas, name) {
+ canvas.toBlob((blob) => {
+ if (blob) saveFile(name, blob);
+ else toast("Image export failed. Please try again.");
+ });
+}
+function setSeed(value) {
+ seed = String(value).trim().slice(0, 128) || "42";
+ $("#seed").value = seed;
+ const url = new URL(location.href);
+ url.searchParams.set("seed", seed);
+ try {
+ history.replaceState(null, "", url);
+ } catch {
+ /* Opaque-origin iframe: the shell owns its URL. */
+ }
+ parentMessage({ type: "harness:state", seed });
+ dispatchEvent(new CustomEvent("seedchange", { detail: seed }));
+}
+$("#seed").value = seed;
+$("#seed-form").addEventListener("submit", (e) => {
+ e.preventDefault();
+ setSeed($("#seed").value);
+});
+$("#next-seed").addEventListener("click", () =>
+ setSeed(/^\d{1,9}$/.test(seed) ? Number(seed) + 1 : hash(seed)),
+);
+function fitCanvas(canvas, draw, maxDpr = 2) {
+ const observer = new ResizeObserver(() => {
+ const box = canvas.getBoundingClientRect(),
+ dpr = Math.min(devicePixelRatio || 1, maxDpr);
+ canvas.width = Math.max(1, Math.round(box.width * dpr));
+ canvas.height = Math.max(1, Math.round(box.height * dpr));
+ draw?.();
+ });
+ observer.observe(canvas);
+ return observer;
+}
+const editable = (target) =>
+ target instanceof Element &&
+ !!target.closest("input,textarea,select,[contenteditable=true]");
+addEventListener("error", (e) =>
+ parentMessage({ type: "harness:error", message: e.message }),
+);
+addEventListener("unhandledrejection", (e) =>
+ parentMessage({
+ type: "harness:error",
+ message: String(e.reason?.message || e.reason),
+ }),
+);
+function ready() {
+ document.body.dataset.ready = "true";
+ parentMessage({ type: "harness:ready", title: document.title, seed });
+}
+
+let points = [],
+ visible = [],
+ showControl = true,
+ showTreatment = true,
+ collected = Infinity,
+ collectTimer;
+const groupColors = ["#73b3b5", "#efc273"];
+function experimentOptions() {
+ return {
+ effect: +$("#effect").value,
+ noise: +$("#noise").value,
+ count: +$("#count").value,
+ };
+}
+function drawChart() {
+ const c = $("#chart"),
+ ctx = c.getContext("2d"),
+ w = c.width,
+ h = c.height;
+ if (!w || !h) return;
+ const d = w / c.getBoundingClientRect().width,
+ m = { l: 53 * d, r: 22 * d, t: 24 * d, b: 48 * d };
+ const low = Math.floor(Math.min(0, ...points.map((p) => p.y)) / 20) * 20,
+ high = Math.ceil(Math.max(100, ...points.map((p) => p.y)) / 20) * 20;
+ const px = (x) => m.l + (x / 100) * (w - m.l - m.r),
+ py = (y) => h - m.b - ((y - low) / (high - low)) * (h - m.b - m.t);
+ ctx.clearRect(0, 0, w, h);
+ ctx.font = `${10 * d}px monospace`;
+ ctx.lineWidth = d;
+ ctx.textAlign = "right";
+ ctx.textBaseline = "middle";
+ for (let i = 0; i <= 5; i++) {
+ const y = low + ((high - low) * i) / 5;
+ ctx.strokeStyle = "#8ea4aa20";
+ ctx.beginPath();
+ ctx.moveTo(m.l, py(y));
+ ctx.lineTo(w - m.r, py(y));
+ ctx.stroke();
+ ctx.fillStyle = "#98abb1";
+ ctx.fillText(y.toFixed(0), m.l - 12 * d, py(y));
+ const x = i * 20;
+ ctx.textAlign = "center";
+ ctx.fillText(x, px(x), h - m.b + 20 * d);
+ ctx.textAlign = "right";
+ }
+ ctx.save();
+ ctx.translate(15 * d, h / 2);
+ ctx.rotate(-Math.PI / 2);
+ ctx.textAlign = "center";
+ ctx.fillText("Yield (%)", 0, 0);
+ ctx.restore();
+ ctx.textAlign = "center";
+ ctx.fillText("Temperature (°C)", w / 2, h - 10 * d);
+ for (const group of [0, 1]) {
+ const subset = visible.filter((p) => p.group === group);
+ if (subset.length < 2) continue;
+ const r = regression(subset);
+ ctx.strokeStyle = groupColors[group];
+ ctx.globalAlpha = 0.7;
+ ctx.setLineDash([5 * d, 4 * d]);
+ ctx.beginPath();
+ ctx.moveTo(px(10), py(r.intercept + r.slope * 10));
+ ctx.lineTo(px(90), py(r.intercept + r.slope * 90));
+ ctx.stroke();
+ ctx.setLineDash([]);
+ }
+ visible.forEach((p) => {
+ ctx.globalAlpha = 0.85;
+ ctx.fillStyle = groupColors[p.group];
+ ctx.beginPath();
+ ctx.arc(px(p.x), py(p.y), 3.5 * d, 0, Math.PI * 2);
+ ctx.fill();
+ });
+ ctx.globalAlpha = 1;
+ drawChart.project = (p) => ({ x: px(p.x) / d, y: py(p.y) / d });
+}
+function drawInterval() {
+ const c = $("#interval-chart"),
+ ctx = c.getContext("2d"),
+ w = c.width,
+ h = c.height;
+ const e = treatmentEffect(points.slice(0, collected)),
+ min = Math.min(-20, e.low - 3),
+ max = Math.max(30, e.high + 3),
+ px = (v) => 25 + ((v - min) / (max - min)) * (w - 50);
+ ctx.clearRect(0, 0, w, h);
+ ctx.strokeStyle = "#98abb1";
+ ctx.lineWidth = 1;
+ ctx.beginPath();
+ ctx.moveTo(25, h * 0.5);
+ ctx.lineTo(w - 25, h * 0.5);
+ ctx.stroke();
+ ctx.setLineDash([3, 4]);
+ ctx.beginPath();
+ ctx.moveTo(px(0), h * 0.15);
+ ctx.lineTo(px(0), h * 0.7);
+ ctx.stroke();
+ ctx.setLineDash([]);
+ ctx.lineWidth = 7;
+ ctx.strokeStyle = "#efc273";
+ ctx.beginPath();
+ ctx.moveTo(px(e.low), h * 0.5);
+ ctx.lineTo(px(e.high), h * 0.5);
+ ctx.stroke();
+ ctx.fillStyle = "#e9efe9";
+ ctx.beginPath();
+ ctx.arc(px(e.difference), h * 0.5, 7, 0, Math.PI * 2);
+ ctx.fill();
+ ctx.fillStyle = "#98abb1";
+ ctx.font = "18px monospace";
+ ctx.textAlign = "center";
+ ctx.fillText("0", px(0), h * 0.9);
+ ctx.fillText("95% interval", w / 2, h * 0.12);
+}
+function updateBench() {
+ const partial = points.slice(0, collected);
+ visible = partial.filter((p) => (p.group ? showTreatment : showControl));
+ const e = treatmentEffect(partial),
+ r = regression(visible);
+ $("#sample-count").textContent = visible.length;
+ $("#effect-estimate").textContent =
+ `${e.difference >= 0 ? "+" : ""}${e.difference.toFixed(1)}`;
+ $("#r-squared").textContent = visible.length > 1 ? r.r2.toFixed(2) : "—";
+ $("#conclusion").textContent =
+ e.low > 0
+ ? "A positive signal emerges."
+ : e.high < 0
+ ? "The catalyst reduces yield."
+ : "The effect is still uncertain.";
+ $("#interval").textContent =
+ `95% interval: ${e.low.toFixed(1)} to ${e.high.toFixed(1)} percentage points · both groups, ${partial.length} samples.`;
+ $("#observations").replaceChildren();
+ visible.slice(0, 12).forEach((p) => {
+ const tr = document.createElement("tr");
+ for (const text of [
+ p.id,
+ p.group ? "Catalyst" : "Control",
+ p.x.toFixed(2),
+ p.y.toFixed(2),
+ ]) {
+ const td = document.createElement("td");
+ td.textContent = text;
+ tr.append(td);
+ }
+ $("#observations").append(tr);
+ });
+ drawChart();
+ drawInterval();
+}
+function generateExperiment() {
+ clearInterval(collectTimer);
+ collected = Infinity;
+ $("#run").textContent = "Replay collection";
+ const options = experimentOptions();
+ points = experiment(seed, options);
+ $("#effect-value").value = `${options.effect} pp`;
+ $("#noise-value").value = `±${options.noise} σ`;
+ $("#count-value").value = options.count;
+ updateBench();
+}
+for (const id of ["effect", "noise", "count"])
+ $("#" + id).oninput = generateExperiment;
+$("#control").onclick = () => {
+ if (showControl && !showTreatment)
+ return toast("Keep at least one group visible.");
+ showControl = !showControl;
+ $("#control").setAttribute("aria-pressed", showControl);
+ updateBench();
+};
+$("#treatment").onclick = () => {
+ if (showTreatment && !showControl)
+ return toast("Keep at least one group visible.");
+ showTreatment = !showTreatment;
+ $("#treatment").setAttribute("aria-pressed", showTreatment);
+ updateBench();
+};
+$("#run").onclick = () => {
+ if (Number.isFinite(collected)) {
+ collected = Infinity;
+ clearInterval(collectTimer);
+ $("#run").textContent = "Replay collection";
+ updateBench();
+ return;
+ }
+ collected = 4;
+ $("#run").textContent = "Finish collection";
+ updateBench();
+ collectTimer = setInterval(() => {
+ collected += 4;
+ if (collected >= points.length) {
+ collected = Infinity;
+ clearInterval(collectTimer);
+ $("#run").textContent = "Replay collection";
+ }
+ updateBench();
+ }, 90);
+};
+$("#chart").onpointermove = (e) => {
+ const box = e.currentTarget.getBoundingClientRect(),
+ x = e.clientX - box.left,
+ y = e.clientY - box.top;
+ let best,
+ dist = Infinity;
+ for (const p of visible) {
+ const pos = drawChart.project(p),
+ d = Math.hypot(pos.x - x, pos.y - y);
+ if (d < dist) {
+ best = p;
+ dist = d;
+ }
+ }
+ $("#probe").textContent =
+ best && dist < 25
+ ? `Sample ${best.id} · ${best.group ? "Catalyst" : "Control"} · ${best.x.toFixed(2)} °C · ${best.y.toFixed(2)}% yield`
+ : "Hover a point to inspect an observation.";
+};
+$("#export-csv").onclick = () =>
+ saveFile(`signal-${hash(seed)}.csv`, csvRows(visible), "text/csv");
+fitCanvas($("#chart"), drawChart);
+fitCanvas($("#interval-chart"), drawInterval);
+addEventListener("seedchange", generateExperiment);
+generateExperiment();
+ready();
+
+</script></body></html>
diff --git a/store/agents/lab-bench/template/tools/check.mjs b/store/agents/lab-bench/template/tools/check.mjs
new file mode 100644
index 000000000..6bc6e9651
--- /dev/null
+++ b/store/agents/lab-bench/template/tools/check.mjs
@@ -0,0 +1,75 @@
+const CONFIG = {"id":"lab-bench","artifact":"bench/index.html"};
+// Compiled into each workspace's tools/check.mjs. Tests the model in the ACTUAL edited HTML.
+import { readFile, mkdir, writeFile } from "node:fs/promises";
+import { createHash } from "node:crypto";
+import vm from "node:vm";
+import { resolve, dirname } from "node:path";
+
+const args = process.argv.slice(2),
+ i = args.indexOf("--seeds");
+const count = i === -1 ? 32 : Number(args[i + 1]);
+if (!Number.isInteger(count) || count < 1 || count > 1000)
+ throw new Error("--seeds must be an integer from 1 to 1000");
+const artifact = resolve(CONFIG.artifact);
+const html = await readFile(artifact, "utf8");
+const script = html.match(
+ /<script id="harness-model">([\s\S]*?)<\/script>/,
+)?.[1];
+if (!script)
+ throw new Error(
+ 'Keep the pure model in <script id="harness-model"> so this checker can exercise the actual artifact.',
+ );
+const expressions = {
+ "generative-art": `const m=artModel(SEED);const p=artPaths(m);({state:m,valid:p.length>0&&p.flat().every(([x,y])=>Number.isFinite(x)&&Number.isFinite(y)),metrics:{paths:p.length,palette:m.palette}})`,
+ "creative-direction": `const m=directionModel(SEED);const ratio=contrast(m.colors[0],m.colors[1]);({state:m,valid:ratio>=4.5,metrics:{direction:m.name,contrast:ratio}})`,
+ "lab-bench": `const p=experiment(SEED),e=treatmentEffect(p);({state:p,valid:p.length>1&&p.every(p=>Number.isFinite(p.x)&&Number.isFinite(p.y))&&Number.isFinite(e.low)&&e.low<=e.high,metrics:{samples:p.length,effect:e.difference,interval:[e.low,e.high]}})`,
+ "music-studio": `const s=musicScore(SEED),r=renderMusic(s);({state:Array.from(r.samples),valid:r.peak>.001&&r.peak<=.95&&r.samples.every(Number.isFinite),metrics:{seconds:r.duration,peak:r.peak,rms:r.rms}})`,
+ "game-master": `const m=arenaMatch(SEED),s=m.history.at(-1);({state:m,valid:m.history.length>1&&m.history.length<=10000&&s.units.every(u=>u.hp>=0&&u.x>=0&&u.x<m.map.w&&u.y>=0&&u.y<m.map.h),metrics:{turns:s.turn,score:s.score,winner:m.winner}})`,
+ "drone-pilot": `const s=flyAutopilot(SEED);({state:s,valid:s.finished&&!s.crashed&&s.passed===flightCourse(SEED).length,metrics:{seconds:s.time,passed:s.passed,missed:s.missed}})`,
+ "voxel-worlds": `const w=voxelWorld(SEED);let p={...w.spawn,vy:0,grounded:true};const clear=playerFits(w,p.x,p.y,p.z);for(let t=0;t<120;t++)p=movePlayer(w,p,{forward:1});({state:Array.from(w.blocks),valid:clear&&playerFits(w,p.x,p.y,p.z),metrics:{blocks:w.blocks.filter(Boolean).length,walkDistance:Math.hypot(p.x-w.spawn.x,p.z-w.spawn.z)}})`,
+};
+const expression = expressions[CONFIG.id];
+const digest = (value) =>
+ createHash("sha256").update(JSON.stringify(value)).digest("hex");
+const results = [];
+for (let seed = 0; seed < count; seed++) {
+ const run = () =>
+ vm.runInNewContext(
+ `${script}\n${expression}`,
+ { SEED: String(seed) },
+ { timeout: 10000 },
+ );
+ try {
+ const first = run(),
+ second = run(),
+ signature = digest(first.state),
+ repeat = digest(second.state);
+ results.push({
+ seed,
+ ok: first.valid && signature === repeat,
+ signature,
+ metrics: first.metrics,
+ });
+ } catch (error) {
+ results.push({ seed, ok: false, error: error.message });
+ }
+}
+const passed = results.filter((r) => r.ok).length;
+const report = {
+ spec: 1,
+ harness: CONFIG.id,
+ artifact: CONFIG.artifact,
+ checkedAt: new Date().toISOString(),
+ modelChecks: { passed, total: count },
+ scope:
+ "Pure model invariants and same-process repeatability. Browser interaction, layout, listening and export review still required.",
+ results,
+};
+const out = resolve(".harness/model-check.json");
+await mkdir(dirname(out), { recursive: true });
+await writeFile(out, JSON.stringify(report, null, 2) + "\n");
+console.log(
+ `${CONFIG.id}: ${passed}/${count} model checks passed. Report: ${out}`,
+);
+console.log(report.scope);
+if (passed !== count) process.exitCode = 1;
diff --git a/store/agents/lab-bench/test/toolchain.test.mjs b/store/agents/lab-bench/test/toolchain.test.mjs
new file mode 100644
index 000000000..a50db30db
--- /dev/null
+++ b/store/agents/lab-bench/test/toolchain.test.mjs
@@ -0,0 +1,66 @@
+// The Lab Bench harness scripts, run the way Harness runs them.
+// node --test test/*.test.mjs
+import assert from 'node:assert/strict'
+import { spawnSync } from 'node:child_process'
+import { accessSync, constants, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { after, test } from 'node:test'
+
+const here = fileURLToPath(new URL('..', import.meta.url))
+const manifest = JSON.parse(readFileSync(join(here, 'harness.json'), 'utf8'))
+const scratch = []
+after(() => { for (const dir of scratch) rmSync(dir, { recursive: true, force: true }) })
+
+function tempDir() { const d = mkdtempSync(join(tmpdir(), 'bench-')); scratch.push(d); return d }
+function run(script, { cwd = here, env = {} } = {}) {
+ const merged = { ...process.env }
+ for (const [k, v] of Object.entries(env)) v === null ? delete merged[k] : (merged[k] = v)
+ const r = spawnSync(join(here, script), { cwd, env: merged, encoding: 'utf8' })
+ return { code: r.status, stdout: r.stdout, stderr: r.stderr }
+}
+const seedScript = join(here, 'skills/bench/scripts/seed-verdict.sh')
+
+test('every script the manifest names is in the folder and executable', () => {
+ for (const s of [manifest.workspace.init, manifest.toolchain.setup, manifest.toolchain.doctor]) {
+ assert.doesNotThrow(() => accessSync(join(here, s), constants.X_OK), s)
+ }
+})
+
+test('setup installs nothing and succeeds quietly', () => {
+ assert.deepEqual(run(manifest.toolchain.setup), { code: 0, stdout: '', stderr: '' })
+})
+
+test('doctor says ok when sh is on PATH', () => {
+ assert.equal(run(manifest.toolchain.doctor).code, 0)
+})
+
+test('init lays out a workspace and seeds a not-ready verdict', () => {
+ const ws = tempDir()
+ assert.equal(run(manifest.workspace.init, { cwd: ws, env: { HARNESS_DSH: manifest.id } }).code, 0)
+ assert.equal(JSON.parse(readFileSync(join(ws, '.harness/verdict.json'), 'utf8')).ready, false)
+ assert.equal(readFileSync(join(ws, '.harness-initialized'), 'utf8'), `initialized by ${manifest.id}\n`)
+})
+
+test('the manifest names a viewer package and an HTML artifact', () => {
+ assert.equal(manifest.viewer.use, 'autonomous/web-viewer')
+ assert.deepEqual(manifest.viewer.artifactExtensions, ['.html'])
+})
+
+test('seed-verdict reflects whether a bench exists', () => {
+ const ws = tempDir()
+ run(manifest.workspace.init, { cwd: ws })
+ assert.equal(spawnSync(seedScript, [ws], { cwd: ws, encoding: 'utf8' }).status, 0)
+ assert.equal(JSON.parse(readFileSync(join(ws, '.harness/verdict.json'), 'utf8')).ready, false)
+ mkdirSync(join(ws, 'bench'), { recursive: true })
+ writeFileSync(join(ws, 'bench/index.html'), '<!doctype html>')
+ assert.equal(spawnSync(seedScript, [ws], { cwd: ws, encoding: 'utf8' }).status, 0)
+ assert.equal(JSON.parse(readFileSync(join(ws, '.harness/verdict.json'), 'utf8')).ready, false)
+})
+
+
+test('the manifest routes the actual nested artifact through the shared viewer', () => {
+ assert.equal(manifest.viewer.url, 'http://127.0.0.1:${port}/?file=${artifact}')
+ assert.ok(manifest.workspace.marker.endsWith('/index.html'))
+})
diff --git a/store/agents/lab-bench/toolchain/doctor.sh b/store/agents/lab-bench/toolchain/doctor.sh
new file mode 100755
index 000000000..2c36f430b
--- /dev/null
+++ b/store/agents/lab-bench/toolchain/doctor.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+# Doctor: the bench is just a file served by the shared web-viewer; no extra runtime needed.
+exit 0
diff --git a/store/agents/lab-bench/toolchain/init-workspace.sh b/store/agents/lab-bench/toolchain/init-workspace.sh
new file mode 100755
index 000000000..8d280347f
--- /dev/null
+++ b/store/agents/lab-bench/toolchain/init-workspace.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Harness copies the template before this runs. Preserve the user's design log on repeat calls.
+set -eu
+ws="${1:-$PWD}"
+mkdir -p "$ws/bench" "$ws/.harness"
+if [ ! -f "$ws/bench/DESIGN.md" ]; then
+ printf '# Design log — Lab Bench\n\nRecord date, USER or AI, decision, rationale, and whether it remains in the build.\n' > "$ws/bench/DESIGN.md"
+fi
+cat > "$ws/.harness/verdict.json" <<JSON
+{"spec":1,"ready":false,"summary":"Signal starter available — describe what you want to create","artifact":"bench/index.html","findings":[{"severity":"info","kind":"review_pending","message":"Starter provided; personalized changes need browser verification."}],"phases":[{"id":"build","name":"Build","state":"active"},{"id":"verify","name":"Verify","state":"pending"}],"updatedAt":"$(date -u +%Y-%m-%dT%H:%M:%SZ)"}
+JSON
+printf 'initialized by %s\n' "${HARNESS_DSH:-autonomous/lab-bench}" > "$ws/.harness-initialized"
diff --git a/store/agents/lab-bench/toolchain/setup.sh b/store/agents/lab-bench/toolchain/setup.sh
new file mode 100755
index 000000000..663e77343
--- /dev/null
+++ b/store/agents/lab-bench/toolchain/setup.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+# Lab Bench has no toolchain: everything is inline HTML + canvas charting. Nothing to install.
+exit 0
diff --git a/store/agents/music-studio/AGENTS.md b/store/agents/music-studio/AGENTS.md
new file mode 100644
index 000000000..46ca363f5
--- /dev/null
+++ b/store/agents/music-studio/AGENTS.md
@@ -0,0 +1,67 @@
+# Music Studio harness
+
+You turn a plain-English description into a **deterministic, seedable piece of
+music** rendered in one self-contained `piece/index.html`. The pane plays it
+live, so the person hears the piece — and a re-seed — as you work.
+
+## What a good piece is
+
+- **One file, offline.** All synthesis inline via the Web Audio API (oscillators,
+ envelopes, buffers, a simple scheduler loop). No CDN at runtime. A `?seed=`
+ query param selects the version: the same seed always plays the same track on
+ this machine.
+- **Determinism is the product.** Seed a PRNG and name sub-streams (per chord,
+ per rhythm, per melody) so tuning one doesn't reshuffle the rest. Same seed →
+ same score, same sound, same length.
+- **Playable, not just loud.** Keep peak levels sane (no clipping), give the
+ piece a beginning/middle/end, and expose a visible waveform or step grid so the
+ pane is fun to watch while it plays.
+- **Be honest about verification.** Same-machine playback is checkable.
+ Cross-machine audio is *not* bit-identical (implementations differ) — say so in
+ the verdict rather than overclaiming.
+
+## How to work so the pane moves
+
+1. **Save within a minute.** Materialize `piece/index.html` that plays a trivial
+ seeded loop (a few notes + a kick), so the header has a state and the pane can
+ play it.
+2. **Build the system, then the piece.** Get the seeded score scheduler + sound
+ right first; only then tune mood, arrangement, and mix.
+3. **Verify like a listener:** play a few seeds in the pane, look at the waveform,
+ check it isn't clipping, re-play the same seed and confirm it is identical.
+4. **Update `.harness/verdict.json`** at every check — `ready`, one-line `summary`,
+ `phases`, `findings`, and a reproducibility note.
+
+## Rules
+
+- A piece is only "ready" when every seed in the range you promise plays clean:
+ no silence, no clipping, no stuck-forever track. Sample a grid of seeds.
+- Tag every crafted decision USER vs AI in `piece/DESIGN.md`
+ (`YYYY-MM-DD | USER|AI | topic | decision | still in build?`).
+- The `summary` says plainly what is reproducible now and what is not.
+
+## Shipped experience and operating standard
+
+The workspace starts with **Afterhours**, a working experience, not an empty placeholder.
+Five editable tracks, finite arrangement, tempo/swing, per-track mute and level, waveform transport, reproducible PCM, WAV export.
+
+- Read the existing artifact before replacing it. The useful model boundaries are musicScore, scoreEvents, renderMusic, wavFile.
+- Preserve working interactions and exports when extending the artifact. Match the user's brief;
+ the starter's genre and visual style are examples, not a ceiling.
+- Expose meaningful domain controls and outputs. Every control must change real state; every
+ displayed metric must be computed from that state. Never invent model activity or test results.
+- Use named random streams and a fixed simulation/score clock. Sample seeds, repeat the same
+ seed, inspect exported data, and verify keyboard/touch controls in the actual viewer.
+- This HTML runs with same-origin APIs in the shared viewer. Sibling fetches, localStorage,
+ downloads and pointer lock are available. Keep files portable and support direct opening.
+- Do not equate an existing HTML file, a successful reload, or a source-string test with a usable
+ result. `seed-verdict.sh` deliberately keeps `ready:false`; write `ready:true` only after your
+ checks establish it. Record exact commands, sampled seeds, observations and limitations.
+- Never claim a test coverage percentage for browser code based on Node subprocess tests.
+
+## Check your actual edited model
+
+Run `node tools/check.mjs --seeds 100` in the workspace. It reads the pure model from
+`<script id="harness-model">` in the artifact, checks domain invariants, repeats each seed, and
+writes `.harness/model-check.json`. Preserve that script boundary when editing. Model checks are
+followed by browser interaction, exported-output inspection, and visual or listening review.
diff --git a/store/agents/music-studio/README.md b/store/agents/music-studio/README.md
new file mode 100644
index 000000000..22596886c
--- /dev/null
+++ b/store/agents/music-studio/README.md
@@ -0,0 +1,42 @@
+# Music Studio — Afterhours
+
+Compose a seeded eight-bar track, edit five instrument patterns, shape swing and the mix, listen locally, and export the result as a WAV file.
+
+## Try it
+
+> Build a warm, unhurried eight-bar piece with a syncopated bass line and a sparse melody. Give it a distinct opening and ending.
+
+The starter already works before the first prompt. Change it with the agent, interact with the
+result in the pane, and keep the output. Everything needed at runtime is in `piece/index.html`.
+It works offline and can be opened outside Harness.
+
+## What you can do
+
+Five editable tracks, finite arrangement, tempo/swing, per-track mute and level, waveform transport, reproducible PCM, WAV export.
+
+## Build on the starter
+
+The model functions `musicScore`, `scoreEvents`, `renderMusic` and `wavFile` are the starting points for substantive changes. Preserve seed
+reproducibility and user controls while changing the domain behavior. A different brief can replace
+this starter's entire visual language. Keep the artifact self-contained and test the actual result.
+
+The source checkout builds these starters with `node store/tools/build-experiences.mjs`. Installed
+workspaces are editable HTML; no build tool, network dependency or paid service is required.
+
+## Verification
+
+Model census: `node --test store/tools/experience-tests/models.test.mjs` from the source checkout.
+Browser interactions, exports, same-origin APIs and manifest routing: see
+[`store/tools/experience-tests`](../../tools/experience-tests/README.md).
+
+`seed-verdict.sh` establishes only artifact presence and keeps `ready:false`. The agent must run
+and record real domain and browser checks before writing a ready verdict. No cross-device pixel or
+audio equality is promised. The research is inspiration; this is original code, not a wrapper of
+any cited third-party engine.
+
+## Check your actual edited model
+
+Run `node tools/check.mjs --seeds 100` in the workspace. It reads the pure model from
+`<script id="harness-model">` in the artifact, checks domain invariants, repeats each seed, and
+writes `.harness/model-check.json`. Preserve that script boundary when editing. Model checks are
+followed by browser interaction, exported-output inspection, and visual or listening review.
diff --git a/store/agents/music-studio/harness.json b/store/agents/music-studio/harness.json
new file mode 100644
index 000000000..878d1651c
--- /dev/null
+++ b/store/agents/music-studio/harness.json
@@ -0,0 +1,32 @@
+{
+ "spec": 1,
+ "id": "autonomous/music-studio",
+ "name": "Music Studio",
+ "category": "Audio",
+ "author": "Autonomous",
+ "description": "Compose a seeded eight-bar track, edit five instrument patterns, shape swing and the mix, listen locally, and export the result as a WAV file.",
+ "engine": "claude",
+ "workspace": {
+ "template": "template",
+ "marker": "piece/index.html",
+ "init": "toolchain/init-workspace.sh"
+ },
+ "agent": {
+ "instructions": "AGENTS.md",
+ "skills": [
+ "skills"
+ ]
+ },
+ "toolchain": {
+ "setup": "toolchain/setup.sh",
+ "doctor": "toolchain/doctor.sh"
+ },
+ "viewer": {
+ "use": "autonomous/web-viewer",
+ "artifactExtensions": [
+ ".html"
+ ],
+ "url": "http://127.0.0.1:${port}/?file=${artifact}"
+ },
+ "verdict": ".harness/verdict.json"
+}
diff --git a/store/agents/music-studio/skills/studio/SKILL.md b/store/agents/music-studio/skills/studio/SKILL.md
new file mode 100644
index 000000000..a588cc90c
--- /dev/null
+++ b/store/agents/music-studio/skills/studio/SKILL.md
@@ -0,0 +1,75 @@
+---
+name: studio
+description: Build a deterministic, seedable piece of music in one HTML file from a plain-English description. Use whenever the user asks for a track, a beat, a generative song, a seedable sound series, or prompt-to-music.
+---
+
+# studio
+
+Take the user's description and produce a **single self-contained `piece/index.html`**
+that plays a **deterministic, seedable** track, loading the seed from a `?seed=`
+query param so the web-viewer can preview the current seed and re-seed live.
+
+## The floor (in order)
+
+1. **Seeded PRNG.** A small seeded PRNG derived from the hash of the seed string.
+ Nothing may call a non-seeded random — the piece must be reproducible.
+2. **Score + synthesis.** A seeded score (chord progression, rhythm grid, melody)
+ driving Web Audio synthesis (oscillators + envelopes, a clock-based scheduler).
+3. **`?seed=` plumbing.** Reading the param, plus a tiny UI (input + "re-seed"
+ button, play/stop) so the person can browse seeds in the pane.
+4. **Named sub-streams.** One PRNG sub-stream per concern (harmony, rhythm, melody)
+ so tuning one doesn't reshuffle the other.
+
+## The gold checklist
+
+- **Trait tables that survive an edition**: seed → traits (key, tempo, arrangement),
+ and a census that shows no silent/clipping/degenerate seed in the range you claim.
+- **Level discipline**: a ceiling (soft clipper or gain architecture) so nothing
+ blows out; a visible meter or waveform.
+- **Style range**: generative techno, lo-fi chords, arpeggiated ambient, drum-grid
+ patterns — matched to the brief, not all at once.
+- **Export route**: `?seed=X&size=…` style render is audio, so offer a "render
+ once, loop forever" mode and a visible step grid.
+
+## Verify like a listener, not a compiler
+
+Play a grid of seeds — actually play them — and listen.
+Two hard checks before "ready":
+- **Re-play same-seed** — it must be identical on this machine.
+- **Census the seed range you promise** (e.g. 0–99); reject any silent, clipped,
+ or stuck-forever frame.
+
+Be explicit in the verdict about the reproducibility guarantee: same-machine yes;
+cross-machine audio you cannot prove bit-identical — say so.
+
+## Verdict feed
+
+Write `.harness/verdict.json` at every change:
+
+```json
+{ "spec": 1, "ready": false, "summary": "seeded lo-fi loop · re-seed live · census 0–99 clean",
+ "findings": [{ "severity": "info", "kind": "reproducibility", "message": "same-machine verification pending; cross-machine audio not provable bit-identical" }],
+ "artifact": "piece/index.html",
+ "phases": [{ "id": "seed", "name": "Seeded core", "state": "done" },
+ { "id": "piece", "name": "The piece", "state": "active" },
+ { "id": "edition", "name": "Edition", "state": "pending" }],
+ "updatedAt": "2026-09-18T00:00:00Z" }
+```
+
+## Starting from Afterhours
+
+The template is functional: Five editable tracks, finite arrangement, tempo/swing, per-track mute and level, waveform transport, reproducible PCM, WAV export.
+
+Keep its useful controls and exports when making a user's creation. Test the behavioral core
+(musicScore, scoreEvents, renderMusic, wavFile) as well as the visible result. A self-contained HTML file can still have well-separated
+model, rendering, input and export functions. Do not turn a finished starter into a waiting screen.
+
+Presence-only helpers do not prove correctness or reproducibility. Record actual evidence before
+marking the result ready. Export and reopen the result as part of the handoff to the user.
+
+## Check your actual edited model
+
+Run `node tools/check.mjs --seeds 100` in the workspace. It reads the pure model from
+`<script id="harness-model">` in the artifact, checks domain invariants, repeats each seed, and
+writes `.harness/model-check.json`. Preserve that script boundary when editing. Model checks are
+followed by browser interaction, exported-output inspection, and visual or listening review.
diff --git a/store/agents/music-studio/skills/studio/scripts/seed-verdict.sh b/store/agents/music-studio/skills/studio/scripts/seed-verdict.sh
new file mode 100755
index 000000000..c7c8a3640
--- /dev/null
+++ b/store/agents/music-studio/skills/studio/scripts/seed-verdict.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# Presence is not evidence of correctness. Only the agent's actual checks may establish ready:true.
+set -eu
+ws="${1:?usage: seed-verdict.sh WORKSPACE}"
+mkdir -p "$ws/.harness"
+summary="No artifact yet"; phase=pending
+if [ -s "$ws/piece/index.html" ]; then summary="Artifact available — browser verification pending"; phase=active; fi
+cat > "$ws/.harness/verdict.json" <<JSON
+{"spec":1,"ready":false,"summary":"$summary","artifact":"piece/index.html","findings":[{"severity":"info","kind":"verification_pending","message":"File presence checked; behavior, output quality and reproducibility have not been verified by this helper."}],"phases":[{"id":"build","name":"Build","state":"$phase"},{"id":"verify","name":"Verify","state":"pending"}],"updatedAt":"$(date -u +%Y-%m-%dT%H:%M:%SZ)"}
+JSON
diff --git a/store/agents/music-studio/store.json b/store/agents/music-studio/store.json
new file mode 100644
index 000000000..c082d5813
--- /dev/null
+++ b/store/agents/music-studio/store.json
@@ -0,0 +1,15 @@
+{
+ "homepage": "https://github.com/autonomous-ai/openharness/tree/main/store/agents/music-studio",
+ "license": "MIT",
+ "tagline": "Compose a seeded eight-bar track, edit five instrument patterns, shape swing and",
+ "screenshots": [
+ "https://raw.githubusercontent.com/autonomous-ai/openharness/main/store/showcase/music-studio/starter.jpg"
+ ],
+ "examples": [
+ {
+ "prompt": "Build a warm, unhurried eight-bar piece with a syncopated bass line and a sparse melody. Give it a distinct opening and ending.",
+ "caption": "Afterhours · interactive offline starter",
+ "image": "https://raw.githubusercontent.com/autonomous-ai/openharness/main/store/showcase/music-studio/starter.jpg"
+ }
+ ]
+}
diff --git a/store/agents/music-studio/template/piece/index.html b/store/agents/music-studio/template/piece/index.html
new file mode 100644
index 000000000..2b3626ebc
--- /dev/null
+++ b/store/agents/music-studio/template/piece/index.html
@@ -0,0 +1,1180 @@
+<!doctype html>
+<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
+<meta name="color-scheme" content="dark light"><title>AFTERHOURS — Music Studio</title>
+<!-- Built by store/tools/build-experiences.mjs. Edit this file freely in your workspace. -->
+<style>:root {
+ color-scheme: dark;
+ --bg: #111414;
+ --panel: #191e1c;
+ --line: #ffffff1c;
+ --ink: #f4f2e9;
+ --muted: #a1aaa4;
+ --accent: #d0f28a;
+ font:
+ 14px/1.5 -apple-system,
+ BlinkMacSystemFont,
+ "Segoe UI",
+ sans-serif;
+}
+* {
+ box-sizing: border-box;
+}
+body {
+ margin: 0;
+ background: var(--bg);
+ color: var(--ink);
+}
+button,
+input,
+select {
+ font: inherit;
+}
+button,
+a,
+input,
+select {
+ -webkit-tap-highlight-color: transparent;
+}
+button,
+a {
+ touch-action: manipulation;
+}
+button {
+ cursor: pointer;
+}
+button:disabled {
+ opacity: 0.45;
+ cursor: wait;
+}
+button:focus-visible,
+input:focus-visible,
+select:focus-visible,
+a:focus-visible {
+ outline: 2px solid var(--accent);
+ outline-offset: 4px;
+}
+button,
+input,
+select {
+ color: inherit;
+ background: transparent;
+ border: 1px solid var(--line);
+ border-radius: 5px;
+ padding: 9px 13px;
+}
+button:hover {
+ background: #ffffff0c;
+ border-color: var(--muted);
+}
+button.primary {
+ background: var(--accent);
+ color: #142015;
+ border-color: transparent;
+ font-weight: 650;
+}
+button[aria-pressed="true"] {
+ border-color: var(--accent);
+ color: var(--accent);
+}
+input[type="range"] {
+ accent-color: var(--accent);
+ padding: 0;
+ min-width: 0;
+}
+input[type="number"] {
+ width: 80px;
+}
+select {
+ background: var(--panel);
+}
+label {
+ cursor: pointer;
+}
+a {
+ color: inherit;
+}
+h1,
+h2,
+h3,
+p {
+ margin: 0;
+}
+h1 {
+ font-size: clamp(32px, 5vw, 64px);
+ line-height: 1.02;
+ letter-spacing: -0.055em;
+ font-weight: 550;
+}
+h2 {
+ font-weight: 550;
+ letter-spacing: -0.03em;
+}
+h3 {
+ font-size: 14px;
+ font-weight: 550;
+}
+.mono,
+.eyebrow {
+ font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
+}
+.eyebrow {
+ font-size: 10px;
+ letter-spacing: 0.16em;
+ text-transform: uppercase;
+ color: var(--muted);
+}
+.muted {
+ color: var(--muted);
+}
+.small {
+ font-size: 12px;
+}
+.masthead {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 20px;
+ padding: 19px 28px;
+ border-bottom: 1px solid var(--line);
+}
+.identity {
+ display: flex;
+ gap: 12px;
+ align-items: center;
+ white-space: nowrap;
+ font-size: 12px;
+ font-weight: 600;
+ letter-spacing: 0.04em;
+}
+.mark {
+ width: 25px;
+ height: 25px;
+ display: grid;
+ place-items: center;
+ border: 1px solid currentColor;
+ font-size: 17px;
+}
+.seed-form {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+}
+.seed-form label {
+ font:
+ 10px ui-monospace,
+ monospace;
+ text-transform: uppercase;
+ letter-spacing: 0.12em;
+ color: var(--muted);
+ margin-right: 4px;
+}
+.seed-form input {
+ width: 74px;
+ padding: 6px 8px;
+ font:
+ 12px ui-monospace,
+ monospace;
+}
+.seed-form button {
+ padding: 6px 10px;
+ font-size: 12px;
+}
+.intro {
+ padding: 32px 28px;
+ display: flex;
+ align-items: flex-end;
+ justify-content: space-between;
+ gap: 20px;
+}
+.intro p {
+ max-width: 440px;
+ color: var(--muted);
+ margin-top: 14px;
+}
+.intro .eyebrow {
+ margin-bottom: 12px;
+}
+.actions {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ flex-wrap: wrap;
+}
+.workspace {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) 270px;
+ gap: 22px;
+ padding: 0 28px 28px;
+}
+.panel {
+ background: var(--panel);
+ border: 1px solid var(--line);
+ border-radius: 8px;
+ overflow: hidden;
+}
+.panel-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 16px 20px;
+ border-bottom: 1px solid var(--line);
+ gap: 10px;
+}
+.side {
+ display: flex;
+ flex-direction: column;
+ gap: 20px;
+}
+.section {
+ border-top: 1px solid var(--line);
+ padding-top: 18px;
+}
+.section h3 {
+ margin-bottom: 15px;
+}
+.field {
+ display: grid;
+ gap: 7px;
+ margin: 14px 0;
+}
+.field > span {
+ display: flex;
+ justify-content: space-between;
+ font-size: 12px;
+ color: var(--muted);
+}
+.metrics {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ gap: 1px;
+ background: var(--line);
+ border: 1px solid var(--line);
+ border-radius: 6px;
+ overflow: hidden;
+}
+.metric {
+ background: var(--bg);
+ padding: 13px 15px;
+}
+.metric strong {
+ display: block;
+ font:
+ 24px ui-monospace,
+ monospace;
+ letter-spacing: -0.06em;
+}
+.metric span {
+ font-size: 10px;
+ color: var(--muted);
+ text-transform: uppercase;
+ letter-spacing: 0.09em;
+}
+canvas {
+ display: block;
+ max-width: 100%;
+}
+.status-line {
+ display: flex;
+ justify-content: space-between;
+ gap: 20px;
+ padding: 14px 28px;
+ border-top: 1px solid var(--line);
+ font:
+ 10px ui-monospace,
+ monospace;
+ color: var(--muted);
+}
+.dot {
+ width: 6px;
+ height: 6px;
+ display: inline-block;
+ background: var(--accent);
+ border-radius: 50%;
+ margin-right: 6px;
+}
+.toast {
+ position: fixed;
+ z-index: 99;
+ left: 50%;
+ bottom: 22px;
+ transform: translateX(-50%);
+ max-width: 90vw;
+ background: var(--ink);
+ color: var(--bg);
+ padding: 11px 18px;
+ border-radius: 6px;
+ box-shadow: 0 3px 30px #0004;
+ font-size: 12px;
+}
+.toast:empty {
+ display: none;
+}
+[hidden] {
+ display: none !important;
+}
+.sr-only {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ padding: 0;
+ margin: -1px;
+ overflow: hidden;
+ clip-path: inset(50%);
+ white-space: nowrap;
+ border: 0;
+}
+@media (max-width: 800px) {
+ .workspace {
+ grid-template-columns: 1fr;
+ }
+ .side {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ }
+ .intro {
+ align-items: flex-start;
+ flex-direction: column;
+ }
+ .intro h1 {
+ font-size: 44px;
+ }
+}
+@media (max-width: 480px) {
+ .masthead {
+ padding: 13px 16px;
+ gap: 8px;
+ flex-wrap: wrap;
+ }
+ .intro {
+ padding: 26px 16px;
+ }
+ .intro h1 {
+ font-size: 38px;
+ }
+ .workspace {
+ padding: 0 16px 20px;
+ gap: 18px;
+ }
+ .side {
+ grid-template-columns: 1fr;
+ }
+ .seed-form label {
+ display: none;
+ }
+ .status-line {
+ padding: 12px 16px;
+ }
+ .status-line span:last-child {
+ display: none;
+ }
+ .metrics .metric {
+ padding: 12px 10px;
+ }
+ .panel-head {
+ padding: 12px;
+ }
+ .actions {
+ gap: 6px;
+ }
+}
+@media (prefers-reduced-motion: reduce) {
+ *,
+ *::before,
+ *::after {
+ scroll-behavior: auto !important;
+ animation: none !important;
+ transition: none !important;
+ }
+}
+
+:root {
+ --bg: #201c1b;
+ --panel: #2b2522;
+ --ink: #f0e6d7;
+ --muted: #b5a496;
+ --line: #af958332;
+ --accent: #eda776;
+}
+.intro {
+ padding-top: 34px;
+ padding-bottom: 30px;
+}
+.intro h1 {
+ font-size: clamp(48px, 7vw, 80px);
+}
+.intro h1 em {
+ font-family: Georgia, serif;
+ font-weight: 400;
+}
+.record {
+ width: 166px;
+ height: 166px;
+ border-radius: 50%;
+ background: repeating-radial-gradient(
+ circle,
+ #211f1f 0,
+ #211f1f 2px,
+ #393431 3px,
+ #161515 4px
+ );
+ display: grid;
+ place-items: center;
+ margin-right: 10px;
+ transform: rotate(-13deg);
+ box-shadow: 5px 8px 20px #0005;
+}
+.record-label {
+ width: 65px;
+ height: 65px;
+ border-radius: 50%;
+ background: #c88860;
+ color: #241c18;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ font-size: 10px;
+ font-weight: 800;
+ line-height: 1.1;
+}
+.record-label span {
+ font: 7px monospace;
+ margin-top: 5px;
+}
+.transport {
+ display: flex;
+ gap: 8px;
+ align-items: center;
+ flex-wrap: wrap;
+ padding-bottom: 18px;
+}
+.transport .mono {
+ font-size: 11px;
+ margin: 0 4px;
+}
+#export-wav {
+ margin-left: auto;
+ font-size: 12px;
+}
+.wave-panel {
+ background: #181615;
+ border: 1px solid var(--line);
+ padding: 16px 16px 10px;
+ border-radius: 6px;
+}
+.wave-panel canvas {
+ width: 100%;
+ height: 126px;
+}
+.sections {
+ display: flex;
+ justify-content: space-between;
+ font:
+ 8px ui-monospace,
+ monospace;
+ letter-spacing: 0.07em;
+ color: var(--muted);
+ border-top: 1px solid var(--line);
+ padding-top: 10px;
+}
+.sequencer {
+ margin-top: 18px;
+}
+.sequencer .panel-head {
+ padding: 12px 0;
+ border: 0;
+}
+.step-grid {
+ display: grid;
+ grid-template-columns: 70px repeat(16, minmax(0, 1fr));
+ gap: 5px;
+ align-items: center;
+}
+.step-grid .track {
+ font-size: 10px;
+ text-align: left;
+ border: 0;
+ padding: 8px 0;
+ color: var(--muted);
+}
+.step-grid .step {
+ height: 30px;
+ border-radius: 3px;
+ padding: 0;
+ background: #312a27;
+ border: 1px solid #504138;
+}
+.step-grid .step.beat {
+ background: #3a302b;
+}
+.step-grid .step[aria-pressed="true"] {
+ background: #d59063;
+ border-color: #e5a67e;
+}
+.step-grid .step.current {
+ outline: 2px solid #f9e8c7;
+ outline-offset: 0;
+}
+.step-grid .step-num {
+ font: 8px monospace;
+ text-align: center;
+ color: #a99181;
+}
+.music-note {
+ border-top: 1px solid var(--line);
+ padding: 20px 0;
+}
+.music-note p {
+ font:
+ 17px Georgia,
+ serif;
+ margin-top: 8px;
+}
+.workspace {
+ grid-template-columns: minmax(0, 1fr) 220px;
+ gap: 30px;
+}
+#mixer .field {
+ margin: 12px 0;
+}
+#mixer input {
+ width: 100%;
+}
+@media (max-width: 800px) {
+ .workspace {
+ grid-template-columns: 1fr;
+ }
+ .intro {
+ flex-direction: row;
+ }
+ .record {
+ width: 125px;
+ height: 125px;
+ flex-shrink: 0;
+ }
+}
+@media (max-width: 480px) {
+ .record {
+ width: 94px;
+ height: 94px;
+ margin: 10px 0;
+ }
+ .record-label {
+ width: 46px;
+ height: 46px;
+ font-size: 8px;
+ }
+ .intro h1 {
+ font-size: 42px;
+ }
+ .intro p {
+ font-size: 12px;
+ }
+ .step-grid {
+ grid-template-columns: 47px repeat(16, minmax(0, 1fr));
+ gap: 3px;
+ }
+ .step-grid .step {
+ height: 25px;
+ }
+ .step-grid .track {
+ font-size: 8px;
+ }
+ .transport .mono {
+ font-size: 10px;
+ }
+ #key {
+ display: none;
+ }
+ .sections {
+ font-size: 7px;
+ }
+}
+</style></head><body>
+<header class="masthead"><div class="identity"><span class="mark" aria-hidden="true">Ⅱ</span>AFTERHOURS</div>
+<form class="seed-form" id="seed-form"><label for="seed">Seed</label><input id="seed" aria-label="Seed" maxlength="128" autocomplete="off" spellcheck="false"><button type="submit">Apply</button><button id="next-seed" type="button" title="Next seed">↗ Next</button></form></header>
+<section class="intro">
+ <div>
+ <p class="eyebrow">A small room for big ideas / Vol. 01</p>
+ <h1>Stay a little<br /><em>longer.</em></h1>
+ <p>
+ Eight bars after midnight. Shape the rhythm, find the pocket, take the
+ whole thing with you.
+ </p>
+ </div>
+ <div class="record" aria-hidden="true">
+ <div class="record-label">AFTER<br />HOURS<span>33 ⅓</span></div>
+ </div>
+</section>
+<main class="workspace">
+ <div>
+ <section class="transport">
+ <button id="play" class="primary">▶ Play</button
+ ><button id="stop" aria-label="Stop playback">■</button
+ ><span class="mono" id="time">0:00 / 0:00</span
+ ><span id="key" class="muted mono"></span
+ ><button id="export-wav">Export WAV ↗</button>
+ </section>
+ <section class="wave-panel">
+ <canvas
+ id="waveform"
+ aria-label="Waveform of the full arrangement"
+ ></canvas>
+ <div class="sections">
+ <span>01 / ARRIVE</span><span>02 / FIND THE POCKET</span
+ ><span>03 / LET GO</span>
+ </div>
+ </section>
+ <section class="sequencer">
+ <div class="panel-head">
+ <h3>The pattern</h3>
+ <span class="eyebrow" id="bar">8 bars / 16 steps</span>
+ </div>
+ <div class="step-grid" id="steps"></div>
+ <p class="small muted" style="padding: 12px 0">
+ Tap a step to write the pattern. Tap a track name to mute it.
+ </p>
+ </section>
+ <div class="music-note">
+ <span class="eyebrow">Your arrangement</span>
+ <p id="audio-status">Your score is ready. Press Play to hear it.</p>
+ </div>
+ </div>
+ <aside class="side">
+ <div>
+ <p class="eyebrow">The pocket</p>
+ <label class="field"
+ ><span>Tempo <output id="tempo-value"></output></span
+ ><input id="tempo" type="range" min="66" max="132" value="86" /></label
+ ><label class="field"
+ ><span>Swing <output id="swing-value">16%</output></span
+ ><input id="swing" type="range" min="0" max="45" value="16" /></label
+ ><label class="field"
+ ><span>Listening level <output id="volume-value">70%</output></span
+ ><input id="volume" type="range" min="0" max="100" value="70"
+ /></label>
+ </div>
+ <div class="section">
+ <h3>The mix</h3>
+ <div id="mixer"></div>
+ </div>
+ <div class="section small muted">
+ <p>
+ Original, locally synthesized audio. No samples to download, no account,
+ no network.
+ </p>
+ <p style="margin-top: 10px">
+ The same score and settings produce the same PCM samples here. WAV
+ exports are mono, 22.05 kHz.
+ </p>
+ </div>
+ </aside>
+</main>
+<footer class="status-line">
+ <span><i class="dot"></i>LISTEN FIRST. THEN MAKE IT YOURS.</span
+ ><span id="peak"></span>
+</footer>
+<div class="toast" id="toast" role="status"></div>
+<script id="harness-model">
+'use strict';
+// Shared deterministic primitives. Domain models use named streams so unrelated edits stay stable.
+function hash(value) {
+ let h = 2166136261;
+ for (const c of String(value)) h = Math.imul(h ^ c.charCodeAt(0), 16777619);
+ return h >>> 0;
+}
+function random(seed, stream = "main") {
+ let a = hash(`${seed}:${stream}`);
+ return () => {
+ a = (a + 0x6d2b79f5) | 0;
+ let t = Math.imul(a ^ (a >>> 15), 1 | a);
+ t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
+ };
+}
+const clamp = (n, lo, hi) => Math.max(lo, Math.min(hi, n));
+const lerp = (a, b, t) => a + (b - a) * t;
+const pick = (items, rng) => items[Math.floor(rng() * items.length)];
+function normal(rng) {
+ return (
+ Math.sqrt(-2 * Math.log(Math.max(1e-9, rng()))) *
+ Math.cos(2 * Math.PI * rng())
+ );
+}
+
+const trackNames = ["Kick", "Snare", "Hi-hat", "Bass", "Keys"];
+function musicScore(seed) {
+ const rhythm = random(seed, "rhythm"),
+ melody = random(seed, "melody"),
+ harmony = random(seed, "harmony");
+ const root = pick([45, 48, 50, 52], harmony),
+ scale = [0, 3, 5, 7, 10];
+ const patterns = [
+ Array.from(
+ { length: 16 },
+ (_, i) => i % 4 === 0 || (i === 14 && rhythm() > 0.5),
+ ),
+ Array.from({ length: 16 }, (_, i) => i === 4 || i === 12),
+ Array.from({ length: 16 }, (_, i) => i % 2 === 0 || rhythm() > 0.64),
+ Array.from({ length: 16 }, (_, i) => [0, 6, 8, 14].includes(i)),
+ Array.from({ length: 16 }, (_, i) => i % 2 === 0 && melody() > 0.18),
+ ];
+ return {
+ seed: String(seed),
+ root,
+ tempo: pick([82, 86, 90, 94], harmony),
+ bars: 8,
+ patterns,
+ notes: Array.from({ length: 16 }, () => root + 24 + pick(scale, melody)),
+ chords: [0, 0, 5, 5, 3, 3, 7, 0],
+ };
+}
+function scoreEvents(
+ score,
+ {
+ tempo = score.tempo,
+ swing = 16,
+ patterns = score.patterns,
+ muted = [],
+ } = {},
+) {
+ const beat = 60 / tempo,
+ step = beat / 4,
+ events = [];
+ for (let bar = 0; bar < score.bars; bar++)
+ for (let tick = 0; tick < 16; tick++)
+ for (let track = 0; track < 5; track++) {
+ if (
+ !patterns[track][tick] ||
+ muted[track] ||
+ (bar === 0 && track === 1) ||
+ (bar === 7 && tick > 11 && track < 3)
+ )
+ continue;
+ const time =
+ (bar * 16 + tick) * step + (tick % 2 ? (step * swing) / 100 : 0);
+ events.push({
+ track,
+ time,
+ note:
+ track === 3
+ ? score.root - 12 + score.chords[bar]
+ : score.notes[tick] + score.chords[bar],
+ duration:
+ track === 4 ? beat * 1.1 : track === 3 ? beat * 0.7 : beat * 0.35,
+ bar,
+ tick,
+ });
+ }
+ return { events, duration: score.bars * 4 * beat + 1, beat };
+}
+function renderMusic(score, options = {}, sampleRate = 22050) {
+ const { events, duration } = scoreEvents(score, options),
+ samples = new Float32Array(Math.ceil(duration * sampleRate));
+ const levels = options.levels ?? [0.85, 0.5, 0.32, 0.6, 0.5];
+ for (const event of events) {
+ const { track, time, note } = event,
+ start = Math.round(time * sampleRate),
+ length = Math.min(
+ samples.length - start,
+ Math.ceil((track < 3 ? 0.24 : event.duration + 0.3) * sampleRate),
+ );
+ const frequency = 440 * 2 ** ((note - 69) / 12),
+ noise = random(score.seed, `hit:${track}:${event.bar}:${event.tick}`);
+ let phase = 0;
+ for (let i = 0; i < length; i++) {
+ const t = i / sampleRate;
+ let value = 0;
+ if (track === 0) {
+ phase += (2 * Math.PI * (48 + 125 * Math.exp(-t * 38))) / sampleRate;
+ value = Math.sin(phase) * Math.exp(-t * 18) * 0.8;
+ }
+ if (track === 1)
+ value =
+ ((noise() * 2 - 1) * 0.66 + Math.sin(2 * Math.PI * 180 * t) * 0.34) *
+ Math.exp(-t * 23) *
+ 0.55;
+ if (track === 2) value = (noise() * 2 - 1) * Math.exp(-t * 75) * 0.27;
+ if (track === 3)
+ value =
+ (Math.sin(2 * Math.PI * frequency * t) +
+ 0.18 * Math.sin(4 * Math.PI * frequency * t)) *
+ Math.min(1, t * 90) *
+ Math.exp(-t * 5) *
+ 0.5;
+ if (track === 4)
+ value =
+ (Math.sin(2 * Math.PI * frequency * t) * 0.6 +
+ Math.sin(2 * Math.PI * frequency * 2.002 * t) * 0.15 +
+ Math.sin(2 * Math.PI * frequency * 0.5 * t) * 0.25) *
+ Math.min(1, t * 120) *
+ Math.exp(-t * 3.8) *
+ 0.4;
+ samples[start + i] += value * levels[track];
+ }
+ }
+ // Fixed soft ceiling, no seed-dependent normalization pumping. Leave headroom for playback.
+ let peak = 0,
+ energy = 0;
+ for (let i = 0; i < samples.length; i++) {
+ samples[i] = Math.tanh(samples[i] * 1.25) * 0.9;
+ peak = Math.max(peak, Math.abs(samples[i]));
+ energy += samples[i] ** 2;
+ }
+ return {
+ samples,
+ sampleRate,
+ duration,
+ peak,
+ rms: Math.sqrt(energy / samples.length),
+ };
+}
+function wavFile(samples, sampleRate) {
+ const out = new ArrayBuffer(44 + samples.length * 2),
+ v = new DataView(out);
+ const text = (offset, s) => {
+ for (let i = 0; i < s.length; i++) v.setUint8(offset + i, s.charCodeAt(i));
+ };
+ text(0, "RIFF");
+ v.setUint32(4, 36 + samples.length * 2, true);
+ text(8, "WAVE");
+ text(12, "fmt ");
+ v.setUint32(16, 16, true);
+ v.setUint16(20, 1, true);
+ v.setUint16(22, 1, true);
+ v.setUint32(24, sampleRate, true);
+ v.setUint32(28, sampleRate * 2, true);
+ v.setUint16(32, 2, true);
+ v.setUint16(34, 16, true);
+ text(36, "data");
+ v.setUint32(40, samples.length * 2, true);
+ samples.forEach((s, i) =>
+ v.setInt16(44 + i * 2, Math.round(clamp(s, -1, 1) * 32767), true),
+ );
+ return out;
+}
+
+</script>
+<script>
+'use strict';
+const $ = (s) => document.querySelector(s);
+const $$ = (s) => [...document.querySelectorAll(s)];
+const params = new URLSearchParams(location.search);
+let seed = (params.get("seed") || "42").slice(0, 128);
+const reducedMotion = matchMedia("(prefers-reduced-motion: reduce)").matches;
+const parentMessage = (message) => {
+ if (parent !== window) parent.postMessage(message, "*");
+};
+function toast(message) {
+ $("#toast").textContent = message;
+ clearTimeout(toast.timer);
+ toast.timer = setTimeout(() => {
+ $("#toast").textContent = "";
+ }, 3500);
+}
+function saveFile(name, content, type = "application/json") {
+ const blob =
+ content instanceof Blob ? content : new Blob([content], { type });
+ const url = URL.createObjectURL(blob),
+ a = document.createElement("a");
+ a.href = url;
+ a.download = name;
+ document.body.append(a);
+ a.click();
+ a.remove();
+ setTimeout(() => URL.revokeObjectURL(url), 30000);
+}
+function canvasPNG(canvas, name) {
+ canvas.toBlob((blob) => {
+ if (blob) saveFile(name, blob);
+ else toast("Image export failed. Please try again.");
+ });
+}
+function setSeed(value) {
+ seed = String(value).trim().slice(0, 128) || "42";
+ $("#seed").value = seed;
+ const url = new URL(location.href);
+ url.searchParams.set("seed", seed);
+ try {
+ history.replaceState(null, "", url);
+ } catch {
+ /* Opaque-origin iframe: the shell owns its URL. */
+ }
+ parentMessage({ type: "harness:state", seed });
+ dispatchEvent(new CustomEvent("seedchange", { detail: seed }));
+}
+$("#seed").value = seed;
+$("#seed-form").addEventListener("submit", (e) => {
+ e.preventDefault();
+ setSeed($("#seed").value);
+});
+$("#next-seed").addEventListener("click", () =>
+ setSeed(/^\d{1,9}$/.test(seed) ? Number(seed) + 1 : hash(seed)),
+);
+function fitCanvas(canvas, draw, maxDpr = 2) {
+ const observer = new ResizeObserver(() => {
+ const box = canvas.getBoundingClientRect(),
+ dpr = Math.min(devicePixelRatio || 1, maxDpr);
+ canvas.width = Math.max(1, Math.round(box.width * dpr));
+ canvas.height = Math.max(1, Math.round(box.height * dpr));
+ draw?.();
+ });
+ observer.observe(canvas);
+ return observer;
+}
+const editable = (target) =>
+ target instanceof Element &&
+ !!target.closest("input,textarea,select,[contenteditable=true]");
+addEventListener("error", (e) =>
+ parentMessage({ type: "harness:error", message: e.message }),
+);
+addEventListener("unhandledrejection", (e) =>
+ parentMessage({
+ type: "harness:error",
+ message: String(e.reason?.message || e.reason),
+ }),
+);
+function ready() {
+ document.body.dataset.ready = "true";
+ parentMessage({ type: "harness:ready", title: document.title, seed });
+}
+
+let score,
+ patterns,
+ rendered,
+ audioContext,
+ source,
+ master,
+ started = 0,
+ offset = 0,
+ playing = false,
+ muted = [false, false, false, false, false],
+ levels = [0.85, 0.5, 0.32, 0.6, 0.5];
+const clockText = (s) =>
+ `${Math.floor(s / 60)}:${String(Math.floor(s % 60)).padStart(2, "0")}`;
+const musicOptions = () => ({
+ tempo: +$("#tempo").value,
+ swing: +$("#swing").value,
+ patterns,
+ muted,
+ levels,
+});
+function stopMusic(reset = true) {
+ if (source) {
+ source.onended = null;
+ source.stop();
+ source = null;
+ }
+ if (playing && audioContext) offset = audioContext.currentTime - started;
+ playing = false;
+ if (reset) offset = 0;
+ $("#play").textContent = "▶ Play";
+ drawWave();
+}
+function rebuildMusic() {
+ stopMusic();
+ rendered = renderMusic(score, musicOptions());
+ $("#tempo-value").value = `${$("#tempo").value} BPM`;
+ $("#swing-value").value = `${$("#swing").value}%`;
+ $("#time").textContent = `0:00 / ${clockText(rendered.duration)}`;
+ $("#peak").textContent =
+ `PEAK ${rendered.peak ? (20 * Math.log10(rendered.peak)).toFixed(1) : "−∞"} dBFS`;
+ $("#audio-status").textContent =
+ "Your score is ready. Press Play to hear it.";
+ drawWave();
+}
+function drawWave() {
+ if (!rendered) return;
+ const c = $("#waveform"),
+ ctx = c.getContext("2d"),
+ w = c.width,
+ h = c.height;
+ ctx.clearRect(0, 0, w, h);
+ const pos = playing ? audioContext.currentTime - started : offset;
+ const played = (pos / rendered.duration) * w;
+ const stride = Math.max(1, Math.floor(rendered.samples.length / w));
+ ctx.lineWidth = 1.4;
+ for (let x = 0; x < w; x += 3) {
+ let peak = 0;
+ for (
+ let i = x * stride;
+ i < Math.min((x + 3) * stride, rendered.samples.length);
+ i += 8
+ )
+ peak = Math.max(peak, Math.abs(rendered.samples[i]));
+ ctx.strokeStyle = x < played ? "#efb082" : "#836650";
+ ctx.beginPath();
+ ctx.moveTo(x, h / 2 - peak * h * 0.7);
+ ctx.lineTo(x, h / 2 + peak * h * 0.7);
+ ctx.stroke();
+ }
+ if (playing) {
+ ctx.strokeStyle = "#f7e7d0";
+ ctx.beginPath();
+ ctx.moveTo(played, 0);
+ ctx.lineTo(played, h);
+ ctx.stroke();
+ }
+}
+function renderGrid() {
+ const grid = $("#steps");
+ grid.replaceChildren();
+ grid.append(document.createElement("span"));
+ for (let i = 0; i < 16; i++) {
+ const s = document.createElement("span");
+ s.className = "step-num";
+ s.textContent = i + 1;
+ grid.append(s);
+ }
+ trackNames.forEach((name, track) => {
+ const b = document.createElement("button");
+ b.className = "track";
+ b.textContent = muted[track] ? `${name} ×` : name;
+ b.setAttribute("aria-label", `${muted[track] ? "Unmute" : "Mute"} ${name}`);
+ b.onclick = () => {
+ muted[track] = !muted[track];
+ renderGrid();
+ rebuildMusic();
+ };
+ grid.append(b);
+ patterns[track].forEach((on, tick) => {
+ const s = document.createElement("button");
+ s.className = `step ${tick % 4 === 0 ? "beat" : ""}`;
+ s.dataset.tick = tick;
+ s.setAttribute("aria-pressed", on);
+ s.setAttribute("aria-label", `${name} step ${tick + 1}`);
+ s.onclick = () => {
+ patterns[track][tick] = !patterns[track][tick];
+ renderGrid();
+ rebuildMusic();
+ };
+ grid.append(s);
+ });
+ });
+}
+async function playMusic() {
+ if (playing) {
+ stopMusic(false);
+ return;
+ }
+ try {
+ audioContext ??= new (window.AudioContext || window.webkitAudioContext)();
+ await audioContext.resume();
+ master ??= audioContext.createGain();
+ master.disconnect();
+ master.connect(audioContext.destination);
+ master.gain.value = +$("#volume").value / 100;
+ const buffer = audioContext.createBuffer(
+ 1,
+ rendered.samples.length,
+ rendered.sampleRate,
+ );
+ buffer.copyToChannel(rendered.samples, 0);
+ source = audioContext.createBufferSource();
+ source.buffer = buffer;
+ source.connect(master);
+ if (offset >= rendered.duration) offset = 0;
+ started = audioContext.currentTime - offset;
+ source.start(0, offset);
+ source.onended = () => {
+ playing = false;
+ source = null;
+ offset = 0;
+ $("#play").textContent = "▶ Play";
+ $("#audio-status").textContent =
+ "That was your take. Play it again, or change a step.";
+ };
+ playing = true;
+ $("#play").textContent = "Ⅱ Pause";
+ $("#audio-status").textContent = "Playing your eight-bar arrangement.";
+ } catch (e) {
+ toast("Audio could not start: " + e.message);
+ }
+}
+function newScore() {
+ score = musicScore(seed);
+ patterns = score.patterns.map((row) => [...row]);
+ $("#tempo").value = score.tempo;
+ $("#key").textContent =
+ ["C", "C♯", "D", "E♭", "E", "F", "F♯", "G", "A♭", "A", "B♭", "B"][
+ score.root % 12
+ ] + " minor";
+ renderGrid();
+ rebuildMusic();
+}
+trackNames.forEach((name, i) => {
+ const label = document.createElement("label");
+ label.className = "field";
+ const span = document.createElement("span");
+ span.textContent = name;
+ const input = document.createElement("input");
+ input.type = "range";
+ input.min = 0;
+ input.max = 100;
+ input.value = levels[i] * 100;
+ input.setAttribute("aria-label", `${name} level`);
+ input.onchange = () => {
+ levels[i] = +input.value / 100;
+ rebuildMusic();
+ };
+ label.append(span, input);
+ $("#mixer").append(label);
+});
+$("#play").onclick = playMusic;
+$("#stop").onclick = () => {
+ stopMusic();
+ $("#time").textContent = `0:00 / ${clockText(rendered.duration)}`;
+ $("#audio-status").textContent =
+ "Stopped. Press Play to start at the beginning.";
+};
+for (const id of ["tempo", "swing"]) $("#" + id).onchange = rebuildMusic;
+$("#volume").oninput = () => {
+ $("#volume-value").value = `${$("#volume").value}%`;
+ if (master)
+ master.gain.setTargetAtTime(
+ +$("#volume").value / 100,
+ audioContext.currentTime,
+ 0.02,
+ );
+};
+$("#export-wav").onclick = () => {
+ saveFile(
+ `afterhours-${hash(seed)}.wav`,
+ wavFile(rendered.samples, rendered.sampleRate),
+ "audio/wav",
+ );
+ toast("WAV rendered from your current score and mix.");
+};
+let lastTick = -1;
+function musicFrame() {
+ if (playing) {
+ const t = Math.min(rendered.duration, audioContext.currentTime - started),
+ tick = Math.floor(t / (60 / +$("#tempo").value / 4)) % 16;
+ $("#time").textContent =
+ `${clockText(t)} / ${clockText(rendered.duration)}`;
+ $("#bar").textContent =
+ `Bar ${Math.min(8, Math.floor(t / ((60 / +$("#tempo").value) * 4)) + 1)} / 8`;
+ if (tick !== lastTick) {
+ $$(".step").forEach((b) =>
+ b.classList.toggle("current", +b.dataset.tick === tick),
+ );
+ lastTick = tick;
+ }
+ drawWave();
+ } else if (lastTick !== -1) {
+ $$(".step.current").forEach((b) => b.classList.remove("current"));
+ lastTick = -1;
+ }
+ requestAnimationFrame(musicFrame);
+}
+fitCanvas($("#waveform"), drawWave);
+addEventListener("seedchange", newScore);
+addEventListener("pagehide", () => {
+ stopMusic();
+ audioContext?.close();
+});
+newScore();
+musicFrame();
+ready();
+
+</script></body></html>
diff --git a/store/agents/music-studio/template/tools/check.mjs b/store/agents/music-studio/template/tools/check.mjs
new file mode 100644
index 000000000..043022a11
--- /dev/null
+++ b/store/agents/music-studio/template/tools/check.mjs
@@ -0,0 +1,75 @@
+const CONFIG = {"id":"music-studio","artifact":"piece/index.html"};
+// Compiled into each workspace's tools/check.mjs. Tests the model in the ACTUAL edited HTML.
+import { readFile, mkdir, writeFile } from "node:fs/promises";
+import { createHash } from "node:crypto";
+import vm from "node:vm";
+import { resolve, dirname } from "node:path";
+
+const args = process.argv.slice(2),
+ i = args.indexOf("--seeds");
+const count = i === -1 ? 32 : Number(args[i + 1]);
+if (!Number.isInteger(count) || count < 1 || count > 1000)
+ throw new Error("--seeds must be an integer from 1 to 1000");
+const artifact = resolve(CONFIG.artifact);
+const html = await readFile(artifact, "utf8");
+const script = html.match(
+ /<script id="harness-model">([\s\S]*?)<\/script>/,
+)?.[1];
+if (!script)
+ throw new Error(
+ 'Keep the pure model in <script id="harness-model"> so this checker can exercise the actual artifact.',
+ );
+const expressions = {
+ "generative-art": `const m=artModel(SEED);const p=artPaths(m);({state:m,valid:p.length>0&&p.flat().every(([x,y])=>Number.isFinite(x)&&Number.isFinite(y)),metrics:{paths:p.length,palette:m.palette}})`,
+ "creative-direction": `const m=directionModel(SEED);const ratio=contrast(m.colors[0],m.colors[1]);({state:m,valid:ratio>=4.5,metrics:{direction:m.name,contrast:ratio}})`,
+ "lab-bench": `const p=experiment(SEED),e=treatmentEffect(p);({state:p,valid:p.length>1&&p.every(p=>Number.isFinite(p.x)&&Number.isFinite(p.y))&&Number.isFinite(e.low)&&e.low<=e.high,metrics:{samples:p.length,effect:e.difference,interval:[e.low,e.high]}})`,
+ "music-studio": `const s=musicScore(SEED),r=renderMusic(s);({state:Array.from(r.samples),valid:r.peak>.001&&r.peak<=.95&&r.samples.every(Number.isFinite),metrics:{seconds:r.duration,peak:r.peak,rms:r.rms}})`,
+ "game-master": `const m=arenaMatch(SEED),s=m.history.at(-1);({state:m,valid:m.history.length>1&&m.history.length<=10000&&s.units.every(u=>u.hp>=0&&u.x>=0&&u.x<m.map.w&&u.y>=0&&u.y<m.map.h),metrics:{turns:s.turn,score:s.score,winner:m.winner}})`,
+ "drone-pilot": `const s=flyAutopilot(SEED);({state:s,valid:s.finished&&!s.crashed&&s.passed===flightCourse(SEED).length,metrics:{seconds:s.time,passed:s.passed,missed:s.missed}})`,
+ "voxel-worlds": `const w=voxelWorld(SEED);let p={...w.spawn,vy:0,grounded:true};const clear=playerFits(w,p.x,p.y,p.z);for(let t=0;t<120;t++)p=movePlayer(w,p,{forward:1});({state:Array.from(w.blocks),valid:clear&&playerFits(w,p.x,p.y,p.z),metrics:{blocks:w.blocks.filter(Boolean).length,walkDistance:Math.hypot(p.x-w.spawn.x,p.z-w.spawn.z)}})`,
+};
+const expression = expressions[CONFIG.id];
+const digest = (value) =>
+ createHash("sha256").update(JSON.stringify(value)).digest("hex");
+const results = [];
+for (let seed = 0; seed < count; seed++) {
+ const run = () =>
+ vm.runInNewContext(
+ `${script}\n${expression}`,
+ { SEED: String(seed) },
+ { timeout: 10000 },
+ );
+ try {
+ const first = run(),
+ second = run(),
+ signature = digest(first.state),
+ repeat = digest(second.state);
+ results.push({
+ seed,
+ ok: first.valid && signature === repeat,
+ signature,
+ metrics: first.metrics,
+ });
+ } catch (error) {
+ results.push({ seed, ok: false, error: error.message });
+ }
+}
+const passed = results.filter((r) => r.ok).length;
+const report = {
+ spec: 1,
+ harness: CONFIG.id,
+ artifact: CONFIG.artifact,
+ checkedAt: new Date().toISOString(),
+ modelChecks: { passed, total: count },
+ scope:
+ "Pure model invariants and same-process repeatability. Browser interaction, layout, listening and export review still required.",
+ results,
+};
+const out = resolve(".harness/model-check.json");
+await mkdir(dirname(out), { recursive: true });
+await writeFile(out, JSON.stringify(report, null, 2) + "\n");
+console.log(
+ `${CONFIG.id}: ${passed}/${count} model checks passed. Report: ${out}`,
+);
+console.log(report.scope);
+if (passed !== count) process.exitCode = 1;
diff --git a/store/agents/music-studio/test/toolchain.test.mjs b/store/agents/music-studio/test/toolchain.test.mjs
new file mode 100644
index 000000000..26349ef58
--- /dev/null
+++ b/store/agents/music-studio/test/toolchain.test.mjs
@@ -0,0 +1,66 @@
+// The Music Studio harness scripts, run the way Harness runs them.
+// node --test test/*.test.mjs
+import assert from 'node:assert/strict'
+import { spawnSync } from 'node:child_process'
+import { accessSync, constants, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { after, test } from 'node:test'
+
+const here = fileURLToPath(new URL('..', import.meta.url))
+const manifest = JSON.parse(readFileSync(join(here, 'harness.json'), 'utf8'))
+const scratch = []
+after(() => { for (const dir of scratch) rmSync(dir, { recursive: true, force: true }) })
+
+function tempDir() { const d = mkdtempSync(join(tmpdir(), 'studio-')); scratch.push(d); return d }
+function run(script, { cwd = here, env = {} } = {}) {
+ const merged = { ...process.env }
+ for (const [k, v] of Object.entries(env)) v === null ? delete merged[k] : (merged[k] = v)
+ const r = spawnSync(join(here, script), { cwd, env: merged, encoding: 'utf8' })
+ return { code: r.status, stdout: r.stdout, stderr: r.stderr }
+}
+const seedScript = join(here, 'skills/studio/scripts/seed-verdict.sh')
+
+test('every script the manifest names is in the folder and executable', () => {
+ for (const s of [manifest.workspace.init, manifest.toolchain.setup, manifest.toolchain.doctor]) {
+ assert.doesNotThrow(() => accessSync(join(here, s), constants.X_OK), s)
+ }
+})
+
+test('setup installs nothing and succeeds quietly', () => {
+ assert.deepEqual(run(manifest.toolchain.setup), { code: 0, stdout: '', stderr: '' })
+})
+
+test('doctor says ok when sh is on PATH', () => {
+ assert.equal(run(manifest.toolchain.doctor).code, 0)
+})
+
+test('init lays out a workspace and seeds a not-ready verdict', () => {
+ const ws = tempDir()
+ assert.equal(run(manifest.workspace.init, { cwd: ws, env: { HARNESS_DSH: manifest.id } }).code, 0)
+ assert.equal(JSON.parse(readFileSync(join(ws, '.harness/verdict.json'), 'utf8')).ready, false)
+ assert.equal(readFileSync(join(ws, '.harness-initialized'), 'utf8'), `initialized by ${manifest.id}\n`)
+})
+
+test('the manifest names a viewer package and an HTML artifact', () => {
+ assert.equal(manifest.viewer.use, 'autonomous/web-viewer')
+ assert.deepEqual(manifest.viewer.artifactExtensions, ['.html'])
+})
+
+test('seed-verdict reflects whether a piece exists', () => {
+ const ws = tempDir()
+ run(manifest.workspace.init, { cwd: ws })
+ assert.equal(spawnSync(seedScript, [ws], { cwd: ws, encoding: 'utf8' }).status, 0)
+ assert.equal(JSON.parse(readFileSync(join(ws, '.harness/verdict.json'), 'utf8')).ready, false)
+ mkdirSync(join(ws, 'piece'), { recursive: true })
+ writeFileSync(join(ws, 'piece/index.html'), '<!doctype html>')
+ assert.equal(spawnSync(seedScript, [ws], { cwd: ws, encoding: 'utf8' }).status, 0)
+ assert.equal(JSON.parse(readFileSync(join(ws, '.harness/verdict.json'), 'utf8')).ready, false)
+})
+
+
+test('the manifest routes the actual nested artifact through the shared viewer', () => {
+ assert.equal(manifest.viewer.url, 'http://127.0.0.1:${port}/?file=${artifact}')
+ assert.ok(manifest.workspace.marker.endsWith('/index.html'))
+})
diff --git a/store/agents/music-studio/toolchain/doctor.sh b/store/agents/music-studio/toolchain/doctor.sh
new file mode 100755
index 000000000..348830f87
--- /dev/null
+++ b/store/agents/music-studio/toolchain/doctor.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+# Doctor: the piece is just a file served by the shared web-viewer; no extra runtime needed.
+exit 0
diff --git a/store/agents/music-studio/toolchain/init-workspace.sh b/store/agents/music-studio/toolchain/init-workspace.sh
new file mode 100755
index 000000000..9a8548896
--- /dev/null
+++ b/store/agents/music-studio/toolchain/init-workspace.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Harness copies the template before this runs. Preserve the user's design log on repeat calls.
+set -eu
+ws="${1:-$PWD}"
+mkdir -p "$ws/piece" "$ws/.harness"
+if [ ! -f "$ws/piece/DESIGN.md" ]; then
+ printf '# Design log — Music Studio\n\nRecord date, USER or AI, decision, rationale, and whether it remains in the build.\n' > "$ws/piece/DESIGN.md"
+fi
+cat > "$ws/.harness/verdict.json" <<JSON
+{"spec":1,"ready":false,"summary":"Afterhours starter available — describe what you want to create","artifact":"piece/index.html","findings":[{"severity":"info","kind":"review_pending","message":"Starter provided; personalized changes need browser verification."}],"phases":[{"id":"build","name":"Build","state":"active"},{"id":"verify","name":"Verify","state":"pending"}],"updatedAt":"$(date -u +%Y-%m-%dT%H:%M:%SZ)"}
+JSON
+printf 'initialized by %s\n' "${HARNESS_DSH:-autonomous/music-studio}" > "$ws/.harness-initialized"
diff --git a/store/agents/music-studio/toolchain/setup.sh b/store/agents/music-studio/toolchain/setup.sh
new file mode 100755
index 000000000..d32f7d778
--- /dev/null
+++ b/store/agents/music-studio/toolchain/setup.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+# Music Studio has no toolchain: everything is inline HTML + Web Audio. Nothing to install.
+exit 0
diff --git a/store/agents/voxel-worlds/AGENTS.md b/store/agents/voxel-worlds/AGENTS.md
new file mode 100644
index 000000000..551f10f68
--- /dev/null
+++ b/store/agents/voxel-worlds/AGENTS.md
@@ -0,0 +1,65 @@
+# Voxel Worlds harness
+
+You turn a plain-English description into a **playable 3D voxel world in a single self-contained
+`world/index.html`**. The warehouse Page loads that file in the pane, so a visitor can walk it.
+
+## What a good world is
+
+- **One file.** Everything (three.js, textures, controls, audio) bundled or generated inline — no
+ CDN at runtime so the pane can load it offline. A long global world script plus a small `onload`
+ is fine.
+- **Walkable, first-person, mouse+keyboard** (and touch), with block **place** and **break**.
+ These four things are the floor; without them the world is a diorama, not a game.
+- **A day/night cycle** and a small **HUD** (a crosshair, a hotbar, a health/heart row) separate a
+ "gold" world from a "silver" one on the Voxelcraft-style checklists. Textured blocks read far
+ better than flat colors — procedurally texture grass/dirt/stone/wood (noise, not a flat fill).
+- **Lean on specific palette terms.** "a small farming village with wheat fields and a dirt road
+ through the center, river along the eastern edge" beats "a cool world". Vague nouns make generic
+ mush; concrete nouns make adjacent and aligned things.
+
+## How to work so the pane moves
+
+1. **Save within a minute.** Materialize `world/index.html` with a tiny camera on a flat ground tile
+ first, so the header shows a state and the pane can load it. Then build up.
+2. **Build one feature at a time**, and after every pass verify in the browser: load the file, take
+ a screenshot from the *player camera* (not a debug angle), look at it. The camera is the referee.
+ Fix what you can see, re-take, repeat.
+3. **Update `.harness/verdict.json` at every check and phase change** — `ready`, a one-line
+ `summary` for the header, `phases` (world → interaction → polish), and `findings` for anything
+ unfinished. Write it as a feed, not once at the end.
+
+## Rules
+
+- If the user reports a bug in plain words ("I can't climb out of the ocean"), diagnose the actual
+ cause (here: the classic 1-block shore wall) and fix it rather than papering over it.
+- Mark every crafted decision USER vs AI with one line in `world/DESIGN.md`
+ (`YYYY-MM-DD | USER|AI | topic | decision | still in build?`) so discarded ideas don't
+ resurrect.
+- Say plainly in `summary` what is real and playable now, and what is not. Don't claim "done" on a
+ build you haven't walked.
+
+## Shipped experience and operating standard
+
+The workspace starts with **Tidelands**, a working experience, not an empty placeholder.
+Walk, collision, jump, place/break, five materials, day/night, island overview, world JSON export.
+
+- Read the existing artifact before replacing it. The useful model boundaries are world geometry, collision, camera, raycast editing, day cycle.
+- Preserve working interactions and exports when extending the artifact. Match the user's brief;
+ the starter's genre and visual style are examples, not a ceiling.
+- Expose meaningful domain controls and outputs. Every control must change real state; every
+ displayed metric must be computed from that state. Never invent model activity or test results.
+- Use named random streams and a fixed simulation/score clock. Sample seeds, repeat the same
+ seed, inspect exported data, and verify keyboard/touch controls in the actual viewer.
+- This HTML runs with same-origin APIs in the shared viewer. Sibling fetches, localStorage,
+ downloads and pointer lock are available. Keep files portable and support direct opening.
+- Do not equate an existing HTML file, a successful reload, or a source-string test with a usable
+ result. `seed-verdict.sh` deliberately keeps `ready:false`; write `ready:true` only after your
+ checks establish it. Record exact commands, sampled seeds, observations and limitations.
+- Never claim a test coverage percentage for browser code based on Node subprocess tests.
+
+## Check your actual edited model
+
+Run `node tools/check.mjs --seeds 100` in the workspace. It reads the pure model from
+`<script id="harness-model">` in the artifact, checks domain invariants, repeats each seed, and
+writes `.harness/model-check.json`. Preserve that script boundary when editing. Model checks are
+followed by browser interaction, exported-output inspection, and visual or listening review.
diff --git a/store/agents/voxel-worlds/README.md b/store/agents/voxel-worlds/README.md
new file mode 100644
index 000000000..4d06cb046
--- /dev/null
+++ b/store/agents/voxel-worlds/README.md
@@ -0,0 +1,42 @@
+# Voxel Worlds — Tidelands
+
+Build and walk a seeded voxel island. Sculpt terrain, place and break blocks, explore a cabin and lighthouse, change the light, and save your world.
+
+## Try it
+
+> Turn this island into a harbor village with a walkable pier, a hilltop observatory, and lanterns along the road.
+
+The starter already works before the first prompt. Change it with the agent, interact with the
+result in the pane, and keep the output. Everything needed at runtime is in `world/index.html`.
+It works offline and can be opened outside Harness.
+
+## What you can do
+
+Walk, collision, jump, place/break, five materials, day/night, island overview, world JSON save and restore.
+
+## Build on the starter
+
+The model functions `voxelWorld`, `movePlayer`, `raycastWorld`, `putBlock` and `importWorld` are the starting points for substantive changes. Preserve seed
+reproducibility and user controls while changing the domain behavior. A different brief can replace
+this starter's entire visual language. Keep the artifact self-contained and test the actual result.
+
+The source checkout builds these starters with `node store/tools/build-experiences.mjs`. Installed
+workspaces are editable HTML; no build tool, network dependency or paid service is required.
+
+## Verification
+
+Model census: `node --test store/tools/experience-tests/models.test.mjs` from the source checkout.
+Browser interactions, exports, same-origin APIs and manifest routing: see
+[`store/tools/experience-tests`](../../tools/experience-tests/README.md).
+
+`seed-verdict.sh` establishes only artifact presence and keeps `ready:false`. The agent must run
+and record real domain and browser checks before writing a ready verdict. No cross-device pixel or
+audio equality is promised. The research is inspiration; this is original code, not a wrapper of
+any cited third-party engine.
+
+## Check your actual edited model
+
+Run `node tools/check.mjs --seeds 100` in the workspace. It reads the pure model from
+`<script id="harness-model">` in the artifact, checks domain invariants, repeats each seed, and
+writes `.harness/model-check.json`. Preserve that script boundary when editing. Model checks are
+followed by browser interaction, exported-output inspection, and visual or listening review.
diff --git a/store/agents/voxel-worlds/harness.json b/store/agents/voxel-worlds/harness.json
new file mode 100644
index 000000000..a7a8dee86
--- /dev/null
+++ b/store/agents/voxel-worlds/harness.json
@@ -0,0 +1,35 @@
+{
+ "spec": 1,
+ "id": "autonomous/voxel-worlds",
+ "name": "Voxel Worlds",
+ "category": "Games",
+ "author": "Autonomous",
+ "description": "Build and walk a seeded voxel island. Sculpt terrain, place and break blocks, explore a cabin and lighthouse, change the light, and save your world.",
+ "engine": "claude",
+ "workspace": {
+ "template": "template",
+ "marker": "world/index.html",
+ "init": "toolchain/init-workspace.sh"
+ },
+ "agent": {
+ "instructions": "AGENTS.md",
+ "skills": [
+ "skills"
+ ],
+ "env": {
+ "VOXEL_DSH_DIR": "${dsh}"
+ }
+ },
+ "toolchain": {
+ "setup": "toolchain/setup.sh",
+ "doctor": "toolchain/doctor.sh"
+ },
+ "viewer": {
+ "use": "autonomous/web-viewer",
+ "artifactExtensions": [
+ ".html"
+ ],
+ "url": "http://127.0.0.1:${port}/?file=${artifact}"
+ },
+ "verdict": ".harness/verdict.json"
+}
diff --git a/store/agents/voxel-worlds/skills/world-builder/SKILL.md b/store/agents/voxel-worlds/skills/world-builder/SKILL.md
new file mode 100644
index 000000000..870d66ec6
--- /dev/null
+++ b/store/agents/voxel-worlds/skills/world-builder/SKILL.md
@@ -0,0 +1,73 @@
+---
+name: world-builder
+description: Build a playable 3D voxel world in one HTML file from a plain-English description. Use whenever the user asks for a world, a voxel scene, a Minecraft-style sandbox, a place to walk around, or a prompt-to-world build.
+---
+
+# world-builder
+
+Take the user's description and produce a **single self-contained `world/index.html`** that is
+walkable first-person, lets the player place and break blocks, has a day/night cycle, and runs
+entirely offline (all three.js/audio inline — no CDN at runtime). Everything ships in that one
+file so the web-viewer pane can load it directly.
+
+## The floor (do these first, in order)
+
+1. **Camera + controls.** First-person pointer-lock mouse-look, WASD movement, canvas click to
+ grab. Touch: a virtual stick / drag-to-look so it works on a phone too.
+2. **Terrain.** Generate from a seeded noise function so the same description + seed gives the same
+ world every time. Keep it small enough to walk easily (a few dozen blocks per axis).
+3. **Place & break.** A crosshair; left click breaks the targeted block, right click places a block
+ from a small hotbar. Visible block selection outline.
+4. **Day/night** — a slowly-moving sun/moon and sky color ramp (or at minimum a timed light shift).
+ A clock or sky clearly shows it.
+
+## The gold checklist (what separates a good world from a demo)
+
+- **Textured, not flat**: procedurally texture grass/dirt/stone/wood (noise + a few tones), so the
+ world reads as voxels from a real game, not colored boxes.
+- **HUD**: crosshair, a health/heart row, and a 5-slot hotbar (even if hotbar is read-only at
+ first).
+- **Specific palette terms win.** Concrete nouns ("dirt road through the center, river along the
+ eastern edge, wheat fields") produce adjacency-aware aligned things (roads join into junctions,
+ shorelines blend into sand). Vague nouns make generic mush. Ask one round of clarifying
+ questions only — then default aggressively.
+- **Audio**: at least a place/break click; a simple background tone is a bonus.
+
+## Verify like a visitor, not a compiler
+
+Load `world/index.html`, screenshot from the **player camera**, and look. Walk the world: can you
+actually get in and out of the water, up a slope, through a doorway? The camera is the referee —
+a world you cannot move through is not done no matter how the code reads. Render, look, fix,
+re-render.
+
+## Verdict feed
+
+Write `.harness/verdict.json` (in the workspace) at every change:
+
+```json
+{ "spec": 1, "ready": false, "summary": "walkable village: road, river, houses · day/night · no audio yet",
+ "findings": [{ "severity": "warning", "kind": "audio", "message": "no place/break sound yet" }],
+ "artifact": "world/index.html",
+ "phases": [{ "id": "world", "name": "World", "state": "done" },
+ { "id": "interaction", "name": "Interaction", "state": "active" },
+ { "id": "polish", "name": "Polish", "state": "pending" }],
+ "updatedAt": "2026-09-18T00:00:00Z" }
+```
+
+## Starting from Tidelands
+
+The template is functional: Walk, collision, jump, place/break, five materials, day/night, island overview, world JSON export.
+
+Keep its useful controls and exports when making a user's creation. Test the behavioral core
+(world geometry, collision, camera, raycast editing, day cycle) as well as the visible result. A self-contained HTML file can still have well-separated
+model, rendering, input and export functions. Do not turn a finished starter into a waiting screen.
+
+Presence-only helpers do not prove correctness or reproducibility. Record actual evidence before
+marking the result ready. Export and reopen the result as part of the handoff to the user.
+
+## Check your actual edited model
+
+Run `node tools/check.mjs --seeds 100` in the workspace. It reads the pure model from
+`<script id="harness-model">` in the artifact, checks domain invariants, repeats each seed, and
+writes `.harness/model-check.json`. Preserve that script boundary when editing. Model checks are
+followed by browser interaction, exported-output inspection, and visual or listening review.
diff --git a/store/agents/voxel-worlds/skills/world-builder/scripts/seed-verdict.sh b/store/agents/voxel-worlds/skills/world-builder/scripts/seed-verdict.sh
new file mode 100755
index 000000000..27e4755d4
--- /dev/null
+++ b/store/agents/voxel-worlds/skills/world-builder/scripts/seed-verdict.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# Presence is not evidence of correctness. Only the agent's actual checks may establish ready:true.
+set -eu
+ws="${1:?usage: seed-verdict.sh WORKSPACE}"
+mkdir -p "$ws/.harness"
+summary="No artifact yet"; phase=pending
+if [ -s "$ws/world/index.html" ]; then summary="Artifact available — browser verification pending"; phase=active; fi
+cat > "$ws/.harness/verdict.json" <<JSON
+{"spec":1,"ready":false,"summary":"$summary","artifact":"world/index.html","findings":[{"severity":"info","kind":"verification_pending","message":"File presence checked; behavior, output quality and reproducibility have not been verified by this helper."}],"phases":[{"id":"build","name":"Build","state":"$phase"},{"id":"verify","name":"Verify","state":"pending"}],"updatedAt":"$(date -u +%Y-%m-%dT%H:%M:%SZ)"}
+JSON
diff --git a/store/agents/voxel-worlds/store.json b/store/agents/voxel-worlds/store.json
new file mode 100644
index 000000000..c7fa91429
--- /dev/null
+++ b/store/agents/voxel-worlds/store.json
@@ -0,0 +1,15 @@
+{
+ "homepage": "https://github.com/autonomous-ai/openharness/tree/main/store/agents/voxel-worlds",
+ "license": "MIT",
+ "tagline": "Build and walk a seeded voxel island",
+ "screenshots": [
+ "https://raw.githubusercontent.com/autonomous-ai/openharness/main/store/showcase/voxel-worlds/starter.jpg"
+ ],
+ "examples": [
+ {
+ "prompt": "Turn this island into a harbor village with a walkable pier, a hilltop observatory, and lanterns along the road.",
+ "caption": "Tidelands · interactive offline starter",
+ "image": "https://raw.githubusercontent.com/autonomous-ai/openharness/main/store/showcase/voxel-worlds/starter.jpg"
+ }
+ ]
+}
diff --git a/store/agents/voxel-worlds/template/NOTES.md b/store/agents/voxel-worlds/template/NOTES.md
new file mode 100644
index 000000000..c034b8b79
--- /dev/null
+++ b/store/agents/voxel-worlds/template/NOTES.md
@@ -0,0 +1,4 @@
+# Tidelands workspace
+
+Open `world/index.html` in the pane, try the controls, then describe what you want to create.
+Keep your decisions in `world/DESIGN.md`. Save the exported result when you are ready.
diff --git a/store/agents/voxel-worlds/template/tools/check.mjs b/store/agents/voxel-worlds/template/tools/check.mjs
new file mode 100644
index 000000000..f8d823ba2
--- /dev/null
+++ b/store/agents/voxel-worlds/template/tools/check.mjs
@@ -0,0 +1,75 @@
+const CONFIG = {"id":"voxel-worlds","artifact":"world/index.html"};
+// Compiled into each workspace's tools/check.mjs. Tests the model in the ACTUAL edited HTML.
+import { readFile, mkdir, writeFile } from "node:fs/promises";
+import { createHash } from "node:crypto";
+import vm from "node:vm";
+import { resolve, dirname } from "node:path";
+
+const args = process.argv.slice(2),
+ i = args.indexOf("--seeds");
+const count = i === -1 ? 32 : Number(args[i + 1]);
+if (!Number.isInteger(count) || count < 1 || count > 1000)
+ throw new Error("--seeds must be an integer from 1 to 1000");
+const artifact = resolve(CONFIG.artifact);
+const html = await readFile(artifact, "utf8");
+const script = html.match(
+ /<script id="harness-model">([\s\S]*?)<\/script>/,
+)?.[1];
+if (!script)
+ throw new Error(
+ 'Keep the pure model in <script id="harness-model"> so this checker can exercise the actual artifact.',
+ );
+const expressions = {
+ "generative-art": `const m=artModel(SEED);const p=artPaths(m);({state:m,valid:p.length>0&&p.flat().every(([x,y])=>Number.isFinite(x)&&Number.isFinite(y)),metrics:{paths:p.length,palette:m.palette}})`,
+ "creative-direction": `const m=directionModel(SEED);const ratio=contrast(m.colors[0],m.colors[1]);({state:m,valid:ratio>=4.5,metrics:{direction:m.name,contrast:ratio}})`,
+ "lab-bench": `const p=experiment(SEED),e=treatmentEffect(p);({state:p,valid:p.length>1&&p.every(p=>Number.isFinite(p.x)&&Number.isFinite(p.y))&&Number.isFinite(e.low)&&e.low<=e.high,metrics:{samples:p.length,effect:e.difference,interval:[e.low,e.high]}})`,
+ "music-studio": `const s=musicScore(SEED),r=renderMusic(s);({state:Array.from(r.samples),valid:r.peak>.001&&r.peak<=.95&&r.samples.every(Number.isFinite),metrics:{seconds:r.duration,peak:r.peak,rms:r.rms}})`,
+ "game-master": `const m=arenaMatch(SEED),s=m.history.at(-1);({state:m,valid:m.history.length>1&&m.history.length<=10000&&s.units.every(u=>u.hp>=0&&u.x>=0&&u.x<m.map.w&&u.y>=0&&u.y<m.map.h),metrics:{turns:s.turn,score:s.score,winner:m.winner}})`,
+ "drone-pilot": `const s=flyAutopilot(SEED);({state:s,valid:s.finished&&!s.crashed&&s.passed===flightCourse(SEED).length,metrics:{seconds:s.time,passed:s.passed,missed:s.missed}})`,
+ "voxel-worlds": `const w=voxelWorld(SEED);let p={...w.spawn,vy:0,grounded:true};const clear=playerFits(w,p.x,p.y,p.z);for(let t=0;t<120;t++)p=movePlayer(w,p,{forward:1});({state:Array.from(w.blocks),valid:clear&&playerFits(w,p.x,p.y,p.z),metrics:{blocks:w.blocks.filter(Boolean).length,walkDistance:Math.hypot(p.x-w.spawn.x,p.z-w.spawn.z)}})`,
+};
+const expression = expressions[CONFIG.id];
+const digest = (value) =>
+ createHash("sha256").update(JSON.stringify(value)).digest("hex");
+const results = [];
+for (let seed = 0; seed < count; seed++) {
+ const run = () =>
+ vm.runInNewContext(
+ `${script}\n${expression}`,
+ { SEED: String(seed) },
+ { timeout: 10000 },
+ );
+ try {
+ const first = run(),
+ second = run(),
+ signature = digest(first.state),
+ repeat = digest(second.state);
+ results.push({
+ seed,
+ ok: first.valid && signature === repeat,
+ signature,
+ metrics: first.metrics,
+ });
+ } catch (error) {
+ results.push({ seed, ok: false, error: error.message });
+ }
+}
+const passed = results.filter((r) => r.ok).length;
+const report = {
+ spec: 1,
+ harness: CONFIG.id,
+ artifact: CONFIG.artifact,
+ checkedAt: new Date().toISOString(),
+ modelChecks: { passed, total: count },
+ scope:
+ "Pure model invariants and same-process repeatability. Browser interaction, layout, listening and export review still required.",
+ results,
+};
+const out = resolve(".harness/model-check.json");
+await mkdir(dirname(out), { recursive: true });
+await writeFile(out, JSON.stringify(report, null, 2) + "\n");
+console.log(
+ `${CONFIG.id}: ${passed}/${count} model checks passed. Report: ${out}`,
+);
+console.log(report.scope);
+if (passed !== count) process.exitCode = 1;
diff --git a/store/agents/voxel-worlds/template/world/index.html b/store/agents/voxel-worlds/template/world/index.html
new file mode 100644
index 000000000..ec50692ce
--- /dev/null
+++ b/store/agents/voxel-worlds/template/world/index.html
@@ -0,0 +1,1634 @@
+<!doctype html>
+<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
+<meta name="color-scheme" content="dark light"><title>TIDELANDS — Voxel Worlds</title>
+<!-- Built by store/tools/build-experiences.mjs. Edit this file freely in your workspace. -->
+<style>:root {
+ color-scheme: dark;
+ --bg: #111414;
+ --panel: #191e1c;
+ --line: #ffffff1c;
+ --ink: #f4f2e9;
+ --muted: #a1aaa4;
+ --accent: #d0f28a;
+ font:
+ 14px/1.5 -apple-system,
+ BlinkMacSystemFont,
+ "Segoe UI",
+ sans-serif;
+}
+* {
+ box-sizing: border-box;
+}
+body {
+ margin: 0;
+ background: var(--bg);
+ color: var(--ink);
+}
+button,
+input,
+select {
+ font: inherit;
+}
+button,
+a,
+input,
+select {
+ -webkit-tap-highlight-color: transparent;
+}
+button,
+a {
+ touch-action: manipulation;
+}
+button {
+ cursor: pointer;
+}
+button:disabled {
+ opacity: 0.45;
+ cursor: wait;
+}
+button:focus-visible,
+input:focus-visible,
+select:focus-visible,
+a:focus-visible {
+ outline: 2px solid var(--accent);
+ outline-offset: 4px;
+}
+button,
+input,
+select {
+ color: inherit;
+ background: transparent;
+ border: 1px solid var(--line);
+ border-radius: 5px;
+ padding: 9px 13px;
+}
+button:hover {
+ background: #ffffff0c;
+ border-color: var(--muted);
+}
+button.primary {
+ background: var(--accent);
+ color: #142015;
+ border-color: transparent;
+ font-weight: 650;
+}
+button[aria-pressed="true"] {
+ border-color: var(--accent);
+ color: var(--accent);
+}
+input[type="range"] {
+ accent-color: var(--accent);
+ padding: 0;
+ min-width: 0;
+}
+input[type="number"] {
+ width: 80px;
+}
+select {
+ background: var(--panel);
+}
+label {
+ cursor: pointer;
+}
+a {
+ color: inherit;
+}
+h1,
+h2,
+h3,
+p {
+ margin: 0;
+}
+h1 {
+ font-size: clamp(32px, 5vw, 64px);
+ line-height: 1.02;
+ letter-spacing: -0.055em;
+ font-weight: 550;
+}
+h2 {
+ font-weight: 550;
+ letter-spacing: -0.03em;
+}
+h3 {
+ font-size: 14px;
+ font-weight: 550;
+}
+.mono,
+.eyebrow {
+ font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
+}
+.eyebrow {
+ font-size: 10px;
+ letter-spacing: 0.16em;
+ text-transform: uppercase;
+ color: var(--muted);
+}
+.muted {
+ color: var(--muted);
+}
+.small {
+ font-size: 12px;
+}
+.masthead {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 20px;
+ padding: 19px 28px;
+ border-bottom: 1px solid var(--line);
+}
+.identity {
+ display: flex;
+ gap: 12px;
+ align-items: center;
+ white-space: nowrap;
+ font-size: 12px;
+ font-weight: 600;
+ letter-spacing: 0.04em;
+}
+.mark {
+ width: 25px;
+ height: 25px;
+ display: grid;
+ place-items: center;
+ border: 1px solid currentColor;
+ font-size: 17px;
+}
+.seed-form {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+}
+.seed-form label {
+ font:
+ 10px ui-monospace,
+ monospace;
+ text-transform: uppercase;
+ letter-spacing: 0.12em;
+ color: var(--muted);
+ margin-right: 4px;
+}
+.seed-form input {
+ width: 74px;
+ padding: 6px 8px;
+ font:
+ 12px ui-monospace,
+ monospace;
+}
+.seed-form button {
+ padding: 6px 10px;
+ font-size: 12px;
+}
+.intro {
+ padding: 32px 28px;
+ display: flex;
+ align-items: flex-end;
+ justify-content: space-between;
+ gap: 20px;
+}
+.intro p {
+ max-width: 440px;
+ color: var(--muted);
+ margin-top: 14px;
+}
+.intro .eyebrow {
+ margin-bottom: 12px;
+}
+.actions {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ flex-wrap: wrap;
+}
+.workspace {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) 270px;
+ gap: 22px;
+ padding: 0 28px 28px;
+}
+.panel {
+ background: var(--panel);
+ border: 1px solid var(--line);
+ border-radius: 8px;
+ overflow: hidden;
+}
+.panel-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 16px 20px;
+ border-bottom: 1px solid var(--line);
+ gap: 10px;
+}
+.side {
+ display: flex;
+ flex-direction: column;
+ gap: 20px;
+}
+.section {
+ border-top: 1px solid var(--line);
+ padding-top: 18px;
+}
+.section h3 {
+ margin-bottom: 15px;
+}
+.field {
+ display: grid;
+ gap: 7px;
+ margin: 14px 0;
+}
+.field > span {
+ display: flex;
+ justify-content: space-between;
+ font-size: 12px;
+ color: var(--muted);
+}
+.metrics {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ gap: 1px;
+ background: var(--line);
+ border: 1px solid var(--line);
+ border-radius: 6px;
+ overflow: hidden;
+}
+.metric {
+ background: var(--bg);
+ padding: 13px 15px;
+}
+.metric strong {
+ display: block;
+ font:
+ 24px ui-monospace,
+ monospace;
+ letter-spacing: -0.06em;
+}
+.metric span {
+ font-size: 10px;
+ color: var(--muted);
+ text-transform: uppercase;
+ letter-spacing: 0.09em;
+}
+canvas {
+ display: block;
+ max-width: 100%;
+}
+.status-line {
+ display: flex;
+ justify-content: space-between;
+ gap: 20px;
+ padding: 14px 28px;
+ border-top: 1px solid var(--line);
+ font:
+ 10px ui-monospace,
+ monospace;
+ color: var(--muted);
+}
+.dot {
+ width: 6px;
+ height: 6px;
+ display: inline-block;
+ background: var(--accent);
+ border-radius: 50%;
+ margin-right: 6px;
+}
+.toast {
+ position: fixed;
+ z-index: 99;
+ left: 50%;
+ bottom: 22px;
+ transform: translateX(-50%);
+ max-width: 90vw;
+ background: var(--ink);
+ color: var(--bg);
+ padding: 11px 18px;
+ border-radius: 6px;
+ box-shadow: 0 3px 30px #0004;
+ font-size: 12px;
+}
+.toast:empty {
+ display: none;
+}
+[hidden] {
+ display: none !important;
+}
+.sr-only {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ padding: 0;
+ margin: -1px;
+ overflow: hidden;
+ clip-path: inset(50%);
+ white-space: nowrap;
+ border: 0;
+}
+@media (max-width: 800px) {
+ .workspace {
+ grid-template-columns: 1fr;
+ }
+ .side {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ }
+ .intro {
+ align-items: flex-start;
+ flex-direction: column;
+ }
+ .intro h1 {
+ font-size: 44px;
+ }
+}
+@media (max-width: 480px) {
+ .masthead {
+ padding: 13px 16px;
+ gap: 8px;
+ flex-wrap: wrap;
+ }
+ .intro {
+ padding: 26px 16px;
+ }
+ .intro h1 {
+ font-size: 38px;
+ }
+ .workspace {
+ padding: 0 16px 20px;
+ gap: 18px;
+ }
+ .side {
+ grid-template-columns: 1fr;
+ }
+ .seed-form label {
+ display: none;
+ }
+ .status-line {
+ padding: 12px 16px;
+ }
+ .status-line span:last-child {
+ display: none;
+ }
+ .metrics .metric {
+ padding: 12px 10px;
+ }
+ .panel-head {
+ padding: 12px;
+ }
+ .actions {
+ gap: 6px;
+ }
+}
+@media (prefers-reduced-motion: reduce) {
+ *,
+ *::before,
+ *::after {
+ scroll-behavior: auto !important;
+ animation: none !important;
+ transition: none !important;
+ }
+}
+
+:root {
+ --bg: #203b37;
+ --ink: #f1f0d9;
+ --muted: #d6e2c8;
+ --line: #ddeacd45;
+ --accent: #d3e4a5;
+}
+.masthead {
+ position: absolute;
+ inset: 0 0 auto;
+ z-index: 5;
+ background: linear-gradient(#112b35b0, transparent);
+ border: 0;
+}
+.masthead input,
+.masthead button {
+ background: #18353655;
+}
+.mark {
+ border: 0;
+ font-size: 27px;
+}
+.world-stage {
+ position: relative;
+ height: 100dvh;
+ min-height: 560px;
+ background: #94b6bb;
+ overflow: hidden;
+}
+#world {
+ position: absolute;
+ inset: 0;
+ width: 100%;
+ height: 100%;
+ max-width: none;
+ touch-action: none;
+ outline-offset: -3px;
+}
+.world-heading {
+ position: absolute;
+ left: 30px;
+ top: 92px;
+ pointer-events: none;
+ text-shadow: 0 2px 25px #0d282966;
+}
+.world-heading .eyebrow {
+ font-size: 9px;
+}
+.world-heading h1 {
+ font:
+ clamp(50px, 6.5vw, 88px) / 0.91 Georgia,
+ serif;
+ letter-spacing: -0.065em;
+ margin: 14px 0 18px;
+}
+.world-heading > p:last-child {
+ font-size: 12px;
+ line-height: 1.7;
+}
+.world-toolbar {
+ position: absolute;
+ right: 22px;
+ top: 89px;
+ display: grid;
+ gap: 7px;
+}
+.world-toolbar button,
+.build-actions button,
+.world-time button,
+.world-pad button {
+ background: #17352eaa;
+ backdrop-filter: blur(8px);
+ font-size: 11px;
+}
+.build-actions .primary {
+ background: #d3e4a5;
+ color: #203b37;
+}
+.world-crosshair {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ font-size: 25px;
+ color: #fff9;
+ pointer-events: none;
+}
+.world-coordinates {
+ position: absolute;
+ left: 25px;
+ bottom: 184px;
+ display: grid;
+ gap: 3px;
+ font:
+ 9px/1.6 ui-monospace,
+ monospace;
+ text-shadow: 0 1px 3px #000;
+}
+.world-bottom {
+ position: absolute;
+ bottom: 24px;
+ left: 50%;
+ transform: translateX(-50%);
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 10px;
+ width: 90%;
+ pointer-events: none;
+}
+.world-bottom > p {
+ font:
+ 10px ui-monospace,
+ monospace;
+ text-align: center;
+ text-shadow: 0 1px 4px #000;
+ background: #153e3466;
+ padding: 6px 12px;
+ border-radius: 4px;
+}
+.hotbar {
+ display: flex;
+ gap: 6px;
+ pointer-events: auto;
+}
+.hotbar button {
+ width: 55px;
+ height: 54px;
+ background: #18382fd9;
+ border: 1px solid #ffffff33;
+ border-radius: 5px;
+ padding: 5px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ flex-direction: column;
+ gap: 4px;
+ font:
+ 8px ui-monospace,
+ monospace;
+}
+.hotbar button[aria-pressed="true"] {
+ border: 2px solid #edebb7;
+ box-shadow: 0 0 20px #b9d98e44;
+}
+.hotbar i {
+ width: 21px;
+ height: 21px;
+ box-shadow: inset -5px -5px #0002;
+ display: block;
+}
+.build-actions {
+ display: flex;
+ gap: 8px;
+ pointer-events: auto;
+}
+.world-time {
+ position: absolute;
+ right: 22px;
+ bottom: 184px;
+ display: grid;
+ gap: 7px;
+ width: 125px;
+ font:
+ 9px ui-monospace,
+ monospace;
+}
+.world-time input {
+ width: 100%;
+}
+.world-pad {
+ display: none;
+}
+.world-error {
+ position: absolute;
+ inset: 25% 10%;
+ background: #173d36ee;
+ padding: 30px;
+ border-radius: 8px;
+ z-index: 20;
+}
+.overview .world-crosshair {
+ display: none;
+}
+@media (max-width: 750px) {
+ .world-heading {
+ left: 20px;
+ top: 100px;
+ }
+ .world-heading h1 {
+ font-size: 56px;
+ }
+ .world-heading > p:last-child {
+ display: none;
+ }
+ .world-toolbar {
+ top: 90px;
+ right: 14px;
+ }
+ .world-toolbar button {
+ padding: 7px;
+ font-size: 10px;
+ }
+ .world-coordinates {
+ left: 17px;
+ bottom: 190px;
+ }
+ .world-time {
+ right: 14px;
+ bottom: 185px;
+ width: 100px;
+ }
+ .world-pad {
+ position: absolute;
+ display: grid;
+ grid-template-columns: repeat(3, 32px);
+ gap: 4px;
+ left: 16px;
+ bottom: 250px;
+ }
+ .world-pad button {
+ touch-action: none;
+ padding: 6px;
+ }
+ .world-pad button:first-child {
+ grid-column: 2;
+ }
+ .world-pad button:nth-child(2) {
+ grid-column: 1;
+ }
+ .world-pad button:last-child {
+ grid-column: 2;
+ }
+ .world-heading .eyebrow {
+ max-width: 120px;
+ }
+ .hotbar button {
+ width: 47px;
+ }
+ .world-bottom > p {
+ font-size: 9px;
+ max-width: 300px;
+ }
+ .world-bottom {
+ bottom: 16px;
+ }
+}
+</style></head><body>
+<header class="masthead"><div class="identity"><span class="mark" aria-hidden="true">▧</span>TIDELANDS</div>
+<form class="seed-form" id="seed-form"><label for="seed">Seed</label><input id="seed" aria-label="Seed" maxlength="128" autocomplete="off" spellcheck="false"><button type="submit">Apply</button><button id="next-seed" type="button" title="Next seed">↗ Next</button></form></header>
+<main class="world-stage">
+ <canvas
+ id="world"
+ tabindex="0"
+ aria-label="Walkable voxel island. Click to look around, use WASD to walk, Space to jump. Use the buttons to place or break blocks."
+ ></canvas>
+ <div class="world-heading">
+ <p class="eyebrow">A place worth getting lost in</p>
+ <h1>A little<br />wild.</h1>
+ <p>Walk the shoreline. Find the cabin.<br />Leave something of your own.</p>
+ </div>
+ <div class="world-toolbar">
+ <button id="overview">Island overview</button
+ ><button id="export-world">Save world ↗</button
+ ><button id="import-world">Open saved world</button
+ ><input
+ id="world-file"
+ type="file"
+ accept=".json,application/json"
+ hidden
+ /><button id="home">Return home</button>
+ </div>
+ <div class="world-crosshair" aria-hidden="true">+</div>
+ <div class="world-coordinates">
+ <span id="coordinates"></span><span id="world-clock"></span>
+ </div>
+ <div class="world-bottom">
+ <p id="target" role="status">
+ Click the world to look around · WASD to walk · Space to jump
+ </p>
+ <div
+ class="hotbar"
+ id="hotbar"
+ role="group"
+ aria-label="Building materials"
+ ></div>
+ <div class="build-actions">
+ <button id="break">Break block</button
+ ><button id="place" class="primary">Place block</button>
+ </div>
+ </div>
+ <div class="world-pad">
+ <button data-key="w" aria-label="Walk forward">↑</button
+ ><button data-key="a" aria-label="Walk left">←</button
+ ><button data-key="s" aria-label="Walk backward">↓</button
+ ><button data-key="d" aria-label="Walk right">→</button
+ ><button data-key=" " aria-label="Jump">↟</button>
+ </div>
+ <div class="world-time">
+ <label for="daylight">Time of day</label
+ ><input id="daylight" type="range" min="0" max="100" value="32" /><button
+ id="cycle"
+ aria-pressed="false"
+ >
+ Day cycle
+ </button>
+ </div>
+ <div class="world-error" id="world-error" hidden></div>
+</main>
+<div class="toast" id="toast" role="status"></div>
+<script id="harness-model">
+'use strict';
+// Shared deterministic primitives. Domain models use named streams so unrelated edits stay stable.
+function hash(value) {
+ let h = 2166136261;
+ for (const c of String(value)) h = Math.imul(h ^ c.charCodeAt(0), 16777619);
+ return h >>> 0;
+}
+function random(seed, stream = "main") {
+ let a = hash(`${seed}:${stream}`);
+ return () => {
+ a = (a + 0x6d2b79f5) | 0;
+ let t = Math.imul(a ^ (a >>> 15), 1 | a);
+ t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
+ };
+}
+const clamp = (n, lo, hi) => Math.max(lo, Math.min(hi, n));
+const lerp = (a, b, t) => a + (b - a) * t;
+const pick = (items, rng) => items[Math.floor(rng() * items.length)];
+function normal(rng) {
+ return (
+ Math.sqrt(-2 * Math.log(Math.max(1e-9, rng()))) *
+ Math.cos(2 * Math.PI * rng())
+ );
+}
+
+const blockTypes = [
+ null,
+ { name: "Grass", color: [0.4, 0.58, 0.31] },
+ { name: "Earth", color: [0.48, 0.34, 0.23] },
+ { name: "Stone", color: [0.51, 0.55, 0.53] },
+ { name: "Sand", color: [0.81, 0.74, 0.54] },
+ { name: "Timber", color: [0.43, 0.29, 0.17] },
+ { name: "Canopy", color: [0.25, 0.47, 0.27] },
+ { name: "Water", color: [0.24, 0.52, 0.59] },
+ { name: "Cedar", color: [0.68, 0.46, 0.28] },
+ { name: "Lantern", color: [1, 0.74, 0.32] },
+];
+function blockAt(world, x, y, z) {
+ if (x < 0 || y < 0 || z < 0 || x >= world.w || y >= world.h || z >= world.d)
+ return 0;
+ return world.blocks[(y * world.d + z) * world.w + x];
+}
+function putBlock(world, x, y, z, id) {
+ if (x < 0 || y < 0 || z < 0 || x >= world.w || y >= world.h || z >= world.d)
+ return false;
+ world.blocks[(y * world.d + z) * world.w + x] = id;
+ return true;
+}
+function solidBlock(id) {
+ return id !== 0 && id !== 7;
+}
+function groundAt(world, x, z) {
+ for (let y = world.h - 1; y >= 0; y--)
+ if (solidBlock(blockAt(world, Math.floor(x), y, Math.floor(z))))
+ return y + 1;
+ return 0;
+}
+function voxelWorld(seed) {
+ const world = {
+ seed: String(seed),
+ w: 48,
+ h: 28,
+ d: 48,
+ blocks: new Uint8Array(48 * 28 * 48),
+ },
+ r = random(seed, "terrain"),
+ phase = r() * 6.28,
+ phase2 = r() * 6.28;
+ for (let z = 0; z < world.d; z++)
+ for (let x = 0; x < world.w; x++) {
+ const radius = Math.hypot((x - 24) / 25, (z - 24) / 26);
+ let height = clamp(
+ Math.floor(
+ 5 +
+ (1 - radius) * 9 +
+ Math.sin(x * 0.23 + phase) * 1.6 +
+ Math.cos(z * 0.24 + phase2) * 1.6,
+ ),
+ 2,
+ 15,
+ );
+ if (z > 16 && Math.abs(x - (22 + Math.sin(z * 0.2) * 3)) < 1.6)
+ height = Math.min(height, 5);
+ for (let y = 0; y < Math.max(height, 6); y++)
+ putBlock(
+ world,
+ x,
+ y,
+ z,
+ y >= height
+ ? 7
+ : y === height - 1
+ ? height < 8
+ ? 4
+ : 1
+ : y > height - 4
+ ? 2
+ : 3,
+ );
+ }
+ const pad = (cx, cz, radius, height) => {
+ for (let z = cz - radius; z <= cz + radius; z++)
+ for (let x = cx - radius; x <= cx + radius; x++)
+ for (let y = 0; y < world.h; y++)
+ putBlock(world, x, y, z, y < height ? (y === height - 1 ? 1 : 2) : 0);
+ };
+ const spawnHeight = Math.max(8, groundAt(world, 31, 35));
+ pad(31, 35, 3, spawnHeight);
+ const hutHeight = Math.max(8, groundAt(world, 31, 25));
+ pad(31, 25, 4, hutHeight);
+ for (let x = 28; x <= 34; x++)
+ for (let z = 22; z <= 27; z++) {
+ putBlock(world, x, hutHeight, z, 8);
+ for (let y = 1; y <= 3; y++)
+ if (
+ (x === 28 || x === 34 || z === 22 || z === 27) &&
+ !(z === 27 && x === 31 && y <= 2) &&
+ !((x === 28 || x === 34) && z === 24 && y === 2)
+ )
+ putBlock(world, x, hutHeight + y, z, 5);
+ putBlock(world, x, hutHeight + 4, z, 8);
+ if (x > 28 && x < 34) putBlock(world, x, hutHeight + 5, z, 8);
+ }
+ putBlock(world, 30, hutHeight + 3, 26, 9);
+ const towerHeight = groundAt(world, 14, 16);
+ for (let y = towerHeight; y < towerHeight + 7; y++)
+ for (let x = 13; x <= 15; x++)
+ for (let z = 15; z <= 17; z++)
+ putBlock(world, x, y, z, y === towerHeight + 6 ? 9 : 4);
+ // A graded three-block-wide trail connects the cabin floor to the shore.
+ for (let z = 28; z <= 37; z++)
+ for (let x = 30; x <= 32; x++) {
+ const height = Math.round(
+ hutHeight + 1 + ((spawnHeight - hutHeight - 1) * (z - 28)) / 9,
+ );
+ for (let y = 0; y < world.h; y++)
+ putBlock(world, x, y, z, y < height ? (y === height - 1 ? 4 : 2) : 0);
+ }
+ const trees = random(seed, "trees");
+ for (let i = 0; i < 65; i++) {
+ const x = 3 + Math.floor(trees() * 42),
+ z = 3 + Math.floor(trees() * 42),
+ y = groundAt(world, x, z);
+ if (
+ y < 8 ||
+ y > 15 ||
+ blockAt(world, x, y - 1, z) !== 1 ||
+ (x > 26 && x < 37 && z > 19)
+ )
+ continue;
+ for (let j = 0; j < 4; j++) putBlock(world, x, y + j, z, 5);
+ for (let dy = 2; dy <= 5; dy++)
+ for (let dx = -2; dx <= 2; dx++)
+ for (let dz = -2; dz <= 2; dz++)
+ if (
+ Math.abs(dx) + Math.abs(dz) + (dy === 5 ? 1 : 0) < 4 &&
+ blockAt(world, x + dx, y + dy, z + dz) === 0
+ )
+ putBlock(world, x + dx, y + dy, z + dz, 6);
+ }
+ world.spawn = {
+ x: 31.5,
+ y: groundAt(world, 31, 29) + 0.03,
+ z: 29.5,
+ yaw: -0.65,
+ pitch: -0.18,
+ };
+ return world;
+}
+function raycastWorld(world, origin, direction, max = 7) {
+ let previous;
+ for (let d = 0; d <= max; d += 0.035) {
+ const p = {
+ x: Math.floor(origin.x + direction.x * d),
+ y: Math.floor(origin.y + direction.y * d),
+ z: Math.floor(origin.z + direction.z * d),
+ };
+ const id = blockAt(world, p.x, p.y, p.z);
+ if (solidBlock(id)) return { ...p, id, previous, distance: d };
+ previous = p;
+ }
+ return null;
+}
+function playerFits(world, x, y, z) {
+ for (const dx of [-0.24, 0.24])
+ for (const dz of [-0.24, 0.24])
+ for (const dy of [0.001, 0.85, 1.65])
+ if (
+ solidBlock(
+ blockAt(
+ world,
+ Math.floor(x + dx),
+ Math.floor(y + dy),
+ Math.floor(z + dz),
+ ),
+ )
+ )
+ return false;
+ return true;
+}
+function movePlayer(world, player, input, dt = 1 / 60) {
+ const p = { ...player };
+ const speed = input.sprint ? 6 : 3.8;
+ let dx =
+ Math.sin(p.yaw) * (input.forward || 0) +
+ Math.cos(p.yaw) * (input.right || 0),
+ dz =
+ Math.cos(p.yaw) * (input.forward || 0) -
+ Math.sin(p.yaw) * (input.right || 0);
+ const length = Math.max(1, Math.hypot(dx, dz));
+ dx = (dx / length) * speed * dt;
+ dz = (dz / length) * speed * dt;
+ const swimming =
+ blockAt(world, Math.floor(p.x), Math.floor(p.y + 0.3), Math.floor(p.z)) ===
+ 7;
+ for (const [axis, delta] of [
+ ["x", dx],
+ ["z", dz],
+ ]) {
+ const n = clamp(
+ p[axis] + delta,
+ 0.3,
+ (axis === "x" ? world.w : world.d) - 0.3,
+ ),
+ x = axis === "x" ? n : p.x,
+ z = axis === "z" ? n : p.z;
+ if (playerFits(world, x, p.y, z)) p[axis] = n;
+ else if (
+ (p.grounded || swimming) &&
+ playerFits(world, x, p.y + (swimming ? 1.3 : 1.05), z)
+ ) {
+ p[axis] = n;
+ p.y += swimming ? 1.3 : 1.05;
+ }
+ }
+ if (input.jump && (p.grounded || swimming)) p.vy = 6;
+ p.vy = (p.vy || 0) - 16 * dt;
+ if (swimming && p.y < 5.85) p.vy = Math.max(p.vy, (5.85 - p.y) * 5);
+ const nextY = p.y + p.vy * dt;
+ if (playerFits(world, p.x, nextY, p.z)) {
+ p.y = nextY;
+ p.grounded = false;
+ } else {
+ if (p.vy < 0) {
+ p.grounded = true;
+ p.y = Math.ceil(nextY);
+ }
+ p.vy = 0;
+ }
+ if (p.y < 0) {
+ Object.assign(p, world.spawn, { vy: 0, grounded: true });
+ }
+ return p;
+}
+
+function importWorld(value) {
+ if (
+ !value ||
+ value.format !== "tidelands-1" ||
+ JSON.stringify(value.size) !== "[48,28,48]" ||
+ !Array.isArray(value.blocks) ||
+ value.blocks.length !== 48 * 28 * 48 ||
+ !value.blocks.every(
+ (n) => Number.isInteger(n) && n >= 0 && n < blockTypes.length,
+ )
+ )
+ throw new Error("This file is not a valid Tidelands world.");
+ const world = {
+ seed: String(value.seed).slice(0, 128),
+ w: 48,
+ h: 28,
+ d: 48,
+ blocks: Uint8Array.from(value.blocks),
+ };
+ const p = value.player;
+ if (
+ !p ||
+ !["x", "y", "z", "yaw", "pitch"].every((k) => Number.isFinite(p[k])) ||
+ p.x < 0.3 ||
+ p.x > 47.7 ||
+ p.z < 0.3 ||
+ p.z > 47.7 ||
+ p.y < 0 ||
+ p.y > 28 ||
+ !playerFits(world, p.x, p.y, p.z)
+ )
+ throw new Error("The saved player position is invalid.");
+ world.spawn = {
+ x: p.x,
+ y: p.y,
+ z: p.z,
+ yaw: p.yaw,
+ pitch: clamp(p.pitch, -1.3, 1.3),
+ };
+ return {
+ world,
+ player: { ...world.spawn, vy: 0, grounded: false },
+ timeOfDay: Number.isFinite(value.timeOfDay)
+ ? clamp(value.timeOfDay, 0, 1)
+ : 0.32,
+ };
+}
+
+</script>
+<script>
+'use strict';
+const $ = (s) => document.querySelector(s);
+const $$ = (s) => [...document.querySelectorAll(s)];
+const params = new URLSearchParams(location.search);
+let seed = (params.get("seed") || "42").slice(0, 128);
+const reducedMotion = matchMedia("(prefers-reduced-motion: reduce)").matches;
+const parentMessage = (message) => {
+ if (parent !== window) parent.postMessage(message, "*");
+};
+function toast(message) {
+ $("#toast").textContent = message;
+ clearTimeout(toast.timer);
+ toast.timer = setTimeout(() => {
+ $("#toast").textContent = "";
+ }, 3500);
+}
+function saveFile(name, content, type = "application/json") {
+ const blob =
+ content instanceof Blob ? content : new Blob([content], { type });
+ const url = URL.createObjectURL(blob),
+ a = document.createElement("a");
+ a.href = url;
+ a.download = name;
+ document.body.append(a);
+ a.click();
+ a.remove();
+ setTimeout(() => URL.revokeObjectURL(url), 30000);
+}
+function canvasPNG(canvas, name) {
+ canvas.toBlob((blob) => {
+ if (blob) saveFile(name, blob);
+ else toast("Image export failed. Please try again.");
+ });
+}
+function setSeed(value) {
+ seed = String(value).trim().slice(0, 128) || "42";
+ $("#seed").value = seed;
+ const url = new URL(location.href);
+ url.searchParams.set("seed", seed);
+ try {
+ history.replaceState(null, "", url);
+ } catch {
+ /* Opaque-origin iframe: the shell owns its URL. */
+ }
+ parentMessage({ type: "harness:state", seed });
+ dispatchEvent(new CustomEvent("seedchange", { detail: seed }));
+}
+$("#seed").value = seed;
+$("#seed-form").addEventListener("submit", (e) => {
+ e.preventDefault();
+ setSeed($("#seed").value);
+});
+$("#next-seed").addEventListener("click", () =>
+ setSeed(/^\d{1,9}$/.test(seed) ? Number(seed) + 1 : hash(seed)),
+);
+function fitCanvas(canvas, draw, maxDpr = 2) {
+ const observer = new ResizeObserver(() => {
+ const box = canvas.getBoundingClientRect(),
+ dpr = Math.min(devicePixelRatio || 1, maxDpr);
+ canvas.width = Math.max(1, Math.round(box.width * dpr));
+ canvas.height = Math.max(1, Math.round(box.height * dpr));
+ draw?.();
+ });
+ observer.observe(canvas);
+ return observer;
+}
+const editable = (target) =>
+ target instanceof Element &&
+ !!target.closest("input,textarea,select,[contenteditable=true]");
+addEventListener("error", (e) =>
+ parentMessage({ type: "harness:error", message: e.message }),
+);
+addEventListener("unhandledrejection", (e) =>
+ parentMessage({
+ type: "harness:error",
+ message: String(e.reason?.message || e.reason),
+ }),
+);
+function ready() {
+ document.body.dataset.ready = "true";
+ parentMessage({ type: "harness:ready", title: document.title, seed });
+}
+
+let worldDirty = true;
+let world,
+ player,
+ targetBlock,
+ gl,
+ program,
+ worldBuffer,
+ worldVertexCount = 0,
+ lineBuffer,
+ keys = {},
+ selected = 8,
+ overview = false,
+ cycling = false,
+ timeOfDay = 0.32,
+ lastWorldTime = 0,
+ worldAccum = 0,
+ drag = null,
+ edited = 0;
+const canvas = $("#world");
+function shader(type, source) {
+ const s = gl.createShader(type);
+ gl.shaderSource(s, source);
+ gl.compileShader(s);
+ if (!gl.getShaderParameter(s, gl.COMPILE_STATUS))
+ throw new Error(gl.getShaderInfoLog(s));
+ return s;
+}
+function initGL() {
+ gl = canvas.getContext("webgl", {
+ antialias: true,
+ alpha: true,
+ preserveDrawingBuffer: true,
+ });
+ if (!gl)
+ throw new Error(
+ "This world needs WebGL. Enable hardware acceleration or try another browser.",
+ );
+ program = gl.createProgram();
+ gl.attachShader(
+ program,
+ shader(
+ gl.VERTEX_SHADER,
+ `attribute vec3 position;attribute vec3 color;attribute vec3 normal;attribute vec2 uv;uniform vec3 eye;uniform vec3 right;uniform vec3 up;uniform vec3 forward;uniform float aspect;varying vec3 vColor;varying vec2 vUV;varying float distance;varying float light;void main(){vec3 p=position-eye;float z=dot(p,forward);gl_Position=vec4(dot(p,right)*1.4/aspect,dot(p,up)*1.4,1.0005*z-.100025,z);vColor=color;vUV=uv;distance=length(p);light=.65+max(0.,dot(normal,normalize(vec3(-.4,.9,.3))))*.35;}`,
+ ),
+ );
+ gl.attachShader(
+ program,
+ shader(
+ gl.FRAGMENT_SHADER,
+ `precision mediump float;varying vec3 vColor;varying vec2 vUV;varying float distance;varying float light;uniform vec3 sky;uniform float day;void main(){vec2 pixel=floor(vUV*12.);float grain=fract(sin(dot(pixel,vec2(12.9898,78.233)))*43758.5453);float edge=step(.04,fract(vUV.x))*step(.04,fract(vUV.y));if(vColor.b>vColor.r*1.5){grain=.6;edge=1.;}vec3 c=vColor*(.86+grain*.2)*light*(.25+day*.75)*(.88+.12*edge);gl_FragColor=vec4(mix(c,sky,smoothstep(35.,150.,distance)*.65),1.);}`,
+ ),
+ );
+ gl.linkProgram(program);
+ if (!gl.getProgramParameter(program, gl.LINK_STATUS))
+ throw new Error(gl.getProgramInfoLog(program));
+ gl.useProgram(program);
+ gl.enable(gl.DEPTH_TEST);
+ worldBuffer = gl.createBuffer();
+ lineBuffer = gl.createBuffer();
+}
+const faces = [
+ {
+ n: [1, 0, 0],
+ v: [
+ [1, 0, 0],
+ [1, 1, 0],
+ [1, 1, 1],
+ [1, 0, 1],
+ ],
+ },
+ {
+ n: [-1, 0, 0],
+ v: [
+ [0, 0, 1],
+ [0, 1, 1],
+ [0, 1, 0],
+ [0, 0, 0],
+ ],
+ },
+ {
+ n: [0, 1, 0],
+ v: [
+ [0, 1, 1],
+ [1, 1, 1],
+ [1, 1, 0],
+ [0, 1, 0],
+ ],
+ },
+ {
+ n: [0, -1, 0],
+ v: [
+ [0, 0, 0],
+ [1, 0, 0],
+ [1, 0, 1],
+ [0, 0, 1],
+ ],
+ },
+ {
+ n: [0, 0, 1],
+ v: [
+ [1, 0, 1],
+ [1, 1, 1],
+ [0, 1, 1],
+ [0, 0, 1],
+ ],
+ },
+ {
+ n: [0, 0, -1],
+ v: [
+ [0, 0, 0],
+ [0, 1, 0],
+ [1, 1, 0],
+ [1, 0, 0],
+ ],
+ },
+];
+function meshWorld() {
+ const data = [],
+ uvs = [
+ [0, 0],
+ [0, 1],
+ [1, 1],
+ [1, 0],
+ ];
+ for (let y = 0; y < world.h; y++)
+ for (let z = 0; z < world.d; z++)
+ for (let x = 0; x < world.w; x++) {
+ const id = blockAt(world, x, y, z);
+ if (!id) continue;
+ for (const face of faces) {
+ const [nx, ny, nz] = face.n,
+ next = blockAt(world, x + nx, y + ny, z + nz);
+ if (next && (id === 7 || next !== 7)) continue;
+ let color = blockTypes[id].color;
+ if (id === 1 && ny === 0) color = [0.43, 0.43, 0.25];
+ if (id === 7 && ny < 1) continue;
+ for (const i of [0, 1, 2, 0, 2, 3])
+ data.push(
+ x + face.v[i][0],
+ y + face.v[i][1],
+ z + face.v[i][2],
+ ...color,
+ ...face.n,
+ ...uvs[i],
+ );
+ }
+ }
+ for (const [x1, z1, x2, z2] of [
+ [-160, -160, 208, 0],
+ [-160, 48, 208, 208],
+ [-160, 0, 0, 48],
+ [48, 0, 208, 48],
+ ]) {
+ const vertices = [
+ [x1, 6, z1],
+ [x2, 6, z1],
+ [x2, 6, z2],
+ [x1, 6, z2],
+ ];
+ for (const i of [0, 1, 2, 0, 2, 3])
+ data.push(
+ ...vertices[i],
+ 0.24,
+ 0.52,
+ 0.59,
+ 0,
+ 1,
+ 0,
+ vertices[i][0],
+ vertices[i][2],
+ );
+ }
+ gl.bindBuffer(gl.ARRAY_BUFFER, worldBuffer);
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(data), gl.STATIC_DRAW);
+ worldVertexCount = data.length / 11;
+}
+function bindVertices(buffer) {
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
+ for (const [name, size, offset] of [
+ ["position", 3, 0],
+ ["color", 3, 3],
+ ["normal", 3, 6],
+ ["uv", 2, 9],
+ ]) {
+ const loc = gl.getAttribLocation(program, name);
+ gl.enableVertexAttribArray(loc);
+ gl.vertexAttribPointer(loc, size, gl.FLOAT, false, 44, offset * 4);
+ }
+}
+function drawWorld() {
+ if (!gl || !world) return;
+ const w = canvas.width,
+ h = canvas.height;
+ gl.viewport(0, 0, w, h);
+ const daylight = 0.25 + 0.75 * Math.max(0, Math.sin(timeOfDay * Math.PI * 2)),
+ sky = [
+ lerp(0.075, 0.64, daylight),
+ lerp(0.12, 0.76, daylight),
+ lerp(0.19, 0.76, daylight),
+ ];
+ canvas.style.background = `radial-gradient(circle at 72% 20%,rgba(255,239,182,${daylight}) 0 3%,transparent 3.2%),linear-gradient(180deg,rgb(${sky.map((n) => Math.round(n * 180)).join(",")}),rgb(${sky.map((n) => Math.round(n * 255)).join(",")}) 65%)`;
+ gl.clearColor(0, 0, 0, 0);
+ gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+ const camera = overview
+ ? { x: 57, y: 36, z: 62, yaw: -2.4, pitch: -0.53 }
+ : { ...player, y: player.y + 1.6 };
+ const { yaw, pitch } = camera,
+ forward = [
+ Math.sin(yaw) * Math.cos(pitch),
+ Math.sin(pitch),
+ Math.cos(yaw) * Math.cos(pitch),
+ ],
+ right = [Math.cos(yaw), 0, -Math.sin(yaw)],
+ up = [
+ -Math.sin(yaw) * Math.sin(pitch),
+ Math.cos(pitch),
+ -Math.cos(yaw) * Math.sin(pitch),
+ ];
+ for (const [name, value] of [
+ ["eye", [camera.x, camera.y, camera.z]],
+ ["forward", forward],
+ ["right", right],
+ ["up", up],
+ ["sky", sky],
+ ])
+ gl.uniform3fv(gl.getUniformLocation(program, name), value);
+ gl.uniform1f(gl.getUniformLocation(program, "aspect"), w / h);
+ gl.uniform1f(gl.getUniformLocation(program, "day"), daylight);
+ bindVertices(worldBuffer);
+ gl.drawArrays(gl.TRIANGLES, 0, worldVertexCount);
+ targetBlock = overview
+ ? null
+ : raycastWorld(
+ world,
+ { x: camera.x, y: camera.y, z: camera.z },
+ { x: forward[0], y: forward[1], z: forward[2] },
+ );
+ if (targetBlock) {
+ const { x, y, z } = targetBlock,
+ data = [],
+ corners = [
+ [0, 0, 0],
+ [1, 0, 0],
+ [1, 1, 0],
+ [0, 1, 0],
+ [0, 0, 1],
+ [1, 0, 1],
+ [1, 1, 1],
+ [0, 1, 1],
+ ];
+ for (const [a, b] of [
+ [0, 1],
+ [1, 2],
+ [2, 3],
+ [3, 0],
+ [4, 5],
+ [5, 6],
+ [6, 7],
+ [7, 4],
+ [0, 4],
+ [1, 5],
+ [2, 6],
+ [3, 7],
+ ])
+ for (const i of [a, b])
+ data.push(
+ x + corners[i][0] * 1.004 - 0.002,
+ y + corners[i][1] * 1.004 - 0.002,
+ z + corners[i][2] * 1.004 - 0.002,
+ 1,
+ 1,
+ 0.78,
+ 0,
+ 1,
+ 0,
+ 0.5,
+ 0.5,
+ );
+ gl.bindBuffer(gl.ARRAY_BUFFER, lineBuffer);
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(data), gl.DYNAMIC_DRAW);
+ bindVertices(lineBuffer);
+ gl.drawArrays(gl.LINES, 0, data.length / 11);
+ }
+ $("#target").textContent = overview
+ ? "An island shaped by your seed. Return to the trail to build."
+ : targetBlock
+ ? `${blockTypes[targetBlock.id].name} · ${targetBlock.distance.toFixed(1)} m · left click breaks / right click places`
+ : "Click to look · WASD to walk · Space to jump · drag to look on touch";
+ $("#coordinates").textContent =
+ `${player.x.toFixed(1)} / ${player.y.toFixed(1)} / ${player.z.toFixed(1)} · ${edited} edits`;
+ const hour = Math.floor(timeOfDay * 24);
+ $("#world-clock").textContent =
+ `${String(hour).padStart(2, "0")}:${String(Math.floor(timeOfDay * 24 * 60) % 60).padStart(2, "0")} · island ${seed.slice(0, 14)}`;
+}
+let clickAudio;
+function blockClick() {
+ try {
+ clickAudio ??= new (window.AudioContext || window.webkitAudioContext)();
+ clickAudio.resume();
+ const o = clickAudio.createOscillator(),
+ g = clickAudio.createGain();
+ o.type = "triangle";
+ o.frequency.value = selected === 9 ? 660 : 180;
+ g.gain.setValueAtTime(0.07, clickAudio.currentTime);
+ g.gain.exponentialRampToValueAtTime(0.001, clickAudio.currentTime + 0.075);
+ o.connect(g).connect(clickAudio.destination);
+ o.start();
+ o.stop(clickAudio.currentTime + 0.08);
+ } catch {}
+}
+function editBlock(place) {
+ if (!targetBlock) return toast("Look at a nearby block first.");
+ const p = place ? targetBlock.previous : targetBlock;
+ if (!p || p.y < 1) return toast("The foundation stays in place.");
+ if (
+ place &&
+ Math.abs(p.x + 0.5 - player.x) < 0.75 &&
+ Math.abs(p.z + 0.5 - player.z) < 0.75 &&
+ p.y < player.y + 1.8 &&
+ p.y + 1 > player.y
+ )
+ return toast("Step back a little before placing that block.");
+ if (putBlock(world, p.x, p.y, p.z, place ? selected : 0)) {
+ edited++;
+ meshWorld();
+ blockClick();
+ drawWorld();
+ }
+}
+function newWorld() {
+ world = voxelWorld(seed);
+ player = { ...world.spawn, vy: 0, grounded: true };
+ edited = 0;
+ meshWorld();
+ drawWorld();
+}
+for (const [id, i] of [1, 3, 5, 8, 9].map((id, i) => [id, i])) {
+ const b = document.createElement("button");
+ b.setAttribute("aria-label", blockTypes[id].name);
+ b.title = `${i + 1}: ${blockTypes[id].name}`;
+ b.setAttribute("aria-pressed", selected === id);
+ const sw = document.createElement("i");
+ sw.style.background = `rgb(${blockTypes[id].color.map((n) => Math.round(n * 255)).join(",")})`;
+ b.append(sw, document.createTextNode(blockTypes[id].name));
+ b.onclick = () => {
+ selected = id;
+ $$("#hotbar button").forEach((button, j) =>
+ button.setAttribute("aria-pressed", j === i),
+ );
+ };
+ $("#hotbar").append(b);
+}
+$("#break").onclick = () => editBlock(false);
+$("#place").onclick = () => editBlock(true);
+$("#overview").onclick = () => {
+ overview = !overview;
+ document.body.classList.toggle("overview", overview);
+ $("#overview").textContent = overview
+ ? "Back to the trail"
+ : "Island overview";
+ document.exitPointerLock?.();
+ drawWorld();
+};
+$("#home").onclick = () => {
+ player = { ...world.spawn, vy: 0, grounded: true };
+ overview = false;
+ document.body.classList.remove("overview");
+ $("#overview").textContent = "Island overview";
+ drawWorld();
+};
+$("#daylight").oninput = () => {
+ timeOfDay = +$("#daylight").value / 100;
+ drawWorld();
+};
+$("#cycle").onclick = () => {
+ cycling = !cycling;
+ $("#cycle").setAttribute("aria-pressed", cycling);
+};
+$("#export-world").onclick = () =>
+ saveFile(
+ `tidelands-${hash(seed)}.json`,
+ JSON.stringify({
+ format: "tidelands-1",
+ seed,
+ size: [world.w, world.h, world.d],
+ blocks: Array.from(world.blocks),
+ player,
+ timeOfDay,
+ }),
+ );
+canvas.oncontextmenu = (e) => e.preventDefault();
+canvas.onpointerdown = (e) => {
+ canvas.focus();
+ if (overview) return;
+ if (document.pointerLockElement === canvas) {
+ editBlock(e.button === 2);
+ return;
+ }
+ drag = { x: e.clientX, y: e.clientY };
+ if (e.pointerType === "mouse")
+ canvas.requestPointerLock?.()?.catch?.(() => toast("Drag to look around."));
+ else canvas.setPointerCapture(e.pointerId);
+};
+canvas.onpointerup = canvas.onpointercancel = () => {
+ drag = null;
+};
+addEventListener("pointerup", () => {
+ drag = null;
+});
+document.addEventListener("pointerlockchange", () => {
+ drag = null;
+});
+canvas.onpointermove = (e) => {
+ if (overview) return;
+ let dx = 0,
+ dy = 0;
+ if (document.pointerLockElement === canvas) {
+ dx = e.movementX;
+ dy = e.movementY;
+ } else if (drag) {
+ dx = e.clientX - drag.x;
+ dy = e.clientY - drag.y;
+ drag = { x: e.clientX, y: e.clientY };
+ }
+ if (dx || dy) worldDirty = true;
+ player.yaw += dx * 0.004;
+ player.pitch = clamp(player.pitch - dy * 0.004, -1.3, 1.3);
+};
+addEventListener("keydown", (e) => {
+ if (editable(e.target)) return;
+ const key = e.key.toLowerCase();
+ if (
+ [
+ "w",
+ "a",
+ "s",
+ "d",
+ " ",
+ "shift",
+ "arrowup",
+ "arrowdown",
+ "arrowleft",
+ "arrowright",
+ ].includes(key)
+ ) {
+ e.preventDefault();
+ keys[key] = true;
+ }
+ if (/^[1-5]$/.test(key)) $$("#hotbar button")[+key - 1].click();
+});
+addEventListener("keyup", (e) => {
+ keys[e.key.toLowerCase()] = false;
+});
+addEventListener("blur", () => {
+ keys = {};
+ drag = null;
+});
+$$(".world-pad button").forEach((b) => {
+ b.onpointerdown = (e) => {
+ e.preventDefault();
+ keys[b.dataset.key] = true;
+ b.setPointerCapture(e.pointerId);
+ };
+ b.onpointerup = b.onpointercancel = () => {
+ keys[b.dataset.key] = false;
+ };
+});
+function worldFrame(time) {
+ const delta = Math.min(0.1, (time - lastWorldTime) / 1000 || 0);
+ lastWorldTime = time;
+ if (!document.hidden) {
+ const before = { x: player.x, y: player.y, z: player.z };
+ if (!overview) {
+ worldAccum += delta;
+ while (worldAccum >= 1 / 60) {
+ player = movePlayer(world, player, {
+ forward:
+ (keys.w || keys.arrowup ? 1 : 0) -
+ (keys.s || keys.arrowdown ? 1 : 0),
+ right:
+ (keys.d || keys.arrowright ? 1 : 0) -
+ (keys.a || keys.arrowleft ? 1 : 0),
+ jump: keys[" "],
+ sprint: keys.shift,
+ });
+ worldAccum -= 1 / 60;
+ }
+ }
+ if (cycling) {
+ timeOfDay = (timeOfDay + delta / 240) % 1;
+ $("#daylight").value = timeOfDay * 100;
+ }
+ if (
+ worldDirty ||
+ cycling ||
+ Math.hypot(
+ player.x - before.x,
+ player.y - before.y,
+ player.z - before.z,
+ ) > 0.0001
+ ) {
+ drawWorld();
+ worldDirty = false;
+ }
+ }
+ requestAnimationFrame(worldFrame);
+}
+try {
+ initGL();
+ newWorld();
+ fitCanvas(canvas, drawWorld, 1.5);
+ addEventListener("seedchange", newWorld);
+ requestAnimationFrame(worldFrame);
+ ready();
+} catch (error) {
+ $("#world-error").hidden = false;
+ $("#world-error").textContent = error.message;
+ parentMessage({ type: "harness:error", message: error.message });
+}
+
+$("#import-world").onclick = () => $("#world-file").click();
+$("#world-file").onchange = async (e) => {
+ const file = e.target.files[0];
+ if (!file) return;
+ try {
+ if (file.size > 2 * 1024 * 1024)
+ throw new Error("Choose a Tidelands JSON file smaller than 2 MiB.");
+ const restored = importWorld(JSON.parse(await file.text()));
+ setSeed(restored.world.seed);
+ world = restored.world;
+ player = restored.player;
+ timeOfDay = restored.timeOfDay;
+ $("#daylight").value = timeOfDay * 100;
+ edited = 0;
+ meshWorld();
+ drawWorld();
+ toast("Your world is restored.");
+ } catch (error) {
+ toast(error.message);
+ } finally {
+ e.target.value = "";
+ }
+};
+
+</script></body></html>
diff --git a/store/agents/voxel-worlds/test/toolchain.test.mjs b/store/agents/voxel-worlds/test/toolchain.test.mjs
new file mode 100644
index 000000000..15b7363be
--- /dev/null
+++ b/store/agents/voxel-worlds/test/toolchain.test.mjs
@@ -0,0 +1,75 @@
+// The Voxel Worlds harness scripts, run the way Harness runs them. Copy the starter's contract and
+// keep it passing as the harness grows.
+// node --test test/*.test.mjs
+import assert from 'node:assert/strict'
+import { spawnSync } from 'node:child_process'
+import { accessSync, constants, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { after, test } from 'node:test'
+
+const here = fileURLToPath(new URL('..', import.meta.url))
+const manifest = JSON.parse(readFileSync(join(here, 'harness.json'), 'utf8'))
+const scratch = []
+after(() => { for (const dir of scratch) rmSync(dir, { recursive: true, force: true }) })
+
+function tempDir() {
+ const dir = mkdtempSync(join(tmpdir(), 'voxel-'))
+ scratch.push(dir)
+ return dir
+}
+
+function run(script, { cwd = here, env = {} } = {}) {
+ const merged = { ...process.env }
+ for (const [key, value] of Object.entries(env)) value === null ? delete merged[key] : (merged[key] = value)
+ const result = spawnSync(join(here, script), { cwd, env: merged, encoding: 'utf8' })
+ return { code: result.status, stdout: result.stdout, stderr: result.stderr }
+}
+
+test('every script the manifest names is in the folder and executable', () => {
+ for (const script of [manifest.workspace.init, manifest.toolchain.setup, manifest.toolchain.doctor]) {
+ assert.doesNotThrow(() => accessSync(join(here, script), constants.X_OK), script)
+ }
+})
+
+test('setup installs nothing and succeeds quietly', () => {
+ assert.deepEqual(run(manifest.toolchain.setup), { code: 0, stdout: '', stderr: '' })
+})
+
+test('doctor says ok when sh is on PATH', () => {
+ const { code } = run(manifest.toolchain.doctor)
+ assert.equal(code, 0)
+})
+
+test('init lays out a workspace and seeds a not-ready verdict', () => {
+ const workspace = tempDir()
+ assert.equal(run(manifest.workspace.init, { cwd: workspace, env: { HARNESS_DSH: manifest.id } }).code, 0)
+ const verdict = JSON.parse(readFileSync(join(workspace, '.harness/verdict.json'), 'utf8'))
+ assert.equal(verdict.ready, false)
+ assert.equal(readFileSync(join(workspace, '.harness-initialized'), 'utf8'), `initialized by ${manifest.id}\n`)
+})
+
+test('the manifest names a viewer package and an HTML artifact', () => {
+ assert.equal(manifest.viewer.use, 'autonomous/web-viewer')
+ assert.deepEqual(manifest.viewer.artifactExtensions, ['.html'])
+})
+
+test('seed-verdict reports artifact presence without inventing verification', () => {
+ const workspace = tempDir()
+ run(manifest.workspace.init, { cwd: workspace })
+ // the script takes the workspace by argument and writes the feed inside it
+ const script = join(here, 'skills/world-builder/scripts/seed-verdict.sh')
+ assert.equal(spawnSync(script, [workspace], { cwd: workspace, encoding: 'utf8' }).status, 0)
+ assert.equal(JSON.parse(readFileSync(join(workspace, '.harness/verdict.json'), 'utf8')).ready, false)
+ // HTML presence alone must not assert that gameplay was verified
+ mkdirSync(join(workspace, 'world'), { recursive: true })
+ writeFileSync(join(workspace, 'world/index.html'), '<!doctype html><title>w</title>')
+ assert.equal(spawnSync(script, [workspace], { cwd: workspace, encoding: 'utf8' }).status, 0)
+ assert.equal(JSON.parse(readFileSync(join(workspace, '.harness/verdict.json'), 'utf8')).ready, false)
+})
+
+test('the manifest routes the actual nested artifact through the shared viewer', () => {
+ assert.equal(manifest.viewer.url, 'http://127.0.0.1:${port}/?file=${artifact}')
+ assert.ok(manifest.workspace.marker.endsWith('/index.html'))
+})
diff --git a/store/agents/voxel-worlds/toolchain/doctor.sh b/store/agents/voxel-worlds/toolchain/doctor.sh
new file mode 100755
index 000000000..76844330b
--- /dev/null
+++ b/store/agents/voxel-worlds/toolchain/doctor.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# Exit 0 when this machine can run the harness. Print one line per check; Harness shows them.
+command -v sh >/dev/null 2>&1 && echo "ok sh (world generator)" || { echo "miss sh"; exit 1; }
+# A browser pass helps the agent verify; warn, don't fail, without it.
+command -v node >/dev/null 2>&1 && echo "ok node (for headless verify)" || echo "note node optional: camera-verify needs a browser"
+exit 0
diff --git a/store/agents/voxel-worlds/toolchain/init-workspace.sh b/store/agents/voxel-worlds/toolchain/init-workspace.sh
new file mode 100755
index 000000000..faeead7de
--- /dev/null
+++ b/store/agents/voxel-worlds/toolchain/init-workspace.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Harness copies the template before this runs. Preserve the user's design log on repeat calls.
+set -eu
+ws="${1:-$PWD}"
+mkdir -p "$ws/world" "$ws/.harness"
+if [ ! -f "$ws/world/DESIGN.md" ]; then
+ printf '# Design log — Voxel Worlds\n\nRecord date, USER or AI, decision, rationale, and whether it remains in the build.\n' > "$ws/world/DESIGN.md"
+fi
+cat > "$ws/.harness/verdict.json" <<JSON
+{"spec":1,"ready":false,"summary":"Tidelands starter available — describe what you want to create","artifact":"world/index.html","findings":[{"severity":"info","kind":"review_pending","message":"Starter provided; personalized changes need browser verification."}],"phases":[{"id":"build","name":"Build","state":"active"},{"id":"verify","name":"Verify","state":"pending"}],"updatedAt":"$(date -u +%Y-%m-%dT%H:%M:%SZ)"}
+JSON
+printf 'initialized by %s\n' "${HARNESS_DSH:-autonomous/voxel-worlds}" > "$ws/.harness-initialized"
diff --git a/store/agents/voxel-worlds/toolchain/setup.sh b/store/agents/voxel-worlds/toolchain/setup.sh
new file mode 100755
index 000000000..30f606684
--- /dev/null
+++ b/store/agents/voxel-worlds/toolchain/setup.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+# Nothing to install: the Voxel Worlds harness generates a single self-contained HTML file and
+# renders it in the built-in web-viewer. Kept so the shape matches a real harness.
+exit 0
diff --git a/store/showcase/creative-direction/starter.jpg b/store/showcase/creative-direction/starter.jpg
new file mode 100644
index 000000000..7fbbee985
Binary files /dev/null and b/store/showcase/creative-direction/starter.jpg differ
diff --git a/store/showcase/drone-pilot/starter.jpg b/store/showcase/drone-pilot/starter.jpg
new file mode 100644
index 000000000..eb162f032
Binary files /dev/null and b/store/showcase/drone-pilot/starter.jpg differ
diff --git a/store/showcase/game-master/starter.jpg b/store/showcase/game-master/starter.jpg
new file mode 100644
index 000000000..7b9d2604c
Binary files /dev/null and b/store/showcase/game-master/starter.jpg differ
diff --git a/store/showcase/generative-art/starter.jpg b/store/showcase/generative-art/starter.jpg
new file mode 100644
index 000000000..a5fe5c7c3
Binary files /dev/null and b/store/showcase/generative-art/starter.jpg differ
diff --git a/store/showcase/lab-bench/starter.jpg b/store/showcase/lab-bench/starter.jpg
new file mode 100644
index 000000000..bd9829073
Binary files /dev/null and b/store/showcase/lab-bench/starter.jpg differ
diff --git a/store/showcase/music-studio/starter.jpg b/store/showcase/music-studio/starter.jpg
new file mode 100644
index 000000000..52e387bee
Binary files /dev/null and b/store/showcase/music-studio/starter.jpg differ
diff --git a/store/showcase/voxel-worlds/starter.jpg b/store/showcase/voxel-worlds/starter.jpg
new file mode 100644
index 000000000..e256aeb73
Binary files /dev/null and b/store/showcase/voxel-worlds/starter.jpg differ
diff --git a/store/tools/build-experiences.mjs b/store/tools/build-experiences.mjs
new file mode 100644
index 000000000..ba879bbd8
--- /dev/null
+++ b/store/tools/build-experiences.mjs
@@ -0,0 +1,120 @@
+#!/usr/bin/env node
+// Compile dependency-free, editable single-file starters. No build is needed after installation.
+import { readFile, writeFile, mkdir } from "node:fs/promises";
+import { fileURLToPath } from "node:url";
+import { resolve } from "node:path";
+const source = new URL("./experiences/", import.meta.url);
+export const experiences = [
+ {
+ id: "generative-art",
+ path: "sketch",
+ title: "FIELDWORK — Generative Art",
+ name: "FIELDWORK",
+ glyph: "≋",
+ },
+ {
+ id: "creative-direction",
+ path: "board",
+ title: "FORME — Creative Direction",
+ name: "FORME",
+ glyph: "F",
+ },
+ {
+ id: "lab-bench",
+ path: "bench",
+ title: "SIGNAL — Lab Bench",
+ name: "SIGNAL / LAB",
+ glyph: "∿",
+ },
+ {
+ id: "music-studio",
+ path: "piece",
+ title: "AFTERHOURS — Music Studio",
+ name: "AFTERHOURS",
+ glyph: "Ⅱ",
+ },
+ {
+ id: "game-master",
+ path: "game",
+ title: "RELAY — Game Master",
+ name: "RELAY / ARENA",
+ glyph: "◇",
+ },
+ {
+ id: "drone-pilot",
+ path: "flight",
+ title: "VECTOR — Drone Pilot",
+ name: "VECTOR / FLIGHT",
+ glyph: "↗",
+ },
+ {
+ id: "voxel-worlds",
+ path: "world",
+ title: "TIDELANDS — Voxel Worlds",
+ name: "TIDELANDS",
+ glyph: "▧",
+ },
+];
+export async function build({ check = false } = {}) {
+ const read = (name) => readFile(new URL(name, source), "utf8");
+ const [core, css, common, checker] = await Promise.all([
+ read("core.mjs"),
+ read("common.css"),
+ read("common.js"),
+ read("check-template.mjs"),
+ ]);
+ let drift = false;
+ for (const exp of experiences) {
+ const [model, style, body, app] = await Promise.all(
+ ["mjs", "css", "html", "js"].map((ext) => read(`${exp.id}.${ext}`)),
+ );
+ const modelJS = [core, model]
+ .join("\n")
+ .replace(/^import .*?;\n/gm, "")
+ .replace(/^export /gm, "");
+ const appJS = [common, app].join("\n");
+ if (/<\/script/i.test(modelJS + appJS))
+ throw new Error(`${exp.id}: inline script closing tag in source`);
+ const html = `<!doctype html>
+<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
+<meta name="color-scheme" content="dark light"><title>${exp.title}</title>
+<!-- Built by store/tools/build-experiences.mjs. Edit this file freely in your workspace. -->
+<style>${css}\n${style}</style></head><body>
+<header class="masthead"><div class="identity"><span class="mark" aria-hidden="true">${exp.glyph}</span>${exp.name}</div>
+<form class="seed-form" id="seed-form"><label for="seed">Seed</label><input id="seed" aria-label="Seed" maxlength="128" autocomplete="off" spellcheck="false"><button type="submit">Apply</button><button id="next-seed" type="button" title="Next seed">↗ Next</button></form></header>
+${body}<div class="toast" id="toast" role="status"></div>
+<script id="harness-model">\n'use strict';\n${modelJS}\n</script>
+<script>\n'use strict';\n${appJS}\n</script></body></html>\n`;
+ const out = new URL(
+ `../agents/${exp.id}/template/${exp.path}/index.html`,
+ import.meta.url,
+ );
+ if (check) {
+ if ((await readFile(out, "utf8")) !== html) {
+ console.error(`Out of date: ${fileURLToPath(out)}`);
+ drift = true;
+ }
+ } else await writeFile(out, html);
+ const checkDir = new URL(
+ `../agents/${exp.id}/template/tools/`,
+ import.meta.url,
+ );
+ const checkFile = new URL("check.mjs", checkDir);
+ const checkSource = `const CONFIG = ${JSON.stringify({ id: exp.id, artifact: `${exp.path}/index.html` })};\n${checker}`;
+ if (check) {
+ if ((await readFile(checkFile, "utf8")) !== checkSource) {
+ console.error(`Out of date: ${fileURLToPath(checkFile)}`);
+ drift = true;
+ }
+ } else {
+ await mkdir(checkDir, { recursive: true });
+ await writeFile(checkFile, checkSource);
+ }
+ }
+ if (drift) process.exitCode = 1;
+}
+if (
+ process.argv[1] &&
+ resolve(process.argv[1]) === fileURLToPath(import.meta.url)
+)
+ await build({ check: process.argv.includes("--check") });
diff --git a/store/tools/experience-tests/README.md b/store/tools/experience-tests/README.md
new file mode 100644
index 000000000..85bd0b922
--- /dev/null
+++ b/store/tools/experience-tests/README.md
@@ -0,0 +1,60 @@
+# Experience verification
+
+The seven interactive starters are generated by `store/tools/build-experiences.mjs` from the
+reviewable model, CSS, markup and UI sources in `store/tools/experiences/`. The installed output is
+one editable HTML file and a small Node checker; the runtime has no package dependencies.
+
+From the repository root:
+
+```sh
+node store/tools/build-experiences.mjs
+node store/tools/build-experiences.mjs --check
+node --test store/tools/experience-tests/models.test.mjs
+node --test store/viewers/web-viewer/test/*.test.mjs
+```
+
+Every generated workspace includes `tools/check.mjs`. Run it **in the workspace**:
+
+```sh
+node tools/check.mjs --seeds 100
+```
+
+It extracts the pure model from the actual edited artifact, exercises domain invariants over the
+requested seeds, repeats each result and writes `.harness/model-check.json`. It does not claim
+browser, visual or listening verification and does not mark the workspace ready.
+
+## Real browser suite
+
+Install the pinned development dependency in this directory, with system Chrome available:
+
+```sh
+npm install
+npm run browser
+```
+
+`BROWSER_EXECUTABLE` selects another Chromium executable. `PLAYWRIGHT_MODULE` can select an existing
+Playwright Core module by absolute path. `EXPERIENCE_OUTPUT` selects the evidence directory (default:
+`work/experience-evidence`). These are test dependencies, never installed into a user's workspace.
+Set `SOFTWARE_WEBGL=1` to exercise SwiftShader instead of the machine's graphics driver.
+Run `node performance.mjs` for 30 warmed artifact requests and five save-to-ready-and-paint
+samples per experience. It waits for the changed document and two animation frames, not just
+an iframe URL change. Timing is local measurement, not a performance guarantee.
+
+The suite creates temporary workspaces, copies each template, runs its init script, expands the
+manifest's actual viewer URL, and starts **this checkout's** viewer. It checks real controls,
+downloads and their contents, seed changes and reload preservation, paused file edits, 390px
+layouts, browser exceptions and screenshots. A separate fixture verifies sibling fetch,
+localStorage, ES modules and recovery when a missing artifact is created.
+
+The model suite checks 100 art/brand/data/music-score/arena/autopilot seeds, 16 rendered audio
+arrangements and 32 walkable voxel worlds. These are finite samples, not a claim about every seed
+or every browser. Browser tests are separate from Node coverage; a Node coverage number must
+never be reported as coverage of the UI or shell scripts.
+
+## Running app integration
+
+With the local daemon running and these seven agents plus `autonomous/web-viewer` installed from
+this checkout, run `HARNESS_MACHINE_ID=<local machine id> node daemon.mjs`. It creates temporary
+idle Claude sessions through the desktop's loopback protocol, checks engine readiness, framework
+materialization, instructions, initial verdicts, installed viewer routing and a browser file reload.
+It sends no prompts and deletes only its own temporary sessions and workspaces in cleanup.
diff --git a/store/tools/experience-tests/browser.mjs b/store/tools/experience-tests/browser.mjs
new file mode 100644
index 000000000..65ec28618
--- /dev/null
+++ b/store/tools/experience-tests/browser.mjs
@@ -0,0 +1,482 @@
+// Real browser checks through the branch viewer, using manifests and materialized workspaces.
+// npm install in this directory, then npm run browser. See README.md for system Chrome options.
+import assert from "node:assert/strict";
+import { createHash } from "node:crypto";
+import { once } from "node:events";
+import { cp, mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
+import { execFileSync } from "node:child_process";
+import { tmpdir } from "node:os";
+import { join, resolve } from "node:path";
+import { fileURLToPath } from "node:url";
+import { createHtmlViewer } from "../../viewers/web-viewer/viewer.mjs";
+import { experiences } from "../build-experiences.mjs";
+const { chromium } = await import(
+ process.env.PLAYWRIGHT_MODULE || "playwright-core"
+);
+const repo = fileURLToPath(new URL("../../../", import.meta.url));
+const output = resolve(
+ process.env.EXPERIENCE_OUTPUT || join(repo, "work/experience-evidence"),
+);
+await mkdir(output, { recursive: true });
+const browser = await chromium.launch({
+ executablePath: process.env.BROWSER_EXECUTABLE || undefined,
+ channel: process.env.BROWSER_EXECUTABLE ? undefined : "chrome",
+ headless: true,
+ args:
+ process.env.SOFTWARE_WEBGL === "1"
+ ? ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"]
+ : [],
+});
+const results = [];
+async function serverFor(workspace) {
+ const server = await createHtmlViewer(workspace);
+ server.listen(0, "127.0.0.1");
+ await once(server, "listening");
+ return { server, base: `http://127.0.0.1:${server.address().port}` };
+}
+async function closeServer(server) {
+ server.closeAllConnections();
+ await new Promise((r) => server.close(r));
+}
+async function download(page, click, name) {
+ const pending = page.waitForEvent("download");
+ await click();
+ const d = await pending;
+ assert.equal(await d.failure(), null);
+ const path = join(output, name || d.suggestedFilename());
+ await d.saveAs(path);
+ return readFile(path);
+}
+const frameOf = (page) =>
+ page.frames().find((f) => f.url().includes("/files/"));
+async function waitReady(page) {
+ await page
+ .frameLocator("#preview")
+ .locator('body[data-ready="true"]')
+ .waitFor();
+ return frameOf(page);
+}
+async function visibleScreenshot(page, name) {
+ const f = frameOf(page);
+ if (f) await f.evaluate(() => scrollTo(0, 0));
+ await page.screenshot({ path: join(output, name + ".png"), fullPage: true });
+}
+
+async function shellRegression() {
+ const ws = await mkdtemp(join(tmpdir(), "experience-shell-"));
+ await mkdir(join(ws, "nested"));
+ await writeFile(
+ join(ws, "nested/data.json"),
+ JSON.stringify({ message: "FETCH-OK" }),
+ );
+ await writeFile(
+ join(ws, "nested/module.js"),
+ 'document.querySelector("#module").textContent="MODULE-OK";',
+ );
+ await writeFile(
+ join(ws, "nested/index.html"),
+ `<!doctype html><title>Regression</title><p id="fetch"></p><p id="storage"></p><p id="module"></p><script>fetch('data.json').then(r=>r.json()).then(d=>document.querySelector('#fetch').textContent=d.message);localStorage.setItem('viewer-check','STORAGE-OK');document.querySelector('#storage').textContent=localStorage.getItem('viewer-check');</script><script type="module" src="module.js"></script>`,
+ );
+ const { server, base } = await serverFor(ws),
+ page = await browser.newPage();
+ try {
+ await page.goto(base + "/?file=nested/index.html");
+ const f = page.frameLocator("#preview");
+ await f.getByText("FETCH-OK").waitFor();
+ await f.getByText("STORAGE-OK").waitFor();
+ await f.getByText("MODULE-OK").waitFor();
+ await page.goto(base + "/?file=later.html");
+ await page.getByText("Waiting for your artifact").waitFor();
+ await writeFile(join(ws, "later.html"), "<h1>Now created</h1>");
+ await page.frameLocator("#preview").getByText("Now created").waitFor();
+ results.push({
+ name: "viewer-regressions",
+ ok: true,
+ checks: [
+ "sibling fetch",
+ "localStorage",
+ "ES module",
+ "missing artifact recovery",
+ ],
+ });
+ } finally {
+ await page.close();
+ await closeServer(server);
+ await rm(ws, { recursive: true, force: true });
+ }
+}
+
+async function one(exp) {
+ const root = join(repo, "store/agents", exp.id),
+ manifest = JSON.parse(await readFile(join(root, "harness.json"), "utf8"));
+ const ws = await mkdtemp(join(tmpdir(), "experience-" + exp.id + "-"));
+ await cp(join(root, "template"), ws, { recursive: true });
+ execFileSync(join(root, manifest.workspace.init), {
+ cwd: ws,
+ env: {
+ ...process.env,
+ HARNESS_DSH: manifest.id,
+ HARNESS_DSH_DIR: root,
+ HARNESS_WORKSPACE: ws,
+ },
+ });
+ const { server, base } = await serverFor(ws),
+ context = await browser.newContext({
+ viewport: { width: 1440, height: 1050 },
+ reducedMotion: "reduce",
+ acceptDownloads: true,
+ }),
+ page = await context.newPage();
+ const errors = [];
+ page.on("pageerror", (error) => errors.push(error.message));
+ const checks = [];
+ const artifact = exp.path + "/index.html";
+ const url =
+ manifest.viewer.url
+ .replace("${port}", new URL(base).port)
+ .replace(
+ "${artifact}",
+ artifact.split("/").map(encodeURIComponent).join("/"),
+ ) + "&seed=42";
+ try {
+ await page.goto(url);
+ let f = await waitReady(page);
+ checks.push("manifest launch");
+ await visibleScreenshot(page, exp.id + "-initial");
+ await page.setViewportSize({ width: 1600, height: 1000 });
+ await f.evaluate(
+ () =>
+ new Promise((r) =>
+ requestAnimationFrame(() => requestAnimationFrame(r)),
+ ),
+ );
+ const showcase = join(repo, "store/showcase", exp.id);
+ await mkdir(showcase, { recursive: true });
+ await page.screenshot({
+ path: join(showcase, "starter.jpg"),
+ type: "jpeg",
+ quality: 80,
+ });
+ await page.setViewportSize({ width: 1440, height: 1050 });
+
+ assert.equal(await page.locator("#empty").isHidden(), true);
+ if (exp.id === "generative-art") {
+ const original = createHash("sha256")
+ .update(await f.locator("#art").evaluate((c) => c.toDataURL()))
+ .digest("hex");
+ await f.locator("#next-seed").click();
+ assert.notEqual(
+ createHash("sha256")
+ .update(await f.locator("#art").evaluate((c) => c.toDataURL()))
+ .digest("hex"),
+ original,
+ );
+ await f.locator("#seed").fill("42");
+ await f.locator("#seed-form button[type=submit]").click();
+ assert.equal(
+ createHash("sha256")
+ .update(await f.locator("#art").evaluate((c) => c.toDataURL()))
+ .digest("hex"),
+ original,
+ );
+ await f.locator("#mode").selectOption("orbits");
+ assert.notEqual(
+ createHash("sha256")
+ .update(await f.locator("#art").evaluate((c) => c.toDataURL()))
+ .digest("hex"),
+ original,
+ );
+ await f.locator("#mode").selectOption("contours");
+ const bytes = await download(
+ page,
+ () => f.locator("#export").click(),
+ "fieldwork-print.png",
+ );
+ assert.equal(bytes.readUInt32BE(16), 1600);
+ assert.equal(bytes.readUInt32BE(20), 2000);
+ checks.push(
+ "pixel deterministic",
+ "different seeds",
+ "technique control",
+ "1600×2000 PNG",
+ );
+ } else if (exp.id === "creative-direction") {
+ await f.locator("#brand-name").fill("COVE STUDIO");
+ await f.locator("#directions button").nth(2).click();
+ assert.equal(await f.locator("#card-name").textContent(), "COVE STUDIO");
+ const colors = await f.locator("#swatches").textContent();
+ await f.locator("#lock-palette").click();
+ await f.locator("#directions button").nth(1).click();
+ assert.equal(await f.locator("#swatches").textContent(), colors);
+ const bytes = await download(
+ page,
+ () => f.locator("#poster-export").click(),
+ "forme-poster.svg",
+ );
+ assert.match(bytes.toString(), /COVE STUDIO/);
+ const tokens = JSON.parse(
+ (
+ await download(
+ page,
+ () => f.locator("#tokens").click(),
+ "forme-tokens.json",
+ )
+ ).toString(),
+ );
+ assert.equal(tokens.brand, "COVE STUDIO");
+ checks.push(
+ "direction change",
+ "custom brand",
+ "palette lock",
+ "SVG and tokens",
+ );
+ } else if (exp.id === "lab-bench") {
+ assert.equal(await f.locator("#sample-count").textContent(), "120");
+ await f.locator("#control").click();
+ assert.equal(await f.locator("#sample-count").textContent(), "60");
+ const csv = (
+ await download(
+ page,
+ () => f.locator("#export-csv").click(),
+ "signal-observations.csv",
+ )
+ ).toString();
+ assert.equal(csv.trim().split("\n").length, 61);
+ await f.locator("#control").click();
+ await f.locator("#effect").fill("-20");
+ await f.locator("#effect").dispatchEvent("input");
+ assert.match(await f.locator("#conclusion").textContent(), /reduces/);
+ await f.locator("#effect").fill("12");
+ await f.locator("#effect").dispatchEvent("input");
+ await f.locator("#run").click();
+ await f.waitForFunction(
+ () => document.querySelector("#sample-count").textContent === "120",
+ );
+ checks.push(
+ "cohort filters",
+ "statistics respond to effect",
+ "collection replay",
+ "filtered CSV",
+ );
+ } else if (exp.id === "music-studio") {
+ const original = await f.evaluate(() =>
+ Array.from(rendered.samples.slice(0, 8000)),
+ );
+ await f.locator("#play").click();
+ await f.waitForFunction(
+ () => playing && audioContext.state === "running",
+ );
+ await f.locator("#stop").click();
+ await f.locator("#play").click();
+ assert.deepEqual(
+ await f.evaluate(() => Array.from(rendered.samples.slice(0, 8000))),
+ original,
+ );
+ await f.locator("#stop").click();
+ const old = await f
+ .getByRole("button", { name: "Kick step 2", exact: true })
+ .getAttribute("aria-pressed");
+ await f.getByRole("button", { name: "Kick step 2", exact: true }).click();
+ assert.notEqual(
+ await f
+ .getByRole("button", { name: "Kick step 2", exact: true })
+ .getAttribute("aria-pressed"),
+ old,
+ );
+ const wav = await download(
+ page,
+ () => f.locator("#export-wav").click(),
+ "afterhours.wav",
+ );
+ assert.equal(wav.toString("ascii", 0, 4), "RIFF");
+ assert.ok(wav.length > 500000);
+ checks.push(
+ "audio running",
+ "replay same PCM",
+ "step editing",
+ "WAV export",
+ );
+ } else if (exp.id === "game-master") {
+ await f.locator("#step").click();
+ assert.match(await f.locator("#turn").textContent(), /01/);
+ await f.locator("#timeline").fill("72");
+ await f.locator("#timeline").dispatchEvent("input");
+ assert.match(await f.locator("#match-state").textContent(), /WINS|DRAW/);
+ await f.locator("#rewind").click();
+ assert.match(await f.locator("#turn").textContent(), /00/);
+ await f.locator("#tournament").click();
+ await f.waitForFunction(() =>
+ document
+ .querySelector("#tournament-result")
+ .textContent.includes("Mean Ember margin"),
+ );
+ const replay = JSON.parse(
+ (
+ await download(
+ page,
+ () => f.locator("#export-replay").click(),
+ "relay-replay.json",
+ )
+ ).toString(),
+ );
+ assert.equal(replay.history.length, 73);
+ checks.push(
+ "step/rewind/scrub",
+ "finite outcome",
+ "32-match tournament",
+ "replay export",
+ );
+ } else if (exp.id === "drone-pilot") {
+ await f.locator("#start-flight").click();
+ await f.waitForFunction(() => state.z > 8);
+ await f.locator("#manual").click();
+ const before = await f.evaluate(() => state.x);
+ await f.locator("#flight").focus();
+ await page.keyboard.down("d");
+ await f.waitForFunction((x) => state.x > x + 2, before);
+ await page.keyboard.up("d");
+ await f.locator("#start-flight").click();
+ const telemetry = JSON.parse(
+ (
+ await download(
+ page,
+ () => f.locator("#export-flight").click(),
+ "vector-telemetry.json",
+ )
+ ).toString(),
+ );
+ assert.ok(telemetry.telemetry.length > 1);
+ await f.locator("#reset-flight").click();
+ assert.equal(await f.evaluate(() => state.z), 0);
+ checks.push(
+ "autopilot motion",
+ "manual steering",
+ "telemetry export",
+ "reset",
+ );
+ } else if (exp.id === "voxel-worlds") {
+ await f.locator("#world").click();
+ await f.waitForFunction(
+ () => document.pointerLockElement?.id === "world",
+ );
+ await f.evaluate(() => document.exitPointerLock());
+ const before = await f.evaluate(() => ({ x: player.x, z: player.z }));
+ await f.locator("#world").focus();
+ await page.keyboard.down("w");
+ await f.waitForFunction(
+ (p) => Math.hypot(player.x - p.x, player.z - p.z) > 1,
+ before,
+ );
+ await page.keyboard.up("w");
+ // Look at the actual ground from the player camera, then exercise the user buttons.
+ await f.evaluate(() => {
+ player.pitch = -0.65;
+ drawWorld();
+ });
+ await f.waitForFunction(() => targetBlock && targetBlock.y > 0);
+ const edits = await f.evaluate(() => edited);
+ await f.locator("#place").click();
+ assert.equal(await f.evaluate(() => edited), edits + 1);
+ await f.locator("#break").click();
+ assert.equal(await f.evaluate(() => edited), edits + 2);
+ const bytes = await download(
+ page,
+ () => f.locator("#export-world").click(),
+ "tidelands-world.json",
+ );
+ assert.equal(JSON.parse(bytes.toString()).blocks.length, 48 * 28 * 48);
+ await f.locator("#world-file").setInputFiles({
+ name: "saved-world.json",
+ mimeType: "application/json",
+ buffer: bytes,
+ });
+ await f.getByText("Your world is restored.").waitFor();
+ await f.locator("#home").click();
+ await f.locator("#overview").click();
+ await visibleScreenshot(page, "voxel-worlds-overview");
+ await f.locator("#overview").click();
+ checks.push(
+ "pointer lock",
+ "walk and collide",
+ "break/place blocks",
+ "world save/restore",
+ "overview",
+ );
+ }
+ await visibleScreenshot(page, exp.id + "-desktop");
+ // Seed changes propagate to the shell and survive a real reload.
+ await f.locator("#seed").fill("73");
+ await f.locator("#seed-form button[type=submit]").click();
+ await page.waitForFunction(
+ () => new URL(location.href).searchParams.get("seed") === "73",
+ );
+ const before = await page.locator("#preview").getAttribute("src");
+ await page.locator("#reload").click();
+ await page.waitForFunction(
+ (src) => document.querySelector("#preview").src !== src,
+ new URL(before, base).href,
+ );
+ f = await waitReady(page);
+ assert.equal(await f.locator("#seed").inputValue(), "73");
+ checks.push("seed survives reload");
+ // Watcher integration: pause holds the active document, resume applies the saved change.
+ await page.locator("#auto").click();
+ const held = await page.locator("#preview").getAttribute("src");
+ await writeFile(
+ join(ws, artifact),
+ (await readFile(join(ws, artifact), "utf8")) +
+ "\n<!-- browser change -->\n",
+ );
+ await page.getByText("Changes pending", { exact: true }).waitFor();
+ assert.equal(await page.locator("#preview").getAttribute("src"), held);
+ await page.locator("#auto").click();
+ await page.waitForFunction(
+ (src) => document.querySelector("#preview").src !== src,
+ new URL(held, base).href,
+ );
+ f = await waitReady(page);
+ checks.push("pause/resume file reload");
+ await page.setViewportSize({ width: 390, height: 844 });
+ await f.waitForFunction(
+ () => document.documentElement.scrollWidth <= innerWidth + 1,
+ );
+ await visibleScreenshot(page, exp.id + "-mobile");
+ checks.push("390px layout");
+ assert.deepEqual(errors, [], "browser runtime errors");
+ checks.push("no runtime errors");
+ results.push({ name: exp.id, ok: true, checks });
+ console.log("PASS " + exp.id + " — " + checks.join(", "));
+ } catch (error) {
+ await page
+ .screenshot({ path: join(output, exp.id + "-FAIL.png"), fullPage: true })
+ .catch(() => {});
+ results.push({
+ name: exp.id,
+ ok: false,
+ checks,
+ error: error.stack,
+ errors,
+ });
+ console.error("FAIL " + exp.id + " — " + error.message.slice(0, 1000));
+ } finally {
+ await context.close();
+ await closeServer(server);
+ await rm(ws, { recursive: true, force: true });
+ }
+}
+try {
+ await shellRegression();
+ for (const exp of experiences.filter(
+ (exp) =>
+ !process.env.EXPERIENCE_IDS ||
+ process.env.EXPERIENCE_IDS.split(",").includes(exp.id),
+ ))
+ await one(exp);
+} finally {
+ await browser.close();
+ await writeFile(
+ join(output, "browser-results.json"),
+ JSON.stringify(results, null, 2) + "\n",
+ );
+}
+if (results.some((r) => !r.ok)) process.exitCode = 1;
diff --git a/store/tools/experience-tests/daemon.mjs b/store/tools/experience-tests/daemon.mjs
new file mode 100644
index 000000000..fa695c87c
--- /dev/null
+++ b/store/tools/experience-tests/daemon.mjs
@@ -0,0 +1,204 @@
+// Optional integration check against a running local Harness daemon. No prompts are sent.
+// HARNESS_MACHINE_ID=<local machine id> node store/tools/experience-tests/daemon.mjs
+import assert from "node:assert/strict";
+import { randomBytes } from "node:crypto";
+import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join, resolve } from "node:path";
+import { fileURLToPath } from "node:url";
+import { experiences } from "../build-experiences.mjs";
+
+const machineId = process.env.HARNESS_MACHINE_ID;
+if (!machineId)
+ throw new Error(
+ "Set HARNESS_MACHINE_ID to the local machine registered with Harness.",
+ );
+const { chromium } = await import(
+ process.env.PLAYWRIGHT_MODULE || "playwright-core"
+);
+const repo = fileURLToPath(new URL("../../../", import.meta.url));
+const output = resolve(
+ process.env.EXPERIENCE_OUTPUT || join(repo, "work/experience-evidence"),
+);
+await mkdir(output, { recursive: true });
+const socket = new WebSocket("ws://127.0.0.1:18473/api/local-ws");
+const pending = new Map(),
+ frames = [],
+ results = [];
+function waitFor(label, predicate, timeout = 30000) {
+ const start = Date.now();
+ return new Promise((resolve, reject) => {
+ const tick = () => {
+ const value = predicate();
+ if (value) return resolve(value);
+ if (Date.now() - start > timeout)
+ return reject(new Error("Timed out: " + label));
+ setTimeout(tick, 100);
+ };
+ tick();
+ });
+}
+function send(type, payload) {
+ socket.send(JSON.stringify({ type, payload }));
+}
+function request(type, payload, timeout = 20000) {
+ return new Promise((resolve, reject) => {
+ const requestId = randomBytes(8).toString("hex");
+ const timer = setTimeout(() => {
+ pending.delete(requestId);
+ reject(new Error(type + " timed out"));
+ }, timeout);
+ pending.set(requestId, (value) => {
+ clearTimeout(timer);
+ resolve(value);
+ });
+ send(type, { ...payload, requestId });
+ });
+}
+socket.addEventListener("message", (event) => {
+ const frame = JSON.parse(event.data);
+ const handler = pending.get(frame.payload?.requestId);
+ if (handler && frame.type.endsWith("_result")) {
+ pending.delete(frame.payload.requestId);
+ handler(frame.payload);
+ } else frames.push(frame);
+});
+await new Promise((resolve, reject) => {
+ socket.addEventListener("open", resolve, { once: true });
+ socket.addEventListener("error", reject, { once: true });
+});
+let browser;
+try {
+ send("machine_select", { machineId, localProtocolVersion: 1 });
+ await waitFor("daemon handshake", () =>
+ frames.find((f) => f.type === "connected"),
+ );
+ const list = await request("dsh_list", {});
+ browser = await chromium.launch({
+ executablePath: process.env.BROWSER_EXECUTABLE || undefined,
+ channel: process.env.BROWSER_EXECUTABLE ? undefined : "chrome",
+ headless: true,
+ });
+ for (const exp of experiences) {
+ const dsh = "autonomous/" + exp.id;
+ assert.ok(
+ list.dsh?.find((entry) => entry.id === dsh && entry.installed),
+ dsh + " must be installed first",
+ );
+ const workspace = await mkdtemp(join(tmpdir(), "harness-daemon-check-"));
+ let agentId, page;
+ try {
+ const created = await request(
+ "agent_create",
+ {
+ engine: "claude",
+ dsh,
+ cwd: workspace,
+ creationId: randomBytes(12).toString("hex"),
+ },
+ 60000,
+ );
+ if (created.agent?.id) agentId = created.agent.id;
+ assert.equal(
+ created.state,
+ "created",
+ JSON.stringify({ error: created.error, failure: created.failure }),
+ );
+ frames.push({ type: "agent_synced", payload: { agent: created.agent } });
+ const agent = await waitFor(
+ exp.id + " ready viewer",
+ () =>
+ frames
+ .map((f) => f.payload?.agent)
+ .find(
+ (a) =>
+ a?.id === agentId && a.viewerUrl && a.launch?.state === "ready",
+ ),
+ 120000,
+ );
+ assert.equal(
+ new URL(agent.viewerUrl).searchParams.get("file"),
+ exp.path + "/index.html",
+ );
+ const verdict = JSON.parse(
+ await readFile(join(workspace, ".harness/verdict.json"), "utf8"),
+ );
+ assert.equal(verdict.artifact, exp.path + "/index.html");
+ assert.equal(verdict.ready, false);
+ assert.match(
+ await readFile(join(workspace, "AGENTS.md"), "utf8"),
+ /Shipped experience/,
+ );
+ const actual = await readFile(
+ join(workspace, exp.path, "index.html"),
+ "utf8",
+ );
+ assert.equal(
+ actual,
+ await readFile(
+ join(
+ repo,
+ "store/agents",
+ exp.id,
+ "template",
+ exp.path,
+ "index.html",
+ ),
+ "utf8",
+ ),
+ );
+ page = await browser.newPage();
+ const errors = [];
+ page.on("pageerror", (e) => errors.push(e.message));
+ await page.goto(agent.viewerUrl);
+ await page
+ .frameLocator("#preview")
+ .locator("body[data-ready=true]")
+ .waitFor();
+ const revision = "daemon-" + exp.id;
+ await writeFile(
+ join(workspace, exp.path, "index.html"),
+ actual.replace("<body>", `<body data-revision="${revision}">`),
+ );
+ await page
+ .frameLocator("#preview")
+ .locator(`body[data-ready=true][data-revision="${revision}"]`)
+ .waitFor();
+ assert.deepEqual(errors, []);
+ results.push({
+ name: exp.id,
+ ok: true,
+ checks: [
+ "daemon create",
+ "engine ready",
+ "template materialized",
+ "agent instructions",
+ "honest initial verdict",
+ "installed viewer routing",
+ "browser ready",
+ "live file reload",
+ ],
+ });
+ console.log("PASS daemon " + exp.id);
+ } finally {
+ await page?.close();
+ if (agentId) {
+ const deleted = await request("agent_delete", { agentId });
+ assert.equal(deleted.deleted, true);
+ await waitFor("temporary agent deleted", () =>
+ frames.find(
+ (f) => f.type === "agent_deleted" && f.payload?.agentId === agentId,
+ ),
+ );
+ }
+ await rm(workspace, { recursive: true, force: true });
+ }
+ }
+} finally {
+ await browser?.close();
+ socket.close();
+ await writeFile(
+ join(output, "daemon-results.json"),
+ JSON.stringify(results, null, 2) + "\n",
+ );
+}
diff --git a/store/tools/experience-tests/models.test.mjs b/store/tools/experience-tests/models.test.mjs
new file mode 100644
index 000000000..877255989
--- /dev/null
+++ b/store/tools/experience-tests/models.test.mjs
@@ -0,0 +1,299 @@
+import assert from "node:assert/strict";
+import { test } from "node:test";
+import { random, hash, normal, clamp, lerp } from "../experiences/core.mjs";
+import { artModel, artPaths } from "../experiences/generative-art.mjs";
+import {
+ directions,
+ directionModel,
+ contrast,
+ brandSVG,
+} from "../experiences/creative-direction.mjs";
+import {
+ experiment,
+ stats,
+ regression,
+ treatmentEffect,
+ csvRows,
+} from "../experiences/lab-bench.mjs";
+import {
+ musicScore,
+ scoreEvents,
+ renderMusic,
+ wavFile,
+} from "../experiences/music-studio.mjs";
+import {
+ arenaMap,
+ arenaPath,
+ arenaMatch,
+ arenaTournament,
+} from "../experiences/game-master.mjs";
+import {
+ flightCourse,
+ flightStart,
+ flightStep,
+ flyAutopilot,
+} from "../experiences/drone-pilot.mjs";
+import {
+ voxelWorld,
+ blockAt,
+ putBlock,
+ solidBlock,
+ groundAt,
+ raycastWorld,
+ playerFits,
+ movePlayer,
+ importWorld,
+} from "../experiences/voxel-worlds.mjs";
+
+test("named random streams repeat exactly and remain independent", () => {
+ const a = random("42", "a"),
+ b = random("42", "a"),
+ c = random("42", "b");
+ const aa = Array.from({ length: 100 }, a);
+ assert.deepEqual(aa, Array.from({ length: 100 }, b));
+ assert.notDeepEqual(aa, Array.from({ length: 100 }, c));
+ assert.ok(aa.every((x) => x >= 0 && x < 1));
+ assert.equal(hash("42"), hash("42"));
+ assert.ok(Number.isFinite(normal(random("n"))));
+ assert.equal(clamp(10, 0, 5), 5);
+ assert.equal(lerp(0, 10, 0.5), 5);
+});
+test("art census: 100 seeds, three techniques, bounded finite geometry, identical re-render inputs", () => {
+ const signatures = new Set();
+ for (let seed = 0; seed < 100; seed++)
+ for (const mode of ["contours", "dunes", "orbits"]) {
+ const m = artModel(seed, { mode }),
+ paths = artPaths(m);
+ assert.deepEqual(m, artModel(seed, { mode }));
+ assert.equal(paths.length, 120);
+ assert.ok(
+ paths
+ .flat()
+ .every(
+ ([x, y]) =>
+ Number.isFinite(x) &&
+ Number.isFinite(y) &&
+ x > -500 &&
+ x < 1500 &&
+ y > -500 &&
+ y < 1700,
+ ),
+ );
+ signatures.add(JSON.stringify(m.phases));
+ }
+ assert.equal(signatures.size, 100);
+});
+test("brand directions have readable ink, reproducible layouts, palette locks and escaped SVG text", () => {
+ for (const d of directions)
+ assert.ok(contrast(d.colors[0], d.colors[1]) >= 7, d.name);
+ assert.equal(contrast("#000000", "#ffffff"), 21);
+ for (let seed = 0; seed < 100; seed++)
+ assert.deepEqual(directionModel(seed), directionModel(seed));
+ const m = directionModel(2, 1, ["#000000", "#ffffff", "#ff0000", "#00ff00"]);
+ assert.equal(m.index, 1);
+ assert.equal(m.colors[0], "#000000");
+ assert.match(
+ brandSVG(m, '<script> & "test"'),
+ /&lt;script&gt; &amp; &quot;test&quot;/,
+ );
+ assert.doesNotMatch(brandSVG(m, "<script>"), /<script>/);
+ assert.match(brandSVG(directionModel(1, 2)), /<ellipse/);
+});
+test("bench statistics are computed from the data, including exact known fits", () => {
+ assert.deepEqual(stats([]), { n: 0, mean: 0, variance: 0, sd: 0 });
+ assert.equal(stats([1, 2, 3]).variance, 1);
+ const fit = regression([
+ { x: 0, y: 2 },
+ { x: 1, y: 5 },
+ { x: 2, y: 8 },
+ ]);
+ assert.equal(fit.slope, 3);
+ assert.equal(fit.intercept, 2);
+ assert.equal(fit.r2, 1);
+ assert.deepEqual(regression([]), { slope: 0, intercept: 0, r2: 1 });
+ const p = [
+ { group: 0, x: 0, y: 1 },
+ { group: 0, x: 1, y: 3 },
+ { group: 1, x: 0, y: 5 },
+ { group: 1, x: 1, y: 7 },
+ ];
+ const e = treatmentEffect(p);
+ assert.equal(e.difference, 4);
+ assert.ok(e.low < 4 && e.high > 4);
+ for (let seed = 0; seed < 100; seed++) {
+ const points = experiment(seed);
+ assert.deepEqual(points, experiment(seed));
+ assert.equal(points.filter((p) => p.group === 0).length, 60);
+ assert.ok(points.every((p) => Number.isFinite(p.y)));
+ }
+ const baseline = experiment(12, { effect: 0 }),
+ effect = experiment(12, { effect: 20 });
+ for (let i = 0; i < baseline.length; i++)
+ assert.ok(
+ Math.abs(effect[i].y - baseline[i].y - (baseline[i].group ? 20 : 0)) <
+ 1e-10,
+ );
+ assert.equal(csvRows(experiment(1)).trim().split("\n").length, 121);
+});
+test("music score is repeatable, finite, musical events are in bounds and edits affect the score", () => {
+ for (let seed = 0; seed < 100; seed++) {
+ const s = musicScore(seed),
+ r = scoreEvents(s);
+ assert.deepEqual(s, musicScore(seed));
+ for (let track = 0; track < 5; track++)
+ assert.ok(
+ r.events.some((e) => e.track === track),
+ `seed ${seed}, track ${track}`,
+ );
+ assert.ok(
+ r.events.every(
+ (e) => e.time >= 0 && e.time < r.duration && e.note > 0 && e.note < 128,
+ ),
+ );
+ }
+ const s = musicScore(1),
+ muted = scoreEvents(s, { muted: [true, true, true, true, true] });
+ assert.equal(muted.events.length, 0);
+});
+test("audio census: 16 full arrangements have signal, headroom and exact same-seed PCM; WAV header is valid", () => {
+ for (let seed = 0; seed < 16; seed++) {
+ const rendered = renderMusic(musicScore(seed));
+ assert.ok(rendered.peak > 0.1 && rendered.peak <= 0.9);
+ assert.ok(rendered.rms > 0.005);
+ assert.ok(rendered.samples.every(Number.isFinite));
+ }
+ const a = renderMusic(musicScore(42)),
+ b = renderMusic(musicScore(42));
+ assert.deepEqual(a.samples, b.samples);
+ const bytes = wavFile(a.samples, a.sampleRate),
+ view = new DataView(bytes);
+ assert.equal(view.getUint32(24, true), 22050);
+ assert.equal(view.getUint32(40, true), a.samples.length * 2);
+ assert.equal(bytes.byteLength, 44 + a.samples.length * 2);
+});
+test("arena census: 100 maps finish with legal positions, consistent scoring and exact replays", () => {
+ for (let seed = 0; seed < 100; seed++) {
+ const m = arenaMatch(seed);
+ assert.equal(m.history.length, 73);
+ assert.deepEqual(m, arenaMatch(seed));
+ for (const state of m.history) {
+ assert.ok(state.score.every((n) => Number.isInteger(n) && n >= 0));
+ assert.ok(
+ state.units.every(
+ (u) =>
+ u.x >= 0 &&
+ u.x < 11 &&
+ u.y >= 0 &&
+ u.y < 9 &&
+ u.hp >= 0 &&
+ u.hp <= 3 &&
+ !m.map.walls.some(([x, y]) => u.x === x && u.y === y),
+ ),
+ );
+ }
+ for (const r of m.map.relays)
+ assert.ok(arenaPath(m.map, { x: 0, y: 4 }, r).length > 0);
+ }
+ assert.deepEqual(
+ arenaPath(
+ {
+ ...arenaMap(1),
+ walls: [
+ [1, 0],
+ [0, 1],
+ ],
+ },
+ { x: 0, y: 0 },
+ { x: 2, y: 2 },
+ ),
+ [],
+ );
+ const t = arenaTournament(42, { coral: "hunt", teal: "control" });
+ assert.equal(t.ember + t.tide + t.draws, 32);
+});
+test("drone census: autopilot clears all 12 gates on 100 seeds with a finite, repeatable fixed-step flight", () => {
+ for (let seed = 0; seed < 100; seed++) {
+ const s = flyAutopilot(seed);
+ assert.ok(s.finished, `seed ${seed}`);
+ assert.equal(s.passed, 12, `seed ${seed}`);
+ assert.equal(s.missed, 0);
+ assert.equal(s.crashed, false);
+ assert.deepEqual(s, flyAutopilot(seed));
+ }
+});
+test("manual drone input steers, braking slows, ground impact terminates and misses are counted", () => {
+ const c = flightCourse(42);
+ let s = flightStart();
+ for (let i = 0; i < 120; i++)
+ s = flightStep(s, c, { autopilot: false, x: 1, y: 0, brake: true });
+ assert.ok(s.x > 10 && s.speed < 8);
+ for (let i = 0; i < 300 && !s.crashed; i++)
+ s = flightStep(s, c, { autopilot: false, y: -1 });
+ assert.ok(s.crashed);
+ assert.deepEqual(flightStep(s, c), s);
+ s = flightStart();
+ for (let i = 0; i < 400; i++)
+ s = flightStep(s, c, { autopilot: false, x: 1 });
+ assert.ok(s.missed > 0);
+});
+test("voxel census: 32 worlds are deterministic, spawn clear and can be walked without entering solid blocks", () => {
+ for (let seed = 0; seed < 32; seed++) {
+ const w = voxelWorld(seed);
+ assert.deepEqual(w.blocks, voxelWorld(seed).blocks);
+ let p = { ...w.spawn, vy: 0, grounded: true };
+ assert.ok(playerFits(w, p.x, p.y, p.z), `spawn ${seed}`);
+ const start = { ...p };
+ for (let i = 0; i < 100; i++) {
+ p = movePlayer(w, p, { forward: 1 });
+ assert.ok(playerFits(w, p.x, p.y, p.z), `walk ${seed}, ${i}`);
+ }
+ assert.ok(
+ Math.hypot(start.x - p.x, start.z - p.z) > 0.5,
+ `movement ${seed}`,
+ );
+ }
+});
+test("voxel targeting and edits use real blocks; jump and world bounds hold", () => {
+ const w = { w: 10, h: 10, d: 10, blocks: new Uint8Array(1000) };
+ for (let x = 0; x < 10; x++)
+ for (let z = 0; z < 10; z++) putBlock(w, x, 0, z, 3);
+ assert.equal(groundAt(w, 5, 5), 1);
+ assert.equal(groundAt(w, 30, 30), 0);
+ assert.equal(blockAt(w, -1, 0, 0), 0);
+ assert.equal(putBlock(w, 50, 50, 50, 3), false);
+ assert.equal(solidBlock(7), false);
+ putBlock(w, 5, 2, 5, 8);
+ const hit = raycastWorld(w, { x: 5.5, y: 2.5, z: 8 }, { x: 0, y: 0, z: -1 });
+ assert.equal(hit.id, 8);
+ assert.deepEqual(hit.previous, { x: 5, y: 2, z: 6 });
+ putBlock(w, hit.x, hit.y, hit.z, 0);
+ assert.equal(
+ raycastWorld(w, { x: 5.5, y: 2.5, z: 8 }, { x: 0, y: 0, z: -1 }),
+ null,
+ );
+ let p = { x: 3, y: 1, z: 3, yaw: 0, vy: 0, grounded: true };
+ p = movePlayer(w, p, { jump: true });
+ assert.ok(p.y > 1);
+ for (let i = 0; i < 240; i++) p = movePlayer(w, p, { forward: 1 });
+ assert.ok(p.z < 10);
+ assert.ok(Math.abs(p.y - 1) < 0.01);
+});
+
+test("saved worlds restore exact blocks and reject corrupt imports", () => {
+ const w = voxelWorld("save");
+ const data = {
+ format: "tidelands-1",
+ seed: w.seed,
+ size: [48, 28, 48],
+ blocks: Array.from(w.blocks),
+ player: w.spawn,
+ timeOfDay: 0.3,
+ };
+ const restored = importWorld(data);
+ assert.deepEqual(restored.world.blocks, w.blocks);
+ assert.deepEqual(restored.world.spawn, w.spawn);
+ assert.equal(restored.timeOfDay, 0.3);
+ assert.throws(() => importWorld({ ...data, blocks: [999] }));
+ assert.throws(() => importWorld({ ...data, player: { ...w.spawn, y: -1 } }));
+ assert.throws(() => importWorld(null));
+});
diff --git a/store/tools/experience-tests/package-lock.json b/store/tools/experience-tests/package-lock.json
new file mode 100644
index 000000000..29e471d9c
--- /dev/null
+++ b/store/tools/experience-tests/package-lock.json
@@ -0,0 +1,26 @@
+{
+ "name": "harness-experience-tests",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "harness-experience-tests",
+ "devDependencies": {
+ "playwright-core": "1.63.0"
+ }
+ },
+ "node_modules/playwright-core": {
+ "version": "1.63.0",
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.63.0.tgz",
+ "integrity": "sha512-rYCsBF/M5HjUch52bbtVONEFjv6Xu8sm8h72dNlR5bzIE1fvC/bxgspzkjSfU+MweEMmPM8KJebG6nnyxo5mCg==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "playwright-core": "cli.js"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ }
+ }
+}
diff --git a/store/tools/experience-tests/package.json b/store/tools/experience-tests/package.json
new file mode 100644
index 000000000..e5df74401
--- /dev/null
+++ b/store/tools/experience-tests/package.json
@@ -0,0 +1,12 @@
+{
+ "name": "harness-experience-tests",
+ "private": true,
+ "type": "module",
+ "scripts": {
+ "test": "node --test models.test.mjs",
+ "browser": "node browser.mjs"
+ },
+ "devDependencies": {
+ "playwright-core": "1.63.0"
+ }
+}
diff --git a/store/tools/experience-tests/performance.mjs b/store/tools/experience-tests/performance.mjs
new file mode 100644
index 000000000..91b41db41
--- /dev/null
+++ b/store/tools/experience-tests/performance.mjs
@@ -0,0 +1,115 @@
+import { once } from "node:events";
+import { cp, mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join, resolve } from "node:path";
+import { fileURLToPath } from "node:url";
+import { createHtmlViewer } from "../../viewers/web-viewer/viewer.mjs";
+import { experiences } from "../build-experiences.mjs";
+const { chromium } = await import(
+ process.env.PLAYWRIGHT_MODULE || "playwright-core"
+);
+const repo = fileURLToPath(new URL("../../../", import.meta.url));
+const output = resolve(
+ process.env.EXPERIENCE_OUTPUT || join(repo, "work/experience-evidence"),
+);
+await mkdir(output, { recursive: true });
+const software = process.env.SOFTWARE_WEBGL === "1";
+const browser = await chromium.launch({
+ executablePath: process.env.BROWSER_EXECUTABLE || undefined,
+ channel: process.env.BROWSER_EXECUTABLE ? undefined : "chrome",
+ headless: true,
+ args: software
+ ? ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"]
+ : [],
+});
+const percentile = (a, p) =>
+ [...a].sort((x, y) => x - y)[
+ Math.min(a.length - 1, Math.floor(a.length * p))
+ ];
+const results = [];
+try {
+ for (const exp of experiences) {
+ const ws = await mkdtemp(join(tmpdir(), "experience-latency-"));
+ await cp(join(repo, "store/agents", exp.id, "template"), ws, {
+ recursive: true,
+ });
+ const server = await createHtmlViewer(ws);
+ server.listen(0, "127.0.0.1");
+ await once(server, "listening");
+ const base = `http://127.0.0.1:${server.address().port}`,
+ artifact = exp.path + "/index.html",
+ path = join(ws, artifact),
+ source = await readFile(path, "utf8");
+ const page = await browser.newPage({
+ viewport: { width: 1280, height: 900 },
+ reducedMotion: "reduce",
+ });
+ try {
+ const requests = [];
+ for (let i = 0; i < 40; i++) {
+ const start = performance.now();
+ const res = await fetch(base + "/files/" + artifact);
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
+ await res.arrayBuffer();
+ if (i >= 10) requests.push(performance.now() - start);
+ }
+ await page.goto(base + "/?file=" + encodeURIComponent(artifact));
+ await page
+ .frameLocator("#preview")
+ .locator("body[data-ready=true]")
+ .waitFor();
+ const paints = [];
+ for (let i = 0; i < 5; i++) {
+ const start = performance.now();
+ await writeFile(
+ path,
+ source.replace("<body>", `<body data-revision="${i}">`),
+ );
+ await page
+ .frameLocator("#preview")
+ .locator(`body[data-ready=true][data-revision="${i}"]`)
+ .waitFor();
+ const frame = page.frames().find((f) => f.url().includes("/files/"));
+ await frame.evaluate(
+ () =>
+ new Promise((resolve) =>
+ requestAnimationFrame(() => requestAnimationFrame(resolve)),
+ ),
+ );
+ paints.push(performance.now() - start);
+ }
+ const result = {
+ name: exp.id,
+ requestMedianMs: percentile(requests, 0.5),
+ requestP95Ms: percentile(requests, 0.95),
+ writeToPaintMedianMs: percentile(paints, 0.5),
+ writeToPaintMaxMs: Math.max(...paints),
+ paintSamples: paints,
+ };
+ results.push(result);
+ console.log(JSON.stringify(result));
+ } finally {
+ await page.close();
+ server.closeAllConnections();
+ await new Promise((r) => server.close(r));
+ await rm(ws, { recursive: true, force: true });
+ }
+ }
+} finally {
+ const version = browser.version();
+ await browser.close();
+ await writeFile(
+ join(output, "performance.json"),
+ JSON.stringify(
+ {
+ measuredAt: new Date().toISOString(),
+ browser: version,
+ headless: true,
+ softwareWebGL: software,
+ results,
+ },
+ null,
+ 2,
+ ) + "\n",
+ );
+}
diff --git a/store/tools/experiences/check-template.mjs b/store/tools/experiences/check-template.mjs
new file mode 100644
index 000000000..28d776306
--- /dev/null
+++ b/store/tools/experiences/check-template.mjs
@@ -0,0 +1,74 @@
+// Compiled into each workspace's tools/check.mjs. Tests the model in the ACTUAL edited HTML.
+import { readFile, mkdir, writeFile } from "node:fs/promises";
+import { createHash } from "node:crypto";
+import vm from "node:vm";
+import { resolve, dirname } from "node:path";
+
+const args = process.argv.slice(2),
+ i = args.indexOf("--seeds");
+const count = i === -1 ? 32 : Number(args[i + 1]);
+if (!Number.isInteger(count) || count < 1 || count > 1000)
+ throw new Error("--seeds must be an integer from 1 to 1000");
+const artifact = resolve(CONFIG.artifact);
+const html = await readFile(artifact, "utf8");
+const script = html.match(
+ /<script id="harness-model">([\s\S]*?)<\/script>/,
+)?.[1];
+if (!script)
+ throw new Error(
+ 'Keep the pure model in <script id="harness-model"> so this checker can exercise the actual artifact.',
+ );
+const expressions = {
+ "generative-art": `const m=artModel(SEED);const p=artPaths(m);({state:m,valid:p.length>0&&p.flat().every(([x,y])=>Number.isFinite(x)&&Number.isFinite(y)),metrics:{paths:p.length,palette:m.palette}})`,
+ "creative-direction": `const m=directionModel(SEED);const ratio=contrast(m.colors[0],m.colors[1]);({state:m,valid:ratio>=4.5,metrics:{direction:m.name,contrast:ratio}})`,
+ "lab-bench": `const p=experiment(SEED),e=treatmentEffect(p);({state:p,valid:p.length>1&&p.every(p=>Number.isFinite(p.x)&&Number.isFinite(p.y))&&Number.isFinite(e.low)&&e.low<=e.high,metrics:{samples:p.length,effect:e.difference,interval:[e.low,e.high]}})`,
+ "music-studio": `const s=musicScore(SEED),r=renderMusic(s);({state:Array.from(r.samples),valid:r.peak>.001&&r.peak<=.95&&r.samples.every(Number.isFinite),metrics:{seconds:r.duration,peak:r.peak,rms:r.rms}})`,
+ "game-master": `const m=arenaMatch(SEED),s=m.history.at(-1);({state:m,valid:m.history.length>1&&m.history.length<=10000&&s.units.every(u=>u.hp>=0&&u.x>=0&&u.x<m.map.w&&u.y>=0&&u.y<m.map.h),metrics:{turns:s.turn,score:s.score,winner:m.winner}})`,
+ "drone-pilot": `const s=flyAutopilot(SEED);({state:s,valid:s.finished&&!s.crashed&&s.passed===flightCourse(SEED).length,metrics:{seconds:s.time,passed:s.passed,missed:s.missed}})`,
+ "voxel-worlds": `const w=voxelWorld(SEED);let p={...w.spawn,vy:0,grounded:true};const clear=playerFits(w,p.x,p.y,p.z);for(let t=0;t<120;t++)p=movePlayer(w,p,{forward:1});({state:Array.from(w.blocks),valid:clear&&playerFits(w,p.x,p.y,p.z),metrics:{blocks:w.blocks.filter(Boolean).length,walkDistance:Math.hypot(p.x-w.spawn.x,p.z-w.spawn.z)}})`,
+};
+const expression = expressions[CONFIG.id];
+const digest = (value) =>
+ createHash("sha256").update(JSON.stringify(value)).digest("hex");
+const results = [];
+for (let seed = 0; seed < count; seed++) {
+ const run = () =>
+ vm.runInNewContext(
+ `${script}\n${expression}`,
+ { SEED: String(seed) },
+ { timeout: 10000 },
+ );
+ try {
+ const first = run(),
+ second = run(),
+ signature = digest(first.state),
+ repeat = digest(second.state);
+ results.push({
+ seed,
+ ok: first.valid && signature === repeat,
+ signature,
+ metrics: first.metrics,
+ });
+ } catch (error) {
+ results.push({ seed, ok: false, error: error.message });
+ }
+}
+const passed = results.filter((r) => r.ok).length;
+const report = {
+ spec: 1,
+ harness: CONFIG.id,
+ artifact: CONFIG.artifact,
+ checkedAt: new Date().toISOString(),
+ modelChecks: { passed, total: count },
+ scope:
+ "Pure model invariants and same-process repeatability. Browser interaction, layout, listening and export review still required.",
+ results,
+};
+const out = resolve(".harness/model-check.json");
+await mkdir(dirname(out), { recursive: true });
+await writeFile(out, JSON.stringify(report, null, 2) + "\n");
+console.log(
+ `${CONFIG.id}: ${passed}/${count} model checks passed. Report: ${out}`,
+);
+console.log(report.scope);
+if (passed !== count) process.exitCode = 1;
diff --git a/store/tools/experiences/common.css b/store/tools/experiences/common.css
new file mode 100644
index 000000000..c612b2b20
--- /dev/null
+++ b/store/tools/experiences/common.css
@@ -0,0 +1,384 @@
+:root {
+ color-scheme: dark;
+ --bg: #111414;
+ --panel: #191e1c;
+ --line: #ffffff1c;
+ --ink: #f4f2e9;
+ --muted: #a1aaa4;
+ --accent: #d0f28a;
+ font:
+ 14px/1.5 -apple-system,
+ BlinkMacSystemFont,
+ "Segoe UI",
+ sans-serif;
+}
+* {
+ box-sizing: border-box;
+}
+body {
+ margin: 0;
+ background: var(--bg);
+ color: var(--ink);
+}
+button,
+input,
+select {
+ font: inherit;
+}
+button,
+a,
+input,
+select {
+ -webkit-tap-highlight-color: transparent;
+}
+button,
+a {
+ touch-action: manipulation;
+}
+button {
+ cursor: pointer;
+}
+button:disabled {
+ opacity: 0.45;
+ cursor: wait;
+}
+button:focus-visible,
+input:focus-visible,
+select:focus-visible,
+a:focus-visible {
+ outline: 2px solid var(--accent);
+ outline-offset: 4px;
+}
+button,
+input,
+select {
+ color: inherit;
+ background: transparent;
+ border: 1px solid var(--line);
+ border-radius: 5px;
+ padding: 9px 13px;
+}
+button:hover {
+ background: #ffffff0c;
+ border-color: var(--muted);
+}
+button.primary {
+ background: var(--accent);
+ color: #142015;
+ border-color: transparent;
+ font-weight: 650;
+}
+button[aria-pressed="true"] {
+ border-color: var(--accent);
+ color: var(--accent);
+}
+input[type="range"] {
+ accent-color: var(--accent);
+ padding: 0;
+ min-width: 0;
+}
+input[type="number"] {
+ width: 80px;
+}
+select {
+ background: var(--panel);
+}
+label {
+ cursor: pointer;
+}
+a {
+ color: inherit;
+}
+h1,
+h2,
+h3,
+p {
+ margin: 0;
+}
+h1 {
+ font-size: clamp(32px, 5vw, 64px);
+ line-height: 1.02;
+ letter-spacing: -0.055em;
+ font-weight: 550;
+}
+h2 {
+ font-weight: 550;
+ letter-spacing: -0.03em;
+}
+h3 {
+ font-size: 14px;
+ font-weight: 550;
+}
+.mono,
+.eyebrow {
+ font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
+}
+.eyebrow {
+ font-size: 10px;
+ letter-spacing: 0.16em;
+ text-transform: uppercase;
+ color: var(--muted);
+}
+.muted {
+ color: var(--muted);
+}
+.small {
+ font-size: 12px;
+}
+.masthead {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 20px;
+ padding: 19px 28px;
+ border-bottom: 1px solid var(--line);
+}
+.identity {
+ display: flex;
+ gap: 12px;
+ align-items: center;
+ white-space: nowrap;
+ font-size: 12px;
+ font-weight: 600;
+ letter-spacing: 0.04em;
+}
+.mark {
+ width: 25px;
+ height: 25px;
+ display: grid;
+ place-items: center;
+ border: 1px solid currentColor;
+ font-size: 17px;
+}
+.seed-form {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+}
+.seed-form label {
+ font:
+ 10px ui-monospace,
+ monospace;
+ text-transform: uppercase;
+ letter-spacing: 0.12em;
+ color: var(--muted);
+ margin-right: 4px;
+}
+.seed-form input {
+ width: 74px;
+ padding: 6px 8px;
+ font:
+ 12px ui-monospace,
+ monospace;
+}
+.seed-form button {
+ padding: 6px 10px;
+ font-size: 12px;
+}
+.intro {
+ padding: 32px 28px;
+ display: flex;
+ align-items: flex-end;
+ justify-content: space-between;
+ gap: 20px;
+}
+.intro p {
+ max-width: 440px;
+ color: var(--muted);
+ margin-top: 14px;
+}
+.intro .eyebrow {
+ margin-bottom: 12px;
+}
+.actions {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ flex-wrap: wrap;
+}
+.workspace {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) 270px;
+ gap: 22px;
+ padding: 0 28px 28px;
+}
+.panel {
+ background: var(--panel);
+ border: 1px solid var(--line);
+ border-radius: 8px;
+ overflow: hidden;
+}
+.panel-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 16px 20px;
+ border-bottom: 1px solid var(--line);
+ gap: 10px;
+}
+.side {
+ display: flex;
+ flex-direction: column;
+ gap: 20px;
+}
+.section {
+ border-top: 1px solid var(--line);
+ padding-top: 18px;
+}
+.section h3 {
+ margin-bottom: 15px;
+}
+.field {
+ display: grid;
+ gap: 7px;
+ margin: 14px 0;
+}
+.field > span {
+ display: flex;
+ justify-content: space-between;
+ font-size: 12px;
+ color: var(--muted);
+}
+.metrics {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ gap: 1px;
+ background: var(--line);
+ border: 1px solid var(--line);
+ border-radius: 6px;
+ overflow: hidden;
+}
+.metric {
+ background: var(--bg);
+ padding: 13px 15px;
+}
+.metric strong {
+ display: block;
+ font:
+ 24px ui-monospace,
+ monospace;
+ letter-spacing: -0.06em;
+}
+.metric span {
+ font-size: 10px;
+ color: var(--muted);
+ text-transform: uppercase;
+ letter-spacing: 0.09em;
+}
+canvas {
+ display: block;
+ max-width: 100%;
+}
+.status-line {
+ display: flex;
+ justify-content: space-between;
+ gap: 20px;
+ padding: 14px 28px;
+ border-top: 1px solid var(--line);
+ font:
+ 10px ui-monospace,
+ monospace;
+ color: var(--muted);
+}
+.dot {
+ width: 6px;
+ height: 6px;
+ display: inline-block;
+ background: var(--accent);
+ border-radius: 50%;
+ margin-right: 6px;
+}
+.toast {
+ position: fixed;
+ z-index: 99;
+ left: 50%;
+ bottom: 22px;
+ transform: translateX(-50%);
+ max-width: 90vw;
+ background: var(--ink);
+ color: var(--bg);
+ padding: 11px 18px;
+ border-radius: 6px;
+ box-shadow: 0 3px 30px #0004;
+ font-size: 12px;
+}
+.toast:empty {
+ display: none;
+}
+[hidden] {
+ display: none !important;
+}
+.sr-only {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ padding: 0;
+ margin: -1px;
+ overflow: hidden;
+ clip-path: inset(50%);
+ white-space: nowrap;
+ border: 0;
+}
+@media (max-width: 800px) {
+ .workspace {
+ grid-template-columns: 1fr;
+ }
+ .side {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ }
+ .intro {
+ align-items: flex-start;
+ flex-direction: column;
+ }
+ .intro h1 {
+ font-size: 44px;
+ }
+}
+@media (max-width: 480px) {
+ .masthead {
+ padding: 13px 16px;
+ gap: 8px;
+ flex-wrap: wrap;
+ }
+ .intro {
+ padding: 26px 16px;
+ }
+ .intro h1 {
+ font-size: 38px;
+ }
+ .workspace {
+ padding: 0 16px 20px;
+ gap: 18px;
+ }
+ .side {
+ grid-template-columns: 1fr;
+ }
+ .seed-form label {
+ display: none;
+ }
+ .status-line {
+ padding: 12px 16px;
+ }
+ .status-line span:last-child {
+ display: none;
+ }
+ .metrics .metric {
+ padding: 12px 10px;
+ }
+ .panel-head {
+ padding: 12px;
+ }
+ .actions {
+ gap: 6px;
+ }
+}
+@media (prefers-reduced-motion: reduce) {
+ *,
+ *::before,
+ *::after {
+ scroll-behavior: auto !important;
+ animation: none !important;
+ transition: none !important;
+ }
+}
diff --git a/store/tools/experiences/common.js b/store/tools/experiences/common.js
new file mode 100644
index 000000000..2d4c9d797
--- /dev/null
+++ b/store/tools/experiences/common.js
@@ -0,0 +1,81 @@
+const $ = (s) => document.querySelector(s);
+const $$ = (s) => [...document.querySelectorAll(s)];
+const params = new URLSearchParams(location.search);
+let seed = (params.get("seed") || "42").slice(0, 128);
+const reducedMotion = matchMedia("(prefers-reduced-motion: reduce)").matches;
+const parentMessage = (message) => {
+ if (parent !== window) parent.postMessage(message, "*");
+};
+function toast(message) {
+ $("#toast").textContent = message;
+ clearTimeout(toast.timer);
+ toast.timer = setTimeout(() => {
+ $("#toast").textContent = "";
+ }, 3500);
+}
+function saveFile(name, content, type = "application/json") {
+ const blob =
+ content instanceof Blob ? content : new Blob([content], { type });
+ const url = URL.createObjectURL(blob),
+ a = document.createElement("a");
+ a.href = url;
+ a.download = name;
+ document.body.append(a);
+ a.click();
+ a.remove();
+ setTimeout(() => URL.revokeObjectURL(url), 30000);
+}
+function canvasPNG(canvas, name) {
+ canvas.toBlob((blob) => {
+ if (blob) saveFile(name, blob);
+ else toast("Image export failed. Please try again.");
+ });
+}
+function setSeed(value) {
+ seed = String(value).trim().slice(0, 128) || "42";
+ $("#seed").value = seed;
+ const url = new URL(location.href);
+ url.searchParams.set("seed", seed);
+ try {
+ history.replaceState(null, "", url);
+ } catch {
+ /* Opaque-origin iframe: the shell owns its URL. */
+ }
+ parentMessage({ type: "harness:state", seed });
+ dispatchEvent(new CustomEvent("seedchange", { detail: seed }));
+}
+$("#seed").value = seed;
+$("#seed-form").addEventListener("submit", (e) => {
+ e.preventDefault();
+ setSeed($("#seed").value);
+});
+$("#next-seed").addEventListener("click", () =>
+ setSeed(/^\d{1,9}$/.test(seed) ? Number(seed) + 1 : hash(seed)),
+);
+function fitCanvas(canvas, draw, maxDpr = 2) {
+ const observer = new ResizeObserver(() => {
+ const box = canvas.getBoundingClientRect(),
+ dpr = Math.min(devicePixelRatio || 1, maxDpr);
+ canvas.width = Math.max(1, Math.round(box.width * dpr));
+ canvas.height = Math.max(1, Math.round(box.height * dpr));
+ draw?.();
+ });
+ observer.observe(canvas);
+ return observer;
+}
+const editable = (target) =>
+ target instanceof Element &&
+ !!target.closest("input,textarea,select,[contenteditable=true]");
+addEventListener("error", (e) =>
+ parentMessage({ type: "harness:error", message: e.message }),
+);
+addEventListener("unhandledrejection", (e) =>
+ parentMessage({
+ type: "harness:error",
+ message: String(e.reason?.message || e.reason),
+ }),
+);
+function ready() {
+ document.body.dataset.ready = "true";
+ parentMessage({ type: "harness:ready", title: document.title, seed });
+}
diff --git a/store/tools/experiences/core.mjs b/store/tools/experiences/core.mjs
new file mode 100644
index 000000000..511bdabde
--- /dev/null
+++ b/store/tools/experiences/core.mjs
@@ -0,0 +1,24 @@
+// Shared deterministic primitives. Domain models use named streams so unrelated edits stay stable.
+export function hash(value) {
+ let h = 2166136261;
+ for (const c of String(value)) h = Math.imul(h ^ c.charCodeAt(0), 16777619);
+ return h >>> 0;
+}
+export function random(seed, stream = "main") {
+ let a = hash(`${seed}:${stream}`);
+ return () => {
+ a = (a + 0x6d2b79f5) | 0;
+ let t = Math.imul(a ^ (a >>> 15), 1 | a);
+ t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
+ };
+}
+export const clamp = (n, lo, hi) => Math.max(lo, Math.min(hi, n));
+export const lerp = (a, b, t) => a + (b - a) * t;
+export const pick = (items, rng) => items[Math.floor(rng() * items.length)];
+export function normal(rng) {
+ return (
+ Math.sqrt(-2 * Math.log(Math.max(1e-9, rng()))) *
+ Math.cos(2 * Math.PI * rng())
+ );
+}
diff --git a/store/tools/experiences/creative-direction.css b/store/tools/experiences/creative-direction.css
new file mode 100644
index 000000000..c497e5abb
--- /dev/null
+++ b/store/tools/experiences/creative-direction.css
@@ -0,0 +1,197 @@
+:root {
+ color-scheme: light;
+ --bg: #eeeae2;
+ --panel: #f6f2e9;
+ --ink: #282c29;
+ --muted: #6e746b;
+ --line: #2b32292a;
+ --accent: #303e32;
+}
+button.primary {
+ color: #eeeae2;
+}
+.mark {
+ background: var(--ink);
+ color: var(--bg);
+ border: 0;
+}
+.intro {
+ padding-bottom: 28px;
+}
+.intro h1 {
+ font:
+ clamp(34px, 5vw, 64px) / 1.02 Georgia,
+ serif;
+ letter-spacing: -0.06em;
+}
+.direction-layout {
+ padding: 0 28px 30px;
+ max-width: 1440px;
+ margin: auto;
+}
+.direction-nav {
+ display: flex;
+ border-top: 1px solid var(--line);
+ border-bottom: 1px solid var(--line);
+ margin-bottom: 26px;
+ gap: 24px;
+ overflow: auto;
+}
+.direction-nav button {
+ border: 0;
+ border-radius: 0;
+ padding: 17px 0;
+ white-space: nowrap;
+ color: var(--muted);
+ font-size: 12px;
+}
+.direction-nav button[aria-pressed="true"] {
+ box-shadow: inset 0 -2px var(--ink);
+ color: var(--ink);
+}
+.brand-grid {
+ display: grid;
+ grid-template-columns: minmax(0, 1.3fr) minmax(240px, 0.7fr);
+ gap: 40px;
+}
+.poster {
+ padding: 24px;
+ background: #d9d7cc;
+ min-width: 0;
+}
+.poster svg {
+ display: block;
+ width: 100%;
+ max-height: 820px;
+ filter: drop-shadow(0 7px 10px #0002);
+}
+.brand-details {
+ padding: 10px 0;
+ display: flex;
+ flex-direction: column;
+ gap: 16px;
+}
+.brand-details h2 {
+ font:
+ 32px/1.15 Georgia,
+ serif;
+}
+.brand-details > p:not(.eyebrow) {
+ font-size: 13px;
+ max-width: 380px;
+}
+.brand-details .field {
+ margin: 3px 0;
+}
+.palette-head {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-top: 4px;
+ gap: 8px;
+}
+.palette-head button {
+ font-size: 10px;
+ padding: 5px 8px;
+}
+.swatches {
+ display: grid;
+ grid-template-columns: repeat(5, 1fr);
+ height: 76px;
+}
+.swatches button {
+ border: 0;
+ border-radius: 0;
+ padding: 7px 3px;
+ display: flex;
+ align-items: flex-end;
+ justify-content: center;
+ font:
+ 9px ui-monospace,
+ monospace;
+}
+.type-spec {
+ border-top: 1px solid var(--line);
+ padding-top: 18px;
+ margin-top: 5px;
+}
+.specimen {
+ font-size: 46px;
+ line-height: 1.05;
+ margin: 10px 0;
+ letter-spacing: -0.04em;
+}
+.brand-card {
+ padding: 24px;
+ min-height: 150px;
+ box-shadow: 0 3px 12px #0001;
+ margin-top: 4px;
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+}
+.brand-card .eyebrow {
+ color: inherit;
+ opacity: 0.8;
+}
+.brand-card h3 {
+ font-size: 27px;
+ margin: 15px 0;
+}
+.brand-card > span:last-child {
+ font-size: 10px;
+}
+.direction-foot {
+ display: flex;
+ justify-content: space-between;
+ gap: 24px;
+ border-top: 1px solid var(--line);
+ margin-top: 26px;
+ padding-top: 20px;
+}
+.direction-foot p {
+ max-width: 360px;
+}
+@media (max-width: 800px) {
+ .brand-grid {
+ grid-template-columns: 1fr;
+ gap: 22px;
+ }
+ .brand-details {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 18px;
+ }
+ .brand-details > h2,
+ .brand-details > p,
+ .brand-details > .palette-head,
+ .swatches,
+ #contrast {
+ grid-column: 1/-1;
+ }
+ .type-spec {
+ margin: 0;
+ border: 0;
+ }
+ .brand-card {
+ grid-column: 1/-1;
+ }
+}
+@media (max-width: 480px) {
+ .direction-layout {
+ padding: 0 16px 24px;
+ }
+ .direction-nav {
+ gap: 18px;
+ }
+ .brand-details {
+ display: flex;
+ }
+ .poster {
+ padding: 12px;
+ }
+ .direction-foot {
+ flex-direction: column;
+ gap: 10px;
+ }
+}
diff --git a/store/tools/experiences/creative-direction.html b/store/tools/experiences/creative-direction.html
new file mode 100644
index 000000000..179f14408
--- /dev/null
+++ b/store/tools/experiences/creative-direction.html
@@ -0,0 +1,48 @@
+<section class="intro">
+ <div>
+ <p class="eyebrow">Independent identities / Direction 01—03</p>
+ <h1>An identity.<br />A point of view.</h1>
+ </div>
+ <div class="actions">
+ <button id="tokens">Export tokens</button
+ ><button id="poster-export" class="primary">Export poster ↗</button>
+ </div>
+</section>
+<main class="direction-layout">
+ <nav class="direction-nav" id="directions" aria-label="Art direction"></nav>
+ <div class="brand-grid">
+ <section id="poster" class="poster" aria-label="Brand poster"></section>
+ <aside class="brand-details">
+ <p class="eyebrow" id="direction-name"></p>
+ <h2 id="direction-line"></h2>
+ <p id="rationale" class="muted"></p>
+ <label class="field"
+ ><span>Your name on it</span
+ ><input id="brand-name" maxlength="28" aria-label="Brand name"
+ /></label>
+ <div class="palette-head">
+ <h3>The palette</h3>
+ <button id="lock-palette" aria-pressed="false">Lock palette</button>
+ </div>
+ <div id="swatches" class="swatches"></div>
+ <p class="small muted" id="contrast"></p>
+ <div class="type-spec">
+ <p class="eyebrow">Type in context</p>
+ <p class="specimen" id="type-specimen">Aa Bb Cc<br />0123456789</p>
+ <span class="small muted" id="type-name"></span>
+ </div>
+ <div class="brand-card" id="brand-card">
+ <span class="eyebrow">The small things matter</span>
+ <h3 id="card-name"></h3>
+ <span>Objects. Places. Possibilities.</span>
+ </div>
+ </aside>
+ </div>
+ <div class="direction-foot">
+ <p class="eyebrow" id="mood"></p>
+ <p class="small muted">
+ A working identity: a poster, a type system, a palette and the reasoning
+ behind them.
+ </p>
+ </div>
+</main>
diff --git a/store/tools/experiences/creative-direction.js b/store/tools/experiences/creative-direction.js
new file mode 100644
index 000000000..9c4fffc9b
--- /dev/null
+++ b/store/tools/experiences/creative-direction.js
@@ -0,0 +1,94 @@
+let direction,
+ directionIndex,
+ lockedColors,
+ customBrand = "";
+function renderDirection() {
+ direction = directionModel(seed, directionIndex, lockedColors);
+ const name = customBrand || direction.brand;
+ $("#poster").innerHTML = brandSVG(direction, name);
+ $("#direction-name").textContent =
+ `DIRECTION 0${direction.index + 1} / ${direction.name}`;
+ $("#direction-line").textContent = direction.line;
+ $("#rationale").textContent = direction.note;
+ $("#brand-name").value = name;
+ $("#type-specimen").style.fontFamily = direction.type;
+ $("#type-name").textContent = `${direction.type} display / system sans body`;
+ $("#mood").textContent = direction.mood;
+ $("#swatches").replaceChildren();
+ direction.colors.forEach((color) => {
+ const b = document.createElement("button");
+ b.style.background = color;
+ b.style.color =
+ contrast(color, "#ffffff") > contrast(color, "#151515")
+ ? "#ffffff"
+ : "#151515";
+ b.textContent = color.toUpperCase();
+ b.title = `Show color ${color}`;
+ b.onclick = () =>
+ toast(`${color.toUpperCase()} — included in your exported tokens`);
+ $("#swatches").append(b);
+ });
+ const ratio = contrast(direction.colors[0], direction.colors[1]);
+ $("#contrast").textContent =
+ `Ink on paper: ${ratio.toFixed(1)}:1 contrast · ${ratio >= 7 ? "AAA" : ratio >= 4.5 ? "AA" : "display only"}`;
+ $("#brand-card").style.background = direction.colors[0];
+ $("#brand-card").style.color = direction.colors[1];
+ $("#card-name").textContent = name;
+ $("#card-name").style.fontFamily = direction.type;
+ $$("#directions button").forEach((b, i) =>
+ b.setAttribute("aria-pressed", i === direction.index),
+ );
+}
+directions.forEach((d, i) => {
+ const b = document.createElement("button");
+ b.textContent = `0${i + 1} / ${d.name}`;
+ b.onclick = () => {
+ directionIndex = i;
+ renderDirection();
+ };
+ $("#directions").append(b);
+});
+$("#brand-name").addEventListener("input", (e) => {
+ customBrand = e.target.value;
+ renderDirection();
+});
+$("#lock-palette").onclick = () => {
+ lockedColors = lockedColors ? undefined : [...direction.colors];
+ $("#lock-palette").setAttribute("aria-pressed", !!lockedColors);
+ $("#lock-palette").textContent = lockedColors
+ ? "Palette locked"
+ : "Lock palette";
+};
+$("#tokens").onclick = () =>
+ saveFile(
+ `forme-${hash(seed)}.json`,
+ JSON.stringify(
+ {
+ seed,
+ brand: customBrand || direction.brand,
+ direction: direction.name,
+ colors: Object.fromEntries(
+ ["ink", "paper", "accent", "secondary", "detail"].map((key, i) => [
+ key,
+ direction.colors[i],
+ ]),
+ ),
+ typography: { display: direction.type, body: "system-ui" },
+ rationale: direction.note,
+ },
+ null,
+ 2,
+ ),
+ );
+$("#poster-export").onclick = () =>
+ saveFile(
+ `forme-${hash(seed)}.svg`,
+ brandSVG(direction, customBrand || direction.brand),
+ "image/svg+xml",
+ );
+addEventListener("seedchange", () => {
+ directionIndex = undefined;
+ renderDirection();
+});
+renderDirection();
+ready();
diff --git a/store/tools/experiences/creative-direction.mjs b/store/tools/experiences/creative-direction.mjs
new file mode 100644
index 000000000..4c490515b
--- /dev/null
+++ b/store/tools/experiences/creative-direction.mjs
@@ -0,0 +1,82 @@
+import { random } from "./core.mjs";
+export const directions = [
+ {
+ name: "Coastal modern",
+ brand: "LOW TIDE",
+ line: "Less noise. More horizon.",
+ note: "Mineral tones, generous space and a quietly expressive serif. A direction for places you want to stay.",
+ colors: ["#163f3c", "#f1ebd9", "#d16a3d", "#b4c8b0", "#d9bb8d"],
+ type: "Georgia",
+ mood: "Warm / deliberate / grounded",
+ },
+ {
+ name: "Electric editorial",
+ brand: "OFF HOURS",
+ line: "For the hours that are yours.",
+ note: "Acid yellow interrupts midnight ink. Dense typography and an oversized orbit turn every application into a signal.",
+ colors: ["#1d2448", "#f2eee4", "#d5ef53", "#b3aff0", "#d85a43"],
+ type: "Arial",
+ mood: "Direct / restless / independent",
+ },
+ {
+ name: "Botanical archive",
+ brand: "FERN & FORM",
+ line: "A slower kind of growth.",
+ note: "Botanical silhouettes and archival paper meet deep wine. An old-world serif gives the living forms room to breathe.",
+ colors: ["#4e2834", "#f0e7d5", "#a1b287", "#d5a093", "#b7af7e"],
+ type: "Georgia",
+ mood: "Organic / curious / considered",
+ },
+];
+export function directionModel(seed, index, lockedColors) {
+ const choice =
+ index ?? Math.floor(random(seed, "direction")() * directions.length);
+ return {
+ ...directions[choice],
+ colors: lockedColors ?? [...directions[choice].colors],
+ index: choice,
+ seed: String(seed),
+ angle: random(seed, "layout")() * 80 - 40,
+ };
+}
+export function luminance(hex) {
+ const c = [1, 3, 5]
+ .map((i) => parseInt(hex.slice(i, i + 2), 16) / 255)
+ .map((n) => (n <= 0.04045 ? n / 12.92 : ((n + 0.055) / 1.055) ** 2.4));
+ return c[0] * 0.2126 + c[1] * 0.7152 + c[2] * 0.0722;
+}
+export function contrast(a, b) {
+ const x = luminance(a),
+ y = luminance(b);
+ return (Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05);
+}
+export function xml(value) {
+ return String(value).replace(
+ /[&<>"']/g,
+ (c) =>
+ ({
+ "&": "&amp;",
+ "<": "&lt;",
+ ">": "&gt;",
+ '"': "&quot;",
+ "'": "&apos;",
+ })[c],
+ );
+}
+export function brandSVG(model, brand = model.brand) {
+ const [ink, paper, accent, secondary] = model.colors;
+ const motif =
+ model.index === 2
+ ? Array.from(
+ { length: 11 },
+ (_, i) =>
+ `<ellipse cx="${480 + Math.sin(i * 2.4) * 130}" cy="${190 + i * 39}" rx="125" ry="34" fill="${i % 2 ? accent : secondary}" transform="rotate(${i % 2 ? -35 : 35} ${480 + Math.sin(i * 2.4) * 130} ${190 + i * 39})"/>`,
+ ).join("")
+ : `<circle cx="520" cy="360" r="210" fill="${accent}"/>` +
+ Array.from(
+ { length: 18 },
+ (_, i) =>
+ `<ellipse cx="510" cy="390" rx="${80 + i * 9}" ry="${205 - i * 8}" fill="none" stroke="${model.index === 0 ? ink : secondary}" stroke-width="2" transform="rotate(${model.angle} 510 390)"/>`,
+ ).join("");
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 900"><rect width="800" height="900" fill="${paper}"/><text x="52" y="62" fill="${ink}" font-family="Arial,sans-serif" font-size="13" letter-spacing="5">INDEPENDENT BY NATURE / ${xml(model.seed.slice(0, 12))}</text>${motif}<text x="50" y="740" textLength="695" lengthAdjust="spacingAndGlyphs" fill="${ink}" font-family="${model.type},serif" font-size="88" font-weight="${model.index === 1 ? 700 : 400}">${xml(brand.slice(0, 28))}</text><line x1="52" y1="785" x2="748" y2="785" stroke="${ink}"/><text x="52" y="827" fill="${ink}" font-family="Arial,sans-serif" font-size="20">${xml(model.line)}</text><text x="52" y="864" fill="${ink}" font-family="monospace" font-size="10" letter-spacing="2">AN EXPLORATION BY FORME — ${xml(model.name.toUpperCase())}</text></svg>`;
+}
diff --git a/store/tools/experiences/drone-pilot.css b/store/tools/experiences/drone-pilot.css
new file mode 100644
index 000000000..b55ad031a
--- /dev/null
+++ b/store/tools/experiences/drone-pilot.css
@@ -0,0 +1,181 @@
+:root {
+ --bg: #152025;
+ --panel: #1e2d32;
+ --ink: #e3ece5;
+ --muted: #9ab0b5;
+ --line: #66838744;
+ --accent: #c7e39b;
+}
+.mark {
+ border-radius: 50%;
+ color: var(--accent);
+}
+.flight-layout {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) 240px;
+ gap: 24px;
+ padding: 0 28px 28px;
+}
+.cockpit {
+ position: relative;
+ min-height: 530px;
+ border: 1px solid var(--line);
+ border-radius: 8px;
+ overflow: hidden;
+ background: #293f45;
+}
+.cockpit > canvas {
+ width: 100%;
+ height: 100%;
+ position: absolute;
+ inset: 0;
+ outline-offset: -3px;
+}
+.hud-top {
+ position: absolute;
+ top: 20px;
+ left: 20px;
+ right: 20px;
+ display: flex;
+ justify-content: space-between;
+ font:
+ 10px ui-monospace,
+ monospace;
+ letter-spacing: 0.1em;
+ text-shadow: 0 1px 3px #000;
+}
+.hud-bottom {
+ position: absolute;
+ bottom: 20px;
+ left: 25px;
+ right: 25px;
+ display: flex;
+ justify-content: space-between;
+ pointer-events: none;
+}
+.hud-bottom > div {
+ display: grid;
+ text-shadow: 0 2px 5px #000;
+}
+.hud-bottom strong {
+ font:
+ 32px ui-monospace,
+ monospace;
+ letter-spacing: -0.06em;
+}
+.hud-bottom span {
+ font:
+ 9px ui-monospace,
+ monospace;
+ opacity: 0.8;
+}
+.reticle {
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ transform: translate(-50%, -50%);
+ font-size: 27px;
+ color: #ffffff99;
+ pointer-events: none;
+}
+.gate-hint {
+ position: absolute;
+ top: 56px;
+ left: 20px;
+ font:
+ 10px ui-monospace,
+ monospace;
+ color: #d4e9d0;
+}
+.flight-aside {
+ display: flex;
+ flex-direction: column;
+ gap: 22px;
+}
+.flight-actions {
+ display: grid;
+ gap: 8px;
+}
+.flight-actions button {
+ width: 100%;
+}
+#minimap {
+ width: 100%;
+ height: 180px;
+ margin-top: 12px;
+}
+.flight-pad {
+ display: grid;
+ grid-template-columns: repeat(3, 38px);
+ gap: 5px;
+ margin-top: 15px;
+}
+.flight-pad button:first-child {
+ grid-column: 2;
+}
+.flight-pad button:nth-child(2) {
+ grid-column: 1;
+}
+.flight-pad button {
+ touch-action: none;
+}
+.flight-summary {
+ position: absolute;
+ inset: 32% 10% auto;
+ background: #142124eb;
+ border: 1px solid #b3cdaf55;
+ padding: 24px;
+ text-align: center;
+ backdrop-filter: blur(8px);
+ font-size: 24px;
+}
+.flight-summary span {
+ font-size: 12px;
+ display: block;
+ margin-top: 8px;
+ color: var(--muted);
+}
+@media (max-width: 800px) {
+ .flight-layout {
+ grid-template-columns: 1fr;
+ }
+ .cockpit {
+ min-height: 500px;
+ }
+ .flight-aside {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ }
+ .flight-actions {
+ align-content: start;
+ }
+ .flight-aside .section {
+ margin: 0;
+ }
+}
+@media (max-width: 480px) {
+ .flight-layout {
+ padding: 0 16px 20px;
+ }
+ .cockpit {
+ min-height: 440px;
+ }
+ .hud-top {
+ left: 12px;
+ right: 12px;
+ font-size: 8px;
+ }
+ .hud-bottom {
+ left: 14px;
+ right: 14px;
+ }
+ .hud-bottom strong {
+ font-size: 25px;
+ }
+ .flight-aside {
+ gap: 15px;
+ }
+ .flight-pad {
+ grid-template-columns: repeat(3, 34px);
+ }
+}
diff --git a/store/tools/experiences/drone-pilot.html b/store/tools/experiences/drone-pilot.html
new file mode 100644
index 000000000..91ccc0b6c
--- /dev/null
+++ b/store/tools/experiences/drone-pilot.html
@@ -0,0 +1,77 @@
+<section class="intro">
+ <div>
+ <p class="eyebrow">Training ground / Canyon sector 07</p>
+ <h1>Find your line.</h1>
+ <p>
+ Fly it yourself. Study the autopilot. Every gate, correction and split is
+ yours to inspect.
+ </p>
+ </div>
+ <button id="export-flight">Export telemetry ↗</button>
+</section>
+<main class="flight-layout">
+ <section class="cockpit">
+ <canvas
+ id="flight"
+ tabindex="0"
+ aria-label="First person drone flight. Use W and S to climb and descend, A and D to steer, Space to brake."
+ ></canvas>
+ <div class="hud-top">
+ <span
+ ><i class="dot"></i
+ ><span id="flight-mode">READY / AUTOPILOT</span></span
+ ><span id="flight-clock">00:00.00</span>
+ </div>
+ <div class="reticle" aria-hidden="true">+</div>
+ <div class="gate-hint" id="gate-hint">12 gates. One clean line.</div>
+ <div class="hud-bottom">
+ <div><strong id="velocity">0</strong><span>m/s · airspeed</span></div>
+ <div><strong id="altitude">13.0</strong><span>m · altitude</span></div>
+ <div><strong id="gates">0 / 12</strong><span>gates cleared</span></div>
+ </div>
+ <div id="flight-summary" class="flight-summary" hidden role="status"></div>
+ </section>
+ <aside class="flight-aside">
+ <div class="flight-actions">
+ <button class="primary" id="start-flight">▶ Watch autopilot</button
+ ><button id="manual">Take control</button
+ ><button id="reset-flight">↻ Restart course</button>
+ </div>
+ <section class="section">
+ <p class="eyebrow">The racing line</p>
+ <canvas
+ id="minimap"
+ aria-label="Course overview and recorded flight path"
+ ></canvas>
+ </section>
+ <section class="section">
+ <h3>Flight controls</h3>
+ <p class="small muted">
+ W / S · climb / descend<br />A / D · steer left / right<br />Shift ·
+ boost &nbsp; Space · brake
+ </p>
+ <div class="flight-pad">
+ <button data-axis="y" data-value="1" aria-label="Climb">↑</button
+ ><button data-axis="x" data-value="-1" aria-label="Steer left">←</button
+ ><button data-axis="y" data-value="-1" aria-label="Descend">↓</button
+ ><button data-axis="x" data-value="1" aria-label="Steer right">
+ →
+ </button>
+ </div>
+ </section>
+ <section class="section small muted">
+ <p>
+ Fixed-step browser simulation. The autopilot is a local tracking
+ controller you can inspect and replace.
+ </p>
+ <p style="margin-top: 8px">
+ Flight dynamics are illustrative. This does not control a physical
+ drone.
+ </p>
+ </section>
+ </aside>
+</main>
+<footer class="status-line">
+ <span><i class="dot"></i>60 Hz SIMULATION / SEEDED COURSE</span
+ ><span>PRECISION IS A FEELING YOU CAN LEARN.</span>
+</footer>
diff --git a/store/tools/experiences/drone-pilot.js b/store/tools/experiences/drone-pilot.js
new file mode 100644
index 000000000..6f6c14bcb
--- /dev/null
+++ b/store/tools/experiences/drone-pilot.js
@@ -0,0 +1,314 @@
+let course,
+ state,
+ flightRunning = false,
+ autopilot = true,
+ telemetry = [],
+ keys = {},
+ touchInput = { x: 0, y: 0 },
+ accumulator = 0,
+ previousTime = 0;
+function projectFlight(x, y, z, w, h) {
+ const dz = z - state.z;
+ if (dz < 0.6) return null;
+ const scale = (w * 0.8) / dz;
+ return {
+ x: w / 2 + (x - state.x) * scale,
+ y: h * 0.47 - (y - state.y) * scale,
+ scale,
+ };
+}
+function drawFlight() {
+ if (!state) return;
+ const c = $("#flight"),
+ ctx = c.getContext("2d"),
+ w = c.width,
+ h = c.height;
+ const sky = ctx.createLinearGradient(0, 0, 0, h);
+ sky.addColorStop(0, "#243e4a");
+ sky.addColorStop(0.53, "#849c9a");
+ sky.addColorStop(1, "#576654");
+ ctx.fillStyle = sky;
+ ctx.fillRect(0, 0, w, h);
+ ctx.fillStyle = "#d7d9af";
+ ctx.beginPath();
+ ctx.arc(w * 0.72, h * 0.23, w * 0.035, 0, Math.PI * 2);
+ ctx.fill();
+ ctx.save();
+ ctx.translate(w / 2, h * 0.5);
+ ctx.rotate(-state.vx * 0.009);
+ ctx.translate(-w / 2, -h * 0.5);
+ for (let layer = 0; layer < 3; layer++) {
+ ctx.fillStyle = ["#708989", "#5d7777", "#476164"][layer];
+ ctx.beginPath();
+ ctx.moveTo(-w, h);
+ for (let i = -1; i <= 24; i++) {
+ const x = (i * w) / 22;
+ const y =
+ h * (0.4 + layer * 0.035) -
+ Math.sin(i * 1.2 + layer * 2.2 + (hash(seed) % 20)) * h * 0.05 -
+ Math.cos(i * 2.7) * h * 0.025;
+ ctx.lineTo(x, y);
+ }
+ ctx.lineTo(w * 2, h);
+ ctx.fill();
+ }
+ const base = Math.floor(state.z / 14) * 14;
+ for (let z = base + 250; z > state.z + 1; z -= 14) {
+ const a = projectFlight(-80, 0, z, w, h),
+ b = projectFlight(80, 0, z, w, h);
+ if (!a || !b) continue;
+ ctx.strokeStyle = "#bed3ae24";
+ ctx.lineWidth = 1;
+ ctx.beginPath();
+ ctx.moveTo(a.x, a.y);
+ ctx.lineTo(b.x, b.y);
+ ctx.stroke();
+ }
+ for (let x = -80; x <= 80; x += 10) {
+ const a = projectFlight(x, 0, state.z + 2, w, h),
+ b = projectFlight(x, 0, state.z + 270, w, h);
+ ctx.strokeStyle = "#bed3ae20";
+ ctx.beginPath();
+ ctx.moveTo(a.x, a.y);
+ ctx.lineTo(b.x, b.y);
+ ctx.stroke();
+ }
+ // Cliff columns are projected in world space; their parallax makes steering legible.
+ const boxes = [];
+ for (let i = Math.floor(state.z / 28); i < Math.floor(state.z / 28) + 12; i++)
+ for (const side of [-1, 1]) {
+ const r = random(seed, `rock:${i}:${side}`);
+ boxes.push({
+ x: side * (34 + r() * 22),
+ z: i * 28 + 12,
+ y: 12 + r() * 35,
+ width: 8 + r() * 7,
+ });
+ }
+ for (const box of boxes.sort((a, b) => b.z - a.z)) {
+ const p = [
+ projectFlight(box.x - box.width, 0, box.z, w, h),
+ projectFlight(box.x + box.width, 0, box.z, w, h),
+ projectFlight(box.x + box.width, box.y, box.z, w, h),
+ projectFlight(box.x - box.width, box.y, box.z, w, h),
+ ];
+ if (p.some((v) => !v)) continue;
+ ctx.fillStyle = box.x < 0 ? "#344f53" : "#3d5558";
+ ctx.beginPath();
+ p.forEach((v, i) => (i ? ctx.lineTo(v.x, v.y) : ctx.moveTo(v.x, v.y)));
+ ctx.closePath();
+ ctx.fill();
+ ctx.strokeStyle = "#768d7744";
+ ctx.stroke();
+ }
+ for (let i = course.length - 1; i >= state.next; i--) {
+ const gate = course[i],
+ p = projectFlight(gate.x, gate.y, gate.z, w, h);
+ if (!p || gate.z - state.z > 260) continue;
+ const radius = gate.radius * p.scale;
+ ctx.strokeStyle = i === state.next ? "#d9f0a7" : "#bfd9bc66";
+ ctx.lineWidth = Math.max(2, p.scale * 0.35);
+ ctx.shadowColor = "#ddf7af";
+ ctx.shadowBlur = i === state.next ? 9 : 0;
+ ctx.beginPath();
+ for (let j = 0; j <= 8; j++) {
+ const a = Math.PI / 8 + (j * Math.PI) / 4,
+ x = p.x + Math.cos(a) * radius,
+ y = p.y + Math.sin(a) * radius;
+ j ? ctx.lineTo(x, y) : ctx.moveTo(x, y);
+ }
+ ctx.stroke();
+ ctx.shadowBlur = 0;
+ ctx.font = `${clamp(p.scale * 1.8, 10, 50)}px monospace`;
+ ctx.textAlign = "center";
+ ctx.fillStyle = "#e6f3cc";
+ ctx.fillText(String(i + 1).padStart(2, "0"), p.x, p.y - radius - 8);
+ }
+ ctx.restore();
+ drawMinimap();
+}
+function drawMinimap() {
+ const c = $("#minimap"),
+ ctx = c.getContext("2d"),
+ w = c.width,
+ h = c.height;
+ if (!course) return;
+ ctx.clearRect(0, 0, w, h);
+ const pos = (x, z) => ({
+ x: w / 2 + (x / 90) * w,
+ y: h - 12 - (z / (course.at(-1).z + 30)) * (h - 24),
+ });
+ ctx.strokeStyle = "#94b2a95c";
+ ctx.beginPath();
+ course.forEach((g, i) => {
+ const p = pos(g.x, g.z);
+ i ? ctx.lineTo(p.x, p.y) : ctx.moveTo(p.x, p.y);
+ });
+ ctx.stroke();
+ course.forEach((g, i) => {
+ const p = pos(g.x, g.z);
+ ctx.fillStyle = i < state.next ? "#8eac99" : "#cde4a1";
+ ctx.fillRect(p.x - 3, p.y - 3, 6, 6);
+ });
+ ctx.strokeStyle = "#dfa578";
+ ctx.beginPath();
+ telemetry.forEach((t, i) => {
+ const p = pos(t.x, t.z);
+ i ? ctx.lineTo(p.x, p.y) : ctx.moveTo(p.x, p.y);
+ });
+ ctx.stroke();
+ const p = pos(state.x, state.z);
+ ctx.fillStyle = "#f4eac7";
+ ctx.beginPath();
+ ctx.arc(p.x, p.y, 5, 0, Math.PI * 2);
+ ctx.fill();
+}
+function updateFlightHUD() {
+ $("#velocity").textContent = flightRunning ? state.speed.toFixed(1) : "0";
+ $("#altitude").textContent = state.y.toFixed(1);
+ $("#gates").textContent = `${state.passed} / ${course.length}`;
+ $("#flight-clock").textContent =
+ `${String(Math.floor(state.time / 60)).padStart(2, "0")}:${(state.time % 60).toFixed(2).padStart(5, "0")}`;
+ $("#flight-mode").textContent =
+ `${flightRunning ? "FLYING" : "PAUSED"} / ${autopilot ? "AUTOPILOT" : "MANUAL"}`;
+ $("#gate-hint").textContent =
+ state.next < course.length
+ ? `GATE ${String(state.next + 1).padStart(2, "0")} · ${Math.max(0, course[state.next].z - state.z).toFixed(0)} m · ${state.missed} missed`
+ : "Course complete";
+ $("#start-flight").textContent = flightRunning
+ ? "Ⅱ Pause flight"
+ : autopilot
+ ? "▶ Watch autopilot"
+ : "▶ Resume flight";
+ $("#manual").textContent = autopilot ? "Take control" : "Engage autopilot";
+}
+function resetFlight() {
+ course = flightCourse(seed);
+ state = flightStart();
+ telemetry = [{ ...state }];
+ flightRunning = false;
+ accumulator = 0;
+ keys = {};
+ $("#flight-summary").hidden = true;
+ updateFlightHUD();
+ drawFlight();
+}
+$("#start-flight").onclick = () => {
+ if (state.finished || state.crashed) resetFlight();
+ flightRunning = !flightRunning;
+ updateFlightHUD();
+ $("#flight").focus();
+};
+$("#manual").onclick = () => {
+ autopilot = !autopilot;
+ flightRunning = true;
+ updateFlightHUD();
+ $("#flight").focus();
+};
+$("#reset-flight").onclick = resetFlight;
+addEventListener("keydown", (e) => {
+ if (editable(e.target)) return;
+ if (
+ [
+ "w",
+ "a",
+ "s",
+ "d",
+ "arrowup",
+ "arrowdown",
+ "arrowleft",
+ "arrowright",
+ " ",
+ "shift",
+ ].includes(e.key.toLowerCase())
+ ) {
+ e.preventDefault();
+ keys[e.key.toLowerCase()] = true;
+ }
+});
+addEventListener("keyup", (e) => {
+ keys[e.key.toLowerCase()] = false;
+});
+addEventListener("blur", () => {
+ keys = {};
+ touchInput = { x: 0, y: 0 };
+});
+$$(".flight-pad button").forEach((b) => {
+ b.onpointerdown = (e) => {
+ e.preventDefault();
+ autopilot = false;
+ flightRunning = true;
+ touchInput[b.dataset.axis] = +b.dataset.value;
+ b.setPointerCapture(e.pointerId);
+ updateFlightHUD();
+ };
+ b.onpointerup = b.onpointercancel = () => {
+ touchInput[b.dataset.axis] = 0;
+ };
+});
+$("#export-flight").onclick = () =>
+ saveFile(
+ `vector-${hash(seed)}.json`,
+ JSON.stringify(
+ {
+ seed,
+ mode: autopilot ? "autopilot" : "manual",
+ step: 1 / 60,
+ course,
+ telemetry,
+ result: state,
+ },
+ null,
+ 2,
+ ),
+ );
+function flightFrame(time) {
+ const delta = Math.min(0.1, (time - previousTime) / 1000 || 0);
+ previousTime = time;
+ if (flightRunning && !document.hidden) {
+ accumulator += delta;
+ while (accumulator >= 1 / 60) {
+ state = flightStep(state, course, {
+ autopilot,
+ x:
+ touchInput.x +
+ (keys.d || keys.arrowright ? 1 : 0) -
+ (keys.a || keys.arrowleft ? 1 : 0),
+ y:
+ touchInput.y +
+ (keys.w || keys.arrowup ? 1 : 0) -
+ (keys.s || keys.arrowdown ? 1 : 0),
+ brake: keys[" "],
+ boost: keys.shift,
+ });
+ accumulator -= 1 / 60;
+ if (state.steps % 12 === 0) telemetry.push({ ...state });
+ if (state.finished || state.crashed) {
+ flightRunning = false;
+ $("#flight-summary").hidden = false;
+ $("#flight-summary").replaceChildren(
+ document.createTextNode(
+ state.crashed
+ ? "Back to the flight line."
+ : state.missed
+ ? "A line to improve."
+ : "A clean run.",
+ ),
+ );
+ const span = document.createElement("span");
+ span.textContent = `${state.passed} / ${course.length} gates · ${state.time.toFixed(2)} s · ${state.missed} missed`;
+ $("#flight-summary").append(span);
+ break;
+ }
+ }
+ updateFlightHUD();
+ drawFlight();
+ }
+ requestAnimationFrame(flightFrame);
+}
+fitCanvas($("#flight"), drawFlight);
+fitCanvas($("#minimap"), drawMinimap);
+addEventListener("seedchange", resetFlight);
+resetFlight();
+requestAnimationFrame(flightFrame);
+ready();
diff --git a/store/tools/experiences/drone-pilot.mjs b/store/tools/experiences/drone-pilot.mjs
new file mode 100644
index 000000000..4a605fd6a
--- /dev/null
+++ b/store/tools/experiences/drone-pilot.mjs
@@ -0,0 +1,73 @@
+import { random, clamp, lerp } from "./core.mjs";
+export function flightCourse(seed, count = 12) {
+ const r = random(seed, "gates"),
+ phase = r() * 6.28;
+ return Array.from({ length: count }, (_, i) => ({
+ x: Math.sin(i * 0.62 + phase) * 17,
+ y: 13 + Math.sin(i * 0.85 + phase) * 5,
+ z: 45 + i * 42,
+ radius: 6,
+ index: i,
+ }));
+}
+export function flightStart() {
+ return {
+ x: 0,
+ y: 13,
+ z: 0,
+ vx: 0,
+ vy: 0,
+ speed: 22,
+ next: 0,
+ passed: 0,
+ missed: 0,
+ steps: 0,
+ time: 0,
+ finished: false,
+ crashed: false,
+ };
+}
+export function flightStep(state, course, input = {}, dt = 1 / 60) {
+ const s = { ...state };
+ if (s.finished || s.crashed) return s;
+ const target = course[Math.min(s.next, course.length - 1)];
+ const auto = input.autopilot !== false;
+ const desiredX = auto
+ ? clamp((target.x - s.x) * 2, -15, 15)
+ : (input.x || 0) * 14;
+ const desiredY = auto
+ ? clamp((target.y - s.y) * 2, -10, 10)
+ : (input.y || 0) * 10;
+ s.vx = lerp(s.vx, desiredX, 1 - Math.exp(-dt * 4));
+ s.vy = lerp(s.vy, desiredY, 1 - Math.exp(-dt * 4));
+ s.speed = lerp(
+ s.speed,
+ input.brake ? 7 : input.boost ? 34 : 22,
+ 1 - Math.exp(-dt * 3),
+ );
+ s.x = clamp(s.x + s.vx * dt, -65, 65);
+ s.y += s.vy * dt;
+ s.z += s.speed * dt;
+ s.steps++;
+ s.time = s.steps / 60;
+ if (s.y < 1.5) {
+ s.crashed = true;
+ s.y = 1.5;
+ return s;
+ }
+ s.y = Math.min(48, s.y);
+ if (s.next < course.length && s.z >= target.z) {
+ if (Math.hypot(s.x - target.x, s.y - target.y) <= target.radius) s.passed++;
+ else s.missed++;
+ s.next++;
+ }
+ if (s.z >= course.at(-1).z + 25) s.finished = true;
+ return s;
+}
+export function flyAutopilot(seed) {
+ const course = flightCourse(seed);
+ let state = flightStart();
+ for (let i = 0; i < 6000 && !state.finished && !state.crashed; i++)
+ state = flightStep(state, course);
+ return state;
+}
diff --git a/store/tools/experiences/game-master.css b/store/tools/experiences/game-master.css
new file mode 100644
index 000000000..1c7356ea7
--- /dev/null
+++ b/store/tools/experiences/game-master.css
@@ -0,0 +1,156 @@
+:root {
+ --bg: #161c23;
+ --panel: #1d2731;
+ --ink: #e7e8e3;
+ --muted: #99a7b3;
+ --line: #7c90a42b;
+ --accent: #aadad1;
+}
+.mark {
+ border: 0;
+ font-size: 30px;
+}
+.workspace {
+ grid-template-columns: minmax(0, 1fr) 235px;
+ gap: 26px;
+}
+.scoreboard {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 20px 25px;
+ border: 1px solid var(--line);
+ border-bottom: 0;
+ border-radius: 8px 8px 0 0;
+ background: #1b242d;
+}
+.team {
+ display: flex;
+ align-items: center;
+ gap: 20px;
+}
+.team .eyebrow {
+ color: inherit;
+ font-size: 9px;
+}
+.team strong {
+ font:
+ 44px ui-monospace,
+ monospace;
+ letter-spacing: -0.08em;
+}
+.ember {
+ color: #df896f;
+}
+.tide {
+ color: #74c8c2;
+ flex-direction: row-reverse;
+}
+.match-state {
+ text-align: center;
+ font:
+ 9px/1.8 ui-monospace,
+ monospace;
+ color: var(--muted);
+ letter-spacing: 0.1em;
+}
+.match-state p {
+ color: var(--ink);
+}
+.arena-stage {
+ background: radial-gradient(ellipse at center, #273743, #111a22);
+ border: 1px solid var(--line);
+ border-top: 0;
+ border-radius: 0 0 8px 8px;
+}
+.arena-stage canvas {
+ width: 100%;
+ height: 445px;
+}
+.arena-legend {
+ display: flex;
+ justify-content: center;
+ gap: 20px;
+ font:
+ 10px ui-monospace,
+ monospace;
+ padding: 12px;
+ color: var(--muted);
+}
+.arena-legend i {
+ display: inline-block;
+ width: 6px;
+ height: 6px;
+ border-radius: 50%;
+ margin-right: 5px;
+}
+.replay-controls {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ margin: 16px 0;
+}
+.replay-controls input {
+ flex: 1;
+ width: 50px;
+}
+.replay-controls button,
+.replay-controls select {
+ font-size: 11px;
+ padding: 7px 9px;
+}
+.event-log {
+ padding: 16px 0;
+ border-top: 1px solid var(--line);
+}
+#events {
+ margin-top: 8px;
+ min-height: 108px;
+ font:
+ 10px/1.8 ui-monospace,
+ monospace;
+ color: var(--muted);
+}
+#events p {
+ overflow-wrap: anywhere;
+}
+.tournament-result {
+ font:
+ 12px/1.8 ui-monospace,
+ monospace;
+ color: var(--accent);
+ margin-top: 14px;
+}
+@media (max-width: 800px) {
+ .workspace {
+ grid-template-columns: 1fr;
+ }
+ .arena-stage canvas {
+ height: 420px;
+ }
+}
+@media (max-width: 480px) {
+ .scoreboard {
+ padding: 12px;
+ }
+ .team {
+ gap: 8px;
+ flex-direction: column;
+ }
+ .team strong {
+ font-size: 33px;
+ }
+ .arena-stage canvas {
+ height: 320px;
+ }
+ .arena-legend {
+ font-size: 8px;
+ gap: 10px;
+ }
+ .replay-controls {
+ gap: 5px;
+ }
+ .replay-controls button {
+ padding: 7px;
+ }
+}
diff --git a/store/tools/experiences/game-master.html b/store/tools/experiences/game-master.html
new file mode 100644
index 000000000..60ec29301
--- /dev/null
+++ b/store/tools/experiences/game-master.html
@@ -0,0 +1,102 @@
+<section class="intro">
+ <div>
+ <p class="eyebrow">A contest of strategies / No reflexes required</p>
+ <h1>Think in moves.</h1>
+ <p>
+ Two squads. Three relays. Change the policies, watch the consequences, and
+ test your theory across an entire tournament.
+ </p>
+ </div>
+ <button id="export-replay">Export replay ↗</button>
+</section>
+<main class="workspace">
+ <div>
+ <div class="scoreboard">
+ <div class="team ember">
+ <span class="eyebrow">EMBER / CORAL</span
+ ><strong id="score-ember">0</strong>
+ </div>
+ <div class="match-state">
+ <p id="match-state">THE OPENING</p>
+ <span id="turn">Turn 00 / 72</span>
+ </div>
+ <div class="team tide">
+ <span class="eyebrow">TIDE / TEAL</span
+ ><strong id="score-tide">0</strong>
+ </div>
+ </div>
+ <section class="arena-stage">
+ <canvas
+ id="arena"
+ aria-label="Strategy arena showing two squads competing for three relays"
+ ></canvas>
+ <div class="arena-legend">
+ <span><i style="background: #df896f"></i>Ember</span
+ ><span><i style="background: #74c8c2"></i>Tide</span
+ ><span>◇ Hold a relay: +1 / turn</span>
+ </div>
+ </section>
+ <div class="replay-controls">
+ <button id="play-match" class="primary">Ⅱ Pause</button
+ ><button id="rewind" aria-label="Rewind match">↤</button
+ ><button id="step" aria-label="Next turn">→</button
+ ><input
+ id="timeline"
+ aria-label="Replay turn"
+ type="range"
+ min="0"
+ max="72"
+ value="0"
+ /><select id="speed" aria-label="Playback speed">
+ <option value="600">1×</option>
+ <option value="250">2×</option>
+ <option value="80">4×</option>
+ </select>
+ </div>
+ <section class="event-log">
+ <p class="eyebrow">Decisions at this turn / Heuristic policies</p>
+ <div id="events" role="log"></div>
+ </section>
+ </div>
+ <aside class="side">
+ <div>
+ <p class="eyebrow">The matchup</p>
+ <label class="field"
+ ><span>Ember policy</span
+ ><select id="coral-policy">
+ <option value="control">Control / hold the relays</option>
+ <option value="hunt">Hunt / pressure opponents</option>
+ </select></label
+ ><label class="field"
+ ><span>Tide policy</span
+ ><select id="teal-policy">
+ <option value="hunt">Hunt / pressure opponents</option>
+ <option value="control">Control / hold the relays</option>
+ </select></label
+ >
+ <p class="small muted">
+ Control defends captured relays. Hunt trades position for attacks. Each
+ knockout scores two points, followed by a three-turn respawn.
+ </p>
+ </div>
+ <div class="section">
+ <h3>Put your theory to the test.</h3>
+ <p class="small muted">
+ Run both policies over 32 seeded maps. Find out whether a convincing win
+ survives a different board.
+ </p>
+ <button id="tournament" style="width: 100%; margin-top: 14px">
+ Run 32-match tournament
+ </button>
+ <div id="tournament-result" class="tournament-result" role="status"></div>
+ </div>
+ <div class="section small muted">
+ All decisions are local, inspectable rules. Replays record every turn,
+ position, score and decision. No hidden model calls.
+ </div>
+ </aside>
+</main>
+<footer class="status-line">
+ <span><i class="dot"></i>DETERMINISTIC MATCH ENGINE</span
+ ><span>CHANGE A RULE. WATCH A WORLD CHANGE.</span>
+</footer>
diff --git a/store/tools/experiences/game-master.js b/store/tools/experiences/game-master.js
new file mode 100644
index 000000000..68025d3bc
--- /dev/null
+++ b/store/tools/experiences/game-master.js
@@ -0,0 +1,179 @@
+let match,
+ turn = 0,
+ running = !reducedMotion,
+ lastTurnTime = 0;
+const policyOptions = () => ({
+ coral: $("#coral-policy").value,
+ teal: $("#teal-policy").value,
+});
+function drawArena() {
+ if (!match) return;
+ const c = $("#arena"),
+ ctx = c.getContext("2d"),
+ w = c.width,
+ h = c.height,
+ state = match.history[turn],
+ unit = Math.min(w / 13, h / 11),
+ left = (w - match.map.w * unit) / 2,
+ top = (h - match.map.h * unit) / 2;
+ ctx.clearRect(0, 0, w, h);
+ const pos = (x, y) => ({
+ x: left + (x + 0.5) * unit,
+ y: top + (y + 0.5) * unit,
+ });
+ for (let y = 0; y < match.map.h; y++)
+ for (let x = 0; x < match.map.w; x++) {
+ const p = pos(x, y),
+ wall = match.map.walls.some((v) => v[0] === x && v[1] === y);
+ ctx.fillStyle = wall ? "#405262" : (x + y) % 2 ? "#24333f" : "#263743";
+ ctx.strokeStyle = "#475d6e33";
+ ctx.lineWidth = 1;
+ ctx.beginPath();
+ ctx.roundRect(
+ p.x - unit * 0.46,
+ p.y - unit * 0.46,
+ unit * 0.92,
+ unit * 0.92,
+ unit * 0.08,
+ );
+ ctx.fill();
+ ctx.stroke();
+ if (wall) {
+ ctx.fillStyle = "#536573";
+ ctx.fillRect(
+ p.x - unit * 0.3,
+ p.y - unit * 0.3,
+ unit * 0.6,
+ unit * 0.12,
+ );
+ }
+ }
+ match.map.relays.forEach((r, i) => {
+ const p = pos(r.x, r.y),
+ owner = state.owners[i];
+ ctx.strokeStyle = owner === -1 ? "#d6c69a" : owner ? "#74c8c2" : "#df896f";
+ ctx.lineWidth = 2;
+ ctx.save();
+ ctx.translate(p.x, p.y);
+ ctx.rotate(Math.PI / 4);
+ ctx.strokeRect(-unit * 0.3, -unit * 0.3, unit * 0.6, unit * 0.6);
+ ctx.restore();
+ ctx.fillStyle = ctx.strokeStyle;
+ ctx.font = `${unit * 0.16}px monospace`;
+ ctx.textAlign = "center";
+ ctx.fillText(r.name, p.x, p.y + unit * 0.47);
+ });
+ state.units
+ .filter((u) => !u.wait)
+ .forEach((u) => {
+ const p = pos(u.x, u.y),
+ color = u.team ? "#74c8c2" : "#df896f";
+ ctx.shadowColor = color;
+ ctx.shadowBlur = 10;
+ ctx.fillStyle = color;
+ ctx.beginPath();
+ ctx.arc(p.x, p.y, unit * 0.25, 0, Math.PI * 2);
+ ctx.fill();
+ ctx.shadowBlur = 0;
+ ctx.fillStyle = "#162129";
+ ctx.textAlign = "center";
+ ctx.textBaseline = "middle";
+ ctx.font = `bold ${unit * 0.24}px monospace`;
+ ctx.fillText((u.id % 3) + 1, p.x, p.y);
+ ctx.fillStyle = color;
+ for (let i = 0; i < u.hp; i++)
+ ctx.fillRect(
+ p.x - unit * 0.19 + i * unit * 0.14,
+ p.y - unit * 0.39,
+ unit * 0.1,
+ unit * 0.055,
+ );
+ });
+ ctx.textBaseline = "alphabetic";
+}
+function showTurn() {
+ const state = match.history[turn];
+ $("#score-ember").textContent = state.score[0];
+ $("#score-tide").textContent = state.score[1];
+ $("#turn").textContent = `Turn ${String(turn).padStart(2, "0")} / 72`;
+ $("#timeline").value = turn;
+ $("#match-state").textContent =
+ turn === 72
+ ? match.winner === -1
+ ? "DRAW"
+ : match.winner
+ ? "TIDE WINS"
+ : "EMBER WINS"
+ : turn < 12
+ ? "THE OPENING"
+ : turn < 50
+ ? "THE CONTEST"
+ : "THE ENDGAME";
+ $("#events").replaceChildren();
+ state.log.forEach((line) => {
+ const p = document.createElement("p");
+ p.textContent = line;
+ $("#events").append(p);
+ });
+ $("#play-match").textContent = running
+ ? "Ⅱ Pause"
+ : turn === 72
+ ? "↻ Replay"
+ : "▶ Play";
+ drawArena();
+}
+function newMatch() {
+ match = arenaMatch(seed, policyOptions());
+ turn = 0;
+ $("#tournament-result").textContent = "";
+ showTurn();
+}
+$("#play-match").onclick = () => {
+ if (turn === 72) turn = 0;
+ running = !running;
+ lastTurnTime = performance.now();
+ showTurn();
+};
+$("#step").onclick = () => {
+ running = false;
+ turn = Math.min(72, turn + 1);
+ showTurn();
+};
+$("#rewind").onclick = () => {
+ running = false;
+ turn = 0;
+ showTurn();
+};
+$("#timeline").oninput = () => {
+ running = false;
+ turn = +$("#timeline").value;
+ showTurn();
+};
+for (const id of ["coral-policy", "teal-policy"])
+ $("#" + id).onchange = newMatch;
+$("#export-replay").onclick = () =>
+ saveFile(`relay-${hash(seed)}.json`, JSON.stringify(match, null, 2));
+$("#tournament").onclick = async () => {
+ const b = $("#tournament");
+ b.disabled = true;
+ $("#tournament-result").textContent = "Playing 32 independent maps…";
+ await new Promise((r) => setTimeout(r, 30));
+ const result = arenaTournament(seed, policyOptions());
+ $("#tournament-result").textContent =
+ `Ember ${result.ember} · Tide ${result.tide} · Draws ${result.draws}. Mean Ember margin: ${result.meanMargin.toFixed(1)} points.`;
+ b.disabled = false;
+};
+function arenaFrame(time) {
+ if (running && time - lastTurnTime > +$("#speed").value) {
+ turn = Math.min(72, turn + 1);
+ if (turn === 72) running = false;
+ lastTurnTime = time;
+ showTurn();
+ }
+ requestAnimationFrame(arenaFrame);
+}
+fitCanvas($("#arena"), drawArena);
+addEventListener("seedchange", newMatch);
+newMatch();
+requestAnimationFrame(arenaFrame);
+ready();
diff --git a/store/tools/experiences/game-master.mjs b/store/tools/experiences/game-master.mjs
new file mode 100644
index 000000000..d37ff346d
--- /dev/null
+++ b/store/tools/experiences/game-master.mjs
@@ -0,0 +1,189 @@
+import { random } from "./core.mjs";
+export const arenaSize = { w: 11, h: 9 };
+export function arenaMap(seed) {
+ const r = random(seed, "terrain"),
+ walls = [];
+ for (let y = 1; y < 8; y++)
+ if (y !== 4 && r() > 0.48) {
+ walls.push([3, y], [7, 8 - y]);
+ }
+ return {
+ ...arenaSize,
+ walls,
+ relays: [
+ { x: 5, y: 1, name: "NORTH" },
+ { x: 5, y: 4, name: "CORE" },
+ { x: 5, y: 7, name: "SOUTH" },
+ ],
+ };
+}
+export function arenaPath(map, from, target, occupied = []) {
+ const blocked = new Set(
+ [...map.walls, ...occupied].map(([x, y]) => `${x},${y}`),
+ );
+ blocked.delete(`${target.x},${target.y}`);
+ const queue = [{ x: from.x, y: from.y, path: [] }],
+ seen = new Set([`${from.x},${from.y}`]);
+ for (let i = 0; i < queue.length; i++) {
+ const p = queue[i];
+ if (p.x === target.x && p.y === target.y) return p.path;
+ for (const [dx, dy] of [
+ [1, 0],
+ [0, -1],
+ [-1, 0],
+ [0, 1],
+ ]) {
+ const x = p.x + dx,
+ y = p.y + dy,
+ key = `${x},${y}`;
+ if (
+ x < 0 ||
+ y < 0 ||
+ x >= map.w ||
+ y >= map.h ||
+ seen.has(key) ||
+ blocked.has(key)
+ )
+ continue;
+ seen.add(key);
+ queue.push({ x, y, path: [...p.path, { x, y }] });
+ }
+ }
+ return [];
+}
+export function arenaMatch(
+ seed,
+ { coral = "control", teal = "hunt", rounds = 72 } = {},
+) {
+ const map = arenaMap(seed),
+ rng = random(seed, "decisions"),
+ units = [];
+ for (let team = 0; team < 2; team++)
+ for (let i = 0; i < 3; i++)
+ units.push({
+ id: team * 3 + i,
+ team,
+ x: team ? 10 : 0,
+ y: 2 + i * 2,
+ hp: 3,
+ wait: 0,
+ });
+ let score = [0, 0],
+ owners = [-1, -1, -1];
+ const history = [];
+ const snapshot = (turn, log) => ({
+ turn,
+ score: [...score],
+ owners: [...owners],
+ units: units.map((u) => ({ ...u })),
+ log,
+ });
+ history.push(
+ snapshot(0, ["Three relays. Seventy-two turns. Hold ground to score."]),
+ );
+ for (let turn = 1; turn <= rounds; turn++) {
+ const log = [];
+ const order = turn % 2 ? [0, 3, 1, 4, 2, 5] : [3, 0, 4, 1, 5, 2];
+ for (const index of order) {
+ const u = units[index];
+ if (u.wait) {
+ u.wait--;
+ if (!u.wait) {
+ u.hp = 3;
+ u.x = u.team ? 10 : 0;
+ u.y = 2 + (u.id % 3) * 2;
+ }
+ continue;
+ }
+ const opponents = units.filter((v) => v.team !== u.team && !v.wait),
+ adjacent = opponents.find(
+ (v) => Math.abs(v.x - u.x) + Math.abs(v.y - u.y) === 1,
+ );
+ const name = u.team ? "Tide" : "Ember";
+ if (adjacent) {
+ adjacent.hp--;
+ log.push(
+ `${name} ${(u.id % 3) + 1} tags ${adjacent.team ? "Tide" : "Ember"} ${(adjacent.id % 3) + 1}.`,
+ );
+ if (adjacent.hp === 0) {
+ adjacent.wait = 3;
+ score[u.team] += 2;
+ log.push(`${name} scores a knockout (+2).`);
+ }
+ continue;
+ }
+ const policy = u.team ? teal : coral;
+ const occupied = units
+ .filter((v) => v !== u && !v.wait)
+ .map((v) => [v.x, v.y]);
+ let target;
+ const onRelay = map.relays.findIndex((r) => r.x === u.x && r.y === u.y);
+ if (onRelay !== -1 && policy === "control") {
+ log.push(
+ `${name} ${(u.id % 3) + 1} holds ${map.relays[onRelay].name}.`,
+ );
+ continue;
+ }
+ if (policy === "hunt" && opponents.length && rng() < 0.56)
+ target = [...opponents].sort(
+ (a, b) =>
+ Math.abs(a.x - u.x) +
+ Math.abs(a.y - u.y) -
+ (Math.abs(b.x - u.x) + Math.abs(b.y - u.y)),
+ )[0];
+ else {
+ const candidates = map.relays.map((r, i) => ({
+ ...r,
+ index: i,
+ cost:
+ Math.abs(r.x - u.x) +
+ Math.abs(r.y - u.y) +
+ (owners[i] === u.team ? 7 : 0) +
+ rng() * 2,
+ }));
+ target = candidates.sort((a, b) => a.cost - b.cost)[0];
+ }
+ const path = arenaPath(map, u, target, occupied);
+ const next = path[0];
+ if (next && !occupied.some(([x, y]) => x === next.x && y === next.y)) {
+ u.x = next.x;
+ u.y = next.y;
+ log.push(
+ `${name} ${(u.id % 3) + 1} → ${target.name || "opponent"} (${policy}).`,
+ );
+ }
+ }
+ owners = map.relays.map((r) => {
+ const u = units.find((u) => !u.wait && u.x === r.x && u.y === r.y);
+ return u ? u.team : -1;
+ });
+ owners.forEach((owner) => {
+ if (owner !== -1) score[owner]++;
+ });
+ history.push(snapshot(turn, log.slice(-6)));
+ }
+ return {
+ seed: String(seed),
+ map,
+ policies: { coral, teal },
+ history,
+ winner: score[0] === score[1] ? -1 : score[0] > score[1] ? 0 : 1,
+ };
+}
+export function arenaTournament(seed, options, count = 32) {
+ const wins = [0, 0, 0];
+ let margins = 0;
+ for (let i = 0; i < count; i++) {
+ const match = arenaMatch(`${seed}/match/${i}`, options);
+ wins[match.winner === -1 ? 2 : match.winner]++;
+ const last = match.history.at(-1);
+ margins += last.score[0] - last.score[1];
+ }
+ return {
+ count,
+ ember: wins[0],
+ tide: wins[1],
+ draws: wins[2],
+ meanMargin: margins / count,
+ };
+}
diff --git a/store/tools/experiences/generative-art.css b/store/tools/experiences/generative-art.css
new file mode 100644
index 000000000..b60cf5083
--- /dev/null
+++ b/store/tools/experiences/generative-art.css
@@ -0,0 +1,125 @@
+:root {
+ color-scheme: light;
+ --bg: #e9e8e1;
+ --panel: #f5f3eb;
+ --line: #242d292a;
+ --ink: #26342d;
+ --muted: #646d62;
+ --accent: #314b3a;
+}
+button.primary {
+ color: #f4f1e7;
+}
+.mark {
+ border-radius: 50%;
+}
+.intro h1 {
+ font-weight: 450;
+}
+.intro em {
+ font-family: Georgia, serif;
+ font-weight: 400;
+}
+.workspace {
+ grid-template-columns: minmax(0, 1fr) 230px;
+ max-width: 1320px;
+ margin: auto;
+ gap: 40px;
+}
+.intro {
+ max-width: 1320px;
+ margin: auto;
+}
+.paper-stage {
+ background: #dbdcd4;
+ padding: 30px 50px 18px;
+ display: flex;
+ align-items: center;
+ flex-direction: column;
+ min-width: 0;
+}
+.paper-stage > canvas {
+ width: min(100%, 620px);
+ aspect-ratio: 4/5;
+ height: auto;
+ box-shadow: 0 13px 28px #28302620;
+}
+.caption {
+ font:
+ 9px ui-monospace,
+ monospace;
+ letter-spacing: 0.08em;
+ width: 100%;
+ display: flex;
+ justify-content: space-between;
+ margin-top: 18px;
+ gap: 8px;
+}
+.palettes {
+ display: flex;
+ gap: 8px;
+ margin-top: 20px;
+}
+.palettes button {
+ border-radius: 50%;
+ width: 32px;
+ height: 32px;
+ padding: 0;
+ border: 3px solid var(--bg);
+ outline: 1px solid var(--line);
+}
+.palettes button[aria-pressed="true"] {
+ outline: 2px solid var(--ink);
+}
+.editions {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ gap: 8px;
+}
+.editions button {
+ padding: 0;
+ border: 0;
+ border-radius: 0;
+}
+.editions canvas {
+ width: 100%;
+}
+.editions span {
+ font:
+ 9px ui-monospace,
+ monospace;
+ display: block;
+ margin-top: 6px;
+}
+.side h2 {
+ font:
+ 27px/1.15 Georgia,
+ serif;
+}
+.seed-form button:hover {
+ background: #0000000b;
+}
+.actions select {
+ background: #e9e8e1;
+ font-size: 12px;
+}
+@media (max-width: 800px) {
+ .workspace {
+ grid-template-columns: 1fr;
+ gap: 24px;
+ }
+ .paper-stage {
+ padding: 24px 32px 16px;
+ }
+}
+@media (max-width: 480px) {
+ .paper-stage {
+ padding: 18px;
+ }
+ .intro {
+ padding-top: 22px;
+ }
+ .intro h1 {
+ font-size: 42px;
+ }
+}
diff --git a/store/tools/experiences/generative-art.html b/store/tools/experiences/generative-art.html
new file mode 100644
index 000000000..e3fced06d
--- /dev/null
+++ b/store/tools/experiences/generative-art.html
@@ -0,0 +1,71 @@
+<section class="intro">
+ <div>
+ <p class="eyebrow">A study in controlled disorder · 001</p>
+ <h1>Follow the<br /><em>unexpected.</em></h1>
+ <p>
+ A field of lines. A small set of rules. An edition that belongs to you.
+ </p>
+ </div>
+ <div class="actions">
+ <select id="export-size" aria-label="Export resolution">
+ <option value="1600">1600 × 2000</option>
+ <option value="3200">3200 × 4000</option></select
+ ><button class="primary" id="export">Export print ↗</button>
+ </div>
+</section>
+<main class="workspace">
+ <section class="paper-stage">
+ <canvas id="art" aria-label="Seeded generative artwork"></canvas>
+ <div class="caption">
+ <span>FIELD NOTES / <span id="edition"></span></span
+ ><span id="palette-name"></span>
+ </div>
+ </section>
+ <aside class="side">
+ <div>
+ <p class="eyebrow">The system</p>
+ <h2 style="margin-top: 10px">Make a little<br />room for chance.</h2>
+ <label class="field"
+ ><span>Technique</span
+ ><select id="mode">
+ <option value="contours">01 / Contour field</option>
+ <option value="dunes">02 / Dune study</option>
+ <option value="orbits">03 / Orbital motion</option>
+ </select></label
+ ><label class="field"
+ ><span>Line density <output id="density-value">120</output></span
+ ><input
+ id="density"
+ type="range"
+ min="40"
+ max="200"
+ value="120" /></label
+ ><label class="field"
+ ><span>Field tension <output id="curl-value">55</output></span
+ ><input id="curl" type="range" min="0" max="100" value="55"
+ /></label>
+ <div
+ id="palettes"
+ class="palettes"
+ role="group"
+ aria-label="Palette"
+ ></div>
+ </div>
+ <div class="section">
+ <h3>Nearby possibilities</h3>
+ <div class="editions" id="editions"></div>
+ <p class="small muted" style="margin-top: 12px">
+ Every seed is a composition. Return to a seed to find it exactly as you
+ left it.
+ </p>
+ </div>
+ <div class="section small muted">
+ Prints use the same geometry at every size. Color and rasterization can
+ vary between devices.
+ </div>
+ </aside>
+</main>
+<footer class="status-line">
+ <span><i class="dot"></i>DETERMINISTIC BY DESIGN</span
+ ><span>CANVAS / NO EXTERNAL ASSETS</span>
+</footer>
diff --git a/store/tools/experiences/generative-art.js b/store/tools/experiences/generative-art.js
new file mode 100644
index 000000000..3a83718f6
--- /dev/null
+++ b/store/tools/experiences/generative-art.js
@@ -0,0 +1,109 @@
+let artwork, paletteOverride;
+function drawArt(canvas, model) {
+ const ctx = canvas.getContext("2d"),
+ p = artPalettes[model.palette];
+ ctx.setTransform(canvas.width / 1000, 0, 0, canvas.height / 1250, 0, 0);
+ ctx.fillStyle = p.paper;
+ ctx.fillRect(0, 0, 1000, 1250);
+ const paths = artPaths(model),
+ colors = random(model.seed, "line-colors");
+ // Batch by ink color. Hundreds of tiny GPU submissions otherwise dominate the redraw.
+ const inks = p.colors.map(() => new Path2D());
+ paths.forEach((points, i) => {
+ const index = Math.floor(
+ (((i / paths.length) * 3 + colors() * 0.45) % 1) * p.colors.length,
+ );
+ points.forEach(([x, y], j) =>
+ j ? inks[index].lineTo(x, y) : inks[index].moveTo(x, y),
+ );
+ });
+ ctx.lineWidth = model.mode === "dunes" ? 2.6 : 2.1;
+ ctx.globalAlpha = 0.83;
+ inks.forEach((path, i) => {
+ ctx.strokeStyle = p.colors[i];
+ ctx.stroke(path);
+ });
+ ctx.globalAlpha = 1;
+ // Seeded paper texture in one draw, in logical coordinates at every export resolution.
+ const grain = random(model.seed, "paper");
+ const texture = document.createElement("canvas");
+ texture.width = texture.height = 128;
+ const textureContext = texture.getContext("2d");
+ const pixels = textureContext.createImageData(128, 128);
+ for (let i = 0; i < pixels.data.length; i += 4) {
+ pixels.data[i] = model.palette === 3 ? 255 : 65;
+ pixels.data[i + 1] = model.palette === 3 ? 255 : 55;
+ pixels.data[i + 2] = model.palette === 3 ? 255 : 46;
+ pixels.data[i + 3] = grain() > 0.91 ? 16 : 0;
+ }
+ textureContext.putImageData(pixels, 0, 0);
+ ctx.fillStyle = ctx.createPattern(texture, "repeat");
+ ctx.fillRect(0, 0, 1000, 1250);
+ ctx.fillStyle = p.colors[0];
+ ctx.font = "9px monospace";
+ ctx.fillText(
+ `FIELDWORK / ${model.seed.slice(0, 26)} / ${model.mode.toUpperCase()}`,
+ 70,
+ 1208,
+ );
+}
+function controls() {
+ return {
+ density: +$("#density").value,
+ curl: +$("#curl").value,
+ mode: $("#mode").value,
+ palette: paletteOverride,
+ };
+}
+function renderArt() {
+ artwork = artModel(seed, controls());
+ $("#density-value").value = artwork.density;
+ $("#curl-value").value = artwork.curl;
+ $("#edition").textContent = seed;
+ $("#palette-name").textContent = artPalettes[artwork.palette].name;
+ drawArt($("#art"), artwork);
+ $$("#palettes button").forEach((b, i) =>
+ b.setAttribute("aria-pressed", i === artwork.palette),
+ );
+ $("#editions").replaceChildren();
+ for (let i = 1; i <= 3; i++) {
+ const next = /^\d{1,9}$/.test(seed) ? String(+seed + i) : `${seed}.${i}`;
+ const button = document.createElement("button"),
+ c = document.createElement("canvas"),
+ label = document.createElement("span");
+ c.width = 160;
+ c.height = 200;
+ label.textContent = next.slice(0, 9);
+ button.setAttribute("aria-label", `Explore seed ${next}`);
+ button.append(c, label);
+ button.onclick = () => setSeed(next);
+ $("#editions").append(button);
+ drawArt(c, artModel(next, controls()));
+ }
+}
+artPalettes.forEach((p, i) => {
+ const b = document.createElement("button");
+ b.title = p.name;
+ b.setAttribute("aria-label", p.name);
+ b.style.background = `conic-gradient(${p.colors.map((c, j) => `${c} ${j * 20}% ${(j + 1) * 20}%`).join(",")})`;
+ b.onclick = () => {
+ paletteOverride = i;
+ renderArt();
+ };
+ $("#palettes").append(b);
+});
+$("#art").width = 1000;
+$("#art").height = 1250;
+for (const id of ["density", "curl", "mode"])
+ $("#" + id).addEventListener("input", renderArt);
+$("#export").onclick = () => {
+ const c = document.createElement("canvas");
+ c.width = +$("#export-size").value;
+ c.height = c.width * 1.25;
+ drawArt(c, artwork);
+ canvasPNG(c, `fieldwork-${hash(seed)}-${artwork.mode}.png`);
+ toast("Your print is ready.");
+};
+addEventListener("seedchange", renderArt);
+renderArt();
+ready();
diff --git a/store/tools/experiences/generative-art.mjs b/store/tools/experiences/generative-art.mjs
new file mode 100644
index 000000000..19ae18cb4
--- /dev/null
+++ b/store/tools/experiences/generative-art.mjs
@@ -0,0 +1,77 @@
+import { random } from "./core.mjs";
+export const artPalettes = [
+ {
+ name: "Estuary",
+ paper: "#f1ecdf",
+ colors: ["#203c36", "#527863", "#9cab86", "#d87746", "#e2b65f"],
+ },
+ {
+ name: "Ultramarine",
+ paper: "#efebe2",
+ colors: ["#132d6c", "#355bb5", "#6e99b3", "#e24f32", "#d59b75"],
+ },
+ {
+ name: "After the rain",
+ paper: "#e9e6ee",
+ colors: ["#332852", "#79658d", "#ac8992", "#cf805c", "#354d52"],
+ },
+ {
+ name: "Ember",
+ paper: "#201e23",
+ colors: ["#edbe7f", "#e67a53", "#ad4248", "#69787b", "#ad9a83"],
+ },
+];
+export function artModel(
+ seed,
+ { density = 120, curl = 55, mode = "contours", palette } = {},
+) {
+ const rnd = random(seed, "composition");
+ return {
+ seed: String(seed),
+ density,
+ curl,
+ mode,
+ palette:
+ palette ?? Math.floor(random(seed, "palette")() * artPalettes.length),
+ phases: Array.from({ length: 5 }, () => rnd() * Math.PI * 2),
+ frequency: 1.4 + rnd() * 1.8,
+ tilt: (rnd() - 0.5) * 0.22,
+ };
+}
+export function artPaths(model) {
+ const { density, curl, phases: p, frequency: f, mode } = model;
+ const paths = [];
+ for (let i = 0; i < density; i++) {
+ const u = i / (density - 1),
+ path = [];
+ for (let j = 0; j <= 140; j++) {
+ const v = j / 140;
+ if (mode === "orbits") {
+ const theta = v * Math.PI * 2;
+ const radius =
+ 50 + u * 385 + Math.sin(theta * 3 + p[0]) * (curl * 0.6) * u;
+ path.push([
+ 500 + Math.cos(theta) * radius,
+ 580 + Math.sin(theta) * radius * 1.25,
+ ]);
+ } else {
+ const wave =
+ Math.sin(v * f * Math.PI + p[0] + u * 2.6) * Math.sin(u * Math.PI);
+ const wave2 =
+ Math.cos(v * Math.PI * 3 + p[1]) * Math.sin(u * Math.PI) * 0.27;
+ if (mode === "dunes")
+ path.push([
+ 70 + v * 860,
+ 170 + u * 890 + (wave + wave2) * curl * 2.1,
+ ]);
+ else
+ path.push([
+ 80 + u * 840 + (wave + wave2) * curl * 2.2,
+ 80 + v * 1070 + (u - 0.5) * model.tilt * 400,
+ ]);
+ }
+ }
+ paths.push(path);
+ }
+ return paths;
+}
diff --git a/store/tools/experiences/lab-bench.css b/store/tools/experiences/lab-bench.css
new file mode 100644
index 000000000..48880de8c
--- /dev/null
+++ b/store/tools/experiences/lab-bench.css
@@ -0,0 +1,122 @@
+:root {
+ --bg: #111b20;
+ --panel: #17242b;
+ --ink: #e9efe9;
+ --muted: #98abb1;
+ --line: #8ea4aa30;
+ --accent: #efc273;
+}
+.intro h1 {
+ font-weight: 450;
+}
+.mark {
+ border-radius: 50%;
+ color: var(--accent);
+}
+.workspace {
+ grid-template-columns: minmax(0, 1fr) 240px;
+ gap: 28px;
+}
+.chart-panel {
+ margin-top: 18px;
+}
+.chart-panel canvas {
+ width: 100%;
+ height: 390px;
+}
+.filter {
+ font-size: 11px;
+ padding: 4px 8px;
+}
+.key {
+ width: 7px;
+ height: 7px;
+ border-radius: 50%;
+ display: inline-block;
+ margin-right: 5px;
+}
+.control-key {
+ background: #73b3b5;
+}
+.treatment-key {
+ background: #efc273;
+}
+.probe {
+ padding: 10px 18px;
+ font-size: 10px;
+ min-height: 38px;
+ color: var(--muted);
+ border-top: 1px solid var(--line);
+}
+.inference {
+ display: grid;
+ grid-template-columns: 1.3fr 1fr;
+ gap: 20px;
+ padding: 24px 0;
+}
+.inference h2 {
+ font-size: 22px;
+ margin: 7px 0;
+}
+.inference canvas {
+ width: 100%;
+ height: 115px;
+}
+.formula {
+ padding: 15px 12px;
+ background: #0b151b;
+ font:
+ 11px/1.9 ui-monospace,
+ monospace;
+ border-left: 2px solid var(--accent);
+ color: var(--accent);
+}
+details {
+ border-top: 1px solid var(--line);
+ padding: 16px 0;
+}
+summary {
+ font-size: 12px;
+ cursor: pointer;
+}
+.table-scroll {
+ overflow: auto;
+}
+table {
+ width: 100%;
+ border-collapse: collapse;
+ font:
+ 11px ui-monospace,
+ monospace;
+ margin-top: 14px;
+ text-align: left;
+}
+td,
+th {
+ padding: 9px 10px;
+ border-bottom: 1px solid var(--line);
+}
+th {
+ color: var(--muted);
+ font-weight: 400;
+}
+@media (max-width: 800px) {
+ .workspace {
+ grid-template-columns: 1fr;
+ }
+}
+@media (max-width: 480px) {
+ .chart-panel canvas {
+ height: 300px;
+ }
+ .panel-head {
+ flex-wrap: wrap;
+ }
+ .inference {
+ grid-template-columns: 1fr;
+ gap: 3px;
+ }
+ .metric strong {
+ font-size: 21px;
+ }
+}
diff --git a/store/tools/experiences/lab-bench.html b/store/tools/experiences/lab-bench.html
new file mode 100644
index 000000000..4a5ea6c43
--- /dev/null
+++ b/store/tools/experiences/lab-bench.html
@@ -0,0 +1,119 @@
+<section class="intro">
+ <div>
+ <p class="eyebrow">Experiment 024 / Synthetic materials lab</p>
+ <h1>Find the signal.</h1>
+ <p>
+ Does a catalyst improve yield? Change the experiment, inspect each
+ observation, and see what the data supports.
+ </p>
+ </div>
+ <button id="export-csv" class="primary">Export observations ↗</button>
+</section>
+<main class="workspace">
+ <div>
+ <div class="metrics">
+ <div class="metric">
+ <strong id="sample-count"></strong><span>Visible samples</span>
+ </div>
+ <div class="metric">
+ <strong id="effect-estimate"></strong><span>Observed uplift · pp</span>
+ </div>
+ <div class="metric">
+ <strong id="r-squared"></strong><span>Visible fit · R²</span>
+ </div>
+ </div>
+ <section class="panel chart-panel">
+ <div class="panel-head">
+ <span class="small">Temperature × reaction yield</span>
+ <div class="actions">
+ <button class="filter" id="control" aria-pressed="true">
+ <i class="key control-key"></i>Control</button
+ ><button class="filter" id="treatment" aria-pressed="true">
+ <i class="key treatment-key"></i>Catalyst
+ </button>
+ </div>
+ </div>
+ <canvas
+ id="chart"
+ tabindex="0"
+ role="img"
+ aria-label="Scatter plot of temperature against yield. Exact observations are available in the table below."
+ ></canvas>
+ <p id="probe" class="probe mono" role="status">
+ Hover a point to inspect an observation.
+ </p>
+ </section>
+ <section class="inference">
+ <div>
+ <p class="eyebrow">What the experiment says</p>
+ <h2 id="conclusion"></h2>
+ <p class="small muted" id="interval"></p>
+ </div>
+ <canvas
+ id="interval-chart"
+ aria-label="Confidence interval for the observed treatment difference"
+ ></canvas>
+ </section>
+ <details>
+ <summary>
+ Inspect observations <span class="muted">/ first 12 visible rows</span>
+ </summary>
+ <div class="table-scroll">
+ <table>
+ <thead>
+ <tr>
+ <th>Sample</th>
+ <th>Group</th>
+ <th>Temp · °C</th>
+ <th>Yield · %</th>
+ </tr>
+ </thead>
+ <tbody id="observations"></tbody>
+ </table>
+ </div>
+ </details>
+ </div>
+ <aside class="side">
+ <div>
+ <p class="eyebrow">Design the experiment</p>
+ <label class="field"
+ ><span>True catalyst effect <output id="effect-value"></output></span
+ ><input id="effect" type="range" min="-20" max="30" value="12" /></label
+ ><label class="field"
+ ><span>Measurement noise <output id="noise-value"></output></span
+ ><input id="noise" type="range" min="1" max="20" value="9" /></label
+ ><label class="field"
+ ><span>Sample size <output id="count-value"></output></span
+ ><input
+ id="count"
+ type="range"
+ min="48"
+ max="240"
+ step="12"
+ value="120" /></label
+ ><button id="run" style="width: 100%">Replay collection</button>
+ </div>
+ <div class="section">
+ <h3>A model you can inspect</h3>
+ <p class="formula">
+ yield = 28 + 0.48 × temperature<br />+ catalyst effect + noise
+ </p>
+ <p class="small muted" style="margin-top: 12px">
+ Balanced groups, seeded temperatures, independent Gaussian measurement
+ noise. The observed difference can depart from the true effect.
+ </p>
+ </div>
+ <div class="section small muted">
+ <strong>Synthetic data, by design.</strong>
+ <p style="margin-top: 8px">
+ The 95% interval uses a normal approximation for the unadjusted
+ difference of means. It illustrates uncertainty; it is not a real
+ experimental finding.
+ </p>
+ </div>
+ </aside>
+</main>
+<footer class="status-line">
+ <span><i class="dot"></i>REPRODUCIBLE OBSERVATIONS</span
+ ><span>SEED / PROBE / QUESTION / REPEAT</span>
+</footer>
diff --git a/store/tools/experiences/lab-bench.js b/store/tools/experiences/lab-bench.js
new file mode 100644
index 000000000..40d07bf6a
--- /dev/null
+++ b/store/tools/experiences/lab-bench.js
@@ -0,0 +1,223 @@
+let points = [],
+ visible = [],
+ showControl = true,
+ showTreatment = true,
+ collected = Infinity,
+ collectTimer;
+const groupColors = ["#73b3b5", "#efc273"];
+function experimentOptions() {
+ return {
+ effect: +$("#effect").value,
+ noise: +$("#noise").value,
+ count: +$("#count").value,
+ };
+}
+function drawChart() {
+ const c = $("#chart"),
+ ctx = c.getContext("2d"),
+ w = c.width,
+ h = c.height;
+ if (!w || !h) return;
+ const d = w / c.getBoundingClientRect().width,
+ m = { l: 53 * d, r: 22 * d, t: 24 * d, b: 48 * d };
+ const low = Math.floor(Math.min(0, ...points.map((p) => p.y)) / 20) * 20,
+ high = Math.ceil(Math.max(100, ...points.map((p) => p.y)) / 20) * 20;
+ const px = (x) => m.l + (x / 100) * (w - m.l - m.r),
+ py = (y) => h - m.b - ((y - low) / (high - low)) * (h - m.b - m.t);
+ ctx.clearRect(0, 0, w, h);
+ ctx.font = `${10 * d}px monospace`;
+ ctx.lineWidth = d;
+ ctx.textAlign = "right";
+ ctx.textBaseline = "middle";
+ for (let i = 0; i <= 5; i++) {
+ const y = low + ((high - low) * i) / 5;
+ ctx.strokeStyle = "#8ea4aa20";
+ ctx.beginPath();
+ ctx.moveTo(m.l, py(y));
+ ctx.lineTo(w - m.r, py(y));
+ ctx.stroke();
+ ctx.fillStyle = "#98abb1";
+ ctx.fillText(y.toFixed(0), m.l - 12 * d, py(y));
+ const x = i * 20;
+ ctx.textAlign = "center";
+ ctx.fillText(x, px(x), h - m.b + 20 * d);
+ ctx.textAlign = "right";
+ }
+ ctx.save();
+ ctx.translate(15 * d, h / 2);
+ ctx.rotate(-Math.PI / 2);
+ ctx.textAlign = "center";
+ ctx.fillText("Yield (%)", 0, 0);
+ ctx.restore();
+ ctx.textAlign = "center";
+ ctx.fillText("Temperature (°C)", w / 2, h - 10 * d);
+ for (const group of [0, 1]) {
+ const subset = visible.filter((p) => p.group === group);
+ if (subset.length < 2) continue;
+ const r = regression(subset);
+ ctx.strokeStyle = groupColors[group];
+ ctx.globalAlpha = 0.7;
+ ctx.setLineDash([5 * d, 4 * d]);
+ ctx.beginPath();
+ ctx.moveTo(px(10), py(r.intercept + r.slope * 10));
+ ctx.lineTo(px(90), py(r.intercept + r.slope * 90));
+ ctx.stroke();
+ ctx.setLineDash([]);
+ }
+ visible.forEach((p) => {
+ ctx.globalAlpha = 0.85;
+ ctx.fillStyle = groupColors[p.group];
+ ctx.beginPath();
+ ctx.arc(px(p.x), py(p.y), 3.5 * d, 0, Math.PI * 2);
+ ctx.fill();
+ });
+ ctx.globalAlpha = 1;
+ drawChart.project = (p) => ({ x: px(p.x) / d, y: py(p.y) / d });
+}
+function drawInterval() {
+ const c = $("#interval-chart"),
+ ctx = c.getContext("2d"),
+ w = c.width,
+ h = c.height;
+ const e = treatmentEffect(points.slice(0, collected)),
+ min = Math.min(-20, e.low - 3),
+ max = Math.max(30, e.high + 3),
+ px = (v) => 25 + ((v - min) / (max - min)) * (w - 50);
+ ctx.clearRect(0, 0, w, h);
+ ctx.strokeStyle = "#98abb1";
+ ctx.lineWidth = 1;
+ ctx.beginPath();
+ ctx.moveTo(25, h * 0.5);
+ ctx.lineTo(w - 25, h * 0.5);
+ ctx.stroke();
+ ctx.setLineDash([3, 4]);
+ ctx.beginPath();
+ ctx.moveTo(px(0), h * 0.15);
+ ctx.lineTo(px(0), h * 0.7);
+ ctx.stroke();
+ ctx.setLineDash([]);
+ ctx.lineWidth = 7;
+ ctx.strokeStyle = "#efc273";
+ ctx.beginPath();
+ ctx.moveTo(px(e.low), h * 0.5);
+ ctx.lineTo(px(e.high), h * 0.5);
+ ctx.stroke();
+ ctx.fillStyle = "#e9efe9";
+ ctx.beginPath();
+ ctx.arc(px(e.difference), h * 0.5, 7, 0, Math.PI * 2);
+ ctx.fill();
+ ctx.fillStyle = "#98abb1";
+ ctx.font = "18px monospace";
+ ctx.textAlign = "center";
+ ctx.fillText("0", px(0), h * 0.9);
+ ctx.fillText("95% interval", w / 2, h * 0.12);
+}
+function updateBench() {
+ const partial = points.slice(0, collected);
+ visible = partial.filter((p) => (p.group ? showTreatment : showControl));
+ const e = treatmentEffect(partial),
+ r = regression(visible);
+ $("#sample-count").textContent = visible.length;
+ $("#effect-estimate").textContent =
+ `${e.difference >= 0 ? "+" : ""}${e.difference.toFixed(1)}`;
+ $("#r-squared").textContent = visible.length > 1 ? r.r2.toFixed(2) : "—";
+ $("#conclusion").textContent =
+ e.low > 0
+ ? "A positive signal emerges."
+ : e.high < 0
+ ? "The catalyst reduces yield."
+ : "The effect is still uncertain.";
+ $("#interval").textContent =
+ `95% interval: ${e.low.toFixed(1)} to ${e.high.toFixed(1)} percentage points · both groups, ${partial.length} samples.`;
+ $("#observations").replaceChildren();
+ visible.slice(0, 12).forEach((p) => {
+ const tr = document.createElement("tr");
+ for (const text of [
+ p.id,
+ p.group ? "Catalyst" : "Control",
+ p.x.toFixed(2),
+ p.y.toFixed(2),
+ ]) {
+ const td = document.createElement("td");
+ td.textContent = text;
+ tr.append(td);
+ }
+ $("#observations").append(tr);
+ });
+ drawChart();
+ drawInterval();
+}
+function generateExperiment() {
+ clearInterval(collectTimer);
+ collected = Infinity;
+ $("#run").textContent = "Replay collection";
+ const options = experimentOptions();
+ points = experiment(seed, options);
+ $("#effect-value").value = `${options.effect} pp`;
+ $("#noise-value").value = `±${options.noise} σ`;
+ $("#count-value").value = options.count;
+ updateBench();
+}
+for (const id of ["effect", "noise", "count"])
+ $("#" + id).oninput = generateExperiment;
+$("#control").onclick = () => {
+ if (showControl && !showTreatment)
+ return toast("Keep at least one group visible.");
+ showControl = !showControl;
+ $("#control").setAttribute("aria-pressed", showControl);
+ updateBench();
+};
+$("#treatment").onclick = () => {
+ if (showTreatment && !showControl)
+ return toast("Keep at least one group visible.");
+ showTreatment = !showTreatment;
+ $("#treatment").setAttribute("aria-pressed", showTreatment);
+ updateBench();
+};
+$("#run").onclick = () => {
+ if (Number.isFinite(collected)) {
+ collected = Infinity;
+ clearInterval(collectTimer);
+ $("#run").textContent = "Replay collection";
+ updateBench();
+ return;
+ }
+ collected = 4;
+ $("#run").textContent = "Finish collection";
+ updateBench();
+ collectTimer = setInterval(() => {
+ collected += 4;
+ if (collected >= points.length) {
+ collected = Infinity;
+ clearInterval(collectTimer);
+ $("#run").textContent = "Replay collection";
+ }
+ updateBench();
+ }, 90);
+};
+$("#chart").onpointermove = (e) => {
+ const box = e.currentTarget.getBoundingClientRect(),
+ x = e.clientX - box.left,
+ y = e.clientY - box.top;
+ let best,
+ dist = Infinity;
+ for (const p of visible) {
+ const pos = drawChart.project(p),
+ d = Math.hypot(pos.x - x, pos.y - y);
+ if (d < dist) {
+ best = p;
+ dist = d;
+ }
+ }
+ $("#probe").textContent =
+ best && dist < 25
+ ? `Sample ${best.id} · ${best.group ? "Catalyst" : "Control"} · ${best.x.toFixed(2)} °C · ${best.y.toFixed(2)}% yield`
+ : "Hover a point to inspect an observation.";
+};
+$("#export-csv").onclick = () =>
+ saveFile(`signal-${hash(seed)}.csv`, csvRows(visible), "text/csv");
+fitCanvas($("#chart"), drawChart);
+fitCanvas($("#interval-chart"), drawInterval);
+addEventListener("seedchange", generateExperiment);
+generateExperiment();
+ready();
diff --git a/store/tools/experiences/lab-bench.mjs b/store/tools/experiences/lab-bench.mjs
new file mode 100644
index 000000000..b798d8a5e
--- /dev/null
+++ b/store/tools/experiences/lab-bench.mjs
@@ -0,0 +1,63 @@
+import { random, normal, clamp } from "./core.mjs";
+export function experiment(seed, { count = 120, effect = 12, noise = 9 } = {}) {
+ const xRng = random(seed, "temperature"),
+ noiseRng = random(seed, "measurement");
+ return Array.from({ length: count }, (_, i) => {
+ const group = i % 2,
+ x = 15 + xRng() * 70;
+ return {
+ id: i + 1,
+ group,
+ x,
+ y: 28 + x * 0.48 + effect * group + normal(noiseRng) * noise,
+ };
+ });
+}
+export function stats(values) {
+ const n = values.length,
+ mean = n ? values.reduce((a, b) => a + b, 0) / n : 0;
+ const variance =
+ n > 1 ? values.reduce((a, b) => a + (b - mean) ** 2, 0) / (n - 1) : 0;
+ return { n, mean, variance, sd: Math.sqrt(variance) };
+}
+export function regression(points) {
+ const x = stats(points.map((p) => p.x)),
+ y = stats(points.map((p) => p.y));
+ const xx = points.reduce((a, p) => a + (p.x - x.mean) ** 2, 0);
+ const xy = points.reduce((a, p) => a + (p.x - x.mean) * (p.y - y.mean), 0);
+ const slope = xx ? xy / xx : 0,
+ intercept = y.mean - slope * x.mean;
+ const ss = points.reduce((a, p) => a + (p.y - y.mean) ** 2, 0);
+ const residual = points.reduce(
+ (a, p) => a + (p.y - intercept - slope * p.x) ** 2,
+ 0,
+ );
+ return { slope, intercept, r2: ss ? clamp(1 - residual / ss, 0, 1) : 1 };
+}
+export function treatmentEffect(points) {
+ const a = stats(points.filter((p) => p.group === 0).map((p) => p.y));
+ const b = stats(points.filter((p) => p.group === 1).map((p) => p.y));
+ const difference = b.mean - a.mean,
+ se = Math.sqrt(
+ a.variance / Math.max(1, a.n) + b.variance / Math.max(1, b.n),
+ );
+ return {
+ a,
+ b,
+ difference,
+ low: difference - 1.96 * se,
+ high: difference + 1.96 * se,
+ };
+}
+export function csvRows(points) {
+ return (
+ "sample,group,temperature_c,yield_percent\n" +
+ points
+ .map(
+ (p) =>
+ `${p.id},${p.group ? "treatment" : "control"},${p.x.toFixed(6)},${p.y.toFixed(6)}`,
+ )
+ .join("\n") +
+ "\n"
+ );
+}
diff --git a/store/tools/experiences/music-studio.css b/store/tools/experiences/music-studio.css
new file mode 100644
index 000000000..46a0c6591
--- /dev/null
+++ b/store/tools/experiences/music-studio.css
@@ -0,0 +1,203 @@
+:root {
+ --bg: #201c1b;
+ --panel: #2b2522;
+ --ink: #f0e6d7;
+ --muted: #b5a496;
+ --line: #af958332;
+ --accent: #eda776;
+}
+.intro {
+ padding-top: 34px;
+ padding-bottom: 30px;
+}
+.intro h1 {
+ font-size: clamp(48px, 7vw, 80px);
+}
+.intro h1 em {
+ font-family: Georgia, serif;
+ font-weight: 400;
+}
+.record {
+ width: 166px;
+ height: 166px;
+ border-radius: 50%;
+ background: repeating-radial-gradient(
+ circle,
+ #211f1f 0,
+ #211f1f 2px,
+ #393431 3px,
+ #161515 4px
+ );
+ display: grid;
+ place-items: center;
+ margin-right: 10px;
+ transform: rotate(-13deg);
+ box-shadow: 5px 8px 20px #0005;
+}
+.record-label {
+ width: 65px;
+ height: 65px;
+ border-radius: 50%;
+ background: #c88860;
+ color: #241c18;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ font-size: 10px;
+ font-weight: 800;
+ line-height: 1.1;
+}
+.record-label span {
+ font: 7px monospace;
+ margin-top: 5px;
+}
+.transport {
+ display: flex;
+ gap: 8px;
+ align-items: center;
+ flex-wrap: wrap;
+ padding-bottom: 18px;
+}
+.transport .mono {
+ font-size: 11px;
+ margin: 0 4px;
+}
+#export-wav {
+ margin-left: auto;
+ font-size: 12px;
+}
+.wave-panel {
+ background: #181615;
+ border: 1px solid var(--line);
+ padding: 16px 16px 10px;
+ border-radius: 6px;
+}
+.wave-panel canvas {
+ width: 100%;
+ height: 126px;
+}
+.sections {
+ display: flex;
+ justify-content: space-between;
+ font:
+ 8px ui-monospace,
+ monospace;
+ letter-spacing: 0.07em;
+ color: var(--muted);
+ border-top: 1px solid var(--line);
+ padding-top: 10px;
+}
+.sequencer {
+ margin-top: 18px;
+}
+.sequencer .panel-head {
+ padding: 12px 0;
+ border: 0;
+}
+.step-grid {
+ display: grid;
+ grid-template-columns: 70px repeat(16, minmax(0, 1fr));
+ gap: 5px;
+ align-items: center;
+}
+.step-grid .track {
+ font-size: 10px;
+ text-align: left;
+ border: 0;
+ padding: 8px 0;
+ color: var(--muted);
+}
+.step-grid .step {
+ height: 30px;
+ border-radius: 3px;
+ padding: 0;
+ background: #312a27;
+ border: 1px solid #504138;
+}
+.step-grid .step.beat {
+ background: #3a302b;
+}
+.step-grid .step[aria-pressed="true"] {
+ background: #d59063;
+ border-color: #e5a67e;
+}
+.step-grid .step.current {
+ outline: 2px solid #f9e8c7;
+ outline-offset: 0;
+}
+.step-grid .step-num {
+ font: 8px monospace;
+ text-align: center;
+ color: #a99181;
+}
+.music-note {
+ border-top: 1px solid var(--line);
+ padding: 20px 0;
+}
+.music-note p {
+ font:
+ 17px Georgia,
+ serif;
+ margin-top: 8px;
+}
+.workspace {
+ grid-template-columns: minmax(0, 1fr) 220px;
+ gap: 30px;
+}
+#mixer .field {
+ margin: 12px 0;
+}
+#mixer input {
+ width: 100%;
+}
+@media (max-width: 800px) {
+ .workspace {
+ grid-template-columns: 1fr;
+ }
+ .intro {
+ flex-direction: row;
+ }
+ .record {
+ width: 125px;
+ height: 125px;
+ flex-shrink: 0;
+ }
+}
+@media (max-width: 480px) {
+ .record {
+ width: 94px;
+ height: 94px;
+ margin: 10px 0;
+ }
+ .record-label {
+ width: 46px;
+ height: 46px;
+ font-size: 8px;
+ }
+ .intro h1 {
+ font-size: 42px;
+ }
+ .intro p {
+ font-size: 12px;
+ }
+ .step-grid {
+ grid-template-columns: 47px repeat(16, minmax(0, 1fr));
+ gap: 3px;
+ }
+ .step-grid .step {
+ height: 25px;
+ }
+ .step-grid .track {
+ font-size: 8px;
+ }
+ .transport .mono {
+ font-size: 10px;
+ }
+ #key {
+ display: none;
+ }
+ .sections {
+ font-size: 7px;
+ }
+}
diff --git a/store/tools/experiences/music-studio.html b/store/tools/experiences/music-studio.html
new file mode 100644
index 000000000..1606d7a53
--- /dev/null
+++ b/store/tools/experiences/music-studio.html
@@ -0,0 +1,81 @@
+<section class="intro">
+ <div>
+ <p class="eyebrow">A small room for big ideas / Vol. 01</p>
+ <h1>Stay a little<br /><em>longer.</em></h1>
+ <p>
+ Eight bars after midnight. Shape the rhythm, find the pocket, take the
+ whole thing with you.
+ </p>
+ </div>
+ <div class="record" aria-hidden="true">
+ <div class="record-label">AFTER<br />HOURS<span>33 ⅓</span></div>
+ </div>
+</section>
+<main class="workspace">
+ <div>
+ <section class="transport">
+ <button id="play" class="primary">▶ Play</button
+ ><button id="stop" aria-label="Stop playback">■</button
+ ><span class="mono" id="time">0:00 / 0:00</span
+ ><span id="key" class="muted mono"></span
+ ><button id="export-wav">Export WAV ↗</button>
+ </section>
+ <section class="wave-panel">
+ <canvas
+ id="waveform"
+ aria-label="Waveform of the full arrangement"
+ ></canvas>
+ <div class="sections">
+ <span>01 / ARRIVE</span><span>02 / FIND THE POCKET</span
+ ><span>03 / LET GO</span>
+ </div>
+ </section>
+ <section class="sequencer">
+ <div class="panel-head">
+ <h3>The pattern</h3>
+ <span class="eyebrow" id="bar">8 bars / 16 steps</span>
+ </div>
+ <div class="step-grid" id="steps"></div>
+ <p class="small muted" style="padding: 12px 0">
+ Tap a step to write the pattern. Tap a track name to mute it.
+ </p>
+ </section>
+ <div class="music-note">
+ <span class="eyebrow">Your arrangement</span>
+ <p id="audio-status">Your score is ready. Press Play to hear it.</p>
+ </div>
+ </div>
+ <aside class="side">
+ <div>
+ <p class="eyebrow">The pocket</p>
+ <label class="field"
+ ><span>Tempo <output id="tempo-value"></output></span
+ ><input id="tempo" type="range" min="66" max="132" value="86" /></label
+ ><label class="field"
+ ><span>Swing <output id="swing-value">16%</output></span
+ ><input id="swing" type="range" min="0" max="45" value="16" /></label
+ ><label class="field"
+ ><span>Listening level <output id="volume-value">70%</output></span
+ ><input id="volume" type="range" min="0" max="100" value="70"
+ /></label>
+ </div>
+ <div class="section">
+ <h3>The mix</h3>
+ <div id="mixer"></div>
+ </div>
+ <div class="section small muted">
+ <p>
+ Original, locally synthesized audio. No samples to download, no account,
+ no network.
+ </p>
+ <p style="margin-top: 10px">
+ The same score and settings produce the same PCM samples here. WAV
+ exports are mono, 22.05 kHz.
+ </p>
+ </div>
+ </aside>
+</main>
+<footer class="status-line">
+ <span><i class="dot"></i>LISTEN FIRST. THEN MAKE IT YOURS.</span
+ ><span id="peak"></span>
+</footer>
diff --git a/store/tools/experiences/music-studio.js b/store/tools/experiences/music-studio.js
new file mode 100644
index 000000000..9a1457ba7
--- /dev/null
+++ b/store/tools/experiences/music-studio.js
@@ -0,0 +1,237 @@
+let score,
+ patterns,
+ rendered,
+ audioContext,
+ source,
+ master,
+ started = 0,
+ offset = 0,
+ playing = false,
+ muted = [false, false, false, false, false],
+ levels = [0.85, 0.5, 0.32, 0.6, 0.5];
+const clockText = (s) =>
+ `${Math.floor(s / 60)}:${String(Math.floor(s % 60)).padStart(2, "0")}`;
+const musicOptions = () => ({
+ tempo: +$("#tempo").value,
+ swing: +$("#swing").value,
+ patterns,
+ muted,
+ levels,
+});
+function stopMusic(reset = true) {
+ if (source) {
+ source.onended = null;
+ source.stop();
+ source = null;
+ }
+ if (playing && audioContext) offset = audioContext.currentTime - started;
+ playing = false;
+ if (reset) offset = 0;
+ $("#play").textContent = "▶ Play";
+ drawWave();
+}
+function rebuildMusic() {
+ stopMusic();
+ rendered = renderMusic(score, musicOptions());
+ $("#tempo-value").value = `${$("#tempo").value} BPM`;
+ $("#swing-value").value = `${$("#swing").value}%`;
+ $("#time").textContent = `0:00 / ${clockText(rendered.duration)}`;
+ $("#peak").textContent =
+ `PEAK ${rendered.peak ? (20 * Math.log10(rendered.peak)).toFixed(1) : "−∞"} dBFS`;
+ $("#audio-status").textContent =
+ "Your score is ready. Press Play to hear it.";
+ drawWave();
+}
+function drawWave() {
+ if (!rendered) return;
+ const c = $("#waveform"),
+ ctx = c.getContext("2d"),
+ w = c.width,
+ h = c.height;
+ ctx.clearRect(0, 0, w, h);
+ const pos = playing ? audioContext.currentTime - started : offset;
+ const played = (pos / rendered.duration) * w;
+ const stride = Math.max(1, Math.floor(rendered.samples.length / w));
+ ctx.lineWidth = 1.4;
+ for (let x = 0; x < w; x += 3) {
+ let peak = 0;
+ for (
+ let i = x * stride;
+ i < Math.min((x + 3) * stride, rendered.samples.length);
+ i += 8
+ )
+ peak = Math.max(peak, Math.abs(rendered.samples[i]));
+ ctx.strokeStyle = x < played ? "#efb082" : "#836650";
+ ctx.beginPath();
+ ctx.moveTo(x, h / 2 - peak * h * 0.7);
+ ctx.lineTo(x, h / 2 + peak * h * 0.7);
+ ctx.stroke();
+ }
+ if (playing) {
+ ctx.strokeStyle = "#f7e7d0";
+ ctx.beginPath();
+ ctx.moveTo(played, 0);
+ ctx.lineTo(played, h);
+ ctx.stroke();
+ }
+}
+function renderGrid() {
+ const grid = $("#steps");
+ grid.replaceChildren();
+ grid.append(document.createElement("span"));
+ for (let i = 0; i < 16; i++) {
+ const s = document.createElement("span");
+ s.className = "step-num";
+ s.textContent = i + 1;
+ grid.append(s);
+ }
+ trackNames.forEach((name, track) => {
+ const b = document.createElement("button");
+ b.className = "track";
+ b.textContent = muted[track] ? `${name} ×` : name;
+ b.setAttribute("aria-label", `${muted[track] ? "Unmute" : "Mute"} ${name}`);
+ b.onclick = () => {
+ muted[track] = !muted[track];
+ renderGrid();
+ rebuildMusic();
+ };
+ grid.append(b);
+ patterns[track].forEach((on, tick) => {
+ const s = document.createElement("button");
+ s.className = `step ${tick % 4 === 0 ? "beat" : ""}`;
+ s.dataset.tick = tick;
+ s.setAttribute("aria-pressed", on);
+ s.setAttribute("aria-label", `${name} step ${tick + 1}`);
+ s.onclick = () => {
+ patterns[track][tick] = !patterns[track][tick];
+ renderGrid();
+ rebuildMusic();
+ };
+ grid.append(s);
+ });
+ });
+}
+async function playMusic() {
+ if (playing) {
+ stopMusic(false);
+ return;
+ }
+ try {
+ audioContext ??= new (window.AudioContext || window.webkitAudioContext)();
+ await audioContext.resume();
+ master ??= audioContext.createGain();
+ master.disconnect();
+ master.connect(audioContext.destination);
+ master.gain.value = +$("#volume").value / 100;
+ const buffer = audioContext.createBuffer(
+ 1,
+ rendered.samples.length,
+ rendered.sampleRate,
+ );
+ buffer.copyToChannel(rendered.samples, 0);
+ source = audioContext.createBufferSource();
+ source.buffer = buffer;
+ source.connect(master);
+ if (offset >= rendered.duration) offset = 0;
+ started = audioContext.currentTime - offset;
+ source.start(0, offset);
+ source.onended = () => {
+ playing = false;
+ source = null;
+ offset = 0;
+ $("#play").textContent = "▶ Play";
+ $("#audio-status").textContent =
+ "That was your take. Play it again, or change a step.";
+ };
+ playing = true;
+ $("#play").textContent = "Ⅱ Pause";
+ $("#audio-status").textContent = "Playing your eight-bar arrangement.";
+ } catch (e) {
+ toast("Audio could not start: " + e.message);
+ }
+}
+function newScore() {
+ score = musicScore(seed);
+ patterns = score.patterns.map((row) => [...row]);
+ $("#tempo").value = score.tempo;
+ $("#key").textContent =
+ ["C", "C♯", "D", "E♭", "E", "F", "F♯", "G", "A♭", "A", "B♭", "B"][
+ score.root % 12
+ ] + " minor";
+ renderGrid();
+ rebuildMusic();
+}
+trackNames.forEach((name, i) => {
+ const label = document.createElement("label");
+ label.className = "field";
+ const span = document.createElement("span");
+ span.textContent = name;
+ const input = document.createElement("input");
+ input.type = "range";
+ input.min = 0;
+ input.max = 100;
+ input.value = levels[i] * 100;
+ input.setAttribute("aria-label", `${name} level`);
+ input.onchange = () => {
+ levels[i] = +input.value / 100;
+ rebuildMusic();
+ };
+ label.append(span, input);
+ $("#mixer").append(label);
+});
+$("#play").onclick = playMusic;
+$("#stop").onclick = () => {
+ stopMusic();
+ $("#time").textContent = `0:00 / ${clockText(rendered.duration)}`;
+ $("#audio-status").textContent =
+ "Stopped. Press Play to start at the beginning.";
+};
+for (const id of ["tempo", "swing"]) $("#" + id).onchange = rebuildMusic;
+$("#volume").oninput = () => {
+ $("#volume-value").value = `${$("#volume").value}%`;
+ if (master)
+ master.gain.setTargetAtTime(
+ +$("#volume").value / 100,
+ audioContext.currentTime,
+ 0.02,
+ );
+};
+$("#export-wav").onclick = () => {
+ saveFile(
+ `afterhours-${hash(seed)}.wav`,
+ wavFile(rendered.samples, rendered.sampleRate),
+ "audio/wav",
+ );
+ toast("WAV rendered from your current score and mix.");
+};
+let lastTick = -1;
+function musicFrame() {
+ if (playing) {
+ const t = Math.min(rendered.duration, audioContext.currentTime - started),
+ tick = Math.floor(t / (60 / +$("#tempo").value / 4)) % 16;
+ $("#time").textContent =
+ `${clockText(t)} / ${clockText(rendered.duration)}`;
+ $("#bar").textContent =
+ `Bar ${Math.min(8, Math.floor(t / ((60 / +$("#tempo").value) * 4)) + 1)} / 8`;
+ if (tick !== lastTick) {
+ $$(".step").forEach((b) =>
+ b.classList.toggle("current", +b.dataset.tick === tick),
+ );
+ lastTick = tick;
+ }
+ drawWave();
+ } else if (lastTick !== -1) {
+ $$(".step.current").forEach((b) => b.classList.remove("current"));
+ lastTick = -1;
+ }
+ requestAnimationFrame(musicFrame);
+}
+fitCanvas($("#waveform"), drawWave);
+addEventListener("seedchange", newScore);
+addEventListener("pagehide", () => {
+ stopMusic();
+ audioContext?.close();
+});
+newScore();
+musicFrame();
+ready();
diff --git a/store/tools/experiences/music-studio.mjs b/store/tools/experiences/music-studio.mjs
new file mode 100644
index 000000000..34fc338ae
--- /dev/null
+++ b/store/tools/experiences/music-studio.mjs
@@ -0,0 +1,152 @@
+import { random, pick, clamp } from "./core.mjs";
+export const trackNames = ["Kick", "Snare", "Hi-hat", "Bass", "Keys"];
+export function musicScore(seed) {
+ const rhythm = random(seed, "rhythm"),
+ melody = random(seed, "melody"),
+ harmony = random(seed, "harmony");
+ const root = pick([45, 48, 50, 52], harmony),
+ scale = [0, 3, 5, 7, 10];
+ const patterns = [
+ Array.from(
+ { length: 16 },
+ (_, i) => i % 4 === 0 || (i === 14 && rhythm() > 0.5),
+ ),
+ Array.from({ length: 16 }, (_, i) => i === 4 || i === 12),
+ Array.from({ length: 16 }, (_, i) => i % 2 === 0 || rhythm() > 0.64),
+ Array.from({ length: 16 }, (_, i) => [0, 6, 8, 14].includes(i)),
+ Array.from({ length: 16 }, (_, i) => i % 2 === 0 && melody() > 0.18),
+ ];
+ return {
+ seed: String(seed),
+ root,
+ tempo: pick([82, 86, 90, 94], harmony),
+ bars: 8,
+ patterns,
+ notes: Array.from({ length: 16 }, () => root + 24 + pick(scale, melody)),
+ chords: [0, 0, 5, 5, 3, 3, 7, 0],
+ };
+}
+export function scoreEvents(
+ score,
+ {
+ tempo = score.tempo,
+ swing = 16,
+ patterns = score.patterns,
+ muted = [],
+ } = {},
+) {
+ const beat = 60 / tempo,
+ step = beat / 4,
+ events = [];
+ for (let bar = 0; bar < score.bars; bar++)
+ for (let tick = 0; tick < 16; tick++)
+ for (let track = 0; track < 5; track++) {
+ if (
+ !patterns[track][tick] ||
+ muted[track] ||
+ (bar === 0 && track === 1) ||
+ (bar === 7 && tick > 11 && track < 3)
+ )
+ continue;
+ const time =
+ (bar * 16 + tick) * step + (tick % 2 ? (step * swing) / 100 : 0);
+ events.push({
+ track,
+ time,
+ note:
+ track === 3
+ ? score.root - 12 + score.chords[bar]
+ : score.notes[tick] + score.chords[bar],
+ duration:
+ track === 4 ? beat * 1.1 : track === 3 ? beat * 0.7 : beat * 0.35,
+ bar,
+ tick,
+ });
+ }
+ return { events, duration: score.bars * 4 * beat + 1, beat };
+}
+export function renderMusic(score, options = {}, sampleRate = 22050) {
+ const { events, duration } = scoreEvents(score, options),
+ samples = new Float32Array(Math.ceil(duration * sampleRate));
+ const levels = options.levels ?? [0.85, 0.5, 0.32, 0.6, 0.5];
+ for (const event of events) {
+ const { track, time, note } = event,
+ start = Math.round(time * sampleRate),
+ length = Math.min(
+ samples.length - start,
+ Math.ceil((track < 3 ? 0.24 : event.duration + 0.3) * sampleRate),
+ );
+ const frequency = 440 * 2 ** ((note - 69) / 12),
+ noise = random(score.seed, `hit:${track}:${event.bar}:${event.tick}`);
+ let phase = 0;
+ for (let i = 0; i < length; i++) {
+ const t = i / sampleRate;
+ let value = 0;
+ if (track === 0) {
+ phase += (2 * Math.PI * (48 + 125 * Math.exp(-t * 38))) / sampleRate;
+ value = Math.sin(phase) * Math.exp(-t * 18) * 0.8;
+ }
+ if (track === 1)
+ value =
+ ((noise() * 2 - 1) * 0.66 + Math.sin(2 * Math.PI * 180 * t) * 0.34) *
+ Math.exp(-t * 23) *
+ 0.55;
+ if (track === 2) value = (noise() * 2 - 1) * Math.exp(-t * 75) * 0.27;
+ if (track === 3)
+ value =
+ (Math.sin(2 * Math.PI * frequency * t) +
+ 0.18 * Math.sin(4 * Math.PI * frequency * t)) *
+ Math.min(1, t * 90) *
+ Math.exp(-t * 5) *
+ 0.5;
+ if (track === 4)
+ value =
+ (Math.sin(2 * Math.PI * frequency * t) * 0.6 +
+ Math.sin(2 * Math.PI * frequency * 2.002 * t) * 0.15 +
+ Math.sin(2 * Math.PI * frequency * 0.5 * t) * 0.25) *
+ Math.min(1, t * 120) *
+ Math.exp(-t * 3.8) *
+ 0.4;
+ samples[start + i] += value * levels[track];
+ }
+ }
+ // Fixed soft ceiling, no seed-dependent normalization pumping. Leave headroom for playback.
+ let peak = 0,
+ energy = 0;
+ for (let i = 0; i < samples.length; i++) {
+ samples[i] = Math.tanh(samples[i] * 1.25) * 0.9;
+ peak = Math.max(peak, Math.abs(samples[i]));
+ energy += samples[i] ** 2;
+ }
+ return {
+ samples,
+ sampleRate,
+ duration,
+ peak,
+ rms: Math.sqrt(energy / samples.length),
+ };
+}
+export function wavFile(samples, sampleRate) {
+ const out = new ArrayBuffer(44 + samples.length * 2),
+ v = new DataView(out);
+ const text = (offset, s) => {
+ for (let i = 0; i < s.length; i++) v.setUint8(offset + i, s.charCodeAt(i));
+ };
+ text(0, "RIFF");
+ v.setUint32(4, 36 + samples.length * 2, true);
+ text(8, "WAVE");
+ text(12, "fmt ");
+ v.setUint32(16, 16, true);
+ v.setUint16(20, 1, true);
+ v.setUint16(22, 1, true);
+ v.setUint32(24, sampleRate, true);
+ v.setUint32(28, sampleRate * 2, true);
+ v.setUint16(32, 2, true);
+ v.setUint16(34, 16, true);
+ text(36, "data");
+ v.setUint32(40, samples.length * 2, true);
+ samples.forEach((s, i) =>
+ v.setInt16(44 + i * 2, Math.round(clamp(s, -1, 1) * 32767), true),
+ );
+ return out;
+}
diff --git a/store/tools/experiences/voxel-worlds.css b/store/tools/experiences/voxel-worlds.css
new file mode 100644
index 000000000..b5ccf5d14
--- /dev/null
+++ b/store/tools/experiences/voxel-worlds.css
@@ -0,0 +1,247 @@
+:root {
+ --bg: #203b37;
+ --ink: #f1f0d9;
+ --muted: #d6e2c8;
+ --line: #ddeacd45;
+ --accent: #d3e4a5;
+}
+.masthead {
+ position: absolute;
+ inset: 0 0 auto;
+ z-index: 5;
+ background: linear-gradient(#112b35b0, transparent);
+ border: 0;
+}
+.masthead input,
+.masthead button {
+ background: #18353655;
+}
+.mark {
+ border: 0;
+ font-size: 27px;
+}
+.world-stage {
+ position: relative;
+ height: 100dvh;
+ min-height: 560px;
+ background: #94b6bb;
+ overflow: hidden;
+}
+#world {
+ position: absolute;
+ inset: 0;
+ width: 100%;
+ height: 100%;
+ max-width: none;
+ touch-action: none;
+ outline-offset: -3px;
+}
+.world-heading {
+ position: absolute;
+ left: 30px;
+ top: 92px;
+ pointer-events: none;
+ text-shadow: 0 2px 25px #0d282966;
+}
+.world-heading .eyebrow {
+ font-size: 9px;
+}
+.world-heading h1 {
+ font:
+ clamp(50px, 6.5vw, 88px) / 0.91 Georgia,
+ serif;
+ letter-spacing: -0.065em;
+ margin: 14px 0 18px;
+}
+.world-heading > p:last-child {
+ font-size: 12px;
+ line-height: 1.7;
+}
+.world-toolbar {
+ position: absolute;
+ right: 22px;
+ top: 89px;
+ display: grid;
+ gap: 7px;
+}
+.world-toolbar button,
+.build-actions button,
+.world-time button,
+.world-pad button {
+ background: #17352eaa;
+ backdrop-filter: blur(8px);
+ font-size: 11px;
+}
+.build-actions .primary {
+ background: #d3e4a5;
+ color: #203b37;
+}
+.world-crosshair {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ font-size: 25px;
+ color: #fff9;
+ pointer-events: none;
+}
+.world-coordinates {
+ position: absolute;
+ left: 25px;
+ bottom: 184px;
+ display: grid;
+ gap: 3px;
+ font:
+ 9px/1.6 ui-monospace,
+ monospace;
+ text-shadow: 0 1px 3px #000;
+}
+.world-bottom {
+ position: absolute;
+ bottom: 24px;
+ left: 50%;
+ transform: translateX(-50%);
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 10px;
+ width: 90%;
+ pointer-events: none;
+}
+.world-bottom > p {
+ font:
+ 10px ui-monospace,
+ monospace;
+ text-align: center;
+ text-shadow: 0 1px 4px #000;
+ background: #153e3466;
+ padding: 6px 12px;
+ border-radius: 4px;
+}
+.hotbar {
+ display: flex;
+ gap: 6px;
+ pointer-events: auto;
+}
+.hotbar button {
+ width: 55px;
+ height: 54px;
+ background: #18382fd9;
+ border: 1px solid #ffffff33;
+ border-radius: 5px;
+ padding: 5px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ flex-direction: column;
+ gap: 4px;
+ font:
+ 8px ui-monospace,
+ monospace;
+}
+.hotbar button[aria-pressed="true"] {
+ border: 2px solid #edebb7;
+ box-shadow: 0 0 20px #b9d98e44;
+}
+.hotbar i {
+ width: 21px;
+ height: 21px;
+ box-shadow: inset -5px -5px #0002;
+ display: block;
+}
+.build-actions {
+ display: flex;
+ gap: 8px;
+ pointer-events: auto;
+}
+.world-time {
+ position: absolute;
+ right: 22px;
+ bottom: 184px;
+ display: grid;
+ gap: 7px;
+ width: 125px;
+ font:
+ 9px ui-monospace,
+ monospace;
+}
+.world-time input {
+ width: 100%;
+}
+.world-pad {
+ display: none;
+}
+.world-error {
+ position: absolute;
+ inset: 25% 10%;
+ background: #173d36ee;
+ padding: 30px;
+ border-radius: 8px;
+ z-index: 20;
+}
+.overview .world-crosshair {
+ display: none;
+}
+@media (max-width: 750px) {
+ .world-heading {
+ left: 20px;
+ top: 100px;
+ }
+ .world-heading h1 {
+ font-size: 56px;
+ }
+ .world-heading > p:last-child {
+ display: none;
+ }
+ .world-toolbar {
+ top: 90px;
+ right: 14px;
+ }
+ .world-toolbar button {
+ padding: 7px;
+ font-size: 10px;
+ }
+ .world-coordinates {
+ left: 17px;
+ bottom: 190px;
+ }
+ .world-time {
+ right: 14px;
+ bottom: 185px;
+ width: 100px;
+ }
+ .world-pad {
+ position: absolute;
+ display: grid;
+ grid-template-columns: repeat(3, 32px);
+ gap: 4px;
+ left: 16px;
+ bottom: 250px;
+ }
+ .world-pad button {
+ touch-action: none;
+ padding: 6px;
+ }
+ .world-pad button:first-child {
+ grid-column: 2;
+ }
+ .world-pad button:nth-child(2) {
+ grid-column: 1;
+ }
+ .world-pad button:last-child {
+ grid-column: 2;
+ }
+ .world-heading .eyebrow {
+ max-width: 120px;
+ }
+ .hotbar button {
+ width: 47px;
+ }
+ .world-bottom > p {
+ font-size: 9px;
+ max-width: 300px;
+ }
+ .world-bottom {
+ bottom: 16px;
+ }
+}
diff --git a/store/tools/experiences/voxel-worlds.html b/store/tools/experiences/voxel-worlds.html
new file mode 100644
index 000000000..115d76058
--- /dev/null
+++ b/store/tools/experiences/voxel-worlds.html
@@ -0,0 +1,59 @@
+<main class="world-stage">
+ <canvas
+ id="world"
+ tabindex="0"
+ aria-label="Walkable voxel island. Click to look around, use WASD to walk, Space to jump. Use the buttons to place or break blocks."
+ ></canvas>
+ <div class="world-heading">
+ <p class="eyebrow">A place worth getting lost in</p>
+ <h1>A little<br />wild.</h1>
+ <p>Walk the shoreline. Find the cabin.<br />Leave something of your own.</p>
+ </div>
+ <div class="world-toolbar">
+ <button id="overview">Island overview</button
+ ><button id="export-world">Save world ↗</button
+ ><button id="import-world">Open saved world</button
+ ><input
+ id="world-file"
+ type="file"
+ accept=".json,application/json"
+ hidden
+ /><button id="home">Return home</button>
+ </div>
+ <div class="world-crosshair" aria-hidden="true">+</div>
+ <div class="world-coordinates">
+ <span id="coordinates"></span><span id="world-clock"></span>
+ </div>
+ <div class="world-bottom">
+ <p id="target" role="status">
+ Click the world to look around · WASD to walk · Space to jump
+ </p>
+ <div
+ class="hotbar"
+ id="hotbar"
+ role="group"
+ aria-label="Building materials"
+ ></div>
+ <div class="build-actions">
+ <button id="break">Break block</button
+ ><button id="place" class="primary">Place block</button>
+ </div>
+ </div>
+ <div class="world-pad">
+ <button data-key="w" aria-label="Walk forward">↑</button
+ ><button data-key="a" aria-label="Walk left">←</button
+ ><button data-key="s" aria-label="Walk backward">↓</button
+ ><button data-key="d" aria-label="Walk right">→</button
+ ><button data-key=" " aria-label="Jump">↟</button>
+ </div>
+ <div class="world-time">
+ <label for="daylight">Time of day</label
+ ><input id="daylight" type="range" min="0" max="100" value="32" /><button
+ id="cycle"
+ aria-pressed="false"
+ >
+ Day cycle
+ </button>
+ </div>
+ <div class="world-error" id="world-error" hidden></div>
+</main>
diff --git a/store/tools/experiences/voxel-worlds.js b/store/tools/experiences/voxel-worlds.js
new file mode 100644
index 000000000..48f5175ef
--- /dev/null
+++ b/store/tools/experiences/voxel-worlds.js
@@ -0,0 +1,543 @@
+let worldDirty = true;
+let world,
+ player,
+ targetBlock,
+ gl,
+ program,
+ worldBuffer,
+ worldVertexCount = 0,
+ lineBuffer,
+ keys = {},
+ selected = 8,
+ overview = false,
+ cycling = false,
+ timeOfDay = 0.32,
+ lastWorldTime = 0,
+ worldAccum = 0,
+ drag = null,
+ edited = 0;
+const canvas = $("#world");
+function shader(type, source) {
+ const s = gl.createShader(type);
+ gl.shaderSource(s, source);
+ gl.compileShader(s);
+ if (!gl.getShaderParameter(s, gl.COMPILE_STATUS))
+ throw new Error(gl.getShaderInfoLog(s));
+ return s;
+}
+function initGL() {
+ gl = canvas.getContext("webgl", {
+ antialias: true,
+ alpha: true,
+ preserveDrawingBuffer: true,
+ });
+ if (!gl)
+ throw new Error(
+ "This world needs WebGL. Enable hardware acceleration or try another browser.",
+ );
+ program = gl.createProgram();
+ gl.attachShader(
+ program,
+ shader(
+ gl.VERTEX_SHADER,
+ `attribute vec3 position;attribute vec3 color;attribute vec3 normal;attribute vec2 uv;uniform vec3 eye;uniform vec3 right;uniform vec3 up;uniform vec3 forward;uniform float aspect;varying vec3 vColor;varying vec2 vUV;varying float distance;varying float light;void main(){vec3 p=position-eye;float z=dot(p,forward);gl_Position=vec4(dot(p,right)*1.4/aspect,dot(p,up)*1.4,1.0005*z-.100025,z);vColor=color;vUV=uv;distance=length(p);light=.65+max(0.,dot(normal,normalize(vec3(-.4,.9,.3))))*.35;}`,
+ ),
+ );
+ gl.attachShader(
+ program,
+ shader(
+ gl.FRAGMENT_SHADER,
+ `precision mediump float;varying vec3 vColor;varying vec2 vUV;varying float distance;varying float light;uniform vec3 sky;uniform float day;void main(){vec2 pixel=floor(vUV*12.);float grain=fract(sin(dot(pixel,vec2(12.9898,78.233)))*43758.5453);float edge=step(.04,fract(vUV.x))*step(.04,fract(vUV.y));if(vColor.b>vColor.r*1.5){grain=.6;edge=1.;}vec3 c=vColor*(.86+grain*.2)*light*(.25+day*.75)*(.88+.12*edge);gl_FragColor=vec4(mix(c,sky,smoothstep(35.,150.,distance)*.65),1.);}`,
+ ),
+ );
+ gl.linkProgram(program);
+ if (!gl.getProgramParameter(program, gl.LINK_STATUS))
+ throw new Error(gl.getProgramInfoLog(program));
+ gl.useProgram(program);
+ gl.enable(gl.DEPTH_TEST);
+ worldBuffer = gl.createBuffer();
+ lineBuffer = gl.createBuffer();
+}
+const faces = [
+ {
+ n: [1, 0, 0],
+ v: [
+ [1, 0, 0],
+ [1, 1, 0],
+ [1, 1, 1],
+ [1, 0, 1],
+ ],
+ },
+ {
+ n: [-1, 0, 0],
+ v: [
+ [0, 0, 1],
+ [0, 1, 1],
+ [0, 1, 0],
+ [0, 0, 0],
+ ],
+ },
+ {
+ n: [0, 1, 0],
+ v: [
+ [0, 1, 1],
+ [1, 1, 1],
+ [1, 1, 0],
+ [0, 1, 0],
+ ],
+ },
+ {
+ n: [0, -1, 0],
+ v: [
+ [0, 0, 0],
+ [1, 0, 0],
+ [1, 0, 1],
+ [0, 0, 1],
+ ],
+ },
+ {
+ n: [0, 0, 1],
+ v: [
+ [1, 0, 1],
+ [1, 1, 1],
+ [0, 1, 1],
+ [0, 0, 1],
+ ],
+ },
+ {
+ n: [0, 0, -1],
+ v: [
+ [0, 0, 0],
+ [0, 1, 0],
+ [1, 1, 0],
+ [1, 0, 0],
+ ],
+ },
+];
+function meshWorld() {
+ const data = [],
+ uvs = [
+ [0, 0],
+ [0, 1],
+ [1, 1],
+ [1, 0],
+ ];
+ for (let y = 0; y < world.h; y++)
+ for (let z = 0; z < world.d; z++)
+ for (let x = 0; x < world.w; x++) {
+ const id = blockAt(world, x, y, z);
+ if (!id) continue;
+ for (const face of faces) {
+ const [nx, ny, nz] = face.n,
+ next = blockAt(world, x + nx, y + ny, z + nz);
+ if (next && (id === 7 || next !== 7)) continue;
+ let color = blockTypes[id].color;
+ if (id === 1 && ny === 0) color = [0.43, 0.43, 0.25];
+ if (id === 7 && ny < 1) continue;
+ for (const i of [0, 1, 2, 0, 2, 3])
+ data.push(
+ x + face.v[i][0],
+ y + face.v[i][1],
+ z + face.v[i][2],
+ ...color,
+ ...face.n,
+ ...uvs[i],
+ );
+ }
+ }
+ for (const [x1, z1, x2, z2] of [
+ [-160, -160, 208, 0],
+ [-160, 48, 208, 208],
+ [-160, 0, 0, 48],
+ [48, 0, 208, 48],
+ ]) {
+ const vertices = [
+ [x1, 6, z1],
+ [x2, 6, z1],
+ [x2, 6, z2],
+ [x1, 6, z2],
+ ];
+ for (const i of [0, 1, 2, 0, 2, 3])
+ data.push(
+ ...vertices[i],
+ 0.24,
+ 0.52,
+ 0.59,
+ 0,
+ 1,
+ 0,
+ vertices[i][0],
+ vertices[i][2],
+ );
+ }
+ gl.bindBuffer(gl.ARRAY_BUFFER, worldBuffer);
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(data), gl.STATIC_DRAW);
+ worldVertexCount = data.length / 11;
+}
+function bindVertices(buffer) {
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
+ for (const [name, size, offset] of [
+ ["position", 3, 0],
+ ["color", 3, 3],
+ ["normal", 3, 6],
+ ["uv", 2, 9],
+ ]) {
+ const loc = gl.getAttribLocation(program, name);
+ gl.enableVertexAttribArray(loc);
+ gl.vertexAttribPointer(loc, size, gl.FLOAT, false, 44, offset * 4);
+ }
+}
+function drawWorld() {
+ if (!gl || !world) return;
+ const w = canvas.width,
+ h = canvas.height;
+ gl.viewport(0, 0, w, h);
+ const daylight = 0.25 + 0.75 * Math.max(0, Math.sin(timeOfDay * Math.PI * 2)),
+ sky = [
+ lerp(0.075, 0.64, daylight),
+ lerp(0.12, 0.76, daylight),
+ lerp(0.19, 0.76, daylight),
+ ];
+ canvas.style.background = `radial-gradient(circle at 72% 20%,rgba(255,239,182,${daylight}) 0 3%,transparent 3.2%),linear-gradient(180deg,rgb(${sky.map((n) => Math.round(n * 180)).join(",")}),rgb(${sky.map((n) => Math.round(n * 255)).join(",")}) 65%)`;
+ gl.clearColor(0, 0, 0, 0);
+ gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+ const camera = overview
+ ? { x: 57, y: 36, z: 62, yaw: -2.4, pitch: -0.53 }
+ : { ...player, y: player.y + 1.6 };
+ const { yaw, pitch } = camera,
+ forward = [
+ Math.sin(yaw) * Math.cos(pitch),
+ Math.sin(pitch),
+ Math.cos(yaw) * Math.cos(pitch),
+ ],
+ right = [Math.cos(yaw), 0, -Math.sin(yaw)],
+ up = [
+ -Math.sin(yaw) * Math.sin(pitch),
+ Math.cos(pitch),
+ -Math.cos(yaw) * Math.sin(pitch),
+ ];
+ for (const [name, value] of [
+ ["eye", [camera.x, camera.y, camera.z]],
+ ["forward", forward],
+ ["right", right],
+ ["up", up],
+ ["sky", sky],
+ ])
+ gl.uniform3fv(gl.getUniformLocation(program, name), value);
+ gl.uniform1f(gl.getUniformLocation(program, "aspect"), w / h);
+ gl.uniform1f(gl.getUniformLocation(program, "day"), daylight);
+ bindVertices(worldBuffer);
+ gl.drawArrays(gl.TRIANGLES, 0, worldVertexCount);
+ targetBlock = overview
+ ? null
+ : raycastWorld(
+ world,
+ { x: camera.x, y: camera.y, z: camera.z },
+ { x: forward[0], y: forward[1], z: forward[2] },
+ );
+ if (targetBlock) {
+ const { x, y, z } = targetBlock,
+ data = [],
+ corners = [
+ [0, 0, 0],
+ [1, 0, 0],
+ [1, 1, 0],
+ [0, 1, 0],
+ [0, 0, 1],
+ [1, 0, 1],
+ [1, 1, 1],
+ [0, 1, 1],
+ ];
+ for (const [a, b] of [
+ [0, 1],
+ [1, 2],
+ [2, 3],
+ [3, 0],
+ [4, 5],
+ [5, 6],
+ [6, 7],
+ [7, 4],
+ [0, 4],
+ [1, 5],
+ [2, 6],
+ [3, 7],
+ ])
+ for (const i of [a, b])
+ data.push(
+ x + corners[i][0] * 1.004 - 0.002,
+ y + corners[i][1] * 1.004 - 0.002,
+ z + corners[i][2] * 1.004 - 0.002,
+ 1,
+ 1,
+ 0.78,
+ 0,
+ 1,
+ 0,
+ 0.5,
+ 0.5,
+ );
+ gl.bindBuffer(gl.ARRAY_BUFFER, lineBuffer);
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(data), gl.DYNAMIC_DRAW);
+ bindVertices(lineBuffer);
+ gl.drawArrays(gl.LINES, 0, data.length / 11);
+ }
+ $("#target").textContent = overview
+ ? "An island shaped by your seed. Return to the trail to build."
+ : targetBlock
+ ? `${blockTypes[targetBlock.id].name} · ${targetBlock.distance.toFixed(1)} m · left click breaks / right click places`
+ : "Click to look · WASD to walk · Space to jump · drag to look on touch";
+ $("#coordinates").textContent =
+ `${player.x.toFixed(1)} / ${player.y.toFixed(1)} / ${player.z.toFixed(1)} · ${edited} edits`;
+ const hour = Math.floor(timeOfDay * 24);
+ $("#world-clock").textContent =
+ `${String(hour).padStart(2, "0")}:${String(Math.floor(timeOfDay * 24 * 60) % 60).padStart(2, "0")} · island ${seed.slice(0, 14)}`;
+}
+let clickAudio;
+function blockClick() {
+ try {
+ clickAudio ??= new (window.AudioContext || window.webkitAudioContext)();
+ clickAudio.resume();
+ const o = clickAudio.createOscillator(),
+ g = clickAudio.createGain();
+ o.type = "triangle";
+ o.frequency.value = selected === 9 ? 660 : 180;
+ g.gain.setValueAtTime(0.07, clickAudio.currentTime);
+ g.gain.exponentialRampToValueAtTime(0.001, clickAudio.currentTime + 0.075);
+ o.connect(g).connect(clickAudio.destination);
+ o.start();
+ o.stop(clickAudio.currentTime + 0.08);
+ } catch {}
+}
+function editBlock(place) {
+ if (!targetBlock) return toast("Look at a nearby block first.");
+ const p = place ? targetBlock.previous : targetBlock;
+ if (!p || p.y < 1) return toast("The foundation stays in place.");
+ if (
+ place &&
+ Math.abs(p.x + 0.5 - player.x) < 0.75 &&
+ Math.abs(p.z + 0.5 - player.z) < 0.75 &&
+ p.y < player.y + 1.8 &&
+ p.y + 1 > player.y
+ )
+ return toast("Step back a little before placing that block.");
+ if (putBlock(world, p.x, p.y, p.z, place ? selected : 0)) {
+ edited++;
+ meshWorld();
+ blockClick();
+ drawWorld();
+ }
+}
+function newWorld() {
+ world = voxelWorld(seed);
+ player = { ...world.spawn, vy: 0, grounded: true };
+ edited = 0;
+ meshWorld();
+ drawWorld();
+}
+for (const [id, i] of [1, 3, 5, 8, 9].map((id, i) => [id, i])) {
+ const b = document.createElement("button");
+ b.setAttribute("aria-label", blockTypes[id].name);
+ b.title = `${i + 1}: ${blockTypes[id].name}`;
+ b.setAttribute("aria-pressed", selected === id);
+ const sw = document.createElement("i");
+ sw.style.background = `rgb(${blockTypes[id].color.map((n) => Math.round(n * 255)).join(",")})`;
+ b.append(sw, document.createTextNode(blockTypes[id].name));
+ b.onclick = () => {
+ selected = id;
+ $$("#hotbar button").forEach((button, j) =>
+ button.setAttribute("aria-pressed", j === i),
+ );
+ };
+ $("#hotbar").append(b);
+}
+$("#break").onclick = () => editBlock(false);
+$("#place").onclick = () => editBlock(true);
+$("#overview").onclick = () => {
+ overview = !overview;
+ document.body.classList.toggle("overview", overview);
+ $("#overview").textContent = overview
+ ? "Back to the trail"
+ : "Island overview";
+ document.exitPointerLock?.();
+ drawWorld();
+};
+$("#home").onclick = () => {
+ player = { ...world.spawn, vy: 0, grounded: true };
+ overview = false;
+ document.body.classList.remove("overview");
+ $("#overview").textContent = "Island overview";
+ drawWorld();
+};
+$("#daylight").oninput = () => {
+ timeOfDay = +$("#daylight").value / 100;
+ drawWorld();
+};
+$("#cycle").onclick = () => {
+ cycling = !cycling;
+ $("#cycle").setAttribute("aria-pressed", cycling);
+};
+$("#export-world").onclick = () =>
+ saveFile(
+ `tidelands-${hash(seed)}.json`,
+ JSON.stringify({
+ format: "tidelands-1",
+ seed,
+ size: [world.w, world.h, world.d],
+ blocks: Array.from(world.blocks),
+ player,
+ timeOfDay,
+ }),
+ );
+canvas.oncontextmenu = (e) => e.preventDefault();
+canvas.onpointerdown = (e) => {
+ canvas.focus();
+ if (overview) return;
+ if (document.pointerLockElement === canvas) {
+ editBlock(e.button === 2);
+ return;
+ }
+ drag = { x: e.clientX, y: e.clientY };
+ if (e.pointerType === "mouse")
+ canvas.requestPointerLock?.()?.catch?.(() => toast("Drag to look around."));
+ else canvas.setPointerCapture(e.pointerId);
+};
+canvas.onpointerup = canvas.onpointercancel = () => {
+ drag = null;
+};
+addEventListener("pointerup", () => {
+ drag = null;
+});
+document.addEventListener("pointerlockchange", () => {
+ drag = null;
+});
+canvas.onpointermove = (e) => {
+ if (overview) return;
+ let dx = 0,
+ dy = 0;
+ if (document.pointerLockElement === canvas) {
+ dx = e.movementX;
+ dy = e.movementY;
+ } else if (drag) {
+ dx = e.clientX - drag.x;
+ dy = e.clientY - drag.y;
+ drag = { x: e.clientX, y: e.clientY };
+ }
+ if (dx || dy) worldDirty = true;
+ player.yaw += dx * 0.004;
+ player.pitch = clamp(player.pitch - dy * 0.004, -1.3, 1.3);
+};
+addEventListener("keydown", (e) => {
+ if (editable(e.target)) return;
+ const key = e.key.toLowerCase();
+ if (
+ [
+ "w",
+ "a",
+ "s",
+ "d",
+ " ",
+ "shift",
+ "arrowup",
+ "arrowdown",
+ "arrowleft",
+ "arrowright",
+ ].includes(key)
+ ) {
+ e.preventDefault();
+ keys[key] = true;
+ }
+ if (/^[1-5]$/.test(key)) $$("#hotbar button")[+key - 1].click();
+});
+addEventListener("keyup", (e) => {
+ keys[e.key.toLowerCase()] = false;
+});
+addEventListener("blur", () => {
+ keys = {};
+ drag = null;
+});
+$$(".world-pad button").forEach((b) => {
+ b.onpointerdown = (e) => {
+ e.preventDefault();
+ keys[b.dataset.key] = true;
+ b.setPointerCapture(e.pointerId);
+ };
+ b.onpointerup = b.onpointercancel = () => {
+ keys[b.dataset.key] = false;
+ };
+});
+function worldFrame(time) {
+ const delta = Math.min(0.1, (time - lastWorldTime) / 1000 || 0);
+ lastWorldTime = time;
+ if (!document.hidden) {
+ const before = { x: player.x, y: player.y, z: player.z };
+ if (!overview) {
+ worldAccum += delta;
+ while (worldAccum >= 1 / 60) {
+ player = movePlayer(world, player, {
+ forward:
+ (keys.w || keys.arrowup ? 1 : 0) -
+ (keys.s || keys.arrowdown ? 1 : 0),
+ right:
+ (keys.d || keys.arrowright ? 1 : 0) -
+ (keys.a || keys.arrowleft ? 1 : 0),
+ jump: keys[" "],
+ sprint: keys.shift,
+ });
+ worldAccum -= 1 / 60;
+ }
+ }
+ if (cycling) {
+ timeOfDay = (timeOfDay + delta / 240) % 1;
+ $("#daylight").value = timeOfDay * 100;
+ }
+ if (
+ worldDirty ||
+ cycling ||
+ Math.hypot(
+ player.x - before.x,
+ player.y - before.y,
+ player.z - before.z,
+ ) > 0.0001
+ ) {
+ drawWorld();
+ worldDirty = false;
+ }
+ }
+ requestAnimationFrame(worldFrame);
+}
+try {
+ initGL();
+ newWorld();
+ fitCanvas(canvas, drawWorld, 1.5);
+ addEventListener("seedchange", newWorld);
+ requestAnimationFrame(worldFrame);
+ ready();
+} catch (error) {
+ $("#world-error").hidden = false;
+ $("#world-error").textContent = error.message;
+ parentMessage({ type: "harness:error", message: error.message });
+}
+
+$("#import-world").onclick = () => $("#world-file").click();
+$("#world-file").onchange = async (e) => {
+ const file = e.target.files[0];
+ if (!file) return;
+ try {
+ if (file.size > 2 * 1024 * 1024)
+ throw new Error("Choose a Tidelands JSON file smaller than 2 MiB.");
+ const restored = importWorld(JSON.parse(await file.text()));
+ setSeed(restored.world.seed);
+ world = restored.world;
+ player = restored.player;
+ timeOfDay = restored.timeOfDay;
+ $("#daylight").value = timeOfDay * 100;
+ edited = 0;
+ meshWorld();
+ drawWorld();
+ toast("Your world is restored.");
+ } catch (error) {
+ toast(error.message);
+ } finally {
+ e.target.value = "";
+ }
+};
diff --git a/store/tools/experiences/voxel-worlds.mjs b/store/tools/experiences/voxel-worlds.mjs
new file mode 100644
index 000000000..853837377
--- /dev/null
+++ b/store/tools/experiences/voxel-worlds.mjs
@@ -0,0 +1,278 @@
+import { random, clamp } from "./core.mjs";
+export const blockTypes = [
+ null,
+ { name: "Grass", color: [0.4, 0.58, 0.31] },
+ { name: "Earth", color: [0.48, 0.34, 0.23] },
+ { name: "Stone", color: [0.51, 0.55, 0.53] },
+ { name: "Sand", color: [0.81, 0.74, 0.54] },
+ { name: "Timber", color: [0.43, 0.29, 0.17] },
+ { name: "Canopy", color: [0.25, 0.47, 0.27] },
+ { name: "Water", color: [0.24, 0.52, 0.59] },
+ { name: "Cedar", color: [0.68, 0.46, 0.28] },
+ { name: "Lantern", color: [1, 0.74, 0.32] },
+];
+export function blockAt(world, x, y, z) {
+ if (x < 0 || y < 0 || z < 0 || x >= world.w || y >= world.h || z >= world.d)
+ return 0;
+ return world.blocks[(y * world.d + z) * world.w + x];
+}
+export function putBlock(world, x, y, z, id) {
+ if (x < 0 || y < 0 || z < 0 || x >= world.w || y >= world.h || z >= world.d)
+ return false;
+ world.blocks[(y * world.d + z) * world.w + x] = id;
+ return true;
+}
+export function solidBlock(id) {
+ return id !== 0 && id !== 7;
+}
+export function groundAt(world, x, z) {
+ for (let y = world.h - 1; y >= 0; y--)
+ if (solidBlock(blockAt(world, Math.floor(x), y, Math.floor(z))))
+ return y + 1;
+ return 0;
+}
+export function voxelWorld(seed) {
+ const world = {
+ seed: String(seed),
+ w: 48,
+ h: 28,
+ d: 48,
+ blocks: new Uint8Array(48 * 28 * 48),
+ },
+ r = random(seed, "terrain"),
+ phase = r() * 6.28,
+ phase2 = r() * 6.28;
+ for (let z = 0; z < world.d; z++)
+ for (let x = 0; x < world.w; x++) {
+ const radius = Math.hypot((x - 24) / 25, (z - 24) / 26);
+ let height = clamp(
+ Math.floor(
+ 5 +
+ (1 - radius) * 9 +
+ Math.sin(x * 0.23 + phase) * 1.6 +
+ Math.cos(z * 0.24 + phase2) * 1.6,
+ ),
+ 2,
+ 15,
+ );
+ if (z > 16 && Math.abs(x - (22 + Math.sin(z * 0.2) * 3)) < 1.6)
+ height = Math.min(height, 5);
+ for (let y = 0; y < Math.max(height, 6); y++)
+ putBlock(
+ world,
+ x,
+ y,
+ z,
+ y >= height
+ ? 7
+ : y === height - 1
+ ? height < 8
+ ? 4
+ : 1
+ : y > height - 4
+ ? 2
+ : 3,
+ );
+ }
+ const pad = (cx, cz, radius, height) => {
+ for (let z = cz - radius; z <= cz + radius; z++)
+ for (let x = cx - radius; x <= cx + radius; x++)
+ for (let y = 0; y < world.h; y++)
+ putBlock(world, x, y, z, y < height ? (y === height - 1 ? 1 : 2) : 0);
+ };
+ const spawnHeight = Math.max(8, groundAt(world, 31, 35));
+ pad(31, 35, 3, spawnHeight);
+ const hutHeight = Math.max(8, groundAt(world, 31, 25));
+ pad(31, 25, 4, hutHeight);
+ for (let x = 28; x <= 34; x++)
+ for (let z = 22; z <= 27; z++) {
+ putBlock(world, x, hutHeight, z, 8);
+ for (let y = 1; y <= 3; y++)
+ if (
+ (x === 28 || x === 34 || z === 22 || z === 27) &&
+ !(z === 27 && x === 31 && y <= 2) &&
+ !((x === 28 || x === 34) && z === 24 && y === 2)
+ )
+ putBlock(world, x, hutHeight + y, z, 5);
+ putBlock(world, x, hutHeight + 4, z, 8);
+ if (x > 28 && x < 34) putBlock(world, x, hutHeight + 5, z, 8);
+ }
+ putBlock(world, 30, hutHeight + 3, 26, 9);
+ const towerHeight = groundAt(world, 14, 16);
+ for (let y = towerHeight; y < towerHeight + 7; y++)
+ for (let x = 13; x <= 15; x++)
+ for (let z = 15; z <= 17; z++)
+ putBlock(world, x, y, z, y === towerHeight + 6 ? 9 : 4);
+ // A graded three-block-wide trail connects the cabin floor to the shore.
+ for (let z = 28; z <= 37; z++)
+ for (let x = 30; x <= 32; x++) {
+ const height = Math.round(
+ hutHeight + 1 + ((spawnHeight - hutHeight - 1) * (z - 28)) / 9,
+ );
+ for (let y = 0; y < world.h; y++)
+ putBlock(world, x, y, z, y < height ? (y === height - 1 ? 4 : 2) : 0);
+ }
+ const trees = random(seed, "trees");
+ for (let i = 0; i < 65; i++) {
+ const x = 3 + Math.floor(trees() * 42),
+ z = 3 + Math.floor(trees() * 42),
+ y = groundAt(world, x, z);
+ if (
+ y < 8 ||
+ y > 15 ||
+ blockAt(world, x, y - 1, z) !== 1 ||
+ (x > 26 && x < 37 && z > 19)
+ )
+ continue;
+ for (let j = 0; j < 4; j++) putBlock(world, x, y + j, z, 5);
+ for (let dy = 2; dy <= 5; dy++)
+ for (let dx = -2; dx <= 2; dx++)
+ for (let dz = -2; dz <= 2; dz++)
+ if (
+ Math.abs(dx) + Math.abs(dz) + (dy === 5 ? 1 : 0) < 4 &&
+ blockAt(world, x + dx, y + dy, z + dz) === 0
+ )
+ putBlock(world, x + dx, y + dy, z + dz, 6);
+ }
+ world.spawn = {
+ x: 31.5,
+ y: groundAt(world, 31, 29) + 0.03,
+ z: 29.5,
+ yaw: -0.65,
+ pitch: -0.18,
+ };
+ return world;
+}
+export function raycastWorld(world, origin, direction, max = 7) {
+ let previous;
+ for (let d = 0; d <= max; d += 0.035) {
+ const p = {
+ x: Math.floor(origin.x + direction.x * d),
+ y: Math.floor(origin.y + direction.y * d),
+ z: Math.floor(origin.z + direction.z * d),
+ };
+ const id = blockAt(world, p.x, p.y, p.z);
+ if (solidBlock(id)) return { ...p, id, previous, distance: d };
+ previous = p;
+ }
+ return null;
+}
+export function playerFits(world, x, y, z) {
+ for (const dx of [-0.24, 0.24])
+ for (const dz of [-0.24, 0.24])
+ for (const dy of [0.001, 0.85, 1.65])
+ if (
+ solidBlock(
+ blockAt(
+ world,
+ Math.floor(x + dx),
+ Math.floor(y + dy),
+ Math.floor(z + dz),
+ ),
+ )
+ )
+ return false;
+ return true;
+}
+export function movePlayer(world, player, input, dt = 1 / 60) {
+ const p = { ...player };
+ const speed = input.sprint ? 6 : 3.8;
+ let dx =
+ Math.sin(p.yaw) * (input.forward || 0) +
+ Math.cos(p.yaw) * (input.right || 0),
+ dz =
+ Math.cos(p.yaw) * (input.forward || 0) -
+ Math.sin(p.yaw) * (input.right || 0);
+ const length = Math.max(1, Math.hypot(dx, dz));
+ dx = (dx / length) * speed * dt;
+ dz = (dz / length) * speed * dt;
+ const swimming =
+ blockAt(world, Math.floor(p.x), Math.floor(p.y + 0.3), Math.floor(p.z)) ===
+ 7;
+ for (const [axis, delta] of [
+ ["x", dx],
+ ["z", dz],
+ ]) {
+ const n = clamp(
+ p[axis] + delta,
+ 0.3,
+ (axis === "x" ? world.w : world.d) - 0.3,
+ ),
+ x = axis === "x" ? n : p.x,
+ z = axis === "z" ? n : p.z;
+ if (playerFits(world, x, p.y, z)) p[axis] = n;
+ else if (
+ (p.grounded || swimming) &&
+ playerFits(world, x, p.y + (swimming ? 1.3 : 1.05), z)
+ ) {
+ p[axis] = n;
+ p.y += swimming ? 1.3 : 1.05;
+ }
+ }
+ if (input.jump && (p.grounded || swimming)) p.vy = 6;
+ p.vy = (p.vy || 0) - 16 * dt;
+ if (swimming && p.y < 5.85) p.vy = Math.max(p.vy, (5.85 - p.y) * 5);
+ const nextY = p.y + p.vy * dt;
+ if (playerFits(world, p.x, nextY, p.z)) {
+ p.y = nextY;
+ p.grounded = false;
+ } else {
+ if (p.vy < 0) {
+ p.grounded = true;
+ p.y = Math.ceil(nextY);
+ }
+ p.vy = 0;
+ }
+ if (p.y < 0) {
+ Object.assign(p, world.spawn, { vy: 0, grounded: true });
+ }
+ return p;
+}
+
+export function importWorld(value) {
+ if (
+ !value ||
+ value.format !== "tidelands-1" ||
+ JSON.stringify(value.size) !== "[48,28,48]" ||
+ !Array.isArray(value.blocks) ||
+ value.blocks.length !== 48 * 28 * 48 ||
+ !value.blocks.every(
+ (n) => Number.isInteger(n) && n >= 0 && n < blockTypes.length,
+ )
+ )
+ throw new Error("This file is not a valid Tidelands world.");
+ const world = {
+ seed: String(value.seed).slice(0, 128),
+ w: 48,
+ h: 28,
+ d: 48,
+ blocks: Uint8Array.from(value.blocks),
+ };
+ const p = value.player;
+ if (
+ !p ||
+ !["x", "y", "z", "yaw", "pitch"].every((k) => Number.isFinite(p[k])) ||
+ p.x < 0.3 ||
+ p.x > 47.7 ||
+ p.z < 0.3 ||
+ p.z > 47.7 ||
+ p.y < 0 ||
+ p.y > 28 ||
+ !playerFits(world, p.x, p.y, p.z)
+ )
+ throw new Error("The saved player position is invalid.");
+ world.spawn = {
+ x: p.x,
+ y: p.y,
+ z: p.z,
+ yaw: p.yaw,
+ pitch: clamp(p.pitch, -1.3, 1.3),
+ };
+ return {
+ world,
+ player: { ...world.spawn, vy: 0, grounded: false },
+ timeOfDay: Number.isFinite(value.timeOfDay)
+ ? clamp(value.timeOfDay, 0, 1)
+ : 0.32,
+ };
+}
diff --git a/store/viewers/web-viewer/README.md b/store/viewers/web-viewer/README.md
index d790f719c..eed755de8 100644
--- a/store/viewers/web-viewer/README.md
+++ b/store/viewers/web-viewer/README.md
@@ -36,10 +36,21 @@ node --test store/viewers/web-viewer/test/*.test.mjs
HARNESS_WORKSPACE=/absolute/path/to/project HARNESS_VIEWER_PORT=4310 node store/viewers/web-viewer/viewer.mjs
```
-HTML, CSS, images, and classic JavaScript scripts are supported. The preview uses a sandboxed iframe
-with scripts enabled but no same-origin access; it cannot read the viewer shell. Features requiring
-a same-origin application, such as module imports, fetch, and local storage, need their own app
-server/viewer. Absolute asset paths should use `/files/`; ordinary relative asset paths work directly.
+HTML, CSS, images, JavaScript modules, sibling `fetch()` requests and `localStorage` work in the
+preview. The iframe enables scripts, same-origin access, forms, pointer lock and downloads, so
+interactive workspace apps behave like local apps. This is a **trusted workspace preview**:
+`allow-scripts` plus `allow-same-origin` is not a security boundary from the shell. Preview only
+workspace code you intend to run. Absolute asset paths should use `/files/`; relative paths work.
+
+The shell preserves artifact query parameters (including `seed`) when files change. It offers
+manual reload, pause/resume of automatic reloads, phone/tablet widths and open-in-new-tab. Missing
+files recover when created, failed requests are visible, and the live connection status is explicit.
+
+An artifact can post `{ type: 'harness:state', seed }` to its parent when its seed changes; the shell
+preserves it in the URL and subsequent reloads. `{ type: 'harness:error', message }` adds a visible
+error report. The seven interactive starters use this small protocol; other HTML apps need no
+integration. See the [browser test guide](../../tools/experience-tests/README.md) for sibling-fetch,
+storage, module, control and export regressions.
The server is read-only, bound to `127.0.0.1`, and rejects paths and symlinks outside the workspace.
Dotfiles and `node_modules` are not served or watched for reloads. Individual files are limited to
diff --git a/store/viewers/web-viewer/preview.html b/store/viewers/web-viewer/preview.html
index de0beb747..ef13e3eac 100644
--- a/store/viewers/web-viewer/preview.html
+++ b/store/viewers/web-viewer/preview.html
@@ -1,34 +1,473 @@
<!doctype html>
<html lang="en">
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width, initial-scale=1">
-<title>Web Viewer</title>
-<style>
- :root { color-scheme: light dark; font: 12px system-ui, sans-serif; }
- body { margin: 0; height: 100vh; display: flex; flex-direction: column; }
- header { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: light-dark(#f4f4f4, #252525); }
- #file { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
- #status { margin-left: auto; opacity: .65; white-space: nowrap; }
- button { color: inherit; background: transparent; border: 1px solid #8886; border-radius: 5px; padding: 4px 8px; cursor: pointer; }
- button:hover { background: #8882; }
- iframe { width: 100%; flex: 1; min-height: 0; border: 0; }
-</style>
-<header><span id="file"></span><span id="status" role="status">Connecting…</span><button id="reload">Reload</button></header>
-<iframe id="preview" title="Workspace preview" sandbox="allow-scripts"></iframe>
-<script>
- const requested = new URLSearchParams(location.search).get('file') || 'index.html';
- const parts = requested.split(/[\\/]/);
- const file = parts.some(part => !part || part.startsWith('.')) ? 'index.html' : requested;
- const frame = document.querySelector('#preview');
- const status = document.querySelector('#status');
- document.querySelector('#file').textContent = file;
- const reload = () => { frame.src = '/files/' + file.split('/').map(encodeURIComponent).join('/') + '?v=' + Date.now(); };
- document.querySelector('#reload').addEventListener('click', reload);
- reload();
- const events = new EventSource('/events');
- events.onopen = () => { status.textContent = 'Live'; reload(); };
- events.onerror = () => { status.textContent = 'Reconnecting…'; };
- events.addEventListener('change', reload);
- events.addEventListener('watch-error', () => { status.textContent = 'Use Reload to see changes'; });
-</script>
+ <head>
+ <meta charset="utf-8" />
+ <meta
+ name="viewport"
+ content="width=device-width, initial-scale=1, viewport-fit=cover"
+ />
+ <title>Web Viewer</title>
+ <style>
+ :root {
+ color-scheme: dark light;
+ font:
+ 12px/1.4 -apple-system,
+ BlinkMacSystemFont,
+ "Segoe UI",
+ sans-serif;
+ --bg: light-dark(#f1f2ee, #121615);
+ --ink: light-dark(#23312a, #e4eae4);
+ --line: light-dark(#d4dbd3, #354139);
+ --muted: light-dark(#627167, #9aaba0);
+ --accent: light-dark(#276244, #b9d998);
+ }
+ * {
+ box-sizing: border-box;
+ }
+ [hidden] {
+ display: none !important;
+ }
+ body {
+ margin: 0;
+ height: 100dvh;
+ display: flex;
+ flex-direction: column;
+ overflow: hidden;
+ background: var(--bg);
+ color: var(--ink);
+ }
+ header {
+ flex-shrink: 0;
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ padding: 8px 12px;
+ border-bottom: 1px solid var(--line);
+ min-height: 45px;
+ }
+ .brand {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ min-width: 0;
+ }
+ .logo {
+ color: var(--accent);
+ font-size: 21px;
+ }
+ .file {
+ font:
+ 11px ui-monospace,
+ monospace;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ max-width: 32vw;
+ }
+ .spacer {
+ flex: 1;
+ }
+ button,
+ select,
+ a {
+ color: inherit;
+ font: inherit;
+ background: transparent;
+ border: 1px solid var(--line);
+ padding: 5px 9px;
+ border-radius: 5px;
+ text-decoration: none;
+ white-space: nowrap;
+ }
+ button {
+ cursor: pointer;
+ }
+ button:hover,
+ a:hover {
+ background: light-dark(#ffffff, #253029);
+ }
+ button:focus-visible,
+ a:focus-visible,
+ select:focus-visible {
+ outline: 2px solid var(--accent);
+ outline-offset: 3px;
+ }
+ select {
+ background: var(--bg);
+ }
+ #status {
+ color: var(--muted);
+ font-size: 10px;
+ white-space: nowrap;
+ display: flex;
+ gap: 5px;
+ align-items: center;
+ }
+ #status::before {
+ content: "";
+ display: block;
+ width: 5px;
+ height: 5px;
+ border-radius: 50%;
+ background: currentColor;
+ }
+ #status[data-state="live"] {
+ color: var(--accent);
+ }
+ #status[data-state="error"] {
+ color: light-dark(#994e1f, #efb58d);
+ }
+ .stage {
+ flex: 1;
+ min-height: 0;
+ position: relative;
+ display: flex;
+ justify-content: center;
+ background: light-dark(#dce0d9, #080d0b);
+ overflow: hidden;
+ }
+ iframe {
+ height: 100%;
+ width: 100%;
+ border: 0;
+ background: var(--bg);
+ transition: width 0.18s ease;
+ }
+ .stage[data-size="phone"] iframe {
+ width: min(100%, 390px);
+ }
+ .stage[data-size="tablet"] iframe {
+ width: min(100%, 768px);
+ }
+ #empty {
+ position: absolute;
+ inset: 0;
+ display: grid;
+ place-content: center;
+ text-align: center;
+ gap: 14px;
+ padding: 30px;
+ background: var(--bg);
+ }
+ #empty .symbol {
+ font-size: 36px;
+ color: var(--accent);
+ }
+ #empty h1 {
+ font-size: 20px;
+ letter-spacing: -0.02em;
+ font-weight: 500;
+ margin: 0;
+ }
+ #empty p {
+ max-width: 430px;
+ color: var(--muted);
+ margin: 0;
+ line-height: 1.7;
+ }
+ #empty button {
+ justify-self: center;
+ }
+ #diagnostics {
+ padding: 12px 18px;
+ border-bottom: 1px solid var(--line);
+ max-height: 140px;
+ overflow: auto;
+ font:
+ 11px/1.7 ui-monospace,
+ monospace;
+ }
+ #diagnostics p {
+ margin: 0;
+ white-space: pre-wrap;
+ overflow-wrap: anywhere;
+ }
+ #errors {
+ color: light-dark(#9b4423, #e9a881);
+ }
+ @media (max-width: 620px) {
+ header {
+ gap: 6px;
+ padding: 7px 8px;
+ }
+ .file {
+ max-width: 26vw;
+ }
+ #viewport,
+ #open {
+ display: none;
+ }
+ #status {
+ font-size: 9px;
+ }
+ button {
+ font-size: 11px;
+ padding: 5px 7px;
+ }
+ }
+ @media (max-width: 390px) {
+ .brand {
+ display: none;
+ }
+ }
+ @media (prefers-reduced-motion: reduce) {
+ iframe {
+ transition: none;
+ }
+ }
+ </style>
+ </head>
+ <body>
+ <header>
+ <span class="brand"
+ ><span class="logo" aria-hidden="true">▧</span
+ ><span class="file" id="file"></span></span
+ ><span id="status" role="status" data-state="loading">Connecting</span
+ ><span class="spacer"></span
+ ><button
+ id="errors"
+ hidden
+ aria-expanded="false"
+ aria-controls="diagnostics"
+ >
+ 0 errors</button
+ ><select id="viewport" aria-label="Preview width">
+ <option value="fit">Fit</option>
+ <option value="tablet">Tablet</option>
+ <option value="phone">Phone</option></select
+ ><button
+ id="auto"
+ aria-pressed="true"
+ title="Pause automatic reloads to keep interacting while files change"
+ >
+ Live reload</button
+ ><a
+ id="open"
+ target="_blank"
+ rel="noopener"
+ title="Open artifact in a new tab"
+ >Open ↗</a
+ ><button id="reload" title="Reload preview (R)">↻ Reload</button>
+ </header>
+ <div id="diagnostics" hidden aria-label="Artifact errors"></div>
+ <main class="stage" id="stage" data-size="fit">
+ <iframe
+ id="preview"
+ title="Workspace preview"
+ sandbox="allow-scripts allow-same-origin allow-forms allow-pointer-lock allow-downloads"
+ allow="autoplay; fullscreen"
+ allowfullscreen
+ ></iframe>
+ <section id="empty">
+ <span class="symbol" aria-hidden="true">▧</span>
+ <h1 id="empty-title">Opening your workspace</h1>
+ <p id="empty-text">The preview will appear here.</p>
+ <button id="retry" hidden>Try again</button>
+ </section>
+ </main>
+ <script>
+ "use strict";
+ const params = new URLSearchParams(location.search);
+ const requested = params.get("file") || "index.html";
+ const parts = requested.replaceAll("\\", "/").split("/");
+ const file = parts.some((part) => !part || part.startsWith("."))
+ ? "index.html"
+ : parts.join("/");
+ const encoded = file.split("/").map(encodeURIComponent).join("/");
+ const frame = document.querySelector("#preview"),
+ empty = document.querySelector("#empty"),
+ status = document.querySelector("#status");
+ const forwarded = new URLSearchParams(params);
+ for (const key of ["file", "v"]) forwarded.delete(key);
+ let connected = false,
+ loaded = false,
+ watching = true,
+ automatic = true,
+ changed = false,
+ sequence = 0,
+ request,
+ hasConnected = false;
+ const errors = [];
+ document.querySelector("#file").textContent = file;
+ function artifactURL(bust = false) {
+ const url = new URL("/files/" + encoded, location.origin);
+ url.search = forwarded.toString();
+ if (bust) url.searchParams.set("v", `${Date.now()}-${sequence}`);
+ return url;
+ }
+ function refreshStatus() {
+ let text = "Loading",
+ state = "loading";
+ if (!watching) {
+ text = "Use Reload";
+ state = "error";
+ } else if (!connected) {
+ text = "Reconnecting";
+ state = "error";
+ } else if (!automatic) {
+ text = changed ? "Changes pending" : "Reload paused";
+ state = "paused";
+ } else if (loaded) {
+ text = "Live";
+ state = "live";
+ } else if (!empty.hidden) text = "Waiting";
+ status.textContent = text;
+ status.dataset.state = state;
+ }
+ function showEmpty(title, text, retry = false) {
+ loaded = false;
+ empty.hidden = false;
+ document.querySelector("#empty-title").textContent = title;
+ document.querySelector("#empty-text").textContent = text;
+ document.querySelector("#retry").hidden = !retry;
+ refreshStatus();
+ }
+ function clearErrors() {
+ errors.length = 0;
+ document.querySelector("#errors").hidden = true;
+ document.querySelector("#diagnostics").hidden = true;
+ document.querySelector("#diagnostics").replaceChildren();
+ }
+ async function load() {
+ const current = ++sequence;
+ request?.abort();
+ request = new AbortController();
+ changed = false;
+ document.querySelector("#open").href = artifactURL().href;
+ try {
+ const response = await fetch(artifactURL(), {
+ method: "HEAD",
+ cache: "no-store",
+ signal: request.signal,
+ });
+ if (current !== sequence) return;
+ if (response.status === 404) {
+ showEmpty(
+ "Waiting for your artifact",
+ `Create ${file} in the workspace. It will appear here as soon as it is saved.`,
+ );
+ return;
+ }
+ if (!response.ok) {
+ showEmpty(
+ "Preview unavailable",
+ response.status === 413
+ ? "This file exceeds the 32 MiB preview limit."
+ : `The server returned ${response.status}. Save the artifact and try again.`,
+ true,
+ );
+ return;
+ }
+ clearErrors();
+ frame.src = artifactURL(true).href;
+ } catch (error) {
+ if (error.name !== "AbortError" && current === sequence)
+ showEmpty(
+ "The viewer is reconnecting",
+ "Your workspace is still here. The preview will resume when the server is available.",
+ true,
+ );
+ }
+ }
+ frame.addEventListener("load", () => {
+ if (!frame.getAttribute("src")) return;
+ loaded = true;
+ empty.hidden = true;
+ refreshStatus();
+ });
+ document.querySelector("#reload").onclick = load;
+ document.querySelector("#retry").onclick = load;
+ document.querySelector("#viewport").onchange = (e) => {
+ document.querySelector("#stage").dataset.size = e.target.value;
+ };
+ document.querySelector("#auto").onclick = (e) => {
+ automatic = !automatic;
+ e.currentTarget.setAttribute("aria-pressed", automatic);
+ e.currentTarget.textContent = automatic
+ ? "Live reload"
+ : "Resume reload";
+ if (automatic && changed) load();
+ refreshStatus();
+ };
+ document.querySelector("#errors").onclick = (e) => {
+ const panel = document.querySelector("#diagnostics");
+ panel.hidden = !panel.hidden;
+ e.currentTarget.setAttribute("aria-expanded", !panel.hidden);
+ };
+ window.addEventListener("keydown", (e) => {
+ if (
+ e.target.closest?.("input,textarea,select,[contenteditable=true]") ||
+ e.ctrlKey ||
+ e.metaKey ||
+ e.altKey
+ )
+ return;
+ if (e.key.toLowerCase() === "r") {
+ e.preventDefault();
+ load();
+ }
+ });
+ window.addEventListener("message", (e) => {
+ if (
+ e.source !== frame.contentWindow ||
+ e.origin !== location.origin ||
+ !e.data ||
+ typeof e.data !== "object"
+ )
+ return;
+ if (
+ ["harness:ready", "harness:state"].includes(e.data.type) &&
+ typeof e.data.seed === "string" &&
+ e.data.seed.length <= 128
+ ) {
+ forwarded.set("seed", e.data.seed);
+ const url = new URL(location.href);
+ url.searchParams.set("seed", e.data.seed);
+ history.replaceState(null, "", url);
+ document.querySelector("#open").href = artifactURL().href;
+ }
+ if (
+ e.data.type === "harness:error" &&
+ typeof e.data.message === "string" &&
+ errors.length < 30
+ ) {
+ errors.push(e.data.message.slice(0, 1000));
+ const line = document.createElement("p");
+ line.textContent = errors.at(-1);
+ document.querySelector("#diagnostics").append(line);
+ const button = document.querySelector("#errors");
+ button.hidden = false;
+ button.textContent = `${errors.length} ${errors.length === 1 ? "error" : "errors"}`;
+ }
+ });
+ const events = new EventSource("/events");
+ events.onopen = () => {
+ connected = true;
+ if (hasConnected) {
+ changed = true;
+ if (automatic) load();
+ }
+ hasConnected = true;
+ refreshStatus();
+ };
+ events.onerror = () => {
+ connected = false;
+ refreshStatus();
+ };
+ events.addEventListener("change", () => {
+ changed = true;
+ if (automatic) load();
+ else refreshStatus();
+ });
+ events.addEventListener("watch-error", () => {
+ watching = false;
+ refreshStatus();
+ });
+ window.addEventListener("pagehide", () => {
+ events.close();
+ request?.abort();
+ });
+ load();
+ </script>
+ </body>
</html>
diff --git a/store/viewers/web-viewer/test/viewer.test.mjs b/store/viewers/web-viewer/test/viewer.test.mjs
index bc83b768c..5fa8e6503 100644
--- a/store/viewers/web-viewer/test/viewer.test.mjs
+++ b/store/viewers/web-viewer/test/viewer.test.mjs
@@ -36,7 +36,7 @@ after(async () => {
test('serves the actual Hello World page and a sandboxed preview shell', async () => {
const shell = await fetch(base);
assert.equal(shell.status, 200);
- assert.match(await shell.text(), /sandbox="allow-scripts"/);
+ assert.match(await shell.text(), /sandbox="allow-scripts allow-same-origin allow-forms allow-pointer-lock allow-downloads"/);
const page = await fetch(base + '/files/index.html');
assert.equal(page.status, 200);
assert.match(page.headers.get('content-type'), /text\/html/);
diff --git a/work/PERFORMANCE.md b/work/PERFORMANCE.md
new file mode 100644
index 000000000..9fafdb065
--- /dev/null
+++ b/work/PERFORMANCE.md
@@ -0,0 +1,44 @@
+# Measured preview performance
+
+Measured 2026-09-19 on this macOS development machine, Chrome 153.0.8010.48, headless,
+native graphics (AMD Radeon Pro 5500 XT through ANGLE Metal), Node 26.7.0.
+These are local measurements, not cross-device performance guarantees.
+
+| Experience | File request median | File request p95 | Save → ready + paint median | Maximum of 5 saves |
+|---|---:|---:|---:|---:|
+| generative-art | 2.46 ms | 2.87 ms | 216.5 ms | 231.9 ms |
+| creative-direction | 2.39 ms | 4.48 ms | 217.2 ms | 219.5 ms |
+| lab-bench | 1.91 ms | 8.87 ms | 218.3 ms | 233.7 ms |
+| music-studio | 1.46 ms | 3.62 ms | 532.6 ms | 667.4 ms |
+| game-master | 1.62 ms | 2.31 ms | 233.4 ms | 239.0 ms |
+| drone-pilot | 2.85 ms | 4.91 ms | 231.6 ms | 233.4 ms |
+| voxel-worlds | 3.09 ms | 5.08 ms | 233.9 ms | 252.8 ms |
+
+## Method
+
+`store/tools/experience-tests/performance.mjs` materializes each real template in a temporary
+workspace and starts the checkout viewer. It makes 40 sequential artifact requests, discards the
+first 10, and measures receipt of the full response body. It then saves five distinct document
+revisions, waits for the changed iframe body to report ready, and waits two animation frames.
+The timer starts immediately before each file write. Browser polling adds measurement overhead.
+
+The watcher retains its 80 ms debounce. The remaining time includes fetching, parsing, generating
+the experience and painting. Music includes rendering the complete audio buffer. Art drawing
+batches paths and uses a reusable seeded grain texture; the voxel scene stops drawing when idle.
+
+The earlier 106 ms number measured an iframe URL change, not a completed visible preview.
+It is superseded here. The original software-rendered run exposed costly art drawing and idle
+voxel redraws; native and software rendering timings are not directly comparable.
+
+## Reproduce
+
+Install the pinned browser-test dependency as described in
+`store/tools/experience-tests/README.md`, then run:
+
+```sh
+node store/tools/experience-tests/performance.mjs
+```
+
+`BROWSER_EXECUTABLE` selects Chrome; `PLAYWRIGHT_MODULE` selects an existing Playwright Core
+installation. `SOFTWARE_WEBGL=1` explicitly selects SwiftShader. Raw per-save samples are written
+to `work/experience-evidence/performance.json` and intentionally stay out of source control.
diff --git a/work/REVIEW.md b/work/REVIEW.md
new file mode 100644
index 000000000..a0f0b4cca
--- /dev/null
+++ b/work/REVIEW.md
@@ -0,0 +1,46 @@
+# Experience rebuild — review and evidence
+
+## Objective
+
+Review the complete branch, make the seven harnesses genuinely capable and visually distinctive,
+and verify the experiences people use through the actual shared viewer. Preserve the isolated worktree.
+
+## Audit, 2026-09-19
+
+- Reviewed all 14 branch commits, all seven manifests, agent instructions, domain skills, templates,
+ init/verdict scripts, the shared viewer, previous browser scripts and research.
+- At audit start, all seven shipped artifacts were placeholders. Voxel is two rectangles; drone is a moving dot;
+ arena has no ending; music consumes its random generator across plays; bench has no filters.
+- The previous E2E opens a manually constructed URL against an installed upstream viewer, appends
+ an HTML comment and checks an iframe URL. It does not exercise manifest routing or user controls.
+- All seven manifests inherit `?file=index.html` although their artifacts live in subdirectories.
+- The 100% coverage claim does not cover any browser artifact. Shell-script subprocesses are not
+ instrumented by Node coverage either. Do not repeat it as product coverage.
+- Verdict helpers mark any nonempty HTML ready and claim verification they did not perform.
+- Both installed and branch shells retain `sandbox="allow-scripts"`; the handoff's claim that the
+ branch fixes canvas inspection is false. A user browser reproduction confirms sibling fetch and localStorage fail. Enable same-origin for trusted workspace apps; test fetch, modules, storage, pointer lock and exports.
+- The research contains unsourced model rankings, licenses and product claims. They are leads,
+ not verified requirements. Original implementations here must be credited as such.
+
+## Completion requirements
+
+1. Seven useful, offline, self-contained starter experiences with distinct art direction:
+ walkable/buildable voxel island; reproducible print studio; editable/exportable music;
+ coherent brand directions; first-person gate racing; finite replayable strategy arena;
+ probeable synthetic experiment with computed statistics and data export.
+2. A shared viewer with correct artifact routing, preserved seed, usable narrow layouts,
+ visible loading/error/reconnect states, manual and automatic refresh, pointer lock and exports.
+3. Reproducible pure domain models plus browser tests for real controls, exports, no runtime
+ errors, determinism, responsive layouts, and file changes through the branch viewer.
+4. Honest verdicts, useful agent instructions, portable developer commands, store metadata and
+ actual output screenshots; remove misleading evidence and unsupported research conclusions.
+5. Conformance, catalog validation, materialization/viewer integration and visual QA on the final
+ state. Record exact evidence and limitations. No fabricated coverage or completion claims.
+
+## Status
+
+Implementation and local verification complete. All seven placeholders have been replaced,
+manifest routes corrected, verdict claims corrected, same-origin browser APIs restored, and
+Store metadata/screenshots supplied. Actual daemon creation and installed viewer reloads pass
+for all seven. See `VERIFICATION.md` and `PERFORMANCE.md` for commands, samples and limitations.
+Publication is verified separately against the live Store catalog after merging.
diff --git a/work/VERIFICATION.md b/work/VERIFICATION.md
new file mode 100644
index 000000000..a27ebee63
--- /dev/null
+++ b/work/VERIFICATION.md
@@ -0,0 +1,80 @@
+# Release verification — 2026-09-19
+
+The final local release candidate passed the checks below. These are reproducible finite samples,
+not a claim of complete product coverage. Tests ran against this worktree's artifacts and viewer.
+
+## Automated model, package and server checks
+
+**83 tests passed; zero failed or skipped.** This consists of 49 harness toolchain/manifest tests,
+12 domain-model tests and 22 shared-viewer server/lifecycle tests.
+
+```sh
+node store/tools/build-experiences.mjs --check
+node --test store/tools/experience-tests/models.test.mjs \
+ store/agents/{voxel-worlds,generative-art,music-studio,creative-direction,drone-pilot,game-master,lab-bench}/test/*.test.mjs \
+ store/viewers/web-viewer/test/*.test.mjs
+```
+
+Model sampling covers 100 seeds for art, brand, synthetic data, score events, finite arena matches
+and autopilot flights; 16 complete audio renders; and 32 walkable voxel worlds. Checks include
+finite geometry, legal movement, all-gate completion, match termination, exact same-seed score/PCM,
+headroom, computed statistics, known fits, SVG escaping and corrupt world import rejection.
+All seven generated `tools/check.mjs` programs also passed in independent copied workspaces with
+three seeds each. Those check the pure model extracted from the actual HTML artifact.
+
+All seven agent packages and the viewer conform to spec 1 (`harness dsh check`). Their setup and
+doctor checks passed after local installation. Catalog validation passed with 44 packages; all
+seven have a viewer dependency, example prompt and actual 1600 × 1000 output screenshot.
+The new Experience checks workflow runs source-drift, model, package, server and catalog checks.
+
+## Actual Chrome interactions
+
+The browser suite passed all seven experiences plus a separate shared-viewer regression fixture.
+The fixture verifies sibling fetch (`FETCH-OK`), localStorage, ES modules and missing-file recovery.
+The user's original `/tmp/wv_ui/sandboxtest.cjs` also returned `ARTIFACT TITLE: FETCH-OK` against the
+store viewer. Forms, audio, pointer lock and downloads are exercised by the experience checks.
+
+| Experience | Verified user behavior |
+|---|---|
+| generative-art | manifest launch, pixel deterministic, different seeds, technique control, 1600×2000 PNG, seed survives reload, pause/resume file reload, 390px layout, no runtime errors |
+| creative-direction | manifest launch, direction change, custom brand, palette lock, SVG and tokens, seed survives reload, pause/resume file reload, 390px layout, no runtime errors |
+| lab-bench | manifest launch, cohort filters, statistics respond to effect, collection replay, filtered CSV, seed survives reload, pause/resume file reload, 390px layout, no runtime errors |
+| music-studio | manifest launch, audio running, replay same PCM, step editing, WAV export, seed survives reload, pause/resume file reload, 390px layout, no runtime errors |
+| game-master | manifest launch, step/rewind/scrub, finite outcome, 32-match tournament, replay export, seed survives reload, pause/resume file reload, 390px layout, no runtime errors |
+| drone-pilot | manifest launch, autopilot motion, manual steering, telemetry export, reset, seed survives reload, pause/resume file reload, 390px layout, no runtime errors |
+| voxel-worlds | manifest launch, pointer lock, walk and collide, break/place blocks, world save/restore, overview, seed survives reload, pause/resume file reload, 390px layout, no runtime errors |
+
+The suite reads each real manifest, materializes a temporary workspace and expands its actual
+viewer URL. Screenshots were visually inspected at desktop and 390px widths. It captures page
+exceptions and checks exported PNG dimensions, WAV headers, SVG text, filtered CSV rows and JSON
+payload contents. Store screenshots are generated from the live starter, not promotional mockups.
+
+## Running Harness app
+
+The optional `daemon.mjs` suite passed **all seven harnesses** through the real local daemon and
+installed viewer. For each, it created an idle Claude session through the desktop WebSocket
+protocol, waited for engine readiness, verified framework materialization and AGENTS instructions,
+checked the exact nested artifact URL and not-ready initial verdict, opened it in Chrome, then
+saved a revision and observed the painted new document. It deleted its own temporary session and
+workspace in cleanup. No prompt was submitted; no inference output is represented as tested.
+
+The seven agents and `autonomous/web-viewer` are locally linked to this isolated worktree for
+immediate testing. Existing user workspaces are preserved. Start a new workspace to see a starter.
+
+## Scope and limitations
+
+- Browser verification used Chrome 153 on macOS, native graphics. Earlier development checks also
+ exercised SwiftShader. Safari, Firefox, real touch devices and remote preview hosts were not tested.
+- Audio verification covers running AudioContext, repeatable PCM, finite length, signal/headroom
+ and WAV structure. It is not a human listening review or a claim about musical taste.
+- Drone flight is an illustrative browser simulation; arena agents are deterministic heuristic
+ policies; the lab's dataset is synthetic and its confidence interval is an approximate normal
+ interval. Their interfaces state these distinctions.
+- The viewer runs trusted workspace scripts with same-origin access. Its sandbox is not a security
+ boundary from the shell; path/host/private-file protections remain tested at the server.
+- Timings are local samples recorded in `PERFORMANCE.md`. Repeated seeded output on one machine
+ does not establish identical graphics or audio on every device.
+
+Portable commands, prerequisites and environment overrides are in
+`store/tools/experience-tests/README.md`. Raw reports, screenshots and exports stay in ignored
+`work/experience-evidence/`; the actual Store images are committed under `store/showcase/`.
diff --git a/work/e2e_all.cjs b/work/e2e_all.cjs
new file mode 100644
index 000000000..297f12e5f
--- /dev/null
+++ b/work/e2e_all.cjs
@@ -0,0 +1,2 @@
+// Compatibility entry point. The maintained suite checks this checkout's actual viewer and artifacts.
+import('../store/tools/experience-tests/browser.mjs').catch(error => { console.error(error); process.exitCode = 1; });
diff --git a/work/e2e_live_reseed.cjs b/work/e2e_live_reseed.cjs
new file mode 100644
index 000000000..297f12e5f
--- /dev/null
+++ b/work/e2e_live_reseed.cjs
@@ -0,0 +1,2 @@
+// Compatibility entry point. The maintained suite checks this checkout's actual viewer and artifacts.
+import('../store/tools/experience-tests/browser.mjs').catch(error => { console.error(error); process.exitCode = 1; });
diff --git a/work/perf.cjs b/work/perf.cjs
new file mode 100644
index 000000000..47fe49160
--- /dev/null
+++ b/work/perf.cjs
@@ -0,0 +1,2 @@
+// Measures actual ready-and-painted frames, not just iframe URL changes.
+import('../store/tools/experience-tests/performance.mjs').catch(error => { console.error(error); process.exitCode = 1; });
diff --git a/work/re_seed_latency.cjs b/work/re_seed_latency.cjs
new file mode 100644
index 000000000..47fe49160
--- /dev/null
+++ b/work/re_seed_latency.cjs
@@ -0,0 +1,2 @@
+// Measures actual ready-and-painted frames, not just iframe URL changes.
+import('../store/tools/experience-tests/performance.mjs').catch(error => { console.error(error); process.exitCode = 1; });