@babylonjs-toolkit/agent 1.2.0 → 1.2.1

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 (36) hide show
  1. package/README.md +3 -2
  2. package/package.json +1 -1
  3. package/skills/bt-atlas/SKILL.md +22 -5
  4. package/skills/bt-design/references/3d-hero-docs.md +10 -3
  5. package/skills/bt-design/references/3d-hero-scroll.md +30 -5
  6. package/skills/bt-gauntlet/SKILL.md +4 -4
  7. package/skills/bt-gauntlet/references/spec-composition.md +4 -2
  8. package/skills/bt-gauntlet/references/target-images.md +28 -4
  9. package/skills/bt-gauntlet/references/unity-pipeline.md +30 -8
  10. package/skills/bt-hero/SKILL.md +3 -3
  11. package/skills/bt-landing/SKILL.md +1 -1
  12. package/skills/bt-prototype/SKILL.md +3 -3
  13. package/skills/bt-unwrap/SKILL.md +396 -0
  14. package/skills/bt-unwrap/scripts/blender/__pycache__/bt_unwrap.cpython-313.pyc +0 -0
  15. package/skills/bt-unwrap/scripts/blender/__pycache__/image_utils.cpython-313.pyc +0 -0
  16. package/skills/bt-unwrap/scripts/blender/__pycache__/mesh_tools.cpython-313.pyc +0 -0
  17. package/skills/bt-unwrap/scripts/blender/__pycache__/model_io.cpython-313.pyc +0 -0
  18. package/skills/bt-unwrap/scripts/blender/__pycache__/previews.cpython-313.pyc +0 -0
  19. package/skills/bt-unwrap/scripts/blender/__pycache__/rasterizer.cpython-313.pyc +0 -0
  20. package/skills/bt-unwrap/scripts/blender/__pycache__/reference_views.cpython-313.pyc +0 -0
  21. package/skills/bt-unwrap/scripts/blender/__pycache__/reference_warp.cpython-313.pyc +0 -0
  22. package/skills/bt-unwrap/scripts/blender/__pycache__/texture_bake.cpython-313.pyc +0 -0
  23. package/skills/bt-unwrap/scripts/blender/__pycache__/texture_compose.cpython-313.pyc +0 -0
  24. package/skills/bt-unwrap/scripts/blender/__pycache__/uv_layout.cpython-313.pyc +0 -0
  25. package/skills/bt-unwrap/scripts/blender/bt_unwrap.py +678 -0
  26. package/skills/bt-unwrap/scripts/blender/image_utils.py +264 -0
  27. package/skills/bt-unwrap/scripts/blender/mesh_tools.py +508 -0
  28. package/skills/bt-unwrap/scripts/blender/model_io.py +135 -0
  29. package/skills/bt-unwrap/scripts/blender/previews.py +205 -0
  30. package/skills/bt-unwrap/scripts/blender/rasterizer.py +217 -0
  31. package/skills/bt-unwrap/scripts/blender/reference_views.py +945 -0
  32. package/skills/bt-unwrap/scripts/blender/reference_warp.py +571 -0
  33. package/skills/bt-unwrap/scripts/blender/texture_bake.py +390 -0
  34. package/skills/bt-unwrap/scripts/blender/texture_compose.py +596 -0
  35. package/skills/bt-unwrap/scripts/blender/uv_layout.py +605 -0
  36. package/skills/bt-unwrap/scripts/bt-unwrap.mjs +165 -0
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Babylon Toolkit Desktop Agent (1.2.0)
1
+ # Babylon Toolkit Desktop Agent (1.2.1)
2
2
 
3
3
  The desktop agent owns the entire pipeline end to end — frontend and UI design, gameplay code, shaders, generated art and audio, 3D models in headless Blender, whole game levels and prefabs in a terminal-driven Unity Editor, the interactive glTF export, the web build, the dev server, and visual QA by screenshotting both Unity and the running browser.
4
4
 
@@ -280,6 +280,7 @@ pair or schedule the bridge.
280
280
  | [`bt-design`](skills/bt-design/SKILL.md) | `/bt-design` | Implement high quality frontend and in-game designs. |
281
281
  | [`bt-hero`](skills/bt-hero/SKILL.md) | `/bt-hero` | Create smooth cinematic 3D scrolling hero sections. |
282
282
  | [`bt-atlas`](skills/bt-atlas/SKILL.md) | `/bt-atlas` | Generate texture atlas skin variations. |
283
+ | [`bt-unwrap`](skills/bt-unwrap/SKILL.md) | `/bt-unwrap` | Turn a rough AI-generated (or any) 3D model into a clean, web-ready game asset in one headless Blender run: repair the geometry, decimate to a face budget (lost shape re-baked as a normal map), orient it to glTF / BabylonJS forward at real-world scale, give it a new UV layout of large islands (less space for surfaces nobody sees), bake the source textures onto it, and paint the sharp reference images back on — straight and three-quarter views, each camera solved from the silhouette, one view per face, seams kept off logos, and the model's own texture kept where images and geometry disagree (engines, cockpits) — so a melted, fragmented texture comes out crisp instead of smeared. GLB / glTF / FBX / OBJ / USD / PLY / STL / Alembic / .blend in; GLB / glTF / FBX / OBJ / USD / .blend out with 2048 WebP textures (4096 on request), a single-sided PBR material, optional Draco and LODs, before/after renders, coverage and clutter maps, the UV island map for `bt-atlas`, and a JSON report with acceptance checks for plans. `--refs`, `--faces`, `--length`, `--texture-size`, `--unwrap views\|smart\|keep`, `--analyze`. |
283
284
  | [`bt-optimize`](skills/bt-optimize/SKILL.md) | `/bt-optimize` | Make an exported Unity scene run fast in the browser: profile the BabylonJS frame (draw calls per pass, lights, shadows, post-processing, resolution, materials, textures), fix the causes on a copy of the scene — runtime lights, shadows, post, exporter settings, static / lightmap / mirrored unlocks — and merge static meshes and LOD groups (packed lightmap UVs, LOD clusters); then re-bake, export and verify frame rate and look against the original. `--no-combine`, `--combine-only`. |
