@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,319 @@
1
+ # .design/config.json Schema
2
+
3
+ The config file is created on first `/gdd:settings` call or when any stage initializes a new project. It controls model selection (profile) and how stages dispatch agents in parallel.
4
+
5
+ ## Full Schema
6
+
7
+ ```json
8
+ {
9
+ "model_profile": "balanced",
10
+ "parallelism": {
11
+ "enabled": true,
12
+ "max_parallel_agents": 5,
13
+ "min_tasks_to_parallelize": 2,
14
+ "min_estimated_savings_seconds": 30,
15
+ "require_disjoint_touches": true,
16
+ "worktree_isolation": false,
17
+ "per_stage_override": {
18
+ "explore": { "max_parallel_agents": 5 },
19
+ "design": { "max_parallel_agents": 3 }
20
+ }
21
+ }
22
+ }
23
+ ```
24
+
25
+ ## Default Config
26
+
27
+ If no `.design/config.json` exists, stages and `/gdd:settings` assume:
28
+
29
+ ```json
30
+ {
31
+ "model_profile": "balanced",
32
+ "parallelism": {
33
+ "enabled": true,
34
+ "max_parallel_agents": 5,
35
+ "min_tasks_to_parallelize": 2,
36
+ "min_estimated_savings_seconds": 30,
37
+ "require_disjoint_touches": true,
38
+ "worktree_isolation": false,
39
+ "per_stage_override": {}
40
+ }
41
+ }
42
+ ```
43
+
44
+ ## Fields
45
+
46
+ ### `model_profile`
47
+
48
+ | Value | Planner / Researcher | Executor | Verifier / Checker |
49
+ |---|---|---|---|
50
+ | `"quality"` | Opus | Sonnet | Sonnet |
51
+ | `"balanced"` (default) | Opus | Sonnet | Haiku |
52
+ | `"budget"` | Sonnet | Sonnet | Sonnet |
53
+
54
+ Agents authored with `model: inherit` read the active profile at spawn time. Agents that hard-code `model:` in their frontmatter ignore the profile.
55
+
56
+ ### `parallelism.enabled`
57
+
58
+ Master switch. When `false`, all stages run serially regardless of other settings.
59
+
60
+ ### `parallelism.max_parallel_agents`
61
+
62
+ Cap on simultaneous agent spawns. Default: `5`.
63
+
64
+ ### `parallelism.min_tasks_to_parallelize`
65
+
66
+ Minimum tasks in a wave before parallelism is considered. Default: `2`.
67
+
68
+ ### `parallelism.min_estimated_savings_seconds`
69
+
70
+ Minimum estimated wall-clock savings (sum of `typical-duration-seconds` for would-be parallel agents, minus serial cost) before parallelism is chosen. Default: `30`.
71
+
72
+ ### `parallelism.require_disjoint_touches`
73
+
74
+ When `true`, agents whose `Touches:` fields overlap are never parallelized. Default: `true` (safe).
75
+
76
+ ### `parallelism.worktree_isolation`
77
+
78
+ When `true`, parallel agents run in dedicated git worktrees. Default: `false` (lower overhead, shared working tree).
79
+
80
+ ### `parallelism.per_stage_override`
81
+
82
+ Keyed by stage name (`brief`, `explore`, `plan`, `design`, `verify`). Any field above may be overridden per stage.
83
+
84
+ ## How Agents Read The Profile
85
+
86
+ Stages are the only code that read `.design/config.json`. When spawning an agent, the stage:
87
+
88
+ 1. Reads `model_profile` from config.
89
+ 2. Injects it into the agent prompt (e.g., `model_profile: balanced`) so the agent can reason about its own budget.
90
+ 3. Selects the concrete model per the profile table above and passes it to the `Task` tool.
91
+
92
+ Agents never read config directly — the profile is always injected at spawn time.
93
+
94
+ ## .design/budget.json Schema (Phase 10.1)
95
+
96
+ Governs the optimization layer introduced in Phase 10.1. Read by every `Agent` tool spawn via `hooks/budget-enforcer.js` (PreToolUse). Bootstrap writes defaults if the file is missing.
97
+
98
+ ## Full Schema
99
+
100
+ ```json
101
+ {
102
+ "per_task_cap_usd": 2.00,
103
+ "per_phase_cap_usd": 20.00,
104
+ "tier_overrides": {
105
+ "design-verifier": "haiku",
106
+ "design-planner": "opus"
107
+ },
108
+ "auto_downgrade_on_cap": true,
109
+ "cache_ttl_seconds": 3600,
110
+ "enforcement_mode": "enforce"
111
+ }
112
+ ```
113
+
114
+ ## Default Config
115
+
116
+ ```json
117
+ {
118
+ "per_task_cap_usd": 2.00,
119
+ "per_phase_cap_usd": 20.00,
120
+ "tier_overrides": {},
121
+ "auto_downgrade_on_cap": true,
122
+ "cache_ttl_seconds": 3600,
123
+ "enforcement_mode": "enforce"
124
+ }
125
+ ```
126
+
127
+ ## Fields
128
+
129
+ ### `per_task_cap_usd`
130
+
131
+ Hard ceiling per agent spawn; breach triggers D-02 block.
132
+
133
+ ### `per_phase_cap_usd`
134
+
135
+ Cumulative ceiling across all spawns within the current phase (read from `.design/STATE.md phase:` field).
136
+
137
+ ### `tier_overrides`
138
+
139
+ `{agent_name: "haiku"|"sonnet"|"opus"}` per-agent tier override; wins over agent frontmatter `default-tier` per D-04.
140
+
141
+ ### `auto_downgrade_on_cap`
142
+
143
+ When `true`, hook silently rewrites tier → haiku at 80% of `per_task_cap_usd` per D-03; logged as `tier_downgraded: true` in telemetry. At 100% hard-cap, D-02 behavior applies regardless.
144
+
145
+ ### `cache_ttl_seconds`
146
+
147
+ TTL driving `.design/cache-manifest.json` entry expiry per D-08 Layer B.
148
+
149
+ ### `enforcement_mode`
150
+
151
+ `enforce | warn | log` per D-11. `enforce` (default) is D-02 behavior; `warn` prints warnings but allows spawn; `log` is advisory-only (useful for adoption on existing projects mid-flight).
152
+
153
+ ## Bootstrap behavior
154
+
155
+ If `.design/budget.json` is missing when any `/gdd:*` command runs, `scripts/bootstrap.sh` writes the Default Config values (per D-12). Don't block the spawn — defaults are sensible.
156
+
157
+ ## .design/telemetry/costs.jsonl + .design/agent-metrics.json (Phase 10.1)
158
+
159
+ Phase 10.1 introduces two measurement artifacts written by `hooks/budget-enforcer.js` (PreToolUse on `Agent` spawns) and `scripts/aggregate-agent-metrics.js` (detached child of the hook + refresh step of `/gdd:optimize`). Both files live under the gitignored `.design/` directory — they are local session state, not committed.
160
+
161
+ ### .design/telemetry/costs.jsonl
162
+
163
+ Append-only ledger. One JSON object per line. Written by `hooks/budget-enforcer.js` on every PreToolUse decision: spawn allowed, spawn blocked by cap, tier downgraded, cache-hit short-circuit, lazy-gate skip. Consumed by the Phase 11 reflector (`agents/design-reflector.md`) and by `/gdd:optimize`.
164
+
165
+ **Row schema** (verbatim from ROADMAP criterion 7):
166
+
167
+ ```json
168
+ {
169
+ "ts": "<ISO-8601 timestamp>",
170
+ "agent": "<agent name>",
171
+ "tier": "<haiku | sonnet | opus | cache | gate>",
172
+ "tokens_in": <int>,
173
+ "tokens_out": <int>,
174
+ "cache_hit": <bool>,
175
+ "est_cost_usd": <float>,
176
+ "cycle": "<v1.0.x>",
177
+ "phase": "<phase slug>"
178
+ }
179
+ ```
180
+
181
+ **Extra diagnostic fields** (optional; Phase 11 reflector ignores unknown fields gracefully):
182
+
183
+ - `tier_downgraded: <bool>` — set when soft-threshold downgrade fired (D-03).
184
+ - `enforcement_mode: <"enforce" | "warn" | "log">` — mirrors `.design/budget.json.enforcement_mode` at the time of decision.
185
+ - `lazy_skipped: <bool>` — set when plan 10.1-04 gate agent declined to spawn the full checker.
186
+ - `block_reason: <"per_task_cap" | "per_phase_cap">` — set when hook blocked the spawn.
187
+
188
+ **Guarantees:**
189
+
190
+ - Writes are `fs.appendFileSync` — OS-level atomic per line.
191
+ - The file is **never truncated or rotated** by the hook in v1. Log rotation is a Phase 12 concern.
192
+ - Consumers must be tolerant of malformed lines (partial writes from crashed processes) — skip-and-continue is the canonical pattern.
193
+ - Rows log only token counts, agent name, tier, cost, cycle, phase. **No prompt or response content is logged** — the schema is information-disclosure-safe by construction.
194
+
195
+ ### .design/agent-metrics.json
196
+
197
+ Per-agent aggregate derived from `costs.jsonl` by `scripts/aggregate-agent-metrics.js`. Written atomically via tmp-file + rename. Overwritten in full on every refresh — not append-only. Consumers should treat it as a snapshot.
198
+
199
+ **Schema:**
200
+
201
+ ```json
202
+ {
203
+ "generated_at": "<ISO-8601 timestamp>",
204
+ "agents": {
205
+ "<agent-name>": {
206
+ "typical_duration_seconds": <number | null>,
207
+ "default_tier": "<haiku | sonnet | opus | null>",
208
+ "parallel_safe": <bool | null>,
209
+ "reads_only": <bool | null>,
210
+ "total_spawns": <int>,
211
+ "total_cost_usd": <float>,
212
+ "total_tokens_in": <int>,
213
+ "total_tokens_out": <int>,
214
+ "cache_hit_rate": <float 0..1>,
215
+ "lazy_skip_rate": <float 0..1>
216
+ }
217
+ }
218
+ }
219
+ ```
220
+
221
+ **Field sources:**
222
+
223
+ - `typical_duration_seconds`, `default_tier`, `parallel_safe`, `reads_only` — read from `agents/{agent}.md` frontmatter (kebab-case in the markdown; re-keyed to snake_case in JSON). Null if the agent file is absent or the field is missing.
224
+ - `total_spawns`, `total_cost_usd`, `total_tokens_in`, `total_tokens_out` — summed across all `costs.jsonl` rows for this agent.
225
+ - `cache_hit_rate = cache_hits / total_spawns` (clamped when total_spawns = 0).
226
+ - `lazy_skip_rate = lazy_skips / total_spawns` (same).
227
+
228
+ **Phase 11 reflector contract:** the fields `typical_duration_seconds`, `default_tier`, `parallel_safe`, `reads_only`, `total_spawns`, `total_cost_usd` are the exact inputs the reflector feeds into its frontmatter-update proposals (see `.planning/phases/11-self-improvement/11-02-PLAN.md`). Do not rename or drop these fields without a reflector contract update.
229
+
230
+ ### Gitignore
231
+
232
+ Both files sit inside `.design/`, which is already `.gitignore`d at the project root. No changes to `.gitignore` required. A `.gitkeep` at `.design/telemetry/` ensures the directory ships empty but present (see plan 10.1-05 Task 06).
233
+
234
+ ### Refresh cadence
235
+
236
+ The aggregator is invoked as a detached child process by `hooks/budget-enforcer.js` after every telemetry row write. It is also invoked directly by `/gdd:optimize` before analysis. There is no cron, no daemon, and no scheduled task — metrics are always at most one spawn stale.
237
+
238
+ ## .design/cache-manifest.json Schema (Phase 10.1)
239
+
240
+ Authored and maintained by `skills/cache-manager/SKILL.md`. Read by `hooks/budget-enforcer.js` (PreToolUse on Agent spawns) for short-circuiting cached spawns per D-05. Layer B of the D-08 two-layer cache. Flat KV shape — keys are SHA-256 hex of the deterministic input-hash, values are entry objects. Schema version 1.
241
+
242
+ ## Full Schema
243
+
244
+ ```json
245
+ {
246
+ "a3f1e4b2c5...": {
247
+ "agent": "design-verifier",
248
+ "result": "<base64-encoded-result-or-file-path>",
249
+ "written_at": "2026-04-18T12:00:00Z",
250
+ "ttl_seconds": 3600,
251
+ "expires_at": "2026-04-18T13:00:00Z"
252
+ },
253
+ "f7e2d8a1b9...": {
254
+ "agent": "design-planner",
255
+ "result": ".design/cache-blobs/f7e2d8a1b9.md",
256
+ "written_at": "2026-04-18T12:05:00Z",
257
+ "ttl_seconds": 3600,
258
+ "expires_at": "2026-04-18T13:05:00Z"
259
+ }
260
+ }
261
+ ```
262
+
263
+ ## Empty Initial State
264
+
265
+ ```json
266
+ {}
267
+ ```
268
+
269
+ ## Fields
270
+
271
+ ### `<sha256-hex>` (key)
272
+
273
+ 64-character lowercase SHA-256 hex produced by `skills/cache-manager/SKILL.md` Phase 1 (`computeInputHash(agent_path, input_file_paths)`). See that skill for the canonical algorithm.
274
+
275
+ ### `agent`
276
+
277
+ String — the `agents/<name>.md` basename without extension (e.g., `design-verifier`). Human-readable debug aid; not load-bearing for lookup.
278
+
279
+ ### `result`
280
+
281
+ String — either (a) a base64-encoded blob (for small results, typically < 16KB), or (b) a filesystem path under `.design/cache-blobs/<sha-prefix>.md` for larger results. Writers choose based on size; readers handle both transparently.
282
+
283
+ ### `written_at`
284
+
285
+ String — ISO-8601 UTC timestamp at write time. Produced by `new Date().toISOString()`.
286
+
287
+ ### `ttl_seconds`
288
+
289
+ Integer — copied from `.design/budget.json.cache_ttl_seconds` at write time (default 3600). Preserved in the entry so a later budget.json change does not retroactively invalidate or extend existing entries.
290
+
291
+ ### `expires_at`
292
+
293
+ String — ISO-8601 UTC timestamp equal to `written_at + ttl_seconds`. Precomputed at write time; readers never recompute. Stale entries (`Date.now() > expires_at`) are treated as misses.
294
+
295
+ ## TTL semantics
296
+
297
+ - TTL default source: `.design/budget.json.cache_ttl_seconds` (default 3600s = 1 hour, per Plan 10.1-01 schema).
298
+ - TTL is copied into each entry at write time — **not** recomputed on read. Budget.json changes do not retroactively affect existing entries.
299
+ - `expires_at` = `written_at + ttl_seconds`, computed once, stored in the entry.
300
+ - Stale entries are **not** actively purged (lazy cleanup): they remain in the file until overwritten by a new write with the same key, or pruned manually. A proactive reaper is out of v1 scope.
301
+ - Readers (`hooks/budget-enforcer.js`) check `Date.now() / 1000 > Date.parse(expires_at) / 1000`; if true, return miss.
302
+
303
+ ## Read/Write contract
304
+
305
+ - **Single writer**: `skills/cache-manager/SKILL.md` Phase 4 (`write-result-on-completion`). Other code must not write this file directly.
306
+ - **Multiple readers**: `hooks/budget-enforcer.js`, any orchestrator that runs Phase 2 (`lookup`) for dry-run planning. Readers treat malformed JSON as "manifest absent" (empty cache) — do not throw.
307
+ - **Concurrency**: Claude Code agent spawns are serialized at the hook level (PreToolUse is synchronous). No file locking is needed at v1 scale. Concurrent writes from parallel orchestrators are theoretically possible but exceedingly rare; last-writer-wins is acceptable (cache miss on next read re-populates).
308
+
309
+ ## Bootstrap behavior
310
+
311
+ If `.design/cache-manifest.json` is missing when `hooks/budget-enforcer.js` reads it, the hook treats every lookup as a miss and the spawn proceeds normally. No bootstrap action is required — the manifest is created lazily on first successful spawn when `skills/cache-manager/SKILL.md` Phase 4 fires. Unlike `.design/budget.json`, missing cache-manifest.json is the **correct** initial state on a fresh repo.
312
+
313
+ ## Cross-references
314
+
315
+ - `skills/cache-manager/SKILL.md` — producer; documents the four-phase contract.
316
+ - `hooks/budget-enforcer.js` (Plan 10.1-01) — reader; short-circuits spawns on hit.
317
+ - `.design/budget.json` — provides `cache_ttl_seconds` default.
318
+ - `.design/telemetry/costs.jsonl` (Plan 10.1-05) — records `cache_hit: true` rows with zero tokens and zero cost when the short-circuit fires.
319
+ - D-05, D-08, D-09 in `.planning/phases/10.1-optimization-layer-cost-governance/10.1-CONTEXT.md` — decision lineage.
@@ -0,0 +1,32 @@
1
+ # Design Debugger Philosophy
2
+
3
+ A design bug is a gap between what the design says (DESIGN-PLAN.md goals, D-XX decisions) and what the code does (rendered output, measured metrics).
4
+
5
+ ## Principles
6
+
7
+ 1. **Symptom first, hypothesis second.** Name the observable symptom before guessing root cause. "Cards look crowded" is a symptom. "Insufficient padding on `.card` class" is a hypothesis. Never skip step 1.
8
+
9
+ 2. **One variable at a time.** Change one thing, re-measure. Multiple simultaneous changes make causation impossible to determine and usually bury the true culprit.
10
+
11
+ 3. **Persistent state.** Write findings to `.design/DEBUG.md` after each investigation step. A killed debug session resumes from the last checkpoint — your future self should be able to read the file and pick up mid-thought.
12
+
13
+ 4. **Design decisions are ground truth.** If D-XX says "primary = #3B82F6" and the rendered color is #000, that is a bug regardless of intent, aesthetics, or taste. The decision trail is the spec.
14
+
15
+ 5. **Narrow scope before widening.** Start at the reported component, then check parent/child relationships, then check global tokens. Widening scope too early turns a 10-minute fix into a token-system overhaul.
16
+
17
+ ## Debug Session Structure
18
+
19
+ Each debug session follows the same arc:
20
+
21
+ ```
22
+ symptom → hypothesis → investigation → finding → fix proposal
23
+ ```
24
+
25
+ Written to `.design/DEBUG.md` with one `##` section per session. Each section contains the five stages as `###` subsections, so a reader can scan the file to see what was tried and what worked.
26
+
27
+ ## Red Flags
28
+
29
+ - "It works for me" without a measurement — no. Measure.
30
+ - Fixing a symptom without isolating the cause — the bug will return somewhere else.
31
+ - Editing a global token to fix one component — blast radius.
32
+ - Skipping the DEBUG.md write-up because "it's obvious now" — future-you will disagree.
@@ -0,0 +1,201 @@
1
+ # Design Heuristics & Principles
2
+
3
+ Use this during Discover (identifying real problems), Plan (determining what to fix), and Verify (scoring the result).
4
+
5
+ ---
6
+
7
+ ## Nielsen Norman Group — 10 Usability Heuristics
8
+
9
+ The baseline evaluation framework. Score each 0–4 (0=violation, 4=excellent). Include in audit output.
10
+
11
+ ### H-01: Visibility of System Status
12
+ The system should always keep users informed about what's going on, through appropriate feedback within a reasonable time.
13
+ - Loading states must show progress (spinner, skeleton, progress bar)
14
+ - Success/error must be communicated within 100ms of action
15
+ - Background processes must have status indicators
16
+ - **Fail cases**: No loading state, success/fail same appearance, silent errors
17
+
18
+ ### H-02: Match Between System and the Real World
19
+ The system should speak the users' language, using words, phrases, and concepts familiar to them rather than system-oriented terms.
20
+ - Labels use domain language, not technical names
21
+ - Dates in human format ("June 12" not "2024-06-12" for consumer apps)
22
+ - Destructive actions use plain language ("Delete" not "Terminate instance")
23
+ - Icons match mental models (floppy disk = save is OK if users know it)
24
+ - **Fail cases**: Backend error codes shown to users, jargon, mismatched metaphors
25
+
26
+ ### H-03: User Control and Freedom
27
+ Users often choose system functions by mistake and will need a clearly marked "emergency exit."
28
+ - Undo/redo for all reversible actions
29
+ - Cancel available in every multi-step flow
30
+ - Browser back button works predictably
31
+ - Destructive confirmation before permanent actions
32
+ - **Fail cases**: No undo, modal with no escape, back button resets form data
33
+
34
+ ### H-04: Consistency and Standards
35
+ Users should not have to wonder whether different words, situations, or actions mean the same thing.
36
+ - Same action → same component → same placement across all screens
37
+ - Platform conventions followed (iOS: bottom nav, Android: material navigation)
38
+ - Color semantic is consistent (red = danger ALWAYS, green = success ALWAYS)
39
+ - Interaction patterns identical across similar elements
40
+ - **Fail cases**: Primary button varies in color, icons change meaning, inconsistent terminology
41
+
42
+ ### H-05: Error Prevention
43
+ Even better than good error messages is a careful design which prevents a problem from occurring in the first place.
44
+ - Destructive actions require confirmation
45
+ - Invalid inputs blocked or warned before submission
46
+ - Irreversible operations clearly marked as such
47
+ - Sensible defaults reduce user error
48
+ - **Fail cases**: Delete with no confirmation, form submits invalid data, no type="email" on email fields
49
+
50
+ ### H-06: Recognition Rather Than Recall
51
+ Minimize the user's memory load by making objects, actions, and options visible.
52
+ - Navigation options always visible, not hidden in help menus
53
+ - Recently used items surfaced
54
+ - Search results show what was searched
55
+ - Form state preserved on navigation
56
+ - **Fail cases**: Users must remember previous step's data, keyboard shortcuts only without visual hints
57
+
58
+ ### H-07: Flexibility and Efficiency of Use
59
+ Accelerators — unseen by the novice user — allow experts to speed up interaction.
60
+ - Keyboard shortcuts for power users
61
+ - Bulk actions for lists
62
+ - Saved searches/filters
63
+ - Command palettes for complex apps (cmd+K)
64
+ - **Fail cases**: Every action requires 5 clicks for all user types, no quick-repeat mechanism
65
+
66
+ ### H-08: Aesthetic and Minimalist Design
67
+ Dialogs should not contain irrelevant or rarely needed information. Every unit of information competes with every other.
68
+ - Every element on screen earns its place
69
+ - One primary action per screen/section
70
+ - Secondary information accessible, not upfront
71
+ - Visual hierarchy guides attention automatically
72
+ - **Fail cases**: 4 CTAs with equal weight, information density makes scanning impossible, decorative elements dominate
73
+
74
+ ### H-09: Help Users Recognize, Diagnose, and Recover from Errors
75
+ Error messages should be expressed in plain language (no codes), precisely indicate the problem, and constructively suggest a solution.
76
+ - Error message = what happened + why + how to fix
77
+ - Errors appear near the field/action that caused them
78
+ - Error color (red) has sufficient contrast (4.5:1)
79
+ - Recovery action is a button, not just text
80
+ - **Fail cases**: "Error 422", "Something went wrong", error at top of page for field-level problem
81
+
82
+ ### H-10: Help and Documentation
83
+ Even though it is better if the system can be used without documentation, it may be necessary to provide help.
84
+ - Inline help text for complex fields
85
+ - Tooltips for icon-only buttons
86
+ - Progressive disclosure for advanced features
87
+ - Search in documentation
88
+ - **Fail cases**: No explanation for non-obvious fields, icon-only toolbar with no labels or tooltips
89
+
90
+ ---
91
+
92
+ ## Gestalt Principles
93
+
94
+ Use during layout and visual hierarchy decisions.
95
+
96
+ **Proximity** — Elements close together are perceived as related. Use: group related controls (8–16px between group members, 32–64px between groups).
97
+
98
+ **Similarity** — Elements looking alike are perceived as the same type. Use: consistent styling for all links, all CTAs, all destructive actions.
99
+
100
+ **Continuity** — The eye follows lines and curves. Use: align elements to create reading flow (left-to-right, top-to-bottom).
101
+
102
+ **Closure** — The mind fills in incomplete shapes. Use: card borders can be implied by spacing and background difference alone.
103
+
104
+ **Figure/Ground** — Foreground vs background differentiation. Use: modals and overlays need clear depth separation (shadow, blur, dimming).
105
+
106
+ **Common Fate** — Elements moving together are perceived as a group. Use: animation groups related elements together — stagger within groups, not across.
107
+
108
+ **Prägnanz (Simplicity)** — The mind perceives the simplest possible interpretation. Use: reduce visual complexity. If 2 elements can do the job of 5, use 2.
109
+
110
+ ---
111
+
112
+ ## Fitts's Law
113
+
114
+ **T = a + b × log₂(D/W + 1)**
115
+
116
+ Time to click = function of distance / target size. Implications:
117
+ - Minimum touch target: **44×44pt** (iOS), **48×48dp** (Android). Never smaller.
118
+ - Destructive actions (Delete, Cancel) must be **physically far** from primary actions OR significantly smaller — not adjacent at the same size.
119
+ - Screen edges and corners are fast (infinite size in that direction) — use for primary navigation (iOS bottom bar, macOS menu bar).
120
+ - Dense interfaces that require clicking small targets = high error rate + user frustration.
121
+
122
+ ---
123
+
124
+ ## Hick's Law
125
+
126
+ **T = b × log₂(n + 1)**
127
+
128
+ Decision time increases with number of choices. Implications:
129
+ - Navigation menus: max **7 top-level items** (ideally 5).
130
+ - Forms: group related fields, reveal complexity progressively.
131
+ - Feature lists on marketing pages: 3–4 items per section, not 12.
132
+ - Product pricing: 3 plans perform better than 2 or 5.
133
+
134
+ ---
135
+
136
+ ## Miller's Law (7 ± 2)
137
+
138
+ Working memory holds approximately **5–9 items**. Implications:
139
+ - Navigation: ≤7 items without grouping.
140
+ - Onboarding steps: ≤5 visible at once.
141
+ - Dropdown options: >7 → add search.
142
+ - Dashboard widgets: >9 on one view → consider filtering or tabs.
143
+
144
+ ---
145
+
146
+ ## Serial Position Effect
147
+
148
+ Users remember the **first** and **last** items in a list best (primacy and recency). Implications:
149
+ - Put most important actions first and last in navigation.
150
+ - In long forms, critical fields go near the top or after a clear section break.
151
+ - CTAs at the bottom of long pages work (recency) — but add one above the fold too (primacy).
152
+
153
+ ---
154
+
155
+ ## Von Restorff Effect (Isolation Effect)
156
+
157
+ The item that **differs** from its group is most memorable. Implications:
158
+ - One primary CTA per screen (contrast makes it memorable).
159
+ - Don't use "primary" styling on 3 different buttons — only one stands out.
160
+ - Highlight key data points in tables (bold, color accent) — but only the truly key ones.
161
+ - Overuse of emphasis = no emphasis. Use it for 1–2 items per view maximum.
162
+
163
+ ---
164
+
165
+ ## Jakob's Law
166
+
167
+ Users spend most of their time on **other sites**. They expect yours to work the same way. Implications:
168
+ - Login at top-right. Cart icon at top-right. Logo at top-left.
169
+ - Don't innovate on navigation placement without very strong reason.
170
+ - Form inputs look like inputs. Buttons look like buttons.
171
+ - "Creative" UI patterns require user re-learning = friction.
172
+
173
+ ---
174
+
175
+ ## Zeigarnik Effect
176
+
177
+ People **remember incomplete tasks** better than completed ones. Implications:
178
+ - Progress bars keep users motivated in onboarding flows.
179
+ - "Complete your profile" patterns work because they activate this effect.
180
+ - Show completion percentage, not just what's left.
181
+
182
+ ---
183
+
184
+ ## How to Score During Verification
185
+
186
+ For each NNG heuristic (H-01 through H-10), rate 0–4:
187
+
188
+ | Score | Meaning |
189
+ |---|---|
190
+ | 4 | Excellent — actively exemplifies the heuristic |
191
+ | 3 | Passes — meets the heuristic requirement |
192
+ | 2 | Minor violation — notable issue but not blocking |
193
+ | 1 | Major violation — users will notice and be impacted |
194
+ | 0 | Critical violation — breaks the interface |
195
+
196
+ **Overall Heuristic Score** = (sum / 40) × 100
197
+
198
+ - 90–100: Excellent UX quality
199
+ - 75–89: Good, minor issues
200
+ - 60–74: Acceptable, improvement needed
201
+ - <60: Significant UX problems, redesign required