motionloom 2.0.0

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 (112) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +179 -0
  3. package/SKILL.md +122 -0
  4. package/agent-card.json +161 -0
  5. package/assets/library/ATTRIBUTION.md +6 -0
  6. package/assets/library/README.md +20 -0
  7. package/assets/library/avatar-base.svg +19 -0
  8. package/assets/library/error-alert.json +1 -0
  9. package/assets/library/rive/ATTRIBUTION.md +12 -0
  10. package/assets/library/rive/state-machine-test.riv +0 -0
  11. package/assets/library/success-check.json +1 -0
  12. package/bin/motionloom.mjs +81 -0
  13. package/docs/BROWSER-REVIEW-E2E.md +78 -0
  14. package/docs/CATEGORIES.md +16 -0
  15. package/docs/CHECKLIST.md +31 -0
  16. package/docs/DEEP-AUDIT-WORKING-NOTES.md +22 -0
  17. package/docs/FRAMEWORK-SELECTION.md +26 -0
  18. package/docs/PROJECT-MANIFEST.md +37 -0
  19. package/docs/ROADMAP-INTELLIGENCE.md +224 -0
  20. package/docs/audits/1.10.0-attestation-research-notes.md +19 -0
  21. package/docs/audits/1.8.0-trust-boundary-hardening.md +56 -0
  22. package/docs/audits/1.9.0-evidence-interoperability-threat-model.md +37 -0
  23. package/docs/audits/2.0.0-attestation-acceptance.md +30 -0
  24. package/docs/releases/1.5.0.md +25 -0
  25. package/docs/releases/1.6.0.md +27 -0
  26. package/docs/releases/1.7.0.md +23 -0
  27. package/docs/releases/1.8.0.md +23 -0
  28. package/docs/releases/1.9.0.md +21 -0
  29. package/docs/releases/2.0.0.md +21 -0
  30. package/docs/releases/npm-publish-from-workstation.md +88 -0
  31. package/docs/research/AGENT-PROTOCOL-FINDINGS.md +43 -0
  32. package/examples/report-demo/REPORT.md +50 -0
  33. package/examples/report-demo/artifact-manifest.json +25 -0
  34. package/examples/report-demo/decision-log.jsonl +0 -0
  35. package/examples/report-demo/execution-report.json +70 -0
  36. package/examples/report-demo/handoff.json +22 -0
  37. package/examples/report-demo/issue-register.json +5 -0
  38. package/examples/report-demo/task.json +13 -0
  39. package/package.json +95 -0
  40. package/project-context.example.json +26 -0
  41. package/references/browser-review-contract.md +32 -0
  42. package/references/dotlottie-source-notes.md +21 -0
  43. package/references/intelligence-core.md +98 -0
  44. package/references/reporting-contract.md +38 -0
  45. package/references/runtime-capability.md +12 -0
  46. package/references/signed-attestation.md +31 -0
  47. package/schemas/artifact-manifest.schema.json +22 -0
  48. package/schemas/browser-review-candidate.schema.json +24 -0
  49. package/schemas/capability-registry.schema.json +61 -0
  50. package/schemas/continuity-report.schema.json +52 -0
  51. package/schemas/evidence-verifier-report.schema.json +35 -0
  52. package/schemas/execution-report.schema.json +35 -0
  53. package/schemas/fix-plan.schema.json +44 -0
  54. package/schemas/handoff.schema.json +19 -0
  55. package/schemas/motion-ir.schema.json +74 -0
  56. package/schemas/project-graph.schema.json +70 -0
  57. package/schemas/provenance.schema.json +76 -0
  58. package/schemas/runtime-evidence.schema.json +48 -0
  59. package/schemas/runtime-telemetry.schema.json +50 -0
  60. package/schemas/scene-manifest.schema.json +45 -0
  61. package/schemas/semantic-benchmark.schema.json +26 -0
  62. package/schemas/semantic-lint-report.schema.json +48 -0
  63. package/schemas/signed-attestation.schema.json +95 -0
  64. package/schemas/task.schema.json +39 -0
  65. package/schemas/trust-policy.schema.json +53 -0
  66. package/scripts/analyze.sh +13 -0
  67. package/scripts/attestation-keygen.py +63 -0
  68. package/scripts/attestation-verifier.py +178 -0
  69. package/scripts/attestation.py +288 -0
  70. package/scripts/capture-runtime-telemetry.sh +37 -0
  71. package/scripts/devlab.sh +77 -0
  72. package/scripts/eval-intelligence.py +377 -0
  73. package/scripts/evidence-verifier.py +222 -0
  74. package/scripts/fetch-library.sh +57 -0
  75. package/scripts/intelligence.py +1543 -0
  76. package/scripts/manifest.py +61 -0
  77. package/scripts/pr.sh +103 -0
  78. package/scripts/quality-gate.py +378 -0
  79. package/scripts/render-node.mjs +53 -0
  80. package/scripts/render.sh +37 -0
  81. package/scripts/report-contract.py +181 -0
  82. package/scripts/report.py +588 -0
  83. package/scripts/review-hook.py +199 -0
  84. package/scripts/runtime-adapters.mjs +187 -0
  85. package/scripts/skill-doctor.py +150 -0
  86. package/scripts/to-dotlottie.mjs +99 -0
  87. package/scripts/to-dotlottie.sh +25 -0
  88. package/scripts/validate-lottie.py +102 -0
  89. package/src/core/analyzer.py +226 -0
  90. package/src/core/snapshot.py +124 -0
  91. package/src/core/spec.py +240 -0
  92. package/src/output/browser-review-smoke/animation.json +57 -0
  93. package/src/output/browser-review-smoke/browser-review.json +21 -0
  94. package/src/output/browser-review-smoke/manifest.json +22 -0
  95. package/src/output/browser-review-smoke/motion-spec.json +28 -0
  96. package/src/output/browser-review-smoke/snapshot/.render-meta.json +10 -0
  97. package/src/output/browser-review-smoke/snapshot/frame-00.png +0 -0
  98. package/src/output/browser-review-smoke/snapshot/frame-100.png +0 -0
  99. package/src/output/browser-review-smoke/snapshot/frame-50.png +0 -0
  100. package/src/rig/README.md +35 -0
  101. package/src/rig/cutout_rig.py +211 -0
  102. package/templates/framer-motion/ui-micro.tsx +50 -0
  103. package/templates/gsap/scroll-scene.js +54 -0
  104. package/templates/lottie/README.md +21 -0
  105. package/templates/lottie/react-component.tsx +82 -0
  106. package/templates/lottie/scaffold/animation.json +57 -0
  107. package/templates/lottie/scaffold/character-rig.svg +19 -0
  108. package/templates/lottie/vanilla.js +68 -0
  109. package/templates/rive/README.md +36 -0
  110. package/tests/evals/intelligence-cases.json +131 -0
  111. package/tests/scripts/run_tests.py +843 -0
  112. package/tests/scripts/test_attestation.py +172 -0
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * MotionLoom npm entrypoint.
4
+ * Style: Timeline Desk — terse command routing, explicit evidence verbs and
5
+ * no hidden approval side effects. The CLI delegates to the shipped Python
6
+ * contracts so npm installation and repository execution use one surface.
7
+ */
8
+ import { fileURLToPath } from "node:url";
9
+ import { dirname, resolve } from "node:path";
10
+ import { spawnSync } from "node:child_process";
11
+
12
+ const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
13
+ const PYTHON = process.env.MOTIONLOOM_PYTHON || (process.platform === "win32" ? "python" : "python3");
14
+
15
+ const PYTHON_COMMANDS = {
16
+ analyze: "scripts/analyze.sh",
17
+ attestation: "scripts/attestation.py",
18
+ "verify-attestation": "scripts/attestation-verifier.py",
19
+ doctor: "scripts/skill-doctor.py",
20
+ intelligence: "scripts/intelligence.py",
21
+ "eval-intelligence": "scripts/eval-intelligence.py",
22
+ "evidence-verify": "scripts/evidence-verifier.py",
23
+ "quality-gate": "scripts/quality-gate.py",
24
+ "report-contract": "scripts/report-contract.py",
25
+ report: "scripts/report.py",
26
+ "review-hook": "scripts/review-hook.py",
27
+ "validate-lottie": "scripts/validate-lottie.py",
28
+ manifest: "scripts/manifest.py",
29
+ };
30
+
31
+ function printHelp() {
32
+ console.log(`MotionLoom 2.0.0 — project-aware animation production and evidence contracts
33
+
34
+ Usage:
35
+ motionloom <command> [args...]
36
+
37
+ Commands:
38
+ doctor Validate the installed Skill package
39
+ analyze Run project analysis (delegates to scripts/analyze.sh)
40
+ intelligence Build or validate Intelligence Core artifacts
41
+ attestation Build/validate canonical signed-attestation artifacts
42
+ verify-attestation Verify an attestation against a trust policy
43
+ evidence-verify Verify runtime evidence externally
44
+ quality-gate Run the strict scene acceptance gate
45
+ report-contract Validate task bundle completeness
46
+ review-hook Prepare or validate browser review handoff
47
+ report Read or update task review reports
48
+ validate-lottie Validate a Lottie animation
49
+ manifest Build or validate a production manifest
50
+ eval-intelligence Run adversarial Intelligence Core evaluation
51
+
52
+ The CLI never grants approval or opens a pull request by itself. User review
53
+ and explicit repository side-effect confirmation remain separate gates.
54
+ `);
55
+ }
56
+
57
+ const [command, ...args] = process.argv.slice(2);
58
+ if (!command || command === "help" || command === "--help" || command === "-h") {
59
+ printHelp();
60
+ process.exit(0);
61
+ }
62
+
63
+ const script = PYTHON_COMMANDS[command];
64
+ if (!script) {
65
+ console.error(`Unknown MotionLoom command: ${command}`);
66
+ printHelp();
67
+ process.exit(2);
68
+ }
69
+
70
+ const executable = script.endsWith(".sh") ? "bash" : PYTHON;
71
+ const result = spawnSync(executable, [resolve(ROOT, script), ...args], {
72
+ cwd: ROOT,
73
+ stdio: "inherit",
74
+ env: process.env,
75
+ });
76
+
77
+ if (result.error) {
78
+ console.error(`MotionLoom could not start ${executable}: ${result.error.message}`);
79
+ process.exit(2);
80
+ }
81
+ process.exit(result.status ?? 1);
@@ -0,0 +1,78 @@
1
+ # MotionLoom Browser Review — End-to-End Runbook
2
+
3
+ This runbook defines the controlled path from a rendered scene to a user-approved, local-only confirm-to-PR commit. The Dev Lab is a mandatory post-render handoff, not a separate skill or autonomous approval agent.
4
+
5
+ ## Contract
6
+
7
+ > A scene is not ready for PR until the exact browser-review candidate has been opened, the reviewer has inspected the runtime checkpoints, every checklist item has been explicitly selected, `review.json` has been persisted, and the context-bound quality gate has passed.
8
+
9
+ The candidate is bound to the task ID, scene ID, source checksum, project-context checksum, reviewer identity and expiry timestamp. The quality gate rejects stale or foreign evidence. `OPEN_PR=0` is the safe default: confirm-to-PR creates a local commit only and never pushes or opens a pull request implicitly.
10
+
11
+ ## Operational sequence
12
+
13
+ From the repository root, prepare the task lifecycle with the official report CLI, render the scene, and stage the candidate through `review-hook.py prepare`. The resulting URL must include the candidate ID, artifact base and task base; do not replace it with a hand-written URL.
14
+
15
+ Open the candidate URL in the internal browser Dev Lab. Inspect the runtime at frames **0, 50 and 100**. Then select every checklist input explicitly. A checklist row being visible is not approval; the Dev Lab intentionally starts every input unchecked. Click **Confirm review** only after the user has approved the inspected candidate.
16
+
17
+ Persist the browser decision and run the gates in this order:
18
+
19
+ ```bash
20
+ TASK_DIR=artifacts/<task-id>
21
+ SCENE=<scene-id>
22
+ CONTEXT=artifacts/<task-id>/project-context.json
23
+
24
+ python3 scripts/report.py review \
25
+ --task-dir "$TASK_DIR" \
26
+ --decision approved \
27
+ --reviewer user \
28
+ --candidate-id <candidate-id> \
29
+ --notes "Approved after inspecting frames 0, 50 and 100." \
30
+ --feedback "All checklist checks passed."
31
+
32
+ python3 scripts/review-hook.py validate \
33
+ --task-dir "$TASK_DIR" \
34
+ --require-approved
35
+
36
+ python3 scripts/quality-gate.py \
37
+ --scene "$SCENE" \
38
+ --context "$CONTEXT" \
39
+ --task-dir "$TASK_DIR" \
40
+ --require-browser-review
41
+
42
+ python3 scripts/report.py transition --task-dir "$TASK_DIR" --state validated
43
+ python3 scripts/report.py transition --task-dir "$TASK_DIR" --state ready_for_pr
44
+ python3 scripts/report.py check --task-dir "$TASK_DIR"
45
+
46
+ CONTEXT_PATH="$CONTEXT" TASK_DIR="$TASK_DIR" OPEN_PR=0 \
47
+ bash scripts/pr.sh "$SCENE" "feat(animation): approved scene in Dev Lab"
48
+ ```
49
+
50
+ After `pr.sh` returns the local commit SHA, record the final task state explicitly:
51
+
52
+ ```bash
53
+ python3 scripts/report.py transition \
54
+ --task-dir "$TASK_DIR" \
55
+ --state confirmed \
56
+ --commit-sha <local-commit-sha>
57
+ ```
58
+
59
+ Do not set `OPEN_PR=1` unless the user separately requests a real push and pull request. A local-only confirmation is the default evidence boundary for this workflow.
60
+
61
+ ## Evidence expected in the task bundle
62
+
63
+ | Artifact | Purpose |
64
+ | --- | --- |
65
+ | `task.json` | Lifecycle state, scene, project and context identity. |
66
+ | `browser-review.json` | Candidate identity, expiry, source/context hashes and approval status. |
67
+ | `review.json` | User decision, reviewer, timestamp, notes and candidate binding. |
68
+ | `quality-report.json` | Quality gate status and acceptance checks. |
69
+ | `execution-report.json` | Completed, verified, unresolved and next-agent evidence. |
70
+ | `REPORT.md` | Human-readable report generated from the task ledger. |
71
+ | `browser-observation.md` | Durable record of inspected runtime checkpoints and browser safety events. |
72
+ | `artifact-manifest.json` | SHA-256 inventory for task artifacts. |
73
+
74
+ ## Verified reference run
75
+
76
+ The professional execution fixture is `artifacts/professional-review-e2e/`. It used scene `browser-review-smoke`, candidate `88a2f2f18ba45a07f56e`, and local commit `74a9ea6` on branch `fix/browser-review-smoke`. The candidate was inspected at frames 0, 50 and 100. The first confirm attempt was rejected because the checklist inputs were not selected; after all four checks were explicitly selected and the user confirmed, the browser review was approved.
77
+
78
+ The acceptance side of this run is covered by `test_approved_browser_review_e2e_contract` in `tests/scripts/run_tests.py`. That test copies the task into a clean temporary root and re-runs candidate validation, the context-bound quality gate and the confirmed-task report contract.
@@ -0,0 +1,16 @@
1
+ # Animation Category Taxonomy
2
+
3
+ Every request must be classified into exactly one category before generation. The category determines the framework shortlist, the default duration/FPS/loop contract, and the rigging approach.
4
+
5
+ | Category | Key signals | Contract |
6
+ |---|---|---|
7
+ | ui-micro | button, toggle, toast, hover, focus, feedback | 0.2–0.6 s, 60 fps, no loop, ease-in-out |
8
+ | loading | spinner, skeleton, progress, shimmer | 0.8–1.5 s, loop true, dotLottie |
9
+ | hero-scene | marketing, landing, camera push/pan/tilt | 2–8 s, camera motion, optional state machine |
10
+ | character-body | avatar, mascot, idle/walk/emote | cutout rig, 30 fps, loop true, parent-first bone order |
11
+ | icon-animation | glyph reveal, state change, path draw | ≤0.8 s, path-draw or morph, theme slot bound |
12
+ | scroll-linked | parallax, pin, scroll progress | GSAP ScrollTrigger, scrub |
13
+ | data-viz | charts, counters, transitions | tweened values, accessible reduced-motion alternative |
14
+ | 3d-scene | model turntable, shader, WebGL | threejs/R3F, ≤60 fps, memory budget |
15
+
16
+ When a request spans categories (e.g., a hero with an animated character), decompose it: the character body becomes a `character-body` scene, the surrounding motion a `hero-scene`, and the Dev Lab composes both.
@@ -0,0 +1,31 @@
1
+ # Dev Lab Quality Checklist
2
+
3
+ A scene is only ready for the confirm-into-PR step when every item below passes. The Dev Lab UI renders this checklist live against the active scene, and CI re-runs it on every PR.
4
+
5
+ ## Motion correctness
6
+ - [ ] The implemented animation matches `motion-spec.json` exactly: duration, easing, loop, interactivity and reduced-motion policy.
7
+ - [ ] Easing uses a canonical name from the easing canon (no invented bezier constants without comment).
8
+ - [ ] Bone rotations follow parent-first order; no child rotates before its parent (body rigs).
9
+ - [ ] No frame pops at loop seam — first and last frames are visually continuous (looping scenes).
10
+
11
+ ## Brand binding
12
+ - [ ] Primary/accent colors come from `project-context.json` (or an explicit user override recorded in the spec).
13
+ - [ ] Theme slots are used for every user-tunable color, never hardcoded hex inside the animation payload.
14
+
15
+ ## Performance
16
+ - [ ] File size within budget (UI ≤300 KB, hero ≤1500 KB for Lottie).
17
+ - [ ] Layer count ≤80.
18
+ - [ ] Runtime snapshot frames at 0/50/100% render in <3 s each on CI; placeholder frames are rejected.
19
+
20
+ ## Accessibility
21
+ - [ ] `prefers-reduced-motion` honored: looping decorations pause; essential motion reduces to a single crossfade.
22
+ - [ ] Lottie players carry `role="img"` plus a descriptive `aria-label`.
23
+
24
+ ## Source traceability
25
+ - [ ] Every geometric asset references an authoritative source (`assets/library/` or the host project) — flagged if invented.
26
+ - [ ] `manifest.json` records framework, source path, license note, spec hash, and completed checklist entries.
27
+
28
+ ## PR readiness
29
+ - [ ] Snapshot PNGs exist for 0/50/100%.
30
+ - [ ] `motion-spec.json` is bound to the exact `project-context.json` hash (implements == planned).
31
+ - [ ] Dev Lab URL tested on mobile viewport and desktop.
@@ -0,0 +1,22 @@
1
+ # MotionLoom Deep Audit — Working Notes
2
+
3
+ ## Confirmed findings
4
+
5
+ - The tracked browser-review smoke bundle is discoverable by `report-contract.py`, but its execution report still says `review_required`, retains the initial pending placeholder, and contains duplicate pending browser-review next-agent entries even though the candidate and review artifact are approved.
6
+ - The tracked smoke task points `context_path` at `/tmp/animation-review-context.json`, so a clean checkout cannot reproduce the report bundle without an external transient file.
7
+ - `review-hook.py` verifies a manifest source is inside `src/output`, but does not yet require it to remain inside the selected scene directory; a scene manifest could therefore bind another scene's source.
8
+ - `review-hook.py validate` computes the expected context hash differently from `prepare` when a spec has no context binding, creating an inconsistent fallback path.
9
+ - `pr.sh` validates the scene and review candidate but does not require `TASK_DIR` to be inside the repository or stage the task/report bundle with the scene, so a PR can omit the evidence that the gate just consumed.
10
+ - Runtime evidence has run identity and framework status, but the report is not yet cryptographically bound to a scene/source/manifest identity; a same-framework evidence file could be copied between scenes if the manifest path is changed.
11
+ - The first runtime-evidence quality-gate path referenced `source_sha` before its later assignment; Python's function-local import semantics made this an `UnboundLocalError` for Rive/GSAP/Framer Motion scenes. The branch now computes shared source and manifest hashes before evidence validation and has regression coverage for fresh and stale evidence.
12
+
13
+ ## Audit direction
14
+
15
+ Prioritize provenance and PR-handoff hardening before adding more runtime features. The Dev Lab artifact-backed mode is implemented and should remain honest: demo catalog fallback is acceptable only when no `artifact_base` is supplied, while browser-review candidates must use the real artifact bundle.
16
+
17
+ ## Remediation status
18
+
19
+ - [x] Scene confinement, candidate expiry, task/candidate identity and duplicate review handoff entries are hardened.
20
+ - [x] `pr.sh` requires an in-repository task bundle, matching `task.scene`, semantic report validation and evidence staging.
21
+ - [x] Runtime evidence records `run_id`, scene, source checksum and manifest checksum; quality gate rejects stale or mismatched files.
22
+ - [x] A regression test covers both accepted evidence and stale manifest rejection.
@@ -0,0 +1,26 @@
1
+ # Framework Selection Matrix
2
+
3
+ The selection rule is deterministic: bind first to the host project's existing stack (from `project-context.json`), then to the category's optimal runtime, then fall back in the order below. The goal is zero new runtime dependencies per delivered scene unless the category demands it.
4
+
5
+ | Category | Primary | Secondary | Fallback | Notes |
6
+ |---|---|---|---|---|
7
+ | ui-micro | framer-motion | gsap | css | Use when React present; pure CSS for hover-only states |
8
+ | loading | lottie (dotLottie) | framer-motion | css | Embedded assets + theming slots; loop true |
9
+ | hero-scene | lottie (dotLottie) | gsap | threejs | dotLottie state machines for scroll+hover interactivity |
10
+ | character-body | lottie (dotLottie) | spine | — | Spine runtimes free but require a Spine license policy note |
11
+ | icon-animation | lottie | framer-motion | css | Path-draw reveals; ≤200 KB target |
12
+ | scroll-linked | gsap | framer-motion | — | ScrollTrigger; `toggleActions` over manual listeners |
13
+ | data-viz | gsap | framer-motion | threejs | Numbers: GSAP `to()` with `innerText` plugin pattern |
14
+ | 3d-scene | threejs | — | — | React Three Fiber when React present |
15
+
16
+ ## License discipline
17
+
18
+ Lottie/dotLottie (MIT) and Anime.js (MIT) are safe defaults for any commercial product. GSAP's core is free but large-scale commercial deployments should verify the license tier; never bundle GSAP Club plugins without a license file in the repo. Spine runtimes integrate free of charge, but end users of your software need their own Spine license — record this in the scene manifest under `license_note`. Rive runtimes are free (Apache-2.0) with the Rive editor subject to its own terms.
19
+
20
+ ## Why dotLottie over raw JSON
21
+
22
+ The dotLottie container is smaller than raw Lottie JSON, can hold multiple animations, embeds images and fonts, and adds state machines and theme slots (color/scalar/vector/gradient/text/image) — the canonical theming spec that keeps animations aligned with brand tokens extracted by the analyzer. Always generate `.lottie`; keep the JSON only as a debug artifact.
23
+
24
+ ## Performance budget
25
+
26
+ Every scene must ship under these limits or it fails the Dev Lab checklist: Lottie UI assets ≤300 KB (hero ≤1500 KB), ≤80 layers, 60 fps standard (30 fps acceptable for body rigs), and durations ≤2 s for UI / ≤8 s for scenes. The snapshot renderer enforces these at PR time via CI (see `.github/workflows/quality.yml`).
@@ -0,0 +1,37 @@
1
+ # Project Manifest
2
+
3
+ `project-manifest.json` lives in the root of the host project (or is auto-generated by `scripts/analyze.sh`). It is the authoritative voice of the project that the skill must bind to. When the manifest is missing, the analyzer infers values from `package.json`, Tailwind/CSS tokens, and README — and flags the inferred values as *assumptions* that the user should confirm in the Dev Lab.
4
+
5
+ ```jsonc
6
+ {
7
+ "name": "my-app",
8
+ "description": "One-line product pitch the animations must reinforce",
9
+ "brand": {
10
+ "primary": "#2563eb", // required — every generated scene binds its theme slots here
11
+ "accent": "#f59e0b",
12
+ "palette": ["#2563eb", "#f59e0b", "#0f172a"],
13
+ "fonts": ["Inter", "Space Grotesk"]
14
+ },
15
+ "motion_language": {
16
+ "easing": "ease-in-out", // project-wide default easing
17
+ "ui_duration_ms": 300, // project-wide UI motion budget
18
+ "hero_duration_s": 4,
19
+ "camera": "push-in"
20
+ },
21
+ "stack": {
22
+ "framework": "lottie", // preferred runtime: lottie | rive | gsap | framer-motion | threejs
23
+ "react": true
24
+ },
25
+ "rules": { // hard constraints the agent must never violate
26
+ "no_flash": true,
27
+ "reduced_motion_required": true,
28
+ "max_file_kb": 300
29
+ },
30
+ "asset_sources": { // where authoritative geometry lives
31
+ "library": "assets/library/",
32
+ "project_svgs": ["src/assets/icons/"]
33
+ }
34
+ }
35
+ ```
36
+
37
+ The analyzer writes `project-context.json` inside the host project by merging this manifest with what it reads from the filesystem; the generator then binds each scene's `motion-spec.json` to the exact context hash, so any drift (for example, someone changed the brand color) is caught at PR time.
@@ -0,0 +1,224 @@
1
+ # MotionLoom Intelligence Roadmap
2
+
3
+ ## Kết luận điều hành
4
+
5
+ MotionLoom hiện đã vượt qua mức “skill chứa prompt và template”. Repo đã có lifecycle, source binding, runtime evidence, browser review, quality gate, report contract và confirm-to-PR an toàn. Tuy nhiên, phần lớn “trí thông minh” hiện vẫn nằm trong **quy tắc kiểm tra và artifact rời**, chưa nằm trong một mô hình chung để Agent suy luận xuyên suốt dự án.
6
+
7
+ Định hướng đúng tiếp theo không phải là thêm thật nhiều framework animation. MotionLoom nên trở thành một **evidence-driven animation compiler cho Agent**: đọc dự án, chuyển intent thành motion specification có cấu trúc, chọn capability dựa trên evidence, tạo artifact, kiểm chứng runtime, giải thích sai lệch, đề xuất cách sửa và chỉ cho phép handoff khi toàn bộ chuỗi bằng chứng còn hợp lệ.
8
+
9
+ > **Mục tiêu:** Agent không chỉ tạo được animation; Agent phải chứng minh animation đó đúng với dự án, đúng nguồn, đúng runtime, đúng accessibility policy và đúng quyết định của reviewer.
10
+
11
+ ## 0. Trạng thái triển khai v0.1
12
+
13
+ Milestone **Intelligence Core v0.1 đã được triển khai ở lớp trust core**. CLI `scripts/intelligence.py` hiện tạo và validate `project-graph.json`, `provenance.json`, `capability-registry.json`, `motion-ir.json` và `replay-bundle.json`. Quality gate có thể chạy strict với `--require-intelligence`; CI luôn validate capability registry và yêu cầu task bundle đầy đủ cho changed scene. Eval runner `scripts/eval-intelligence.py` hiện chạy bảy case deterministic/adversarial trên clean temporary root.
14
+
15
+ Phạm vi này chứng minh **artifact relationship, provenance, capability freshness/integrity và replay tamper detection**. Nó chưa phải semantic motion lint, chưa phải recommendation engine và chưa phải MCP server. Những phần đó được giữ ở P1/P2 để không biến heuristic thành acceptance truth trước khi có benchmark đủ mạnh.
16
+
17
+ ### 0.2 Trust-boundary hardening — 1.8.0
18
+
19
+ Milestone **1.8.0 đã hoàn tất và được merge vào `main`**. Deep audit và regression coverage hiện bảo vệ browser-review lifecycle, report bundle selection, task-root/symlink boundaries, capability evidence paths, provenance attestation paths và deterministic replay binding. Dev Lab artifact intake cũng kiểm tra same-origin, task/scene/candidate identity và browser-review expiry trước khi cho phép staging review.
20
+
21
+ Audit này không tuyên bố hệ thống đã có cryptographic trust anchor bên ngoài repository. Các guard hiện tại là deterministic repository/runtime checks; approval vẫn chỉ đến từ review artifact hợp lệ và user consent.
22
+
23
+ ### 0.3 Evidence interoperability và runtime observability — 1.9.0
24
+
25
+ Milestone **1.9.0 đã hoàn tất ở lớp internal evidence interoperability**. Runtime adapter thật ghi `runtime-telemetry.json` tại các scrub point với RAF timing, runtime state hashes và binding tới task, scene, source, manifest và Motion IR. `scripts/evidence-verifier.py` cung cấp verifier read-only với stable JSON result, age/path/symlink guards, cross-task identity checks, tamper detection và invariant `approval: false`.
26
+
27
+ CI và quality gate đã có capture/verify sequence cùng cờ `--require-telemetry`; report collection và handoff quảng bá verifier report, runtime evidence và telemetry. Dev Lab hiển thị telemetry/verifier/benchmark trong evidence rail và khóa confirm khi integrity hoặc identity binding chưa pass. Đây là integrity contract nội bộ, chưa phải signed DSSE/in-toto trust anchor bên ngoài repository.
28
+
29
+ ### 0.4 Signed attestation và trust anchor — 2.0.0
30
+
31
+ Milestone **2.0.0 đã hoàn tất ở lớp signed evidence interoperability**. `scripts/attestation.py` tạo statement canonical từ scene/task bytes, đóng gói DSSE-compatible envelope và ký Ed25519; `scripts/attestation-verifier.py` là verifier độc lập với stable exit codes, trust-policy lookup, validity/rotation/revocation checks và fail-closed semantics. `approval` luôn là `false`.
32
+
33
+ Quality gate và report contract có `--require-attestation`; CI tạo fixture key ephemeral cho verification plumbing, còn production trust anchor/key material phải được quản lý ngoài source repository. Eval corpus và regression harness bao phủ clean path, payload tamper, binding mismatch, revoked signer và unknown signer. Đây là chữ ký xác nhận integrity/identity của evidence, không phải user approval hay quyền mở PR.
34
+
35
+ ## 1. Baseline hiện tại và khoảng trống cần giải quyết
36
+
37
+ | Lớp | Đã có | Khoảng trống chính | Hậu quả nếu chưa xử lý |
38
+ | --- | --- | --- | --- |
39
+ | Skill discovery | `SKILL.md`, `agent-card.json`, capability registry v0.1 | Chưa có refresh service và compatibility matrix theo từng browser/library release | Registry tốt hơn flat flags nhưng cần CI refresh có policy và diff review |
40
+ | Project awareness | `project-context.json`, context hash, task binding, `project-graph.json` | Graph chưa có semantic constraint nodes và multi-scene supersedes đầy đủ | Agent đã có index quan hệ nhưng chưa suy luận continuity sâu |
41
+ | Motion reasoning | `motion-spec.json`, `motion-ir.json`, analyzer/spec pipeline | Semantic lint và compiler intent → adapter plan chưa hoàn chỉnh | Intent phức tạp vẫn cần policy/profile và human review |
42
+ | Provenance | Source binding, artifact manifest, `provenance.json`, DSSE-compatible signed attestation, Ed25519 trust policy, read-only external verifiers | Chưa có managed key distribution/rotation service và remote transparency log | Chữ ký đã tách khỏi hash-only integrity; vận hành trust anchor vẫn cần secret management và policy distribution phù hợp |
43
+ | Runtime | Adapter thật cho Rive, GSAP, Framer Motion; runtime evidence và scrub-point telemetry | Chưa có adapter interface chung và compatibility matrix theo browser/library/version | Telemetry đã so sánh được integrity/runtime state, nhưng compatibility history vẫn cần chuẩn hóa |
44
+ | Quality | Schema validation, quality gate, browser review | Semantic lint và continuity checks còn mỏng | File hợp lệ về cấu trúc nhưng vẫn sai nhịp, sai intent hoặc phá UX |
45
+ | Review loop | Dev Lab, checklist, `review.json`, expiry/replay protection | Feedback chưa được chuyển thành root-cause/fix-plan có thể chạy lại | Agent thường rerender toàn scene thay vì sửa đúng nguyên nhân |
46
+ | Evaluation | Regression scripts, E2E contract và bảy adversarial eval cases | Chưa có benchmark prompt/context đa dạng và aggregate historical metrics | Chưa đủ dữ liệu để khẳng định capability selection trên nhiều dự án |
47
+ | Agent integration | CLI, `SKILL.md`, stable JSON errors và side-effect metadata | Chưa có typed resources/tools qua MCP | Host Agent vẫn cần gọi CLI trực tiếp thay vì discover protocol |
48
+
49
+ ## 2. Kiến trúc đích: Motion Graph + Evidence Chain
50
+
51
+ ### 2.1 Canonical Project Motion Graph
52
+
53
+ Tạo một representation duy nhất, ví dụ `project-graph.json`, thay vì để Agent suy luận từ những file không liên kết. Graph nên có các node `project`, `intent`, `constraint`, `asset`, `source`, `scene`, `motion_spec`, `runtime`, `artifact`, `evidence`, `review` và `decision`. Các edge quan trọng gồm `derived_from`, `uses`, `constrained_by`, `rendered_by`, `verified_by`, `reviewed_as`, `supersedes` và `blocked_by`.
54
+
55
+ Graph không thay thế các artifact hiện có. Nó là **index có hash và quan hệ**, giúp Agent trả lời được những câu hỏi có tính quyết định: scene này phục vụ intent nào, dùng asset nào, source authority là gì, runtime evidence được tạo bởi adapter/version nào, review nào đã phê duyệt và artifact nào đã trở nên stale sau khi context đổi.
56
+
57
+ ### 2.2 Provenance chain theo từng bước
58
+
59
+ `artifact-manifest.json` hiện đã là inventory checksum tốt, nhưng chưa phải provenance attestation hoàn chỉnh. Nên bổ sung `provenance.json` theo hướng tương thích với các khái niệm `subject`, `materials`, `build definition`, `builder` và `resolved dependencies` của SLSA [1], đồng thời mô hình hóa chuỗi step/actor/material/product theo in-toto [2].
60
+
61
+ Mỗi step phải ghi tối thiểu:
62
+
63
+ | Trường | Ý nghĩa |
64
+ | --- | --- |
65
+ | `step_id`, `step_type` | Ví dụ `analyze`, `spec`, `source-bind`, `render`, `runtime-test`, `browser-review`, `quality-gate` |
66
+ | `actor` | Agent, user, CI hoặc runtime adapter đã thực hiện step |
67
+ | `builder` | Toolchain, version, browser và môi trường thực thi |
68
+ | `materials[]` | Input path/URI, resolved version và SHA-256 |
69
+ | `products[]` | Output path, type và SHA-256 |
70
+ | `policy` | Rule set/schema/quality policy được áp dụng |
71
+ | `started_at`, `finished_at` | Khoảng thời gian của step |
72
+ | `result` | `pass`, `fail`, `blocked` hoặc `needs_review` |
73
+ | `parent_attestation` | Liên kết step trước để tạo chain, không chỉ danh sách file |
74
+
75
+ MotionLoom hiện dùng hash chain nội bộ cùng DSSE-compatible envelope và SLSA/in-toto-inspired statement. Private key không nằm trong artifact bundle; trust policy phải công bố key lifecycle, validity, revocation và fail-closed behavior. Chữ ký không được nâng `approval` hoặc thay thế browser review/user consent.
76
+
77
+ ### 2.3 Capability Registry v2
78
+
79
+ `agent-card.json` nên chuyển từ danh sách capability sang registry có dữ liệu vận hành. Mỗi capability cần có `id`, `kind`, `status`, `adapter_version`, `supported_inputs`, `supported_outputs`, `browser_matrix`, `evidence`, `last_verified_at`, `limitations`, `fallback` và `risk_level`.
80
+
81
+ Agent chỉ được chọn capability nếu capability đó thỏa ba điều kiện: input/intent tương thích, evidence chưa quá cũ và runtime/browser hiện tại nằm trong compatibility matrix. `scaffold-only` phải là trạng thái không được dùng cho production trừ khi user chủ động chấp thuận một exception được ghi trong report.
82
+
83
+ ### 2.4 Motion IR và semantic lint
84
+
85
+ Giữa project intent và framework adapter cần có một **Motion Intermediate Representation** độc lập framework. Motion IR nên mô tả target, property, keyframes hoặc spring, duration, delay, easing, loop, interaction trigger, reduced-motion behavior, performance budget, continuity reference và acceptance assertions.
86
+
87
+ Semantic lint phải kiểm tra ít nhất bốn lớp:
88
+
89
+ | Lớp lint | Ví dụ rule |
90
+ | --- | --- |
91
+ | Intent | Motion emphasis phải có target và reason; “subtle” không được map thành scale quá lớn |
92
+ | UX/accessibility | Có reduced-motion fallback; keyboard/assistive action không bị khóa bởi animation |
93
+ | Continuity | ID, state, asset anchor và initial pose không đứt giữa các scene liên quan |
94
+ | Runtime/performance | Không animate layout khi transform/opacity đủ dùng; duration và layer count nằm trong budget |
95
+
96
+ Lint không được giả vờ hiểu thẩm mỹ tuyệt đối. Mỗi rule phải phân loại `deterministic`, `heuristic` hoặc `human_required`, kèm confidence và evidence. Đây là ranh giới để MotionLoom không biến một phán đoán xác suất thành quality truth.
97
+
98
+ ### 2.5 Unified Runtime Adapter API
99
+
100
+ Chuẩn hóa adapter interface thành các hook: `capabilities()`, `prepare()`, `render()`, `capture()`, `assert()`, `collect_evidence()` và `cleanup()`. Rive, GSAP và Framer Motion là các adapter đầu tiên; các runtime khác chỉ được gắn nhãn verified sau khi thực hiện cùng contract.
101
+
102
+ Evidence nên chứa `adapter_id`, `adapter_version`, `browser_version`, `os`, `source_sha256`, `manifest_sha256`, `motion_ir_sha256`, `frames`, `assertions`, `status` và `replay_command`. Khi render fail, output cần trả về failure class và bước self-correction thay vì chỉ exit code.
103
+
104
+ ### 2.6 Structured review feedback loop
105
+
106
+ Dev Lab nên ghi feedback thành `fix-plan.json`, không chỉ `notes` tự do. Một fix plan tối thiểu gồm `issue_id`, `category`, `severity`, `observed_at`, `evidence`, `root_cause_hypotheses`, `recommended_patch`, `affected_nodes`, `rerun_scope`, `expected_delta` và `requires_user_decision`.
107
+
108
+ Ví dụ, “nhịp vào quá gấp” cần được chuyển thành `timing/easing`, trỏ tới keyframe hoặc transition cụ thể, đề xuất giảm acceleration, rerun scene + runtime evidence, và không yêu cầu rerender asset nếu source hash không đổi. Đây là điểm biến Dev Lab từ viewer thành **debugging instrument**.
109
+
110
+ ## 3. Roadmap theo thứ tự ưu tiên
111
+
112
+ ### P0 — Trust core, 0–2 tuần — **Đã hoàn thành v0.1**
113
+
114
+ P0 đã làm cho MotionLoom **khó báo PASS sai** bằng bốn schema mới: `project-graph.schema.json`, `provenance.schema.json`, `capability-registry.schema.json` và `motion-ir.schema.json`. Các command deterministic được gom trong `scripts/intelligence.py` để giữ một entrypoint ổn định cho Agent và CI.
115
+
116
+ Eval corpus v0.1 nằm ở `tests/evals/intelligence-cases.json` và runner `scripts/eval-intelligence.py`, bao phủ verified selection, scaffold-only block, stale/tampered capability evidence, graph corruption, replay tamper và foreign-task candidate. P1 cần mở rộng corpus lên prompt/context đa dạng, multi-scene và semantic intent.
117
+
118
+ **Definition of done P0:** Đạt trong suite hiện tại: candidate/task binding bị reject khi sai; scaffold-only không được chọn; capability evidence stale/tampered bị reject; graph edge hỏng bị reject; replay artifact bị sửa bị reject; quality gate strict kiểm tra graph/provenance/Motion IR/replay cùng browser evidence.
119
+
120
+ ### P1 — Reasoning core, 2–6 tuần
121
+
122
+ P1 xây compiler từ project graph + intent → Motion IR → adapter plan. Agent phải xuất ra `decision-log.jsonl` với lý do chọn runtime, nguồn asset, trade-off, confidence và câu hỏi cần user quyết định. Thêm semantic lint và policy profiles theo loại sản phẩm: `ui`, `character`, `marketing`, `game`, `accessibility-first`.
123
+
124
+ Tại giai đoạn này nên đưa `fix-plan.json` vào Dev Lab. Khi reviewer request changes, Agent nhận issue có thể định vị và chạy lại một phần pipeline. Không cần thêm runtime mới nếu ba adapter hiện tại chưa đạt replay/compatibility matrix ổn định.
125
+
126
+ **Definition of done P1:** với cùng một context, Agent chọn capability đúng trong benchmark; mọi quyết định heuristic có confidence và evidence; reviewer feedback có thể chuyển thành patch plan; rerun scope không làm stale artifact ngoài phạm vi.
127
+
128
+ ### P2 — Protocol and ecosystem, 6–10 tuần — **Đã hoàn tất lớp 2.0.0; còn visual/benchmark extensions**
129
+
130
+ Sau khi core contracts ổn định, expose MotionLoom qua typed CLI trước, sau đó thêm MCP adapter nếu cần interoperability. Theo MCP, resources nên đại diện cho context/task/artifact; prompts hoặc workflow resources đại diện cho playbook; tools đại diện cho prepare, render, inspect, validate và confirm với output schema rõ ràng [4]. Tool execution errors phải actionable để Agent tự sửa, nhưng các side effect như remote push/open PR vẫn phải giữ human-in-the-loop [4].
131
+
132
+ Mỗi tool cần khai báo `side_effect_level`: `read`, `local_write`, `user_review_required`, `remote_write`. `confirm-to-PR` chỉ được gọi khi có approval authority còn hạn, task identity khớp và quality gate đã pass. Không mở quyền remote write chỉ vì Agent đã nhìn thấy một artifact `approved` cũ.
133
+
134
+ **Definition of done P2:** host Agent có thể discover capability, lấy resource đúng task, gọi tool typed, nhận lỗi có hướng tự sửa, và không thể gọi remote write khi thiếu approval authority.
135
+
136
+ Signed attestation 2.0.0 đã hoàn tất trước khi mở rộng protocol: statement canonical, Ed25519 signing, trust policy, external verification, CI/gate/report integration và adversarial coverage đều đã có. Khoảng trống kế tiếp là **visual comparison contract** có dataset fixture được gắn provenance và **benchmark history** append-only; cả hai phải giữ review-first, không biến metric thành approval.
137
+
138
+ ### P3 — Scale and learning, sau 10 tuần
139
+
140
+ P3 thu thập aggregate metrics từ eval và các task thực tế đã được user cho phép. Feedback phải dùng để cải thiện rule, adapter và prompt contract theo phiên bản; không tự động dùng reviewer feedback làm “training truth” nếu chưa được normalize và kiểm duyệt.
141
+
142
+ Có thể thêm recommendation engine cho runtime/asset, nhưng recommendation phải trả về alternatives, reason, confidence, evidence age và cost/risk. Không nên biến một score nội bộ thành quyết định tự động không thể giải thích.
143
+
144
+ ## 4. Metrics phải đo từ đầu
145
+
146
+ | Metric | Cách đo | Mục tiêu ban đầu |
147
+ | --- | --- | --- |
148
+ | Acceptance precision | Tỷ lệ artifact được gate PASS và thực sự không có blocker khi reviewer kiểm tra | ≥ 95% trên eval set có nhãn |
149
+ | False approval rate | Tỷ lệ artifact bị quality/review gate cho PASS dù adversarial case phải fail | 0% cho P0 safety rules |
150
+ | Provenance completeness | Tỷ lệ node/step có materials, products, actor, policy và hash hợp lệ | ≥ 98% |
151
+ | Context retention | Tỷ lệ case Agent giữ đúng project constraints và source authority | ≥ 95% |
152
+ | Capability selection accuracy | Tỷ lệ chọn đúng adapter theo intent/input/browser matrix | ≥ 95% |
153
+ | Replay success | Tỷ lệ clean replay đạt cùng hashes hoặc trong tolerance đã khai báo | ≥ 98% |
154
+ | Fix localization | Tỷ lệ review issue dẫn đến rerun đúng subset thay vì rerender toàn bộ | ≥ 80% ở P1 |
155
+ | Handoff completeness | Agent mới chạy được từ `handoff.json` + artifacts mà không đọc chat cũ | 100% trong CI |
156
+ | Reviewer burden | Số thao tác/checklist và thời gian từ candidate đến quyết định | Giảm dần, không đánh đổi safety |
157
+ | Time-to-fix | Thời gian từ `changes_requested` đến evidence pass tiếp theo | Đo baseline trước, tối ưu sau |
158
+
159
+ Không dùng một “quality score” tổng hợp làm acceptance truth. Deterministic checks, runtime assertions và human review phải tách riêng; score chỉ dùng để ưu tiên điều tra.
160
+
161
+ ## 5. Cấu trúc repo nên hướng tới
162
+
163
+ ```text
164
+ MotionLoom/
165
+ ├── SKILL.md # Activation contract ngắn, progressive disclosure
166
+ ├── agent-card.json # Discovery metadata và capability index
167
+ ├── schemas/
168
+ │ ├── project-graph.schema.json
169
+ │ ├── provenance.schema.json
170
+ │ ├── capability-registry.schema.json
171
+ │ ├── motion-ir.schema.json
172
+ │ ├── fix-plan.schema.json
173
+ │ └── ...
174
+ ├── scripts/
175
+ │ ├── intelligence.py # graph/provenance/capability/Motion IR/replay
176
+ │ ├── eval-intelligence.py # deterministic adversarial eval runner
177
+ │ ├── lint-motion.py # P1 semantic lint placeholder
178
+ │ └── ...
179
+ ├── references/
180
+ │ ├── motion-ir.md
181
+ │ ├── capability-policy.md
182
+ │ ├── provenance-policy.md
183
+ │ └── runtime-adapter-contract.md
184
+ ├── tests/evals/
185
+ │ ├── intelligence-cases.json
186
+ │ └── ...
187
+ ├── artifacts/
188
+ │ └── <task-id>/
189
+ │ ├── project-graph.json
190
+ │ ├── provenance.json
191
+ │ ├── decision-log.jsonl
192
+ │ ├── fix-plan.json
193
+ │ └── ...
194
+ └── dev-lab/
195
+ └── ...
196
+ ```
197
+
198
+ ## 6. Những việc không nên làm ngay
199
+
200
+ Không nên thêm Spine, Three.js hoặc nhiều AI generation backend trước khi adapter contract, replay và capability registry đã ổn định. Một danh sách framework dài không tạo ra intelligence nếu Agent không biết runtime nào đã được verify trong môi trường hiện tại.
201
+
202
+ Không nên dùng LLM judge làm quality gate duy nhất. Judge có thể hỗ trợ triage hoặc gợi ý, nhưng acceptance phải dựa trên schema, hash, runtime assertion, policy và human review có bằng chứng.
203
+
204
+ Không nên ký provenance vội khi field semantics còn thay đổi. Hãy version schema, chạy migration và xác định trust boundary trước; chữ ký trên metadata không chính xác chỉ tạo cảm giác an toàn giả.
205
+
206
+ Không nên đưa toàn bộ runbook vào `SKILL.md`. Agent Skills khuyến nghị progressive disclosure và giới hạn phần body chính dưới khoảng 500 dòng [5]. MotionLoom nên giữ activation contract ngắn, còn framework rules và long-form references để trong `references/`.
207
+
208
+ ## 7. Việc nên làm ngay ở milestone kế tiếp
209
+
210
+ Milestone 2.0.0 đã hoàn tất phần **signed evidence integrity** trên nền 1.9.0. Không nên thêm framework theo số lượng. Ưu tiên tiếp theo là asset/frame-level visual comparison có dataset được gắn nhãn nguồn gốc, benchmark history append-only và aggregate metrics theo project/context/framework; trust anchor vận hành cần secret management/rotation thực tế bên ngoài repository.
211
+
212
+ Trình tự triển khai cụ thể là: version visual-comparison schema và labeled fixtures; thêm pixel/perceptual hash checks với dataset drift guards; ghi append-only benchmark runs và outlier detection; sau đó tích hợp review rail vào Dev Lab. Mỗi milestone phải giữ nguyên nguyên tắc: evidence có hash và identity, failure có stable exit code, heuristic/metric/chữ ký không tự thành approval, và side effect GitHub luôn cần explicit confirmation.
213
+
214
+ ### References
215
+
216
+ [1]: <https://slsa.dev/spec/v1.0/provenance> — SLSA Provenance v1.0.
217
+
218
+ [2]: <https://github.com/in-toto/docs/blob/master/in-toto-spec.md> — in-toto Specification 1.0.0.
219
+
220
+ [3]: <https://agentskills.io/skill-creation/evaluating-skills> — Agent Skills: Evaluating skill output quality.
221
+
222
+ [4]: <https://modelcontextprotocol.io/specification/2026-07-28/server/tools> — Model Context Protocol: Tools.
223
+
224
+ [5]: <https://agentskills.io/specification> — Agent Skills Specification.
@@ -0,0 +1,19 @@
1
+ # Attestation research notes
2
+
3
+ ## Scope
4
+
5
+ These notes preserve the external standards findings used to design MotionLoom's signed-attestation phase. They are design inputs, not a claim that MotionLoom is already SLSA- or Sigstore-conformant.
6
+
7
+ ## Verified principles
8
+
9
+ 1. SLSA defines a software attestation as an authenticated statement about a software artifact or collection of artifacts. The metadata is explicit; the signature authenticates the attestation producer rather than silently implying a quality decision. Source: <https://slsa.dev/spec/v1.2/attestation-model>.
10
+ 2. DSSE signs the pre-authentication encoding of the payload type and serialized body. The payload type must be unambiguous and the verifier must use the exact serialized body that was verified; it must not re-parse the envelope and verify one body while handing another body to the application. Source: <https://github.com/secure-systems-lab/dsse/blob/master/protocol.md>.
11
+ 3. DSSE `keyid` is an unauthenticated hint and must not be used as a security decision by itself. The verifier must establish trust using an independently configured key or trust policy. Source: <https://github.com/secure-systems-lab/dsse/blob/master/protocol.md>.
12
+
13
+ ## MotionLoom design consequences
14
+
15
+ - The signed predicate will carry artifact identity, task/scene identity, provenance chain hash, policy version and evidence hashes, but never an approval authority.
16
+ - Canonical serialization and domain separation will be explicit in the schema and verifier contract.
17
+ - Trust anchors, signer validity, revocation and key rotation will be evaluated separately from payload integrity.
18
+ - The verifier will return integrity/trust results and keep `approval: false`; only the review lifecycle can produce approval.
19
+ - The first implementation will use a local test trust anchor and deterministic fixtures. Production key custody or Sigstore integration will remain an explicit deployment boundary.
@@ -0,0 +1,56 @@
1
+ # MotionLoom Deep Audit: Trust-Boundary Hardening 1.8.0
2
+
3
+ ## Executive summary
4
+
5
+ The 1.8.0 hardening pass audited the browser-review lifecycle, Dev Lab artifact intake, report-bundle selection, task-root handling, capability evidence paths, provenance attestation paths and deterministic replay binding. The audit found several places where identity and path contracts needed to be made explicit. Those remediations are now implemented as deterministic guards and adversarial regression tests. The result is stronger protection against cross-task evidence mixing, symlink/path escape, stale or replayed browser candidates and ambiguous report selection. The changes do **not** create a cryptographic trust anchor and do not turn heuristic lint or benchmark results into approval.
6
+
7
+ ## Scope and evidence
8
+
9
+ | Area | Canonical implementation | Evidence used |
10
+ | --- | --- | --- |
11
+ | Browser review | `scripts/review-hook.py`, `scripts/report.py` | Candidate task/scene identity, reviewer identity, expiry and single-use state checks |
12
+ | Dev Lab intake | `animation-dev-lab/client/src/lib/artifact.ts`, `client/src/pages/Lab.tsx` | Same-origin bases, task/scene/candidate binding, expiry visibility and confirm blocking |
13
+ | Report selection | `scripts/report-contract.py` | Complete passing bundle selection by state, update time and task ID; ambiguous tie rejection |
14
+ | Task-root integrity | `scripts/intelligence.py` | Graph, provenance, capability and replay path/symlink guards |
15
+ | Replay | `scripts/intelligence.py replay` | `task_dir`, `task_id`, scene and recorded file containment checks |
16
+ | Regression | `tests/scripts/run_tests.py` | Foreign candidate, duplicate scene, cross-task replay, symlink artifact and external capability evidence cases |
17
+
18
+ ## Key findings and remediation
19
+
20
+ | ID | Severity before remediation | Finding | Remediation status |
21
+ | --- | --- | --- | --- |
22
+ | AUD-001 | High | A review artifact must not be reusable after expiry or after approval, and `review.json` must name the exact candidate/task. | Fixed in `report.py` and `review-hook.py`; regression covers expired and foreign candidates. |
23
+ | AUD-002 | High | Multiple passing task bundles for one scene could make evidence selection implicit or filename-dependent. | Fixed in `report-contract.py`; selection is ranked deterministically and equal state/time ties fail. |
24
+ | AUD-003 | High | Symlinked files or resolved paths outside a task bundle could enter graph, provenance or replay inventories. | Fixed in `intelligence.py`; graph/provenance/capability/replay reject symlink traversal and root escapes. |
25
+ | AUD-004 | High | A replay bundle could name a different task directory or record files from another task. | Fixed in replay capture/verify and task Intelligence validation; task directory, task ID, scene and every file are bound. |
26
+ | AUD-005 | Medium | Dev Lab query parameters could point artifact/task intake at a foreign origin or mismatched task/candidate identity. | Fixed in `artifact.ts` and `Lab.tsx`; same-origin and identity checks are surfaced and confirm staging is disabled on failure. |
27
+ | AUD-006 | Medium | Capability evidence supplied from outside the repository weakened the meaning of the registry path reference. | Fixed in `intelligence.py`; capability build and validation require repository-contained, non-symlink evidence. |
28
+
29
+ ## Remediation contract
30
+
31
+ The following rules are now part of the acceptance boundary:
32
+
33
+ 1. **Identity is explicit.** Candidate, review, task, scene, replay and report selection must agree on stable identifiers; filename order is not an identity mechanism.
34
+ 2. **Roots are enforceable.** A resolved path is accepted only when its raw path contains no symlink component and its resolved file remains inside the declared root.
35
+ 3. **Review is time-bounded and single-use.** Expired, already-approved or foreign browser candidates cannot be recorded as a new approval.
36
+ 4. **Evidence and approval remain separate.** Graphs, provenance, benchmarks, semantic warnings and Dev Lab binding status can block or request review, but none can manufacture user consent.
37
+ 5. **Side effects remain explicit.** The Dev Lab only stages a local review decision; `OPEN_PR=0` remains the default and GitHub writes require an explicit action.
38
+
39
+ ## Verification matrix
40
+
41
+ The following checks passed during the milestone:
42
+
43
+ | Check | Result |
44
+ | --- | --- |
45
+ | `python3 -m py_compile scripts/report.py scripts/intelligence.py scripts/review-hook.py scripts/report-contract.py tests/scripts/run_tests.py` | Pass |
46
+ | `python3 tests/scripts/run_tests.py` | Pass, including new hardening adversarial cases |
47
+ | Dev Lab `pnpm run build` | Pass; existing CSS parser and bundle-size warnings are non-blocking |
48
+ | Existing P0/P1 Intelligence eval and strict quality contracts | Preserved by the regression suite; full acceptance is required before release commit |
49
+
50
+ ## Residual risk
51
+
52
+ The Dev Lab is a client-side reviewer. Same-origin and identity checks prevent accidental or query-driven evidence mixing, but a browser user can still modify local client state with developer tools. The authoritative boundary therefore remains the repository-side review hook, report contract and quality gate. Provenance is hash-chain verified inside the repository but is not yet signed with DSSE/in-toto or verified by an external trust anchor. Visual/perceptual lint remains a proxy and must not be described as human visual approval.
53
+
54
+ ## Next audit target
55
+
56
+ The next roadmap milestone should add external attestation verification, runtime frame telemetry and a labeled visual-comparison benchmark. Each should begin with a threat model and schema contract before any capability is promoted in `agent-card.json`.