284
285
  | [`bt-profile`](skills/bt-profile/SKILL.md) | `/bt-profile` | Find what makes a web app slow and list the fixes (spec them with `/bt-spec`, or apply them with `--auto-fix`) — built for BabylonJS / Babylon Toolkit games, usable on any front end (give it a URL and the project folder): drive the running game in Chrome through a repeatable scenario (a cold load, a level start, a countdown), record the CPU profile, allocations, every frame and every GPU pipeline compile (with `--gpu-cold`, as on a first visit), map each millisecond to its source line and owner (your code, the toolkit runtime, BabylonJS, Havok, React), then list the fixes, or with `--auto-fix` apply them one at a time and re-measure each. Writes `.agents/profile/<slug>/dashboard.html` (live progress, Print / Download PDF) and a spec-ready `findings.md`. `--auto-fix`, `--snapshots`, `--watch`, `--gpu-cold`, `--stop`, `--resume`, `--restart`, `--project`, `--slug`. |
285
286
 
@@ -445,7 +446,7 @@ Where each tool looks for PROJECT-LOCAL skills (only when the user explicitly re
445
446
  > for everything else (Codex, Copilot, Gemini CLI, Antigravity). By default use the
446
447
  > GLOBAL (per-user home) locations; use the project-local locations only when the user
447
448
  > explicitly asks for a project install. Copy **whole folders** into each — the
448
- > `bt-atlas/scripts/`, `bt-optimize/scripts/` and `bt-profile/scripts/` + `bt-profile/templates/` assets must be present in every location.
449
+ > `bt-atlas/scripts/`, `bt-unwrap/scripts/`, `bt-optimize/scripts/` and `bt-profile/scripts/` + `bt-profile/templates/` assets must be present in every location.
449
450
 
450
451
 
451
452
  # Babylon Toolkit Loop Engineering (Gauntlet Loop)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonjs-toolkit/agent",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Installs the Babylon Toolkit Desktop Agent for Claude Code, Codex, GitHub Copilot, Gemini CLI and Antigravity.",
5
5
  "keywords": [
6
6
  "babylonjs",
@@ -64,8 +64,9 @@ user exactly which input failed and why, and ask for a corrected path/URL.
64
64
  - **Image generation**: pick the backend in this order:
65
65
  1. the tool or model the user named (e.g. "use nano-banana-2", "use Flux", "use Higgsfield");
66
66
  2. the **kie** image MCP (`kie-image-mcp`), the **default** where configured;
67
- 3. the **Higgsfield CLI** (`@higgsfield/cli`) where installed and signed in;
68
- 4. the host's built-in image generation, or any other configured image tool.
67
+ 3. the **Higgsfield API**, when the project's `.env` has `HIGGSFIELD_API_KEY` (checked by shape only, never printed);
68
+ 4. the **Higgsfield CLI** (`@higgsfield/cli`) where installed and signed in;
69
+ 5. the host's built-in image generation, or any other configured image tool.
69
70
 
70
71
  Whichever tool is used, pass BOTH the base texture and the UV layout as reference
71
72
  images to it. Match `aspect_ratio` to the texture (usually `1:1`), request a
@@ -75,7 +76,23 @@ user exactly which input failed and why, and ask for a corrected path/URL.
75
76
 
76
77
  - **kie**: `generate_image` with `reference_paths: [<base.png>, <uv_layout.png>]`
77
78
  (in that order), `out_path: <scratch>/raw/skin_var_NN.png`, `output_format: "png"`.
78
- - **Higgsfield CLI**: see the Babylon Toolkit reference `web-higgsfield-cli.md`. Install it locally
79
+ - **Higgsfield API** (`HIGGSFIELD_API_KEY`): see the Babylon Toolkit reference `web-higgsfield-cli.md`. Run the
80
+ installed wrapper in place, never a copy:
81
+ `HF_API="https://raw.githubusercontent.com/babylontoolkit/agent/main/references/higgsfield/hf-api.mjs"`.
82
+ 1. **Use an edit model that takes both references in order**: `alibaba/qwen-image-3/edit` (1–3 ordered
83
+ references, the closest match to "keep this layout") or `xai/grok-imagine-image-2.0` (up to 10). Base first:
84
+ ```
85
+ node "$HF_API" alibaba/qwen-image-3/edit --out <scratch>/raw/gen_NN --set prompt="<prompt>" \
86
+ --file image_urls[]=<base.png> --file image_urls[]=<uv_layout.png> \
87
+ --set resolution=2k --set aspect_ratio=1:1
88
+ ```
89
+ 2. **Estimate first**: the same command with `--estimate` in place of `--out <dir>`. Tell the user the
90
+ per-variant cost before a large batch.
91
+ 3. The wrapper saves `<request_id>_<field>.png` in the `--out` folder and lists it under `files` on stdout.
92
+ Move it to `<scratch>/raw/skin_var_NN.png`. `composite_skin.py` resizes it to the base texture's size, so
93
+ a 2K output for a 4K texture needs no extra step (the API image models stop at 2K).
94
+ 4. Run several variants as parallel calls from the shell, each with its own `--out` folder.
95
+ - **Higgsfield CLI** (no API key): see the Babylon Toolkit reference `web-higgsfield-cli.md`. Install it locally
79
96
  (`npm i -D @higgsfield/cli`) and add the reference's download wrapper as `scripts/hf-generate.mjs` in
80
97
  the project. The CLI only returns URLs; the wrapper saves the file.
81
98
  1. **Upload both references once** and reuse the IDs for every variant, because every call that names
@@ -191,8 +208,8 @@ for just those indices.
191
208
 
192
209
  ## Notes & gotchas
193
210
  - Always pass BOTH base + UV layout as references to the generator; never rely on
194
- the prompt alone to hold the layout. On Higgsfield that means two
195
- `--image-references` flags, base first.
211
+ the prompt alone to hold the layout. On the Higgsfield API that means two
212
+ `--file image_urls[]=` inputs, base first; on the CLI, two `--image-references` flags, base first.
196
213
  - Generated outputs (kie or Higgsfield) must end up as local files in `<scratch>/raw/`;
197
214
  never reference a remote result URL from the finals or the engine project.
198
215
  - The mask is the safety net. If a variant's island content is shifted inside its
@@ -64,10 +64,17 @@ all beats ffmpeg concat → journey.mp4
64
64
  **Which tool backs `generate_image` / `generate_video`?** These are generic
65
65
  calls, not a specific vendor. The skill routes them to whatever image/video
66
66
  generation is configured in your environment — KIE MCP servers (e.g.
67
- `kie-image-mcp` and `kie-video-mcp`, the default), the Higgsfield CLI, the
68
- model's own built-in image/video generation, or any other configured image/video
69
- tool. The prompt just says "generate the footage"; the wiring picks the backend.
67
+ `kie-image-mcp` and `kie-video-mcp`, the default), the Higgsfield API (when `.env`
68
+ has `HIGGSFIELD_API_KEY`), the Higgsfield CLI, the model's own built-in
69
+ image/video generation, or any other configured image/video tool. The prompt
70
+ just says "generate the footage"; the wiring picks the backend.
70
71
  `image_paths` / `reference_paths` / `out_path` are the KIE/Kling parameter names.
72
+ On the **Higgsfield API** every call goes through the Reference's installed
73
+ `hf-api.mjs`: `image_paths[0]` / `[1]` become `--file image_url=…` and
74
+ `--file last_image_url=…` on `kling-video/v3.0/pro/image-to-video` (or
75
+ `end_image_url` on `bytedance/seedance-2.5/image-to-video`), reference images
76
+ become `--file image_urls[]=<file>`, and each result is moved from the `--out`
77
+ folder to its `out_path`.
71
78
  On the **Higgsfield CLI** every call goes through the reference's
72
79
  `scripts/hf-generate.mjs` wrapper: `image_paths[0]` / `[1]` become
73
80
  `--start-image` / `--end-image` on `kling3_0` or `seedance_2_5`, reference images
@@ -40,8 +40,9 @@ memory in any framework; copy it and configure it.
40
40
  - **(a) Provided video** — skip to §3 (still needs the scrub re-encode).
41
41
  - **(b) Generate the footage** with whatever image/video generation is
42
42
  configured — KIE MCP servers (`kie-image-mcp` / `kie-video-mcp`, the
43
- **default**), the Higgsfield CLI, the model's own built-in image/video
44
- generation, or any other configured image/video tool — §2.
43
+ **default**), the Higgsfield API (`HIGGSFIELD_API_KEY` in `.env`), the
44
+ Higgsfield CLI, the model's own built-in image/video generation, or any
45
+ other configured image/video tool — §2.
45
46
  - **(c) No footage possible** — this pattern is wrong; use a static hero.
