@call-me-sensei/toonlab 0.4.22 → 0.4.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/NPM-LIBRARY.md +45 -34
  2. package/README.md +8 -8
  3. package/agents/PROMPTS.md +17 -3
  4. package/agents/README.md +13 -3
  5. package/agents/claude/CLAUDE.md +3 -0
  6. package/agents/codex/AGENTS.md +112 -159
  7. package/agents/cursor/toonlab.mdc +7 -3
  8. package/agents/examples/game-foundation.mjs +104 -0
  9. package/agents/references/game-lifecycle.md +57 -0
  10. package/agents/references/runtime-entry-points.md +26 -0
  11. package/agents/references/style-bundles.md +4 -1
  12. package/agents/skills/claude/asset-sourcing/SKILL.md +7 -4
  13. package/agents/skills/claude/environment/SKILL.md +4 -0
  14. package/agents/skills/claude/game-dev/SKILL.md +63 -87
  15. package/agents/skills/claude/lighting/SKILL.md +36 -0
  16. package/agents/skills/claude/post-processing/SKILL.md +8 -3
  17. package/agents/skills/claude/rock-ground-shaders/SKILL.md +10 -15
  18. package/agents/skills/claude/rockgen/SKILL.md +52 -21
  19. package/agents/skills/claude/scene-style-application/SKILL.md +4 -0
  20. package/agents/skills/claude/style-presets/SKILL.md +11 -8
  21. package/agents/skills/claude/toon-shading/SKILL.md +4 -0
  22. package/agents/skills/claude/vegetation-sky/SKILL.md +13 -7
  23. package/agents/skills/claude/visual-verification/SKILL.md +45 -119
  24. package/agents/skills/claude/water/SKILL.md +6 -2
  25. package/agents/skills/codex/asset-sourcing/SKILL.md +7 -4
  26. package/agents/skills/codex/environment/SKILL.md +4 -0
  27. package/agents/skills/codex/game-dev/SKILL.md +63 -87
  28. package/agents/skills/codex/lighting/SKILL.md +36 -0
  29. package/agents/skills/codex/post-processing/SKILL.md +8 -3
  30. package/agents/skills/codex/rock-ground-shaders/SKILL.md +10 -15
  31. package/agents/skills/codex/rockgen/SKILL.md +52 -21
  32. package/agents/skills/codex/scene-style-application/SKILL.md +4 -0
  33. package/agents/skills/codex/style-presets/SKILL.md +11 -8
  34. package/agents/skills/codex/toon-shading/SKILL.md +4 -0
  35. package/agents/skills/codex/vegetation-sky/SKILL.md +13 -7
  36. package/agents/skills/codex/visual-verification/SKILL.md +45 -119
  37. package/agents/skills/codex/water/SKILL.md +6 -2
  38. package/database/providers.mjs +1 -0
  39. package/mcp/lab-management.mjs +11 -8
  40. package/mcp/public-catalog.mjs +0 -16
  41. package/mcp/tree-lab-contract.mjs +2381 -0
  42. package/mcp/vite-plugin.mjs +5 -1
  43. package/package.json +26 -17
  44. package/src/cloud/cloudReprojection.js +40 -7
  45. package/src/cloud/cloudVolume.js +44 -7
  46. package/src/cloud/noise/baseShapeVolume.js +8 -6
  47. package/src/cloud/noise/cirrusMap.js +2 -1
  48. package/src/cloud/noise/curlNoise.js +2 -1
  49. package/src/cloud/noise/erosionVolume.js +2 -1
  50. package/src/cloud/noise/textureCache.js +77 -0
  51. package/src/cloud/noise/weatherMap.js +2 -1
  52. package/src/core/sha256.js +83 -0
  53. package/src/ground-shader/groundShaderMaterial.js +12 -3
  54. package/src/rockgen/index.js +9 -0
  55. package/src/rockgen/rockDocument.js +326 -40
  56. package/src/rockgen/surface/c7GeologySurface.js +39 -9
  57. package/src/rockgen/surface/naturalRockSurface.js +1948 -0
  58. package/src/shaders-tsl/chunks/projected-water-caustics.js +14 -2
  59. package/src/shaders-tsl/chunks/water-foam.js +6 -6
  60. package/src/shaders-tsl/chunks/water-lighting.js +28 -5
  61. package/src/shaders-tsl/chunks/water-shore-state.js +5 -2
  62. package/src/shaders-tsl/chunks/water-waves.js +10 -5
  63. package/src/shaders-tsl/flower.js +7 -4
  64. package/src/shaders-tsl/grass.js +4 -3
  65. package/src/shaders-tsl/water-shore-state-simulation.js +3 -2
  66. package/src/shaders-tsl/water.js +209 -41
  67. package/src/sky/skySystem.js +30 -7
  68. package/src/toon/settings/perspectiveRemovalSettings.js +1 -1
  69. package/src/toon/toonSettings.js +74 -0
  70. package/src/vegetation/stylizedFlower.js +6 -0
  71. package/src/version.js +1 -1
  72. package/src/water/waterDetailSpectrum.js +91 -0
  73. package/src/water/waterDynamics.js +422 -0
  74. package/src/water/waterFoamParticles.js +196 -0
  75. package/src/water/waterFoamTexture.js +57 -0
  76. package/src/water/waterHydrodynamics.js +209 -0
  77. package/src/water/waterMaterial.js +1 -0
  78. package/src/water/waterRenderExtension.js +107 -0
  79. package/src/water/waterScenePasses.js +14 -6
  80. package/src/water/waterSettings.js +53 -26
  81. package/src/water/waterShoreMaterial.js +38 -14
  82. package/src/water/waterSpectralOcean.js +137 -0
  83. package/src/water/waterStageSettings.js +19 -1
  84. package/src/water/waterSurface.js +62 -18
  85. package/src/water/waterUnderwaterAtmosphere.js +30 -3
  86. package/types/cloud/noise/baseShapeVolume.d.ts +1 -1
  87. package/types/cloud/noise/textureCache.d.ts +12 -0
  88. package/types/core/sha256.d.ts +2 -0
  89. package/types/index.d.ts +6 -0
  90. package/types/rockgen/index.d.ts +1 -0
  91. package/types/rockgen/rockDocument.d.ts +76 -4
  92. package/types/rockgen/surface/naturalRockSurface.d.ts +100 -0
  93. package/types/shaders-tsl/chunks/projected-water-caustics.d.ts +7 -1
  94. package/types/shaders-tsl/chunks/water-lighting.d.ts +4 -3
  95. package/types/shaders-tsl/water.d.ts +2 -1
  96. package/types/version.d.ts +1 -1
  97. package/types/water/waterDetailSpectrum.d.ts +13 -0
  98. package/types/water/waterDynamics.d.ts +89 -0
  99. package/types/water/waterFoamParticles.d.ts +32 -0
  100. package/types/water/waterFoamTexture.d.ts +1 -0
  101. package/types/water/waterHydrodynamics.d.ts +49 -0
  102. package/types/water/waterRenderExtension.d.ts +16 -0
  103. package/types/water/waterScenePasses.d.ts +1 -1
  104. package/types/water/waterSettings.d.ts +1 -0
  105. package/types/water/waterSpectralOcean.d.ts +17 -0
  106. package/types/water/waterStageSettings.d.ts +1 -1
  107. package/types/water/waterUnderwaterAtmosphere.d.ts +19 -4
