@hegemonart/get-design-done 1.51.0 → 1.53.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 (58) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +96 -0
  4. package/README.md +4 -0
  5. package/SKILL.md +2 -0
  6. package/agents/a11y-mapper.md +30 -1
  7. package/agents/component-taxonomy-mapper.md +30 -1
  8. package/agents/design-context-reviewer-gate.md +102 -0
  9. package/agents/design-context-reviewer.md +186 -0
  10. package/agents/design-debt-crawler.md +60 -60
  11. package/agents/design-research-synthesizer.md +27 -1
  12. package/agents/motion-mapper.md +35 -13
  13. package/agents/token-mapper.md +30 -1
  14. package/agents/visual-hierarchy-mapper.md +30 -1
  15. package/dist/claude-code/.claude/skills/context/SKILL.md +137 -0
  16. package/dist/claude-code/.claude/skills/discover/SKILL.md +7 -1
  17. package/dist/claude-code/.claude/skills/explore/SKILL.md +3 -1
  18. package/dist/claude-code/.claude/skills/migrate-context/SKILL.md +123 -0
  19. package/dist/claude-code/.claude/skills/progress/SKILL.md +4 -0
  20. package/package.json +3 -2
  21. package/reference/design-context-schema.md +159 -0
  22. package/reference/design-context-tag-vocab.md +82 -0
  23. package/reference/registry.json +14 -0
  24. package/reference/schemas/design-context.schema.json +130 -0
  25. package/reference/schemas/mcp-gdd-tools.schema.json +34 -1
  26. package/reference/skill-graph.md +3 -1
  27. package/scripts/lib/design-context/extract-a11y.mjs +188 -0
  28. package/scripts/lib/design-context/extract-components.mjs +243 -0
  29. package/scripts/lib/design-context/extract-motion.mjs +248 -0
  30. package/scripts/lib/design-context/extract-tokens.mjs +234 -0
  31. package/scripts/lib/design-context/extract-visual-hierarchy.mjs +178 -0
  32. package/scripts/lib/design-context/integration-map.mjs +251 -0
  33. package/scripts/lib/design-context/merge-fragments.mjs +227 -0
  34. package/scripts/lib/design-context-query.cjs +0 -0
  35. package/scripts/lib/explore-parallel-runner/index.ts +58 -0
  36. package/scripts/lib/explore-parallel-runner/types.ts +58 -0
  37. package/scripts/lib/manifest/skills.json +18 -2
  38. package/scripts/lib/mappers/compute-batches.mjs +625 -0
  39. package/scripts/lib/mappers/graph-adjacency.mjs +129 -0
  40. package/scripts/lib/mappers/incremental-discover.cjs +617 -0
  41. package/scripts/lib/mappers/incremental-discover.d.cts +133 -0
  42. package/scripts/lib/mappers/neighbor-map.mjs +0 -0
  43. package/scripts/lib/mcp-tools-lint/index.cjs +3 -1
  44. package/sdk/cli/index.js +369 -2
  45. package/sdk/fingerprint/classify.cjs +406 -0
  46. package/sdk/fingerprint/index.ts +405 -0
  47. package/sdk/fingerprint/store.cjs +523 -0
  48. package/sdk/index.ts +1 -0
  49. package/sdk/mcp/gdd-mcp/schemas/gdd_context_query.schema.json +60 -0
  50. package/sdk/mcp/gdd-mcp/server.js +474 -158
  51. package/sdk/mcp/gdd-mcp/server.ts +9 -5
  52. package/sdk/mcp/gdd-mcp/tools/gdd_context_query.ts +35 -0
  53. package/sdk/mcp/gdd-mcp/tools/index.ts +18 -13
  54. package/skills/context/SKILL.md +137 -0
  55. package/skills/discover/SKILL.md +7 -1
  56. package/skills/explore/SKILL.md +3 -1
  57. package/skills/migrate-context/SKILL.md +123 -0
  58. package/skills/progress/SKILL.md +4 -0
@@ -5,14 +5,14 @@
5
5
  },
6
6
  "metadata": {
7
7
  "description": "Get Design Done — 5-stage agent-orchestrated design pipeline with 9 connections, handoff-first workflow, bidirectional Figma write-back, 22+ specialized agents, queryable knowledge layer (intel store, dependency analysis, learnings extraction), and a self-improvement loop (reflector, frontmatter + budget feedback, global-skills layer). v1.20.0 ships the SDK foundation: gdd-state MCP server (11 typed tools), lockfile-safe STATE.md mutations, event stream, and resilience primitives (jittered-backoff, rate-guard, error-classifier, iteration-budget) for rate-limit + 429 + context-overflow recovery. Full CI/CD pipeline (Node 22/24 × Linux/macOS/Windows) and release automation (auto-tag + GitHub Release + release-time smoke test).",
8
- "version": "1.51.0"
8
+ "version": "1.53.0"
9
9
  },
