Skip to content

feat(image-compare): add SSIM as parallel diff signal#7

Open
bazmatic wants to merge 14 commits into
mainfrom
feat/figma-driven-development
Open

feat(image-compare): add SSIM as parallel diff signal#7
bazmatic wants to merge 14 commits into
mainfrom
feat/figma-driven-development

Conversation

@bazmatic

@bazmatic bazmatic commented Apr 26, 2026

Copy link
Copy Markdown

Summary

  • Extends build_tree to accept both image arrays simultaneously and compute an SSIM score per node alongside the existing colour average
  • Adds normalise_and_score to combine colour distance and SSIM into a single distance = max(norm_colour_dist, norm_ssim_diff) — either signal can surface a divergent region independently
  • Updates diff_trees, the leaf selection snippet, Step 5 report fields, Quick Reference, and Common Mistakes to reflect the new dual-signal pipeline

Test Plan

  • Run /tmp/test_ssim.py — verifies node_ssim logic and scikit-image import (python3.13 /tmp/test_ssim.py)
  • Run /tmp/test_build_tree.py — verifies dual-array build_tree and stop condition (python3.13 /tmp/test_build_tree.py)
  • Run /tmp/test_normalise.py — verifies normalise_and_score edge cases including None SSIM and zero-division (python3.13 /tmp/test_normalise.py)
  • Run /tmp/test_e2e.py — end-to-end: synthetic image pair with a red rectangle; top divergent leaf should overlap the rectangle with distance > 0.5 and colour_distance_raw > 0 (python3.13 /tmp/test_e2e.py)
  • Confirm scikit-image is installed: pip3.13 install scikit-image

bazmatic and others added 14 commits April 26, 2026 09:19
…l gate

Reduced from 353 to 208 lines by collapsing redundant prose and the
standalone "What NOT to Do" table into a consolidated Key Rules table.

Moved post-implementation visual verification from a skippable Phase 5b
heading into a numbered step 12 inside Phase 5, labelled as a hard gate
to prevent agents from skipping it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Delegate screenshot comparison to a skeptical subagent in both Phase 5 and Phase 7, with an explicit adversarial prompt covering 13 diff categories including gradients, charts, and visual effects
- Warn not to assume asset file format — check content-type before downloading, as Figma images are frequently SVGs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both Phase 5 and Phase 7 subagent prompts now include the section name,
node ID, expected size, and catalogue description so subagents can
anchor their diff against what was documented, and flag missing elements
with confidence.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a prominent scale warning to both Phase 5 and Phase 7 subagent
prompts, and elevates sizing to a high-risk category with an explicit
proportional comparison check.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Before handing off to the skeptical subagent, the implementing agent
now scores section complexity 1–3 and runs the subagent that many
times sequentially. Each pass receives the cumulative findings from
prior passes and is instructed to re-examine independently, not just
confirm. Applied to both Phase 5 (visual gate) and Phase 7 (audit).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Catalogue now stores CSS layout, typography tables, colour tokens,
  spacing, component mappings, assets, copy, interactive states,
  transitions, responsive variants, and complexity/error-likelihood scores
- Split catalogue into index + shared-styles + per-section files so each
  subagent loads only what it needs
- QA subagent prompts adapt analysis depth based on complexity score
  (score 3 triggers quadrant decomposition, per-element chart checks, etc.)
- Trimmed Key Rules table to a compact Hard Rules list; collapsed
  verbose gate explanation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bazmatic bazmatic changed the title refactor: reduce figma-driven-development skill size and harden visual gate feat(image-compare): add SSIM as parallel diff signal Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant