@hegemonart/get-design-done 1.59.2 → 1.59.4

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 (161) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +56 -0
  4. package/SKILL.md +2 -0
  5. package/agents/design-advisor.md +1 -1
  6. package/agents/design-context-checker-gate.md +0 -1
  7. package/agents/design-context-checker.md +0 -1
  8. package/agents/design-context-reviewer-gate.md +0 -1
  9. package/agents/design-context-reviewer.md +0 -1
  10. package/agents/design-integration-checker-gate.md +0 -1
  11. package/agents/design-integration-checker.md +0 -1
  12. package/agents/design-plan-checker.md +0 -1
  13. package/agents/design-verifier-gate.md +0 -1
  14. package/agents/design-verifier.md +0 -1
  15. package/agents/prototype-gate.md +0 -1
  16. package/agents/quality-gate-runner.md +0 -1
  17. package/figma-plugin/README.md +61 -0
  18. package/figma-plugin/code.ts +36 -0
  19. package/figma-plugin/manifest.json +12 -0
  20. package/figma-plugin/package-lock.json +35 -0
  21. package/figma-plugin/package.json +12 -0
  22. package/figma-plugin/src/export-variables.ts +144 -0
  23. package/figma-plugin/src/payload-schema.ts +250 -0
  24. package/figma-plugin/tsconfig.json +16 -0
  25. package/figma-plugin/ui.html +44 -0
  26. package/hooks/gdd-intel-trigger.js +3 -3
  27. package/package.json +6 -1
  28. package/reference/DEPRECATIONS.md +3 -3
  29. package/reference/live-mode-integration.md +1 -1
  30. package/reference/registry.json +1 -1
  31. package/reference/skill-metadata.md +4 -4
  32. package/reference/skill-placeholders.md +2 -2
  33. package/scripts/build-skills.cjs +146 -0
  34. package/scripts/generate-skill-frontmatter.cjs +243 -0
  35. package/scripts/lib/manifest/scaffolder.cjs +1 -1
  36. package/scripts/lib/manifest/schemas/skills.schema.json +1 -1
  37. package/scripts/lib/manifest/skills.json +1 -1
  38. package/scripts/lib/new-addendum.cjs +1 -1
  39. package/scripts/skill-templates/README.md +90 -0
  40. package/scripts/skill-templates/add-backlog/SKILL.md +48 -0
  41. package/scripts/skill-templates/analyze-dependencies/SKILL.md +95 -0
  42. package/scripts/skill-templates/apply-reflections/SKILL.md +109 -0
  43. package/scripts/skill-templates/apply-reflections/apply-reflections-procedure.md +170 -0
  44. package/scripts/skill-templates/audit/SKILL.md +79 -0
  45. package/scripts/skill-templates/bandit-reset/SKILL.md +91 -0
  46. package/scripts/skill-templates/bandit-status/SKILL.md +94 -0
  47. package/scripts/skill-templates/benchmark/SKILL.md +65 -0
  48. package/scripts/skill-templates/bootstrap-ds/SKILL.md +43 -0
  49. package/scripts/skill-templates/brief/SKILL.md +145 -0
  50. package/scripts/skill-templates/budget/SKILL.md +45 -0
  51. package/scripts/skill-templates/cache-manager/SKILL.md +66 -0
  52. package/scripts/skill-templates/cache-manager/cache-policy.md +126 -0
  53. package/scripts/skill-templates/check-update/SKILL.md +98 -0
  54. package/scripts/skill-templates/compare/SKILL.md +82 -0
  55. package/scripts/skill-templates/compare/compare-rubric.md +171 -0
  56. package/scripts/skill-templates/complete-cycle/SKILL.md +81 -0
  57. package/scripts/skill-templates/connections/SKILL.md +71 -0
  58. package/scripts/skill-templates/connections/connections-onboarding.md +608 -0
  59. package/scripts/skill-templates/context/SKILL.md +137 -0
  60. package/scripts/skill-templates/continue/SKILL.md +24 -0
  61. package/scripts/skill-templates/darkmode/SKILL.md +76 -0
  62. package/scripts/skill-templates/darkmode/darkmode-audit-procedure.md +258 -0
  63. package/scripts/skill-templates/debug/SKILL.md +41 -0
  64. package/scripts/skill-templates/debug/debug-feedback-loops.md +119 -0
  65. package/scripts/skill-templates/design/SKILL.md +118 -0
  66. package/scripts/skill-templates/design/design-procedure.md +304 -0
  67. package/scripts/skill-templates/discuss/SKILL.md +96 -0
  68. package/scripts/skill-templates/do/SKILL.md +45 -0
  69. package/scripts/skill-templates/explore/SKILL.md +118 -0
  70. package/scripts/skill-templates/explore/explore-procedure.md +267 -0
  71. package/scripts/skill-templates/export/SKILL.md +30 -0
  72. package/scripts/skill-templates/extract-learnings/SKILL.md +114 -0
  73. package/scripts/skill-templates/fast/SKILL.md +91 -0
  74. package/scripts/skill-templates/figma-extract/SKILL.md +64 -0
  75. package/scripts/skill-templates/figma-write/SKILL.md +50 -0
  76. package/scripts/skill-templates/graphify/SKILL.md +49 -0
  77. package/scripts/skill-templates/health/SKILL.md +99 -0
  78. package/scripts/skill-templates/health/health-mcp-detection.md +44 -0
  79. package/scripts/skill-templates/health/health-skill-length-report.md +69 -0
  80. package/scripts/skill-templates/help/SKILL.md +60 -0
  81. package/scripts/skill-templates/instinct/SKILL.md +111 -0
  82. package/scripts/skill-templates/list-assumptions/SKILL.md +61 -0
  83. package/scripts/skill-templates/list-pins/SKILL.md +27 -0
  84. package/scripts/skill-templates/live/SKILL.md +98 -0
  85. package/scripts/skill-templates/locale/SKILL.md +51 -0
  86. package/scripts/skill-templates/map/SKILL.md +89 -0
  87. package/scripts/skill-templates/migrate/SKILL.md +70 -0
  88. package/scripts/skill-templates/migrate-context/SKILL.md +123 -0
  89. package/scripts/skill-templates/new-addendum/SKILL.md +81 -0
  90. package/scripts/skill-templates/new-cycle/SKILL.md +37 -0
  91. package/scripts/skill-templates/new-project/SKILL.md +53 -0
  92. package/scripts/skill-templates/new-skill/SKILL.md +90 -0
  93. package/scripts/skill-templates/next/SKILL.md +68 -0
  94. package/scripts/skill-templates/note/SKILL.md +48 -0
  95. package/scripts/skill-templates/openrouter-status/SKILL.md +86 -0
  96. package/scripts/skill-templates/optimize/SKILL.md +97 -0
  97. package/scripts/skill-templates/override/SKILL.md +86 -0
  98. package/scripts/skill-templates/paper-write/SKILL.md +54 -0
  99. package/scripts/skill-templates/pause/SKILL.md +77 -0
  100. package/scripts/skill-templates/peer-cli-add/SKILL.md +88 -0
  101. package/scripts/skill-templates/peer-cli-add/peer-cli-protocol.md +161 -0
  102. package/scripts/skill-templates/peer-cli-customize/SKILL.md +89 -0
  103. package/scripts/skill-templates/peers/SKILL.md +96 -0
  104. package/scripts/skill-templates/pencil-write/SKILL.md +54 -0
  105. package/scripts/skill-templates/pin/SKILL.md +37 -0
  106. package/scripts/skill-templates/plan/SKILL.md +105 -0
  107. package/scripts/skill-templates/plan/plan-procedure.md +278 -0
  108. package/scripts/skill-templates/plant-seed/SKILL.md +48 -0
  109. package/scripts/skill-templates/pr-branch/SKILL.md +32 -0
  110. package/scripts/skill-templates/progress/SKILL.md +107 -0
  111. package/scripts/skill-templates/quality-gate/SKILL.md +90 -0
  112. package/scripts/skill-templates/quality-gate/threat-modeling.md +101 -0
  113. package/scripts/skill-templates/quick/SKILL.md +44 -0
  114. package/scripts/skill-templates/reapply-patches/SKILL.md +32 -0
  115. package/scripts/skill-templates/recall/SKILL.md +75 -0
  116. package/scripts/skill-templates/reflect/SKILL.md +85 -0
  117. package/scripts/skill-templates/reflect/procedures/capability-gap-scan.md +119 -0
  118. package/scripts/skill-templates/report-issue/SKILL.md +53 -0
  119. package/scripts/skill-templates/report-issue/report-issue-procedure.md +119 -0
  120. package/scripts/skill-templates/resume/SKILL.md +93 -0
  121. package/scripts/skill-templates/review-backlog/SKILL.md +46 -0
  122. package/scripts/skill-templates/review-decisions/SKILL.md +42 -0
  123. package/scripts/skill-templates/roi/SKILL.md +54 -0
  124. package/scripts/skill-templates/rollout-status/SKILL.md +35 -0
  125. package/scripts/skill-templates/router/SKILL.md +89 -0
  126. package/scripts/skill-templates/router/capability-gap-emitter.md +65 -0
  127. package/scripts/skill-templates/router/router-pick-emitter.md +78 -0
  128. package/scripts/skill-templates/router/router-rules.md +84 -0
  129. package/scripts/skill-templates/settings/SKILL.md +87 -0
  130. package/scripts/skill-templates/ship/SKILL.md +48 -0
  131. package/scripts/skill-templates/sketch/SKILL.md +78 -0
  132. package/scripts/skill-templates/sketch-wrap-up/SKILL.md +92 -0
  133. package/scripts/skill-templates/skill-manifest/SKILL.md +79 -0
  134. package/scripts/skill-templates/spike/SKILL.md +67 -0
  135. package/scripts/skill-templates/spike-wrap-up/SKILL.md +86 -0
  136. package/scripts/skill-templates/start/SKILL.md +67 -0
  137. package/scripts/skill-templates/start/start-procedure.md +115 -0
  138. package/scripts/skill-templates/state/SKILL.md +106 -0
  139. package/scripts/skill-templates/stats/SKILL.md +51 -0
  140. package/scripts/skill-templates/style/SKILL.md +71 -0
  141. package/scripts/skill-templates/style/style-doc-procedure.md +150 -0
  142. package/scripts/skill-templates/synthesize/SKILL.md +94 -0
  143. package/scripts/skill-templates/timeline/SKILL.md +66 -0
  144. package/scripts/skill-templates/todo/SKILL.md +64 -0
  145. package/scripts/skill-templates/turn-closeout/SKILL.md +95 -0
  146. package/scripts/skill-templates/undo/SKILL.md +31 -0
  147. package/scripts/skill-templates/unlock-decision/SKILL.md +54 -0
  148. package/scripts/skill-templates/unpin/SKILL.md +31 -0
  149. package/scripts/skill-templates/update/SKILL.md +56 -0
  150. package/scripts/skill-templates/using-gdd/SKILL.md +78 -0
  151. package/scripts/skill-templates/verify/SKILL.md +113 -0
  152. package/scripts/skill-templates/verify/verify-procedure.md +511 -0
  153. package/scripts/skill-templates/warm-cache/SKILL.md +81 -0
  154. package/scripts/skill-templates/watch-authorities/SKILL.md +82 -0
  155. package/scripts/skill-templates/zoom-out/SKILL.md +26 -0
  156. package/sdk/cli/commands/build.ts +2 -2
  157. package/sdk/cli/index.js +2 -2
  158. package/sdk/cli/index.ts +1 -1
  159. package/skills/README.md +22 -14
  160. package/skills/help/SKILL.md +28 -55
  161. package/skills/new-skill/SKILL.md +5 -5
