# `helix character check` — judge an avatar before it is published

An avatar used to be judged in only one place: the hosted visual-QA gate, which needs an `itemId`, so every attempt on a
new avatar cost a sealed, immutable Package Version. The Cream Hoodie Anime Girl shipped broken through exactly that loop:
forearms inside the hoodie, the side torn open, the back hair a rigid slab, a stray strand, the head pitched, reported
"good" by lanes that looked at front views and by a gate that read one frozen frame. `character check` runs the gate's own
measures, plus the ones it never made, on a **bare GLB**, locally, for free, and writes a tool-owned set of photographs
next to the same frames of Base Female.

```
helix character check <avatar.glb> [--out <dir>] [--json] [--no-inspection] [--no-control-cache]
                                   [--host-item <id>] [--control-item <id>] [--chrome <path>] [--api-url <u>] [--web-url <u>]
```

Exit `0` every blocking assert passed — **a floor, not a quality verdict** (verdict `pass`, or `warn`, see below) · `1` a
blocking assert failed (each failure prints its measured value and the next step) · `2` could not measure (never a pass). No login, no item id, no LIX, nothing is
uploaded. It needs network: the production Marketplace viewer, the platform's clips and its DynamicsLayer. About 80 s once
the Base Female control is cached, about 2.5 min the first time.

Output (`--out`, default `<glb dir>/<name>.check`):

| file | what |
|---|---|
| `inspection/index.json` | the sheets in reading order: `file`, `title`, and one `look` question each, plus the asserts and a note that a pass is a floor |
| `inspection/NN-<id>.jpg` | the contact sheets: the avatar on the left, Base Female on the right, same clip, same phase, same camera |
| `numbers.json` | every measure of every motion (and the control's), the clip hashes, the host, the browser/adapter and the timings |
| `check.json` | the verdict, every assert (`pass`, `severity`, `detail`, `measured`), the failures with their next steps |
| `frames/` | the individual tiles |

## How it is drawn: the production Marketplace viewer, not a re-implementation

The avatar has to move exactly as the product moves it: the platform's shared clips retargeted onto the avatar's skeleton by the
production retargeter, with the platform `DynamicsLayer` driving any hair/cloth chains. The check does not re-implement
either. It loads the **production Marketplace item page** (`/items/<id>`, `new.helixgame.com`) of a published avatar headless
and answers that page's model request with the candidate (`host.ts`):

1. the page resolves the host's Package, fetches the model by content hash from the CDN and SHA-256-verifies it against the
   host's manifest and byte count;
2. the candidate is padded to **exactly the host rendition's byte length** with one trailing unknown-type GLB chunk (glTF 2.0
   loaders must ignore unknown chunks) and the page's digest of those bytes is mapped to the host's hash — the mechanism
   `HELIX_VQA_FIXTURE_MODEL` already uses to prove the hosted gate fails on a broken fixture;
3. nothing is uploaded and nothing is written to the backend. The host is the smallest published avatar whose rendition can
   carry the candidate (the page re-derives the manifest's CID itself, so the byte count cannot move). **A GLB larger than the
   biggest host (about 10 MB) is refused with exit 2 and the advice to re-import with a smaller `--tex-size`.**

The same page-side probe the hosted gate uses (`visualQa/avatarPreviewProbe.ts`, unchanged) holds the page's own
`AnimationMixer` at 16 phases of the clip and reads the posed mesh and skeleton. Because the walk goes through the gate's own
page and the gate's own math (`visualQa/avatarPreviewMath.ts`, thresholds untouched: the backend re-derives the hosted
verdict from them), **the walk numbers are the hosted gate's numbers**: Cream Hoodie 1.0.6 reads 18.0 % arms-inside (peak
25.9 % at phase 15, 9.9 cm deep), a 35.9 cm hole at phase 6 and upper arms bound at 15.2 / 13 deg, byte for byte what the hosted
run recorded.

Why not the other options (measured, not assumed):

