@drafthq/draft 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/.claude-plugin/marketplace.json +38 -0
  2. package/.claude-plugin/plugin.json +26 -0
  3. package/LICENSE +21 -0
  4. package/README.md +272 -0
  5. package/bin/README.md +49 -0
  6. package/cli/bin/draft.js +13 -0
  7. package/cli/src/cli.js +113 -0
  8. package/cli/src/hosts/claude-code.js +46 -0
  9. package/cli/src/hosts/codex.js +33 -0
  10. package/cli/src/hosts/cursor.js +50 -0
  11. package/cli/src/hosts/index.js +24 -0
  12. package/cli/src/hosts/opencode.js +39 -0
  13. package/cli/src/installer.js +61 -0
  14. package/cli/src/lib/fsx.js +34 -0
  15. package/cli/src/lib/graph.js +23 -0
  16. package/cli/src/lib/log.js +32 -0
  17. package/cli/src/lib/paths.js +14 -0
  18. package/core/agents/architect.md +338 -0
  19. package/core/agents/debugger.md +193 -0
  20. package/core/agents/ops.md +104 -0
  21. package/core/agents/planner.md +158 -0
  22. package/core/agents/rca.md +314 -0
  23. package/core/agents/reviewer.md +256 -0
  24. package/core/agents/writer.md +110 -0
  25. package/core/guardrails/README.md +4 -0
  26. package/core/guardrails/code-quality.md +4 -0
  27. package/core/guardrails/dependency-triage.md +4 -0
  28. package/core/guardrails/design-norms.md +4 -0
  29. package/core/guardrails/language-standards.md +4 -0
  30. package/core/guardrails/review-checks.md +4 -0
  31. package/core/guardrails/secure-patterns.md +4 -0
  32. package/core/guardrails/security.md +4 -0
  33. package/core/guardrails.md +22 -0
  34. package/core/knowledge-base.md +127 -0
  35. package/core/methodology.md +1221 -0
  36. package/core/shared/condensation.md +224 -0
  37. package/core/shared/context-verify.md +44 -0
  38. package/core/shared/cross-skill-dispatch.md +127 -0
  39. package/core/shared/discovery-schema.md +75 -0
  40. package/core/shared/draft-context-loading.md +282 -0
  41. package/core/shared/git-report-metadata.md +106 -0
  42. package/core/shared/graph-query.md +239 -0
  43. package/core/shared/graph-usage-report.md +22 -0
  44. package/core/shared/jira-sync.md +170 -0
  45. package/core/shared/parallel-analysis.md +386 -0
  46. package/core/shared/parallel-fanout.md +10 -0
  47. package/core/shared/pattern-learning.md +146 -0
  48. package/core/shared/red-flags.md +58 -0
  49. package/core/shared/template-contract.md +22 -0
  50. package/core/shared/template-hygiene.md +10 -0
  51. package/core/shared/tool-resolver.md +10 -0
  52. package/core/shared/vcs-commands.md +97 -0
  53. package/core/shared/verification-gates.md +47 -0
  54. package/core/templates/CHANGELOG.md +70 -0
  55. package/core/templates/ai-context-export.md +8 -0
  56. package/core/templates/ai-context.md +270 -0
  57. package/core/templates/ai-profile.md +41 -0
  58. package/core/templates/architecture.md +203 -0
  59. package/core/templates/dependency-graph.md +103 -0
  60. package/core/templates/discovery.md +79 -0
  61. package/core/templates/guardrails.md +143 -0
  62. package/core/templates/hld.md +327 -0
  63. package/core/templates/intake-questions.md +403 -0
  64. package/core/templates/jira.md +119 -0
  65. package/core/templates/lld.md +283 -0
  66. package/core/templates/metadata.json +66 -0
  67. package/core/templates/plan.md +130 -0
  68. package/core/templates/product.md +110 -0
  69. package/core/templates/rca.md +86 -0
  70. package/core/templates/root-architecture.md +127 -0
  71. package/core/templates/root-product.md +53 -0
  72. package/core/templates/root-tech-stack.md +117 -0
  73. package/core/templates/service-index.md +55 -0
  74. package/core/templates/session-summary.md +8 -0
  75. package/core/templates/spec.md +165 -0
  76. package/core/templates/tech-matrix.md +101 -0
  77. package/core/templates/tech-stack.md +169 -0
  78. package/core/templates/track-architecture.md +311 -0
  79. package/core/templates/workflow.md +187 -0
  80. package/integrations/agents/AGENTS.md +24384 -0
  81. package/integrations/copilot/.github/copilot-instructions.md +24384 -0
  82. package/integrations/gemini/.gemini.md +26 -0
  83. package/package.json +53 -0
  84. package/scripts/fetch-memory-engine.sh +116 -0
  85. package/scripts/lib.sh +256 -0
  86. package/scripts/tools/_lib.sh +220 -0
  87. package/scripts/tools/adr-index.sh +117 -0
  88. package/scripts/tools/check-graph-usage-report.sh +95 -0
  89. package/scripts/tools/check-scope-conflicts.sh +139 -0
  90. package/scripts/tools/check-skill-line-caps.sh +115 -0
  91. package/scripts/tools/check-template-noop.sh +87 -0
  92. package/scripts/tools/check-track-hygiene.sh +230 -0
  93. package/scripts/tools/classify-files.sh +231 -0
  94. package/scripts/tools/cycle-detect.sh +75 -0
  95. package/scripts/tools/detect-test-framework.sh +135 -0
  96. package/scripts/tools/diff-templates-vs-tracks.sh +176 -0
  97. package/scripts/tools/emit-skill-metrics.sh +71 -0
  98. package/scripts/tools/fix-whitespace.sh +192 -0
  99. package/scripts/tools/freshness-check.sh +143 -0
  100. package/scripts/tools/git-metadata.sh +203 -0
  101. package/scripts/tools/graph-callers.sh +74 -0
  102. package/scripts/tools/graph-impact.sh +93 -0
  103. package/scripts/tools/graph-snapshot.sh +102 -0
  104. package/scripts/tools/hotspot-rank.sh +75 -0
  105. package/scripts/tools/manage-symlinks.sh +85 -0
  106. package/scripts/tools/mermaid-from-graph.sh +92 -0
  107. package/scripts/tools/migrate-track-frontmatter.sh +241 -0
  108. package/scripts/tools/parse-git-log.sh +135 -0
  109. package/scripts/tools/parse-reports.sh +114 -0
  110. package/scripts/tools/render-track.sh +145 -0
  111. package/scripts/tools/run-coverage.sh +153 -0
  112. package/scripts/tools/scan-markers.sh +144 -0
  113. package/scripts/tools/skill-caps.conf +24 -0
  114. package/scripts/tools/validate-frontmatter.sh +125 -0
  115. package/scripts/tools/verify-citations.sh +250 -0
  116. package/scripts/tools/verify-doc-anchors.sh +204 -0
  117. package/scripts/tools/verify-graph-binary.sh +154 -0
  118. package/skills/GRAPH.md +332 -0
  119. package/skills/adr/SKILL.md +374 -0
  120. package/skills/assist-review/SKILL.md +49 -0
  121. package/skills/bughunt/SKILL.md +668 -0
  122. package/skills/bughunt/references/regression-tests.md +399 -0
  123. package/skills/change/SKILL.md +267 -0
  124. package/skills/coverage/SKILL.md +336 -0
  125. package/skills/debug/SKILL.md +201 -0
  126. package/skills/decompose/SKILL.md +656 -0
  127. package/skills/deep-review/SKILL.md +326 -0
  128. package/skills/deploy-checklist/SKILL.md +254 -0
  129. package/skills/discover/SKILL.md +66 -0
  130. package/skills/docs/SKILL.md +42 -0
  131. package/skills/documentation/SKILL.md +197 -0
  132. package/skills/draft/SKILL.md +177 -0
  133. package/skills/draft/context-files.md +57 -0
  134. package/skills/draft/intent-mapping.md +37 -0
  135. package/skills/draft/quality-guide.md +51 -0
  136. package/skills/graph/SKILL.md +107 -0
  137. package/skills/impact/SKILL.md +86 -0
  138. package/skills/implement/SKILL.md +794 -0
  139. package/skills/incident-response/SKILL.md +245 -0
  140. package/skills/index/SKILL.md +848 -0
  141. package/skills/init/SKILL.md +1784 -0
  142. package/skills/init/references/architecture-spec.md +1259 -0
  143. package/skills/integrations/SKILL.md +53 -0
  144. package/skills/jira/SKILL.md +577 -0
  145. package/skills/jira/references/review.md +1322 -0
  146. package/skills/learn/SKILL.md +478 -0
  147. package/skills/new-track/SKILL.md +841 -0
  148. package/skills/ops/SKILL.md +57 -0
  149. package/skills/plan/SKILL.md +60 -0
  150. package/skills/quick-review/SKILL.md +216 -0
  151. package/skills/revert/SKILL.md +178 -0
  152. package/skills/review/SKILL.md +1114 -0
  153. package/skills/standup/SKILL.md +183 -0
  154. package/skills/status/SKILL.md +183 -0
  155. package/skills/tech-debt/SKILL.md +318 -0
  156. package/skills/testing-strategy/SKILL.md +195 -0
  157. package/skills/tour/SKILL.md +38 -0
  158. package/skills/upload/SKILL.md +117 -0