@@ -0,0 +1,145 @@
1
+ ---
2
+ name: gdd-brief
3
+ description: "Stage 1 of 5 design intake that captures problem statement, audience, constraints, success metrics, and scope into .design/BRIEF.md, and bootstraps .design/STATE.md if missing. Use when starting a new design cycle and before {{command_prefix}}explore. Activates for requests involving capturing a problem statement, defining audience and constraints, or starting a new design brief."
4
+ argument-hint: "[--re-brief to redo intake on existing project]"
5
+ tools: Read, Write, AskUserQuestion, mcp__gdd_state__frontmatter_update, mcp__gdd_state__set_status, mcp__gdd_state__update_progress, mcp__gdd_state__get
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
+ <prior-research>
59
+ <!-- Phase 38: populated by agents/user-research-synthesizer.md from UserTesting/Maze/Hotjar
60
+ (pseudonymized) — ranked findings {finding · frequency · severity}. Empty on a fresh brief;
61
+ the verify stage cross-checks each finding (addressed or explicitly deferred). -->
62
+ </prior-research>
63
+ ```
64
+
65
+ Leave the `<prior-research>` block empty on a greenfield brief - it is filled by `{{command_prefix}}research-sync` (the `user-research-synthesizer`) when a research source is connected, and re-checked at verify. See `reference/design-variants.md` for the outcome loop.
66
+
67
+ ## Step 4 - Bootstrap STATE.md (if missing)
68
+
69
+ <!-- BOOTSTRAP EXCEPTION: STATE.md does not exist yet — MCP tools require it to exist. Direct Write is intentional. All subsequent mutations use MCP. -->
70
+
71
+ If `.design/STATE.md` does not exist, copy the template block from `reference/STATE-TEMPLATE.md` (between `==== BEGIN TEMPLATE ====` and `==== END TEMPLATE ====`) to `.design/STATE.md` via `Write`. Leave the `<ISO 8601 timestamp>` placeholders in-place - Step 5 stamps them via MCP. If STATE.md already exists, skip to Step 5.
72
+
73
+ ## Step 5 - Commit STATE.md initialization
74
+
75
+ With `.design/STATE.md` seeded from the template:
76
+
77
+ 1. Stamp timestamps + cycle id: call `mcp__gdd_state__frontmatter_update` with `patch: { started_at: <ISO>, last_checkpoint: <ISO>, cycle: <cycle-id> }`.
78
+ 2. Mark brief progress: call `mcp__gdd_state__update_progress` with `task_progress: "5/5"`, `status: "brief_complete"`.
79
+ 3. Set handoff status: call `mcp__gdd_state__set_status` with `status: "brief_complete"`.
80
+
81
+ Do NOT call `mcp__gdd_state__transition_stage` from brief - explore calls it on entry, keeping the transition atomic with the stage that owns the new state.
82
+
83
+ ## Step 6 - Inline glossary (CONTEXT.md) + ADR pointer
84
+
85
+ When a fuzzy phrase is resolved or a new domain concept is named during the briefing
86
+ interview: write to `./CONTEXT.md` IMMEDIATELY per `./../../reference/context-md-format.md`
87
+ (H2 heading + body; lazy-create on first term; no batching). Glossary entries compound
88
+ across cycles - token savings + naming consistency.
89
+
90
+ Project-shaping decisions surfaced in briefing can be promoted to an ADR - see
91
+ `./../../reference/adr-format.md` for the 3-criteria gate (hard-to-reverse AND
92
+ surprising-without-context AND real-tradeoff). Routine choices stay in STATE.md.
93
+
94
+ ## After Writing
95
+
96
+ ```
97
+ ━━━ Brief complete ━━━
98
+ Saved: .design/BRIEF.md
99
+ Next: @get-design-done explore
100
+ ━━━━━━━━━━━━━━━━━━━━━━━
101
+ ```
102
+
103
+ ## Spec self-review (before transition)
104
+
105
+ Run this final spec-quality pass over `.design/BRIEF.md` before the brief→explore transition:
106
+ - Placeholder scan: no TBD / TODO / `<placeholder>` / lorem left in the artifact.
107
+ - Internal consistency: sections don't contradict each other.
108
+ - Scope check: nothing in the artifact exceeds (or silently drops) the agreed scope.
109
+ - Ambiguity check: every requirement/decision is specific enough to act on without a follow-up question.
110
+
111
+ ## Optional brief audit (non-blocking)
112
+
113
+ Before the gate, you MAY spawn `agents/brief-auditor.md` via `Task` to grade the brief against the five
114
+ brief anti-patterns (vague verbs, missing audience, immeasurable success criteria, scope creep, missing
115
+ anti-goals). The auditor reads `.design/BRIEF.md` plus `reference/brief-quality-rubric.md` and writes
116
+ advisory findings to `.design/BRIEF-AUDIT.md`. This step is advisory and MUST NOT block the brief to
117
+ explore transition.
118
+
119
+ If the auditor reports one or more fired anti-patterns, surface a single-line pointer to the user:
120
+
121
+ ```
122
+ Brief audit flagged N issue(s) - run {{command_prefix}}discuss brief to refine, or proceed to explore.
123
+ ```
124
+
125
+ The user decides. Proceeding to explore with a flagged brief is allowed; the pointer is a nudge, not a gate.
126
+ If the auditor reports no fired anti-patterns, or you skip the audit, continue to the gate unchanged.
127
+
128
+ <HARD-GATE>
129
+ Do NOT transition to explore (or invoke `{{command_prefix}}explore`) until the brief artifact (default `.design/BRIEF.md`) is committed AND the user has approved it. If this project uses a custom `.design` location, read the artifact path from `.design/STATE.md` rather than assuming the default.
130
+ </HARD-GATE>
131
+
132
+ ## Rationalizations - Thought to Reality
133
+
134
+ The excuses an agent invents to skip or shortcut the brief, and what each one actually costs the cycle:
135
+
136
+ | Thought | Reality |
137
+ |---------|---------|
138
+ | "This brief is too simple to need a problem statement." | Skip the brief = guess at requirements, then redesign mid-design when the real problem surfaces. |
139
+ | "The user told me what to build, I can skip the interview." | Unasked constraints (a11y, brand, stack) become rework - the five questions exist because each one has blown a past cycle. |
140
+ | "I'll capture success metrics later in verify." | Verify has nothing to check against; an un-metricked brief produces an un-verifiable cycle. |
141
+ | "Scope is obvious, I don't need an in/out line." | Undeclared scope is scope creep waiting to happen - the explore scan widens to fill the vacuum. |
142
+ | "I can answer all five questions for the user from context." | AskUserQuestion one-at-a-time exists because batched/assumed answers smuggle in wrong premises that compound downstream. |
143
+ | "STATE.md bootstrap can wait." | Every later MCP mutation requires STATE.md to exist; skipping the bootstrap hard-blocks explore on entry. |
144
+
145
+ ## BRIEF COMPLETE
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: gdd-budget
3
+ description: "Forecasts GDD design-cycle spend before the bill arrives. Reads .design/telemetry/costs.jsonl (cost per cycle) + .design/budget.json (the project_cap), runs the pure cost-forecast model via agents/cost-forecaster.md, and projects the next N cycles - surfacing 'at the current rate you'll hit your $X project cap in Y cycles.' Supports --scenario best|typical|worst and --cycles N. Read-only - it forecasts and warns; it never spends, edits budget.json, or halts (the budget-enforcer hook halts). Use to sanity-check spend trajectory before a long run."
4
+ argument-hint: "[--cycles N] [--scenario best|typical|worst]"
5
+ user-invocable: true
6
+ tools: Read, Bash, Grep, Glob, ToolSearch, Task
7
+ ---
8
+
9
+ # {{command_prefix}}budget
10
+
11
+ Closes the long-horizon cost gap: Phase 10.1 per-task caps + Phase 26 per-runtime telemetry track
12
+ *cost*, but nothing **forecasts** it. This skill projects the next N cycles of spend and tells you how
13
+ many cycles you have before you hit your `project_cap`. **Read-only** - it forecasts and warns; it
14
+ never spends, never edits `budget.json`, and never halts (the Phase 25 budget-enforcer hook is the
15
+ only thing that blocks a spawn). Contract: `../../reference/cost-governance.md`.
16
+
17
+ ## Invocation
18
+
19
+ | Command | Behavior |
20
+ |---|---|
21
+ | `{{command_prefix}}budget` | Typical-scenario forecast over the next 5 cycles + cycles-to-cap. |
22
+ | `{{command_prefix}}budget --cycles N` | Forecast over the next N cycles. |
23
+ | `{{command_prefix}}budget --scenario best\|typical\|worst` | Pick the projection rate (best / steady / worst). |
24
+
25
+ ## Steps
26
+
27
+ 1. **Check telemetry exists.** No `.design/telemetry/costs.jsonl` (or zero rows) → print
28
+ `budget: no cost telemetry yet — run a cycle first.` and exit.
29
+ 2. **Delegate to `cost-forecaster`** (via `Task`): it groups `est_cost_usd` by `cycle`, runs the pure
30
+ `scripts/lib/budget/cost-forecast.cjs` model for the requested `--scenario`/`--cycles`, reads
31
+ `project_cap_usd` from `.design/budget.json`, and computes cycles-to-cap.
32
+ 3. **Render.** Show: the scenario + its per-cycle rate, the best↔worst band, the projected total over
33
+ N cycles, and - when `project_cap_usd > 0` - **"at the `<scenario>` rate (~$X/cycle) you'll reach
34
+ your $`<cap>` project cap in `<Y>` cycles"** (or "not at this rate" when the trend is flat/down).
35
+ When no cap is set, show the trajectory and note that `project_cap_usd` is unset (so the hook won't
36
+ halt).
37
+ 4. **Do not act.** Never raise/lower the cap, never spend - GDD forecasts; the human sets the budget.
38
+
39
+ ## Output
40
+
41
+ End with:
42
+
43
+ ```
44
+ ## BUDGET COMPLETE
45
+ ```
@@ -0,0 +1,66 @@
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.ts before every Agent spawn."
4
+ user-invocable: false
5
+ tools: Read, Bash, Write
6
+ disable-model-invocation: true
7
+ ---
8
+
9
+ # gdd-cache-manager
10
+
11
+ ## Role
12
+
13
+ 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`.
14
+
15
+ ## Invocation Contract
16
+
17
+ ### Phase 1: compute-key
18
+
19
+ - **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.
20
+ - **Output**: `{input_hash: string}` - 64-character lowercase SHA-256 hex.
21
+ - **Algorithm**: canonicalize inputs, concat with newline separators, SHA-256 (see Deterministic Input-Hash Algorithm below).
22
+
23
+ ### Phase 2: lookup
24
+
25
+ - **Input**: `{input_hash: string}`
26
+ - **Output**: `{hit: true, result: string, expires_at: string} | {hit: false}`
27
+ - 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`.
28
+
29
+ ### Phase 3: short-circuit-or-miss
30
+
31
+ - 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.
32
+ - On miss: orchestrator proceeds with real spawn. Cache-manager is not involved until Phase 4.
33
+
34
+ ### Phase 4: write-result-on-completion
35
+
36
+ - **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).
37
+ - **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.
38
+
39
+ ## Deterministic Input-Hash Algorithm
40
+
41
+ The canonical reference implementation (single source of truth; `hooks/budget-enforcer.ts` imports the same primitive via a shared helper) lives in `./cache-policy.md#deterministic-input-hash-algorithm-layer-b` - it documents the JS implementation, the maintainer notes (sorted-unique paths, MISSING-file sentinel, agent-path bust behavior), the manifest shape, and TTL semantics in one place. Conform to the algorithm exactly so the hook and any orchestrator agree byte-for-byte.
42
+
43
+ ## Integration Points
44
+
45
+ - **`hooks/budget-enforcer.ts`** (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.
46
+ - **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.
47
+ - **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.
48
+
49
+ ## Failure Modes
50
+
51
+ - `.design/cache-manifest.json` missing or malformed → treat every lookup as miss; orchestrator proceeds with full spawn. Do not throw.
52
+ - 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).
53
+ - `agent_path` file missing → compute hash anyway using the provided string; cache entries for a deleted agent simply never hit again.
54
+
55
+ ## Non-Goals
56
+
57
+ Per D-09:
58
+
59
+ - No semantic / graph-based lookup. Manifest is a dumb KV store keyed by content hash.
60
+ - No cross-project cache sharing. Manifest lives at `.design/cache-manifest.json`, scoped per repo.
61
+ - No eviction beyond lazy expiry on read. A `{{command_prefix}}cache-prune` command is a Phase 11 reflector candidate, not 10.1 scope.
62
+ - No hash-algorithm tuning. SHA-256 is fixed; if a future phase wants BLAKE3, bump the manifest schema version (not relevant in v1).
63
+
64
+ ## TTL Semantics
65
+
66
+ Default `ttl_seconds` = `.design/budget.json.cache_ttl_seconds` = 3600s (1 hour) per D-10. `expires_at` is computed at write time and stored; readers do not recompute. Stale entries are lazily cleaned on read (no eager reaper in v1). Full TTL discussion: `./cache-policy.md#ttl-semantics-layer-b`.
@@ -0,0 +1,126 @@
1
+ ---
2
+ name: cache-policy
3
+ type: heuristic
4
+ version: 1.0.0
5
+ phase: 28.5
6
+ tags: [cache, layer-a, layer-b, sha-256, ttl, warm-cache, cache-manager, anthropic-prompt-cache]
7
+ last_updated: 2026-05-18
8
+ ---
9
+
10
+ # Cache Policy (Layer A + Layer B)
11
+
12
+ Extracted from `skills/cache-manager/SKILL.md` and `skills/warm-cache/SKILL.md` per Phase 28.5
13
+ D-10 (extract-then-link, never delete content). The two skills keep their orchestration
14
+ contracts and step-by-step flows; the deeper algorithmic and operational detail moves here
15
+ so the SKILLs stay under the 100-line cap.
16
+
17
+ The two layers (D-08):
18
+
19
+ - **Layer A** - Anthropic's 5-min prompt cache (owned by `warm-cache`). Keyed on shared-preamble-first prompt prefix. No project-local state.
20
+ - **Layer B** - explicit `.design/cache-manifest.json` (owned by `gdd-cache-manager`). Keyed on deterministic SHA-256 of `(agent-path, sorted-input-file-paths, input-content-hashes)`. Per-repo state.
21
+
22
+ ## Deterministic Input-Hash Algorithm (Layer B)
23
+
24
+ The canonical reference implementation (the single source of truth; `hooks/budget-enforcer.ts` imports the same primitive via a shared helper):
25
+
26
+ ```js
27
+ // Deterministic cache-key primitive (reference implementation)
28
+ // hash = SHA-256(
29
+ // agent_path + "\n" +
30
+ // sorted(input_file_paths).join("\n") + "\n" +
31
+ // sorted(input_file_paths)
32
+ // .map(p => sha256(readFileSync(p, "utf8")))
33
+ // .join("\n")
34
+ // )
35
+ const crypto = require('crypto');
36
+ const fs = require('fs');
37
+
38
+ function sha256Hex(s) {
39
+ return crypto.createHash('sha256').update(s, 'utf8').digest('hex');
40
+ }
41
+
42
+ function computeInputHash(agentPath, inputFilePaths) {
43
+ const sortedPaths = [...inputFilePaths].sort();
44
+ const contentHashes = sortedPaths.map(p => {
45
+ try { return sha256Hex(fs.readFileSync(p, 'utf8')); }
46
+ catch { return 'MISSING'; }
47
+ });
48
+ const canonical = [
49
+ agentPath,
50
+ sortedPaths.join('\n'),
51
+ contentHashes.join('\n')
52
+ ].join('\n');
53
+ return sha256Hex(canonical);
54
+ }
55
+ ```
56
+
57
+ Notes for maintainers:
58
+
59
+ - **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.
60
+ - **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.
61
+ - **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.
62
+
63
+ ## Manifest Shape (Layer B)
64
+
65
+ See `./config-schema.md` §.design/cache-manifest.json Schema (Phase 10.1) for the authoritative schema. Keyed object, flat SHA-256 hex keys. Example:
66
+
67
+ ```json
68
+ {
69
+ "a3f1e...": {
70
+ "agent": "design-verifier",
71
+ "result": "<base64-or-path>",
72
+ "written_at": "2026-04-18T12:00:00Z",
73
+ "ttl_seconds": 3600,
74
+ "expires_at": "2026-04-18T13:00:00Z"
75
+ }
76
+ }
77
+ ```
78
+
79
+ ## TTL Semantics (Layer B)
80
+
81
+ - Default `ttl_seconds` = `.design/budget.json.cache_ttl_seconds` = 3600s (1 hour) per D-10.
82
+ - `expires_at` is computed at write time and stored; readers do not recompute.
83
+ - 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.
84
+
85
+ ## Concrete Warm-Cache Command Examples (Layer A)
86
+
87
+ Full invocation:
88
+
89
+ ```
90
+ $ {{command_prefix}}warm-cache
91
+
92
+ Warming Anthropic prompt cache for 14 agents (5 min TTL)...
93
+ [1/14] design-verifier ... ok (0.3s)
94
+ [2/14] design-planner ... ok (0.3s)
95
+ [3/14] design-integration-checker ... ok (0.3s)
96
+ ...
97
+ [14/14] design-reflector ... ok (0.3s)
98
+
99
+ ## Warm-cache complete
100
+ - Agents warmed: 14
101
+ - Skipped (no shared preamble import): 3 (agents/README.md not an agent; 2 agents not yet migrated to shared preamble)
102
+ - Duration: 4.2s
103
+ - Next 5 min: repeated spawns of these agents pay cached_input_per_1m rate
104
+ ```
105
+
106
+ Filtered invocation:
107
+
108
+ ```
109
+ $ {{command_prefix}}warm-cache --agents design-verifier,design-planner
110
+
111
+ Warming Anthropic prompt cache for 2 agents (filtered from 14)...
112
+ [1/2] design-verifier ... ok (0.3s)
113
+ [2/2] design-planner ... ok (0.3s)
114
+
115
+ ## Warm-cache complete
116
+ - Agents warmed: 2
117
+ - Filtered out by --agents: 12
118
+ - Duration: 0.7s
119
+ ```
120
+
121
+ ## Cost Model (Layer A)
122
+
123
+ - Each no-op Haiku ping: ~50 input tokens (shared preamble + "No-op warm: acknowledge..." system+user) + ~5 output tokens ("ok").
124
+ - At Haiku rates (`./model-prices.md`): `(50 / 1e6) * 1.00 + (5 / 1e6) * 5.00 = $0.00005 + $0.000025 = $0.000075` per agent.
125
+ - 14 agents × $0.000075 = **$0.00105** total for a full warm-cache invocation.
126
+ - Payback: a single subsequent Opus spawn with 40k cached input tokens saves `(40000/1e6) * (15.00 - 1.50) = $0.54`. Warm-cache pays for itself ~500× over on the first repeated planner spawn.
@@ -0,0 +1,98 @@
1
+ ---
2
+ name: gdd-check-update
3
+ description: "Manual plugin-update check. Shows cached state by default; --refresh bypasses the 24h TTL; --dismiss hides the nudge until a newer release ships; --prompt spawns design-update-checker for a richer summary."
4
+ argument-hint: "[--refresh] [--dismiss] [--prompt]"
5
+ tools: Read, Write, Bash, Task
6
+ ---
7
+
8
+ # {{command_prefix}}check-update
9
+
10
+ **Role:** Manual entry point for the plugin-update checker. The SessionStart hook (`hooks/update-check.sh`) already runs on its own 24h cadence and writes `.design/update-cache.json` + `.design/update-available.md`. This command lets the user inspect / force / dismiss / enrich that state on demand. See `./reference/heuristics.md` §"Version-cadence" for the off-cadence / preview-suffix handling background.
11
+
12
+ ## Flags
13
+
14
+ | Flag | Effect |
15
+ |------|--------|
16
+ | *(none)* | Print cached state. If cache is older than 24h, trigger `--refresh` implicitly. |
17
+ | `--refresh` | Invoke `hooks/update-check.sh --refresh` - bypasses the 24h TTL and re-fetches immediately. |
18
+ | `--dismiss` | Write `update_dismissed: "<latest_tag>"` to `.design/config.json` atomically and delete `.design/update-available.md`. Sticky until a newer release ships. |
19
+ | `--prompt` | Spawn `design-update-checker` agent (Haiku) to produce a 3–5-line "what this release changes for you" summary. Does not alter the banner or cache. |
20
+
21
+ Flags combine: `--refresh --prompt` is valid (re-fetch, then enrich). `--dismiss` is the only flag that mutates `.design/config.json`.
22
+
23
+ ## Steps
24
+
25
+ 1. **Parse flags.** Detect `--refresh`, `--dismiss`, `--prompt` in `$ARGUMENTS`. Unknown flag → `Unknown flag: <flag>` and exit.
26
+
27
+ 2. **`--refresh` path** (if set):
28
+
29
+ ```bash
30
+ bash "${CLAUDE_PLUGIN_ROOT:-$(pwd)}/hooks/update-check.sh" --refresh
31
+ ```
32
+
33
+ This re-fetches `/releases/latest`, rewrites `.design/update-cache.json`, and re-renders `.design/update-available.md` subject to state/dismissal gates.
34
+
35
+ 3. **Read cache.** After any optional refresh, read `.design/update-cache.json`. If missing: print `No cache. Network may be unreachable or the hook has not run yet. Try {{command_prefix}}check-update --refresh.` and exit.
36
+
37
+ 4. **`--dismiss` path** (if set): Compute new config contents and write atomically via the env-prefix Python heredoc pattern below. The pattern is essential - passing variables as trailing `KEY=VALUE` argv treats them as `sys.argv`, not `os.environ`. Use env-prefix form only.
38
+
39
+ ```bash
40
+ CONFIG_PATH=".design/config.json"
41
+ LATEST_TAG="$(grep -E '"latest_tag"' .design/update-cache.json | head -n1 | sed -E 's/.*"latest_tag"[[:space:]]*:[[:space:]]*"([^"]+)".*/\1/')"
42
+ [ -n "$LATEST_TAG" ] || { echo 'No latest_tag in cache — nothing to dismiss.'; exit 0; }
43
+ mkdir -p .design
44
+ CONFIG_PATH="$CONFIG_PATH" LATEST_TAG="$LATEST_TAG" python3 <<'PY'
45
+ import json, os, sys, tempfile
46
+ config_path = os.environ['CONFIG_PATH']
47
+ latest_tag = os.environ['LATEST_TAG']
48
+ try:
49
+ with open(config_path, 'r', encoding='utf-8') as f:
50
+ data = json.load(f)
51
+ if not isinstance(data, dict): data = {}
52
+ except (FileNotFoundError, json.JSONDecodeError): data = {}
53
+ data['update_dismissed'] = latest_tag
54
+ target_dir = os.path.dirname(config_path) or '.'
55
+ fd, tmp_path = tempfile.mkstemp(prefix='config.', suffix='.tmp', dir=target_dir)
56
+ try:
57
+ with os.fdopen(fd, 'w', encoding='utf-8') as f:
58
+ json.dump(data, f, indent=2); f.write('\n')
59
+ os.replace(tmp_path, config_path)
60
+ except Exception:
61
+ try: os.unlink(tmp_path)
62
+ except OSError: pass
63
+ sys.exit(1)
64
+ PY
65
+ rm -f .design/update-available.md
66
+ echo "Dismissed $LATEST_TAG. The nudge will return when a newer release ships."
67
+ ```
68
+
69
+ D-14 atomic-write invariant: `os.replace()` (POSIX `rename(2)`) is atomic on the same filesystem. The `json.load → set single key → json.dump` round-trip preserves every unknown top-level key (e.g. `model_profile`, `parallelism`) verbatim.
70
+
71
+ 5. **Print default state** (always, unless exited early):
72
+
73
+ ```
74
+ ━━━ {{command_prefix}}check-update ━━━
75
+ Current: v<X.Y.Z>
76
+ Latest: v<A.B.C> (delta: <major|minor|patch|off-cadence|none>)
77
+ Newer: <true|false>
78
+ Checked: <ISO time of checked_at>
79
+ Dismissed: <tag or "no">
80
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━
81
+ ```
82
+
83
+ Parse fields from `.design/update-cache.json` via `grep + sed` (no jq dep). Read dismissal from `.design/config.json` via the same pattern as `hooks/update-check.sh`.
84
+
85
+ 6. **`--prompt` path** (if set): Spawn `design-update-checker` via Task tool with context `{current_tag, latest_tag, delta, release_body}`. Display response verbatim below the banner. Agent ends with `## UPDATE-CHECKER COMPLETE`.
86
+
87
+ ## Do Not
88
+
89
+ - Do not fetch from GitHub directly - always go through `hooks/update-check.sh --refresh` so caching + state-guard + dismissal logic stays in one place.
90
+ - Do not modify `.design/update-available.md` except to delete on `--dismiss`.
91
+ - Do not rewrite `.design/config.json` wholesale - the atomic Python rewrite preserves every unknown key (D-14).
92
+ - Do not pass variables to the Python heredoc via trailing `KEY=VALUE` argv - env-prefix form only.
93
+
94
+ ## Completion marker
95
+
96
+ ```
97
+ ## CHECK-UPDATE COMPLETE
98
+ ```
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: gdd-compare
3
+ description: "Compute the delta between the `DESIGN.md` baseline (from explore) and the `DESIGN-VERIFICATION.md` result (from verify), reporting per-category score delta, anti-pattern delta (resolved vs new), must-have pass/fail change, and design drift (regressions without covering tasks in `DESIGN-PLAN.md`). Use after `verify` to measure whether a design pipeline cycle actually improved the design. Writes `.design/COMPARE-REPORT.md`. Activates for requests involving diffing a design baseline against verification output, or a before-after design delta."
4
+ argument-hint: ""
5
+ user-invocable: true
6
+ ---
7
+
8
+ # gdd-compare - Baseline vs Result Delta
9
+
10
+ Standalone delta command. Computes the difference between the scan baseline (`DESIGN.md`) and the verification result (`DESIGN-VERIFICATION.md`), and flags design drift for any regression not covered by an explicit task in `DESIGN-PLAN.md`. Writes one artifact: `.design/COMPARE-REPORT.md`.
11
+
12
+ For the full step-by-step methodology (score parsing, set arithmetic for anti-patterns, drift-coverage map, screenshot-delta probe, and `COMPARE-REPORT.md` template), see `./compare-rubric.md`. For the cross-skill output discipline (artifact prefix, completion marker, MUST-NOT-write list, connection-probe pattern), see `../../reference/shared-preamble.md#output-contract-reminders` and `../../reference/shared-preamble.md#connection-handshake-summary`. For the underlying 0–10 category-scoring rubric the delta is computed against, see `../../reference/audit-scoring.md`.
13
+
14
+ ---
15
+
16
+ ## Scope
17
+
18
+ This command is **standalone** - not a pipeline stage:
19
+
20
+ - Scoped strictly to delta between two existing files (COMP-02): `DESIGN.md` (baseline, from scan) and `DESIGN-VERIFICATION.md` (result, from verify).
21
+ - Does NOT require or implement a snapshot mechanism - multi-run history is deferred to V2-06.
22
+ - Does NOT mutate any pipeline artifact (`DESIGN.md`, `DESIGN-VERIFICATION.md`, `DESIGN-SUMMARY.md`, `DESIGN-CONTEXT.md`, `DESIGN-PLAN.md`, `.design/STATE.md`).
23
+ - Writes exactly ONE file: `.design/COMPARE-REPORT.md`.
24
+ - Output artifact prefix `COMPARE-REPORT` is distinct from the pipeline namespace (`DESIGN-*.md`). No naming conflict.
25
+
26
+ ---
27
+
28
+ ## Pre-Flight Checks (Pitfall 3)
29
+
30
+ Required files - abort if either is missing:
31
+
32
+ - `.design/DESIGN.md` missing → `"No baseline found. Run /get-design-done scan first."`
33
+ - `.design/DESIGN-VERIFICATION.md` missing → `"No verification result found. Run /get-design-done verify first to produce DESIGN-VERIFICATION.md."`
34
+
35
+ **Optional files (graceful degradation if absent):**
36
+
37
+ - `.design/DESIGN-CONTEXT.md` - used for must-have delta. If missing, skip the Must-Have Status section and emit note: `"Must-have delta skipped: DESIGN-CONTEXT.md not found."`
38
+ - `.design/DESIGN-PLAN.md` - used for drift detection. If missing, skip DRIFT flagging and emit note: `"Drift detection skipped: no DESIGN-PLAN.md."`
39
+
40
+ Confirm `.design/` directory exists. If absent: `mkdir -p .design/`.
41
+
42
+ Probe `preview` connection per `../../reference/shared-preamble.md#connection-handshake-summary` (ToolSearch → live call → STATE.md write). Result drives Step 5B (screenshot delta).
43
+
44
+ ---
45
+
46
+ ## Workflow
47
+
48
+ 1. **Parse Category Scores** - extract baseline + result score tables, normalize names, flag unmatched. Detail: `./compare-rubric.md#step-1--parse-category-scores`.
49
+ 2. **Compute Score Delta** - `delta = result - baseline`, classify (`improvement`/`no_change`/`regression`). Detail: `./compare-rubric.md#step-2--compute-score-delta-comp-03`.
50
+ 3. **Anti-Pattern Delta** - set arithmetic on baseline vs result anti-pattern sets (resolved / new / unchanged). Detail: `./compare-rubric.md#step-3--anti-pattern-delta`.
51
+ 4. **Must-Have Pass/Fail Change** - read `<must_haves>` from `DESIGN-CONTEXT.md`, status from `DESIGN-VERIFICATION.md`. Detail: `./compare-rubric.md#step-4--must-have-passfail-change`.
52
+ 5. **Design Drift Detection (COMP-04)** - build coverage map from `DESIGN-PLAN.md` `Type:` fields; for each `regression` not in coverage_map → emit `DRIFT: [category] ...`. Detail: `./compare-rubric.md#step-5--design-drift-detection-comp-04`.
53
+ 6. **Screenshot Delta (preview: available only)** - capture per-route screenshots to `.design/screenshots/{before,after}/<route>.png`. Detail: `./compare-rubric.md#step-5b--screenshot-delta-when-preview-available`.
54
+ 7. **Write `.design/COMPARE-REPORT.md`** - full template at `./compare-rubric.md#step-6--compare-reportmd-template`.
55
+
56
+ ---
57
+
58
+ ## Constraints
59
+
60
+ This command MUST NOT (per `../../reference/shared-preamble.md#output-contract-reminders`):
61
+
62
+ - Write to `DESIGN.md`, `DESIGN-VERIFICATION.md`, `DESIGN-SUMMARY.md`, `DESIGN-CONTEXT.md`, `DESIGN-PLAN.md`, or `.design/STATE.md`.
63
+ - Require or implement a snapshot system (V2-06 deferred).
64
+ - Reinterpret or silently normalize category names that do not match between files - report mismatches in the Notes section.
65
+ - Invoke `design-auditor` or any other pipeline agent.
66
+ - Produce more than one output file: `.design/COMPARE-REPORT.md`.
67
+
68
+ Must abort with a clear actionable error message if either input file (`DESIGN.md` baseline, `DESIGN-VERIFICATION.md` result) is missing.
69
+
70
+ ---
71
+
72
+ ## Completion
73
+
74
+ After writing `.design/COMPARE-REPORT.md`, print a summary:
75
+
76
+ ```
77
+ Compare complete. Improvements: N. Regressions: M. Drift flags: K. See .design/COMPARE-REPORT.md.
78
+ ```
79
+
80
+ Where `N` = improvement count, `M` = regression count, `K` = DRIFT-flag count (0 if drift detection was skipped or no regressions). Do not summarize individual issues - the file contains the full detail.
81
+
82
+ ## COMPARE COMPLETE