@hegemonart/get-design-done 1.0.7

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 (144) hide show
  1. package/.claude-plugin/marketplace.json +63 -0
  2. package/.claude-plugin/plugin.json +54 -0
  3. package/CHANGELOG.md +221 -0
  4. package/LICENSE +21 -0
  5. package/README.md +724 -0
  6. package/SKILL.md +232 -0
  7. package/agents/README.md +226 -0
  8. package/agents/a11y-mapper.md +118 -0
  9. package/agents/component-taxonomy-mapper.md +88 -0
  10. package/agents/design-advisor.md +139 -0
  11. package/agents/design-assumptions-analyzer.md +171 -0
  12. package/agents/design-auditor.md +383 -0
  13. package/agents/design-context-builder.md +544 -0
  14. package/agents/design-context-checker-gate.md +90 -0
  15. package/agents/design-context-checker.md +260 -0
  16. package/agents/design-discussant.md +98 -0
  17. package/agents/design-doc-writer.md +229 -0
  18. package/agents/design-executor.md +452 -0
  19. package/agents/design-figma-writer.md +302 -0
  20. package/agents/design-fixer.md +180 -0
  21. package/agents/design-integration-checker-gate.md +93 -0
  22. package/agents/design-integration-checker.md +326 -0
  23. package/agents/design-pattern-mapper.md +206 -0
  24. package/agents/design-phase-researcher.md +229 -0
  25. package/agents/design-plan-checker.md +164 -0
  26. package/agents/design-planner.md +352 -0
  27. package/agents/design-reflector.md +175 -0
  28. package/agents/design-research-synthesizer.md +127 -0
  29. package/agents/design-verifier-gate.md +97 -0
  30. package/agents/design-verifier.md +605 -0
  31. package/agents/gdd-graphify-sync.md +100 -0
  32. package/agents/gdd-intel-updater.md +88 -0
  33. package/agents/gdd-learnings-extractor.md +85 -0
  34. package/agents/motion-mapper.md +103 -0
  35. package/agents/token-mapper.md +103 -0
  36. package/agents/visual-hierarchy-mapper.md +95 -0
  37. package/connections/chromatic.md +247 -0
  38. package/connections/claude-design.md +190 -0
  39. package/connections/connections.md +218 -0
  40. package/connections/figma-writer.md +139 -0
  41. package/connections/figma.md +146 -0
  42. package/connections/graphify.md +197 -0
  43. package/connections/pinterest.md +153 -0
  44. package/connections/preview.md +173 -0
  45. package/connections/refero.md +189 -0
  46. package/connections/storybook.md +280 -0
  47. package/hooks/budget-enforcer.js +318 -0
  48. package/hooks/context-exhaustion.js +127 -0
  49. package/hooks/gdd-read-injection-scanner.js +44 -0
  50. package/hooks/hooks.json +44 -0
  51. package/package.json +60 -0
  52. package/reference/BRANCH-PROTECTION.md +65 -0
  53. package/reference/DEPRECATIONS.md +41 -0
  54. package/reference/STATE-TEMPLATE.md +200 -0
  55. package/reference/accessibility.md +190 -0
  56. package/reference/anti-patterns.md +336 -0
  57. package/reference/audit-scoring.md +205 -0
  58. package/reference/checklists.md +137 -0
  59. package/reference/config-schema.md +319 -0
  60. package/reference/debugger-philosophy.md +32 -0
  61. package/reference/heuristics.md +201 -0
  62. package/reference/intel-schema.md +266 -0
  63. package/reference/model-prices.md +37 -0
  64. package/reference/model-tiers.md +118 -0
  65. package/reference/motion.md +285 -0
  66. package/reference/parallelism-rules.md +108 -0
  67. package/reference/priority-matrix.md +31 -0
  68. package/reference/project-skills-guide.md +42 -0
  69. package/reference/review-format.md +107 -0
  70. package/reference/schemas/config.schema.json +41 -0
  71. package/reference/schemas/hooks.schema.json +55 -0
  72. package/reference/schemas/intel.schema.json +191 -0
  73. package/reference/schemas/marketplace.schema.json +72 -0
  74. package/reference/schemas/plugin.schema.json +59 -0
  75. package/reference/shared-preamble.md +82 -0
  76. package/reference/typography.md +229 -0
  77. package/scripts/aggregate-agent-metrics.js +144 -0
  78. package/scripts/apply-branch-protection.sh +75 -0
  79. package/scripts/bootstrap-manifest.txt +3 -0
  80. package/scripts/bootstrap.sh +80 -0
  81. package/scripts/build-intel.cjs +458 -0
  82. package/scripts/detect-stale-refs.cjs +101 -0
  83. package/scripts/extract-changelog-section.cjs +57 -0
  84. package/scripts/release-smoke-test.cjs +169 -0
  85. package/scripts/rollback-release.sh +42 -0
  86. package/scripts/run-injection-scanner-ci.cjs +92 -0
  87. package/scripts/validate-frontmatter.cjs +68 -0
  88. package/scripts/validate-schemas.cjs +225 -0
  89. package/scripts/verify-version-sync.cjs +30 -0
  90. package/skills/add-backlog/SKILL.md +47 -0
  91. package/skills/analyze-dependencies/SKILL.md +184 -0
  92. package/skills/apply-reflections/SKILL.md +112 -0
  93. package/skills/audit/SKILL.md +54 -0
  94. package/skills/brief/SKILL.md +75 -0
  95. package/skills/cache-manager/SKILL.md +120 -0
  96. package/skills/compare/SKILL.md +322 -0
  97. package/skills/complete-cycle/SKILL.md +33 -0
  98. package/skills/darkmode/SKILL.md +331 -0
  99. package/skills/debug/SKILL.md +38 -0
  100. package/skills/design/SKILL.md +281 -0
  101. package/skills/discover/SKILL.md +172 -0
  102. package/skills/discuss/SKILL.md +67 -0
  103. package/skills/do/SKILL.md +45 -0
  104. package/skills/explore/SKILL.md +109 -0
  105. package/skills/extract-learnings/SKILL.md +98 -0
  106. package/skills/fast/SKILL.md +44 -0
  107. package/skills/figma-write/SKILL.md +40 -0
  108. package/skills/graphify/SKILL.md +48 -0
  109. package/skills/health/SKILL.md +48 -0
  110. package/skills/help/SKILL.md +76 -0
  111. package/skills/list-assumptions/SKILL.md +60 -0
  112. package/skills/map/SKILL.md +112 -0
  113. package/skills/new-cycle/SKILL.md +35 -0
  114. package/skills/new-project/SKILL.md +53 -0
  115. package/skills/next/SKILL.md +42 -0
  116. package/skills/note/SKILL.md +47 -0
  117. package/skills/optimize/SKILL.md +120 -0
  118. package/skills/pause/SKILL.md +41 -0
  119. package/skills/plan/SKILL.md +251 -0
  120. package/skills/plant-seed/SKILL.md +47 -0
  121. package/skills/pr-branch/SKILL.md +31 -0
  122. package/skills/progress/SKILL.md +60 -0
  123. package/skills/quick/SKILL.md +43 -0
  124. package/skills/reapply-patches/SKILL.md +31 -0
  125. package/skills/reflect/SKILL.md +73 -0
  126. package/skills/resume/SKILL.md +37 -0
  127. package/skills/review-backlog/SKILL.md +45 -0
  128. package/skills/router/SKILL.md +67 -0
  129. package/skills/scan/SKILL.md +721 -0
  130. package/skills/settings/SKILL.md +78 -0
  131. package/skills/ship/SKILL.md +31 -0
  132. package/skills/sketch/SKILL.md +78 -0
  133. package/skills/sketch-wrap-up/SKILL.md +88 -0
  134. package/skills/skill-manifest/SKILL.md +79 -0
  135. package/skills/spike/SKILL.md +67 -0
  136. package/skills/spike-wrap-up/SKILL.md +81 -0
  137. package/skills/stats/SKILL.md +50 -0
  138. package/skills/style/SKILL.md +193 -0
  139. package/skills/synthesize/SKILL.md +93 -0
  140. package/skills/todo/SKILL.md +54 -0
  141. package/skills/undo/SKILL.md +30 -0
  142. package/skills/update/SKILL.md +36 -0
  143. package/skills/verify/SKILL.md +452 -0
  144. package/skills/warm-cache/SKILL.md +113 -0