46
47
  2. **Brand tokens** — map `--hs-bg / --hs-ink / --hs-dim / --hs-accent /
47
48
  --hs-display / --hs-mono` to the host site's design system (DESIGN.md or
@@ -76,16 +77,40 @@ memory in any framework; copy it and configure it.
76
77
  The generation backend is pluggable — the pipeline below is the same whatever
77
78
  produces the frames. Choose the backend in this order: the one the user named →
78
79
  **KIE MCP servers** (`kie-image-mcp` / `kie-video-mcp`, the default) → the **Higgsfield
79
- CLI** → the model's own built-in image/video generation → any other configured
80
+ API** when the project's `.env` has `HIGGSFIELD_API_KEY` → the **Higgsfield CLI** →
81
+ the model's own built-in image/video generation → any other configured
80
82
  image/video tool. The parameter names below (`reference_paths`, `image_paths`,
81
- `out_path`) are KIE/Kling's; map them to your backend (Higgsfield mapping below).
83
+ `out_path`) are KIE/Kling's; map them to your backend (Higgsfield mappings below).
82
84
 
83
85
  > **If using the KIE MCP servers** (Babylon Toolkit projects): read the
84
86
  > Babylon Toolkit Agent Reference and its `web-kie-servers.md` sub-document
85
87
  > first (per CLAUDE.md). Those servers read the key from `.env` — a file named
86
88
  > `env` is ignored.
87
89
 
88
- > **If using the Higgsfield CLI** (`@higgsfield/cli`): read the Agent
90
+ > **If using the Higgsfield API** (`HIGGSFIELD_API_KEY` in `.env`, checked by
91
+ > shape only): read the Agent Reference's `web-higgsfield-cli.md` sub-document
92
+ > first. Run the Reference's installed wrapper in place, never a copy:
93
+ > `HF_API="https://raw.githubusercontent.com/babylontoolkit/agent/main/references/higgsfield/hf-api.mjs"`.
94
+ > It uploads local files, waits, and saves every result as
95
+ > `<request_id>_<field>.<ext>` under `--out <dir>`, listing them under `files`
96
+ > on stdout. Move each one to the path the step names. KIE-shaped calls map like this:
97
+ >
98
+ > | KIE shape | Higgsfield API |
99
+ > |---|---|
100
+ > | `generate_image({ prompt, out_path })` | `node "$HF_API" xai/grok-imagine-image-2.0 --out media/gen --set prompt="…" --set aspect_ratio=16:9 --set resolution=2k`, then move the PNG to `media/hero.png` |
101
+ > | `reference_paths: [hero.png]` | `--file image_urls[]=media/hero.png` (repeat for several, up to 10) |
102
+ > | `image_paths[0]` = first frame | `--file image_url=media/clip1-last.jpg` |
103
+ > | `image_paths[1]` = last frame | `--file last_image_url=media/hero.png` (Kling) · `--file end_image_url=media/hero.png` (Seedance) |
104
+ > | Kling 3 `std`/`pro` | `node "$HF_API" kling-video/v3.0/pro/image-to-video --set prompt="…" --set duration=<3–15> --set sound=off …` (`v3.0/standard/…`, `v3.0/4k/…`) |
105
+ > | general video | `node "$HF_API" bytedance/seedance-2.5/image-to-video --set duration=<4–30> --set resolution=1080p --set generate_audio=false …` |
106
+ > | `out_path: "clipN.mp4"` | `--out media/gen`, then move the saved `.mp4` to `media/clipN.mp4` (`--timeout` is in minutes, default 30) |
107
+ >
108
+ > Turn sound **off** (the scrub encode strips audio) and run every clip once
109
+ > with `--estimate` in place of `--out <dir>`. Tell the user the film's total
110
+ > before submitting it. There is no sign-in step. The API image models stop at
111
+ > 2K, so the anchor is 2K.
112
+
113
+ > **If using the Higgsfield CLI** (`@higgsfield/cli`, no API key): read the Agent
89
114
  > Reference's `web-higgsfield-cli.md` sub-document first. Install the CLI
