agent-manifesto-kit 1.8.2 → 1.8.4

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 (56) hide show
  1. package/README.md +29 -2
  2. package/collection/bundles/game-dev/README.md +69 -0
  3. package/collection/bundles/game-dev/RECOMMENDS.md +24 -0
  4. package/collection/bundles/game-dev/agents/game-code-reviewer.md +36 -0
  5. package/collection/bundles/game-dev/agents/game-image-generator.md +34 -0
  6. package/collection/bundles/game-dev/agents/game-visual-reviewer.md +34 -0
  7. package/collection/bundles/game-dev/skills/game-code/SKILL.md +54 -0
  8. package/collection/bundles/game-dev/skills/game-code/agents/openai.yaml +4 -0
  9. package/collection/bundles/game-dev/skills/game-code/references/engine-godot.md +45 -0
  10. package/collection/bundles/game-dev/skills/game-code/references/engine-threejs.md +47 -0
  11. package/collection/bundles/game-dev/skills/game-delegation/SKILL.md +58 -0
  12. package/collection/bundles/game-dev/skills/game-delegation/agents/openai.yaml +4 -0
  13. package/collection/bundles/game-dev/skills/game-dev-setup/SKILL.md +103 -0
  14. package/collection/bundles/game-dev/skills/game-dev-setup/agents/openai.yaml +4 -0
  15. package/collection/bundles/game-dev/skills/game-dev-setup/assets/agents-section.md +20 -0
  16. package/collection/bundles/game-dev/skills/game-dev-setup/references/config.md +46 -0
  17. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/audit.py +202 -0
  18. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/balance.py +197 -0
  19. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/check.py +62 -0
  20. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/delegate.py +350 -0
  21. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/gamedev_config.py +163 -0
  22. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/install.py +172 -0
  23. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/instruction_size.py +75 -0
  24. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/prompts/code_review.md +19 -0
  25. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/prompts/image.md +5 -0
  26. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/prompts/visual_review.md +13 -0
  27. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/pyramid.py +84 -0
  28. package/collection/bundles/game-dev/skills/game-dev-setup/scripts/test_game_dev.py +309 -0
  29. package/collection/bundles/game-dev/skills/game-planning/SKILL.md +80 -0
  30. package/collection/bundles/game-dev/skills/game-planning/agents/openai.yaml +4 -0
  31. package/collection/bundles/game-dev/skills/game-testing/SKILL.md +58 -0
  32. package/collection/bundles/game-dev/skills/game-testing/agents/openai.yaml +4 -0
  33. package/collection/bundles/kit-adopt/conventions/recommended-companions.md +1 -1
  34. package/collection/skills/astro-preview/SKILL.md +97 -41
  35. package/collection/skills/astro-preview/references/manifest.md +42 -0
  36. package/collection/skills/astro-preview/scripts/portal.py +686 -0
  37. package/collection/skills/astro-preview/scripts/test_portal.py +576 -0
  38. package/collection/skills/concept-asset-builder/SKILL.md +14 -5
  39. package/collection/skills/concept-asset-builder/assets/templates/agent_brief.md +5 -2
  40. package/collection/skills/concept-asset-builder/references/field-lessons.md +9 -0
  41. package/collection/skills/concept-asset-builder/scripts/blender/render_views.py +4 -2
  42. package/collection/skills/concept-asset-builder/scripts/codex_review.sh +4 -1
  43. package/collection/skills/concept-asset-builder/scripts/godot/capture.gd +5 -2
  44. package/collection/skills/concept-asset-builder/scripts/init_workspace.sh +1 -1
  45. package/collection/skills/concept-asset-builder/scripts/measure_silhouette.py +18 -4
  46. package/collection/skills/concept-asset-builder/scripts/overlay_masks.py +25 -0
  47. package/collection/skills/concept-asset-builder/scripts/test_tools.py +44 -0
  48. package/collection/skills/concept-asset-builder/scripts/threejs/studio.js +4 -2
  49. package/collection/skills/concept-asset-builder/scripts/wear_stats.py +35 -1
  50. package/collection/skills/mixamo/SKILL.md +109 -0
  51. package/collection/skills/mixamo/agents/openai.yaml +4 -0
  52. package/collection/skills/mixamo/scripts/mixamo.py +264 -0
  53. package/collection/skills/mixamo/scripts/test_mixamo.py +108 -0
  54. package/collection/skills/sfx-creator/SKILL.md +160 -0
  55. package/collection/skills/sfx-creator/agents/openai.yaml +4 -0
  56. package/package.json +1 -1
@@ -16,7 +16,8 @@ pipeline; never touch its files or anything outside the workspace.
16
16
 
17
17
  ## Inputs (read only)
18
18
  - `reference/concept.png`, `reference/crops/{3q,front,back,left,right,detail}.png` — look at them at 2x.
19
- - `spec/object.json` — measured geometry, palette, cameras. It is a draft: if you find a clear error, do not edit it;
19
+ - `spec/object.json` — measured geometry, palette, cameras. Its `constraints` block holds the owner's hard numbers:
20
+ they always win over the sheet. The measured rest is a draft: if you find a clear error, do not edit the spec;
20
21
  log the deviation in `reviews/<PIPELINE>_decisions.md` and apply it in your code.