package/NPM-LIBRARY.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # ToonLab npm library guide
2
2
 
3
3
  This guide is included in `@call-me-sensei/toonlab`. It is the package-first
4
- reference for version 0.4.22 and does not require access to the source
4
+ reference for version 0.4.23 and does not require access to the source
5
5
  repository.
6
6
 
7
7
  ## Install
@@ -67,13 +67,13 @@ release. A one-asset Node rock annotation compiler is also repository-only.
67
67
  The npm artifact contains four supported layers:
68
68
 
69
69
  1. The JavaScript runtime and TypeScript declarations for the public imports.
70
- 2. Text-only agent guides, prompts, references, and paired Codex/Claude skills
70
+ 2. Text-only agent guides, prompts, references, a copyable game example, and paired Codex/Claude skills
71
71
  under `agents/`.
72
72
  3. The `toonlab` manifest audit CLI and `toonlab-mcp` local stdio MCP server.
73
73
  4. The local MCP database/catalog support required for Library and asset
74
74
  discovery workflows.
75
75
 
76
- It does not contain the ToonLab website, Lab application UIs, examples,
76
+ It does not contain the ToonLab website, Lab application UIs, repository demo applications,
77
77
  screenshots, models, textures, or other binary media. Optional public fixtures
78
78
  are identified by immutable `https://assets.toonlab.io` metadata rather than
79
79
  being bundled. Authored tree recipes are assets too: the reviewed public tree