90
115
  > locally (`npm i -D @higgsfield/cli`) and the reference's download wrapper as
91
116
  > `scripts/hf-generate.mjs`. The CLI only returns CDN URLs; the wrapper saves
@@ -52,9 +52,9 @@ Use the user's message after the skill name as the `arguments`.
52
52
  |---|---|
53
53
  | `references/workspace.md` | the `.agents/gauntlet/<name>/` layout, `progress.md` and round-journal formats, the resume protocol |
54
54
  | `references/critic-rubrics.md` | the critic contract, the scoring rubrics, the gap-list rules, the hard gates, the stall ladder |
55
- | `references/target-images.md` | generating, prompting, reachability-checking, locking the target; locked cameras; **generation backends** (kie default, Higgsfield mapping) |
55
+ | `references/target-images.md` | generating, prompting, reachability-checking, locking the target; locked cameras; **generation backends** (kie default, Higgsfield API and CLI mapping) |
56
56
  | `references/loop-templates.md` | Template A and Template B loop cards |
57
- | `references/unity-pipeline.md` | the Unity build + verify pipeline, with Blender as the modelling tool |
57
+ | `references/unity-pipeline.md` | the Unity build + verify pipeline, with Blender as the modelling tool and image → 3D blockouts (Hi3D first, then Higgsfield) |
58
58
  | `references/spec-composition.md` | composition with bt-spec / bt-plan / bt-execute, and cross-host notes |
59
59
 
60
60
  ---
@@ -167,7 +167,7 @@ and export it for my BabylonJS game — wet asphalt with puddle reflections, lay
167
167
  volumetric haze under the lights, at the fidelity of the attached screenshots.
168
168
  ```
169
169
 
170
- **If the user attaches nothing**, the interview generates the target instead — a real in-engine screenshot, never concept art (`references/target-images.md` § 2). The calls below use the kie shape (the default backend); on the Higgsfield CLI, map them per `target-images.md` §1a: `node scripts/hf-generate.mjs <model> --prompt … --image-references <file> --out <same out_path>`:
170
+ **If the user attaches nothing**, the interview generates the target instead — a real in-engine screenshot, never concept art (`references/target-images.md` § 2). The calls below use the kie shape (the default backend); on Higgsfield, map them per `target-images.md` §1a: on the API (`HIGGSFIELD_API_KEY`), `node "$HF_API" xai/grok-imagine-image-2.0 --set prompt="…" --file image_urls[]=<file> --out <dir>`, then move the saved file to the same out_path; on the CLI, `node scripts/hf-generate.mjs <model> --prompt … --image-references <file> --out <same out_path>`:
171
171
 
172
172
  ```