10
10
  "plugins": [
11
11
  {
12
12
  "name": "get-design-done",
13
13
  "source": "./",
14
14
  "description": "Agent-orchestrated 5-stage design pipeline: Brief → Explore → Plan → Design → Verify. 22+ specialized agents, 9 connections (Figma, Refero, Preview, Storybook, Chromatic, Figma Writer, Graphify, Pinterest, Claude Design), Claude Design handoff, bidirectional Figma write-back, and a queryable intel store (.design/intel/) for dependency and learnings queries. Standalone commands: style, darkmode, compare, figma-write, graphify, handoff, analyze-dependencies, skill-manifest, extract-learnings. Embeds NNG heuristics, WCAG thresholds, typographic systems, motion framework, and anti-pattern catalog. Ships with a full CI/CD pipeline (Node 22/24 × Linux/macOS/Windows) and release automation. Optimization layer (v1.0.4.1, retroactive): gdd-router + gdd-cache-manager skills, PreToolUse budget-enforcer hook, tier-aware agent frontmatter, lazy checker gates, streaming synthesizer, /gdd:warm-cache + /gdd:optimize commands, and cost telemetry at .design/telemetry/costs.jsonl — targeting 50-70% per-task token-cost reduction with no quality-floor regression. v1.20.0 SDK foundation: gdd-state MCP server (11 typed tools), lockfile-safe STATE.md mutations, event stream at .design/telemetry/events.jsonl, resilience primitives (jittered-backoff, rate-guard, error-classifier, iteration-budget) with rate-limit + 429 + context-overflow recovery, and TypeScript toolchain.",
15
- "version": "1.51.0",
15
+ "version": "1.53.0",
16
16
  "author": {
17
17
  "name": "hegemonart"
18
18
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "get-design-done",
3
3
  "short_name": "gdd",
4
- "version": "1.51.0",
4
+ "version": "1.53.0",
5
5
  "description": "Agent-orchestrated 5-stage design pipeline: Brief → Explore → Plan → Design → Verify. 59 specialized agents, 88 skills, 41 connection integrations (Figma, Refero, Preview, Storybook, Chromatic, Graphify, Slack, Linear, Jira, Notion, and more), handoff-first workflow via Claude Design bundles, bidirectional Figma write-back (annotations, Code Connect), queryable intel store (`.design/intel/`) for O(1) design surface lookups, and self-improvement loop (reflector agent, frontmatter + budget feedback, global-skills layer at `~/.claude/gdd/global-skills/`). Standalone commands: style, darkmode, compare, figma-write, graphify, handoff, analyze-dependencies, skill-manifest, extract-learnings, reflect, apply-reflections. Embeds NNG heuristics, WCAG thresholds, typographic systems, motion framework, and anti-pattern catalog. Ships with a full CI/CD pipeline (Node 22/24 × Linux/macOS/Windows, lint + schema + frontmatter + stale-ref + shellcheck + gitleaks + injection-scan + blocking size-budget) and release automation (auto-tag + GitHub Release + release-time smoke test). Optimization layer (v1.0.4.1, retroactive): gdd-router + gdd-cache-manager skills, PreToolUse budget-enforcer hook, tier-aware agent frontmatter, lazy checker gates, streaming synthesizer, /gdd:warm-cache + /gdd:optimize commands, and cost telemetry at .design/telemetry/costs.jsonl — targeting 50-70% per-task token-cost reduction with no quality-floor regression. v1.20.0 SDK foundation: gdd-state MCP server (11 typed tools), lockfile-safe STATE.md mutations, event stream at .design/telemetry/events.jsonl, resilience primitives (jittered-backoff, rate-guard, error-classifier, iteration-budget) with rate-limit + 429 + context-overflow recovery, and TypeScript toolchain. v1.27.7 ships gdd-mcp (Phase 27.7): 12 read-only MCP tools for sub-3s priming. v1.28.0 (Phase 28): Foundational References Tier 2 — 5 new reference files (color-theory, composition, proportion-systems, i18n, contrast-advanced), 2 verifier i18n probes + 1 explore i18n-readiness probe, 12 additive cross-link insertions across 10 existing references, 2 orthogonal audit-scoring lens-tags (composition_alignment + i18n_readiness).",
6
6
  "author": {
7
7
  "name": "hegemonart",
package/CHANGELOG.md CHANGED
@@ -4,6 +4,102 @@ All notable changes to get-design-done are documented here. Versions follow [sem
4
4
 
5
5
  ---
6
6
 
7
+ ## [1.53.0] - 2026-06-03
8
+
9
+ ### Phase 53 - Semantic Mapper Engine (Louvain Batching + neighborMap + Fingerprint Incremental)
10
+
11
+ Phase 52 gave mappers a typed graph; Phase 53 makes them smart about scale and re-runs. Three Understand-Anything
12
+ patterns adapted onto the Phase 52 schema: Louvain community batching so each parallel mapper sees files that import
13
+ each other, a neighborMap sidecar so cross-batch edges emit without rereading other batches, and SHA-256 fingerprinting
14
+ so re-runs only re-discover what actually changed. All dep-free (Node builtins; no `graphology`, no embeddings). Planned
15
+ and executed via the GSD pipeline (4 parallel executors + 1 integration executor).
16
+
17
+ ### Breaking changes
18
+
19
+ - **`/gdd:discover` becomes incremental by default.** It now fingerprints the current graph against the rolling
20
+ fingerprint store, classifies the delta (SKIP / PARTIAL_UPDATE / ARCHITECTURE_UPDATE / FULL_UPDATE), and dispatches
21
+ mappers per decision instead of always re-mapping everything. Pass `--full` to force a full re-discover. First runs
22
+ (no prior fingerprint store) classify as FULL automatically. The fingerprint store lives at `.design/fingerprints/`
23
+ and follows the Phase 49 worktree-redirect (never written into a worktree-local `.design/`).
24
+
25
+ ### Added
26
+
27
+ - **Louvain batching**: `scripts/lib/mappers/compute-batches.mjs` (dep-free two-phase modularity maximization,
28
+ deterministic lexicographic seed, `MAX_COMMUNITY_SIZE=35` sub-split, small-batch merger, `count-fallback` on any
29
+ error) + `scripts/lib/mappers/graph-adjacency.mjs` (shared adjacency/degree builder). Non-code node groups
30
+ (token / motion / a11y) emit as `mergeable:false` batches.
31
+ - **neighborMap sidecar**: `scripts/lib/mappers/neighbor-map.mjs` (`buildNeighborMap`) - 1-hop external neighbors per
32
+ batched file, ranked by degree, capped at 50, with graph-harvested exported symbols (no source reads).
33
+ - **Fingerprint engine**: `sdk/fingerprint/index.ts` (`fingerprint`/`compareFingerprints` via `node:crypto`; per-type
34
+ component/token/motion signatures; `NONE`/`COSMETIC`/`STRUCTURAL` with a structure-only sub-hash) +
35
+ `sdk/fingerprint/classify.cjs` (4-action decision matrix) + `sdk/fingerprint/store.cjs` (`current.json` + rolling
36
+ `cycle-NNN.json` N=5, atomic-write, worktree-redirect, optional FTS5 since-cycle via `probeOptional` with a
37
+ JSON-scan fallback).
38
+ - **Incremental wiring**: `scripts/lib/mappers/incremental-discover.cjs` (`planIncremental`) composes the above and is
39
+ wired additively into `scripts/lib/explore-parallel-runner` (community batches before the rolling semaphore;
40
+ concurrency from `resolveConcurrency`); `/gdd:discover` + `/gdd:explore` gain `--incremental` / `--full`.
41
+ - **Graph-context reviewer**: `agents/design-context-reviewer.md` (Haiku tier; 9 checks; hard-reject on schema /
42
+ referential / uniqueness breakage, soft-warn otherwise via the health-mirror surface) + `agents/design-context-reviewer-gate.md`
43
+ (suppresses the reviewer on <5% change).
44
+
45
+ ### Notes
46
+
47
+ - 6-manifest lockstep at **v1.53.0** + `OFF_CADENCE_VERSIONS.add('1.53.0')` + 37 `manifests-version.txt` baselines.
48
+ Re-locked: agent-list (60 -> 62; +design-context-reviewer +gate) + the design-* current baseline (28 -> 30) + the
49
+ agent-frontmatter snapshot; the phase-28.5 distribution (discover 72 -> 78, explore 105 -> 107; warn count unchanged
50
+ at 10); the explore post-migration baseline; skills.json `argument_hint` for discover/explore (then
51
+ generate-skill-frontmatter + build:skills). Tarball golden 934 -> 944 (+10). No new reference docs, so the registry is
52
+ unchanged. **No new runtime dependency.**
53
+
54
+ ---
55
+
56
+ ## [1.52.0] - 2026-06-03
57
+
58
+ ### Phase 52 - Typed DesignContext Graph Schema (KEYSTONE)
59
+
60
+ GDD's design knowledge lived in flat `.design/map/*.md` mapper notes that nothing downstream could query. Phase 52
61
+ introduces a typed DesignContext graph: a design-semantic map of tokens, components, variants, states, motion fragments,
62
+ a11y patterns, screens, layers, and design patterns, plus the typed edges between them. It is the keystone for phases
63
+ 53-57 (semantic mapper engine, graph-aware verification, dashboard, SQLite mirror). Regex extraction (not tree-sitter),
64
+ JSON storage (not SQLite), zero new dependency. Planned and executed via the GSD pipeline (5 parallel executor subagents).
65
+
66
+ ### Breaking changes
67
+
68
+ - **New graph contract at `.design/context-graph.json`.** Nodes are `{ id, type, name, summary, tags[], complexity }`
69
+ over 10 node types; edges are `{ source, target, type, direction, weight }` over 12 edge types
70
+ (`reference/schemas/design-context.schema.json`). The 5 mapper agents and the synthesizer now DUAL-EMIT: they keep
71
+ writing `.design/map/*.md` AND emit graph fragments to `.design/fragments/<mapper>.json` (backward-compatible for one
72
+ minor version), so consumers gain the graph without losing the markdown maps.
73
+ - **gdd-mcp tool cap raised 12 -> 13.** A 13th read-only tool, `gdd_context_query`, joins the registry
74
+ (`sdk/mcp/gdd-mcp/tools/index.ts`). The hard cap in the tool index, the MCP-tools lint, and the Phase 27.7 baselines
75
+ all move to 13. No write tools were added.
76
+
77
+ ### Added
78
+
79
+ - **Schema, validator, query lib**: `reference/schemas/design-context.schema.json` (plus `reference/design-context-schema.md`
80
+ and `reference/design-context-tag-vocab.md`); `scripts/validate-design-context.cjs` (referential integrity, id
81
+ uniqueness, completeness, controlled tag vocabulary; dep-free with an optional Ajv overlay; wired as the
82
+ `validate:design-context` CI gate, a clean no-op when no graph is present); and `scripts/lib/design-context-query.cjs`
83
+ (`load`/`nodes`/`edges`/`path`/`consumersOf`/`unreachable`/`cycles`/`coverage`; pure, dep-free).
84
+ - **Extract and merge engine**: `scripts/lib/design-context/{extract-tokens,extract-components,extract-motion,extract-a11y,extract-visual-hierarchy,merge-fragments,integration-map}.mjs`,
85
+ regex over source roots, dep-free, emitting schema-valid fragments; merge dedupes nodes by id and recovers or drops dangling edges.
86
+ - **MCP and skills**: `gdd_context_query` (read-only graph query over the seven operations), `/gdd:context` (its front
87
+ end), and `/gdd:migrate-context` (migrate a pre-Phase-52 project from `.design/map/*.md` to the graph, flagging
88
+ low-confidence transforms; preview-first with `--dry-run`).
89
+ - **Debt-crawler dual-mode**: `design-debt-crawler` queries the graph when `.design/context-graph.json` is present and
90
+ falls back to grep otherwise; `/gdd:progress` surfaces graph coverage; `integration-map.mjs` renders a mermaid map per Atomic-Design layer.
91
+
92
+ ### Notes
93
+
94
+ - 6-manifest lockstep at **v1.52.0** + `OFF_CADENCE_VERSIONS.add('1.52.0')` + 37 `manifests-version.txt` baselines.
95
+ Re-locked: skill-list (89 -> 91; +context +migrate-context), root SKILL.md rows, the phase-42 compile count
96
+ (113 -> 115), the phase-28.5 distribution + warn count (8 -> 10; context at 137 and migrate-context at 123 lines, both
97
+ in the advisory WARN band), the progress post-migration baseline, the gdd-mcp 27.7 tool-count + registry baselines
98
+ (12 -> 13), and skills.json (+2). Tarball golden 917 -> 934 (+17). The `lint:md` ignore was widened to nested
99
+ `node_modules`.
100
+
101
+ ---
102
+
7
103
  ## [1.51.0] - 2026-06-03
8
104
 
9
105
  ### Phase 51 - Instinct-Based Learnings
package/README.md CHANGED
@@ -263,6 +263,10 @@ All 14 runtimes receive their native artifact layout (`skills/`, `command/`, `ag
263
263
 
264
264
  **Instinct-based learnings (v1.51.0).** The reflection loop now produces atomic, confidence-weighted instinct units instead of prose nobody reads. Each unit (`reference/instinct-format.md`: trigger, confidence 0.3-0.9, domain, scope, project id) is stored via `scripts/lib/instinct-store.cjs` (a JSON store with optional `better-sqlite3` FTS5 acceleration, the same probe-and-fall-back pattern as cross-cycle recall, so no dependency is added). `design-reflector` dual-emits instincts plus a narrative; `/gdd:apply-reflections` accepts them; the decision-injector surfaces the top-3 relevant instincts into agent context on every design-file read; and `/gdd:instinct list|query|promote` inspects the project and global stores. A project instinct promotes to the global layer only after it recurs across at least two projects (a conservative `Beta(2,8)` prior keeps it advisory), and stale instincts decay and archive. **No new runtime dependency.**
265
265
 
266
+ **Typed DesignContext graph (v1.52.0, keystone).** Design knowledge moves from flat `.design/map/*.md` notes to a typed graph at `.design/context-graph.json`: nodes are tokens, components, variants, states, motion fragments, a11y patterns, screens, layers, and design patterns; typed edges connect them (uses-token, composes, depends-on, consumes-context, and eight more). A Draft-07 schema (`reference/schemas/design-context.schema.json`) plus a dep-free validator (`scripts/validate-design-context.cjs`) and a pure query lib (`scripts/lib/design-context-query.cjs`: nodes / edges / path / consumers / unreachable / cycles / coverage) back it; regex extract passes build fragments that merge into the graph. The five mapper agents and the synthesizer dual-emit, so the markdown maps stay while fragments are added. A 13th read-only MCP tool (`gdd_context_query`) and two skills (`/gdd:context`, `/gdd:migrate-context`) expose it. Regex not tree-sitter, JSON not SQLite; this is the keystone for the phases that follow. **No new runtime dependency.**
267
+
268
+ **Semantic mapper engine (v1.53.0).** Mappers get smart about scale and re-runs on top of the Phase 52 graph. Louvain community batching (`scripts/lib/mappers/compute-batches.mjs`, dep-free, deterministic) groups files that import each other so each parallel mapper sees a coherent slice; a neighborMap sidecar (`neighbor-map.mjs`) hands each batch its 1-hop external symbols so cross-batch edges emit without rereading other batches. SHA-256 fingerprinting (`sdk/fingerprint/`) classifies each re-run as SKIP / PARTIAL / ARCHITECTURE / FULL, so `/gdd:discover` (now incremental by default, `--full` to override) only re-discovers what actually changed. A graph-context-reviewer agent runs nine checks on the assembled graph (hard-reject on schema or referential breakage, soft-warn otherwise). Node builtins only, no `graphology`, no embeddings. **No new runtime dependency.**
269
+
266
270
  Verify with:
267
271
 
268
272
  ```
package/SKILL.md CHANGED
@@ -113,6 +113,8 @@ Each stage produces artifacts in `.design/` inside the current project.
113
113
  | `review-decisions [<id>] [--pending]` | `get-design-done:gdd-review-decisions` | Phase 40 - surface the async decision-review queue (`proposed → reviewing → approved → locked`); `--pending` shows decisions still awaiting action. Read-only |
114
114
  | `unlock-decision <id> --approver <who> [--reason <text>] [--dry-run]` | `get-design-done:gdd-unlock-decision` | Phase 40 - reopen a LOCKED decision (the only escape hatch); requires an approver + writes an audit entry; previews before writing |
115
115
  | `locale [<code>]` | `get-design-done:gdd-locale` | Phase 40.5 - inspect or set the GDD CLI locale (en/ru/uk/de/fr/zh/ja) for `--help`, errors, and skill prompt headers; missing keys fall back to English. No arg reports the resolved locale + coverage |
116
+ | `context [nodes --type X \| edges --type Z \| path <a> <b> \| consumers-of <id> \| unreachable \| cycles \| coverage]` | `get-design-done:gdd-context` | Phase 52 - read-only query front end for the typed DesignContext graph at `.design/context-graph.json`; lists/filters nodes and edges, traces a path between two nodes, finds a node's consumers, and reports unreachable nodes, dependency cycles, and coverage. Never writes |
117
+ | `migrate-context [--dry-run]` | `get-design-done:gdd-migrate-context` | Phase 52 - migrate a pre-Phase-52 project from flat `.design/map/*.md` mapper notes to the typed DesignContext graph; runs the extract-*.mjs passes, merges fragments, validates with `validate-design-context.cjs`, and flags low-confidence transforms for review. Preview-first; `--dry-run` previews without writing |
116
118
 
117
119
  ## Handoff Routing
118
120
 
@@ -11,6 +11,7 @@ typical-duration-seconds: 45
11
11
  reads-only: false
12
12
  writes:
13
13
  - ".design/map/a11y.md"
14
+ - ".design/fragments/a11y-mapper.json"
14
15
  ---
15
16
 
16
17
  @reference/shared-preamble.md
@@ -136,9 +137,37 @@ Total: N findings. (0 = clean)
136
137
  ```
137
138
  ```
138
139
 
140
+ ## Graph fragment emission
141
+
142
+ Dual-emit: keep writing `.design/map/a11y.md` above, and ALSO emit a typed graph fragment for the synthesizer to merge into `.design/context-graph.json`. Fragment shape and field rules come from `reference/design-context-schema.md`; allowed `tags[]` come from `reference/design-context-tag-vocab.md`. Do not invent fields or tags outside those two references.
143
+
144
+ ### 1. Deterministic phase (structural nodes/edges)
145
+
146
+ Run the matching extractor over the same source roots you scanned above:
147
+
148
+ ```bash
149
+ node scripts/lib/design-context/extract-a11y.mjs <source_root> [<source_root>...] > .design/fragments/a11y-mapper.json
150
+ ```
151
+
152
+ `extract-a11y.mjs` walks the source roots with regex (zero-dep) and returns a Fragment whose `nodes[]` have `id`, `type` (`a11y-pattern`), and `name` filled, with stub `summary` you must replace. Patterns map to the ARIA, keyboard, focus, landmark, and skip-link signals you inventoried above. This is a static scan only; runtime behavior stays out (Phase 8).
153
+
154
+ ### 2. LLM phase (fill summary, tags, complexity)
155
+
156
+ For every node the extractor produced, set:
157
+
158
+ - `summary`: one sentence describing the pattern and the WCAG concern it touches, distinct from `name`. Example: "Focus-visible ring on interactive controls, supports 2.4.7".
159
+ - `tags[]`: pick from `reference/design-context-tag-vocab.md` only (a11y terms such as `aria`, `keyboard`, `focus`, `landmark`, `contrast`). Where a node maps to a WCAG criterion you tracked, use the vocab tag for it. Drop any tag not in the vocab.
160
+ - `complexity`: `simple` for a single attribute or landmark, `moderate` for a keyboard-handler pattern across a widget, `complex` for a composite pattern such as a focus-managed dialog.
161
+
162
+ Add edges the extractor cannot infer: a pattern whose coverage a test asserts is `tested-by`; a pattern explained in a reference is `documented-by`. Set `direction` and `weight` per the schema.
163
+
164
+ ### 3. Write the fragment
165
+
166
+ Write the completed Fragment to `.design/fragments/a11y-mapper.json` with `schema_version`, `mapper: "a11y-mapper"`, `generated_at` (ISO 8601), the enriched `nodes[]`, and `edges[]`. Resolve the main repo root the same way the rest of the pipeline does so a worktree run does not leak the file.
167
+
139
168
  ## Constraints
140
169
 
141
- No modifications outside `.design/map/`. No live browser. No git. No agent spawning.
170
+ No modifications outside `.design/map/` and `.design/fragments/`. No live browser. No git. No agent spawning.
142
171
 
143
172
  ## A11Y MAP COMPLETE
144
173
 
@@ -11,6 +11,7 @@ typical-duration-seconds: 45
11
11
  reads-only: false
12
12
  writes:
13
13
  - ".design/map/components.md"
14
+ - ".design/fragments/component-taxonomy-mapper.json"
14
15
  ---
15
16
 
16
17
  @reference/shared-preamble.md
@@ -81,9 +82,37 @@ dominant_styling: [CSS Modules | Tailwind | styled-components | mixed]
81
82
  |-----------|--------|
82
83
  ```
83
84
 
85
+ ## Graph fragment emission
86
+
87
+ Dual-emit: keep writing `.design/map/components.md` above, and ALSO emit a typed graph fragment for the synthesizer to merge into `.design/context-graph.json`. Fragment shape and field rules come from `reference/design-context-schema.md`; allowed `tags[]` come from `reference/design-context-tag-vocab.md`. Do not invent fields or tags outside those two references.
88
+
89
+ ### 1. Deterministic phase (structural nodes/edges)
90
+
91
+ Run the matching extractor over the same source roots you scanned above:
92
+
93
+ ```bash
94
+ node scripts/lib/design-context/extract-components.mjs <source_root> [<source_root>...] > .design/fragments/component-taxonomy-mapper.json
95
+ ```
96
+
97
+ `extract-components.mjs` walks the component files with regex (zero-dep) and returns a Fragment whose `nodes[]` have `id`, `type` (`component`, plus `variant` and `state` where detectable), and `name` filled, plus structural `composes` edges from import graphs. Each node `summary` arrives as a STUB you must replace.
98
+
99
+ ### 2. LLM phase (fill summary, tags, complexity)
100
+
101
+ For every node the extractor produced, set:
102
+
103
+ - `summary`: one sentence describing the component's responsibility, distinct from `name`. Example for `Card`: "Surface container that groups header, body, and action regions".
104
+ - `tags[]`: pick from `reference/design-context-tag-vocab.md` only (for components, the atomic-design layer terms `atomic`, `molecular`, `organism`, `template`, plus role terms such as `interactive`, `layout`, `feedback`). Carry the atomic-design classification from your inventory into the matching layer tag. Drop any tag not in the vocab.
105
+ - `complexity`: `simple` for an atom with no children, `moderate` for a molecule composing 2 to 5 children, `complex` for an organism with 6+ children or routable surface.
106
+
107
+ Add cross-component edges the extractor cannot infer: a compound child specializing a base is `extends`; a near-duplicate sibling you flagged for reuse is `mirrors`. Set `direction` and `weight` per the schema.
108
+
109
+ ### 3. Write the fragment
110
+
111
+ Write the completed Fragment to `.design/fragments/component-taxonomy-mapper.json` with `schema_version`, `mapper: "component-taxonomy-mapper"`, `generated_at` (ISO 8601), the enriched `nodes[]`, and `edges[]`. Resolve the main repo root the same way the rest of the pipeline does so a worktree run does not leak the file.
112
+
84
113
  ## Constraints
85
114
 
86
- Do not modify anything outside `.design/map/`. No git. No agent spawning.
115
+ Do not modify anything outside `.design/map/` and `.design/fragments/`. No git. No agent spawning.
87
116
 
88
117
  ## Record
89
118
 
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: design-context-reviewer-gate
3
+ description: "Cheap Haiku gate that reads a change signal and decides whether design-context-reviewer should spawn. Suppresses the reviewer when project change is below 5 percent."
4
+ tools: Read, Bash, Grep
5
+ color: cyan
6
+ model: inherit
7
+ default-tier: haiku
8
+ tier-rationale: "Cheap change-signal gate - graph reviewer only runs when the graph changed enough to matter"
9
+ size_budget: S
10
+ parallel-safe: always
11
+ typical-duration-seconds: 10
12
+ reads-only: true
13
+ writes: []
14
+ ---
15
+
16
+ @reference/shared-preamble.md
17
+
18
+ # design-context-reviewer-gate
19
+
20
+ ## Role
21
+
22
+ You read a CHANGE SIGNAL and answer one binary question: *did this cycle change the project enough to warrant a full graph review?* Everything else is out of scope.
23
+
24
+ You run once per explore invocation, after assembly. You are read-only. You do not run the full `design-context-reviewer`, spawn other agents, write files, or ask questions. Your only job is to emit a `{spawn, rationale}` decision.
25
+
26
+ ## Input Contract
27
+
28
+ The orchestrator supplies these fields in the prompt context:
29
+
30
+ - `change_pct` - the fraction of the project that changed this cycle, as classified by the fingerprint change classifier (`classify(...)` returns `pct`). A value of `0.05` means 5 percent.
31
+ - `classifier_action` - the classifier action for this cycle: `SKIP`, `PARTIAL_UPDATE`, `ARCHITECTURE_UPDATE`, or `FULL_UPDATE`.
32
+ - `graph_path` - path to the assembled graph (typically `.design/context-graph.json`).
33
+
34
+ ## Heuristic
35
+
36
+ Spawn the full reviewer (`spawn: true`) if **and only if** the project change reaches the threshold:
37
+
38
+ ```
39
+ change reaches the spawn threshold: change_pct >= 0.05
40
+ ```
41
+
42
+ Below 5 percent change, the prior review still holds and the assembled graph differs only cosmetically, so the spawn is wasted cost. A `SKIP` action (the classifier saw zero structural change) always suppresses.
43
+
44
+ Below threshold (or `classifier_action` is `SKIP`) returns:
45
+
46
+ ```json
47
+ {"spawn": false, "rationale": "project change 3% < 5% threshold (classifier PARTIAL_UPDATE) - prior graph review still holds"}
48
+ ```
49
+
50
+ At or above threshold returns `spawn: true` with the measured change as rationale:
51
+
52
+ ```json
53
+ {"spawn": true, "rationale": "project change 12% >= 5% threshold (classifier FULL_UPDATE) - graph review required"}
54
+ ```
55
+
56
+ ## Output Contract
57
+
58
+ Emit a single JSON object on its own line. No prose wrapper, no code fence, no leading or trailing text on that line:
59
+
60
+ ```json
61
+ {"spawn": true, "rationale": "project change 12% >= 5% threshold (classifier FULL_UPDATE) - graph review required"}
62
+ ```
63
+
64
+ Rationale MUST be 200 characters or fewer, percentages and action names only, no graph content.
65
+
66
+ Then emit the completion marker on its own final line.
67
+
68
+ ## Completion Marker
69
+
70
+ ```
71
+ ## GATE COMPLETE
72
+ ```
73
+
74
+ ## Constraints
75
+
76
+ You MUST NOT:
77
+ - Run the full `design-context-reviewer` (the orchestrator spawns it on `spawn: true`)
78
+ - Write or modify any file
79
+ - Spawn other agents
80
+ - Ask interactive questions
81
+ - Emit prose before or after the JSON line beyond the completion marker
82
+
83
+ You MAY:
84
+ - Use `Read` on the change signal only if strictly necessary to disambiguate (e.g., to confirm `change_pct` when the field is ambiguous)
85
+ - Run the fingerprint classifier via `Bash` to re-derive `change_pct` if missing
86
+ - Use `Grep` over the signal to confirm the percentage
87
+
88
+ ## Why this agent exists
89
+
90
+ This gate mirrors the lazy-spawn pattern of `design-context-checker-gate`: a cheap Haiku gate at `agents/*-gate.md` decides whether to spawn the full checker. If false, the orchestrator skips the full reviewer and logs `lazy_skipped: true` in telemetry. The full `design-context-reviewer` runs a 9-check rubric over the assembled graph. When the fingerprint classifier reports less than 5 percent project change this cycle, the graph is materially the same as the last reviewed graph, so re-running the full review buys nothing.
91
+
92
+ ## Record
93
+
94
+ At run-end, append one JSONL line to `.design/intel/insights.jsonl`:
95
+
96
+ ```json
97
+ {"ts":"<ISO-8601>","agent":"<name>","cycle":"<cycle from STATE.md>","stage":"<stage from STATE.md>","one_line_insight":"<what was produced or learned>","artifacts_written":["<files written>"]}
98
+ ```
99
+
100
+ Schema: `reference/schemas/insight-line.schema.json`. Use an empty `artifacts_written` array for read-only agents.
101
+
102
+ ## GATE COMPLETE
@@ -0,0 +1,186 @@
1
+ ---
2
+ name: design-context-reviewer
3
+ description: "Reviews the merged .design/context-graph.json after mapper assembly across 9 checks (schema validity, referential integrity, completeness, layer coverage, id uniqueness, summary quality, edge-expectation consistency, type-prefix consistency, coverage-vs-stack). Hard-rejects on critical breakage; soft-warns on advisory issues. Spawned by the explore stage after the synthesizer merges all fragments."
4
+ tools: Read, Grep, Glob
5
+ color: cyan
6
+ model: inherit
7
+ default-tier: haiku
8
+ tier-rationale: "Schema-driven graph review on top of a deterministic validator; rubric-bound, no reasoning density needed"
9
+ size_budget: LARGE
10
+ parallel-safe: always
11
+ typical-duration-seconds: 25
12
+ reads-only: true
13
+ writes: []
14
+ ---
15
+
16
+ @reference/shared-preamble.md
17
+
18
+ # design-context-reviewer
19
+
20
+ ## Role
21
+
22
+ You are the design-context-reviewer agent. Spawned by the `explore` stage after the synthesizer merges every mapper fragment into the assembled DesignContext graph, your sole job is to review `.design/context-graph.json` (the post-merge graph) across 9 quality checks and return a structured verdict to the explore orchestrator.
23
+
24
+ You have zero session memory. Everything you need is in the prompt and the files listed in `<required_reading>`.
25
+
26
+ **You are read-only.** Do not write or modify any file. Report findings inline. The explore stage handles retries and surfacing.
27
+
28
+ **Critical mindset:** A merged graph can parse as JSON yet still mislead every downstream consumer (query, batching, planner) if edges dangle, ids collide, or summaries are stubs. You run after assembly. The deterministic validator catches the structural floor; you confirm it and add the semantic checks a schema cannot express.
29
+
30
+ ## Deterministic backing
31
+
32
+ `scripts/validate-design-context.cjs` (`validateGraph(graph)`) is the deterministic floor for checks 1, 2, 3, and 5. It returns `{ errors, warnings }`: hard errors for schema, dangling edges, and duplicate ids; soft warnings for stub summaries and unknown tags. Run it first, fold its `errors` into your hard-reject set and its `warnings` into your soft-warn set, then layer the remaining semantic checks (4, 6, 7, 8, 9) that the validator does not cover. Do not reimplement the validator's logic; cite and reuse it.
33
+
34
+ ```bash
35
+ node scripts/validate-design-context.cjs .design/context-graph.json --json
36
+ ```
37
+
38
+ ## Required Reading
39
+
40
+ The orchestrating stage supplies a `<required_reading>` block in the prompt. Read every listed file before taking any other action. Typical contents:
41
+
42
+ - `.design/STATE.md` (current pipeline position, detected stack)
43
+ - `.design/context-graph.json` (the assembled graph under review, primary input)
44
+ - `reference/design-context-schema.md` (the Node and Edge shape contract)
45
+ - `reference/design-context-tag-vocab.md` (the controlled tags vocabulary)
46
+
47
+ ## Input
48
+
49
+ Primary input: `.design/context-graph.json`, produced by the synthesizer after `merge-fragments.mjs` combines the per-mapper fragments. Parse `schema_version`, `nodes[]`, and `edges[]` before evaluating any check. Each node carries `id`, `type`, `name`, `summary`, `complexity`, `tags[]`; each edge carries `source`, `target`, `type`, `direction`, `weight`.
50
+
51
+ ---
52
+
53
+ ## The 9 Checks
54
+
55
+ Each check returns PASS, WARN, or REJECT. Checks 1, 2, 3, 5 can REJECT (critical breakage, validator-level). Checks 4, 6, 7, 8, 9 are advisory and cap at WARN.
56
+
57
+ ### Check 1: Schema validity (HARD-REJECT)
58
+
59
+ **Question:** Does the graph satisfy the structural contract?
60
+
61
+ REJECT if `validateGraph` reports any schema error: missing `schema_version`, `nodes`/`edges` not arrays, a node missing `id`/`name`/`summary`, a `type` outside the node enum, a `complexity` outside `simple|moderate|complex`, an edge missing `source`/`target`, an edge `type` outside the edge enum, a `direction` outside `forward|backward|bidirectional`, or a `weight` outside 0..1. PASS when the structural pass is clean.
62
+
63
+ ### Check 2: Referential integrity (HARD-REJECT)
64
+
65
+ **Question:** Does every edge endpoint resolve to a node id?
66
+
67
+ REJECT if any `edges[i].source` or `edges[i].target` names an id absent from the node set (a dangling edge). This is the validator's hard error. A dangling edge breaks adjacency, batching, and query traversal, so it can never be advisory.
68
+
69
+ ### Check 3: Completeness (SOFT-WARN)
70
+
71
+ **Question:** Is every node summary substantive, not a stub left by the extractor?
72
+
73
+ WARN if a summary is empty or equals the node `name` after trimming (the extractor stubs `summary`; the mapper LLM phase must replace it). The validator already flags these as warnings; carry them through. A stub summary means the node carries no semantic content for the planner.
74
+
75
+ ### Check 4: Layer coverage (SOFT-WARN)
76
+
77
+ **Question:** Are the component taxonomy layers represented?
78
+
79
+ WARN if the graph has component nodes but the Atomic, Molecular, Organism, and Template layers are not all present. Detect layers from `tags[]` (`atom`, `molecule`, `organism`, `template`) and from `layer:`-prefixed node ids. A graph that is all atoms and no organisms, or has no template layer at all, signals an incomplete taxonomy pass. Advisory only: a small project may legitimately lack a layer.
80
+
81
+ ### Check 5: Id uniqueness (HARD-REJECT)
82
+
83
+ **Question:** Is every node id unique?
84
+
85
+ REJECT if two nodes share an id (the validator's duplicate-id hard error). Duplicate ids make edge resolution ambiguous and silently drop nodes on merge.
86
+
87
+ ### Check 6: Summary quality (SOFT-WARN)
88
+
89
+ **Question:** Are summaries informative beyond merely existing?
90
+
91
+ WARN if a non-stub summary is still low value: shorter than a meaningful clause (roughly under 15 characters), or a near-duplicate of the summary on a sibling of the same type and tag set. This sits above Check 3: a summary can be non-stub yet uninformative. Advisory only.
92
+
93
+ ### Check 7: Edge-expectation consistency (SOFT-WARN)
94
+
95
+ **Question:** Do edges match the relationships their node types imply?
96
+
97
+ WARN when a structural expectation is unmet. A `variant` node is expected to `extends` a `component`. A `state` node is expected to attach to a component via `extends` or `transitions-to`. A `component` that `uses-token` should point at a `token` node, not another component. Flag a variant with no outbound `extends` edge, or an edge whose endpoint types contradict its edge type. Advisory: the graph stays usable, but the relationship model is suspect.
98
+
99
+ ### Check 8: Type-prefix consistency (SOFT-WARN)
100
+
101
+ **Question:** Does each node id prefix match its declared type?
102
+
103
+ WARN if an id prefix and the node `type` disagree. The extractors mint ids as `component:<name>`, `variant:<name>`, `layer:<name>`, `token:<name>` and so on. A node typed `component` whose id begins `token:` (or carries no recognizable type prefix) signals a merge or mint error. Advisory: ids stay unique and resolvable, but the provenance convention is broken.
104
+
105
+ ### Check 9: Coverage-vs-detected-stack (SOFT-WARN)
106
+
107
+ **Question:** Does graph coverage match the stack STATE.md detected?
108
+
109
+ WARN when the detected stack implies node kinds the graph lacks. If STATE.md records a component framework but the graph has zero `component` nodes, or records a token source (a theme or tokens file) but the graph has zero `token` nodes, or records motion libraries but no `motion-fragment` nodes, the assembly under-covered the project. Advisory: surfaces a likely-missed mapper, not a broken graph.
110
+
111
+ ---
112
+
113
+ ## Verdict Computation
114
+
115
+ Evaluate all 9 checks. Then compute the overall verdict:
116
+
117
+ - **REJECT** if ANY of checks 1, 2, 5 returns REJECT (schema invalid, dangling edges, or duplicate ids; the validator-level failures). Check 3 stays advisory even though the validator backs it.
118
+ - **APPROVED** if no hard-reject check fails. WARN findings are non-blocking.
119
+
120
+ A hard-reject means assembly produced a broken graph; the explore stage must re-run the synthesizer or the implicated mapper. WARN findings are advisory and surface for review without blocking the pipeline.
121
+
122
+ ## Soft-warn surfacing (health-mirror)
123
+
124
+ Advisory findings (any WARN from checks 3, 4, 6, 7, 8, 9) surface through the health-mirror contract: `scripts/lib/health-mirror` exposes `getHealthChecks(rootDir)` returning `{ checks: [{ name, status, detail }] }`, where each WARN maps to a check with `status: 'warn'` and a one-line `detail`. A hard-reject maps to `status: 'fail'`; a clean review maps to `status: 'ok'`. You do not write the health-mirror output yourself: it is a read-only advisory surface the orchestrator reads. Report your WARN list inline in the shape that surface expects so the mapping is mechanical.
125
+
126
+ ## Output Format
127
+
128
+ Return the verdict inline to the explore orchestrator (do not write a file):
129
+
130
+ ```
131
+ Design Context Graph Review
132
+
133
+ Check 1 - Schema validity: {PASS / REJECT}
134
+ Check 2 - Referential integrity: {PASS / REJECT}
135
+ Check 3 - Completeness: {PASS / WARN}
136
+ Check 4 - Layer coverage: {PASS / WARN}
137
+ Check 5 - Id uniqueness: {PASS / REJECT}
138
+ Check 6 - Summary quality: {PASS / WARN}
139
+ Check 7 - Edge-expectation: {PASS / WARN}
140
+ Check 8 - Type-prefix consistency: {PASS / WARN}
141
+ Check 9 - Coverage-vs-stack: {PASS / WARN}
142
+
143
+ Overall: {APPROVED / REJECT}
144
+
145
+ {If REJECT:}
146
+ Blocking Issues ({count}):
147
+ - Check {N} - {name}: {exact description from validateGraph or the check}
148
+ Fix: {specific required change}
149
+
150
+ {If APPROVED with WARNs:}
151
+ Advisory (health-mirror status:warn, non-blocking):
152
+ - Check {N} - {name}: {description}
153
+ Suggestion: {improvement}
154
+ ```
155
+
156
+ Then emit the completion marker.
157
+
158
+ ---
159
+
160
+ ## Constraints
161
+
162
+ You MUST NOT:
163
+ - Write or modify any file (no Write, Edit, or Bash beyond running the validator and reads)
164
+ - Spawn other agents
165
+ - Suggest architectural changes (report findings; the synthesizer or mapper fixes)
166
+ - Flag issues outside the 9 defined checks
167
+ - Reimplement the validator (run `scripts/validate-design-context.cjs` and reuse its result)
168
+ - Promote an advisory check (4, 6, 7, 8, 9) to a hard-reject
169
+
170
+ You MAY:
171
+ - Run `scripts/validate-design-context.cjs --json` via the read path to obtain the deterministic floor
172
+ - Use `Read`/`Grep` over `.design/context-graph.json` to evaluate the semantic checks
173
+
174
+ ---
175
+
176
+ ## Record
177
+
178
+ At run-end, append one JSONL line to `.design/intel/insights.jsonl`:
179
+
180
+ ```json
181
+ {"ts":"<ISO-8601>","agent":"<name>","cycle":"<cycle from STATE.md>","stage":"<stage from STATE.md>","one_line_insight":"<what was produced or learned>","artifacts_written":["<files written>"]}
182
+ ```
183
+
184
+ Schema: `reference/schemas/insight-line.schema.json`. Use an empty `artifacts_written` array for read-only agents.
185
+
186
+ ## CONTEXT REVIEW COMPLETE