| option | verdict |
|---|---|
| offline production retargeter (`avatar-animations.ts` transpiled with esbuild + the downloaded `addons.js`) | needs the website's source tree (not in the npm package) or a vendored copy that drifts; re-implements the page's grounding, display scaling and dynamics stepping |
| the engine's own character runtime (Try Now with a proxy avatar, as `vehicle preview` does) | needs a signed-in QA account and a room, and judges by the engine's local-rotation clips, which the Marketplace retargeter's world-space delta hides: a different artifact from what a buyer sees. It remains the hosted gate's stage 1 |
| **the production Marketplace page with a CID-verified model swap** | deterministic (the same bytes in give the same numbers: 3 of 3 runs identical), no login, no itemId, the exact path buyers and the hosted gate use |

### The three clips

| motion | clip | source |
|---|---|---|
| walk | `/anims/walk.glb` | the page's own, byte-identical (`sha256 b7fac49d…`) to the engine's `locomotion.walk` |
| run | `locomotion.run` | the **engine's in-world run** from the humanoid-character asset pack (resolved from the platform, checksum-verified against the pack's own manifest), served in the walk's place so the page's own retargeter and DynamicsLayer play it. The Marketplace's own `/anims/run.glb` is a different clip (Mixamo `M_Run_001`) that nobody plays in a world |
| idle | `locomotion.idle` | the engine's in-world idle, the same way |

The clip hashes and the asset-pack version are in `numbers.json` (`clips`, `engineClips`); the control cache is keyed on them.
The engine applies these clips as absolute local rotations on the canonical skeleton while the page applies the same clip as a
world-space delta onto the avatar's bind; for a conformed `helix-humanoid@1` avatar the two agree, and where they could not
(a bone whose rest roll disagrees with the canonical frame) `avatar.rest_frames` below reads the bone frames directly.

## What it judges

Every assert has a stable id, a measured value and a next step. Blocking unless stated.

