howone 0.1.38 → 0.1.39

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 (23) hide show
  1. package/package.json +1 -1
  2. package/templates/vite/.howone/skills/web-shader-extractor/SKILL.md +123 -0
  3. package/templates/vite/.howone/skills/web-shader-extractor/references/capture-backends.md +201 -0
  4. package/templates/vite/.howone/skills/web-shader-extractor/references/evidence-policy.md +93 -0
  5. package/templates/vite/.howone/skills/web-shader-extractor/references/operating-contract.md +82 -0
  6. package/templates/vite/.howone/skills/web-shader-extractor/references/qa-failure-policy.md +100 -0
  7. package/templates/vite/.howone/skills/web-shader-extractor/references/recon-kernel.md +206 -0
  8. package/templates/vite/.howone/skills/web-shader-extractor/references/replay-policy.md +145 -0
  9. package/templates/vite/.howone/skills/web-shader-extractor/references/shaders-com.md +212 -0
  10. package/templates/vite/.howone/skills/web-shader-extractor/references/source-analysis.md +112 -0
  11. package/templates/vite/.howone/skills/web-shader-extractor/references/surface-discovery.md +113 -0
  12. package/templates/vite/.howone/skills/web-shader-extractor/references/target-lock.md +205 -0
  13. package/templates/vite/.howone/skills/web-shader-extractor/references/three-shader-reconstruction.md +155 -0
  14. package/templates/vite/.howone/skills/web-shader-extractor/references/tool-capability-matrix.md +57 -0
  15. package/templates/vite/.howone/skills/web-shader-extractor/references/unicorn-studio.md +387 -0
  16. package/templates/vite/.howone/skills/web-shader-extractor/scripts/fetch-rendered-dom.mjs +178 -0
  17. package/templates/vite/.howone/skills/web-shader-extractor/scripts/scan-bundle.sh +80 -0
  18. package/templates/vite/.howone/skills/web-shader-extractor/templates/extraction-report.md +41 -0
  19. package/templates/vite/.howone/skills/web-shader-extractor/templates/known-gaps.md +14 -0
  20. package/templates/vite/.howone/skills/web-shader-extractor/templates/qa-report.md +74 -0
  21. package/templates/vite/.howone/skills/web-shader-extractor/templates/replay-manifest.json +147 -0
  22. package/templates/vite/.howone/skills/web-shader-extractor/templates/run-state.json +75 -0
  23. package/templates/vite/.howone/skills/web-shader-extractor/templates/scout-card.json +106 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "howone",
3
- "version": "0.1.38",
3
+ "version": "0.1.39",
4
4
  "private": false,
5
5
  "description": "HowOne command line tools for creating app templates.",
6
6
  "type": "module",
