@genex-ai/cli-demo 0.86.0-dev.217 → 0.88.0-dev.219

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.
@@ -0,0 +1,145 @@
1
+ # Custom animations with `genex motion` — the full procedure
2
+
3
+ Text → raw motion takes on the platform GPU service → objective verify →
4
+ YOUR pick → local compile → a rig-independent set the vendored runtime plays
5
+ on any humanoid. The skeleton is a 27-joint humanoid core at 20 fps; takes
6
+ arrive as `.npz` files plus a machine verify report. Everything after `gen`
7
+ runs locally and free — regenerate compiled sets as often as you like.
8
+
9
+ **Rig limits (say them to the user before promising a move):** biped,
10
+ human-proportioned characters only. Rigs without finger bones (many Meshy
11
+ characters) cannot curl fingers around a grip — prefer weapon-carry looks
12
+ that read well with flat hands there, or use a rig with fingers for hero
13
+ characters. Takes are 2–10 seconds.
14
+
15
+ ## The loop
16
+
17
+ ```bash
18
+ # 1. Generate (bills per take, default 4; ALWAYS --no-wait — jobs run minutes)
19
+ npx genex motion gen "soldier rifle low-ready idle, fully upright, head held high" --takes 4 --no-wait
20
+ npx genex wait <id> # prints one URL per take + the report
21
+
22
+ # 2. Download the takes it printed and RENAME them — filenames drive everything
23
+ mkdir -p takes && curl -o takes/rifle-idle.npz "<take-url>"
24
+
25
+ # 3. Verify locally (same math the service ran; free, reproducible)
26
+ npx genex motion verify takes/
27
+
28
+ # 4. Pick the takes whose MOTION reads right (the report is data, not taste),
29
+ # then compile the set
30
+ npx genex motion compile takes/ --out src/motion/rifle.json
31
+
32
+ # 5. Vendor the runtime once per game (+ the proven rifle starter set)
33
+ npx genex motion install --set rifle
34
+ ```
35
+
36
+ ## Take naming — the routing contract
37
+
38
+ `verify` and `compile` classify each take by its FILENAME stem. Rename
39
+ downloaded takes before running them:
40
+
41
+ | Stem pattern | Compiles into |
42
+ |---|---|
43
+ | `<set>-run-forward` / `-back` | `forward` / `back` gait |
44
+ | `<set>-strafe-left` / `-strafe-right` | `strafeLeft` / `strafeRight` |
45
+ | `<set>-run-fl` / `-fr` / `-bl` / `-br` | the four diagonal gaits |
46
+ | `<set>-idle` or `…stance…` | the `idle` loop |
47
+ | `…jump…` (`jump-stand`, `jump-run`) | `jumpStand` / `jumpRun` one-shots |
48
+ | anything else | a named freeform loop |
49
+
50
+ A stem containing `aim`, `rifle`, or `pistol` marks the take as a WEAPON
51
+ HOLD: verify adds the hold-shape gates, and compile grip-line-normalizes the
52
+ idle (the whole body blades as one) and plucks `aim0`/`aim0Up`/`aim0Dn`
53
+ upper-body mask poses from the hold takes.
54
+
55
+ ## The prompt wording ladder (hard-won — wrong words cost paid takes)
56
+
57
+ - **Never ask for "sights" or a "cheek weld"** — you get a hunched
58
+ face-height hold that reads absurd on game rigs. Ask for the third-person
59
+ hold: *"weapon at chest height, arms extended"*, *"low-ready"* as the
60
+ fallback.
61
+ - **Always add "fully upright, head held high"** — the model's prior slouches.
62
+ - **Describe hand geometry literally** (*"left hand forward on the handguard,
63
+ right hand at the grip"*), not by weapon jargon.
64
+ - The model NEVER squares a two-handed hold to the pelvis — real marksmen
65
+ blade, and compile normalizes the heading by the grip line. Do not fight
66
+ it with prompt words; it is not a defect.
67
+ - **Gaits need constraints, not prose.** Direction words alone drift; pin
68
+ the trajectory:
69
+
70
+ ```bash
71
+ npx genex motion constraints --dir strafe-left --speed 2.5 --duration 5 --out strafe-left.json
72
+ npx genex motion gen "soldier strafing with a rifle at low-ready" --constraints strafe-left.json --no-wait
73
+ ```
74
+
75
+ The constraint pins the root path AND the heading (facing stays +Z) — that
76
+ pin is what makes a strafe a strafe. One direction per request; a full
77
+ 8-direction set is 8 requests + one idle (run them in parallel with
78
+ `--no-wait`, like any batch).
79
+
80
+ ## Verify semantics
81
+
82
+ `PASS` (≥70) / `WARN` (≥50) / `FAIL`, with a hard-zero cap: a zero on any
83
+ load-bearing gate fails the take no matter the average. The reasons column
84
+ names the defect in plain words (feet skate, grip line wanders, cheek weld…).
85
+ The report is DATA — freeform verbs have no semantic gate, so watch the take
86
+ on the rig before shipping it. Tune bands via `--gates gates.json` (partial
87
+ JSON, deep-merged: `{"aim": {"hunch": {"bad": 25}}}`).
88
+
89
+ ## Compile semantics + tunables
90
+
91
+ Compile cuts loop cycles at left-foot strikes (gaits) or the best seam window
92
+ (idles), removes the linear trajectory (residual sway + full Y bob stay),
93
+ normalizes heading to +Z, phase-aligns gaits (frame 0 = left strike), and for
94
+ weapon holds levels the arm assembly, raises the gaze, clamps tall stances,
95
+ and yaws mask poses in the SPINE. All rigid whole-body/assembly operations —
96
+ no joint ever moves relative to another (the no-bake law; it is why compiled
97
+ sets survive retargeting). Every threshold lives in
98
+ `src/motion/motion.config.json` after install — pass `--config` to use it.
99
+
100
+ ## Wiring the runtime
101
+
102
+ `genex motion install` puts the runtime IN YOUR GAME — `src/motion/rigs.js`
103
+ (both retarget formulas + the load-time normalizations), `anim-runtime.js`
104
+ (ClipSet/Animator/dir8Weights/aimMaskStep), `ik.js`, and the config. They are
105
+ yours: read them, tune them, the comments explain every formula. Load order
106
+ matters:
107
+
108
+ ```js
109
+ import { loadRig, captureRestAnkle, reanchorFeet, groundCalibrate, curlFingers } from "./motion/rigs.js";
110
+ import { ClipSet, Animator, dir8Weights, aimMaskStep } from "./motion/anim-runtime.js";
111
+
112
+ const set = await (await fetch("./motion-sets/rifle.json")).json(); // copy sets where your bundler serves them
113
+ const rig = await loadRig("./assets/character.glb", set, modelFrame); // GLB or VRM — auto-detected
114
+ rig.computeCorrection();
115
+ const restAnkle = captureRestAnkle(rig, scene); // BIND pose, before any clip
116
+ reanchorFeet(rig, set, scene); // steep-boot fix — BEFORE ClipSet
117
+ const clipSet = new ClipSet(rig, set, set.gaits);
118
+ groundCalibrate(rig, clipSet, scene, restAnkle); // short-leg fix — AFTER ClipSet
119
+ curlFingers(rig, scene); // grips (no-op on finger-less rigs)
120
+ const anim = new Animator(clipSet);
121
+
122
+ // per frame: your input → blend weights; the mask follows the COMMAND magnitude
123
+ anim.setLoops({ idle: 1 - mag, ...dir8Weights(x, z, mag) }, dt);
124
+ maskW = aimMaskStep(maskW, { mag, grounded, pitch, dt });
125
+ anim.setMask("aim0", maskW, pitch / 0.6); // ±40° at pitch extremes
126
+ anim.update(dt);
127
+ ```
128
+
129
+ - Physics owns the world transform: hips play LOCAL values only (residual
130
+ x/z + absolute y); your character root carries position + yaw.
131
+ - Jumps: `anim.playOneShot("jumpRun", { yCap: 0.1 })` — cap hips Y when the
132
+ physics capsule owns the jump, and gate the impulse on the clip's own
133
+ takeoff frame. The `--set rifle` install includes the shared jumps set;
134
+ merge it: `Object.assign(clipSet.tracks, new ClipSet(rig, jumps, jumps.gaits).tracks)`.
135
+ - The aim mask WINS over one-shots on masked bones — a jump keeps aiming.
136
+ - Standing aim = the UNMASKED bladed idle; the spine-yawed mask pose is only
137
+ for moving/airborne/pitched states. `aimMaskStep` already encodes this.
138
+
139
+ ## Cost + discipline
140
+
141
+ Per-take billing (a 4-take request ≈ one model generation). One regenerate
142
+ per verb is a fair budget when takes fail the gates — reword with the ladder
143
+ above before spending again, and compare candidates from ONE batch first
144
+ (that is what `--takes 4` is for). Never re-run `motion gen` to "pick up" a
145
+ result — `genex wait <id>` re-attaches free.
@@ -34,11 +34,15 @@ Never claim a capability you didn't find, and never stall because one is
34
34
  missing.
35
35
 
36
36
  One more thing to note while you're looking: your platform may bundle its own
37
- image / video / site generation workflows. **They are not part of any Genex
38
- lane.** All generated art, audio, video, characters, and UI come from `genex`
39
- commands, unless the player explicitly asks for another tool by name — and a
40
- local reference image is never a reason to switch tools: `genex image --edit`
41
- and `--inpaint` take a local file path directly.
37
+ image / video generation workflows AND its own site-building / hosting /
38
+ deploy skills. **None of them are part of any Genex lane — don't load them
39
+ for this project.** All generated art, audio, video, characters, and UI come
40
+ from `genex` commands, unless the player explicitly asks for another tool by
41
+ name and a local reference image is never a reason to switch tools:
42
+ `genex image --edit` and `--inpaint` take a local file path directly. The
43
+ same exclusivity covers shipping: the game builds, previews, and publishes
44
+ only through `genex preview` / `genex publish` — a platform hosting skill in
45
+ context is pure confusion fuel.
42
46
 
43
47
  ## 2. Scope check — what is this?
44
48
 
@@ -80,14 +84,22 @@ DESIGN.md → Decisions as "assumed — player didn't answer"; the build never
80
84
  stalls on the interview.
81
85
 
82
86
  Then, before rendering code, write `DESIGN.md` at the project root from
83
- [references/design-contract.md](references/design-contract.md). The moment
84
- the file lands, post a 5–6 line summary of the contract in chat — pitch,
85
- core loop, content counts, screens, multiplayer shape, what you build
86
- first and keep building immediately: the summary is information, not a
87
- gate (the plan-message duties from `$genex-threejs-game-ui` fold into this
88
- file plus that summary). The file is the single source of truth:
89
- sub-agents build against it, and after any long break it is how work resumes.
90
- Keep it current decisions land in its log the moment they're made.
87
+ [references/design-contract.md](references/design-contract.md) including
88
+ its **Build plan & status** section: numbered milestones, a status mark per
89
+ line, and a `Now:` line naming the current one. While drafting it, make the
90
+ parallel call per module (dependencies decide see §6) and write each call
91
+ into the Modules table with its one-line reason. The moment the file lands,
92
+ post a 5–6 line summary of the contract in chat pitch, core loop, content
93
+ counts, screens, multiplayer shape, what you build first **and say in one
94
+ plain line that the plan is locked in and lives in `DESIGN.md`** (the player
95
+ must never have to wonder whether the contract happened). Then keep building
96
+ immediately: the summary is information, not a gate (the plan-message duties
97
+ from `$genex-threejs-game-ui` fold into this file plus that summary). The
98
+ file is the single source of truth: sub-agents build against it, after any
99
+ long break or context compaction work resumes from its `Now:` line, and a
100
+ milestone flips to done only when its work reached a preview
101
+ (`→ previewed`). Keep it current — decisions land in its log the moment
102
+ they're made.
91
103
 
92
104
  ## 4. Know your teams — what we can generate
93
105
 
@@ -257,11 +269,21 @@ in DESIGN.md):
257
269
  ## 6. Delegate — sub-agents own Modules rows