| assert | what | threshold |
|---|---|---|
| `avatar.bind_pose` | each upper arm bound far enough from straight down; other bones vs Base Female's bind | the gate's: 17 deg (Base Female 36); spine 30, neck 35, … |
| `avatar.preview.arms_clear` | forearm/hand surface >= 3 cm inside torso/hips, mean over the 16 walk phases | the gate's: <= 13 % |
| `avatar.preview.surface_closed` | two sides of a hole that touch at rest part by more than 5 cm | the gate's |
| `avatar.preview.silhouette` | hair/cloth standing off the torso outline | the gate's: 35 cm at 1.70 m |
| `avatar.preview.posture` | neck/torso lean vs Base Female's walk | the gate's: 25 / 15 deg |
| `avatar.mesh.no_strands` | a detached thin fragment floating clear of every surface | the gate's |
| `avatar.grounded` | the lowest rest vertex vs the skeleton root's ground plane | the gate's idle limits (-0.08..+0.12 m). The walk half of the hosted assert is not reproducible here: the viewer re-grounds the avatar once at load |
| `avatar.limbs_untwisted` | each limb bone's twist about its own axis over the walk; a limb bone no vertex is weighted to fails | the gate's: thigh 55, calf 50, foot 55, upper arm 55, forearm 50 deg; knees bend forward |
| `avatar.skin_intact` | collapsed / stretched triangles and 3x-stretched edges over the walk | the gate's: 3 % and 1.5 % of the surface |
| `avatar.no_emissive_washout` | a flat emissive colour with no emissive map over > 25 % of the triangles (read from the GLB's own materials) | the gate's |
| `avatar.materials_resolved` | every drawn primitive has a material, every map it samples decoded, declared textures reached the renderer | the gate's |
| `avatar.feet_intact`, `avatar.run.feet_intact` | the feet's OWN surface: the share of the triangles the feet/shoes own (dominant bone `foot_*` / `ball_*`) with an edge stretched over 3x, at its worst phase of the walk and of the run. The gate's `skin_intact` is a share of the whole surface, so a pair of shoes torn into spikes (3 % of a body) reads under its limit and only the vision critic sees it (a01 sweater girl: 0.9 % local, hosted math pass, critic fail) | 10 % of the feet's area. Good: 14 eval/published avatars and Base Female <= 0.3 %, 6 fresh imports <= 0.9 %; torn: 47-51 % (a01 gen 1), 60-66 % (gen 2). A region is judged from 4 triangles up (a low-poly avatar's page mesh can have 8 foot triangles; the detail then says one triangle is 12.5 % of them); under 4 it is `not measured`, which is never a pass |
| `avatar.preview.hand_hip_clearance`, `avatar.run.hand_hip_clearance` | **warn only.** The closest a hand vertex comes to the hip through the cycle, as a signed lateral clearance to the torso/hip outline (negative = inside the body), beside Base Female's on the same clip (`numbers.json` -> `walk.handClearance`, `run.handClearance`). Robots and puppets pass the gate with their hands on the hip, so it never blocks | warns when more than 4 cm deeper than the control |
| `avatar.rest_frames` | bone frames within 100 deg of the canonical `helix-humanoid@1` rest frames (the importer's own guard, `restFrameGuard.ts`) | the importer's |
| `avatar.run.*`, `avatar.idle.*` | arms_clear, surface_closed, silhouette, posture (vs Base Female on the **same clip**), and skin_intact at the run | calibrated below; a measure that does not separate good from broken is reported (`warn`) and left to its sheet |
| `avatar.inspection.complete` | every inspection frame rendered | a hole is exit 2, never a pass |

### Local against hosted: what is the same and what cannot be

The walk asserts are the hosted gate's own math on the hosted gate's own page (above). Two things the hosted run makes are not
reproduced and are named here so a local pass is not read as a hosted pass:

- the **vision critic**. It saw what the math missed twice in r1: the sweater girl's loafers (`render.intact`, `avatar.skinning`,
  `avatar.rig_distortion`: "torn into jagged, stretched spikes") on a version whose `skin_intact` read 0.9 %. Where a critic finding has
  a measurable cause, the check measures it itself (`avatar.feet_intact` above), over the feet's own surface instead of the whole body's,
  so the local check is **at least as strict as the hosted math on that cause**. It is never looser. What no measure covers (likeness,
  taste, a cape slit at the run) stays a LOOK item on the sheets;
- Try Now's `avatar.locomotes` / `faces_forward` / `height_matches_body`, and the hosted stage 1's seven live samples of the engine walk
  (the check reads 16 held phases of the same walk and 16 of the run instead, which contain every one of them).

Not part of the local gate (the hosted gate still makes them): `avatar.colour_matches_albedo` (needs a lit-versus-albedo
re-render of the page), the Try Now `avatar.locomotes` / `faces_forward` / `height_matches_body` warnings, and the hosted
vision critic. A local pass says nothing about them.

## The fixed inspection set

