agent-manifesto-kit 1.7.0 → 1.8.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 (27) hide show
  1. package/README.md +37 -0
  2. package/collection/skills/art-direction-pass/SKILL.md +245 -0
  3. package/collection/skills/art-direction-pass/agents/openai.yaml +4 -0
  4. package/collection/skills/art-direction-pass/assets/presets.json +9 -0
  5. package/collection/skills/art-direction-pass/assets/visual_capture.gd +77 -0
  6. package/collection/skills/art-direction-pass/scripts/compare.py +86 -0
  7. package/collection/skills/art-direction-pass/scripts/metrics.py +56 -0
  8. package/collection/skills/art-direction-pass/scripts/test_tools.py +83 -0
  9. package/collection/skills/concept-scene-builder/SKILL.md +313 -0
  10. package/collection/skills/concept-scene-builder/agents/openai.yaml +4 -0
  11. package/collection/skills/concept-scene-builder/references/field-lessons.md +113 -0
  12. package/collection/skills/concept-scene-builder/scripts/blend.py +32 -0
  13. package/collection/skills/concept-scene-builder/scripts/crop.py +56 -0
  14. package/collection/skills/concept-scene-builder/scripts/grid_overlay.py +117 -0
  15. package/collection/skills/concept-scene-builder/scripts/test_tools.py +89 -0
  16. package/collection/skills/machine-builder/SKILL.md +222 -0
  17. package/collection/skills/machine-builder/agents/openai.yaml +4 -0
  18. package/collection/skills/machine-builder/assets/spec.example.yaml +47 -0
  19. package/collection/skills/machine-builder/scripts/validate.py +307 -0
  20. package/collection/skills/roadmap/SKILL.md +49 -0
  21. package/collection/skills/roadmap/agents/openai.yaml +4 -0
  22. package/collection/skills/roadmap/assets/post-commit.sh +33 -0
  23. package/collection/skills/roadmap/assets/template.html +470 -0
  24. package/collection/skills/roadmap/references/format.md +51 -0
  25. package/collection/skills/roadmap/scripts/roadmap.py +852 -0
  26. package/collection/skills/roadmap/scripts/test_roadmap.py +578 -0
  27. package/package.json +1 -1