@@ -0,0 +1,283 @@
1
+ ---
2
+ project: "{PROJECT_NAME}"
3
+ module: "root"
4
+ track_id: "{TRACK_ID}"
5
+ generated_by: "draft:decompose"
6
+ generated_at: "{ISO_TIMESTAMP}"
7
+ # Stable frontmatter only (WS-8). Ephemeral fields live in metadata.json
8
+ # and render via <!-- META:<key> --> directives.
9
+ links:
10
+ spec: "./spec.md"
11
+ plan: "./plan.md"
12
+ hld: "./hld.md"
13
+ project_architecture: "../../architecture.md"
14
+ ---
15
+
16
+ # {TRACK_TITLE} — LLD
17
+
18
+ **_TBD_author_** (_TBD_email_) <!-- REQUIRED -->
19
+
20
+ **Status:** <!-- META:status --> <!-- REQUIRED -->
21
+
22
+ > Track ID: `{TRACK_ID}` — generated by `draft:decompose`. Sibling docs: [`./hld.md`](./hld.md), [`./spec.md`](./spec.md), [`./plan.md`](./plan.md). For project-wide architecture, see [`../../architecture.md`](../../architecture.md).
23
+
24
+ ## Approvals
25
+
26
+ > **Pre-fill:** Pulled from `spec.md` frontmatter `approvers.{team_leads, tech_leads, qa}`. Captured per row before code review begins.
27
+
28
+ | Role | Approver | Date | Comments | <!-- REQUIRED for criticality ∈ {high, mission-critical} -->
29
+ |------|----------|------|----------|
30
+ | Team Leads | _TBD_approver_team_leads_ | _TBD_date_ | _TBD_comments_ |
31
+ | Technical Leads | _TBD_approver_tech_leads_ | _TBD_date_ | _TBD_comments_ |
32
+ | Quality Assurance | _TBD_approver_qa_ | _TBD_date_ | _TBD_comments_ |
33
+
34
+ ---
35
+
36
+ ## Table of Contents
37
+
38
+ 1. [Background](#background)
39
+ 2. [Requirements](#requirements)
40
+ 3. [Low Level Design](#low-level-design)
41
+ 4. [Observability](#observability)
42
+
43
+ ---
44
+
45
+ ## Background
46
+
47
+ <Link to HLD and explain context here>
48
+
49
+ > See [`./hld.md` §Background](./hld.md#background) for the high-level rationale. Use this section only for component-internal context the HLD doesn't cover.
50
+
51
+ > **Citations.** Use `path/to/file.ext:LINE` (or `LINE-RANGE`); verifier:
52
+ > `scripts/tools/verify-citations.sh`. Prefer `// DRAFT-CITE: <id>` source
53
+ > anchors over raw line numbers for code that moves often.
54
+
55
+ ---
56
+
57
+ ## Requirements
58
+
59
+ > **Source:** [`./spec.md`](./spec.md). Whitebox (per-component) requirements live there. Do not duplicate.
60
+
61
+ - **Whitebox requirements scorecard:** see [`./spec.md` §Requirements](./spec.md#requirements)
62
+ - **Acceptance criteria mapped to this LLD:** {list AC IDs covered by this LLD}
63
+
64
+ ---
65
+
66
+ ## Low Level Design
67
+
68
+ > **NOTE:**
69
+ > - HLD and Detailed Design covers components and interactions across various services that the feature touches
70
+ > - LLD to be documented here is for each such component and internal implementation
71
+ > - A single doc here can cover all components, or they can be split up, but the key is to ensure every component in every service the design touches has an LLD
72
+
73
+ ### Classes and Interfaces
74
+
75
+ **Describe the class level design preferably with a diagram**
76
+
77
+ - This should convey what interfaces each class provides and how it interacts with other classes
78
+ - Describe choice of message queues vs RPCs for interactions
79
+
80
+ <!-- GRAPH:track-class-table:START -->
81
+ <!-- Rendered by draft:decompose Step 5b for each module marked New/Modified.
82
+ Per-module table. Columns: Symbol, Kind (class/iface/func/method),
83
+ Signature, Visibility, Citation, Concurrency Notes, lock_acquired,
84
+ reentrant. -->
85
+ <!-- WS-7 required columns: lock_acquired (named lock or "none"),
86
+ reentrant (yes/no/n/a). -->
87
+ <!-- GRAPH:track-class-table:END -->
88
+
89
+ #### [Component/Service Name]
90
+
91
+ **Public API:**
92
+
93
+ | Function / Method | Signature | Params | Returns | Errors / Exceptions | Citation |
94
+ |-------------------|-----------|--------|---------|---------------------|----------|
95
+ | `{name}` | `{lang-appropriate signature}` | `{param: type — constraint}` | `{type — shape}` | `{error types / codes}` | `path:line` |
96
+
97
+ **Preconditions:** {what must be true before call — caller responsibilities}
98
+ **Postconditions:** {what is guaranteed after successful call}
99
+ **Invariants:** {properties preserved across calls — thread safety, idempotency, ordering}
100
+
101
+ {Repeat per component.}
102
+
103
+ ---
104
+
105
+ ### Data Model
106
+
107
+ **Describe the schemas of persistent state - protobuf or db schemas**
108
+
109
+ - Describe the schemas of messages / RPCs
110
+ - Describe caching considerations
111
+
112
+ <!-- GRAPH:track-data-models:START -->
113
+ <!-- Rendered by draft:decompose Step 5b. One block per new/modified entity.
114
+ Pulls proto/struct/class declarations + field metadata from the graph. -->
115
+ <!-- GRAPH:track-data-models:END -->
116
+
117
+ #### [Component/Service Name]
118
+
119
+ **`{ModelName}`** (`path:line`)
120
+
121
+ ```{language}
122
+ {actual type definition — struct, class, interface, proto message, TypedDict, etc.}
123
+ ```
124
+
125
+ | Field | Type | Nullable | Default | Validation / Constraint |
126
+ |-------|------|----------|---------|-------------------------|
127
+ | `{field}` | `{type}` | yes/no | `{default or —}` | `{rule}` |
128
+
129
+ **Storage:** {where persisted — table, collection, key prefix}
130
+ **Indexes / Keys:** {primary key, unique constraints, indexed fields}
131
+ **Migration:** {if this is a schema change — migration path and rollback}
132
+
133
+ {Repeat per model.}
134
+
135
+ ---
136
+
137
+ ### Eligibility / Cap Tables <!-- OPTIONAL -->
138
+
139
+ > When the LLD specifies caps (byte limits, row limits, concurrency caps),
140
+ > use this schema. Every cap value carries `derived_from` (a flag, threshold,
141
+ > benchmark, or vendor limit). Pure invention without `derived_from` is
142
+ > rejected by the deploy-checklist gate.
143
+
144
+ | Cap | Value | derived_from | Notes | <!-- REQUIRED if section present -->
145
+ |-----|-------|--------------|-------|
146
+ | _TBD_cap_1_name_ | _TBD_cap_1_value_ | _TBD_cap_1_derived_from_ | _TBD_cap_1_notes_ |
147
+
148
+ ---
149
+
150
+ ### Key Algorithms and Workflows
151
+
152
+ **Describe certain key algorithms / workflows**
153
+
154
+ > **WS-7 sequence-diagram rule.** When the prose enumerates edge cases (cap
155
+ > exceeded, OOM, flag flip mid-flow, retry exhausted), the Mermaid sequence
156
+ > diagram **must** include an explicit `alt` / `opt` block per edge case.
157
+ > `Note over X,Y: ... TBD policy ...` is **not** sufficient. Reviewers and
158
+ > deploy-checklist fail on bare prose without diagram blocks.
159
+
160
+ Examples:
161
+ - List of steps to failover a multi-region database cluster
162
+ - Analysis phase of a background data indexing service
163
+ - Transferring session state information between authentication and profile services via a secure messaging protocol
164
+
165
+ #### [Algorithm/Workflow Name]
166
+
167
+ **Inputs:** `{...}`
168
+ **Outputs:** `{...}`
169
+ **Complexity:** `O({...})` time, `O({...})` space
170
+
171
+ ```mermaid
172
+ sequenceDiagram
173
+ participant U as {Caller}
174
+ participant A as {module-1}
175
+ participant B as {module-2}
176
+ participant D as {DB / external}
177
+
178
+ U->>A: {request payload}
179
+ A->>B: {internal call}
180
+ B->>D: {query / write}
181
+ D-->>B: {result}
182
+ B-->>A: {response}
183
+ A-->>U: {final response}
184
+
185
+ Note over A,B: {invariant / gate}
186
+ ```
187
+
188
+ **Pseudocode:**
189
+
190
+ ```
191
+ 1. validate inputs
192
+ 2. ...
193
+ 3. return result
194
+ ```
195
+
196
+ **Edge cases handled:**
197
+ - {case 1 — what happens}
198
+ - {case 2 — what happens}
199
+
200
+ ---
201
+
202
+ ### Error Handling & Retry Semantics
203
+
204
+ | Operation | Error Class | Classification | Retry? | Backoff | Max Attempts | Fallback | fault_injection_site | <!-- REQUIRED -->
205
+ |-----------|-------------|----------------|--------|---------|--------------|----------|----------------------|
206
+ | _TBD_err_1_op_ | _TBD_err_1_class_ | _TBD_err_1_classification_ | _TBD_err_1_retry_ | _TBD_err_1_backoff_ | _TBD_err_1_max_attempts_ | _TBD_err_1_fallback_ | _TBD_err_1_fault_injection_site_ |
207
+
208
+ **Propagation model:** {Result type / exceptions / error codes}
209
+ **Circuit breaker:** {thresholds, half-open policy, reset} — omit if N/A
210
+ **Idempotency:** {which operations are idempotent and how — dedup key, tx id}
211
+
212
+ ---
213
+
214
+ ### Refactoring of Existing Code
215
+
216
+ <Describe if large sections of existing code is being refactored, and why (e.g., not modular and hence can't be reused; can't write UTs well as interfaces are not defined cleanly)>
217
+
218
+ ---
219
+
220
+ ### Programming Language Choice and Unit Testing
221
+
222
+ #### Programming Language Choice
223
+
224
+ <Describe Programming Language choice and justification>
225
+
226
+ #### Unit Testing Strategy
227
+
228
+ - **Mock Interfaces:**
229
+ - How mock interfaces are going to be implemented and used in UTs
230
+
231
+ - **Functional Test Cases:**
232
+ - What are major cases to be UT'd functionally
233
+
234
+ - **Error & Fault Injection:**
235
+ - How errors & faults are injected
236
+
237
+ - **Race Condition Simulation:**
238
+ - How race conditions are simulated
239
+
240
+ > See `/draft:testing-strategy` for the project's authoritative test strategy. This LLD section captures only what is specific to this track's components.
241
+
242
+ ---
243
+
244
+ ### PaaS Choices
245
+
246
+ <Describe the choices made in each of the following areas with justification:>
247
+
248
+ #### Data Store
249
+
250
+ - Relational vs NoSQL
251
+ - Justification
252
+
253
+ #### Workflow Engine
254
+
255
+ - (e.g., Temporal, etc.)
256
+ - Justification
257
+
258
+ #### Operational State Checkpointing Store
259
+
260
+ - (e.g., Scribe, Mongo, etc.)
261
+ - Justification
262
+
263
+ ---
264
+
265
+ ## Observability
266
+
267
+ ### Metrics
268
+
269
+ List down all metrics that developers and SREs need to look at to identify issues:
270
+
271
+ -
272
+ -
273
+ -
274
+
275
+ ### Alerting Thresholds
276
+
277
+ List down alerting thresholds on those metrics:
278
+
279
+ | Metric | Threshold | Severity | Action |
280
+ |--------|-----------|----------|--------|
281
+ | | | | |
282
+
283
+ > `/draft:deploy-checklist` validates this table is populated before deploy.
@@ -0,0 +1,66 @@
1
+ {
2
+ "$schema": "Draft Track Metadata Schema",
3
+ "$description": "Tracks status, progress, review history, and blast radius for a Draft track. Created by /draft:new-track, updated by /draft:implement and /draft:review.",
4
+
5
+ "id": "<track-id>",
6
+ "title": "<Human-readable title>",
7
+ "type": "feature|bugfix|refactor",
8
+ "status": "planning|in_progress|completed",
9
+ "created": "<ISO 8601 timestamp>",
10
+ "updated": "<ISO 8601 timestamp>",
11
+
12
+ "phases": {
13
+ "total": 0,
14
+ "completed": 0
15
+ },
16
+
17
+ "tasks": {
18
+ "total": 0,
19
+ "completed": 0
20
+ },
21
+
22
+ "template_version": "2.0.0",
23
+
24
+ "scope_includes": [],
25
+ "scope_excludes": [],
26
+
27
+ "classification": {
28
+ "criticality": "_TBD_criticality_",
29
+ "data_classification": "_TBD_data_classification_",
30
+ "deployment_surface": "_TBD_deployment_surface_"
31
+ },
32
+
33
+ "git": {
34
+ "branch": "_TBD_branch_",
35
+ "remote": "_TBD_remote_",
36
+ "commit": "_TBD_commit_",
37
+ "commit_short": "_TBD_commit_short_",
38
+ "commit_date": "_TBD_commit_date_",
39
+ "commit_message": "_TBD_commit_message_",
40
+ "dirty": false
41
+ },
42
+ "synced_to_commit": "_TBD_synced_to_commit_",
43
+
44
+ "hygiene_budget": {
45
+ "draft_tbd_cap": -1,
46
+ "ready_for_review_tbd_cap": 3,
47
+ "discovery_min_hotspots": 3
48
+ },
49
+
50
+ "pre_deploy_status": "unrun",
51
+
52
+ "lastReviewed": "<ISO 8601 timestamp — set by /draft:review>",
53
+ "reviewCount": 0,
54
+ "lastReviewVerdict": "PASS|PASS_WITH_NOTES|FAIL",
55
+
56
+ "$impact_description": "Blast-radius memory — written by /draft:implement on phase complete, read by /draft:new-track to flag overlap. Sourced from `git diff --name-only <track_first_sha>^..HEAD` plus `scripts/tools/graph-impact.sh --repo . --file <path>` for each touched file. Optional — absent if graph data unavailable.",
57
+ "impact": {
58
+ "files_touched": [],
59
+ "modules_touched": [],
60
+ "downstream_files": 0,
61
+ "downstream_modules": [],
62
+ "max_depth": 0,
63
+ "by_category": { "code": 0, "test": 0, "doc": 0, "config": 0 },
64
+ "computed_at": "<ISO 8601 timestamp>"
65
+ }
66
+ }
@@ -0,0 +1,130 @@
1
+ ---
2
+ project: "{PROJECT_NAME}"
3
+ module: "root"
4
+ track_id: "{TRACK_ID}"
5
+ generated_by: "draft:new-track"
6
+ generated_at: "{ISO_TIMESTAMP}"
7
+ # Stable frontmatter only (WS-8). Ephemeral fields live in metadata.json
8
+ # and render via <!-- META:<key> --> directives.
9
+ ---
10
+
11
+ # Plan: {TITLE}
12
+
13
+ <!-- DECOMPOSE:REGENERATE START -->
14
+ <!-- Phase tables below are rewritten by draft:decompose. Manual notes outside
15
+ these markers survive every regenerate. -->
16
+ <!-- DECOMPOSE:REGENERATE END -->
17
+
18
+ | Field | Value |
19
+ |-------|-------|
20
+ | **Branch** | <!-- META:git.branch --> → <!-- META:git.remote --> |
21
+ | **Commit** | <!-- META:git.commit_short --> — <!-- META:git.commit_message --> |
22
+ | **Generated** | {ISO_TIMESTAMP} |
23
+ | **Synced To** | <!-- META:synced_to_commit --> |
24
+
25
+ **Track ID:** {TRACK_ID}
26
+ **Spec:** ./spec.md
27
+ **Status:** <!-- META:status --> <!-- REQUIRED -->
28
+
29
+ ## Scope <!-- OPTIONAL -->
30
+
31
+ - **Includes:** <!-- META:scope_includes -->
32
+ - **Excludes:** <!-- META:scope_excludes -->
33
+
34
+ ---
35
+
36
+ ## Overview
37
+
38
+ {One-paragraph summary of what this plan delivers, derived from spec.md}
39
+
40
+ ---
41
+
42
+ <!-- DECOMPOSE:REGENERATE START -->
43
+
44
+ ## Phase 0: Discovery (completed)
45
+
46
+ **Goal:** Spike — read current code, enumerate hotspots and open questions.
47
+ **Verification:** [`./discovery.md`](./discovery.md) exists, hotspots cited,
48
+ open questions resolved or deferred.
49
+
50
+ | Entry gate | Exit gate | Owner |
51
+ |---|---|---|
52
+ | `draft:new-track` initiated | `discovery.md` validator clean (`scripts/tools/verify-citations.sh`, hygiene) | _TBD_owner_phase_0_ |
53
+
54
+ ---
55
+
56
+ ## Phase 1: Foundation
57
+
58
+ **Goal:** {What this phase establishes}
59
+ **Verification:** {How to confirm phase is complete}
60
+
61
+ | Entry gate | Exit gate | Owner | <!-- REQUIRED -->
62
+ |---|---|---|
63
+ | _TBD_phase_1_entry_gate_command_ | _TBD_phase_1_exit_gate_command_ | _TBD_owner_phase_1_ |
64
+
65
+ ### Tasks
66
+
67
+ - [ ] **Task 1.1:** {Description} — `{file_path}`
68
+ - [ ] **Task 1.2:** {Description} — `{file_path}`
69
+
70
+ ---
71
+
72
+ ## Phase 2: Core Implementation
73
+
74
+ **Goal:** {What this phase delivers}
75
+ **Verification:** {How to confirm phase is complete}
76
+
77
+ | Entry gate | Exit gate | Owner | <!-- REQUIRED -->
78
+ |---|---|---|
79
+ | _TBD_phase_2_entry_gate_command_ | _TBD_phase_2_exit_gate_command_ | _TBD_owner_phase_2_ |
80
+
81
+ ### Tasks
82
+
83
+ - [ ] **Task 2.1:** {Description} — `{file_path}`
84
+ - [ ] **Task 2.2:** {Description} — `{file_path}`
85
+
86
+ ---
87
+
88
+ ## Phase 3: Integration & Polish
89
+
90
+ **Goal:** {What this phase delivers}
91
+ **Verification:** {How to confirm phase is complete — run full test suite, manual verification}
92
+
93
+ | Entry gate | Exit gate | Owner | <!-- REQUIRED -->
94
+ |---|---|---|
95
+ | _TBD_phase_3_entry_gate_command_ | _TBD_phase_3_exit_gate_command_ | _TBD_owner_phase_3_ |
96
+
97
+ ### Tasks
98
+
99
+ - [ ] **Task 3.1:** {Description} — `{file_path}`
100
+ - [ ] **Task 3.2:** Verify — {Run tests, confirm all acceptance criteria met}
101
+
102
+ <!-- DECOMPOSE:REGENERATE END -->
103
+
104
+ ---
105
+
106
+ ## Pre-Deploy Validation <!-- REQUIRED -->
107
+
108
+ Before any phase advances past `[~]` in-progress to `[x]` complete, run the
109
+ validator chain via the canonical resolver pattern (see
110
+ [core/shared/verification-gates.md](../../core/shared/verification-gates.md)):
111
+
112
+ ```bash
113
+ DRAFT_TOOLS="${DRAFT_PLUGIN_ROOT:-$HOME/.claude/plugins/draft}/scripts/tools"
114
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$HOME/.cursor/plugins/local/draft/scripts/tools"
115
+ [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
116
+ "$DRAFT_TOOLS/check-track-hygiene.sh" .; "$DRAFT_TOOLS/verify-citations.sh" .
117
+ "$DRAFT_TOOLS/verify-doc-anchors.sh" .; "$DRAFT_TOOLS/check-graph-usage-report.sh" .
118
+ "$DRAFT_TOOLS/check-scope-conflicts.sh" ..;"$DRAFT_TOOLS/diff-templates-vs-tracks.sh" .
119
+ ```
120
+
121
+ `metadata.json:pre_deploy_status` MUST be `passing` to deploy.
122
+
123
+ ---
124
+
125
+ ## Status Markers
126
+
127
+ - `[ ]` Pending
128
+ - `[~]` In Progress
129
+ - `[x]` Completed — append commit SHA: `(abc1234)`
130
+ - `[!]` Blocked — note reason
@@ -0,0 +1,110 @@
1
+ ---
2
+ project: "{PROJECT_NAME}"
3
+ module: "root"
4
+ generated_by: "draft:init"
5
+ generated_at: "{ISO_TIMESTAMP}"
6
+ ---
7
+
8
+ # Product: [Product Name]
9
+
10
+ | Field | Value |
11
+ |-------|-------|
12
+ | **Branch** | `{LOCAL_BRANCH}` → `{REMOTE/BRANCH}` |
13
+ | **Commit** | `{SHORT_SHA}` — {COMMIT_MESSAGE} |
14
+ | **Generated** | {ISO_TIMESTAMP} |
15
+ | **Synced To** | `{FULL_SHA}` |
16
+
17
+ ---
18
+
19
+ ## Vision
20
+
21
+ [One paragraph describing what this product does and why it matters to users]
22
+
23
+ ---
24
+
25
+ ## Target Users
26
+
27
+ ### Primary Users
28
+ - **[User Type 1]**: [What they need, their context]
29
+ - **[User Type 2]**: [What they need, their context]
30
+
31
+ ### Secondary Users
32
+ - **[Admin/Support]**: [Their interaction with the product]
33
+
34
+ ---
35
+
36
+ ## Core Features
37
+
38
+ ### Must Have (P0)
39
+ 1. **[Feature 1]**: [Brief description]
40
+ 2. **[Feature 2]**: [Brief description]
41
+ 3. **[Feature 3]**: [Brief description]
42
+
43
+ ### Should Have (P1)
44
+ 1. **[Feature 4]**: [Brief description]
45
+ 2. **[Feature 5]**: [Brief description]
46
+
47
+ ### Nice to Have (P2)
48
+ 1. **[Feature 6]**: [Brief description]
49
+
50
+ ---
51
+
52
+ ## Success Criteria
53
+
54
+ - [ ] [Measurable goal 1, e.g., "Users can complete signup in under 2 minutes"]
55
+ - [ ] [Measurable goal 2]
56
+ - [ ] [Measurable goal 3]
57
+
58
+ ---
59
+
60
+ ## Constraints
61
+
62
+ ### Technical
63
+ - [Constraint, e.g., "Must support IE11"]
64
+ - [Constraint, e.g., "API response time < 200ms"]
65
+
66
+ ### Business
67
+ - [Constraint, e.g., "Must comply with GDPR"]
68
+ - [Constraint, e.g., "Budget for external APIs: $X/month"]
69
+
70
+ ### Timeline
71
+ - [Milestone 1]: [Date]
72
+ - [Milestone 2]: [Date]
73
+
74
+ ---
75
+
76
+ ## Non-Goals
77
+
78
+ Things explicitly out of scope for this product:
79
+
80
+ - [Non-goal 1]
81
+ - [Non-goal 2]
82
+
83
+ ---
84
+
85
+ ## Open Questions
86
+
87
+ - [ ] [Question that needs resolution]
88
+ - [ ] [Another question]
89
+
90
+ ---
91
+
92
+ ## Guidelines (Optional)
93
+
94
+ ### Writing Style
95
+ - **Tone:** [professional / casual / technical]
96
+ - **Voice:** [first person "we" / third person "the system" / second person "you"]
97
+ - **Terminology:** [domain-specific terms and definitions]
98
+
99
+ ### UX Principles
100
+ 1. [e.g., "Convention over configuration" — minimize required decisions]
101
+ 2. [e.g., "Accessible by default" — WCAG AA compliance minimum]
102
+ 3. [e.g., "Progressive disclosure" — show complexity only when needed]
103
+
104
+ ### Error Handling
105
+ - **Error message tone:** [helpful / technical / minimal]
106
+ - **User feedback patterns:** [toasts / modals / inline / status bar]
107
+
108
+ ### Content Standards
109
+ - **Date format:** [ISO 8601 / localized / relative]
110
+ - **Internationalization:** [i18n required / English-only / planned]
@@ -0,0 +1,86 @@
1
+ ---
2
+ project: "{PROJECT_NAME}"
3
+ track_id: "{TRACK_ID}"
4
+ jira_ticket: "{JIRA_KEY}"
5
+ generated_by: "draft:new-track"
6
+ generated_at: "{ISO_TIMESTAMP}"
7
+ ---
8
+
9
+ # Root Cause Analysis: {TITLE}
10
+
11
+ | Field | Value |
12
+ |-------|-------|
13
+ | **Branch** | `{LOCAL_BRANCH}` → `{REMOTE/BRANCH}` |
14
+ | **Commit** | `{SHORT_SHA}` — {COMMIT_MESSAGE} |
15
+ | **Generated** | {ISO_TIMESTAMP} |
16
+ | **Synced To** | `{FULL_SHA}` |
17
+
18
+ ## Summary
19
+
20
+ [1-2 sentence root cause statement with `file:line` references]
21
+
22
+ ## Classification
23
+
24
+ - **Type:** [logic error | race condition | data corruption | config error | dependency issue | missing validation | state management | resource exhaustion]
25
+ - **Severity:** [SEV1 | SEV2 | SEV3 | SEV4]
26
+ - **Detection Lag:** [when introduced vs when detected]
27
+ - **SLO Impact:** [which SLOs affected, by how much]
28
+
29
+ ## Evidence Gathered
30
+
31
+ | Source | URL/Path | Key Finding |
32
+ |--------|----------|-------------|
33
+ | Jira ticket | {JIRA_KEY} | [reproduction steps, reporter context] |
34
+ | Logs | [ssh path or URL] | [relevant log lines] |
35
+ | Dashboard | [URL] | [metric anomaly] |
36
+ | Code | [file:line] | [relevant code section] |
37
+
38
+ ## Timeline
39
+
40
+ | When | What |
41
+ |------|------|
42
+ | [date] | Bug introduced (commit SHA if known) |
43
+ | [date] | Bug detected / reported |
44
+ | [date] | Investigation started |
45
+ | [date] | Root cause confirmed |
46
+ | [date] | Fix deployed |
47
+
48
+ ## 5 Whys
49
+
50
+ 1. Why did [symptom]? → Because [cause 1]
51
+ 2. Why [cause 1]? → Because [cause 2]
52
+ 3. Why [cause 2]? → Because [cause 3]
53
+ 4. Why [cause 3]? → Because [cause 4]
54
+ 5. Why [cause 4]? → Because [root cause]
55
+
56
+ ## Blast Radius
57
+
58
+ - **Affected modules:** [from .ai-context.md service map]
59
+ - **Affected users/flows:** [from product.md user journeys]
60
+ - **Data impact:** [any data corruption or loss]
61
+ - **SLO budget consumed:** [percentage of error budget burned]
62
+
63
+ ## Prevention Items
64
+
65
+ ### Detection Improvement
66
+ - [ ] [monitoring/alerting improvement to catch this sooner]
67
+
68
+ ### Process Improvement
69
+ - [ ] [review/testing improvement to prevent this class of bug]
70
+
71
+ ### Code Improvement
72
+ - [ ] [guard/validation to add in code]
73
+
74
+ ### Architecture Improvement
75
+ - [ ] [structural change if needed to make this class of bug impossible]
76
+
77
+ ## Proposed Fix
78
+
79
+ [Brief description of the fix approach — developer reviews before implementation]
80
+
81
+ **Files to modify:**
82
+ - `file1:line` — [change description]
83
+ - `file2:line` — [change description]
84
+
85
+ **Regression test:**
86
+ - [Description of regression test to write — pending developer approval]