Never agent-chosen angles. Each sheet is a grid of pairs `avatar | Base Female`, one question on top (`inspection/index.json`
carries the same question as `look`). Walk phases: left arm furthest back, right arm furthest back (the gate's own), and
mid-stride a quarter cycle on.

| sheet | frames | question |
|---|---|---|
| `walk-left`, `walk-right` | true left / true right at the three phases | forearm or hand inside torso/hips? torn surface? hair along the back or a slab? strand? |
| `walk-front`, `walk-front34` | front, front 3/4 | daylight between arm and torso? head level? smooth sleeves, hem, knees? |
| `walk-back34`, `walk-back` | back 3/4 (its right), back | hair along the back? floating fragment? back of head and neck attached? nothing see-through between sleeve and torso? |
| `run-left`, `run-back` | the engine run, true left and back, three phases | the same, plus: does anything smear or stretch that did not at the walk? |
| `idle-turnaround` | eight sides at idle | clean silhouette from every side? |
| `closeup-head`, `closeup-hands`, `closeup-feet` | head (idle), forearms and hands (both walk back-swings), feet (mid-stride) | one clean piece? five fingers? shoes intact and pointing forward? |

**Read every sheet.** Open them in `index.json` order, answer each `look` from the image alone against the Base Female beside it,
and fix what looks wrong before publishing. A pass prints that it is a floor.

## Exit 1: what a failure looks like

```
FAIL avatar.bind_pose
  measured: upperarmAbductionDeg={"upperarm_l":15.2,"upperarm_r":13}
  bind pose: upperarm_l is bound 15.2 deg from the body (standard 36, minimum 17): …
  next: arms bound at 13° (standard 36°, minimum 17°): re-import so the arms are re-bound to the canonical A-pose (arm-bind
        normalisation in `helix character import`) — never hand-cut triangles or tweak weights by hand
```

## Block and warn

The verdict has the hosted gate's four words: `pass`, `warn`, `fail`, `error`. A `warn` is **exit 0** (deliberately: every
script and MCP that treats a nonzero exit as a stop keeps working) and means *no blocking assert failed and nothing could not
be measured, but a generator-limit defect was measured*; the hosted gate would release this avatar **privately** to its owner
with the same warnings.