@@ -0,0 +1,123 @@
1
+ ---
2
+ name: web-shader-extractor
3
+ description: >
4
+ Use when a user gives or references a webpage URL and wants to extract,
5
+ reproduce, port, or locally replay a WebGL, WebGPU, Canvas, shader-like,
6
+ animated background, interactive 3D, or web visual effect. Locks the target
7
+ rendering surface group, records shader/resource/render graph/timing/input
8
+ evidence, builds an evidence-matched local baseline, then projectizes it.
9
+ Do not use for ordinary DOM/CSS page cloning.
10
+ ---
11
+
12
+ # Web Shader Extractor
13
+
14
+ Index for WebGL / WebGPU / Canvas rendering investigation and local replay.
15
+ Start from the target visual. Lock the surface group. Trace source or runtime facts. Build a runnable baseline. Then projectize.
16
+
17
+ ## Router Contract
18
+
19
+ This file is the index. Do not treat it as the full operating manual. Before task action, read:
20
+
21
+ - `references/operating-contract.md`
22
+ - `references/recon-kernel.md`
23
+
24
+ Then load only the focused references needed by the current state.
25
+ Keep large evidence, captures, and generated outputs out of the conversation.
26
+ Store them in the user's output directory.
27
+
28
+ ## Use This For
29
+
30
+ - Extracting a webpage WebGL, WebGPU, Canvas2D, OffscreenCanvas, shader, or animated canvas effect.
31
+ - Replaying an animated background, product shader, interactive WebGL scene, or Canvas visual locally.
32
+ - Building an evidence-matched baseline first, then an editable project.
33
+ - Investigating target-bound shader/render graph/timing/resource/input facts.
34
+
35
+ Do not use this for ordinary DOM/CSS cloning, static screenshots, generic website copying, unrelated JavaScript deobfuscation, or product UI redesign.
36
+ Use it only when the task has a shader/canvas target.
37
+
38
+ ## Core Rules
39
+
40
+ - Target-bound before framework-bound: a global Three.js, platform, or shader signature is only a hypothesis until tied to the target surface group.
41
+ - Evidence before implementation: source, runtime objects, frame captures, source maps, and public structured definitions outrank visual fitting.
42
+ - Baseline before projectization: never overwrite a verified baseline for cleanup, simplification, or native conversion.
43
+ - Honest labels: implementation-critical facts are `SOURCE`, `PARTIAL`, or `GUESS`; unlabeled values are treated as `GUESS`.
44
+ - No compensation tuning: do not adjust brightness, time, color, offsets, or noise to mask missing pipeline evidence.
45
+ - Gate artifacts are transition guards: if the required artifact is missing, incomplete, or has placeholders in gate-critical fields, the state has not advanced.
46
+ - Ask only for product scope changes or external access/permission blockers.
47
+ - Use plain records: state the fact, evidence path, current unknown, and next action. Avoid metaphor, broad claims, and unsupported conclusions.
48
+
49
+ ## State Router
50
+
51
+ Use the Recon Kernel state flow:
52
+
53
+ ```text
54
+ INTAKE -> CAPABILITY_SNAPSHOT -> QUICK_SCOUT -> SURFACE_ATTRIBUTION
55
+ -> TARGET_LOCK_GATE
56
+ - provisional/failed -> REFINE_SCOUT
57
+ - attributed -> targeted owner/backend/source probe -> TARGET_LOCK_GATE
58
+ - locked -> SCOPE_CHECK
59
+ -> TRACE_ROUTE_SELECT -> SOURCE_TRACE -> CAPTURE_MINIMUM_TRUTH
60
+ -> REPLAY_READY_GATE
61
+ - not ready -> SOURCE_TRACE / CAPTURE_MINIMUM_TRUTH
62
+ - ready -> RAW_REPLAY
63
+ -> BASELINE_RUN -> BASELINE_VERIFY
64
+ -> BASELINE_VERIFIED -> PROJECTIZE -> PROJECT_VERIFY -> PACKAGE
65
+ ```
66
+
67
+ `TARGET_LOCKED` must precede deep source/bundle work.
68
+ Before lock, only narrow source probes tied to `nextProbe` are allowed.
69
+ `REPLAY_READY` must precede implementation.
70
+ `BASELINE_VERIFIED` must precede projectization.
71
+
72
+ ## Reference Router
73
+
74
+ Load only what the current state needs:
75
+
76
+ | Need | Read |
77
+ |---|---|
78
+ | Global contract, fact labels, completion states | `references/operating-contract.md` |
79
+ | Kernel, initial protocol, state flow, autonomy, budgets | `references/recon-kernel.md` |
80
+ | Surface discovery and visual attribution | `references/surface-discovery.md` |
81
+ | Lock criteria, target-bound evidence, scope, Three.js binding | `references/target-lock.md` |
82
+ | Evidence labels, ledgers, unknown classes, sensitive data | `references/evidence-policy.md` |
83
+ | Tool capability selection | `references/tool-capability-matrix.md` |
84
+ | WebGL, WebGPU, and Canvas2D capture facts | `references/capture-backends.md` |
85
+ | Source maps, bundle slices, config, encoded definitions | `references/source-analysis.md` |
86
+ | Replay readiness, routes, baseline, stack choice, projectization | `references/replay-policy.md` |
87
+ | QA, failure routing, severity, mismatch signatures | `references/qa-failure-policy.md` |
88
+ | Three.js shader injection or TSL reconstruction | `references/three-shader-reconstruction.md` |
89
+ | Unicorn Studio target | `references/unicorn-studio.md` |
90
+ | shaders.com / TSL target | `references/shaders-com.md` |
91
+
92
+ ## Tool And Artifact Policy
93
+
94
+ Tools are replaceable capabilities, not prerequisites. First record the available capability profile:
95
+
96
+ ```text
97
+ navigate, runtime-eval, preload-script, network-metadata, network-body,
98
+ source-map, canvas-screenshot, interaction, frame-capture-webgl,
99
+ frame-capture-webgpu, local-run, multi-frame-compare
100
+ ```
101
+
102
+ Use `scripts/fetch-rendered-dom.mjs` only as an optional inventory helper when Playwright is already available.
103
+ Use `scripts/scan-bundle.sh` only on target-bound bundle slices or a precise `nextProbe`.
104
+ Script output is hypothesis evidence. It never satisfies Surface Attribution, Target Lock, Replay Ready, or QA gates by itself.
105
+
106
+ Use bundled templates as schemas, not free-form notes:
107
+
108
+ - `templates/scout-card.json`
109
+ - `templates/replay-manifest.json`
110
+ - `templates/run-state.json`
111
+ - `templates/qa-report.md`
112
+ - `templates/known-gaps.md`
113
+ - `templates/extraction-report.md`
114
+
115
+ ## Platform Adapters
116
+
117
+ Load platform references only after target-bound evidence points there:
118
+
119
+ - Unicorn Studio: `references/unicorn-studio.md`
120
+ - shaders.com / TSL: `references/shaders-com.md`
121
+ - Three.js shader injection or TSL: `references/three-shader-reconstruction.md`
122
+
123
+ If no adapter fits, follow generic WebGL, WebGPU, or Canvas2D capture in `references/capture-backends.md`.
@@ -0,0 +1,201 @@
1
+ # Capture Backends
2
+
3
+ Use after `TARGET_LOCKED`, or as a selected tactical probe while moving from `attributed` to `locked`. Capture only facts bound to the target surface group.
4
+
5
+ ## Common Rules
6
+
7
+ - Prefer public source/config or runtime objects when they are target-bound.
8
+ - Use preload hooks or frame capture when source does not expose the render graph.
9
+ - Use bundle slices only when they resolve a named unknown.
10
+ - Keep backend facts separate from replay implementation choices.
11
+ - Record every hook result as evidence. Hook hits prove only that an API was used; they do not prove the target uses that API until tied to the target surface group, owner, frame, or call path.
12
+
13
+ ## WebGL / WebGL2
14
+
15
+ Capture:
16
+
17
+ - surface CSS size, backing size, DPR, and context attributes
18
+ - vertex/fragment source or trusted source representation
19
+ - attributes, buffers, indices, instancing, or fullscreen primitive
20
+ - textures, samplers, formats, dimensions, and asset paths
21
+ - pass order, FBOs, attachments, inputs, and outputs
22
+ - viewport, scissor, clear, blend, depth, stencil, cull, alpha
23
+ - time origin/unit/delta, random, uniform updates, pointer, scroll, resize
24
+ - color space, tone mapping, premultiplied alpha, and DOM composite
25
+
26
+ Common failure cases:
27
+
28
+ - WebGL1 vs WebGL2 shader syntax
29
+ - framebuffer orientation and texture coordinate flips
30
+ - premultiplied alpha mismatch
31
+ - renderer output color space vs shader internal color space
32
+ - time measured in seconds, frames, or platform-specific increments
33
+ - hidden parent DOM transforms changing canvas coordinates
34
+
35
+ ### WebGL Preload Hook Map
36
+
37
+ Use this map when source or runtime objects do not expose enough facts. Hook only the minimum API set needed for the current unknown.
38
+
39
+ Surface and owner:
40
+
41
+ - `HTMLCanvasElement.prototype.getContext`
42
+ - `OffscreenCanvas.prototype.getContext`
43
+ - `HTMLCanvasElement.prototype.transferControlToOffscreen`
44
+
45
+ Program and shader:
46
+
47
+ - `createShader`
48
+ - `shaderSource`
49
+ - `compileShader`
50
+ - `getShaderInfoLog`
51
+ - `createProgram`
52
+ - `attachShader`
53
+ - `linkProgram`
54
+ - `getProgramInfoLog`
55
+ - `useProgram`
56
+
57
+ Uniforms:
58
+
59
+ - `getUniformLocation`
60
+ - `uniform1f` / `uniform2f` / `uniform3f` / `uniform4f`
61
+ - `uniform1i` / `uniform2i` / `uniform3i` / `uniform4i`
62
+ - `uniformMatrix*`
63
+
64
+ Geometry:
65
+
66
+ - `createBuffer`
67
+ - `bindBuffer`
68
+ - `bufferData`
69
+ - `bufferSubData`
70
+ - `vertexAttribPointer`
71
+ - `enableVertexAttribArray`
72
+ - `bindVertexArray`
73
+
74
+ Textures:
75
+
76
+ - `createTexture`
77
+ - `bindTexture`
78
+ - `texImage2D`
79
+ - `texSubImage2D`
80
+ - `texParameteri`
81
+ - `activeTexture`
82
+ - `pixelStorei`
83
+
84
+ Framebuffers:
85
+
86
+ - `createFramebuffer`
87
+ - `bindFramebuffer`
88
+ - `framebufferTexture2D`
89
+ - `createRenderbuffer`
90
+ - `bindRenderbuffer`
91
+ - `framebufferRenderbuffer`
92
+
93
+ State:
94
+
95
+ - `viewport`
96
+ - `scissor`
97
+ - `clearColor`
98
+ - `clear`
99
+ - `enable` / `disable`
100
+ - `blendFunc` / `blendFuncSeparate`
101
+ - `blendEquation`
102
+ - `depthFunc`
103
+ - `cullFace`
104
+ - `colorMask`
105
+ - `depthMask`
106
+
107
+ Draw:
108
+
109
+ - `drawArrays`
110
+ - `drawElements`
111
+ - `drawArraysInstanced`
112
+ - `drawElementsInstanced`
113
+
114
+ ## WebGPU
115
+
116
+ WebGPU targets do not pass through `gl.shaderSource()`. Treat them as a separate backend.
117
+
118
+ Capture:
119
+
120
+ - canvas configuration and preferred format
121
+ - shader modules or trusted node/source definitions
122
+ - render and compute pipeline descriptors
123
+ - bind group layouts and bind groups
124
+ - buffers, textures, samplers, and update cadence
125
+ - render pass and compute pass order
126
+ - command submission sequence
127
+ - time, pointer, scroll, resize, random
128
+ - output color, alpha, and canvas/DOM composite
129
+
130
+ Prefer platform/source definitions, readable WGSL, or WebGPU capture tools.
131
+ If the site uses Three.js TSL or another node system that targets WebGPU, capture the node definition and renderer route before translating to GLSL or WGSL.
132
+
133
+ Do not declare WebGPU replay ready because a WebGL shader capture succeeded elsewhere on the page. Evidence must bind to the WebGPU target surface.
134
+
135
+ ### WebGPU Preload Hook Map
136
+
137
+ - `navigator.gpu.requestAdapter`
138
+ - `GPUAdapter.requestDevice`
139
+ - `GPUCanvasContext.configure`
140
+ - `GPUDevice.createShaderModule`
141
+ - `GPUDevice.createRenderPipeline`
142
+ - `GPUDevice.createComputePipeline`
143
+ - `GPUDevice.createBindGroupLayout`
144
+ - `GPUDevice.createBindGroup`
145
+ - `GPUDevice.createBuffer`
146
+ - `GPUDevice.createTexture`
147
+ - `GPUCommandEncoder.beginRenderPass`
148
+ - `GPUCommandEncoder.beginComputePass`
149
+ - `GPURenderPassEncoder.setPipeline`
150
+ - `GPURenderPassEncoder.setBindGroup`
151
+ - `GPURenderPassEncoder.draw`
152
+ - `GPURenderPassEncoder.drawIndexed`
153
+ - `GPUQueue.writeBuffer`
154
+ - `GPUQueue.writeTexture`
155
+ - `GPUQueue.submit`
156
+
157
+ ## Canvas2D
158
+
159
+ Canvas2D targets need command, asset, font, and timing facts rather than shader facts.
160
+
161
+ Capture:
162
+
163
+ - command stream or readable source
164
+ - transforms and clipping
165
+ - paths, text, image draws
166
+ - gradients, patterns, filters
167
+ - `globalCompositeOperation`
168
+ - assets and fonts
169
+ - timing, random, pointer, scroll, resize
170
+ - canvas size, DPR, and DOM composite
171
+
172
+ Use Vanilla JS for simple Canvas2D baselines. Keep static offscreen buffers when the source uses them. Match font loading and text metrics before tuning positions.
173
+
174
+ Common failure cases:
175
+
176
+ - font fallback changes glyph metrics
177
+ - DPR scaling applied twice or not at all
178
+ - filter/composite order differs from source
179
+ - image smoothing settings change texture quality
180
+ - random state is re-created every frame in the replay
181
+
182
+ ### Canvas2D Command Capture Map
183
+
184
+ - `drawImage`
185
+ - `fillRect` / `strokeRect` / `clearRect`
186
+ - `beginPath` / `moveTo` / `lineTo` / `bezierCurveTo` / `arc` / `fill` / `stroke` / `clip`
187
+ - `fillText` / `strokeText`
188
+ - `setTransform` / `transform` / `translate` / `rotate` / `scale`
189
+ - `save` / `restore`
190
+ - `globalAlpha`
191
+ - `globalCompositeOperation`
192
+ - `filter`
193
+ - `createLinearGradient` / `createRadialGradient` / `createPattern`
194
+ - `imageSmoothingEnabled`
195
+
196
+ ## OffscreenCanvas And Worker Probes
197
+
198
+ - Hook `transferControlToOffscreen` before page scripts run when worker ownership is suspected.
199
+ - Record worker script URLs and message channels, but do not persist private message payloads unless they are public effect definitions needed for replay.
200
+ - Bind OffscreenCanvas evidence back to the visible placeholder canvas or DOM layer before promoting owner or backend facts.
201
+ - If worker source cannot be read, capture call timing, canvas dimensions, and message shapes as `PARTIAL` evidence and keep the missing source as a blocking or important unknown.
@@ -0,0 +1,93 @@
1
+ # Evidence Policy
2
+
3
+ Choose evidence by authority and collection cost.
4
+
5
+ ## Truth Labels
6
+
7
+ Every implementation-critical fact needs a nearby truth label. If a fact has no label, treat it as `GUESS`.
8
+
9
+ | Label | Meaning | Valid evidence |
10
+ |---|---|---|
11
+ | `SOURCE` | Direct target-bound evidence from implementation or runtime. | Public source, source map, runtime object dump, captured shader/WGSL, GPU frame capture, network body with hash, or authoritative API output. |
12
+ | `PARTIAL` | Target-bound handle whose value, wiring, or replay role is not proven. | Symbol name, bundle slice, framework object, shader without draw/resource state, owner hint, or resource URL without use evidence. |
13
+ | `GUESS` | No direct evidence for the fact. | Visual fit, naming inference, copied defaults, hand-tuned constants, approximate behavior rebuild, or unverified assumption. |
14
+
15
+ Do not describe `PARTIAL` or `GUESS` facts as extracted source. A behavior rebuild can be used, but it stays approximate until promoted by evidence.
16
+
17
+ ## Leaf Facts vs Wiring Facts
18
+
19
+ False conclusions often come from proving a leaf fact and guessing the wiring fact. Audit them separately:
20
+
21
+ - Leaf facts: shader source, WGSL, constants, config values, asset URLs, resource dimensions, sampler settings, context attributes.
22
+ - Wiring facts: target ownership, draw/pass order, FBO dependencies, coordinate transforms, time unit, delta rule, random source, input coupling, resize behavior, color/alpha/DOM composite.
23
+
24
+ `SOURCE` leaf facts do not promote unproven wiring.
25
+ A source shader string does not prove active pass order.
26
+ A config field named `velocity` does not prove units.
27
+ A framework signature does not prove the target canvas uses that framework.
28
+
29
+ ## Promotion Rules
30
+
31
+ Promote a fact only when evidence improves:
32
+
33
+ - `GUESS -> PARTIAL`: a target-bound handle exists, but the value or wiring is still missing.
34
+ - `PARTIAL -> SOURCE`: direct source/runtime/frame evidence proves the value and its use in the target path.
35
+ - `SOURCE` for gate-critical wiring should have corroboration when practical. Examples: source plus runtime object, runtime plus frame capture, or source plus local replay smoke.
36
+
37
+ When evidence conflicts with the model, do not tune parameters to mask the conflict.
38
+ Route the mismatch back to attribution, source trace, or replay readiness.
39
+ Record the unresolved unknown.
40
+
41
+ ## Unknown Classes
42
+
43
+ - `blocking`: cannot build a baseline that matches required evidence without resolving it
44
+ - `important`: baseline can run, but QA must focus on it
45
+ - `deferred`: affects projectization or polish, not baseline
46
+ - `external`: blocked by access, authorization, or legal permission
47
+
48
+ ## Choosing The Next Action
49
+
50
+ Prefer the action that resolves the most blocking unknowns while keeping authority high and cost low.
51
+
52
+ Invalid action: "download every bundle and inspect everything."
53
+
54
+ Valid action: "target context creation stack points into `hero-renderer.*.js`; fetch only that source-mapped module to resolve owner and shader source."
55
+
56
+ ## Evidence Ledger
57
+
58
+ Use ledger entries for facts that influence implementation:
59
+
60
+ ```json
61
+ {
62
+ "id": "ev-0042",
63
+ "fact": "target surface is created by THREE.WebGLRenderer",
64
+ "value": true,
65
+ "truth": "SOURCE",
66
+ "targetIds": ["surface-1"],
67
+ "source": {
68
+ "type": "runtime|api|source-map|frame-capture|bundle|dom|screenshot|inference",
69
+ "location": "evidence/runtime/renderer.json#0",
70
+ "hash": "sha256:..."
71
+ },
72
+ "authority": "direct|corroborated|indirect|inferred",
73
+ "confidence": 0.96,
74
+ "verifiedBy": ["runtime-owner", "call-stack"]
75
+ }
76
+ ```
77
+
78
+ Implementation-critical values should not rely only on `inferred` evidence unless the replay route is explicitly `BEHAVIOR_REBUILD`.
79
+
80
+ ## Pre-Delivery Honesty Check
81
+
82
+ Before reporting completion, verify:
83
+
84
+ - Every implementation-critical value has `SOURCE`, `PARTIAL`, or `GUESS` evidence.
85
+ - No fitted value is labeled `SOURCE`.
86
+ - Wiring facts are proven separately from leaf facts.
87
+ - `REPLAY_READY` has no blocking unknowns without a documented fallback and fidelity downgrade.
88
+ - Known gaps describe the blocking unknown and the evidence needed to resolve it. Do not replace missing evidence with assumptions.
89
+
90
+ ## Sensitive Data
91
+
92
+ Do not persist cookies, Authorization headers, access tokens, private API keys, or private account data.
93
+ When a browser session is already logged in, record only the minimum non-sensitive facts needed for target attribution and replay.
@@ -0,0 +1,82 @@
1
+ # Operating Contract
2
+
3
+ This contract defines the behavior of the Web Shader Extractor skill before any focused workflow begins.
4
+
5
+ ## Objective
6
+
7
+ Start from the visual effect the user points to.
8
+ Lock the rendering surface, runtime, and source entry that produce it.
9
+ Use the lowest-cost target-bound evidence path.
10
+ Build a runnable and verifiable local baseline first.
11
+ Perform cleanup, modularization, and editability work only after that baseline passes verification.
12
+
13
+ This skill is not a general website cloner or a general JavaScript reverse-engineering workflow.
14
+ The core completion state is a local, runnable, verified replay of the target visual.
15
+
16
+ ## Non-Negotiable Principles
17
+
18
+ 1. Start from the visual target, not from bundles, framework names, or project structure.
19
+ 2. Be canvas-first, not canvas-only: track iframes, OffscreenCanvas, workers, WebGPU, and DOM layers that participate in the effect.
20
+ 3. Attribute before locking: the largest, fullscreen, or continuously animated canvas is not automatically the target.
21
+ 4. Bind every conclusion to the target: a page-level Three.js, Babylon.js, or platform signature does not prove the target canvas uses it.
22
+ 5. Lock the target before deep analysis: do not deobfuscate full bundles before `TARGET_LOCKED`.
23
+ 6. Resolve one key unknown at a time: every action must state which unknown it resolves.
24
+ 7. Prefer evidence over inference: public definitions, source, source maps, runtime objects, and frame captures outrank minified guesses.
25
+ 8. Replay first: a runnable, verified local baseline is the core deliverable.
26
+ 9. Restore before refactoring: projectization, modularization, lite versions, and native WebGL conversions happen after the baseline.
27
+ 10. Choose the stack for evidence match: use native WebGL only when the scene is simple and conversion facts are complete.
28
+ 11. Do not compensate by tuning: never change brightness, speed, position, or noise values to mask timing, color, FBO, resource, coordinate, or state-model errors.
29
+ 12. Do not downgrade silently: if source replay falls back to pipeline replay or behavior rebuild, record it.
30
+ 13. A matching single frame is not dynamic correctness: verify time, input, scroll, and multi-pass behavior separately.
31
+ 14. Never overwrite the baseline: projectization and simplification happen in separate directories.
32
+ 15. Do not ask by default: ask only for product-level scope changes or external authorization blockers.
33
+ 16. Do not bypass access control: handle only public content or content the user is authorized to access and reproduce; do not save cookies, Authorization headers, tokens, or secrets.
34
+ 17. Label implementation-critical facts as `SOURCE`, `PARTIAL`, or `GUESS`; an unlabeled value is treated as `GUESS`.
35
+ 18. Separate leaf facts from wiring. Shader text, constants, asset URLs, and pass names can be source facts while render order, timing, input coupling, units, and ownership are still unproven.
36
+
37
+ ## False Conclusion Rules
38
+
39
+ ```text
40
+ 1. The largest or fullscreen canvas is not necessarily the target canvas.
41
+ 2. A framework existing on the page does not mean the target canvas uses it.
42
+ 3. A visible first frame does not prove the render graph, time, and inputs are correct.
43
+ 4. A similar screenshot does not prove the dynamic effect has been verified.
44
+ 5. A source constant does not prove the pipeline wiring that consumes it.
45
+ 6. A target-bound symbol name does not prove units, coordinate space, or timing semantics.
46
+ 7. A local fix that improves appearance is not evidence; it is a GUESS until traced or independently verified.
47
+ ```
48
+
49
+ ## Fact Labels
50
+
51
+ Use truth labels close to facts that drive implementation:
52
+
53
+ - `SOURCE`: direct target-bound evidence. Examples: public original source, source-mapped module, runtime object dump, captured shader/WGSL, frame capture, or network body with hash.
54
+ - `PARTIAL`: a handle for the next probe. Examples: class/function/field name, target-bound bundle slice, framework object, or shader without state/pass/input facts.
55
+ - `GUESS`: visual fitting, naming inference, copied defaults, hand-tuned constants, or any behavior rebuild value without direct evidence.
56
+
57
+ Never upgrade a fact because output looks similar.
58
+ If a value is fitted so the baseline resembles the source, keep it labeled `GUESS`.
59
+ State which evidence would promote it.
60
+ If direct source conflicts with runtime behavior, treat wiring, units, or target attribution as unresolved before tuning.
61
+
62
+ Before declaring `TARGET_LOCKED`, `REPLAY_READY`, or `BASELINE_VERIFIED`, check both layers:
63
+
64
+ - Leaf facts: shader/WGSL text, constants, config, asset paths, resource dimensions, context attributes.
65
+ - Wiring facts: owner, pass order, FBO dependencies, coordinate transforms, time units, random rules, pointer/scroll/resize coupling, output composite.
66
+
67
+ Read `references/evidence-policy.md` for the full labeling and audit rules.
68
+
69
+ ## External Blockers
70
+
71
+ Ask separately only for login, CAPTCHA, private pages, paid resources, or permission/license uncertainty.
72
+ Combine blockers into one note.
73
+
74
+ If connecting to an existing logged-in browser, tell the user credentials or page data may be visible to the agent.
75
+ Do not persist sensitive headers, cookies, tokens, or secrets.
76
+
77
+ ## Completion States
78
+
79
+ - `DONE_BASELINE_VERIFIED`: baseline passed Source -> Baseline validation.
80
+ - `DONE_PROJECTIZED`: editable project passed Baseline -> Editable regression.
81
+ - `DONE_BASELINE_WITH_GAPS`: baseline runs, but differences or evidence gaps remain and are documented.
82
+ - `BLOCKED_EXTERNAL`: legal access, authorization, or permission prevents progress.
@@ -0,0 +1,100 @@
1
+ # QA and Failure Policy
2
+
3
+ Validation happens twice:
4
+
5
+ 1. Source -> Baseline: does the local baseline match the target evidence?
6
+ 2. Baseline -> Editable: did projectization avoid regression?
7
+
8
+ ## Fixed Conditions
9
+
10
+ Keep these identical across comparisons:
11
+
12
+ - viewport
13
+ - DPR
14
+ - browser/backend
15
+ - fixed time or selected frame
16
+ - pointer, scroll, resize, route state
17
+ - random seed when controllable
18
+ - background, alpha, and DOM composite
19
+ - crop and time point
20
+
21
+ ## Validation Levels
22
+
23
+ 1. Build: dependencies and assets resolve
24
+ 2. GPU: shaders/pipelines compile and link
25
+ 3. Structural: pass, FBO, program, resource, and state match Manifest
26
+ 4. Visual: color, composition, alpha, edges
27
+ 5. Temporal: multi-frame rhythm, phase, randomness
28
+ 6. Interaction: pointer, scroll, resize, route
29
+ 7. Regression: editable project vs baseline
30
+
31
+ ## Minimum Source -> Baseline Protocol
32
+
33
+ Minimum verification requires more than one static screenshot:
34
+
35
+ 1. Compare at the initial frame or a fixed time.
36
+ 2. Compare at a later frame.
37
+ 3. Compare after one relevant interaction if the target is interactive.
38
+ 4. For scroll-coupled effects, compare at top, middle, and target section.
39
+ 5. For route-coupled effects, compare at the route transition or persistent renderer state.
40
+ 6. Always record viewport, DPR, browser/backend, crop, time, pointer, scroll, and route state.
41
+
42
+ Every comparison must save or reference:
43
+
44
+ - source image or frame evidence
45
+ - baseline image or frame evidence
46
+ - diff image, numeric comparison, or written visual difference record
47
+
48
+ If the environment cannot produce image diffs, write a structured visual difference record and keep that limitation in `known-gaps.md`. A single matching first frame is not enough for `BASELINE_VERIFIED`.
49
+
50
+ ## Truth Audit
51
+
52
+ Run this audit before marking the final state:
53
+
54
+ - Every implementation-critical fact in `replay-manifest.json` has direct evidence or a `PARTIAL` / `GUESS` label.
55
+ - Leaf facts and wiring facts were checked separately. A verified shader or config value does not prove the active render graph, timing, coordinate space, or input route.
56
+ - Any parameter changed to improve appearance is recorded as `GUESS` unless source/runtime/frame evidence proves it.
57
+ - Any mismatch is routed to the upstream unknown that explains it. Do not cover mismatches with tuning.
58
+ - Known gaps state the blocking unknown and the evidence needed to resolve it.
59
+
60
+ The QA report is the gate artifact for `BASELINE_VERIFY` and `PROJECT_VERIFY`. Do not mark either gate passed while any required row is `pending`, any P0/P1/P2 issue is open, or the final status is absent.
61
+
62
+ ## Severity
63
+
64
+ - `P0`: cannot run, cannot render, or route impossible
65
+ - `P1`: wrong target, render graph, composition, or main interaction
66
+ - `P2`: visible timing, color, alpha, responsive, or input drift
67
+ - `P3`: polish or performance issue that does not block delivery
68
+
69
+ Automatically loop only P0/P1/P2.
70
+
71
+ ## Failure Routing
72
+
73
+ | Symptom | Category | Return |
74
+ |---|---|---|
75
+ | wrong canvas or missing shared surface | target | `SURFACE_ATTRIBUTION` |
76
+ | missing shader/resource/input | evidence | `SOURCE_TRACE` |
77
+ | wrong FBO, time, coordinates, color model | replay model | `CAPTURE_MINIMUM_TRUTH` |
78
+ | dependency, path, or code error | implementation | `RAW_REPLAY` |
79
+ | browser, GPU, CORS, or context issue | environment | `BASELINE_RUN` |
80
+ | evidence complete but implementation visually wrong | fidelity implementation | `RAW_REPLAY` |
81
+
82
+ Do not route all mismatches into parameter tuning.
83
+
84
+ ## Failure Signatures
85
+
86
+ Use these signatures to classify mismatches before editing values.
87
+
88
+ | Symptom | Likely Root Cause |
89
+ |---|---|
90
+ | overall too bright or color-shifted | color space, tone mapping, premultiplied alpha |
91
+ | animation slowly drifts | seconds vs frames, delta, time origin |
92
+ | vertical flip | UVs, render target orientation, SDF/image coordinate system |
93
+ | black blocks or missing layers | FBO, clear, blend, depth, missing resources |
94
+ | noise differs | RNG, precision, filtering, noise implementation |
95
+ | edge softness differs | DPR, AA, derivatives, SDF smoothing |
96
+ | scroll position drifts | DOM-canvas binding or scroll normalization |
97
+ | route flicker | renderer lifecycle, resource cache, route persistence |
98
+ | pointer response offset | canvas CSS transform, DPR, page scroll, coordinate normalization |
99
+
100
+ Confirm the category with evidence before changing implementation constants.