@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
@@ -26,32 +26,23 @@ tree of an existing or legacy codebase, find design debt, group it by category,
26
26
  each finding by priority, and write a single project-scoped report at
27
27
  `.design/debt/DEBT-CATALOG.md`.
28
28
 
29
- You run once against the whole project, not against one cycle of work. This is the
30
- defining difference from `design-auditor`: that agent is cycle-scoped and reads the
31
- pipeline's recently completed work, while you ignore cycle state entirely and survey
32
- everything that exists on disk right now.
33
-
34
- You are a pure catalog. You do NOT modify source code, you do NOT apply fixes, and you
35
- do NOT spawn other agents. For every finding you suggest a remediation command the user
36
- can run later; you never run it yourself.
29
+ You run once against the whole project, not one cycle of work (the defining difference
30
+ from cycle-scoped `design-auditor`). You are a pure catalog: you do NOT modify source code,
31
+ apply fixes, or spawn other agents. For every finding you suggest a remediation command the
32
+ user can run later; you never run it yourself.
37
33
 
38
34
  ## CRITICAL: Project-Wide Scope, Not Cycle Scope
39
35
 
40
- **You do NOT read `.design/STATE.md` `<completed_tasks>`.** You do not scope to the
41
- current cycle, the current wave, or any recently touched file list. Your scope is the
42
- whole source tree.
36
+ **You do NOT read `.design/STATE.md` `<completed_tasks>`.** You do not scope to the current
37
+ cycle, wave, or any recently touched file list. Your scope is the whole source tree.
43
38
 
44
39
  - You **walk the entire codebase**, every source file under the configured source roots
45
- (default `src/`), regardless of when it was last changed or whether any GDD cycle ever
46
- touched it.
47
- - You write to a **project-scoped** path: `.design/debt/DEBT-CATALOG.md`. This is not a
48
- cycle artifact and is not placed under any cycle directory.
49
- - You may read `.design/STATE.md` only to learn the `source_roots` value. You ignore its
50
- `<completed_tasks>`, `<position>`, `wave`, and `cycle` fields for scoping. If STATE.md
51
- is absent, default the source root to `src/` and proceed.
52
-
53
- If you ever find yourself filtering files by a completed-task list, stop: that is the
54
- cycle-scoped behavior this agent exists to avoid.
40
+ (default `src/`), regardless of when it last changed or whether a GDD cycle touched it.
41
+ - You write to one **project-scoped** path, `.design/debt/DEBT-CATALOG.md`, never under a cycle.
42
+ - You may read `.design/STATE.md` solely for `source_roots`; ignore its `<completed_tasks>`,
43
+ `<position>`, `wave`, and `cycle` fields. If STATE.md is absent, default to `src/`.
44
+ - If you ever find yourself filtering files by a completed-task list, stop: that is the
45
+ cycle-scoped behavior this agent exists to avoid.
55
46
 
56
47
  ## Required Reading
57
48
 
@@ -63,14 +54,36 @@ listed file before acting. Minimum expected files:
63
54
  - @reference/anti-slop-rubric.md
64
55
  - @reference/reviewer-confidence-gate.md
65
56
 
66
- `reference/debt-categories.md` is the taxonomy you classify against and the source of
67
- the priority-scoring model. `reference/anti-patterns.md` is the BAN-NN and SLOP-NN
68
- catalog that the anti-pattern class cross-references.
57
+ `reference/debt-categories.md` is the taxonomy and the source of the priority-scoring model.
58
+ `reference/anti-patterns.md` is the BAN-NN and SLOP-NN catalog the anti-pattern class cites.
69
59
 
70
60
  ---
71
61
 
72
62
  ## Work
73
63
 
64
+ ### Step 0: Mode selection (graph-aware dual-mode)
65
+
66
+ Check for the typed DesignContext graph at `.design/context-graph.json`. When it exists,
67
+ PREFER graph queries via `scripts/lib/design-context-query.cjs` for the three classes that
68
+ map cleanly, and grep for the rest. When it is absent, run the full grep scan (Step 2) as
69
+ before. Queries (`Q="node ${CLAUDE_PLUGIN_ROOT:-.}/scripts/lib/design-context-query.cjs"`,
70
+ all with `--file .design/context-graph.json --json`):
71
+
72
+ ```bash
73
+ $Q nodes --type component # untokenized: a component id NOT in any uses-token source
74
+ $Q edges --type uses-token # ...the tokenized component ids
75
+ $Q nodes --type anti-pattern # anti-pattern: each node is a direct finding
76
+ $Q edges --type conflicts-with # ...names the sanctioned pattern it collides with
77
+ $Q nodes # complexity outliers: keep complexity === "complex"
78
+ ```
79
+
80
+ A graph hit cites the node `id` as the location and the query as the evidence. The other six
81
+ classes (color-literal, contrast, density-spacing, typography-drift, a11y-text,
82
+ aesthetic-slop) always grep, since the graph lacks their raw `file:line` literal evidence.
83
+ The output contract, the confidence gate (Step 2.5), and the priority scoring (Step 3) are
84
+ identical in both modes: a graph-sourced finding still clears the Pre-Report Gate and carries
85
+ a `confidence` value and a `priority` score.
86
+
74
87
  ### Step 1: Determine source roots
75
88
 
76
89
  Read `source_roots` from `.design/STATE.md` if present; otherwise default to `src/`.
