Skip to content

fix(design): count screenshots and corpus reads the pipeline was dropping - #95

Merged
fusengine merged 2 commits into
mainfrom
fix/design-corpus-pipeline-counters
Jul 29, 2026
Merged

fix(design): count screenshots and corpus reads the pipeline was dropping#95
fusengine merged 2 commits into
mainfrom
fix/design-corpus-pipeline-counters

Conversation

@fusengine

Copy link
Copy Markdown
Owner

Summary

  • The design pipeline was not crediting real agent work: a run that captured 3 screenshots and read 5 corpus files was reported as screenshotsCount:0, corpusReads:[], currentPhase:1, so the phase-2 gate never opened.
  • Root cause (C2/C3): corpus resolution only recognized marketplaces/<mkt>/plugins/design-expert, not the cache/<mkt>/<plugin>/<version>/ tree Claude Code also serves (plugin named fuse-design there) — now detected structurally by corpus suffix, never a hardcoded name, with marketplace priority + maxSemver selection.
  • Six more fixes riding on that root cause: batch screenshot tools now credit the quota (C1); motion*.js allowed by basename in the write gate (C4); full corpus quota raised to README+3 tokens, owner-arbitrated (C5); reference design-system.md sheets credit as a new sheet CorpusKind without counting toward tokens-* (C6); .css classified tailwind only by content markers, not extension alone (C7).
  • Separate chore commit bumps CHANGELOG/package.json to 0.1.86 (PATCH, per post-commit procedure).

Changes

  • src/policy/design/corpus-resolve.ts, new corpus-fs.ts, corpus-resolve-cache.ts — dual-tree corpus resolution
  • new src/policy/design/screenshot-tools.ts, src/runtime/design-helpers.ts — batch screenshot credit
  • src/policy/design/gates.ts, new allowed-write.tsmotion*.js write gate
  • src/policy/design/corpus.ts — quota bump + sheet CorpusKind
  • src/policy/detect-framework.ts — content-gated Tailwind CSS detection
  • Tests: test/design-corpus-transitions.test.ts, test/design-corpus.test.ts, test/design-gate-corpus.test.ts updated; new test/design-corpus-cache.test.ts, design-corpus-sheet.test.ts, design-motion-js.test.ts, design-screenshot-tools.test.ts, detect-framework-css-tailwind.test.ts
  • CHANGELOG.md, package.json — 0.1.86 (separate commit)

Test plan

  • bun test — 1012 pass / 1 skip / 0 fail (baseline was 1007/1/0)
  • bunx tsc --noEmit — exit 0
  • No existing assertion changed in design-gate-corpus.test.ts / design-corpus-transitions.test.ts (verified via diff)
  • Only intended assertion change: design-corpus.test.ts full quota 2→3 tokens (owner-arbitrated)
  • End-to-end probe on the previously-stuck scene: corpusReads: 4, screenshotsCount: 2, currentPhase: 2
  • CI green

Breaking changes

None.

…ping

- credit browser_shots_batch and browser_site_shots, not only
  browser_screenshot, toward the screenshot quota (screenshot-tools.ts)
- recognize the cache/<mkt>/<plugin>/<version>/ plugin tree structurally
  (corpus suffix, not a hardcoded name) alongside marketplaces/<mkt>/,
  with marketplace priority and maxSemver selection (corpus-fs.ts,
  corpus-resolve-cache.ts) - root cause of uncredited corpus reads
- allow motion*.js by basename in the write gate; app.js and
  motionless-app.js stay refused (allowed-write.ts)
- raise the "full" corpus quota to README + 3 tokens (was 2)
- credit reference design-system.md sheets as a new "sheet" CorpusKind,
  without counting them toward the tokens-* threshold
- restrict Tailwind CSS detection to .css files whose content matches
  known Tailwind markers, instead of classifying every .css as tailwind

Verified end-to-end: the previously-stuck scene now reports
corpusReads: 4, screenshotsCount: 2, currentPhase: 2.
@fusengine
fusengine merged commit c7fba54 into main Jul 29, 2026
1 check passed
@fusengine
fusengine deleted the fix/design-corpus-pipeline-counters branch July 29, 2026 12:24
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