@@ -0,0 +1,307 @@
1
+ """Validate a machine built from rigid parts parented to armature bones.
2
+
3
+ blender -b unit.blend --python-exit-code 1 --python validate.py -- --spec spec.yaml --out report.json
4
+
5
+ Exits 0 when every check passes and 1 otherwise. Any error (bad spec, unknown bone, missing armature)
6
+ also exits 1 and writes a report with "passed": false, so a stale passing report never survives a crash.
7
+
8
+ Checks, per test pose and sweep step from the spec:
9
+ - collisions between parts that are not on the same or directly connected bones
10
+ - centre of mass over the support polygon of the contact parts (when the ground check applies)
11
+ Plus static checks: part count, triangles, loose islands per part, missing sockets, unparented meshes.
12
+
13
+ Part custom properties (optional): "density" (default 1.0), "contact" (True for feet/tracks/wheels),
14
+ "max_islands" (default 1).
15
+ Spec keys used:
16
+ test_poses {pose: {bone: VALUE}} VALUE = [x, y, z] rotation in degrees,
17
+ or {"rot": [x, y, z], "loc": [x, y, z]} (loc in bone-local metres,
18
+ e.g. suspension travel)
19
+ sweeps {name: {bone, axis, from, to, step, pose?}} pose = a base pose (same format) applied first,
20
+ e.g. a turret sweep at full gun depression
21
+ hardpoints [{id}], allowed_contacts [[partA, partB]], budgets {tris_lod0}, min_support_margin_m,
22
+ profile (walker/tracked/wheeled/hover/rotorcraft/fixed_wing/static),
23
+ ground_check (overrides the profile default), ground_check_poses [pose names] (check only these poses,
24
+ e.g. gear_down for a rotorcraft).
25
+
26
+ Rotations are Euler XYZ in Blender BONE-LOCAL space: Y runs along the bone (twist / yaw of an upright bone),
27
+ X and Z bend it. A torso twist on an upright torso bone is [0, angle, 0].
28
+ """
29
+ import json
30
+ import math
31
+ import os
32
+ import sys
33
+
34
+ import bmesh
35
+ import bpy
36
+ from mathutils import Vector
37
+ from mathutils.bvhtree import BVHTree
38
+
39
+ GROUND_PROFILES = ("walker", "tracked", "wheeled", "static")
40
+ AXIS = {"x": 0, "y": 1, "z": 2}
41
+
42
+
43
+ class SpecError(Exception):
44
+ pass
45
+
46
+
47
+ def load_spec(path):
48
+ with open(path) as f:
49
+ if path.endswith(".json"):
50
+ return json.load(f)
51
+ try:
52
+ import yaml
53
+ except ImportError as e:
54
+ raise SpecError("PyYAML missing in Blender's Python: install it or pass a .json copy of the spec") from e
55
+ return yaml.safe_load(f)
56
+
57
+
58
+ def vec3(value, what):
59
+ if not isinstance(value, (list, tuple)) or len(value) != 3 or not all(isinstance(v, (int, float)) for v in value):
60
+ raise SpecError(f"{what} must be three numbers, got {value!r}")
61
+ return [float(v) for v in value]
62
+
63
+
64
+ def normalise_pose(pose, where):
65
+ out = {}
66
+ for bone, value in (pose or {}).items():
67
+ if isinstance(value, dict):
68
+ unknown = set(value) - {"rot", "loc"}
69
+ if unknown:
70
+ raise SpecError(f"{where}: bone {bone} has unknown keys {sorted(unknown)}")
71
+ out[bone] = (vec3(value.get("rot", [0, 0, 0]), f"{where}.{bone}.rot"),
72
+ vec3(value.get("loc", [0, 0, 0]), f"{where}.{bone}.loc"))
73
+ else:
74
+ out[bone] = (vec3(value, f"{where}.{bone}"), [0.0, 0.0, 0.0])
75
+ return out
76
+
77
+
78
+ def build_poses(spec):
79
+ poses = {"rest": {}}
80
+ for name, pose in (spec.get("test_poses") or {}).items():
81
+ poses[name] = normalise_pose(pose, f"test_poses.{name}")
82
+ for name, sw in (spec.get("sweeps") or {}).items():
83
+ missing = {"bone", "from", "to", "step"} - set(sw)
84
+ if missing:
85
+ raise SpecError(f"sweeps.{name} is missing {sorted(missing)}")
86
+ axis = sw.get("axis", "y")
87
+ if axis not in AXIS:
88
+ raise SpecError(f"sweeps.{name}.axis must be x, y or z, got {axis!r}")
89
+ if not sw["step"] > 0:
90
+ raise SpecError(f"sweeps.{name}.step must be positive")
91
+ base = normalise_pose(sw.get("pose"), f"sweeps.{name}.pose")
92
+ a = sw["from"]
93
+ while a <= sw["to"] + 1e-9:
94
+ pose = dict(base)
95
+ rot, loc = pose.get(sw["bone"], ([0.0, 0.0, 0.0], [0.0, 0.0, 0.0]))
96
+ rot = list(rot)
97
+ rot[AXIS[axis]] = float(a)
98
+ pose[sw["bone"]] = (rot, loc)
99
+ poses[f"{name}@{a:g}"] = pose
100
+ a += sw["step"]
101
+ return poses
102
+
103
+
104
+ def islands(bm):
105
+ bm.faces.ensure_lookup_table()
106
+ seen, count = set(), 0
107
+ for f in bm.faces:
108
+ if f.index in seen:
109
+ continue
110
+ count += 1
111
+ stack = [f]
112
+ while stack:
113
+ cur = stack.pop()
114
+ if cur.index in seen:
115
+ continue
116
+ seen.add(cur.index)
117
+ for e in cur.edges:
118
+ stack.extend(lf for lf in e.link_faces if lf.index not in seen)
119
+ return count
120
+
121
+
122
+ def hull(pts):
123
+ pts = sorted(set(pts))
124
+ if len(pts) < 3:
125
+ return pts
126
+
127
+ def cross(o, a, b):
128
+ return (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0])
129
+
130
+ lo, up = [], []
131
+ for p in pts:
132
+ while len(lo) >= 2 and cross(lo[-2], lo[-1], p) <= 0:
133
+ lo.pop()
134
+ lo.append(p)
135
+ for p in reversed(pts):
136
+ while len(up) >= 2 and cross(up[-2], up[-1], p) <= 0:
137
+ up.pop()
138
+ up.append(p)
139
+ return lo[:-1] + up[:-1]
140
+
141
+
142
+ def inside_margin(p, poly):
143
+ """Signed distance from p to the convex polygon edges (positive = inside)."""
144
+ if len(poly) < 3:
145
+ return None
146
+ best = float("inf")
147
+ for i in range(len(poly)):
148
+ a, b = poly[i], poly[(i + 1) % len(poly)]
149
+ ex, ey = b[0] - a[0], b[1] - a[1]
150
+ length = math.hypot(ex, ey) or 1e-9
151
+ best = min(best, (ex * (p[1] - a[1]) - ey * (p[0] - a[0])) / length)
152
+ return best
153
+
154
+
155
+ def validate(spec):
156
+ arm = next((o for o in bpy.data.objects if o.type == "ARMATURE"), None)
157
+ if arm is None:
158
+ raise SpecError("no armature in the file: build the skeleton first")
159
+ meshes = [o for o in bpy.data.objects if o.type == "MESH"]
160
+ parts = [o for o in meshes if o.parent == arm and o.parent_type == "BONE"]
161
+ if not parts:
162
+ raise SpecError("no mesh parts parented to armature bones")
163
+ allowed = {frozenset(p) for p in spec.get("allowed_contacts", [])}
164
+ ground = spec.get("ground_check", spec.get("profile", "walker") in GROUND_PROFILES)
165
+ ground_poses = spec.get("ground_check_poses")
166
+ poses = build_poses(spec)
167
+ for name, pose in poses.items():
168
+ for bone in pose:
169
+ if bone not in arm.pose.bones:
170
+ raise SpecError(f"pose {name} references unknown bone {bone}")
171
+ for name in ground_poses or []:
172
+ if name not in poses:
173
+ raise SpecError(f"ground_check_poses names unknown pose {name}")
174
+
175
+ def connected(a, b):
176
+ ba, bb = arm.data.bones[a.parent_bone], arm.data.bones[b.parent_bone]
177
+ return ba == bb or ba.parent == bb or bb.parent == ba
178
+
179
+ def world_mesh(obj, dg):
180
+ ev = obj.evaluated_get(dg)
181
+ me = ev.to_mesh()
182
+ bm = bmesh.new()
183
+ bm.from_mesh(me)
184
+ bm.transform(ev.matrix_world)
185
+ ev.to_mesh_clear()
186
+ return bm
187
+
188
+ def set_pose(pose):
189
+ for pb in arm.pose.bones:
190
+ pb.rotation_mode = "XYZ"
191
+ pb.rotation_euler = (0, 0, 0)
192
+ pb.location = (0, 0, 0)
193
+ for bone, (rot, loc) in pose.items():
194
+ arm.pose.bones[bone].rotation_euler = [math.radians(d) for d in rot]
195
+ arm.pose.bones[bone].location = loc
196
+ bpy.context.view_layer.update()
197
+
198
+ report = {"static": {}, "poses": {}, "failures": []}
199
+
200
+ # ---- static checks (rest pose)
201
+ set_pose({})
202
+ dg = bpy.context.evaluated_depsgraph_get()
203
+ tris, loose = 0, {}
204
+ for o in parts:
205
+ bm = world_mesh(o, dg)
206
+ tris += sum(len(f.verts) - 2 for f in bm.faces)
207
+ n = islands(bm)
208
+ if n > o.get("max_islands", 1):
209
+ loose[o.name] = n
210
+ bm.free()
211
+ report["static"] = {
212
+ "parts": len(parts),
213
+ "triangles": tris,
214
+ "unparented_meshes": [o.name for o in meshes if o not in parts],
215
+ "parts_with_extra_islands": loose,
216
+ "missing_sockets": [h["id"] for h in spec.get("hardpoints", []) if f"socket_{h['id']}" not in bpy.data.objects],
217
+ }
218
+ budget = spec.get("budgets", {}).get("tris_lod0")
219
+ if budget and tris > budget:
220
+ report["failures"].append(f"triangles {tris} > budget {budget}")
221
+ for key in ("unparented_meshes", "parts_with_extra_islands", "missing_sockets"):
222
+ if report["static"][key]:
223
+ report["failures"].append(f"{key}: {report['static'][key]}")
224
+
225
+ # ---- per-pose checks
226
+ for name, pose in poses.items():
227
+ set_pose(pose)
228
+ dg = bpy.context.evaluated_depsgraph_get()
229
+ data = {}
230
+ for o in parts:
231
+ bm = world_mesh(o, dg)
232
+ verts = [v.co.copy() for v in bm.verts]
233
+ if not verts:
234
+ bm.free()
235
+ report["failures"].append(f"pose {name}: part {o.name} has no geometry")
236
+ continue
237
+ polys = [[v.index for v in f.verts] for f in bm.faces]
238
+ vol = abs(bm.calc_volume()) or 1e-6
239
+ data[o.name] = {
240
+ "tree": BVHTree.FromPolygons(verts, polys),
241
+ "centroid": sum(verts, Vector()) / len(verts),
242
+ "mass": vol * o.get("density", 1.0),
243
+ "verts": verts,
244
+ "contact": bool(o.get("contact", False)),
245
+ }
246
+ bm.free()
247
+ if not data:
248
+ continue
249
+
250
+ hits = []
251
+ names = list(data)
252
+ for i, a in enumerate(names):
253
+ for b in names[i + 1:]:
254
+ if connected(bpy.data.objects[a], bpy.data.objects[b]) or frozenset((a, b)) in allowed:
255
+ continue
256
+ if data[a]["tree"].overlap(data[b]["tree"]):
257
+ hits.append([a, b])
258
+ result = {"collisions": hits}
259
+ if hits:
260
+ report["failures"].append(f"pose {name}: {len(hits)} colliding pairs")
261
+
262
+ check_ground = name in ground_poses if ground_poses else ground
263
+ if check_ground:
264
+ total = sum(d["mass"] for d in data.values())
265
+ com = sum((d["centroid"] * d["mass"] for d in data.values()), Vector()) / total
266
+ contact_verts = [v for d in data.values() if d["contact"] for v in d["verts"]]
267
+ if not contact_verts:
268
+ report["failures"].append(f"pose {name}: no ground contact parts (set custom prop contact=True)")
269
+ else:
270
+ ground_z = min(v.z for v in contact_verts)
271
+ lowest = min(v.z for d in data.values() for v in d["verts"])
272
+ contact_pts = [(v.x, v.y) for v in contact_verts if v.z - ground_z < 0.03]
273
+ margin = inside_margin((com.x, com.y), hull(contact_pts))
274
+ result.update({"com": [round(c, 3) for c in com], "ground_z": round(ground_z, 3),
275
+ "support_margin_m": None if margin is None else round(margin, 3)})
276
+ if lowest < ground_z - 0.03:
277
+ report["failures"].append(f"pose {name}: a non-contact part is {ground_z - lowest:.2f} m below the contacts")
278
+ if margin is None:
279
+ report["failures"].append(f"pose {name}: contact parts give no support polygon")
280
+ elif margin < spec.get("min_support_margin_m", 0.0):
281
+ report["failures"].append(f"pose {name}: centre of mass outside support polygon by {-margin:.2f} m")
282
+ report["poses"][name] = result
283
+
284
+ set_pose({})
285
+ report["passed"] = not report["failures"]
286
+ return report
287
+
288
+
289
+ def main():
290
+ argv = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
291
+ args = dict(zip(argv[::2], argv[1::2]))
292
+ out_path = args.get("--out", "report.json")
293
+ if os.path.exists(out_path):
294
+ os.remove(out_path) # never leave a stale report behind
295
+ try:
296
+ if "--spec" not in args:
297
+ raise SpecError("usage: blender -b unit.blend --python-exit-code 1 --python validate.py -- --spec spec.yaml [--out report.json]")
298
+ report = validate(load_spec(args["--spec"]) or {})
299
+ except Exception as e: # any failure is a failed validation, never a silent pass
300
+ report = {"passed": False, "failures": [f"error: {type(e).__name__}: {e}"]}
301
+ with open(out_path, "w") as f:
302
+ json.dump(report, f, indent=2)
303
+ print(json.dumps({"passed": report["passed"], "failures": report["failures"]}, indent=2))
304
+ sys.exit(0 if report["passed"] else 1)
305
+
306
+
307
+ main()
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: roadmap
3
+ description: Create, build, check and keep consistent a project's roadmap, a Gantt page generated from the TaskPilot items, the git history and a small plan file, one shared template for every project. Use when a project needs a roadmap, when items or plan phases change, when the roadmap looks stale.
4
+ ---
5
+
6
+ # Roadmap
7
+
8
+ A roadmap is one self-contained HTML page (no network) built by `scripts/roadmap.py` from three read-only sources: the
9
+ TaskPilot items (`.taskpilot/items/*.yaml`), the git history of those files and of commits naming item ids, and an
10
+ optional hand-edited plan file (`docs/roadmap_plan.json`: phases, estimates, milestones). Every project uses the same
11
+ template (`assets/template.html`), so all roadmaps look and behave the same. Format and plan keys:
12
+ [references/format.md](references/format.md).
13
+
14
+ ## Commands
15
+
16
+ Run from the project (or pass `--project DIR`); `python3`, standard library only.
17
+
18
+ ```sh
19
+ python3 .claude/skills/roadmap/scripts/roadmap.py init --title "My game" [--lang en|ru] # skeleton plan, never overwrites
20
+ python3 .claude/skills/roadmap/scripts/roadmap.py build [--open] # writes docs/roadmap.html
21
+ python3 .claude/skills/roadmap/scripts/roadmap.py check [--json] [--template-from PATH] # exit 1 on any problem
22
+ python3 .claude/skills/roadmap/scripts/roadmap.py path # output path, relative
23
+ ```
24
+
25
+ Tests of the tool itself: `python3 -m unittest discover -s .claude/skills/roadmap/scripts`.
26
+
27
+ ## Rules that keep it consistent
28
+
29
+ - Never hand-edit the generated `roadmap.html` or the template copy in a project: change the plan file or the items,
30
+ then rebuild. Template changes are made in this skill (the kit's `roadmap`, `assets/template.html`) and copied over.
31
+ - After items or the plan change: `build`, then `check` (it fails on an invalid plan, unknown or cancelled ids, an id in
32
+ two blocks, bad dates, a missing or stale page, a page built from another template). Commit the rebuilt page.
33
+ - `assets/post-commit.sh` rebuilds the page after commits on `main` that touch items or name an id and makes a commit of
34
+ that page by itself (install it as `.git/hooks/post-commit`, or call it from the project's hook; it finds the script
35
+ in either tool's skills directory; `ROADMAP_PY`, `ROADMAP_PYTHON` and `ROADMAP_BRANCH` override the script, the interpreter
36
+ and the branch). It does not run after a fast-forward merge: run `build` and commit the page then. `check` on a
37
+ feature branch can report `output-stale` (commits naming ids on other branches count), so rebuild and commit the page
38
+ on `main`, not on every branch.
39
+ - Keep ids in commit messages (`AV-12: ...`): they become ticks and rework bars in the chart.
40
+ - Plan blocks list item ids (leaves count) or an estimated `size`; do not list an id twice. Dates are ISO date-times.
41
+
42
+ ## Adopting it in another project
43
+
44
+ 1. Prerequisite: TaskPilot items (`.taskpilot/items/*.yaml`, skill `taskpilot`) or files with the same keys; without items the page is empty. Install the skill with the kit sync (it places it in each tool's own skills directory) or copy this folder to the project's skills directory. On Windows use `python` or `py -3` for `python3`.
45
+ 2. `init`, edit `docs/roadmap_plan.json` (phases, milestones), `build`, `check`, commit the page.
46
+ 3. Optionally install the hook. To detect drift from the canonical template run
47
+ `check --template-from <kit copy>/assets/template.html`.
48
+ 4. Optional integration, Astro Preview: register it in the sidebar **Roadmaps** tab, **Add roadmap**, pick the project and the page
49
+ (`docs/roadmap.html`). Astro keeps only the link; the roadmap stays in the project and is never written by Astro.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Roadmap"
3
+ short_description: "One shared Gantt roadmap page per project from TaskPilot items and git history"
4
+ default_prompt: "Use $roadmap to give this project a roadmap, rebuild it after item changes and check that it is consistent."
@@ -0,0 +1,33 @@
1
+ #!/bin/sh
2
+ # Roadmap upkeep (roadmap.py): after a commit on main in the main checkout that touches TaskPilot items or names an
3
+ # item id, rebuild the roadmap page and commit that file alone when it changed (`git commit -- path` leaves other
4
+ # sessions' staged work alone). Skipped in worktrees, on other branches, during rebases and merges.
5
+ # Install: copy to .git/hooks/post-commit (or call it from your hooks directory). The script is found in
6
+ # .claude/skills/roadmap or .agents/skills/roadmap (the kit's sync does not rewrite this file); overrides:
7
+ # ROADMAP_PY (script path), ROADMAP_PYTHON (interpreter, default python3 then python), ROADMAP_BRANCH (default main).
8
+ # It makes a commit on that branch by itself: the rebuilt page, alone.
9
+ [ -n "$ROADMAP_HOOK" ] && exit 0
10
+ root="$(git rev-parse --show-toplevel)" || exit 0
11
+ gd="$(git rev-parse --path-format=absolute --git-dir)"
12
+ [ "$gd" = "$(git rev-parse --path-format=absolute --git-common-dir)" ] || exit 0
13
+ [ "$(git symbolic-ref --quiet --short HEAD)" = "${ROADMAP_BRANCH:-main}" ] || exit 0
14
+ [ -d "$gd/rebase-merge" ] || [ -d "$gd/rebase-apply" ] || [ -f "$gd/MERGE_HEAD" ] && exit 0
15
+ script="$ROADMAP_PY"
16
+ if [ -z "$script" ]; then
17
+ for d in .claude .agents; do
18
+ [ -f "$root/$d/skills/roadmap/scripts/roadmap.py" ] && script="$root/$d/skills/roadmap/scripts/roadmap.py" && break
19
+ done
20
+ fi
21
+ [ -f "$script" ] || { echo "post-commit: roadmap.py not found (set ROADMAP_PY)" >&2; exit 0; }
22
+ py="${ROADMAP_PYTHON:-}"
23
+ if [ -z "$py" ]; then if command -v python3 >/dev/null 2>&1; then py=python3; else py=python; fi; fi
24
+ # Only commits that touch items or name an id (<LETTERS>-<digits>) matter.
25
+ git diff-tree --no-commit-id --name-only -r -m HEAD | grep -q '^\.taskpilot/items/' \
26
+ || git log -1 --format=%B HEAD | grep -Eq '[A-Z][A-Z0-9]*-[0-9]+' || exit 0
27
+ out="$("$py" "$script" path --project "$root")" || { echo "post-commit: roadmap path failed" >&2; exit 0; }
28
+ "$py" "$script" build --project "$root" >/dev/null || { echo "post-commit: roadmap build failed" >&2; exit 0; }
29
+ git -C "$root" add -- "$out" 2>/dev/null
30
+ git -C "$root" diff --cached --quiet HEAD -- "$out" && exit 0
31
+ ROADMAP_HOOK=1 git -C "$root" commit --no-verify -q -m "Roadmap: rebuild $out" -- "$out" \
32
+ || echo "post-commit: roadmap commit skipped" >&2
33
+ exit 0