258
270
 
259
271
  If your environment has sub-agents, delegation is the DEFAULT for every
260
- independent DESIGN.md Modules row — not a big-game special case. If it
261
- doesn't, run the same rows yourself in order; the `--no-wait` generation
262
- pattern still hides most latency. Either way this skill is worn by the main
263
- agent: you stay the director.
264
-
272
+ independent DESIGN.md Modules row — not a big-game special case. The build
273
+ contract in the game's `AGENTS.md` is your standing authorization to spawn
274
+ them; some platforms keep sub-agents locked until an instruction like it
275
+ explicitly asks. If your environment has none, run the same rows yourself in
276
+ order; the `--no-wait` generation pattern still hides most latency. Either
277
+ way this skill is worn by the main agent: you stay the director.
278
+
279
+ - **Which rows run in parallel is YOUR per-game call, made while drafting
280
+ the plan** — there is no fixed list. Walk the modules once: what has no
281
+ dependency on unfinished work runs in parallel; what must be tuned against
282
+ something still moving stays serial. The same module lands differently in
283
+ different games (an arena is a parallel row in a quest game and the serial
284
+ spine of a combat game whose feel depends on its gaps). Write the call +
285
+ one-line reason into each row; building everything serially needs a
286
+ stated reason.
265
287
  - One row = one worker = one disjoint file set. One writer per file — that