@@ -0,0 +1,184 @@
1
+ ---
2
+ name: gdd-analyze-dependencies
3
+ description: "Queries the intel store to surface token fan-out, component call-graphs, decision traceability, and circular dependency detection. Requires .design/intel/ to exist (run build-intel.cjs first)."
4
+ tools: Bash, Read, Glob, Grep
5
+ ---
6
+
7
+ # /gdd:analyze-dependencies
8
+
9
+ **Role:** Surface dependency relationships, token usage spread, component graphs, and decision traceability using the `.design/intel/` store. No file greps — all queries are O(1) reads against pre-built JSON slices.
10
+
11
+ ## Pre-flight check
12
+
13
+ Before any analysis, verify the intel store exists:
14
+
15
+ ```bash
16
+ ls .design/intel/files.json 2>/dev/null && echo "ready" || echo "missing"
17
+ ```
18
+
19
+ If missing: print the following and stop:
20
+
21
+ ```
22
+ Intel store not found. Build it first:
23
+ node scripts/build-intel.cjs --force
24
+ Then re-run /gdd:analyze-dependencies.
25
+ ```
26
+
27
+ ## Usage modes
28
+
29
+ `/gdd:analyze-dependencies` — run all four analyses and print a combined report
30
+ `/gdd:analyze-dependencies tokens` — token fan-out only
31
+ `/gdd:analyze-dependencies components` — component call-graph only
32
+ `/gdd:analyze-dependencies decisions` — decision traceability only
33
+ `/gdd:analyze-dependencies circular` — circular dependency detection only
34
+
35
+ ## Analysis 1 — Token fan-out
36
+
37
+ **What:** Which design tokens are referenced in the most files? Which are orphaned (defined but never used)?
38
+
39
+ **Protocol:**
40
+
41
+ 1. Read `.design/intel/tokens.json`
42
+ 2. Group entries by `token` value
43
+ 3. Count distinct `file` values per token
44
+ 4. Sort descending by file count
45
+ 5. Print top-20 most-referenced tokens:
46
+
47
+ ```
48
+ ━━━ Token fan-out ━━━
49
+ Token Files Category
50
+ --color-primary 12 color
51
+ --space-4 9 spacing
52
+ --font-size-body 7 typography
53
+ ...
54
+ (top 20 shown)
55
+
56
+ Orphaned tokens (referenced in exactly 1 file):
57
+ --shadow-card-hover (skills/design/SKILL.md:44)
58
+ ━━━━━━━━━━━━━━━━━━━━━
59
+ ```
60
+
61
+ ## Analysis 2 — Component call-graph
62
+
63
+ **What:** Which components are referenced most widely? Which files reference a given component?
64
+
65
+ **Protocol:**
66
+
67
+ 1. Read `.design/intel/components.json`
68
+ 2. Group by `component` name
69
+ 3. Count distinct `file` values per component
70
+ 4. Sort descending by reference count
71
+ 5. Print top-20 most-referenced components with their source files:
72
+
73
+ ```
74
+ ━━━ Component call-graph ━━━
75
+ Component References Files
76
+ Button 14 skills/design/SKILL.md, agents/design-executor.md, ...
77
+ Card 9 skills/verify/SKILL.md, reference/heuristics.md, ...
78
+ ...
79
+ (top 20 shown)
80
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━
81
+ ```
82
+
83
+ If a specific component name is passed as a second argument (e.g., `/gdd:analyze-dependencies components Button`), show only that component's referencing files, one per line.
84
+
85
+ ## Analysis 3 — Decision traceability
86
+
87
+ **What:** Which decisions from DESIGN-CONTEXT.md are referenced by which skill/agent files?
88
+
89
+ **Protocol:**
90
+
91
+ 1. Read `.design/intel/decisions.json` to get known decision IDs (D-01, D-02, ...)
92
+ 2. Read `.design/intel/symbols.json` to find files that contain decision headings
93
+ 3. Read `.design/intel/dependencies.json` for @-reference chains
94
+ 4. For each decision in decisions.json, grep the intel store's files index:
95
+
96
+ ```bash
97
+ grep -r "D-[0-9][0-9]*" .design/intel/decisions.json | head -20
98
+ ```
99
+
100
+ 5. Cross-reference with which skill/agent files cite that decision ID (look in symbols.json for heading anchors matching decision patterns)
101
+
102
+ 6. Print:
103
+
104
+ ```
105
+ ━━━ Decision traceability ━━━
106
+ D-01 Use Figma MCP for token extraction
107
+ Referenced by: skills/scan/SKILL.md:12, agents/design-executor.md:7
108
+
109
+ D-02 Merge-not-replace pattern for Figma tokens
110
+ Referenced by: (no explicit references found)
111
+
112
+ Total: 3 decisions tracked, 2 with file references
113
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━
114
+ ```
115
+
116
+ If `.design/intel/decisions.json` contains no entries (e.g., no DESIGN-CONTEXT.md exists yet), print:
117
+ ```
118
+ No decisions indexed. Run node scripts/build-intel.cjs after creating .design/DESIGN-CONTEXT.md.
119
+ ```
120
+
121
+ ## Analysis 4 — Circular dependency detection
122
+
123
+ **What:** Detect cycles in the `@`-reference graph (File A -> File B -> File A).
124
+
125
+ **Protocol:**
126
+
127
+ 1. Read `.design/intel/graph.json`
128
+ 2. Build an adjacency map from `edges` array: `{ from -> [to, to, ...] }`
129
+ 3. Run depth-first search with path tracking to detect back-edges (cycles)
130
+ 4. Algorithm:
131
+
132
+ ```
133
+ visited = {}
134
+ path = []
135
+ cycles = []
136
+
137
+ function dfs(node):
138
+ if node in path:
139
+ cycle_start = path.index(node)
140
+ cycles.append(path[cycle_start:] + [node])
141
+ return
142
+ if node in visited: return
143
+ visited.add(node)
144
+ path.append(node)
145
+ for neighbor in adjacency[node]:
146
+ dfs(neighbor)
147
+ path.pop()
148
+ ```
149
+
150
+ 5. Print detected cycles (or "No circular dependencies detected"):
151
+
152
+ ```
153
+ ━━━ Circular dependency detection ━━━
154
+ Cycle 1:
155
+ skills/verify/SKILL.md
156
+ -> reference/accessibility.md
157
+ -> skills/verify/SKILL.md <- CYCLE
158
+
159
+ Total cycles: 1
160
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
161
+ ```
162
+
163
+ If no cycles: `All clear — no circular dependencies detected.`
164
+
165
+ ## Combined report format
166
+
167
+ When run without a mode argument, print all four analyses in sequence separated by blank lines. Prefix the overall report with:
168
+
169
+ ```
170
+ ━━━ Dependency Analysis ━━━
171
+ Intel store: .design/intel/
172
+ Generated: <timestamp from files.json>
173
+ Files indexed: <count>
174
+ ```
175
+
176
+ ## Required reading (conditional)
177
+
178
+ @.design/intel/tokens.json (if present)
179
+ @.design/intel/components.json (if present)
180
+ @.design/intel/dependencies.json (if present)
181
+ @.design/intel/decisions.json (if present)
182
+ @.design/intel/graph.json (if present)
183
+
184
+ ## ANALYZE-DEPENDENCIES COMPLETE
@@ -0,0 +1,112 @@
1
+ ---
2
+ name: gdd-apply-reflections
3
+ description: "Review and selectively apply proposals from .design/reflections/<cycle-slug>.md. Diffs each proposal, prompts user to accept/skip/edit, then writes changes."
4
+ argument-hint: "[--cycle <slug>] [--filter <FRONTMATTER|REFERENCE|BUDGET|QUESTION|GLOBAL-SKILL>] [--dry-run]"
5
+ tools: Read, Write, Edit, Bash, Glob
6
+ ---
7
+
8
+ # /gdd:apply-reflections
9
+
10
+ Interactive proposal review loop. Reads `.design/reflections/<cycle-slug>.md`, walks each numbered proposal, and applies accepted ones to the appropriate target file. Nothing is applied without explicit user confirmation.
11
+
12
+ ## Steps
13
+
14
+ ### 1. Resolve reflections file
15
+
16
+ - If `--cycle <slug>` given: load `.design/reflections/<slug>.md`
17
+ - Else: glob `.design/reflections/*.md`, sort by modified time descending, load the most recent
18
+ - If no file found: error "No reflections found. Run `/gdd:reflect` first."
19
+ - Print: "Reviewing reflections: <filename>"
20
+
21
+ ### 2. Parse proposals
22
+
23
+ Scan file for lines matching `### Proposal N — [TYPE] ...`. Extract each proposal block (Why / Change / Risk).
24
+
25
+ If `--filter <TYPE>` given: skip proposals whose type tag doesn't match.
26
+
27
+ Print: "Found N proposals (N after filter)."
28
+
29
+ ### 3. Review loop
30
+
31
+ For each proposal (in order):
32
+
33
+ Print the full proposal block:
34
+ ```
35
+ ─────────────────────────────────────────
36
+ Proposal N/TOTAL — [TYPE] Title
37
+ Risk: low|medium
38
+
39
+ Why: ...
40
+ Change: ...
41
+ ─────────────────────────────────────────
42
+ (a) apply (s) skip (e) edit (q) quit
43
+ ```
44
+
45
+ If `--dry-run`: print `[dry-run — would prompt here]` and continue to next proposal without prompting.
46
+
47
+ Based on user choice:
48
+ - **a** — apply (see Apply Logic below)
49
+ - **s** — mark proposal as `**Reviewed: skipped**` in the reflections file; continue
50
+ - **e** — show the Change text, ask user to provide edited version, then apply the edited version
51
+ - **q** — stop processing; print "Stopped at proposal N. Resume with `/gdd:apply-reflections --cycle <slug>`."
52
+
53
+ ### 4. Apply Logic by Proposal Type
54
+
55
+ #### [FRONTMATTER]
56
+ 1. Extract agent name from Change field (e.g., `agents/design-verifier.md`)
57
+ 2. Read the agent file
58
+ 3. Find the frontmatter line matching the field being changed
59
+ 4. Use Edit tool to update the specific line
60
+ 5. Append `**Applied**: <date>` to the proposal in reflections file
61
+
62
+ #### [REFERENCE]
63
+ 1. Extract target file path from Change field (e.g., `reference/heuristics.md`)
64
+ 2. If file exists: append the drafted text using Edit tool
65
+ 3. If file doesn't exist: create it with a minimal header + the drafted text using Write tool
66
+ 4. Append `**Applied**: <date>` to proposal in reflections file
67
+
68
+ #### [BUDGET]
69
+ 1. Read `.design/budget.json`
70
+ 2. Locate the key path from the Change field (e.g., `design-verifier.per_run_cap_usd`)
71
+ 3. Update the value
72
+ 4. Write updated JSON back to `.design/budget.json`
73
+ 5. Append `**Applied**: <date>` to proposal in reflections file
74
+
75
+ #### [QUESTION]
76
+ 1. Read `agents/design-discussant.md`
77
+ 2. Find the question text specified in the Change field
78
+ 3. If pruning: remove the question lines using Edit tool
79
+ 4. If rewording: replace the question text using Edit tool
80
+ 5. Append `**Applied**: <date>` to proposal in reflections file
81
+
82
+ #### [GLOBAL-SKILL]
83
+ 1. Extract target filename from Change field (e.g., `design-color-conventions.md`)
84
+ 2. Ensure `~/.claude/gdd/global-skills/` directory exists (create with `mkdir -p` if not)
85
+ 3. If target file exists: append new content using Edit tool (add a `---` separator first)
86
+ 4. If target file doesn't exist: create with header + content using Write tool:
87
+ ```markdown
88
+ # <Topic> Conventions (Global)
89
+ *Promoted from project: <project-name>, cycle: <cycle-slug>*
90
+
91
+ <content>
92
+ ```
93
+ 5. Print: "Global skill written to ~/.claude/gdd/global-skills/<name>.md — auto-loads in all future gdd sessions"
94
+ 6. Append `**Applied**: <date>` to proposal in reflections file
95
+
96
+ ### 5. Summary
97
+
98
+ After all proposals processed (or `q`):
99
+ ```
100
+ ─────────────────────────────────────────
101
+ Apply-reflections complete
102
+ Applied: N
103
+ Skipped: N
104
+ Remaining: N (run again to continue)
105
+ ─────────────────────────────────────────
106
+ ```
107
+
108
+ ## Do Not
109
+
110
+ - Do not apply any proposal without the user explicitly choosing `a` or `e`.
111
+ - Do not modify source code files (`.ts`, `.tsx`, `.css`, `.js`) — only agent files, reference files, budget.json, discussant questions, and global skills.
112
+ - Do not re-run the reflector — this skill only applies existing proposals.
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: gdd-audit
3
+ description: "Run design audit — wraps design-verifier + design-auditor + design-reflector. --retroactive audits the full cycle scope."
4
+ argument-hint: "[--retroactive] [--quick] [--no-reflect]"
5
+ tools: Read, Write, Task, Glob
6
+ ---
7
+
8
+ # /gdd:audit
9
+
10
+ Wraps the existing `design-auditor`, `design-verifier`, and `design-integration-checker` agents — no new auditor logic here. Parses flags, spawns the right combination, prints summary.
11
+
12
+ ## Modes
13
+
14
+ ### Default
15
+ Spawn `design-auditor` (6-pillar scoring 1–4) in parallel with `design-integration-checker`. After both finish, read `.design/DESIGN-AUDIT.md` and `.design/DESIGN-INTEGRATION.md` and print a consolidated summary (scores + top 3 findings each).
16
+
17
+ After the auditor and integration checker complete, check if `.design/learnings/` exists and contains at least one `.md` file. If so — and unless `--no-reflect` is passed — spawn `design-reflector` for the current cycle. Append the reflection proposal count to the audit summary: "Reflection: N proposals → review with `/gdd:apply-reflections`".
18
+
19
+ ### `--retroactive`
20
+ Spawn `design-verifier` with cycle-span scope. Verifier reads all tasks completed in the current cycle (from STATE.md `<completed_tasks>` list for the active `cycle:` ID) and uses `DESIGN-PLAN.md` goals as the reference baseline for what "should have been done." Output: `.design/DESIGN-VERIFICATION.md` with per-task pass/fail.
21
+
22
+ ### `--quick`
23
+ Run only `design-auditor` (skip `design-integration-checker`). Faster health check when integration isn't the concern.
24
+
25
+ ## Steps
26
+
27
+ 1. Parse args for `--retroactive`, `--quick`, and `--no-reflect`.
28
+ 2. Verify `.design/STATE.md` exists; abort if not (suggest `/gdd:new-project`).
29
+ 3. Spawn the appropriate agents (Task tool). Default and `--retroactive` spawn two agents; `--quick` spawns one.
30
+ 4. Wait for completion, then read each output file and print a summary:
31
+ - Auditor scores per pillar
32
+ - Integration check pass/fail
33
+ - Verifier pass/fail per task (retroactive mode)
34
+ 5. **Reflection step** (default + retroactive modes only, skipped with `--no-reflect` or `--quick`):
35
+ - Check if `.design/learnings/` exists and has ≥1 `.md` file
36
+ - If yes: spawn `design-reflector` for the current cycle slug (read from STATE.md)
37
+ - After completion: count proposal types and append to summary
38
+ 6. Recommend next action based on findings (e.g., "Score 2/4 on typography — run `/gdd:discuss typography` to gather decisions").
39
+
40
+ ## Registered Audit Agents
41
+
42
+ | Agent | Trigger | Output |
43
+ |---|---|---|
44
+ | `design-auditor` | Default, retroactive | `.design/DESIGN-AUDIT.md` |
45
+ | `design-integration-checker` | Default, retroactive | `.design/DESIGN-INTEGRATION.md` |
46
+ | `design-verifier` | `--retroactive` only | `.design/DESIGN-VERIFICATION.md` |
47
+ | `design-reflector` | Default + retroactive when learnings exist | `.design/reflections/<slug>.md` |
48
+
49
+ ## Do Not
50
+
51
+ - Do not modify source files.
52
+ - Do not rerun stages; this is a read-only audit.
53
+
54
+ ## AUDIT COMPLETE
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: gdd-brief
3
+ description: "Design intake — captures problem statement, audience, constraints, success metrics, and scope into .design/BRIEF.md (Stage 1 of 5)"
4
+ argument-hint: "[--re-brief to redo intake on existing project]"
5
+ tools: Read, Write, AskUserQuestion
6
+ ---
7
+
8
+ # Get Design Done — Brief
9
+
10
+ **Role:** You are the Brief stage. Stage 1 of 5 in the get-design-done pipeline.
11
+
12
+ **Purpose:** Capture the design problem before any scanning or exploration. Produces `.design/BRIEF.md`.
13
+
14
+ ---
15
+
16
+ ## Step 1 — Check for existing BRIEF.md
17
+
18
+ 1. Read `.design/BRIEF.md` if it exists.
19
+ 2. Parse it into sections: Problem, Audience, Constraints, Success Metrics, Scope.
20
+ 3. Note which sections are already answered (non-empty).
21
+ 4. If `--re-brief` flag is passed, ignore existing answers and ask all five questions.
22
+ 5. Otherwise, only ask questions for unanswered sections.
23
+
24
+ ## Step 2 — Interview
25
+
26
+ Ask the following one at a time using `AskUserQuestion`, only for unanswered sections:
27
+
28
+ 1. **Problem** — "What design problem are we solving? (user-facing outcome)"
29
+ 2. **Audience** — "Who is the primary audience? (role, device, context)"
30
+ 3. **Constraints** — "What constraints apply? (tech stack, brand, time, a11y requirements)"
31
+ 4. **Success Metrics** — "How will we measure success? (specific metrics or outcomes)"
32
+ 5. **Scope** — "What is in/out of scope for this cycle?"
33
+
34
+ Do not proceed to the next question until the current one is answered.
35
+
36
+ ## Step 3 — Write .design/BRIEF.md
37
+
38
+ Write the brief with these sections, preserving any pre-existing answers:
39
+
40
+ ```markdown
41
+ # Design Brief — <project name>
42
+
43
+ ## Problem
44
+ <answer>
45
+
46
+ ## Audience
47
+ <answer>
48
+
49
+ ## Constraints
50
+ <answer>
51
+
52
+ ## Success Metrics
53
+ <answer>
54
+
55
+ ## Scope
56
+ <answer>
57
+ ```
58
+
59
+ ## Step 4 — Update STATE.md
60
+
61
+ - If `.design/STATE.md` does not exist, create it from `reference/STATE-TEMPLATE.md`.
62
+ - Set frontmatter `stage: explore` (next stage).
63
+ - Update `last_checkpoint` to now.
64
+ - Write STATE.md.
65
+
66
+ ## After Writing
67
+
68
+ ```
69
+ ━━━ Brief complete ━━━
70
+ Saved: .design/BRIEF.md
71
+ Next: @get-design-done explore
72
+ ━━━━━━━━━━━━━━━━━━━━━━━
73
+ ```
74
+
75
+ ## BRIEF COMPLETE
@@ -0,0 +1,120 @@
1
+ ---
2
+ name: gdd-cache-manager
3
+ description: "Maintains .design/cache-manifest.json for Layer B explicit cache per D-08. Computes deterministic SHA-256 input-hash from (agent-path + sorted-input-file-paths + input-content-hashes). On spawn: lookup key → return cached blob if within TTL, else miss. On completion: write result + TTL. Consulted by hooks/budget-enforcer.js before every Agent spawn."
4
+ user-invocable: false
5
+ tools: Read, Bash, Write
6
+ ---
7
+
8
+ # gdd-cache-manager
9
+
10
+ ## Role
11
+
12
+ You are the deterministic cache-key computer and cache-manifest writer for the optimization layer. You do not spawn agents, and you do not make model calls. You read agent paths, input file paths, and input file contents; you compute a stable SHA-256 key; you look that key up in `.design/cache-manifest.json`; you return a hit (cached result + `cache_hit: true`) or a miss. On spawn completion, the orchestrator calls you again to persist the result. You are Layer B of the two-layer cache (D-08). Layer A — Anthropic's 5-min prompt cache — is not owned by you; it's owned by the shared-preamble ordering convention in `agents/README.md`.
13
+
14
+ ## Invocation Contract
15
+
16
+ ### Phase 1: compute-key
17
+
18
+ - **Input**: `{agent_path: string, input_file_paths: string[]}` — `agent_path` is the absolute or repo-relative path to the `agents/<name>.md` file; `input_file_paths` is the sorted-unique list of files the agent will read.
19
+ - **Output**: `{input_hash: string}` — 64-character lowercase SHA-256 hex.
20
+ - **Algorithm**: canonicalize inputs, concat with newline separators, SHA-256 (see Deterministic Input-Hash Algorithm below).
21
+
22
+ ### Phase 2: lookup
23
+
24
+ - **Input**: `{input_hash: string}`
25
+ - **Output**: `{hit: true, result: string, expires_at: string} | {hit: false}`
26
+ - Reads `.design/cache-manifest.json`. If key absent → miss. If present and `Date.now() >= entry.expires_at` → miss (lazy cleanup: caller may evict but is not required to). Else → hit with `entry.result`.
27
+
28
+ ### Phase 3: short-circuit-or-miss
29
+
30
+ - On hit: orchestrator short-circuits the spawn. Budget-enforcer hook (Plan 10.1-01) emits `SkippedCached` telemetry with `tokens_in: 0, tokens_out: 0, cache_hit: true, est_cost_usd: 0` (writer lands in Plan 10.1-05). Returns cached `result` as the tool output.
31
+ - On miss: orchestrator proceeds with real spawn. Cache-manager is not involved until Phase 4.
32
+
33
+ ### Phase 4: write-result-on-completion
34
+
35
+ - **Input**: `{input_hash: string, agent: string, result: string, ttl_seconds: number}` — `ttl_seconds` defaults to `.design/budget.json.cache_ttl_seconds` (3600 if budget.json absent).
36
+ - **Behavior**: open `.design/cache-manifest.json` (create if missing), set key `input_hash` → `{agent, result, written_at, ttl_seconds, expires_at}`, write file. `written_at` is `new Date().toISOString()`. `expires_at` is `written_at + ttl_seconds` as ISO.
37
+
38
+ ## Deterministic Input-Hash Algorithm
39
+
40
+ The canonical reference implementation (the single source of truth; `hooks/budget-enforcer.js` will import the same primitive via a shared helper in Plan 10.1-05 when telemetry lands):
41
+
42
+ ```js
43
+ // Deterministic cache-key primitive (reference implementation)
44
+ // hash = SHA-256(
45
+ // agent_path + "\n" +
46
+ // sorted(input_file_paths).join("\n") + "\n" +
47
+ // sorted(input_file_paths)
48
+ // .map(p => sha256(readFileSync(p, "utf8")))
49
+ // .join("\n")
50
+ // )
51
+ const crypto = require('crypto');
52
+ const fs = require('fs');
53
+
54
+ function sha256Hex(s) {
55
+ return crypto.createHash('sha256').update(s, 'utf8').digest('hex');
56
+ }
57
+
58
+ function computeInputHash(agentPath, inputFilePaths) {
59
+ const sortedPaths = [...inputFilePaths].sort();
60
+ const contentHashes = sortedPaths.map(p => {
61
+ try { return sha256Hex(fs.readFileSync(p, 'utf8')); }
62
+ catch { return 'MISSING'; }
63
+ });
64
+ const canonical = [
65
+ agentPath,
66
+ sortedPaths.join('\n'),
67
+ contentHashes.join('\n')
68
+ ].join('\n');
69
+ return sha256Hex(canonical);
70
+ }
71
+ ```
72
+
73
+ Notes for maintainers:
74
+
75
+ - **Sorted-unique paths** — ordering must be stable; caller is expected to de-duplicate. If the same path appears twice the hash still matches as long as caller pre-dedupes before invoking.
76
+ - **Missing file** — the string `MISSING` is used in place of the content hash so a missing dependency doesn't silently collide with an empty file (empty file's SHA-256 is `e3b0c44...`). Missing-file hashes naturally miss on the next read because the real file has a different content hash.
77
+ - **Agent-path** — agents changing their own body (role, tools, output contract) invalidate all their cache entries automatically because the agent file's content is not hashed; but the `agent_path` string is concatenated. Upgrading agents between versions naturally busts the cache only when the path changes. Plan 10.1-04 (shared preamble extraction) is expected to slightly adjust agent bodies — consumers should treat the first post-10.1 run as a full cache miss, which is the intended behavior.
78
+
79
+ ## Manifest Shape
80
+
81
+ See `reference/config-schema.md` §.design/cache-manifest.json Schema (Phase 10.1) for the authoritative schema. Keyed object, flat SHA-256 hex keys. Example:
82
+
83
+ ```json
84
+ {
85
+ "a3f1e...": {
86
+ "agent": "design-verifier",
87
+ "result": "<base64-or-path>",
88
+ "written_at": "2026-04-18T12:00:00Z",
89
+ "ttl_seconds": 3600,
90
+ "expires_at": "2026-04-18T13:00:00Z"
91
+ }
92
+ }
93
+ ```
94
+
95
+ ## Integration Points
96
+
97
+ - **`hooks/budget-enforcer.js`** (Plan 10.1-01) reads the manifest on every Agent spawn. The hook already calls `cacheLookup(agent, inputHash)` against `.design/cache-manifest.json`. This skill is the authority on how `inputHash` is computed so the hook and any orchestrator agree byte-for-byte.
98
+ - **Orchestrators** (e.g., `skills/map/`, `skills/discover/`, `skills/plan/`) invoke Phase 1 (compute-key) + Phase 4 (write-result-on-completion) around each Agent spawn they launch. Phase 2 + Phase 3 are executed by the hook.
99
+ - **Warm-cache command** (`skills/warm-cache/SKILL.md`, Task 02) does not touch Layer B — it only primes Anthropic's 5-min prompt cache (Layer A). Do not confuse the two.
100
+
101
+ ## Failure Modes
102
+
103
+ - `.design/cache-manifest.json` missing or malformed → treat every lookup as miss; orchestrator proceeds with full spawn. Do not throw.
104
+ - File system write fails on Phase 4 → log to stderr, do not throw (the spawn already completed successfully; losing a cache write is a performance regression, not a correctness bug).
105
+ - `agent_path` file missing → compute hash anyway using the provided string; cache entries for a deleted agent simply never hit again.
106
+
107
+ ## Non-Goals
108
+
109
+ Per D-09:
110
+
111
+ - No semantic / graph-based lookup. Manifest is a dumb KV store keyed by content hash.
112
+ - No cross-project cache sharing. Manifest lives at `.design/cache-manifest.json`, scoped per repo.
113
+ - No eviction beyond lazy expiry on read. A `/gdd:cache-prune` command is a Phase 11 reflector candidate, not 10.1 scope.
114
+ - No hash-algorithm tuning. SHA-256 is fixed; if a future phase wants BLAKE3, bump the manifest schema version (not relevant in v1).
115
+
116
+ ## TTL Semantics
117
+
118
+ - Default `ttl_seconds` = `.design/budget.json.cache_ttl_seconds` = 3600s (1 hour) per D-10.
119
+ - `expires_at` is computed at write time and stored; readers do not recompute.
120
+ - Lazy cleanup: stale entries are not actively deleted on read (overhead for no benefit in normal operation). A separate reaper is optional and out of v1 scope.