173
173
  generate_image(
@@ -269,7 +269,7 @@ Nothing model-specific is needed — `selection == null` exports the level, the
269
269
 
270
270
  The checkpoint is also where the critic gets both the Unity snapshot and the browser frame of the same angle and must say which side a gap is on — *Unity right, browser wrong* means material translation, not the sculpt, so don't re-model.
271
271
 
272
- **Textures are generated, never procedural stand-ins** — `generate_image` (kie by default, Higgsfield per `target-images.md` §1a) for albedo, normal and roughness detail. With the Higgsfield CLI set up, a part that starts from nothing may take an image-to-3D GLB as its blockout (`unity-pipeline.md`). "Substituted procedural noise for the missing map" is a gate failure, and it is the single most common reason a model reads as plastic.
272
+ **Textures are generated, never procedural stand-ins** — `generate_image` (kie by default, Higgsfield per `target-images.md` §1a) for albedo, normal and roughness detail. A part that starts from nothing may take an image-to-3D GLB as its blockout: Hi3D when `HI3D_ACCESS_KEY` + `HI3D_SECRET_KEY` are set, else Higgsfield (API or CLI) (`unity-pipeline.md`). "Substituted procedural noise for the missing map" is a gate failure, and it is the single most common reason a model reads as plastic.
273
273
 
274
274
  Scored on the **model rubric** (Silhouette & Proportion · Surface & Material · Detail Density · Topology & Efficiency · Integration Readiness), with gates on tri budget, ≤4 influences/vertex, weights normalised, transform hygiene and GUID survival.
275
275
 
@@ -70,8 +70,10 @@ re-invocation — no host loop feature is required.
70
70
  - **Browser evidence:** chrome-devtools MCP on Claude Code; other hosts use their browser/screenshot tool.
71
71
  None available → parts are `unverified`, never passed.
72
72
  - **Image generation:** the toolkit's `kie-image` MCP (`generate_image`) by default where configured.
73
- The Higgsfield CLI is also supported, through the `scripts/hf-generate.mjs` download wrapper
74
- (`target-images.md` §1a). It is a shell tool, so it works on any host with a shell. Otherwise use any host image tool. None available and no user-supplied
73
+ Higgsfield is also supported: the API through the Reference's installed `hf-api.mjs` when `.env` has
74
+ `HIGGSFIELD_API_KEY`, else the CLI through the `scripts/hf-generate.mjs` download wrapper (`target-images.md` §1a).
75
+ For image → 3D blockouts, Hi3D's installed `hi3d-api.mjs` comes first when `HI3D_ACCESS_KEY` + `HI3D_SECRET_KEY`
76
+ are set (`unity-pipeline.md`). All three are shell tools, so they work on any host with a shell. Otherwise use any host image tool. None available and no user-supplied
75
77
  reference → stop and ask (see `target-images.md`).
76
78
  - **Interview:** `AskUserQuestion` where the host has it; plain numbered questions otherwise.
77
79
  - **Unity / Blender CLIs:** shell tools, so they work on any host with a shell. A host with no shell cannot
@@ -20,15 +20,19 @@ gap to it.
20
20
  reimagines the scene sends the loop chasing a layout it was never asked to build.
21
21
  3. **Starting fresh.** Generate the target directly from the brief.
22
22
 
23
- ### 1a. Generation backends — kie by default, Higgsfield supported
23
+ ### 1a. Generation backends — kie by default, Higgsfield (API or CLI) supported
24
24
 
25
25
  Every `generate_image(...)` call in this skill is written in the **kie** shape. Pick the backend once, at
26
26
  the interview, and record it in `pipeline.md` so a resumed session uses the same one:
27
27
 
28
28
  1. **The user named a backend or model** → use it.
29
29
  2. **kie** (`kie-image` MCP) is configured → **default**.
30
- 3. The **Higgsfield CLI** is installed and signed in (`node_modules/.bin/higgsfield account status --json` works) → use it.
31
- 4. Otherwise → the host's built-in image tool.
30
+ 3. The project's `.env` has **`HIGGSFIELD_API_KEY`** → the **Higgsfield API**, through the Reference's installed
31
+ `hf-api.mjs`. It bills the API balance the user paid into, so it comes before the CLI.
32
+ 4. The **Higgsfield CLI** is installed and signed in (`node_modules/.bin/higgsfield account status --json` works) → use it.
33
+ 5. Otherwise → the host's built-in image tool.
34
+
35
+ Check the keys by their shape only (set or not, their length), never by printing them.
32
36
 
33
37
  **kie (default)** — see
34
38
  [Image, Video And Sound Generation](https://raw.githubusercontent.com/babylontoolkit/agent/main/references/web-kie-servers.md):
@@ -41,7 +45,27 @@ generate_image(prompt, out_path, reference_paths?, model?, aspect_ratio?, resolu
41
45
  - `reference_paths` → the current-state screenshot for the refinement path (up to 14 files)
42
46
  - `aspect_ratio` → match the locked camera's aspect; `resolution: "2K"` or `"4K"`; `output_format: "png"`
43
47
 
44
- **Higgsfield CLI** — see
48
+ **Higgsfield API** (`HIGGSFIELD_API_KEY`) — see
49
+ [Higgsfield CLI and API](https://raw.githubusercontent.com/babylontoolkit/agent/main/references/web-higgsfield-cli.md),
50
+ which has the full kie → API table. Run the installed wrapper in place, never a copy:
51
+
52
+ ```
53
+ HF_API="https://raw.githubusercontent.com/babylontoolkit/agent/main/references/higgsfield/hf-api.mjs"
54
+ node "$HF_API" xai/grok-imagine-image-2.0 --estimate --set prompt="…" --file image_urls[]=<current-state.png> \
55
+ --set resolution=2k --set aspect_ratio=16:9
56
+ node "$HF_API" xai/grok-imagine-image-2.0 --out <round-dir>/gen --set prompt="…" \
57
+ --file image_urls[]=<current-state.png> --set resolution=2k --set aspect_ratio=16:9
58
+ ```
59
+
60
+ - `reference_paths` → one `--file image_urls[]=<file>` per reference, in order (up to 10). For a strict edit of
61
+ 1–3 references, use `alibaba/qwen-image-3/edit`. For a text-only draft, use `z-image/turbo`.
62
+ - `out_path` → the wrapper saves `<request_id>_<field>.png` under `--out <dir>`. Move the file stdout lists under
63
+ `files` to the `out_path` the step names (`reference/target-<camera>.png`).
64
+ - `resolution: "4K"` → the API image models stop at `2k`. Lock the target at 2K.
65
+ - **Estimate first** and log the cost per image in `pipeline.md`, exactly as for the CLI below. There is no sign-in
66
+ and no workspace step.
67
+
68
+ **Higgsfield CLI** (no API key) — see
45
69
  [Higgsfield CLI](https://raw.githubusercontent.com/babylontoolkit/agent/main/references/web-higgsfield-cli.md).
46
70
  Install it locally (`npm i -D @higgsfield/cli`) and generate through the reference's download wrapper
47
71
  `scripts/hf-generate.mjs`, which saves the result to `--out` the way kie saves to `out_path`. The CLI itself only
@@ -216,17 +216,39 @@ return UnityEditor.AssetDatabase.AssetPathToGUID(p) + " rig=" + i.animationType
216
216
  matching the Unity Avatar/Animator rig, and `add_leaf_bones=False` on FBX export.
217
217
 
218
218
  **Textures are generated, not procedural.** Use `generate_image` for albedo, normals, roughness masks and
219
- detail maps. It goes to the backend recorded in `pipeline.md`: the toolkit's `kie-image` MCP by default, or
220
- the Higgsfield CLI (`node scripts/hf-generate.mjs <model> … --out Assets/Textures/<map>.png`, per `target-images.md` §1a). Substituting
219
+ detail maps. It goes to the backend recorded in `pipeline.md`: the toolkit's `kie-image` MCP by default, the
220
+ Higgsfield API (`node "$HF_API" <model-path> … --out <dir>`, then move the saved file to
221
+ `Assets/Textures/<map>.png`), or the Higgsfield CLI (`node scripts/hf-generate.mjs <model> … --out Assets/Textures/<map>.png`),
222
+ per `target-images.md` §1a. Substituting
221
223
  procedural noise or flat colours for maps the target needs is a gate failure, and the commonest reason an
222
224
  asset reads as plastic.
223
225
 
224
- **Image → starting mesh (Higgsfield only).** When a model part starts from nothing and the Higgsfield CLI is
225
- set up, an image-to-3D model can turn the locked target's subject into a GLB blockout:
226
- `node scripts/hf-generate.mjs tripo_h3_1_image_to_3d --image-references <subject.png> --out <round-dir>/blockout.glb`
227
- (9 credits; `tripo_h3_1_multiview_to_3d` for 2–4 views). Run `--cost` first and log it. Confirm the result with
228
- `file blockout.glb` (`glTF binary`), then import it into Blender and refine it like any other source mesh: retopo, UVs, LODs, weights under the gates
229
- above. It is a head start on the silhouette, never a finished asset. Its topology and UVs will not pass the
226
+ **Image → starting mesh.** When a model part starts from nothing, an image-to-3D model can turn the locked
227
+ target's subject into a GLB blockout. Pick the generator in this order and record it in `pipeline.md`:
228
+
229
+ 1. **Hi3D**, when the project's `.env` has `HI3D_ACCESS_KEY` + `HI3D_SECRET_KEY`. It is the preferred mesh generator
230
+ ([Hi3D API](https://raw.githubusercontent.com/babylontoolkit/agent/main/references/web-hi3d-api.md)):
231
+ ```
232
+ HI3D_API="https://raw.githubusercontent.com/babylontoolkit/agent/main/references/hi3d/hi3d-api.mjs"
233
+ node "$HI3D_API" image-to-3d --estimate --file images=<subject.png> --set face=100000
234
+ node "$HI3D_API" image-to-3d --out <round-dir> --name blockout --file images=<subject.png> --set face=100000
235
+ ```
236
+ 45 credits ($0.90) at the default `hi3dv3.0` / `2048quality`. For 2–4 views, use
237
+ `--view front=… --view back=… --view left=… --view right=…` in place of `--file images=…`. Hi3D's order differs
238
+ from Tripo's, and `--view` gets it right. For a cheap shape iteration, use
239
+ `--set model=hitem3dv2.1 --set resolution=1536fast` (25 credits). Never resubmit a task that timed out; resume it
240
+ with `--task <task_id>`.
241
+ 2. **Higgsfield API**, when `.env` has `HIGGSFIELD_API_KEY` (`HF_API` is the installed wrapper, `target-images.md` §1a):
242
+ `node "$HF_API" tripo3d/h3.1/image-to-3d --out <round-dir> --file image_url=<subject.png>`, then move the saved
243
+ `.glb` to `<round-dir>/blockout.glb` (`tripo3d/h3.1/multiview-to-3d` with `--file image_urls[]=…` for 2–4 views,
244
+ in Tripo's order: front, left, back, right). Run `--estimate` first.
245
+ 3. **Higgsfield CLI**, when it is signed in:
246
+ `node scripts/hf-generate.mjs tripo_h3_1_image_to_3d --image-references <subject.png> --out <round-dir>/blockout.glb`
247
+ (9 credits; `tripo_h3_1_multiview_to_3d` for 2–4 views). Run `--cost` first.
248
+
249
+ Log the cost of each one. Confirm the result with `file blockout.glb` (`glTF binary`). Then run `bt-unwrap` on it
250
+ with the same reference views, or import it into Blender, and refine it like any other source mesh: retopo, UVs,
251
+ LODs, weights under the gates above. It is a head start on the silhouette, never a finished asset. Its topology and UVs will not pass the
230
252
  model rubric untouched.
231
253
 
232
254
  ---
@@ -37,7 +37,7 @@ Whatever is present is used verbatim; the intake resolves the rest (Step 1). **T
37
37
  Every piece of a 3D hero scroll belongs to exactly one tier. This is the rule that keeps the intake small and the output deterministic:
38
38
 
39
39
  - **Tier 1 — Invariants.** How the mechanic works. Owned by bt-design's reference and templates; never asked, never in the brief, never overridable: muted footage, the all-intra scrub encode, blob preload, veiled cuts, film-speed autoplay, cancel semantics, the `HS_CONFIG`/markup syntax, and the **verification protocol — which always runs, without being requested.**
40
- - **Tier 2 — Defaults.** Sensible values supplied silently; the user may override any of them in their input (recorded in the brief's `Overrides` section): aspect ratio (default 16:9), clip duration (**backend-derived — probe the configured video model's real output; never assume a number**), the 4-beat REVEAL → MOTION → SHIFT → FINALE arc, `sweep: page`, controls all-on (`sweep: page`) / HUD+PLAY (`sweep: hero`), the scroll-length formula, poster = first film frame, generation backend (**KIE MCP by default; the Higgsfield CLI when that is what's set up or the user names it**; see bt-design `3d-hero-scroll.md` §2 for the Higgsfield mapping).
40
+ - **Tier 2 — Defaults.** Sensible values supplied silently; the user may override any of them in their input (recorded in the brief's `Overrides` section): aspect ratio (default 16:9), clip duration (**backend-derived — probe the configured video model's real output; never assume a number**), the 4-beat REVEAL → MOTION → SHIFT → FINALE arc, `sweep: page`, controls all-on (`sweep: page`) / HUD+PLAY (`sweep: hero`), the scroll-length formula, poster = first film frame, generation backend (**KIE MCP by default; Higgsfield when that is what's set up or the user names it: the API when `.env` has `HIGGSFIELD_API_KEY`, else the CLI**; see bt-design `3d-hero-scroll.md` §2 for both Higgsfield mappings).
41
41
  - **Tier 3 — Creative slots.** The only things intake deals in — the eight slots below.
42
42
 
43
43
  If it's how the mechanic works → Tier 1. If it's a value that could legitimately differ per project → Tier 2. If it's a creative decision about *this* product → Tier 3.
@@ -62,7 +62,7 @@ Then resolve every unfilled slot by exactly one of two paths:
62
62
  - **Enough to fly** — the input contains a usable star (an idea sentence, or an image/video whose subject is clear): fill every remaining slot from its default, ask **nothing**, and proceed. This is the one-shot path.
63
63
  - **Not enough to fly** — empty input, or fragments with no discernible star: ask **only the unanswered questions** — inline, conversationally, as ONE compact numbered list (never one-at-a-time interrogation, never a structured question UI). Tell the user loose prose, partial answers, and "you pick" are all fine. What they answer is used; what they skip gets the default. Then proceed — do not re-confirm.
64
64
 
65
- **Footage feasibility check:** if there is no provided footage AND no image/video generation backend configured (KIE MCP — the default, Higgsfield CLI, built-in generation, …), STOP — this pattern is wrong without footage; recommend a static hero instead (per the bt-design reference intake).
65
+ **Footage feasibility check:** if there is no provided footage AND no image/video generation backend configured (KIE MCP — the default, the Higgsfield API or CLI, built-in generation, …), STOP — this pattern is wrong without footage; recommend a static hero instead (per the bt-design reference intake).
66
66
 
67
67
  ## Step 2 — Write the hero brief (the save file)
68
68
 
@@ -82,7 +82,7 @@ status: draft
82
82
 
83
83
  ## 2. Footage Source
84
84
  - Mode: generate | provided
85
- - Backend: kie | higgsfield | <other> (generate mode only — recorded so a re-run uses the same one)
85
+ - Backend: kie | higgsfield-api | higgsfield-cli | <other> (generate mode only — recorded so a re-run uses the same one; `higgsfield` in an older brief means the CLI)
86
86
  - Anchor: <image-generation prompt for the hero anchor> | <path/to/existing-image-or-video>
87
87
 
88
88
  ## 3. The Journey
@@ -124,7 +124,7 @@ The Layout law from Step 2 binds these surfaces too — full-bleed, responsive,
124
124
 
125
125
  If the platform's `generate_image` / `generate_video` tools are available on this turn, use them to make the design beautiful: a hero background, a logo/wordmark, splash-adjacent accents (16:9 for wide heroes, 1:1 for badges/logos; png when alpha matters). Make ALL generate calls FIRST, in ONE parallel round, before writing any files; reference the returned `/assets/generated/…` paths exactly as returned (the one exception to never-invent-an-asset-path) — the renders land in the background, so every surface must look finished while they do (styled color/gradient fallback behind each image, never a blank box). At most ONE short looping hero video, and only if it truly elevates the design — video costs the user hundreds of credits. If the tools are absent, design with CSS + the images on disk instead.
126
126
 
127
- **Backend mapping (Claude Code and other MCP hosts).** Where no platform-native `generate_*` is present, use the **KIE MCP** servers by default (`web-kie-servers.md`): pass `out_path` under the project's `assets/generated/` folder and reference that path. When the **Higgsfield CLI** is the set-up or requested backend (`web-higgsfield-cli.md`), generate through the reference's `scripts/hf-generate.mjs` wrapper, which saves each result to `--out` (for example `node scripts/hf-generate.mjs gpt_image_2_5 --prompt "…" --aspect_ratio 16:9 --resolution 2k --out assets/generated/hero-bg.png`). Launch all the calls in ONE parallel round in the background (shell `&`), write the files with their fallbacks in place, then `wait`. Image results are **PNG**, so reference `.png` paths (the wrapper saves `--out x.jpg` as `x.png` and reports it). Never reference a Higgsfield CDN URL. Run `--cost` first and state the total.
127
+ **Backend mapping (Claude Code and other MCP hosts).** Where no platform-native `generate_*` is present, use the **KIE MCP** servers by default (`web-kie-servers.md`): pass `out_path` under the project's `assets/generated/` folder and reference that path. When Higgsfield is the set-up or requested backend and the project's `.env` has **`HIGGSFIELD_API_KEY`**, use the **Higgsfield API** through the Reference's installed `hf-api.mjs` (`web-higgsfield-cli.md`, run in place; `HF_API="https://raw.githubusercontent.com/babylontoolkit/agent/main/references/higgsfield/hf-api.mjs"`): for example `node "$HF_API" xai/grok-imagine-image-2.0 --out assets/generated/gen --set prompt="…" --set aspect_ratio=16:9 --set resolution=2k`, then move the PNG it lists under `files` to `assets/generated/hero-bg.png`. Run `--estimate` first and state the total. Otherwise, when the **Higgsfield CLI** is the set-up or requested backend (`web-higgsfield-cli.md`), generate through the reference's `scripts/hf-generate.mjs` wrapper, which saves each result to `--out` (for example `node scripts/hf-generate.mjs gpt_image_2_5 --prompt "…" --aspect_ratio 16:9 --resolution 2k --out assets/generated/hero-bg.png`). Launch all the calls in ONE parallel round in the background (shell `&`), write the files with their fallbacks in place, then `wait`. Image results are **PNG**, so reference `.png` paths (the wrapper saves `--out x.jpg` as `x.png` and reports it). Never reference a Higgsfield CDN URL. Run `--cost` first and state the total.
128
128
 
129
129
  Generated art goes on the LANDING PAGE — never on the splash/preloader (Step 3's lightweight rule). Art direction for every generate call comes from `DESIGN.md` — prompt the renders in its palette and atmosphere so the art belongs to the same design as the CSS around it.
130
130
 
@@ -53,7 +53,7 @@ Use the user's message after the skill name as the `arguments`.
53
53
 
54
54
  ## ⚠️ Required reading before any build
55
55
 
56
- For any Babylon / BabylonJS / Babylon Toolkit work, ensure the **Agent Reference** is already read in this session/context (read `https://raw.githubusercontent.com/babylontoolkit/agent/main/reference.md` first if not; and its `web-kie-servers.md` sub-document if using the KIE MCP servers, or its `web-higgsfield-cli.md` sub-document if using the Higgsfield CLI). If a required document cannot be read, STOP and tell the user. Do not re-read what you already remember.
56
+ For any Babylon / BabylonJS / Babylon Toolkit work, ensure the **Agent Reference** is already read in this session/context (read `https://raw.githubusercontent.com/babylontoolkit/agent/main/reference.md` first if not; and its `web-kie-servers.md` sub-document if using the KIE MCP servers, or its `web-higgsfield-cli.md` sub-document if using the Higgsfield API or CLI). If a required document cannot be read, STOP and tell the user. Do not re-read what you already remember.
57
57
 
58
58
  If the project keeps a root **SPEC.md**, read it first and conform to its architecture/conventions; record the shipped prototypes per the project's working agreement when the batch lands.
59
59
 
@@ -74,7 +74,7 @@ The **difference** between prototypes is in the *design language* — layout, mo
74
74
  1. Read the flags (`--type`, `--count`, `--motionsites`, `--awwwards[:forensic]`, `--3d-hero-scroll`) and the `<theme>`. Apply defaults (`html`, `10`).
75
75
  2. **Theme gate:** if no theme is discernible, ask **once** — one short inline question — then proceed. This is the only interactive stop; once the batch starts, it runs autonomously.
76
76
  3. Ingest attached screenshots into a world anchor (above). Note the host: React (Vite/TS) vs plain HTML, per `--type` and any existing project.
77
- 4. **Asset-backend check:** the Fable-grade bar assumes asset generation is available. Confirm what's configured — KIE MCP (image/video/Kling — the **default**), the Higgsfield CLI (`node_modules/.bin/higgsfield account status --json` succeeds), GPT Image 2 keys, Pinterest source. Pass the chosen backend to every subagent so the batch is consistent. **If Higgsfield is the backend, check `account status`, run one image and one video through `scripts/hf-generate.mjs … --cost`, then tell the user the estimated batch cost before fanning out**: N prototypes × video is where credits disappear. If none is available, say so and proceed with hand-authored CSS/SVG/WebGL craft rather than silently producing flat pages.
77
+ 4. **Asset-backend check:** the Fable-grade bar assumes asset generation is available. Confirm what's configured — KIE MCP (image/video/Kling — the **default**), the Higgsfield API (the project's `.env` has `HIGGSFIELD_API_KEY`, checked by shape only; it comes before the CLI), the Higgsfield CLI (`node_modules/.bin/higgsfield account status --json` succeeds), GPT Image 2 keys, Pinterest source. Pass the chosen backend to every subagent so the batch is consistent. **If Higgsfield is the backend, run one image and one video through `--estimate` (API: the installed `hf-api.mjs`) or `--cost` (CLI: `scripts/hf-generate.mjs`, after checking `account status`), then tell the user the estimated batch cost before fanning out**: N prototypes × video is where credits disappear. If none is available, say so and proceed with hand-authored CSS/SVG/WebGL craft rather than silently producing flat pages.
78
78
 
79
79
  ## Step 2 — Compose the direction spread (N genuinely-different lenses)
80
80
 
@@ -130,7 +130,7 @@ Each prototype subagent gets: its **direction**, the **theme**, the **world anch
130
130
 
131
131
  1. **Own its folder.** Create `.agents/prototypes/<NN-slug>/` and put **everything self-contained inside it** — markup, styles, scripts, and all generated/downloaded assets. No shared globals; a prototype is copy-out-able on its own.
132
132
  2. **Build to the Fable bar for its lens** — advanced 3D tactics, otherworldly animation, exceptional palette, novel type. Not a template with the colors swapped; a distinct, *mind-blowing* execution of that direction for this game. **Full-bleed console UI by default** (bt-design's *Layout Philosophy*): fill the whole viewport edge-to-edge like a console dashboard / game menu, not a centered fixed-width website — unless this direction is the noted contained exception.
133
- 3. **Produce assets** via any mix of the available workflows: Pinterest pulls for reference, **GPT Image 2** for stills, **KIE MCP servers (default) / the Higgsfield CLI (Kling, Seedance, etc.)** for motion/video, hand-authored WebGL/SVG/CSS. All assets stay faithful to the world anchor and live in the prototype's folder. **On Higgsfield, every generation goes through the reference's `scripts/hf-generate.mjs` wrapper** with `--out .agents/prototypes/<NN-slug>/<file>`: the CLI alone only returns a CDN URL, and a prototype must never hot-link one. Local reference images are passed as file paths (`--image-references`, `--start-image`, `--end-image`) and uploaded automatically.
133
+ 3. **Produce assets** via any mix of the available workflows: Pinterest pulls for reference, **GPT Image 2** for stills, **KIE MCP servers (default) / Higgsfield, API or CLI (Kling, Seedance, etc.)** for motion/video, hand-authored WebGL/SVG/CSS. All assets stay faithful to the world anchor and live in the prototype's folder. **On the Higgsfield API, every generation goes through the Reference's installed `hf-api.mjs`** (run in place, `web-higgsfield-cli.md` has the kie → API model table) with `--out .agents/prototypes/<NN-slug>/gen`, then the saved file is moved to its name in the prototype's folder; local references go in as `--file image_urls[]=…` (first / last video frames as `--file image_url=…` and `--file last_image_url=…` on Kling 3, `end_image_url` on Seedance 2.5). **On the Higgsfield CLI, every generation goes through the reference's `scripts/hf-generate.mjs` wrapper** with `--out .agents/prototypes/<NN-slug>/<file>`: the CLI alone only returns a CDN URL, and a prototype must never hot-link one. Local reference images are passed as file paths (`--image-references`, `--start-image`, `--end-image`) and uploaded automatically.
134
134
  4. **3D-hero-scroll directions:** follow *The 3D-hero-scroll batch rule* below.
135
135
  5. Run its own **iteration passes** (Step 4) before returning.
136
136
  6. **Write clean, readable code.** Every file follows the Coding Practices: clean, professional TypeScript or JavaScript in the project's own language; meaningful full-word names, never one- or two-letter names or obfuscation; well-structured, readable, maintainable code for human developers; meaningful JSDoc on every class, function, method and public member (always written, but never a reason to fail a test or verification). The chosen prototype becomes the user's real front end, so its code must be maintainable. Every HUD follows the Agent Reference's **Game UI Performance — ENFORCED**: per-frame values (speed, timers, bars, needles) reach the screen through refs and one frame loop, never React state or a per-frame EventBus message. And nothing runs per frame that does not need to: the "otherworldly animation" is CSS `@keyframes` / `transition` on `transform` and `opacity` wherever CSS can do it; a WebGL / canvas / scroll-scrubbed scene pauses off-screen (`IntersectionObserver`) and in a background tab, writes nothing while the scroll is at rest, and honors `prefers-reduced-motion`; nothing animates `width` / `height` / `top` / `left` or reads layout per frame (`ui-design-system.md` › **Per frame or not**). Spectacle that costs frames when nothing is moving is not finished.