@@ -83,8 +96,9 @@ find src/ -type f \( -name "*.tsx" -o -name "*.jsx" -o -name "*.ts" -o -name "*.
83
96
 
84
97
  ### Step 2: Scan each debt class
85
98
 
86
- Run one pass per class from `reference/debt-categories.md`. Record `file:line` plus the
87
- matched text for every hit so each catalog row is traceable.
99
+ Run one pass per class from `reference/debt-categories.md`, recording `file:line` plus the
100
+ matched text for traceability. When a graph exists (Step 0), the anti-pattern,
101
+ untokenized-component, and complexity-outlier passes below are the no-graph fallback.
88
102
 
89
103
  **color-literal** (raw color values, not token references):
90
104
 
@@ -93,38 +107,31 @@ grep -rEn "#[0-9a-fA-F]{3,8}|rgb\(|rgba\(|hsl\(|hsla\(" src/ \
93
107
  --include="*.tsx" --include="*.jsx" --include="*.css" --include="*.scss" 2>/dev/null
94
108
  ```
95
109
 
96
- Exclude the palette or token-definition file (a literal inside a `var(--x: #hex)`
97
- definition IS the token). Count distinct literals and total occurrences.
110
+ Exclude the token-definition file (a literal inside a `var(--x: #hex)` definition IS the
111
+ token). Count distinct literals and total occurrences.
98
112
 
99
- **anti-pattern** (BAN-NN and SLOP-NN): run the deterministic detector once over the
100
- tree. It returns every statically matchable rule in one pass with `file`, `line`,
101
- `ruleId`, and a reference link, offline and with zero model calls.
113
+ **anti-pattern** (BAN-NN and SLOP-NN): run the deterministic detector once over the tree.
114
+ It returns every statically matchable rule with `file`, `line`, `ruleId`, and a reference
115
+ link, offline.
102
116
 
103
117
  ```bash
104
118
  node "${CLAUDE_PLUGIN_ROOT:-.}/bin/gdd-detect" src/ --json 2>/dev/null || true
105
119
  ```
106
120
 
107
- Parse the JSON `findings` array. The detector cannot match the two subjective rules
108
- (BAN-04 keyboard-action animation, BAN-10 nested equal radius); list those as a
109
- manual-review note rather than counting them.
121
+ Parse the JSON `findings` array. The detector cannot match the two subjective rules (BAN-04
122
+ keyboard-action animation, BAN-10 nested equal radius); list those as a manual-review note.
110
123
 
111
124
  **untokenized-component** (component renders surface without token references):
112
125
 
113
126
  ```bash
114
- # arbitrary bracket values + inline hex inside component files
115
127
  grep -rEn "\[[0-9]+px\]|\[#[0-9a-fA-F]{3,8}\]" src/ \
116
128
  --include="*.tsx" --include="*.jsx" --include="*.vue" --include="*.svelte" 2>/dev/null
117
- # token references present in the same file set (for the ratio)
118
- grep -rEln "var\(--|theme\(" src/ --include="*.tsx" --include="*.jsx" 2>/dev/null
129
+ grep -rEln "var\(--|theme\(" src/ --include="*.tsx" --include="*.jsx" 2>/dev/null # tokenized files
119
130
  ```
120
131
 
121
- A component file with literal or bracket hits and no `var(--` reference is untokenized.
122
- The literal-to-token ratio per file is the strength signal.
132
+ A component file with literal or bracket hits and no `var(--` reference is untokenized; the per-file literal-to-token ratio is the strength signal.
123
133
 
124
- **contrast** (foreground and background pairs below WCAG AA): resolve color pairs that
125
- share an element or selector, compute the ratio, and flag pairs under 4.5:1 for body
126
- text or 3:1 for large text and non-text indicators. Pairs built from unresolvable
127
- runtime values become a manual-review note.
134
+ **contrast** (foreground and background pairs below WCAG AA): resolve color pairs sharing an element or selector, compute the ratio, and flag pairs under 4.5:1 for body text or 3:1 for large text and non-text indicators. Unresolvable runtime pairs become a manual-review note.
128
135
 
129
136
  **density-spacing** (off-scale spacing and inconsistent rhythm):
130
137
 
@@ -133,8 +140,7 @@ grep -rEon "(p|px|py|pt|pb|pl|pr|m|mx|my|mt|mb|ml|mr|gap|space-[xy])-[0-9.]+" sr
133
140
  --include="*.tsx" --include="*.jsx" 2>/dev/null | sort | uniq -c | sort -rn
134
141
  ```
135
142
 
136
- Flag values that are not on the project's modular scale (default 4 / 8 / 12 / 16 / 24 /
137
- 32) and clusters where sibling components use different step counts for one role.
143
+ Flag values off the modular scale (default 4 / 8 / 12 / 16 / 24 / 32) and sibling clusters with mismatched step counts.
138
144
 
139
145
  **typography-drift** (off-scale sizes, too many families, weak weight hierarchy):
140
146
 
@@ -145,8 +151,7 @@ grep -rEon "text-[a-z0-9]+|font-(bold|semibold|medium|normal|light)|font-size:[^
145
151
  grep -rEn "font-family:|fontFamily" src/ --include="*.css" --include="*.ts" 2>/dev/null
146
152
  ```
147
153
 
148
- Flag a long tail of one-off sizes, more than two families, and `font-weight` under 400
149
- on small text.
154
+ Flag a long tail of one-off sizes, more than two families, and `font-weight` under 400 on small text.
150
155
 
151
156
  **a11y-text** (text-content accessibility debt):
152
157
 
@@ -156,14 +161,13 @@ grep -rEn "No data|No results|Nothing here|went wrong|error occurred" src/ \
156
161
  --include="*.tsx" --include="*.jsx" 2>/dev/null
157
162
  ```
158
163
 
159
- Flag meaningful images without `alt`, icon-only controls without an accessible name,
160
- placeholder used as the only label, and generic empty or error copy.
164
+ Flag meaningful images without `alt`, icon-only controls without an accessible name, placeholder-as-only-label, and generic empty or error copy.
161
165
 
162
- **aesthetic-slop** (generically AI-default even when pillars pass): the orthogonal
163
- verb-axis class from `reference/anti-slop-rubric.md`. `agents/design-auditor.md` scores
164
- five axes (Directness, Distinctness, Hierarchy, Authenticity, Density, 1-10 each) and routes
165
- any finding summing below 35 of 50 here as `category: aesthetic-slop`, carrying its
166
- `verb_axes_scored` values plus matched `reference/visual-tells.md` categories as evidence.
166
+ **aesthetic-slop** (generically AI-default even when pillars pass): the orthogonal verb-axis
167
+ class from `reference/anti-slop-rubric.md`. `agents/design-auditor.md` scores five axes
168
+ (Directness, Distinctness, Hierarchy, Authenticity, Density, 1-10 each) and routes any finding
169
+ summing below 35 of 50 here as `category: aesthetic-slop`, carrying its `verb_axes_scored`
170
+ values plus matched `reference/visual-tells.md` categories as evidence.
167
171
 
168
172
  ### Step 2.5: Pre-Report Gate + confidence
169
173
 
@@ -192,12 +196,8 @@ Sort the catalog by `priority` descending. Break ties by visible-delta, then pre
192
196
 
193
197
  ### Step 4: Write the catalog
194
198
 
195
- Create the directory and write the report. Each row suggests a remediation command per
196
- the ROADMAP open-question default: pure catalog, no auto-fix.
197
-
198
- ```bash
199
- mkdir -p .design/debt
200
- ```
199
+ Create the directory (`mkdir -p .design/debt`) and write the report. Each row suggests a
200
+ remediation command per the ROADMAP open-question default: pure catalog, no auto-fix.
201
201
 
202
202
  ---
203
203
 
@@ -11,6 +11,7 @@ typical-duration-seconds: 60
11
11
  reads-only: false
12
12
  writes:
13
13
  - ".design/DESIGN-CONTEXT.md"
14
+ - ".design/context-graph.json"
14
15
  ---
15
16
 
16
17
  @reference/shared-preamble.md
@@ -26,6 +27,7 @@ Aggregates outputs from the 5 mappers, discussant decisions, phase-researcher fi
26
27
  - `.design/map/visual-hierarchy.md` - visual-hierarchy-mapper output
27
28
  - `.design/map/a11y.md` - a11y-mapper output
28
29
  - `.design/map/motion.md` - motion-mapper output
30
+ - `.design/fragments/*.json` - the typed graph fragments the 5 mappers dual-emit (one per mapper); these feed the graph merge below
29
31
  - `.design/STATE.md` - `<decisions>` block (D-XX entries) and `<connections>` block
30
32
  - Any phase-researcher output provided in the spawn prompt `<research>` block
31
33
  - Pinterest MCP (if `pinterest: available` in STATE.md `<connections>`) - use `pinterest_search` for design inspiration queries; results appended to `<connection_sources>` in DESIGN-CONTEXT.md
@@ -85,6 +87,30 @@ Use Glob to confirm presence; skip absent files gracefully and mark section as `
85
87
  ---
86
88
  ```
87
89
 
90
+ ## Graph merge and validation
91
+
92
+ The 5 mappers now dual-emit typed graph fragments to `.design/fragments/<mapper>.json` alongside their `.design/map/*.md`. After they finish, merge those fragments into the typed DesignContext graph, validate it, and derive the human view from it. This runs in addition to the markdown synthesis above (dual-emit, kept for one minor for backward-compat).
93
+
94
+ 1. **Merge fragments into the graph.** Invoke the merge engine over every fragment present:
95
+
96
+ ```bash
97
+ node scripts/lib/design-context/merge-fragments.mjs .design/fragments/*.json > .design/context-graph.json 2> .design/fragments/merge.stderr
98
+ ```
99
+
100
+ `merge-fragments.mjs` dedupes nodes by `id`, recovers or drops dangling edges, and emits the merged Graph (`schema_version`, `generated_at`, `nodes[]`, `edges[]`) per `reference/design-context-schema.md`. Items it could not auto-fix (dropped edges, id collisions it could not reconcile) are written to stderr; keep that stderr for the review pass below.
101
+
102
+ 2. **Validate the graph (hard block).** Run the validator and gate on its exit code:
103
+
104
+ ```bash
105
+ node scripts/validate-design-context.cjs .design/context-graph.json
106
+ ```
107
+
108
+ Exit 0 is clean. A non-zero exit is a hard block: do NOT write a `status: complete` DESIGN-CONTEXT.md over a graph that failed validation. Report the validator output and stop, leaving the prior artifact in place. Soft warnings (for example a `summary` equal to its `name`, or a tag near the vocab boundary) are surfaced but do not block.
109
+
110
+ 3. **Derive the human view FROM the graph.** Treat `.design/context-graph.json` as the source of truth and render `.design/DESIGN-CONTEXT.md` as an auto-derived view of it. Keep the existing section structure so downstream consumers do not break: `<token_system>` from `token` nodes, `<component_inventory>` from `component`/`variant`/`state` nodes grouped by atomic-design layer tag, `<visual_hierarchy>` from `screen`/`pattern`/`anti-pattern` nodes, `<a11y_baseline>` from `a11y-pattern` nodes, `<motion_system>` from `motion-fragment` nodes, and `<decisions>` from STATE.md as before. Each node's `summary` and `tags[]` populate the rows; edges populate the cross-reference notes (for example which components consume which tokens via `uses-token`).
111
+
112
+ 4. **Review pass for could-not-fix items.** Hand the contents of `.design/fragments/merge.stderr` (plus any validator soft-warnings) to an assemble-review pass that cites the offending pattern and proposes a fix back to the owning mapper. Follow the assemble-reviewer pattern used elsewhere in the pipeline for "could not fix" hand-off. A dedicated `assemble-reviewer` agent is a likely future addition for this; do not create or spawn it here. For now, list these items under a `<graph_review>` section in DESIGN-CONTEXT.md so the next cycle can act on them.
113
+
88
114
  ## Handoff mode
89
115
 
90
116
  Handoff mode activates when `handoff_source` is present in `.design/STATE.md <position>`. In this mode, the synthesizer's primary input is the Claude Design handoff bundle rather than the 5 mapper outputs.
@@ -163,7 +189,7 @@ Read .design/STATE.md
163
189
 
164
190
  Before writing any `.design/` artifact, resolve the main repo root via `scripts/lib/worktree-resolve.cjs` (`resolveDesignRoot`) so a worktree run writes to the main checkout and does not leak.
165
191
 
166
- Single file: `.design/DESIGN-CONTEXT.md`.
192
+ Two artifacts (dual-emit): `.design/context-graph.json` (the merged, validated typed graph, source of truth) and `.design/DESIGN-CONTEXT.md` (the auto-derived human view of that graph).
167
193
 
168
194
  ## Record
169
195
 
@@ -11,6 +11,7 @@ typical-duration-seconds: 30
11
11
  reads-only: false
12
12
  writes:
13
13
  - ".design/map/motion.md"
14
+ - ".design/fragments/motion-mapper.json"
14
15
  ---
15
16
 
16
17
  @reference/shared-preamble.md
@@ -25,9 +26,7 @@ You inventory motion and animation patterns. Zero session memory. You do not mod
25
26
 
26
27
  - `.design/STATE.md`
27
28
  - `reference/motion.md` (if present) - **the motion domain-index (Phase 45): start here.** It indexes the
28
- motion fragments below with a "use this when" pointer for each. Load a specific fragment ONLY when you
29
- reach the classification step that needs it (drill-in), not all of them up front - this is the bulk of
30
- the token saving (the index is ~1.7k tokens vs ~15k for all four fragments).
29
+ motion fragments below with a "use this when" pointer for each. Load a specific fragment ONLY when you reach the classification step that needs it (drill-in), not all of them up front.
31
30
  - Drill-in fragments (load on demand, per the index in `motion.md`):
32
31
  - `reference/motion-advanced.md` - advanced patterns: spring physics, scroll-driven, FLIP, View Transitions API, gesture/drag mechanics, clip-path patterns, blur crossfades, Framer Motion hardware-accel gotcha
33
32
  - `reference/motion-easings.md` - 12 canonical easing presets; classify each detected easing against this catalog
@@ -91,10 +90,7 @@ grep -rEn "animation-timeline|ScrollTimeline|useScroll\b" src/ | head -30
91
90
  grep -rEn "\.animate\(\[|WebAnimation|getAnimations" src/ | head -20
92
91
  ```
93
92
 
94
- Classify gesture patterns against `reference/motion-advanced.md` (velocity formula, pointer capture, multi-touch protection).
95
- Classify easing values against the 12 canonical presets in `reference/motion-easings.md`; output `"custom"` with justification for anything that doesn't match.
96
- Classify page/route transitions against the 8 families in `reference/motion-transition-taxonomy.md`.
97
- Classify spring configs against the 4 presets in `reference/motion-spring.md`.
93
+ Classify gesture patterns against `reference/motion-advanced.md` (velocity formula, pointer capture, multi-touch protection), easing values against the 12 presets in `reference/motion-easings.md` (output `"custom"` with justification for anything unmatched), page/route transitions against the 8 families in `reference/motion-transition-taxonomy.md`, and spring configs against the 4 presets in `reference/motion-spring.md`.
98
94
 
99
95
  ## Output Format - `.design/map/motion.md`
100
96
 
@@ -134,10 +130,12 @@ generated: [ISO 8601]
134
130
  ```
135
131
 
136
132
  ## CSS transitions
133
+
137
134
  | File | Property | Duration | Easing | Canonical Easing |
138
135
  |------|----------|----------|--------|-----------------|
139
136
 
140
137
  ## Library usage
138
+
141
139
  | Library | Files | Notes |
142
140
  |---------|-------|-------|
143
141
 
@@ -149,20 +147,20 @@ generated: [ISO 8601]
149
147
  - Narrative (>800ms): [N]
150
148
 
151
149
  ## Easing classification
150
+
152
151
  | Detected Easing | Canonical Name | Count | Notes |
153
152
  |----------------|---------------|-------|-------|
154
153
 
155
154
  ## Advanced patterns detected
155
+
156
156
  | Pattern | Files | Notes |
157
157
  |---------|-------|-------|
158
158
 
159
159
  ## Reduced-motion compliance
160
- - `prefers-reduced-motion` queries present: [N]
161
- - Animated components lacking a reduced-motion branch: [list]
160
+ - `prefers-reduced-motion` queries present: [N]; animated components lacking a reduced-motion branch: [list]
162
161
 
163
162
  ## Score
164
- Reduced-motion compliance: [Full | Partial | None]
165
- Motion consistency: [Consistent | Mixed | Chaotic]
163
+ Reduced-motion compliance: [Full | Partial | None]. Motion consistency: [Consistent | Mixed | Chaotic]
166
164
 
167
165
  ## Micro-motion findings
168
166
 
@@ -207,12 +205,36 @@ After the standard motion inventory, emit a "Micro-motion findings" section with
207
205
  Total: N violations found. (0 = clean)
208
206
  ```
209
207
 
210
- If no violations found, emit: `## Micro-motion findings CLEAN (0 violations)`
208
+ If no violations found, emit: `## Micro-motion findings (CLEAN, 0 violations)`
209
+ ```
210
+
211
+ ## Graph fragment emission
212
+
213
+ Dual-emit: keep writing `.design/map/motion.md` above, and ALSO emit a typed graph fragment for the synthesizer to merge into `.design/context-graph.json`. Fragment shape comes from `reference/design-context-schema.md`; allowed `tags[]` come from `reference/design-context-tag-vocab.md`. Do not invent fields or tags outside those references.
214
+
215
+ ### 1. Deterministic phase
216
+
217
+ ```bash
218
+ node scripts/lib/design-context/extract-motion.mjs <source_root> [<source_root>...] > .design/fragments/motion-mapper.json
211
219
  ```
212
220
 
221
+ `extract-motion.mjs` walks the source roots with regex (zero-dep) and returns a Fragment whose `nodes[]` (`type: motion-fragment`) have `id`, `name`, and a stub `summary` you replace. It maps to the `animations[]` you already inventoried, so reuse that data.
222
+
223
+ ### 2. LLM phase (fill summary, tags, complexity)
224
+
225
+ - `summary`: one sentence per node, distinct from `name`. Example: "Toast enter, opacity plus translateY over 180ms".
226
+ - `tags[]`: from the tag-vocab only (motion terms such as `enter`, `exit`, `gesture`, `scroll-driven`, `reduced-motion`). Drop tags not in the vocab.
227
+ - `complexity`: `simple` for a single CSS transition, `moderate` for a library spring or multi-property tween, `complex` for FLIP, scroll-driven, or gesture-physics patterns.
228
+
229
+ Add `transitions-to` edges between fragments that form an enter/exit pair or a route sequence. Set `direction` and `weight` per the schema.
230
+
231
+ ### 3. Write the fragment
232
+
233
+ Write the Fragment to `.design/fragments/motion-mapper.json` (`schema_version`, `mapper: "motion-mapper"`, `generated_at` ISO 8601, enriched `nodes[]`, `edges[]`), resolving the main repo root so a worktree run does not leak the file.
234
+
213
235
  ## Constraints
214
236
 
215
- No modifications outside `.design/map/`. No git. No agent spawning.
237
+ No modifications outside `.design/map/` and `.design/fragments/`. No git. No agent spawning.
216
238
 
217
239
  ## Record
218
240
 
@@ -11,6 +11,7 @@ typical-duration-seconds: 45
11
11
  reads-only: false
12
12
  writes:
13
13
  - ".design/map/tokens.md"
14
+ - ".design/fragments/token-mapper.json"
14
15
  ---
15
16
 
16
17
  @reference/shared-preamble.md
@@ -140,9 +141,37 @@ Total: N findings. (0 = clean)
140
141
  ```
141
142
  ```
142
143
 
144
+ ## Graph fragment emission
145
+
146
+ Dual-emit: keep writing `.design/map/tokens.md` above, and ALSO emit a typed graph fragment so the synthesizer can merge it into `.design/context-graph.json`. Fragment shape and field rules come from `reference/design-context-schema.md`; the allowed `tags[]` come from `reference/design-context-tag-vocab.md`. Do not invent fields or tags outside those two references.
147
+
148
+ ### 1. Deterministic phase (structural nodes/edges)
149
+
150
+ Run the matching extractor over the same `<source_roots>` you scanned above:
151
+
152
+ ```bash
153
+ node scripts/lib/design-context/extract-tokens.mjs <source_root> [<source_root>...] > .design/fragments/token-mapper.json
154
+ ```
155
+
156
+ `extract-tokens.mjs` walks the source roots with regex (zero-dep) and returns a Fragment whose `nodes[]` have `id`, `type` (`token`, subtype color/spacing/typography/radius/shadow), and `name` filled, plus structural `uses-token` edges from consuming files. Each node `summary` arrives as a STUB you must replace.
157
+
158
+ ### 2. LLM phase (fill summary, tags, complexity)
159
+
160
+ For every node the extractor produced, set:
161
+
162
+ - `summary`: one sentence describing the token's role, distinct from `name` (a summary equal to the name is a soft-warn in the validator). Example for `--color-primary`: "Brand accent used for primary CTAs and active states".
163
+ - `tags[]`: pick from `reference/design-context-tag-vocab.md` only (for tokens, terms such as `color`, `spacing`, `typography`, `semantic`, `brand`). Drop any tag not in the vocab.
164
+ - `complexity`: `simple` for a single literal value, `moderate` for a token that aliases or composes others (for example a shadow built from a 3-layer formula), `complex` for a token whose value depends on mode/theme resolution.
165
+
166
+ Add cross-token edges you can see that the extractor cannot infer: a semantic token aliasing a primitive is `extends`; a shadow token referencing spacing or color primitives is `uses-token`. Set `direction` and `weight` per the schema.
167
+
168
+ ### 3. Write the fragment
169
+
170
+ Write the completed Fragment to `.design/fragments/token-mapper.json` with `schema_version`, `mapper: "token-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.
171
+
143
172
  ## Constraints
144
173
 
145
- You MUST NOT modify anything outside `.design/map/`. Do not run git commands or spawn agents.
174
+ You MUST NOT modify anything outside `.design/map/` and `.design/fragments/`. Do not run git commands or spawn agents.
146
175
 
147
176
  ## Record
148
177
 
@@ -11,6 +11,7 @@ typical-duration-seconds: 45
11
11
  reads-only: false
12
12
  writes:
13
13
  - ".design/map/visual-hierarchy.md"
14
+ - ".design/fragments/visual-hierarchy-mapper.json"
14
15
  ---
15
16
 
16
17
  @reference/shared-preamble.md
@@ -117,9 +118,37 @@ Total: N findings.
117
118
  ```
118
119
  ```
119
120
 
121
+ ## Graph fragment emission
122
+
123
+ Dual-emit: keep writing `.design/map/visual-hierarchy.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.
124
+
125
+ ### 1. Deterministic phase (structural nodes/edges)
126
+
127
+ Run the matching extractor over the same source roots you scanned above:
128
+
129
+ ```bash
130
+ node scripts/lib/design-context/extract-visual-hierarchy.mjs <source_root> [<source_root>...] > .design/fragments/visual-hierarchy-mapper.json
131
+ ```
132
+
133
+ `extract-visual-hierarchy.mjs` walks the source roots with regex (zero-dep) and returns a Fragment whose `nodes[]` have `id`, `type` (`screen` for pages or routes, `pattern` for layout patterns, `anti-pattern` for hierarchy violations you flagged), and `name` filled, with stub `summary` you must replace.
134
+
135
+ ### 2. LLM phase (fill summary, tags, complexity)
136
+
137
+ For every node the extractor produced, set:
138
+
139
+ - `summary`: one sentence describing the screen or pattern and its hierarchy signal, distinct from `name`. Example for an F-pattern node: "Left-aligned scan path with stacked content blocks".
140
+ - `tags[]`: pick from `reference/design-context-tag-vocab.md` only (hierarchy terms such as `f-pattern`, `z-pattern`, `centered`, `type-scale`, `focal-weight`). Drop any tag not in the vocab.
141
+ - `complexity`: `simple` for a single layout pattern, `moderate` for a screen combining two patterns, `complex` for a screen with nested or competing focal regions.
142
+
143
+ Add edges the extractor cannot infer: two screens sharing a layout pattern are `mirrors`; a flagged anti-pattern that contradicts a sibling screen's pattern is `conflicts-with`. Set `direction` and `weight` per the schema.
144
+
145
+ ### 3. Write the fragment
146
+
147
+ Write the completed Fragment to `.design/fragments/visual-hierarchy-mapper.json` with `schema_version`, `mapper: "visual-hierarchy-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.
148
+
120
149
  ## Constraints
121
150
 
122
- No modifications outside `.design/map/`. No git. No agent spawning.
151
+ No modifications outside `.design/map/` and `.design/fragments/`. No git. No agent spawning.
123
152
 
124
153
  ## Record
125
154
 
@@ -0,0 +1,137 @@
1
+ ---
2
+ name: gdd-context
3
+ description: "Queries the typed DesignContext graph at .design/context-graph.json - the design-semantic map of tokens, components, variants, states, motion, a11y patterns, screens, layers, and design patterns plus the edges between them. Lists and filters nodes and edges, traces a path between two nodes, finds the consumers of a node, and reports unreachable nodes, dependency cycles, and coverage. Use when the user wants to inspect the design graph, find what depends on a token or component, trace how one node reaches another, or check graph health. Activates for requests involving the design context graph, design dependencies, token consumers, component composition, unreachable design nodes, design cycles, or design coverage."
4
+ argument-hint: "[nodes --type X | edges --type Z | path <a> <b> | consumers-of <id> | unreachable | cycles | coverage]"
5
+ tools: Read, Bash
6
+ user-invocable: true
7
+ ---
8
+
9
+ # /gdd:context
10
+
11
+ **Role:** Read-only front end for the typed DesignContext graph. The graph is a design-semantic map: nodes are tokens, components, variants, states, motion fragments, a11y patterns, screens, layers, and design patterns; edges connect them (uses-token, composes, extends, transitions-to, depends-on, mirrors, conflicts-with, referenced-by, tested-by, documented-by, consumes-context, provides-context). This skill queries that graph. It never writes to it. The graph is authored by the mapper agents plus the design-research-synthesizer; this skill only reads.
12
+
13
+ The query engine ships at `scripts/lib/design-context-query.cjs` (authored elsewhere; this skill only calls it). It is pure and dep-free, exposing `load`, `nodes`, `edges`, `path`, `consumersOf`, `unreachable`, `cycles`, and `coverage`. The merged graph lives at `.design/context-graph.json` with the shape `{ schema_version, generated_at, nodes[], edges[] }`.
14
+
15
+ If `.design/context-graph.json` is absent, print: `No DesignContext graph yet. Run the design research pipeline (mappers plus /gdd:synthesize) to generate .design/context-graph.json.` Then STOP. Do not invent a graph.
16
+
17
+ The engine exposes a module API rather than a CLI, so drive it from a short `node -e` script, the same way other skills call a `scripts/lib` helper:
18
+
19
+ ```bash
20
+ node -e "const q=require('${CLAUDE_PLUGIN_ROOT}/scripts/lib/design-context-query.cjs'); \
21
+ const g=q.load('.design/context-graph.json'); \
22
+ console.log(JSON.stringify(q.nodes(g, { type: process.env.NODE_TYPE || undefined, tag: process.env.TAG || undefined })));"
23
+ ```
24
+
25
+ ## Invocation Modes
26
+
27
+ | Command | Behavior |
28
+ |---|---|
29
+ | `/gdd:context nodes` | List graph nodes, optionally filtered by `--type` and `--tag` (default mode). |
30
+ | `/gdd:context edges` | List graph edges, optionally filtered by `--type`. |
31
+ | `/gdd:context path <a> <b>` | Trace a path from node `<a>` to node `<b>`. |
32
+ | `/gdd:context consumers-of <id>` | List the nodes that consume node `<id>`. |
33
+ | `/gdd:context unreachable` | List nodes no edge reaches. |
34
+ | `/gdd:context cycles` | List dependency cycles in the graph. |
35
+ | `/gdd:context coverage` | Report graph coverage (typed and tagged ratios). |
36
+
37
+ Output discipline: emit JSON when a tool or another skill is the caller; render a compact table when a person is at the terminal.
38
+
39
+ ## nodes
40
+
41
+ List nodes. `--type <t>` filters by node type (token, component, variant, state, motion-fragment, a11y-pattern, screen, layer, pattern, anti-pattern). `--tag <tag>` filters by a controlled tag. Call `nodes(graph, { type, tag })`:
42
+
43
+ ```bash
44
+ node -e "const q=require('${CLAUDE_PLUGIN_ROOT}/scripts/lib/design-context-query.cjs'); \
45
+ const g=q.load('.design/context-graph.json'); \
46
+ console.log(JSON.stringify(q.nodes(g, { type: process.env.NODE_TYPE || undefined, tag: process.env.TAG || undefined })));"
47
+ ```
48
+
49
+ Render one row per node. Keep it scannable:
50
+
51
+ ```
52
+ ID TYPE COMPLEXITY NAME
53
+ token:color/brand token simple Brand primary
54
+ component:Button component moderate Button
55
+ ```
56
+
57
+ If no nodes match, say so plainly and suggest a broader filter.
58
+
59
+ ## edges
60
+
61
+ List edges. `--type <t>` filters by edge type (uses-token, composes, extends, transitions-to, depends-on, mirrors, conflicts-with, referenced-by, tested-by, documented-by, consumes-context, provides-context). Call `edges(graph, { type })`:
62
+
63
+ ```bash
64
+ node -e "const q=require('${CLAUDE_PLUGIN_ROOT}/scripts/lib/design-context-query.cjs'); \
65
+ const g=q.load('.design/context-graph.json'); \
66
+ console.log(JSON.stringify(q.edges(g, { type: process.env.EDGE_TYPE || undefined })));"
67
+ ```
68
+
69
+ Render `source -> target (type, weight)` per row. If none match, report it and suggest dropping the filter.
70
+
71
+ ## path
72
+
73
+ Trace a path between two node ids. Call `path(graph, from, to)`:
74
+
75
+ ```bash
76
+ node -e "const q=require('${CLAUDE_PLUGIN_ROOT}/scripts/lib/design-context-query.cjs'); \
77
+ const g=q.load('.design/context-graph.json'); \
78
+ console.log(JSON.stringify(q.path(g, process.env.FROM, process.env.TO)));"
79
+ ```
80
+
81
+ Print the ordered node ids joined by arrows. If no path exists, print `No path from <a> to <b>.` Do not fabricate intermediate nodes.
82
+
83
+ ## consumers-of
84
+
85
+ List the nodes that consume a given node (the inbound side). Call `consumersOf(graph, id)`:
86
+
87
+ ```bash
88
+ node -e "const q=require('${CLAUDE_PLUGIN_ROOT}/scripts/lib/design-context-query.cjs'); \
89
+ const g=q.load('.design/context-graph.json'); \
90
+ console.log(JSON.stringify(q.consumersOf(g, process.env.ID)));"
91
+ ```
92
+
93
+ Render the consumer ids one per row. If the id is unknown, print `No node <id> in the graph.` and suggest `/gdd:context nodes`.
94
+
95
+ ## unreachable
96
+
97
+ List nodes that no edge reaches (orphans). Call `unreachable(graph)`:
98
+
99
+ ```bash
100
+ node -e "const q=require('${CLAUDE_PLUGIN_ROOT}/scripts/lib/design-context-query.cjs'); \
101
+ const g=q.load('.design/context-graph.json'); \
102
+ console.log(JSON.stringify(q.unreachable(g)));"
103
+ ```
104
+
105
+ If the list is empty, print `Every node is reachable.`
106
+
107
+ ## cycles
108
+
109
+ List dependency cycles. Call `cycles(graph)`:
110
+
111
+ ```bash
112
+ node -e "const q=require('${CLAUDE_PLUGIN_ROOT}/scripts/lib/design-context-query.cjs'); \
113
+ const g=q.load('.design/context-graph.json'); \
114
+ console.log(JSON.stringify(q.cycles(g)));"
115
+ ```
116
+
117
+ Print each cycle as its ordered node ids. If there are none, print `No cycles detected.`
118
+
119
+ ## coverage
120
+
121
+ Report graph coverage. Call `coverage(graph)`:
122
+
123
+ ```bash
124
+ node -e "const q=require('${CLAUDE_PLUGIN_ROOT}/scripts/lib/design-context-query.cjs'); \
125
+ const g=q.load('.design/context-graph.json'); \
126
+ console.log(JSON.stringify(q.coverage(g)));"
127
+ ```
128
+
129
+ Surface the returned ratios (for example typed and tagged coverage and node and edge counts) as a short summary.
130
+
131
+ ## Do Not
132
+
133
+ - Do not edit `.design/context-graph.json` or the fragments under `.design/fragments/`. All writes go through the mapper agents and the synthesizer.
134
+ - Do not invent nodes, edges, or paths. If a query returns nothing, report it plainly.
135
+ - Do not modify `scripts/lib/design-context-query.cjs` or the DesignContext schema.
136
+
137
+ ## CONTEXT COMPLETE
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: discover
3
3
  description: "Stage 1.5 of 4 orchestrator that probes Figma / Refero / Pinterest connections, spawns design-context-builder (auto-detect + interview) and (via lazy gate) design-context-checker (6-dimension validator), producing .design/DESIGN-CONTEXT.md. Use after /gdd:scan when a fast-path context build is wanted instead of the full /gdd:explore. Activates for requests involving detecting an existing design system, inventorying tokens and components, or onboarding a brownfield repo."
4
- argument-hint: "[--auto]"
4
+ argument-hint: "[--auto] [--incremental] [--full]"
5
5
  user-invocable: true
6
6
  ---
7
7
 
@@ -30,6 +30,12 @@ When `--auto` is passed to the builder: if `tailwind.config.{js,cjs,mjs,ts}` exi
30
30
 
31
31
  ---
32
32
 
33
+ ## Incremental Mode (Phase 53, default)
34
+
35
+ `--incremental` is the DEFAULT after Phase 53; pass `--full` to opt out and re-map everything. Incremental runs the change classifier FIRST (via the fingerprint store at `.design/fingerprints/`): it fingerprints the current DesignContext graph, diffs each node against the prior cycle, and dispatches mappers per the verdict. SKIP (cosmetic-only / no-op) dispatches 0 mappers; PARTIAL re-maps only the affected community batches; ARCHITECTURE re-batches the dir-reshaped subset; FULL (or `--full`, or a first run with no prior store) re-maps all batches. The batching + classifier engine lives in `explore` (`scripts/lib/explore-parallel-runner` + `scripts/lib/mappers/incremental-discover.cjs`); this flag selects the path. Detail: `./discover-procedure.md` §Incremental Mode.
36
+
37
+ ---
38
+
33
39
  ## Step 1 - Spawn design-context-builder
34
40
 
35
41
  Spawn `design-context-builder` -> `.design/DESIGN-CONTEXT.md`. The agent auto-detects via grep/glob first and interviews only for areas where auto-detect returned no confident answer. Baseline audit directory chain: `src/` -> `app/` -> `pages/` -> `lib/` -> flag "layout unknown". Common gray areas to probe (Area 7): font-change risk, token-layer introduction risk, component rebuild-vs-restyle. Wait for `## CONTEXT COMPLETE`, then update STATE.md `task_progress = 0.5`. Full prompt: `./discover-procedure.md` §Step 1.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: gdd-explore
3
3
  description: "Stage 2 of 5 - unified exploration merging inventory grep + design interview. Probes 6 connections, scans the codebase, conducts the AskUserQuestion interview, and writes .design/DESIGN.md + DESIGN-DEBT.md + DESIGN-CONTEXT.md. Use after /gdd:brief to map the existing system and lock decisions before planning. Activates for requests involving researching design direction, gathering references, or exploring visual options."
4
- argument-hint: "[--skip-interview] [--skip-scan]"
4
+ argument-hint: "[--skip-interview] [--skip-scan] [--incremental] [--full]"
5
5
  tools: Read, Write, Bash, Grep, Glob, Task, AskUserQuestion, mcp__gdd_state__get, mcp__gdd_state__transition_stage, mcp__gdd_state__probe_connections, mcp__gdd_state__update_progress, mcp__gdd_state__set_status, mcp__gdd_state__add_blocker, mcp__gdd_state__checkpoint, mcp__gdd_state__add_decision
6
6
  ---
7
7
 
@@ -49,6 +49,8 @@ For each greenfield component in scope: `21st_magic_component_search(component_n
49
49
 
50
50
  **Parallelism decision**: read `.design/config.json` + `reference/parallelism-rules.md`. Record verdict via `mcp__gdd_state__set_status` (`"explore_parallel"` / `"explore_serial"`). Parallel -> multiple `Task()` in one response; serial -> sequential.
51
51
 
52
+ **Incremental batching (Phase 53, default)**: `--incremental` (default; `--full` opts out) runs the change classifier first via the fingerprint store, groups the DesignContext graph into Louvain community batches, and dispatches mappers per the verdict (SKIP=0, PARTIAL=affected batches only, FULL=all). Engine: `scripts/lib/explore-parallel-runner` + `scripts/lib/mappers/incremental-discover.cjs`; dispatch concurrency comes from `concurrency-tuner.cjs`. Detail: `./explore-procedure.md` §Incremental Batching.
53
+
52
54
  Run the canonical scan grep/glob inventory (POSIX ERE, preserving PLAT-01/02): component detection (Glob `**/*.{tsx,jsx,vue,svelte}`), color extraction (hex / rgb / hsl / Tailwind arbitrary), typography scan (font-family / Tailwind `font-*` / `text-*`), motion scan (`transition` / `animate-` / `@keyframes` / `framer-motion`), token detection (tailwind.config / CSS custom properties / token JSON), layout detection (ordered fallback `src/` -> `app/` -> `pages/` -> `lib/` -> unknown). Write `.design/DESIGN.md` + `.design/DESIGN-DEBT.md`. Then `mcp__gdd_state__update_progress` for scan progress. Detail: `./explore-procedure.md` §Step 2.
53
55
 
54
56
  **Step 2.x - i18n readiness probe (informational, per D-04)**: check `package.json` deps against `{react-intl, next-intl, i18next, vue-i18n, formatjs, lingui}` -> `framework-managed`; else grep `Intl.(DateTimeFormat|NumberFormat|...)` in `src/` -> `partial`; else `none`. Emit single line `Localization readiness: <state>` in the report. NO gate, NO blocking - surface signal only (D-07). Detail: `./explore-procedure.md` §Step 2.x.