- **Warn**: a failing assert that is warn-severity, or in the mirrored `AVATAR_WARN_ASSERTS` table
  (`src/visualQa/avatarSeverity.ts`, from the backend's `visual-qa.severity.ts`): today only `wear.walk.no_poke_through`
  (minor cloth poke-through). The thresholds and asserts themselves are unchanged.
- **Block** (`fail`, exit 1): any other failing blocking assert: arms or limbs in the body, a torn surface, a bind pose, a
  washout, missing textures, a detached part, not grounded, a limb twist or skin tear, wrong scale.
- **Error** (exit 2): a blocking assert that could not be measured, a harness error or a hole in the inspection set. A
  warning never turns an error into a warn.

`check.json` / `--json` gain, in the server's shape:

```json
{ "verdict": "warn", "exitCode": 0,
  "warnings": [{ "id": "wear.walk.no_poke_through", "summary": "…", "fixHint": "Loose cloth passes through the legs as they move. …", "source": "measured", "checks": ["wear.walk.no_poke_through"] }],
  "blockers": [] }
```

`blockers` lists every failing or unmeasured blocking assert (and harness error) the same way, with the server's fix hint
for the assert (`failing[].next` keeps the longer local remedy). The inspection index (`helix.avatar-inspection/1`) carries the
same `verdict`. The text report ends `result: WARN (exit 0): released privately would carry N warning(s); nothing blocks` and
lists each warning with its fix. Like a pass, a warn is a floor: open the sheets.

## The control, and the cache

Base Female (the gate's own control) is rendered through the same page on the same clips, and the candidate's posture at the
run and idle is judged relative to hers. Her reads and tiles are cached in `~/.helix/cache/avatar-check/<key>/` (override with
`HELIX_AVATAR_CHECK_CACHE`), keyed on her model hash, the three clip hashes and the framing revision; `--no-control-cache`
renders her again. Each page runs in its own throwaway Chromium profile: the viewer keeps downloaded models in a store keyed by the
host's hash, so a reused profile would show the previous page's bytes.

## Headless, portable

Chromium is launched through the visual-QA harness (`visualQa/browser.ts`): always headless, its own `--user-data-dir`,
`--use-mock-keychain --password-store=basic`, the pinned Chrome for Testing (the macOS system Chrome is refused), SwiftShader
on Linux, the WSL Windows-Chrome route on VRPC. The browser cap of the machine is shared: one check runs one browser at a time.

## Calibration

### Walk: identical to the hosted gate

The walk is the hosted gate's stage 2 run through the same page and the same math, so its numbers are the gate's. Measured on this
machine for the eval set (`scripts/avatar-check-eval.mjs`), against the hosted gate's own recorded verdict for the same entries
(`run/evidence/avatar-gate-v3/eval/after/summary.json`, 3 runs per entry):

| | local pass | local fail | local could not measure |
|---|---|---|---|
| hosted pass (15 good entries with a GLB) | 15 | 0 | 0 |
| hosted fail (11 bad entries with a GLB) | 0 | 11 | 0 |

26 of 29 manifest entries have a GLB on disk; `bfgloves` is a glove add-on (the hosted gate exempts it, it is not an avatar) and the
two original "Cream Hoodie Girl" items (`f1588a10`, `32fda6b7`) have no Continuum pin, so no model can be resolved for them
(the hosted gate fails them as "not measured"). The hosted run counts each entry 3 times (45 good / 39 bad runs); the local check is
deterministic, so it runs each once. Agreement 26/26. The failing blocking asserts match the hosted gate's for every entry that
failed there (Cream Hoodie 1.0.6: `arms_clear` 18.0 %, `surface_closed` 35.9 cm, `bind_pose` 15.2 / 13 deg).

### Run and idle: calibrated here, blocking only where it separates

Each measure is the gate's own, made on the engine's run and idle, over the 15 good entries (Base Female and Base Male are the
controls) and the 11 bad ones. A measure **blocks** only where the worst good entry and the best broken one are separated with a margin;
elsewhere it is **reported** (`warn`) and is a LOOK item on the run sheets instead. `src/character/check/motionJudge.ts` holds the limits.

| measure | clip | worst good | best broken | limit | blocks? |
|---|---|---|---|---|---|
| arms inside the body (mean share) | run | 0.041 (Starfish; peak 0.121) | 0.119 (arms-low), 0.124 (hoodie 1.0.6) | 0.08 | yes |
| | idle | 0.142 (Pastel Cyberpunk, arms bound at 20 deg) | 0.165 (hoodie 1.0.6), 0.268 (arms-low) | 0.15 | **no**: a 9 % margin is a guess; reported. `bind_pose` and the walk already block the cause |
| hole opening (cm) | run | 4.0 (Iron Man) | 48.6 (hoodie 1.0.6) | 10 | yes |
| | idle | 2.4 (Iron Man) | 30.3 (hoodie 1.0.6) | 10 | yes |
| silhouette, hair/cloth off the torso (cm at 1.70 m) | run | 27.4 (Kemonomimi cape) | 70.1 (slab fixture) | 35 | yes |
| | idle | 20.9 (Kemonomimi cape) | 82.7 (slab fixture) | 35 | yes |
| neck lean vs Base Female, same clip | run | -51.3 (Brass: the run clip drives its neck differently) .. +11.7 | +42.3 (head-forward fixture) | 25 | **no**: not separable on the run; reported |
| | idle | -11.9 .. +11.7 | +42.5 (head-forward fixture) | 25 / torso 15 | yes |
| skin collapsed/stretched, 3x edges | run | 0.007 / 0.002 (Cream Hoodie 1.0.8) | 0.053 (collapse), 0.037 edges (bad weights) | the gate's 0.03 / 0.015 | yes |

Cream Hoodie 1.0.8 (the fixed avatar the gate passed) reads, at the run, arms 0.000, no hole, silhouette 5.6 cm; at the idle
0.0 / 0 / 3.6 cm: it passes everything here.

Silhouette on short, head-weighted bodies (2026-10-10, re-judged offline from the recorded walks): a cardboard-box mascot (1.20 m, body
weighted to the clavicles, no spine vertices, head box wider than the body) read "hair 90.2 cm out beside the torso" at one walk phase on
a CLI built before #447 (torso outline from its vertices, display-space poses scaled as if they were metres). With the cross-section
outline of #447 the same recorded walk reads 0 cm in every band (the head sits 94 cm inside the torso's outline); the real defects keep
failing on the same math: Miku v2 / v3 walk 48.1 / 45.6 cm (old math 95.5 / 85.8), the Base Male slab 49.5 cm (old 84), and Miku v1
passes at 28.9 cm. No body-relative rule was needed: the false positive was the stale outline, not the limit.

### Negative fixtures: the check refuses what it claims to

| fixture | defect | blocking asserts that fail |
|---|---|---|
| Cream Hoodie 1.0.6 (the shipped broken one) | arms bound at 15 / 13 deg, torn side, loose hair | `avatar.preview.arms_clear`, `avatar.preview.surface_closed`, `avatar.bind_pose`, and at the run and idle `avatar.run.arms_clear`, `avatar.run.surface_closed`, `avatar.idle.surface_closed` |
| Base Male `arms-low` | upper arms re-bound 25 deg closer | `avatar.preview.arms_clear`, `avatar.bind_pose`, `avatar.run.arms_clear` |
| Base Male `head-forward` | neck pitched 40 deg | `avatar.preview.posture`, `avatar.bind_pose`, `avatar.idle.posture` |
| Base Male `strand` | a 30 cm thread behind the waist | `avatar.mesh.no_strands` |
| Base Male `slab` | a plate 45 cm off the back | `avatar.preview.silhouette` (+ run/idle silhouette) |
| Base Male `emissive` | flat white emissive over the body | `avatar.no_emissive_washout` |
| Base Male `brokentex` | textures bound but undecodable | `avatar.materials_resolved` |
| Base Male `twist`, `twist-arms` | limb bone rest roll disagrees with canonical | `avatar.rest_frames` (the walk reads these as clean, because the Marketplace retargeter works in world space: this is why the check also reads the bone frames) |
| Base Male `weights`, `collapse` | torn weights / collapsed triangles | `avatar.skin_intact`, `avatar.run.skin_intact` (+ `avatar.limbs_untwisted` for `weights`: its calf bone has no vertices) |
| Cream Hoodie 1.0.8, Base Female, Base Male, the 13 published avatars | none | pass |

Re-generate the matrix and the per-entry table with
`node scripts/avatar-check-eval.mjs --manifest <eval manifest.json> --out <dir> --hosted-summary <hosted summary.json>`
(the fixtures: `scripts/make-avatar-gate-fixtures.mjs`, `run/evidence/avatar-gate-v3/eval/fixtures`).

### Timing

Full run (numbers and the 12 inspection sheets, the Base Female control cached) of the 26 eval entries on a heavily loaded Mac
(load 25 to 60, Apple M4 Max): median 89 s, 67 to 183 s (the slowest was one run that waited on the machine's shared browser cap); the
first run of a day adds about 80 s to render and cache the control. On VRPC (WSL, SwiftShader on Linux, no GPU): about 8 min for
Cream Hoodie 1.0.6, with the same verdicts and the same numbers to the digit (18.0 % arms-inside, 35.9 cm hole). Per page: about 30 s
of boot, 5 to 6 s of reads per clip on the Mac (17 to 21 s on VRPC).

Evidence (matrix, per-entry table, check.json / numbers.json and the sheets of the hoodie pair and two fixtures, and the VRPC run):
`run/evidence/avatar-local-check-2026-10-07/`.

## Limits of this check, said plainly

- A local pass is **not** a gate result: no vision critic ran, and the hosted gate still judges `avatar.colour_matches_albedo`, the
  Try Now locomotion warnings and the critic's `walk_preview`. The check is how an agent finds the broken avatar before it has to
  seal a version to learn it.
- The walk's soles are not read (the viewer re-grounds the avatar once at load), only the rest mesh's.
- Dynamics (hair/cloth chains) are driven by the platform's DynamicsLayer, so a chain that is mis-authored shows in the
  sheets and in `silhouette`; there is no separate dynamics validator here.
- It cannot judge likeness to a reference, face channels, LODs at distance or the look under world lighting.
- The avatar must fit inside the largest published host rendition (about 10 MB); a larger GLB exits 2 with the advice to re-import
  smaller.