266
288
  rule is anti-collision, never a reason to serialize work.
267
289
  - You stay the integrator and the only writer of shared files (boot, main
@@ -11,12 +11,25 @@ Rules the director enforces about this file:
11
11
 
12
12
  - Create it right after the scope check, before the concept generation; fill
13
13
  sections as decisions land and keep it current (stale is worse than short).
14
- - **The Modules table is the delegation contract**: one row per independent
15
- lane, and a row's "Owns files" set never overlaps another row's. One writer
16
- per file. "Sub-agent when available" stays flexiblebut if a
17
- planned-sub-agent module gets built inline, the agent says why in one line.
18
- Verification is never a module row: the milestone smoke pass belongs to the
19
- director (the scaffold prompt owns its ceilings).
14
+ - **The Build plan & status section is the compass.** Numbered milestones,
15
+ each with a status mark, and a `Now:` line naming the current one. Update
16
+ it the moment a milestone starts or finishes a milestone is done only
17
+ when its work reached a `genex preview` (mark it `→ previewed`). After any
18
+ context compaction or session resume, this section not memory says
19
+ where the build is; continue from `Now:`. When the plan first lands, tell
20
+ the player in one plain line that it's locked in and lives in `DESIGN.md`.
21
+ - **The Modules table is the delegation contract, and "Built by" is a
22
+ per-game DECISION, not a default you copy.** While drafting the plan, walk
23
+ the modules once and decide what can run in parallel and what must stay
24
+ serial for THIS game — dependencies decide (an arena can be a parallel row
25
+ in one game and the serial spine of another). Write the call into each row
26
+ with a one-line reason. When your platform has sub-agents, independent
27
+ modules default to parallel; building everything serially needs a stated
28
+ reason. One row per independent lane, and a row's "Owns files" set never
29
+ overlaps another row's — one writer per file. If a planned-parallel module
30
+ gets built inline, say why in one line. Verification is never a module
31
+ row: the milestone smoke pass belongs to the director (the scaffold prompt
32
+ owns its ceilings).
20
33
  - **The Assets table is the budget**: the asset list falls out of Content
21
34
  (enemies → models, an arena → a ground texture, outdoors → a skybox).
22
35
  Status flow per row: `proposed → planned → generating (id) → landed (URL) →
@@ -50,6 +63,14 @@ Concept image: <asset URL> (standing — shown <date>; player said
50
63
  - **You earn:** <reward / progression>
51
64
  - **You lose when:** <fail state> → **and retry by:** <restart shape>
52
65
 
66
+ ## Build plan & status
67
+ Now: ▶ <number + name of the milestone in progress>
68
+ 1. <milestone> — ✅ → previewed
69
+ 2. <milestone> — ▶ in progress (<who: main agent | sub-agent>)
70
+ 3. <milestone> — ⬜ (<parallel: sub-agent | serial: main agent — one-line why>)
71
+ (One line per milestone; update on every start/finish; done requires its
72
+ preview. This section is the post-compaction compass — resume from `Now:`.)
73
+
53
74
  ## Content (only when the request names plural content or a content genre)
54
75
  Every plural noun from the request becomes a countable line:
55
76
  - Quests: <N>, chained by <how>
@@ -99,13 +120,15 @@ teams, backfill…)> — and why. Play-button rule: nothing connects before the
99
120
  click (when a Play screen exists).
100
121
 
101
122
  ## Modules — the build split
123
+ ("Built by" is decided per game while drafting the plan — dependencies
124
+ decide, with a one-line reason per row; the rows below are only a SHAPE.)
102
125
  | Module | Owns files | Built by | Done when |
103
126
  |---|---|---|---|
104
- | Boot & identity | src/main.ts, src/genex-boot.ts | main agent (only writer) | boots, tier wired, initEmbed runs |
105
- | World/terrain | src/world/** | sub-agent when available | walkable, matches World & scale |
106
- | Quests & dialogue data | src/content/** | sub-agent when available | counts match Content lines |
107
- | Enemies/AI | src/enemies/** | sub-agent when available | roster matches Content |
108
- | HUD chain (style-dependent) | src/ui/** | sub-agent on concept landing | all screens from Screens & UI |
127
+ | Boot & identity | src/main.ts, src/genex-boot.ts | main agent (only writer of shared boot) | boots, tier wired, initEmbed runs |
128
+ | World/terrain | src/world/** | parallel: sub-agent (no dependency on combat) | walkable, matches World & scale |
129
+ | Quests & dialogue data | src/content/** | parallel: sub-agent (pure data) | counts match Content lines |
130
+ | Enemies/AI | src/enemies/** | serial: main agent (tuned against movement feel) | roster matches Content |
131
+ | HUD chain (style-dependent) | src/ui/** | parallel: sub-agent on concept landing | all screens from Screens & UI |
109
132
 
110
133
  ## Decisions & changes
111
134
  - <date> — <one-liner per decision, including anything the player said no or
@@ -133,6 +156,15 @@ Concept image: https://assets.genex.technology/g/rustyard/concept.png
133
156
  - **You lose when:** your bot breaks → **and retry by:** one key, instant
134
157
  respawn, same round
135
158
 
159
+ ## Build plan & status
160
+ Now: ▶ 3. Rival AI feels dangerous
161
+ 1. Arena skeleton + movement — ✅ → previewed
162
+ 2. Shooting + scrap scoring — ✅ → previewed
163
+ 3. Rival AI feels dangerous — ▶ main agent
164
+ 4. HUD sprite swap — ⬜ parallel: sub-agent (concept landed, chain enqueued)
165
+ 5. Magnet cycle + pickups — ⬜ parallel: sub-agent (own files, no AI dependency)
166
+ 6. Menus, music, publish floors — ⬜
167
+
136
168
  ## Screens & UI
137
169
  Screens: loader, title menu, HUD (health, scrap, cycle timer), pause,
138
170
  win/lose. Style brief: oily metal, warning-stripe accents, stencil type.
@@ -167,10 +199,10 @@ Single-player v1 (rivals are host-free local AI). Revisit after publish.
167
199
  ## Modules
168
200
  | Module | Owns files | Built by | Done when |
169
201
  |---|---|---|---|
170
- | Boot & identity | src/main.ts | main agent | boots, tier wired, initEmbed runs |
171
- | Arena & pickups | src/world/** | sub-agent | walkable, magnet cycle fires |
172
- | Rival AI | src/enemies/** | sub-agent | 3 rivals hunt + shoot |
173
- | HUD chain | src/ui/** | sub-agent after yes | all 5 screens live |
202
+ | Boot & identity | src/main.ts | main agent (shared boot) | boots, tier wired, initEmbed runs |
203
+ | Arena & pickups | src/world/** | parallel: sub-agent (independent of AI) | walkable, magnet cycle fires |
204
+ | Rival AI | src/enemies/** | serial: main agent (tuned vs player feel) | 3 rivals hunt + shoot |
205
+ | HUD chain | src/ui/** | parallel: sub-agent on concept landing | all 5 screens live |
174
206
 
175
207
  ## Decisions & changes
176
208
  - 2026-07-20 — player picked concept candidate 2; asked for "more sparks".
@@ -33,6 +33,10 @@ platforms, climbs stairs and slides on too-steep slopes out of the box.
33
33
  Use the VRM + UAL lane above by default. When the game needs a custom generated
34
34
  humanoid or an action unavailable in UAL, load `$genex-ai-character`, search
35
35
  Meshy's library first, and follow the reviewed image-first generation flow.
36
+ For a full custom LOCOMOTION SET beyond the UAL packs (a weapon-hold 8-way
37
+ shooter kit, a signature gait), see that skill's motion section: `npx genex
38
+ motion install --set rifle` drops the proven rifle set + its own runtime, and
39
+ `genex motion gen` builds new sets from text.
36
40
 
37
41
  Before generating a Meshy character, discuss two or three visual directions.
38
42
  When the user names a visual reference, inspect references before writing the
@@ -51,6 +51,11 @@ post-mixer limb corrections. Prompt the body UPRIGHT and unpropped (held
51
51
  props fuse into bodies); prompt "facing the viewer" but never trust it —
52
52
  facing is verified below.
53
53
 
54
+ When the catalog has no clip for a bespoke attack, telegraph, or death move
55
+ on a rigged biped, `genex motion` can generate one from text — see the motion
56
+ section of `$genex-ai-character` (its compiled sets retarget onto any
57
+ humanoid rig, unlike catalog clips).
58
+
54
59
  ### State → clip wiring (one mixer per creature)
55
60
 
56
61
  ```ts
@@ -8,6 +8,12 @@ description: Build procedural animation systems for Genex Three.js games. Use fo
8
8
  Animate semantic state, not unrelated transform curves. Define phases,
9
9
  coordinate frames, velocities, and ownership before writing per-frame updates.
10
10
 
11
+ Boundary: procedural animation owns held-object and analytic motion (arcs,
12
+ springs, docking, debris). WHOLE-BODY character verbs (a gait, a weapon
13
+ hold, a signature move) belong to the character lane — the catalog first,
14
+ then `genex motion` for verbs it lacks; see the motion section of
15
+ `$genex-ai-character`.
16
+
11
17
  ## Build order
12
18
 
13
19
  1. Define the timeline phases and event boundaries.