@@ -115,8 +115,12 @@ await look.apply(CALL_ME_SENSEI_STYLE_BUNDLE, {
115
115
 
116
116
  renderer.setAnimationLoop(() => {
117
117
  const delta = clock.getDelta();
118
+ sky?.update(delta);
118
119
  look.update(delta, camera);
119
- renderer.render(scene, camera);
120
+ // Update host-owned grass/characters here if this scene uses them.
121
+ water?.update(delta, camera);
122
+ if (post) post.render(delta);
123
+ else renderer.render(scene, camera);
120
124
  });
121
125
  ```
122
126
 
@@ -124,10 +128,22 @@ The host application still owns renderer creation, geometry and XZ layout,
124
128
  cameras, controls, gameplay, dynamic physics, navigation, persistence, and the
125
129
  frame loop. ToonLab does not turn a prompt into a finished world.
126
130
 
131
+ ## Realistic rock surface generation
132
+
133
+ The public `rockgen` entry includes `createNaturalRockMapData`,
134
+ `createNaturalRockSurfaceSpecification`, `resolveNaturalRockProjection`,
135
+ `NATURAL_ROCK_SURFACE_PROFILES`, and `NATURAL_ROCK_MAP_ROLES`.
136
+ These are the same deterministic realistic material profiles used by the Rock
137
+ Lab. They produce typed RGBA map data; the host creates textures and assigns
138
+ material/projection settings. Saved library rocks retain their surface recipe.
139
+ The published realistic GLB is also available through raw catalog acquisition.
140
+ Composite lithologies require authored semantic regions; micro-height maps are
141
+ surface detail, not displacement that replaces a geometric high-to-low bake.
142
+
127
143
  ## Load Nature Reference Rocks
128
144
 
129
- Version 0.4.22 understands both the original `rock-0001`–`rock-0480`
130
- identities and the `rock-c8-*` Nature Reference Rocks. Acquiring an asset
145
+ Version 0.4.23 understands both the original `rock-0001`–`rock-0480`
146
+ identities and the Nature Reference Rocks catalog. Acquiring an asset
131
147
  directly returns its realistic PBR GLB. The one-call placement path additionally
132
148
  loads that asset's reviewed geology maps and `call_me_sensei` material settings
133
149
  before applying the selected style bundle.
@@ -146,21 +162,24 @@ const provider = createOfficialCatalogProvider({
146
162
  transport: 'public-rock',
147
163
  });
148
164
  const assets = createOfficialCatalogAssetRuntime({ provider, renderer });
165
+ const catalog = await provider.listAssets();
166
+ const selectedRock = catalog.assets.find((asset) => asset.label.toLowerCase().includes('sandstone'));
167
+ if (!selectedRock) throw new Error('Select an available sandstone rock from the catalog.');
149
168
 
150
169
  // Raw acquisition keeps the realistic PBR model.
151
- const realistic = await assets.acquireAsset('rock-c8-arch-sandstone');
170
+ const realistic = await assets.acquireAsset(selectedRock.id);
152
171
  scene.add(realistic.root);
153
172
 
154
173
  // Placement loads the same rock's geology maps and applies Call Me Sensei.
155
174
  const stylized = await loadOfficialCatalogAsset({
156
- assetId: 'rock-c8-arch-sandstone',
175
+ assetId: selectedRock.id,
157
176
  assetRuntime: assets,
158
177
  parent: scene,
159
178
  styleBundle: CALL_ME_SENSEI_STYLE_BUNDLE,
160
179
  });
161
180
 
162
181
  // Rock Lab/editor integrations receive the non-destructive authoring contract.
163
- const rockPackage = await assets.getRockPackage('rock-c8-arch-sandstone');
182
+ const rockPackage = await assets.getRockPackage(selectedRock.id);
164
183
  const editorSource = createOfficialCatalogRockEditorDescriptor(
165
184
  rockPackage.asset,
166
185
  rockPackage,
@@ -177,32 +196,23 @@ when their scene lifetime ends.
177
196
 
178
197
  Everything in this section is present in the installed npm package.
179
198
 
180
- ### Codex
181
-
182
- ```bash
183
- cp node_modules/@call-me-sensei/toonlab/agents/codex/AGENTS.md ./AGENTS.md
184
- mkdir -p .agents/skills
185
- cp -R node_modules/@call-me-sensei/toonlab/agents/skills/codex/* .agents/skills/
186
- ```
199
+ ### Use the installed guide
187
200
 
188
- ### Claude Code
201
+ Add a reference to `node_modules/@call-me-sensei/toonlab/agents/codex/AGENTS.md`
202
+ in the project's existing instructions, or read it directly. Merge relevant
203
+ guidance; do not replace an existing `AGENTS.md` or `CLAUDE.md`. Claude's optional
204
+ wrapper is `agents/claude/CLAUDE.md`; Cursor's is `agents/cursor/toonlab.mdc`.
189
205
 
190
- ```bash
191
- cp node_modules/@call-me-sensei/toonlab/agents/claude/CLAUDE.md ./CLAUDE.md
192
- mkdir -p .claude/skills
193
- cp -R node_modules/@call-me-sensei/toonlab/agents/skills/claude/* .claude/skills/
194
- ```
195
-
196
- ### Cursor
197
-
198
- ```bash
199
- mkdir -p .cursor/rules
200
- cp node_modules/@call-me-sensei/toonlab/agents/cursor/toonlab.mdc .cursor/rules/
201
- ```
206
+ Copy only the feature skills you need into the client's skill directory, while
207
+ preserving any existing skills with the same names. Shared `agents/...`
208
+ references remain relative to the installed package root. Keep the package
209
+ installed; copying a single skill does not copy its reference library.
202
210
 
203
- Use `agents/PROMPTS.md` for ready-to-paste prompts. Begin with `game-dev` for
204
- an existing scene and add `asset-sourcing` when Library, Gallery, or MCP asset
205
- discovery is involved.
211
+ Start with `game-dev` for a new game or existing-scene integration, then add
212
+ `asset-sourcing` for Library/Gallery work and the focused rendering skills as
213
+ needed. `agents/PROMPTS.md` contains the prompt cookbook.
214
+ `agents/examples/game-foundation.mjs` is a copyable, playable blockout example;
215
+ it is application code, not an exported ToonLab game engine.
206
216
 
207
217
  ## Connect MCP
208
218
 
@@ -218,7 +228,8 @@ it uses the disk workspace passed through `--workspace`; no account is needed.
218
228
  "command": "npx",
219
229
  "args": [
220
230
  "-y",
221
- "@call-me-sensei/toonlab@0.4.22",
231
+ "--package=@call-me-sensei/toonlab@0.4.23",
232
+ "toonlab-mcp",
222
233
  "--workspace",
223
234
  "/absolute/path/to/your-game/.toonlab"
224
235
  ],
@@ -230,7 +241,7 @@ it uses the disk workspace passed through `--workspace`; no account is needed.
230
241
  }
231
242
  ```
232
243
 
233
- This server provides the anime-game profile, runtime guide, live-Lab
244
+ This server provides the anime-game profile, live-Lab
234
245
  contracts, deterministic document creation and mutation, policy validation,
235
246
  public Gallery search/retrieval, local Library operations, and optional
236
247
  provider-backed generation when the developer supplies server-side provider
package/README.md CHANGED
@@ -19,7 +19,7 @@ Use ToonLab as a focused runtime library (`@call-me-sensei/toonlab` on npm), as
19
19
  an asset/preset authoring workspace, or as an asset-discovery service—not as a
20
20
  one-shot world generator.
21
21
 
22
- ## Versioned expectation: 0.4.22
22
+ ## Versioned expectation: 0.4.23
23
23
 
24
24
  For a correctly constructed and semantically labeled scene, one strict Call Me
25
25
  Sensei bundle application is expected to establish the supported visual
@@ -379,7 +379,7 @@ camera behavior, and game feel remain host-owned or pre-beta.
379
379
  | Toon character shading | `@call-me-sensei/toonlab/toon` | Modern anime character shader: cel bands with art-directed face lighting, skin-tone shadow management, shadow-color HSV control, scene/self/contact shadows, average-shadow smoothing, rim light (fresnel or screen-space depth), stylized + anisotropic hair highlights, eye catchlights, role-aware specular, source map routing (normal/AO/emissive/MatCap/ramp/detail), inverted-hull outlines, glitter, stickers, perspective removal, shell fur, dither fades — 23 settings groups, all preset-serializable. [Docs](https://github.com/call-me-sensei/toonlab/blob/main/docs/toon-shading.md) |
380
380
  | Environment shading | `@call-me-sensei/toonlab/environment` | Modern anime-style scene shader for texture packs, standard glTF, and untextured scenes: material-role classification, wrapped lighting, packed-map hints, window cutouts, sun/lamp rigs, time-of-day, six-direction ambient probe, planar floor reflections, BVH vertex-AO baking, height fog, cloud shadows. [Docs](https://github.com/call-me-sensei/toonlab/blob/main/docs/environment.md) |
381
381
  | Water | `@call-me-sensei/toonlab/water` | Focused water treatment for a host-authored water footprint, continuous shore, and closed seabed: Gerstner waves, absorption color, refraction/caustics/foam, ripples, splashes, wakes, kelp, underwater treatment, and CPU buoyancy sampling. It does not design the coast or underwater habitat. [Docs](https://github.com/call-me-sensei/toonlab/blob/main/docs/water.md) |
382
- | Vegetation | `@call-me-sensei/toonlab/vegetation` | Tree/grass/flower construction and shader runtimes, including the focused procedural broadleaf `BranchTree` with deterministic branching, five leaf silhouettes, caller-supplied leaf/bark textures, and a portable recipe. No authored tree asset collection is bundled or exported: reviewed tree recipes remain searchable Gallery assets delivered through MCP with their CC0 metadata. Package-generated trees preserve authored bark first and otherwise select a registered deterministic bark surface instead of a bare trunk. The experimental species roster remains repository-only. [Docs](https://github.com/call-me-sensei/toonlab/blob/main/docs/vegetation-sky.md) |
382
+ | Vegetation | `@call-me-sensei/toonlab/vegetation` | Tree/grass/flower construction and shader runtimes, including the focused procedural broadleaf `BranchTree` with deterministic branching, eight leaf silhouettes, caller-supplied leaf/bark textures, and a portable recipe. No authored tree asset collection is bundled or exported: reviewed tree recipes remain searchable Gallery assets delivered through MCP with their CC0 metadata. Package-generated trees preserve authored bark first and otherwise select a registered deterministic bark surface instead of a bare trunk. The experimental species roster remains repository-only. [Docs](https://github.com/call-me-sensei/toonlab/blob/main/docs/vegetation-sky.md) |
383
383
  | Rock shader | `@call-me-sensei/toonlab/rock-shader` | Detailed, versioned rock-material profiles with projected detail, distance tint, normal fading, striping, moss and optional top layers, plus explicit source-albedo and vertex-color/AO integration. Call Me Sensei is the default. Geometry generation remains separate in `rockgen`. [Docs](https://github.com/call-me-sensei/toonlab/blob/main/docs/rock-shader.md) |
384
384
  | Ground shader | `@call-me-sensei/toonlab/ground-shader` | Splat-weighted anime terrain with slope/cliff detail, shoreline and weather response, HDR sun/shade controls, safe shadow defaults, and flat-albedo ground-field output for vegetation adoption. [Docs](https://github.com/call-me-sensei/toonlab/blob/main/docs/ground-shader.md) |
385
385
  | Sky | `@call-me-sensei/toonlab/sky` | Reusable atmosphere, palette, sun, moon, stars, and god-ray settings authored by Sky Lab and Sky & Cloud Lab. Your application coordinates final lighting and scene state. [Docs](https://github.com/call-me-sensei/toonlab/blob/main/docs/sky.md) |
@@ -629,7 +629,7 @@ stack, with WebGL2 fallback through the same TSL path.
629
629
  shared 24-hour controls, four-state regression matrix, and required cool/blue
630
630
  daylight-shadow verification.
631
631
  - [Rock shader](https://github.com/call-me-sensei/toonlab/blob/main/docs/rock-shader.md) — the separate generator/material
632
- architecture, 58-field public configuration, import policy, and bundle use.
632
+ architecture, schema-defined public configuration, import policy, and bundle use.
633
633
  - [Styles, style bundles, and asset routing](https://github.com/call-me-sensei/toonlab/blob/main/docs/styles-and-bundles.md) —
634
634
  rendering domains, required asset labels, fallback policy, bundle ownership,
635
635
  OSS application boundaries, and the shader/lab migration contract.
@@ -655,7 +655,7 @@ stack, with WebGL2 fallback through the same TSL path.
655
655
  - [Post-processing](https://github.com/call-me-sensei/toonlab/blob/main/docs/post-processing.md)
656
656
  - [Texture Lab and texgen](https://github.com/call-me-sensei/toonlab/blob/main/docs/texture-lab.md)
657
657
  - [Characters and animation](https://github.com/call-me-sensei/toonlab/blob/main/docs/characters.md)
658
- - [Settings reference](https://github.com/call-me-sensei/toonlab/blob/main/docs/settings-reference.md) — every tunable field,
658
+ - [Settings reference](https://github.com/call-me-sensei/toonlab/blob/main/docs/settings-reference.md) — selected runtime and repository settings,
659
659
  generated from the schemas (`node scripts/generate-settings-reference.mjs`).
660
660
  - [Shader constants](https://github.com/call-me-sensei/toonlab/blob/main/docs/shader-constants.md) — the deliberately unexposed
661
661
  constants and where they live.
@@ -667,14 +667,14 @@ Cursor, …). The recommended setup has three parts: give the agent the ToonLab
667
667
  skills, connect whichever ToonLab OSS local or ToonLab Pro remote MCP surface
668
668
  the developer has, then start from a goal prompt and iterate. The npm package
669
669
  ships runtime source and the small text-only `agents/` guidance bundle. It
670
- ships no models, textures, labs, examples, review fixtures, or other binary or
671
- visual assets.
670
+ includes a copyable playable blockout in `agents/examples/game-foundation.mjs`;
671
+ models, textures, Lab apps, repository demos and review media are not bundled.
672
672
 
673
673
  ### 1. Install the ToonLab skills in your game project
674
674
 
675
675
  The skills teach the agent the runtime boundary, asset-discovery order,
676
676
  frame-loop contract, and each focused subsystem API. Start with `game-dev` for
677
- integration into an existing scene and `asset-sourcing` for Gallery/MCP work.
677
+ new-game development or integration, and `asset-sourcing` for Gallery/MCP work.
678
678
  Experimental whole-world, natural-cliff, Weather/Climate, camera, game-feel,
679
679
  and gameplay-VFX skills are intentionally not included in the npm artifact.
680
680
 
@@ -714,7 +714,7 @@ the public tree collection—those recipes are not npm built-ins:
714
714
  "mcpServers": {
715
715
  "toonlab-local": {
716
716
  "command": "npx",
717
- "args": ["-y", "@call-me-sensei/toonlab@latest", "--workspace", "/absolute/path/to/your-game/.toonlab"],
717
+ "args": ["-y", "--package=@call-me-sensei/toonlab@latest", "toonlab-mcp", "--workspace", "/absolute/path/to/your-game/.toonlab"],
718
718
  "env": { "TOONLAB_LEGACY_WORKSPACE": "1" }
719
719
  }
720
720
  }
package/agents/PROMPTS.md CHANGED
@@ -1,7 +1,21 @@
1
1
  # ToonLab agent prompts
2
2
 
3
3
  These prompts are included with the npm package. They use only the supported
4
- 0.4.22 runtime, agent skills, and MCP workflows.
4
+ 0.4.23 runtime, agent skills, and MCP workflows.
5
+
6
+ ## New playable game
7
+
8
+ ```text
9
+ Use the installed ToonLab game-dev skill to build the game described in my
10
+ request. Implement the host gameplay, input, camera, UI and level structure;
11
+ use ToonLab's public APIs for the supported visual and runtime systems. Start
12
+ with a playable slice that has movement, collision, one objective and restart,
13
+ then replace placeholders and apply the selected style. Use the installed
14
+ version's export map, preserve asset/material identities, assign one update
15
+ owner per system, and verify actual keyboard/pointer input, resize and teardown.
16
+ Do not invent package APIs or describe the result as polished before inspecting
17
+ it at the gameplay camera. Report remaining limitations concretely.
18
+ ```
5
19
 
6
20
  ## Existing-scene integration
7
21
 
@@ -71,8 +85,8 @@ species engine.
71
85
  ```text
72
86
  Using the ToonLab rockgen and rock-ground-shaders skills, create or edit the
73
87
  requested rock asset with @call-me-sensei/toonlab/rockgen and style it with
74
- @call-me-sensei/toonlab/rock-shader. Keep geometry identity, seed, LOD,
75
- collision, and baked channels in the rock document; keep reusable appearance in
88
+ @call-me-sensei/toonlab/rock-shader. Preserve geometry identity, seed, surface recipe, authored masks, LOD,
89
+ collision, and bake provenance; keep reusable appearance in
76
90
  the rock shader profile. Validate the portable documents and verify the result
77
91
  from multiple useful views. Do not deep-import repository compilers or test
78
92
  fixtures.
package/agents/README.md CHANGED
@@ -4,7 +4,8 @@ These are downloadable AI coding agent resources for developers using ToonLab
4
4
  runtime features in their own apps. They are not maintenance instructions for
5
5
  this repository.
6
6
 
7
- The recommended agent workflow starts from an existing scene: apply the
7
+ For a new game, implement a playable host-game slice and then apply ToonLab.
8
+ For an existing scene, preserve its authorized layout and systems: apply the
8
9
  focused character, manufactured, ground, rock, vegetation, water, sky, cloud,
9
10
  lighting, and post runtimes; find assets through Gallery or MCP; and author
10
11
  bounded portable outputs. The package does not promise reliable one-shot scene
@@ -22,12 +23,14 @@ Layout:
22
23
  runtime-boundary, sourcing-policy, and custom-gap contracts used by every
23
24
  agent integration.
24
25
 
25
- Recommended feature skills (start with `game-dev` for existing-scene
26
+ Recommended feature skills (start with `game-dev` for new-game development or existing-scene
26
27
  integration and `asset-sourcing` for Gallery/MCP work):
27
28
 
28
29
  - `asset-sourcing`
29
30
  - `environment`
30
31
  - `game-dev`
32
+ - `lighting`
33
+ - `scene-style-application`
31
34
  - `post-processing`
32
35
  - `rock-ground-shaders`
33
36
  - `rockgen`
@@ -42,7 +45,7 @@ artifact. This includes whole-world construction, natural cliff formation,
42
45
  Weather/Climate composition, camera behavior, game feel, and gameplay VFX.
43
46
 
44
47
  These text-only resources ship with the npm package beside the runtime source.
45
- The package does not include ToonLab lab applications, examples, review
48
+ The package does not include ToonLab lab applications, repository demo applications, review
46
49
  fixtures, models, textures, or other redistributed visual/media assets.
47
50
  First-party grass geometry and materials are generated by runtime code; the
48
51
  optional CC0 mannequin resolves from immutable public R2 rather than npm.
@@ -52,3 +55,10 @@ root needs a stable target ID/domain, and every material slot needs a stable
52
55
  material ID plus semantic role in the versioned ToonLab material contract.
53
56
  Root-only labels do not make multi-material assets bundle-ready. Strict mode
54
57
  blocks incomplete assets; advisory mode must report them as incomplete.
58
+
59
+ References beginning `agents/` resolve under the installed package root. Do not
60
+ copy the shared guide over an existing game instruction file: add a reference
61
+ to it, or merge only relevant guidance. Individual skills copied to an agent's
62
+ skill directory still read shared references from the installed package.
63
+ See `references/game-lifecycle.md` for update ownership and
64
+ `examples/game-foundation.mjs` for a copyable, verified playable blockout.
@@ -2,6 +2,9 @@
2
2
 
3
3
  ## Claude Code
4
4
 
5
+ - Resolve `agents/` references from the installed package root.
6
+ - Use the `game-dev` skill for new games and integration; host-owned input,
7
+ gameplay and layout are part of requested game development.
5
8
  - Use `agents/skills/claude/` as the user-facing usage guides for ToonLab
6
9
  runtime features.
7
10
  - Keep this file short; shared guidance belongs in `agents/codex/AGENTS.md`.
@@ -1,161 +1,114 @@
1
1
  # ToonLab Agent Guide
2
2
 
3
- Use this file when helping a developer build an anime-style game, character,
4
- or environment with ToonLab's runtime library in their own Three.js app.
5
-
6
- ## Anime-Game Product Contract
7
-
8
- - ToonLab is specifically an anime-game toolkit, not a generic stylization
9
- library. Read `agents/references/anime-art-direction.md` before making
10
- visual, shader, material, or asset decisions.
11
- - Load the selected bundle's `artDirection` and treat it as authoritative.
12
- Call Me Sensei is the first-party coordinated reference.
13
- - Never accept unintended photorealism, generic low-poly styling, undirected
14
- cartoon rendering, or untreated PBR materials as a finished ToonLab result.
15
- - If supported shaders or approved assets are insufficient, document the
16
- customization and why your project needs it.
17
-
18
- ## Runtime Boundary
19
-
20
- - `@call-me-sensei/toonlab` is primarily a runtime library for applying
21
- Three.js shaders, stylized materials, focused vegetation/water, settings,
22
- and preset documents to supplied scene content.
23
- - Prefer public package imports such as `@call-me-sensei/toonlab/toon`,
24
- `@call-me-sensei/toonlab/environment`, `@call-me-sensei/toonlab/water`,
25
- `@call-me-sensei/toonlab/vegetation`, `@call-me-sensei/toonlab/post`,
26
- `@call-me-sensei/toonlab/styles`,
27
- `@call-me-sensei/toonlab/texgen`, and `@call-me-sensei/toonlab/rockgen`.
28
- - Use `@call-me-sensei/toonlab/sky` and `/cloud` for the live Sky, Cloud, and
29
- Sky & Cloud Lab contracts. Weather, Climate, ambient effects, and fauna are
30
- not public package entry points in this release.
31
- - Use `@call-me-sensei/toonlab/vegetation-shaders` and
32
- `@call-me-sensei/toonlab/grass-palettes` when a consumer needs only those
33
- focused contracts. They are the same bindings exposed by the vegetation and
34
- root barrels.
35
- - Keep root imports lightweight in examples. Import only the feature subpath a
36
- developer needs.
37
- - Public export status and product maturity are different. Toon,
38
- Environment/Ground/Rock, Tree/Grass/Flower, Water on a host-authored
39
- footprint/shore/bed, Post, Gallery/MCP asset workflows, loaders, portable
40
- settings, Sky/Cloud, and qualified focused generators are the recommended
41
- path. Whole terrain/biome/coast/cliff construction,
42
- automatic set dressing, and cross-system world assembly are experimental.
43
- - ToonLab's labs, sample assets, local manifests, screenshots, captures, and
44
- app routes are examples. Do not treat them as part of the runtime API or copy
45
- their local asset assumptions into user apps.
46
- - The host app owns scene layout and major geometry, asset placement, cameras,
47
- collision, asset loading, decoder hosting, storage, routing, persistence,
48
- collaboration, and final art direction. Renderer construction stays
49
- host-owned, while the public renderer helper and scene style runtime apply
50
- reversible Call Me Sensei renderer, lighting, probe, and shadow settings.
51
- - VFX, camera, game-feel, and renderer selection are not style-bundle domains.
52
- Treat project-local implementations as custom adapters and record a gap when
53
- they affect the selected look. Lighting is a supported bundle domain.
54
-
55
- ## Usage Rules
56
-
57
- - Use the README and docs pages first; feature skills in `agents/skills/codex/`
58
- are short usage guides for public runtime APIs.
59
- - For existing-scene or multi-system integration, start with the `game-dev`
60
- skill (boundary, frame-loop contract, task→skill routing). When sourcing or generating
61
- assets, use the `asset-sourcing` skill. Feature-detect the connected ToonLab
62
- OSS local and/or ToonLab Pro remote MCP surface before calling tools; their
63
- overlapping tool names have different discovery roles and schemas.
64
- First-party rock search must shortlist from meter dimensions and taxonomy;
65
- do not load or render catalog GLBs merely to determine their size.
66
- - Whole-world and natural-cliff construction skills are not shipped in the npm
67
- package. Prefer bounded work on an existing terrain, asset family,
68
- vegetation field, or water body.
69
- - For any style-aware construction, use `style-presets` to record the intended
70
- selector and distinguish neutral defaults from domains that already default
71
- to Call Me Sensei. Before visual approval or reporting a package gap, use
72
- `visual-verification` for readiness, isolation, multi-view, measurement, and
73
- outlier checks. These routes apply to every agent integration, not only Codex
74
- or Claude.
75
- - ToonLab materials are TSL/NodeMaterial-first for Three.js WebGPU with WebGL2
76
- fallback through the same TSL path. Do not guide developers toward raw GLSL,
77
- `ShaderMaterial`, or classic WebGL-only forks for ToonLab features.
78
- - Keep developer examples focused on documented settings, preset documents,
79
- public constructors/helpers, and app-owned Three.js objects.
80
- - Keep artifact scope explicit: Shader Labs author IP profiles, Asset Labs
81
- author geometry/material data, and Water Lab authors a focused runtime
82
- system preset with embedded shader controls. Sky, Cloud, and Sky & Cloud are
83
- live focused authoring surfaces. Vegetation is one shared
84
- implementation family with separate Tree, Grass, and Flower shader profiles;
85
- their Generation Labs own geometry/material data. The public package ships
86
- tree construction and shader capability, not predefined tree assets. Search
87
- reviewed authored tree recipes through MCP; use `StylizedTree` or
88
- `BranchTree` to instantiate or deliberately author them. Repository species
89
- work is experimental and must not be presented as supported. Ground is a
90
- separate shader domain. Scene weather,
91
- lighting, camera, interactions, and complete Sky/Cloud composition stay
92
- host-owned or experimental.
93
- - For style-bundle, multi-shader, or arbitrary-asset work, read
94
- `agents/references/style-bundles.md` first. A bundle selects coordinated treatments;
95
- explicit asset labels select rendering destinations; scene state selects
96
- current conditions. Inventory and label every renderable root and material.
97
- Every newly modeled, generated, or imported material slot requires a stable
98
- ID and valid semantic role in the versioned material contract. A root domain
99
- label is not sufficient for a multi-material asset; missing roles and mixed
100
- atlases without a split or ID mask block strict handoff.
101
- Character anatomy, clothing, held weapons, and worn hero accessories
102
- normally route to toon; manufactured props, vegetation, rocks/debris,
103
- water/sky, and VFX retain their owning runtimes. For an imported manufactured
104
- prop, call `proposeManufacturedStyleTargetLabel()` first, review every issue,
105
- provide explicit `materialOverrides` for unresolved slots, then call
106
- `applyManufacturedStyleTargetLabelProposal()`. Never collapse assisted
107
- results into the automatic success rate.
108
- - Report unknown domains and material roles, mixed atlases without masks,
109
- unsupported transparency, and custom-renderer exemptions. Never silently
110
- infer a production-safe route from names, texture colors, or scene
111
- parenting. Preserve asset identity and runtime conditions when changing
112
- style.
113
- - Local style bundle creation, validation, serialization, parsing, and
114
- resolution are OSS `/styles` APIs and require no database. Hosted storage
115
- and `fetchStyleBundle` are optional. Scene discovery remains explicit;
116
- manufactured assets have a conservative proposal/review/apply labeling path,
117
- and strict bundle application reconciles declared roles against live slots
118
- before the first mutation.
119
- - New bundles use `treeShader`, `grassShader`, `flowerShader`, and
120
- `groundShader`. V1 `vegetationShader`, `tree`, `grass`, and `flowers`
121
- selections are migration inputs only and never serialize into v2. Do not
122
- serialize asset recipes, tree geometry, scatter, or live wind/weather
123
- into shader slots.
124
- - Treat `call_me_sensei` as the first-party reference bundle. Optimize the
125
- canonical domain implementations for the best coordinated result and apply
126
- the completion gate in `agents/references/style-bundles.md`. Assigning the same
127
- style id to every slot is not completion, and compatibility flattening for
128
- incomplete assets must not define the signature look.
129
- - For sourcing or generation, read
130
- `agents/references/mcp-asset-discovery.md` and
131
- `agents/references/asset-sourcing-policy.md`. Reuse an
132
- accepted asset first. If a procedural family has an approved stylized base
133
- set and passed the reliability gate, generate directly and skip gallery
134
- search. Otherwise use curated CC0, then properly attributed CC-BY; reserve
135
- image-to-3D for a named remaining gap. Preserve base-set version, recipe,
136
- seed, domain/material labels, license provenance, and the Call Me Sensei
137
- verification result. Pro may author/review base sets; OSS consumes portable
138
- artifacts without a database.
139
- - For Sky/Cloud and Water work, `.settings` is the portable authored baseline and
140
- `.renderedSettings` is the current composition. Give Lighting, Weather, and
141
- other transient owners unique `setSceneOverrideLayer` ids and clear only the
142
- same id; never export composed scene state.
143
- - In a composed-world test, use the public Lighting bundle slot and scene style
144
- runtime for the coordinated sun, sky probe, and shared shadow contract. Keep
145
- host-owned Weather and any custom local-light adapters coordinated with Sky,
146
- Water, and vegetation scene inputs.
147
- - Sky documents contain exactly 46 portable art fields. Radius and compile-time
148
- quality are not portable: named tiers use 2/3/4 cloud octaves, custom quality
149
- accepts `{ cloudOctaves: 1..5 }`, and `sky.setQuality()` rebuilds the material.
150
- Water quality is chosen when constructing/replacing `WaterSurface`, not via
151
- `applySettings()`.
152
- - Do not depend on ToonLab sample assets, generated manifests, or lab-only
153
- model/environment discovery.
154
- - Keep these downloadable resources focused on runtime usage.
155
-
156
- ## Developer Verification
157
-
158
- - For consumer apps, run that app's normal typecheck, test, build, and visual
159
- smoke checks.
160
- - For generated rock assets, use a fixed seed and compare the output your app
161
- expects.
3
+ Use ToonLab's public runtime to develop the game the user requested. Build the
4
+ host game systems when needed; “host-owned” means your application implements
5
+ that part, not that the task must be refused or called an experiment. Preserve
6
+ existing gameplay and layout unless the request authorizes changing them.
7
+
8
+ ## Find the installed contract
9
+
10
+ Resolve `@call-me-sensei/toonlab` in this project and read its `package.json`
11
+ version and export map. In this guide and the feature skills, `agents/...` and
12
+ `NPM-LIBRARY.md` are relative to that package root, normally
13
+ `node_modules/@call-me-sensei/toonlab/`, not the game repository root. In a
14
+ workspace with hoisted dependencies, resolve the installed location first.
15
+
16
+ Start with `NPM-LIBRARY.md`, `agents/references/runtime-entry-points.md`, and the
17
+ `game-dev` skill. Read other skills only for the systems the task uses. The
18
+ installed package has the supported guides and references; a source checkout,
19
+ Lab UI, Pro account, and generative AI are not prerequisites for building a game.
20
+ Do not overwrite the game's existing agent instructions when installing this guide.
21
+
22
+ ## Divide responsibilities correctly
23
+
24
+ | Application work | ToonLab support |
25
+ | --- | --- |
26
+ | Game rules, input, camera, UI, objectives, spawning, scene layout, navigation, dynamic physics, networking, persistence | Host code composed with the runtime; do not invent ToonLab APIs for these |
27
+ | Renderer construction, resize, frame loop, shutdown | `renderer` helpers and scene-style configuration; use Three's `WebGPURenderer` for TSL, including its WebGL2 fallback |
28
+ | Character loading, rig/clips, conversion, animation update/disposal | `createCharacterRuntime()`; `createWalkableCharacterRuntime()` connects locomotion and grounding to host movement/physics |
29
+ | Terrain-bound placement, grass, shore and water-bed coordination | `createSceneSurfaceRuntime()` when the host supplies a heightfield |
30
+ | Labeled static blockers | `createSceneStyleRuntime().collision`; use explicit collision metadata or the Rapier adapter where needed |
31
+ | Coordinated lighting, sky inputs, ground field and shared shadows | `createSceneStyleRuntime()` and the public `lighting` domain |
32
+ | Materials, vegetation, water, sky/cloud, post and procedural assets | Focused exports listed in `agents/references/runtime-entry-points.md` |
33
+
34
+ A hand-built level is valid application work. Reliable automatic world layout,
35
+ terrain/geology synthesis, navigation, camera controllers, gameplay VFX and the
36
+ experimental species engine are not promises of the npm package. Do not import
37
+ repository-only implementations or turn a Lab route into a runtime dependency.
38
+
39
+ ## Build in useful increments
40
+
41
+ For a new game, make a playable vertical slice first: controls, movement,
42
+ collision, camera, one objective, and restart. Then apply the selected art
43
+ direction and add assets. For an existing game, integrate the requested domains
44
+ without replacing its renderer or update loop unnecessarily. The `game-dev`
45
+ skill gives the integration order and the frame ownership contract.
46
+
47
+ Use focused package imports. Choose the selected bundle's treatment explicitly;
48
+ Call Me Sensei is the first-party default when the user has not chosen another.
49
+ Its bundle ID is `call-me-sensei`; many domain preset/style selectors instead
50
+ use `call_me_sensei`. Use the documented selector for each API.
51
+
52
+ Use `style-presets` before style-aware construction.
53
+ For anime treatment, read `agents/references/anime-art-direction.md` and
54
+ `agents/references/style-bundles.md`. Preserve source PBR maps and material
55
+ identity. Realistic rock maps are valid asset inputs and may also be the user's
56
+ requested output; do not confuse them with an accidentally unstyled anime scene.
57
+
58
+ Label style targets by domain and give every material slot a stable material
59
+ ID and semantic role. A root-only label is incomplete for a multi-material
60
+ asset. Strict mode blocks incomplete coverage. Use the manufactured-material proposal/review/apply
61
+ helpers for imported props. Report automatic and assisted results separately.
62
+ Do not infer a physical material solely from its color or filename. Split mixed
63
+ atlases or supply the required mask. Strict style application must reject
64
+ incomplete coverage before mutation; advisory results must disclose gaps.
65
+
66
+ Apply scene-wide styles through `styleRuntime.apply(...)`. It manages the
67
+ lighting, renderer, shadow, and collision integrations as well as material
68
+ transactions. Use the lower-level `applyStyleBundle()` only when the app owns
69
+ those integrations deliberately. A `createStyleTarget()` descriptor alone is
70
+ not durable labeling: use `labelStyleTarget()` for scene-label discovery.
71
+
72
+ ## Assets and MCP
73
+
74
+ Use `asset-sourcing` when discovering/importing assets or requesting generation.
75
+ Inspect the connected server's tool schemas: local and Pro tools with the same
76
+ name can mean different things. Follow the project's actual policy; the strict
77
+ acceptance fixture is not a universal rule for every game.
78
+
79
+ Reuse project/Library assets, shortlist Gallery results from metadata, then
80
+ retrieve selected artifacts. Preserve IDs, license, provenance, dimensions,
81
+ recipe and seed. First-party rock dimensions and taxonomy support shortlisting
82
+ without rendering GLBs just to measure them. Use returned IDs and public labels;
83
+ internal production identifiers are not product names.
84
+
85
+ MCP also creates and mutates portable Lab documents. Call `list_live_labs`,
86
+ `get_lab_features`, then `create_lab_document`; its result wraps the portable
87
+ JSON in `document`. Save through the relevant Library tool when persistence is
88
+ part of the task. A valid document does not guarantee its preview or generated
89
+ asset has passed visual review.
90
+
91
+ Local `generate_asset` is procedural; local provider work uses
92
+ `generate_ai_asset` and the user's keys. Pro `generate_asset` spends separately
93
+ purchased credits. A free Pro month grants MCP access without AI credits.
94
+ Generation capability is not permission to spend; follow existing authorization
95
+ and the server's sourcing-policy requirements. Keep provider keys out of source
96
+ and portable documents.
97
+
98
+ ## Verify and hand off
99
+
100
+ Test through the app's real input and render path. Run its applicable checks,
101
+ wait for asset/render readiness, inspect the console, and capture the requested
102
+ views. Test restart/teardown and verify that listeners, resources, and animation
103
+ loops are not duplicated. Each system has one update owner and each frame has
104
+ one final render owner. Read `visual-verification` for a visual review.
105
+
106
+ For a heightfield scene, run the shared surface audit after the required passes
107
+ have rendered. Run `styleRuntime.collision.assertReady()` before relying on its
108
+ blockers. Test actual movement around representative obstacles. Include LOD,
109
+ shadow and shoreline views only when those systems are used.
110
+
111
+ Record missing package capabilities and material-policy exceptions when they
112
+ matter to the requested result. Ordinary host gameplay code is not a ToonLab
113
+ failure. Report what works, what was tested, and any remaining limitation;
114
+ never describe a build alone as a finished or visually approved game.