21
22
  - `brief/wear_description.md` — numeric target per zone, part and side (source of truth for the surface).
22
23
  - `brief/scene_style.md` — scene style rules (mandatory). `brief/rubric.json` — how the reviewer scores you.
@@ -43,7 +44,9 @@ Blender (x, -z, y)); finish with `studio.setup(SPEC); studio.save(ROOT, "object"
43
44
  ## Process
44
45
  1. Study the concept, spec, description, style. Write your plan into the report: parts, materials, how you do wear.
45
46
  2. Geometry (all edges rounded, nothing intersects or floats) → materials → wear → render 5 views → self-check
46
- (sheets, 2x close-ups of every part, measurements, IoU/ΔE).
47
+ (sheets, 2x close-ups of every part, `tools/overlay_masks.py` on your renders, measurements, IoU/ΔE).
48
+ Render what the 5 views cannot show (interior cutaways, sections, close-ups) to `out/<PIPELINE>/extra_*.png`;
49
+ the reviewer receives them.
47
50
  3. Keep `reviews/<PIPELINE>_decisions.md` up to date (the reviewer reads it).
48
51
  4. Review rounds 1..<N> with fixes after each; stop early at a weighted score ≥ <TARGET>. After the last round only
49
52
  obvious small fixes.
@@ -4,6 +4,7 @@
4
4
  - Post box, hand-iterated with the owner: silhouette IoU 0.84 → 0.96 after measuring; independent reviewer 4–6.5 → 7.5/10 over 3 rounds; the owner still found 7 issues per round for 3 more rounds, mostly wear.
5
5
  - Post box, agents + Codex reviewer, no owner: three.js 5 → 7, Blender 6 → 6.5 (reviewer v1, no rubric, no memory).
6
6
  - Vending machine from scratch through the conveyor (style file + reviewer v2): Blender 6.3 → 6.9 → 7.1 → 7.2, three.js 6.25 → 6.85 → 6.9 → 6.9; none of the pilot's owner complaints repeated. Shape 8–9, paint 8, parts 7–8, chips 6, drips 5–6.
7
+ - Two-storey shop (8 × 6 m, rooms inside), one Blender builder, ~2.5 h: 6.99 → 7.44 → 7.87, final 7.92; shape and interior 9, roof/shop front/openings/plaster 8, stains 6. Accepted by the owner without remarks.
7
8
 
8
9
  ## Measuring
9
10
  - Geometry measured from pixels beat eyeballing immediately (IoU 0.84–0.93 on the first build). The two corrections later were base height (a contact shadow is part of the silhouette) and body radius.
@@ -12,13 +13,21 @@
12
13
  - Silhouette masks must exclude the ground shadow (background scaled by a near-constant factor).
13
14
  - Colour statistics matching is not the look matching; the reviewer and close-ups decide.
14
15
 
16
+ - Wear darker than the surface (peeling plaster over a darker layer) was invisible to a "lighter than the paint" chip mask; with a median reference it caught only patch edges, because a third of the wall was peeled. A high-percentile reference in a ~1 m window fixed it; goods behind shop glazing read as "moss" until the glazing was excluded per view.
17
+ - Coverage saturates above ~40% of a local window: the builder could not raise the measured number further even when the eye said enough. Give ranges and trust the overlay.
18
+ - Back and side positions written in image coordinates mirrored a whole façade; measure in object coordinates per view.
19
+ - Owner constraints (8 × 6 m, 3 m floors) disagreed with the generated sheet (a floor seam at 3.45 m); without a separate constraints block the builder had to decide which to trust.
20
+
15
21
  ## Reviewers
16
22
  - Without a rubric and memory, the reviewer contradicted itself between rounds ("lips overloaded" → "lips too fresh") and gave the same score four times while major issues dropped from 9 to 6. A weighted rubric computed by a script + the previous review + the builder's decisions log fixed it: monotonic scores, no reversals.
17
23
  - A reviewer of the same model that also built the thing anchors on its intentions; use another model or a fresh context with only the inputs.
18
24
  - The reviewer trusts numbers it is given; give it only numbers you have validated by overlay.
19
25
  - The owner's eye still catches things the reviewer does not (mould on a hood, a too-white sign, a door that reads noisy, sharp three.js edges). Keep the owner checkpoint on the pilot and on wear.
20
26
 
27
+ - The reviewer can only judge what it sees: an interior got a 9 only because the builder rendered floor-plan cutaways and a section through the stair as extra images.
28
+
21
29
  ## Textures from image models
30
+ - A generated asset sheet drew peeling plaster as a regular diamond lattice: shape and layout were usable, the wear was a stamp. Name the scene concept as the wear reference.
22
31
  - Albedo textures from Codex image generation are good paint bases but bake in chips, moss, stains and "panel seams". One cap texture had 23% chips (concept ~8%) and was unusable. Clean with hue/lightness filters; never let the texture carry the wear.
23
32
  - Box-projected textures sample random parts of a texture: a cap's top faces sampled the mossy bottom band → "mould on the cap". Map each part to a clean band of the texture.
24
33
 
@@ -52,8 +52,10 @@ def fit(az_deg):
52
52
  d = 5.0
53
53
  for _ in range(6):
54
54
  place(az_deg, d)
55
- ys = [world_to_camera_view(scene, cam, c).y for c in corners]
56
- ext = max(ys) - min(ys)
55
+ pts = [world_to_camera_view(scene, cam, c) for c in corners]
56
+ ys = [q.y for q in pts]; xs = [q.x for q in pts]
57
+ # fit BOTH axes: a wide object (a building in 3/4) would otherwise leave the frame sideways
58
+ ext = max(max(ys) - min(ys), max(xs) - min(xs))
57
59
  d *= ext / fill
58
60
  place(az_deg, d)
59
61
  # centre vertically
@@ -30,6 +30,8 @@ for v, fr, n in (("front", (0.0, 0.0, 1.0, 0.5), "detail_front_top"), ("front",
30
30
  s = Image.new("RGB", (a.width + b.width + 16, max(a.height, b.height)), "black"); s.paste(a, (0, 0)); s.paste(b, (a.width + 16, 0))
31
31
  s.save(f"{base}_{n}.png")
32
32
  PY
33
+ # builder's extra renders (e.g. interior cutaways, close-ups) have no concept counterpart: attach them as they are
34
+ for f in "$ROOT/out/$PIPE"/extra_*.png; do [ -f "$f" ] && cp "$f" "$IMG/${TAG}_$(basename "$f")"; done
33
35
  STATS_C=$(python3 "$ROOT/tools/wear_stats.py" 2>/dev/null | sed -n '/^\[/,$p')
34
36
  STATS_R=$(python3 "$ROOT/tools/wear_stats.py" "$ROOT/out/$PIPE" 2>/dev/null | sed -n '/^\[/,$p')
35
37
  PREV_TXT="(none: first round)"; [ -f "$ROOT/reviews/${PIPE}_r${PREV}.md" ] && PREV_TXT=$(cat "$ROOT/reviews/${PIPE}_r${PREV}.md")
@@ -40,7 +42,8 @@ command codex exec -m "$MODEL" -c model_reasoning_effort=high --skip-git-repo-ch
40
42
  -C "$ROOT" "${IMGS[@]}" -o "$ROOT/reviews/${TAG}.md" > "$ROOT/reviews/${TAG}.log" 2>&1 <<PROMPT
41
43
  You are an independent art reviewer. Your only context is this message and the attached images.
42
44
  Images *_<view>.png: LEFT the reference concept, RIGHT a 3D render of the same object (views 3q, front, back, left, right).
43
- *_detail_*.png: 2x close-ups, LEFT concept, RIGHT render. Lighting and camera are fixed by the studio and NOT under review.
45
+ *_detail_*.png: 2x close-ups, LEFT concept, RIGHT render. *_extra_*.png (if any): the builder's extra renders
46
+ (interior cutaways, close-ups) with no concept counterpart; judge them against the description. Lighting and camera are fixed by the studio and NOT under review.
44
47
 
45
48
  OBJECT AND WEAR DESCRIPTION (source of truth, Russian):
46
49
  $(cat "$ROOT/brief/wear_description.md")
@@ -106,9 +106,12 @@ func _run() -> void:
106
106
  for i in 6:
107
107
  _place(az, el, d, target)
108
108
  var ys: Array = []
109
+ var xs: Array = []
109
110
  for p in corners:
110
- ys.append(cam.unproject_position(p).y)
111
- var ext: float = (ys.max() - ys.min()) / size.y
111
+ var q := cam.unproject_position(p)
112
+ ys.append(q.y); xs.append(q.x)
113
+ # fit BOTH axes: a wide object would otherwise leave the frame sideways
114
+ var ext: float = maxf((ys.max() - ys.min()) / size.y, (xs.max() - xs.min()) / size.x)
112
115
  d *= ext / fill
113
116
  _place(az, el, d, target)
114
117
  for i in 4:
@@ -6,7 +6,7 @@ SK="$(cd "$(dirname "$0")" && pwd)"
6
6
  W="$1"; C="$2"; STYLE="${3:-}"
7
7
  mkdir -p "$W"/{reference/crops,spec,brief,tools,blender,threejs,out,reviews,reports,textures}
8
8
  cp "$C" "$W/reference/concept.png"
9
- cp "$SK"/{metrics.py,sheet.py,wear_stats.py,codex_review.sh,gen_texture.sh,capture.mjs,crop.py,measure_silhouette.py,compare_to.py,composite_godot.py} "$W/tools/"
9
+ cp "$SK"/{metrics.py,sheet.py,wear_stats.py,overlay_masks.py,codex_review.sh,gen_texture.sh,capture.mjs,crop.py,measure_silhouette.py,compare_to.py,composite_godot.py} "$W/tools/"
10
10
  chmod +x "$W/tools/"*.sh
11
11
  cp "$SK/blender/"{studio.py,render_views.py,bake_export.py} "$W/blender/"
12
12
  cp "$SK/threejs/"{studio.js,index.html,model.js} "$W/threejs/"
@@ -4,7 +4,11 @@ Usage: python3 tools/measure_silhouette.py <view> --height <m> [--rows 24] [--da
4
4
  <view>: front|back|left|right|3q (reference/crops/<view>.png)
5
5
  Prints: silhouette bbox, metres per pixel, the width profile (row by row, metres from the ground),
6
6
  and the largest dark / bright components (openings, panels, glowing windows, buttons) in metres:
7
- height range from the ground and x range from the silhouette centre. Read them, then LOOK at the crop
7
+ height range from the ground and the horizontal range in OBJECT coordinates (spec convention: front +Z, +X to the
8
+ object's right as seen from the front): front -> x as in the image; back -> x mirrored (the image's left is +x);
9
+ left view (camera at -X, front on the image's right) -> z = image offset; right view -> z mirrored; 3q -> image
10
+ offset only (not an object axis). Writing back/side positions in image coordinates was a real bug (a mirrored
11
+ back façade). Read them, then LOOK at the crop
8
12
  and decide what each component is. Watch out: a contact shadow under the object belongs to the silhouette
9
13
  (subtract it from heights), and the top surface seen from the camera adds a little to the height.
10
14
  """
@@ -24,12 +28,21 @@ img = M.load(M.ROOT / f"reference/crops/{a.view}.png")
24
28
  m = M.mask_of(img)
25
29
  y0, y1, x0, x1 = M.bbox(m)
26
30
  mpp = a.height / (y1 - y0); cx = (x0 + x1) / 2
31
+ AXIS, SIGN = {"front": ("x", 1), "back": ("x", -1), "left": ("z", 1), "right": ("z", -1)}.get(a.view, ("image x", 1))
32
+
33
+
34
+ def span(p0, p1):
35
+ """image pixel range -> sorted object-axis range in metres"""
36
+ u0, u1 = SIGN * (p0 - cx) * mpp, SIGN * (p1 - cx) * mpp
37
+ return min(u0, u1), max(u0, u1)
27
38
  print(f"bbox y {y0}-{y1} x {x0}-{x1}; {mpp * 1000:.2f} mm/px; width {(x1 - x0) * mpp:.3f} m; aspect {(x1 - x0) / (y1 - y0):.3f}")
28
- print("width profile (height from ground m: width m, x-range from centre):")
39
+ print(f"view {a.view}: horizontal positions are {AXIS} in object coordinates" + ("" if AXIS != "image x" else " (3/4 view: image offset, not an object axis)"))
40
+ print("width profile (height from ground m: width m, range):")
29
41
  for y in np.linspace(y0, y1 - 1, a.rows).astype(int):
30
42
  r = np.where(m[y])[0]
31
43
  if len(r):
32
- print(f" {(y1 - y) * mpp:6.3f}: {(r.max() - r.min()) * mpp:.3f} [{(r.min() - cx) * mpp:+.3f}, {(r.max() - cx) * mpp:+.3f}]")
44
+ lo, hi = span(r.min(), r.max())
45
+ print(f" {(y1 - y) * mpp:6.3f}: {(r.max() - r.min()) * mpp:.3f} {AXIS} [{lo:+.3f}, {hi:+.3f}]")
33
46
  L = img.mean(2)
34
47
  for name, mask in (("dark", (L < a.dark) & m), ("bright", (img[..., 1] > a.bright) & (img[..., 2] > a.bright) & m)):
35
48
  lab, n = ndi.label(ndi.binary_closing(mask, iterations=2))
@@ -37,4 +50,5 @@ for name, mask in (("dark", (L < a.dark) & m), ("bright", (img[..., 1] > a.brigh
37
50
  key=lambda s: -(s[0].stop - s[0].start) * (s[1].stop - s[1].start))[:8]
38
51
  print(f"{name} components (largest first):")
39
52
  for s in comps:
40
- print(f" y {(y1 - s[0].stop) * mpp:.3f}-{(y1 - s[0].start) * mpp:.3f} m x {(s[1].start - cx) * mpp:+.3f}..{(s[1].stop - cx) * mpp:+.3f} m")
53
+ lo, hi = span(s[1].start, s[1].stop)
54
+ print(f" y {(y1 - s[0].stop) * mpp:.3f}-{(y1 - s[0].start) * mpp:.3f} m {AXIS} {lo:+.3f}..{hi:+.3f} m")
@@ -0,0 +1,25 @@
1
+ """Overlay the wear masks of tools/wear_stats.py on images: chips magenta, rust orange, grime green, excluded areas dimmed.
2
+ Usage: python3 tools/overlay_masks.py <out.png> [image_dir] [views] (default reference/crops, 3q,front,back,left)"""
3
+ import sys, pathlib
4
+ import numpy as np
5
+ from PIL import Image
6
+ HERE = pathlib.Path(__file__).resolve().parent
7
+ sys.path.insert(0, str(HERE))
8
+ import metrics as M
9
+ src_code = (HERE / "wear_stats.py").read_text().split("\nres = {}")[0]
10
+ src_code = src_code.replace('src = pathlib.Path(sys.argv[1]) if len(sys.argv) > 1 else ROOT / "reference/crops"', 'src = None')
11
+ ns = {"__file__": str(HERE / "wear_stats.py")}
12
+ exec(compile(src_code, "wear_stats", "exec"), ns)
13
+ out = sys.argv[1]
14
+ d = pathlib.Path(sys.argv[2]) if len(sys.argv) > 2 else M.ROOT / "reference/crops"
15
+ views = sys.argv[3].split(",") if len(sys.argv) > 3 else ["3q", "front", "back", "left"]
16
+ tiles = []
17
+ for v in views:
18
+ img = ns["normalise"](M.load(d / f"{v}.png")); sil = M.mask_of(img); y0, y1, x0, x1 = M.bbox(sil)
19
+ ns["VIEW"] = v; chip, rust, grime, keep = ns["masks"](img, ns["H"] / (y1 - y0), sil)
20
+ vis = img.copy(); vis[chip] = [255, 0, 200]; vis[rust] = [255, 140, 0]; vis[grime] = [0, 200, 0]
21
+ vis[~keep & sil] = vis[~keep & sil] * 0.4
22
+ tiles.append(Image.fromarray(np.concatenate([img, vis], 1).clip(0, 255).astype(np.uint8)))
23
+ W = sum(t.width for t in tiles) + 10 * (len(tiles) - 1); s = Image.new("RGB", (W, max(t.height for t in tiles)), "black"); x = 0
24
+ for t in tiles: s.paste(t, (x, 0)); x += t.width + 10
25
+ s.save(out); print(out, s.size)
@@ -50,6 +50,9 @@ class ToolsTest(unittest.TestCase):
50
50
  for x in range(x0 + 40, x0 + 52):
51
51
  for y in range(100, 116):
52
52
  px[x, y] = (226, 205, 176)
53
+ for x in range(x0 + 20, x0 + 35): # a dark opening left of the centre, for view-aware measurement
54
+ for y in range(60, 80):
55
+ px[x, y] = (40, 40, 40)
53
56
  self.boxes[v] = [x0, 20, x0 + 100, 260]
54
57
  self.concept = self.dir / "sheet.png"
55
58
  sheet.save(self.concept)
@@ -102,6 +105,47 @@ class ToolsTest(unittest.TestCase):
102
105
  self.assertGreater(res["front"]["all"]["chip_pct"], 0.5)
103
106
  self.assertEqual(res["front"]["all"]["chips"]["count"], 1)
104
107
 
108
+ def test_measure_silhouette_uses_object_coordinates_per_view(self):
109
+ def first_dark(view):
110
+ out = run(sys.executable, "-B", "tools/measure_silhouette.py", view, "--height", "2.0", cwd=self.ws).stdout
111
+ line = out.split("dark components")[1].splitlines()[1]
112
+ axis, rng = line.split("m")[1].split()[0], line.split()[-2]
113
+ return axis, float(rng.split("..")[0]), float(rng.split("..")[1])
114
+ # the opening sits left of the image centre: front -> -x, back -> +x (mirrored), left -> -z, right -> +z
115
+ ax, lo, hi = first_dark("front"); self.assertEqual(ax, "x"); self.assertLess(hi, 0)
116
+ ax, lo, hi = first_dark("back"); self.assertEqual(ax, "x"); self.assertGreater(lo, 0)
117
+ ax, lo, hi = first_dark("left"); self.assertEqual(ax, "z"); self.assertLess(hi, 0)
118
+ ax, lo, hi = first_dark("right"); self.assertEqual(ax, "z"); self.assertGreater(lo, 0)
119
+
120
+ @unittest.skipUnless(HAVE_SCIPY, "scipy is required")
121
+ def test_dark_mode_finds_peeling_and_exclusions_remove_it(self):
122
+ wall = Image.new("RGB", (100, 240), BG)
123
+ wp = wall.load()
124
+ for x in range(10, 90):
125
+ for y in range(40, 240):
126
+ wp[x, y] = (232, 200, 158) # light stucco
127
+ for x in range(25, 55):
128
+ for y in range(90, 140):
129
+ wp[x, y] = (196, 146, 100) # darker exposed plaster
130
+ wall.save(self.ws / "reference/crops/front.png")
131
+ zones = json.loads((self.ws / "reference/zones.json").read_text())
132
+ zones.update({"height_m": 2.0, "bands": {"all": [0.0, 2.0]},
133
+ "chip": {"mode": "dark", "dL": 8, "min_L": 50, "min_C": 15, "max_C": 60, "window_m": 0.8, "ref_pct": 80}})
134
+ (self.ws / "reference/zones.json").write_text(json.dumps(zones))
135
+ run(sys.executable, "-B", "tools/wear_stats.py", cwd=self.ws)
136
+ peel = json.loads((self.ws / "out/wear_stats_concept.json").read_text())["front"]["all"]["chip_pct"]
137
+ self.assertGreater(peel, 5.0) # the patch is ~9% of the wall
138
+ zones["exclude_rects"] = {"front": [[-1.0, 1.0, 0.0, 2.0]]}
139
+ (self.ws / "reference/zones.json").write_text(json.dumps(zones))
140
+ run(sys.executable, "-B", "tools/wear_stats.py", cwd=self.ws)
141
+ self.assertNotIn("all", json.loads((self.ws / "out/wear_stats_concept.json").read_text())["front"])
142
+
143
+ @unittest.skipUnless(HAVE_SCIPY, "scipy is required")
144
+ def test_overlay_masks_writes_an_image(self):
145
+ run(sys.executable, "-B", "tools/overlay_masks.py", "out/overlay.png", "reference/crops", "front,back", cwd=self.ws)
146
+ im = Image.open(self.ws / "out/overlay.png")
147
+ self.assertGreater(im.width, im.height)
148
+
105
149
  def test_sheet_builds_concept_render_pairs(self):
106
150
  (self.ws / "out/blender").mkdir(parents=True)
107
151
  for v in VIEWS:
@@ -135,12 +135,14 @@ export function createStudio(spec, container = document.body, opts = {}) {
135
135
  camera.position.copy(target).addScaledVector(dir, dist);
136
136
  camera.lookAt(target);
137
137
  camera.updateMatrixWorld();
138
- let ymin = Infinity, ymax = -Infinity;
138
+ let ymin = Infinity, ymax = -Infinity, xmin = Infinity, xmax = -Infinity;
139
139
  for (const c of corners) {
140
140
  const p = c.clone().project(camera);
141
141
  ymin = Math.min(ymin, p.y); ymax = Math.max(ymax, p.y);
142
+ xmin = Math.min(xmin, p.x); xmax = Math.max(xmax, p.x);
142
143
  }
143
- dist *= (ymax - ymin) / (2 * fill);
144
+ // fit BOTH axes: a wide object (a building in 3/4) would otherwise leave the frame sideways
145
+ dist *= Math.max(ymax - ymin, xmax - xmin) / (2 * fill);
144
146
  // recentre vertically: shift target along camera up by the NDC offset
145
147
  const mid = (ymax + ymin) / 2;
146
148
  const halfH = Math.tan(THREE.MathUtils.degToRad(camera.fov / 2)) * dist;
@@ -7,9 +7,11 @@ Config: reference/zones.json
7
7
  front_rects: {name: [x0, x1, y0, y1]} metres, x from the silhouette centre; front view only
8
8
  chip: {dL, min_L, max_C, window_m} chip = lighter than the local paint by dL, L > min_L, chroma < max_C
9
9
  or {mode: "hue", paint_hue: [h0, h1], neutral_C, min_L, max_C} for light paint: chip = not the paint hue
10
+ or {mode: "dark", dL, min_L, min_C, max_C, window_m} peeling over a darker layer (plaster): darker than the wall
10
11
  rust: {mode: "dark"|"hue", hue: [h0, h1], min_C, dL} hue mode: orange-brown hue range (for non-red paint)
11
12
  grime: {hue: [h0, h1], min_C, max_L} olive grime
12
13
  exclude_emissive: true drop the glowing window (and what is inside it) from all measurements
14
+ exclude_rects: {view: [[x0, x1, y0, y1], ...]} metres; areas that are not surface (glazing, signs) per view
13
15
  All images are resampled so the silhouette is 527 px tall; windows are in metres; vertical components longer
14
16
  than 0.2 m are dropped from rust (edges/grooves, not drips).
15
17
  """
@@ -35,6 +37,15 @@ def normalise(img):
35
37
  return np.asarray(im).astype(np.float32)
36
38
 
37
39
 
40
+ def up(a, shape):
41
+ """bilinear upsample of a downscaled reference back to full size (block upsampling shifted the chip counts)"""
42
+ z = ndi.zoom(a, (shape[0] / a.shape[0], shape[1] / a.shape[1]), order=1)
43
+ out = np.empty(shape, z.dtype); h, w = min(shape[0], z.shape[0]), min(shape[1], z.shape[1])
44
+ out[:h, :w] = z[:h, :w]; out[h:, :] = out[h - 1:h, :] if h < shape[0] else out[h:, :]
45
+ out[:, w:] = out[:, w - 1:w] if w < shape[1] else out[:, w:]
46
+ return out
47
+
48
+
38
49
  def masks(img, mpp, sil):
39
50
  lab = M.srgb_to_lab(img); L, a, b = lab[..., 0], lab[..., 1], lab[..., 2]
40
51
  C = np.hypot(a, b); hue = np.degrees(np.arctan2(b, a)) % 360
@@ -42,8 +53,25 @@ def masks(img, mpp, sil):
42
53
  Lloc = ndi.median_filter(L, size=win)
43
54
  ch = Z.get("chip", {}); dL, minL, maxC = ch.get("dL", 10), ch.get("min_L", 55), ch.get("max_C", 38)
44
55
  # chips can be larger than the rust window: compare with a wider (8 cm) paint neighbourhood
45
- Lchip = ndi.median_filter(L, size=max(7, int(round(ch.get("window_m", 0.08) / mpp)) | 1))
56
+ if ch.get("mode") == "dark":
57
+ Lchip = Lloc # the dark mode builds its own percentile reference below
58
+ else:
59
+ # chips can be larger than the rust window: compare with a wider paint neighbourhood (at 1/k scale if wide)
60
+ wpx = ch.get("window_m", 0.08) / mpp
61
+ kk = max(1, int(np.ceil(wpx / 60))) # full resolution up to a 60 px window (keeps calibrated numbers)
62
+ Lchip = ndi.median_filter(L[::kk, ::kk], size=max(3, int(round(wpx / kk)) | 1))
63
+ Lchip = up(Lchip, L.shape) if kk > 1 else Lchip
46
64
  chip = (L > np.minimum(Lloc, Lchip) + dL) & (L > minL) & (C < maxC)
65
+ if ch.get("mode") == "dark":
66
+ # peeling plaster / paint over a DARKER layer: compare with the intact wall = a high percentile of L in a wide
67
+ # window (when peeling covers a third of the wall the median itself is dragged down); computed at 1/4 scale
68
+ # downscale so the window stays <= ~25 px: percentile filters cost O(window^2) per pixel
69
+ win_px = ch.get("window_m", 1.0) / mpp
70
+ k = max(4, int(np.ceil(win_px / 25)))
71
+ win = max(3, int(round(win_px / k)) | 1)
72
+ ref = ndi.percentile_filter(L[::k, ::k], ch.get("ref_pct", 80), size=win)
73
+ ref = up(ref, L.shape)
74
+ chip = (L < ref - dL) & (L > minL) & (C > ch.get("min_C", 0)) & (C < maxC)
47
75
  if ch.get("mode") == "hue":
48
76
  # light paint: chips are not much lighter, they differ by hue (warm/neutral primer vs the paint hue)
49
77
  ph0, ph1 = ch["paint_hue"]
@@ -70,6 +98,11 @@ def masks(img, mpp, sil):
70
98
  if win_m.any():
71
99
  ys, xs = np.where(win_m); win_m[ys.min():ys.max() + 1, xs.min():xs.max() + 1] = True
72
100
  keep &= ~win_m
101
+ for xa, xb, ya, yb in Z.get("exclude_rects", {}).get(VIEW, []):
102
+ # per-view rectangles (metres, x from the silhouette centre) that are not surface: glazing, signs
103
+ ys, xs = np.where(sil)
104
+ y1, cx = ys.max() + 1, (xs.min() + xs.max() + 1) / 2
105
+ keep[max(0, int(y1 - yb / mpp)):int(y1 - ya / mpp), max(0, int(cx + xa / mpp)):int(cx + xb / mpp)] = False
73
106
  lab_, n = ndi.label(rust)
74
107
  for i, sl in enumerate(ndi.find_objects(lab_), 1):
75
108
  if sl is not None and (sl[0].stop - sl[0].start) * mpp > 0.20:
@@ -106,6 +139,7 @@ for v in M.VIEWS:
106
139
  continue
107
140
  img = normalise(M.load(p)); sil = M.mask_of(img); y0, y1, x0, x1 = M.bbox(sil); mpp = H / (y1 - y0)
108
141
  sil = ndi.binary_erosion(sil, iterations=3)
142
+ VIEW = v
109
143
  chip, rust, grime, keep = masks(img, mpp, sil)
110
144
  rv = {}
111
145
  for z, (a, b) in Z["bands"].items():
@@ -0,0 +1,109 @@
1
+ ---
2
+ name: mixamo
3
+ description: Rig a humanoid 3D model and download animations from Mixamo through its web API with the user's token - upload a character, auto-rig it with markers, search the animation library, download FBX clips. Use when a humanoid model needs a skeleton or animations from Mixamo, or the user mentions Mixamo.
4
+ ---
5
+
6
+ # Mixamo
7
+
8
+ ## Scope
9
+
10
+ A humanoid model needs a skeleton, skin weights or animations from Mixamo. Only humanoids: Mixamo's auto-rigger
11
+ knows no other body. Not for non-humanoid rigs, hand animation or retargeting between skeletons.
12
+
13
+ ## Prerequisites
14
+
15
+ - Python 3.9 or later; the script uses only the standard library. Verify with `python3 --version`.
16
+ - A Mixamo account (Adobe ID) of the user's own, signed in at [mixamo.com](https://www.mixamo.com/) in their browser.
17
+ - The user's Mixamo bearer token, supplied by the user. The agent never signs in, never types credentials and
18
+ never extracts the token from a browser itself. The user copies it from their own signed-in session (the
19
+ `Authorization: Bearer ...` header of a mixamo.com API request in the browser's developer tools) and stores it
20
+ in one of these places; the script uses the first that is set:
21
+ 1. `--token-file PATH` on any command;
22
+ 2. the `MIXAMO_TOKEN` environment variable, set by the user in their own shell (the token itself);
23
+ 3. the `MIXAMO_TOKEN_FILE` environment variable (a path);
24
+ 4. `~/.config/mixamo/token`.
25
+
26
+ A token file holds the raw token or a line `token=...`; keep it outside every repository and readable only by
27
+ the user (`chmod 600`).
28
+ - Verify with `python3 .claude/skills/mixamo/scripts/mixamo.py token` (a local check, no network).
29
+ - The skill's resources, installed with it under `.claude/skills/mixamo/` (other tools use their own skills
30
+ directory): `scripts/mixamo.py` and its network-free tests `scripts/test_mixamo.py`.
31
+
32
+ ## Token rules
33
+
34
+ - The token expires after about a day. The script refuses a token file older than 23 hours (`TOKEN_STALE`), reports
35
+ a missing one as `TOKEN_MISSING` and a 401 as `TOKEN_REJECTED`; a `MIXAMO_TOKEN` value has no known age, so only a
36
+ 401 shows it expired. In every one of these cases ask the user to replace the token and stop.
37
+ - Never print, `cat`, `grep` or `awk` the token file; never put the token in a command line (do not set
38
+ `MIXAMO_TOKEN=...` yourself), a log, a commit or a reply. The script never prints it, redacts it from response
39
+ text and sends it only to `https://*.mixamo.com`.
40
+
41
+ ## Stop conditions
42
+
43
+ - No token configured, `TOKEN_STALE`, `TOKEN_REJECTED`: ask the user for a fresh token, stop.
44
+ - The model is not humanoid, or the user did not ask for this model to be uploaded: stop and say why.
45
+ - A command fails in a way that suggests the unofficial API changed: inspect it with `raw` (below), report what
46
+ changed, and do not guess request bodies against the user's account.
47
+
48
+ ## Mechanism
49
+
50
+ `scripts/mixamo.py` makes the calls the mixamo.com page makes. The API is unofficial and may change;
51
+ `mixamo.py raw <METHOD> <path> [json]` is for looking at an endpoint when a command breaks, and the page's own
52
+ script (`https://www.mixamo.com/`, the `js/mixamo.min.*.js` it loads) shows what the page sends.
53
+
54
+ ```text
55
+ mixamo.py token is a token configured and fresh
56
+ mixamo.py upload <model.fbx> -> character id and its bounds
57
+ mixamo.py rig <character-id> <markers.json> auto-rig; fails unless the character ends "ready"
58
+ mixamo.py status <character-id>
59
+ mixamo.py search <words> [--limit N] id | name | description
60
+ mixamo.py download <character-id> <product-id|name> <out.fbx> [--skin] [--in-place] [--fps 30]
61
+ ```
62
+
63
+ ### Model for upload
64
+
65
+ - One mesh, no armature, FBX. A-pose or T-pose, arms away from the body, legs apart, facing the viewer.
66
+ - Take off what must not bend with the body (weapon, shield, cloak) and attach it to a bone after rigging.
67
+ - Exported from Blender with the default axes the character stands Y up and faces +Z on Mixamo.
68
+
69
+ ### Markers
70
+
71
+ `markers.json` holds eight points, each `[x, y]`: `chin`, `larm` and `rarm` (wrists), `lelbow`, `relbow`, `lknee`,
72
+ `rknee`, `groin`. They are in the uploaded model's own space as `upload` prints its bounds: Y up, X to the
73
+ character's left, the units of the file. Measure them on the mesh (in Blender: x is X, y is Z), do not guess from
74
+ a picture. Skeleton detail is `--lod`: `""` (default), `ThumbIndexRing`, `ThumbIndex`, `NoFingers`.
75
+
76
+ ### Animations
77
+
78
+ `download --skin` returns the mesh, skeleton, weights and the clip in one FBX: take one clip this way, the rest
79
+ without skin and apply their actions to the same armature. `--in-place` removes travel where the animation offers
80
+ it (walks, runs); the script prints whether it applied. Bones are named `mixamorig:<Name>`.
81
+
82
+ ## Outcomes
83
+
84
+ - Look at the result before relying on it: import into Blender, render frames of every clip, check the mesh
85
+ bends where the joints are and nothing tears.
86
+ - Record beside the downloaded files which Mixamo animation each one is (name and product id).
87
+
88
+ ## Invariants
89
+
90
+ - Uploading sends the user's model to Adobe. Do it only for models the user asked to rig.
91
+ - Mixamo's licence allows using characters and animations in a game, royalty free, but not redistributing the
92
+ raw animation files as a library. Check the project's own rules on third-party assets before committing them.
93
+ - This is one user's account: no bulk scraping of the library, download what the task needs.
94
+ - Follow the project's Git rules; commit downloaded files only when the user asks. Never push.
95
+
96
+ ## Known gaps
97
+
98
+ - With `--lod ""` a stylised, large-headed character came back with 41 bones (thumb and one finger chain), not the
99
+ 65 of the standard skeleton. Whether the page sends something else for the full skeleton is not verified.
100
+ - Downloading the bare rigged character without an animation is not implemented; use `download --skin`.
101
+
102
+ ## Output Contract
103
+
104
+ Emit `Skill: mixamo - output below`, then state:
105
+
106
+ - character id, rig status and skeleton LOD (bone count if checked);
107
+ - every downloaded file with its Mixamo animation name, product id, skin and in-place flags;
108
+ - what was checked visually and what was not;
109
+ - any token or API problem, with the status code (`TOKEN_MISSING`, `TOKEN_STALE`, `TOKEN_REJECTED`, HTTP code).
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Mixamo"
3
+ short_description: "Auto-rig a humanoid model and download Mixamo animations through its web API with the user's own token"
4
+ default_prompt: "Use $mixamo to rig this humanoid model on Mixamo and download the animations it needs, using my Mixamo token."