@drafthq/draft 3.6.0 → 3.7.2

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 (117) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.cursor-plugin/plugin.json +1 -1
  4. package/README.md +28 -49
  5. package/bin/README.md +47 -1
  6. package/cli/src/installer.js +1 -1
  7. package/cli/src/lib/cursor-registry.js +10 -0
  8. package/core/agents/architect.md +21 -9
  9. package/core/agents/debugger.md +5 -0
  10. package/core/agents/ops.md +7 -2
  11. package/core/agents/planner.md +7 -0
  12. package/core/agents/rca.md +14 -3
  13. package/core/agents/reviewer.md +1 -0
  14. package/core/agents/writer.md +6 -0
  15. package/core/knowledge-base.md +22 -3
  16. package/core/methodology.md +30 -5
  17. package/core/shared/condensation.md +27 -17
  18. package/core/shared/context-verify.md +3 -1
  19. package/core/shared/cross-skill-dispatch.md +7 -3
  20. package/core/shared/draft-context-loading.md +3 -0
  21. package/core/shared/git-report-metadata.md +1 -0
  22. package/core/shared/graph-query.md +0 -2
  23. package/core/shared/graph-usage-report.md +1 -1
  24. package/core/shared/jira-sync.md +10 -6
  25. package/core/shared/okf-retrieval.md +1 -1
  26. package/core/shared/parallel-analysis.md +14 -7
  27. package/core/shared/pattern-learning.md +2 -0
  28. package/core/shared/template-contract.md +1 -1
  29. package/core/shared/vcs-commands.md +5 -2
  30. package/core/templates/ai-context.md +3 -2
  31. package/core/templates/ai-profile.md +7 -0
  32. package/core/templates/architecture.md +6 -2
  33. package/core/templates/discovery.md +1 -1
  34. package/core/templates/guardrails.md +9 -0
  35. package/core/templates/hld.md +5 -4
  36. package/core/templates/intake-questions.md +45 -0
  37. package/core/templates/jira.md +11 -2
  38. package/core/templates/lld.md +8 -5
  39. package/core/templates/okf/concept.md +0 -1
  40. package/core/templates/product.md +11 -2
  41. package/core/templates/rca.md +6 -0
  42. package/core/templates/service-index.md +1 -0
  43. package/core/templates/spec.md +15 -0
  44. package/core/templates/tech-stack.md +12 -0
  45. package/core/templates/workflow.md +20 -0
  46. package/integrations/agents/AGENTS.md +1272 -292
  47. package/integrations/copilot/.github/copilot-instructions.md +1272 -292
  48. package/package.json +1 -1
  49. package/scripts/fetch-memory-engine.sh +24 -6
  50. package/scripts/lib.sh +11 -4
  51. package/scripts/tools/_graph_queries.sh +10 -3
  52. package/scripts/tools/_lib.sh +33 -11
  53. package/scripts/tools/check-repo-size.sh +125 -0
  54. package/scripts/tools/check-skill-line-caps.sh +1 -2
  55. package/scripts/tools/check-template-noop.sh +0 -1
  56. package/scripts/tools/classify-files.sh +2 -2
  57. package/scripts/tools/cycle-detect.sh +16 -8
  58. package/scripts/tools/fix-whitespace.sh +3 -0
  59. package/scripts/tools/git-metadata.sh +6 -0
  60. package/scripts/tools/graph-arch.sh +1 -1
  61. package/scripts/tools/graph-callers.sh +6 -3
  62. package/scripts/tools/graph-impact.sh +4 -2
  63. package/scripts/tools/graph-init.sh +12 -8
  64. package/scripts/tools/graph-preflight.sh +3 -0
  65. package/scripts/tools/graph-query.sh +70 -7
  66. package/scripts/tools/graph-snapshot.sh +29 -5
  67. package/scripts/tools/hotspot-rank.sh +24 -9
  68. package/scripts/tools/install-smoke-test.sh +223 -0
  69. package/scripts/tools/mermaid-from-graph.sh +28 -11
  70. package/scripts/tools/migrate-track-frontmatter.sh +9 -10
  71. package/scripts/tools/okf-coverage-check.sh +4 -3
  72. package/scripts/tools/okf-fix-links.sh +18 -93
  73. package/scripts/tools/okf-plan-concepts.sh +5 -8
  74. package/scripts/tools/okf-render-views.sh +19 -14
  75. package/scripts/tools/okf-validate-quality.sh +13 -2
  76. package/scripts/tools/okf-validate.sh +13 -2
  77. package/scripts/tools/parse-git-log.sh +19 -1
  78. package/scripts/tools/resolve-tools.sh +24 -8
  79. package/scripts/tools/verify-citations.sh +1 -2
  80. package/scripts/tools/verify-doc-anchors.sh +13 -33
  81. package/scripts/tools/verify-graph-binary.sh +13 -3
  82. package/skills/GRAPH.md +21 -10
  83. package/skills/adr/SKILL.md +24 -6
  84. package/skills/assist-review/SKILL.md +2 -1
  85. package/skills/bughunt/SKILL.md +54 -11
  86. package/skills/bughunt/references/regression-tests.md +14 -4
  87. package/skills/change/SKILL.md +19 -9
  88. package/skills/coverage/SKILL.md +26 -10
  89. package/skills/debug/SKILL.md +12 -2
  90. package/skills/decompose/SKILL.md +39 -9
  91. package/skills/deep-review/SKILL.md +17 -4
  92. package/skills/deploy-checklist/SKILL.md +9 -2
  93. package/skills/documentation/SKILL.md +12 -1
  94. package/skills/draft/SKILL.md +40 -29
  95. package/skills/draft/context-files.md +8 -1
  96. package/skills/draft/quality-guide.md +10 -2
  97. package/skills/graph/SKILL.md +1 -1
  98. package/skills/impact/SKILL.md +3 -1
  99. package/skills/implement/SKILL.md +60 -18
  100. package/skills/incident-response/SKILL.md +5 -2
  101. package/skills/init/SKILL.md +102 -23
  102. package/skills/init/references/architecture-spec.md +31 -7
  103. package/skills/init/references/okf-emitter.md +3 -3
  104. package/skills/jira/SKILL.md +33 -13
  105. package/skills/jira/references/review.md +61 -19
  106. package/skills/learn/SKILL.md +29 -6
  107. package/skills/new-track/SKILL.md +73 -18
  108. package/skills/quick-review/SKILL.md +7 -2
  109. package/skills/revert/SKILL.md +11 -5
  110. package/skills/review/SKILL.md +123 -24
  111. package/skills/review/references/zero-setup-mode.md +117 -0
  112. package/skills/standup/SKILL.md +9 -1
  113. package/skills/status/SKILL.md +6 -6
  114. package/skills/tech-debt/SKILL.md +7 -1
  115. package/skills/testing-strategy/SKILL.md +10 -2
  116. package/skills/tour/SKILL.md +2 -1
  117. package/skills/upload/SKILL.md +3 -2
@@ -12,6 +12,7 @@ Perform an exhaustive end-to-end lifecycle review of a service, component, or mo
12
12
  When `draft/graph/schema.yaml` exists, this skill **must** follow the graph-first lookup contract in [core/shared/graph-query.md](../../core/shared/graph-query.md) §Mandatory Lookup Contract. Deep-review uses the graph to **narrow review scope** — a key 30–50% scope reduction:
13
13
 
14
14
  First resolve the bundled helpers:
15
+
15
16
  ```bash
16
17
  # Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
17
18
  # is not exported into skill Bash). See core/shared/tool-resolver.md.
@@ -28,11 +29,12 @@ DRAFT_TOOLS="${DRAFT_PLUGIN_ROOT:-$(cat ~/.cache/draft/plugin-root 2>/dev/null)}
28
29
 
29
30
  Filesystem `grep` is reserved for source-text scans (API contract strings, secret patterns, log message audits). Module enumeration and caller tracing go through the graph.
30
31
 
31
- ## Red Flags - STOP if you're:
32
+ ## Red Flags - STOP if you're
32
33
 
33
34
  See [shared red flags](../../core/shared/red-flags.md) — applies to all code-touching skills.
34
35
 
35
36
  Skill-specific:
37
+
36
38
  - Acting without reading the Draft context (`draft/.ai-context.md`, `draft/tech-stack.md`, `draft/product.md`)
37
39
  - Modifying production code. This command is for auditing and reporting only. Fixes should be handled in a separate implementation track.
38
40
  - Reviewing a module that was already reviewed recently, unless explicitly requested.
@@ -74,6 +76,7 @@ If `.ai-context.md` is missing, check for `draft/architecture.md` as a fallback
74
76
  ## Review Phases
75
77
 
76
78
  ### Phase 1: Context & Structural Analysis
79
+
77
80
  - Load Draft context following the procedure in `core/shared/draft-context-loading.md`. Use loaded context to understand intended boundaries and critical invariants.
78
81
  - **Load track HLD/LLD if any track owns this module.** Scan `draft/tracks/*/hld.md` for §Detailed Design components matching the module path. When found, extract claims from §High-Level Design / Key Design Decisions, §Checklist (Performance/Scale/Security/Resiliency/Multi-tenancy/Upgrade/Cost), §Observability, §Deployment, and any LLD §Classes and Interfaces invariants and §Error Handling policies. These claims become the design contract this audit measures against (HLD claims vs code reality).
79
82
  - **Load Learned Anti-Patterns** — If `draft/guardrails.md` exists, read the `## Learned Anti-Patterns` section before analysis begins. During the audit, when an issue matches a learned anti-pattern, prefix the finding with `[KNOWN-ANTI-PATTERN: {pattern name}]`. This separates newly discovered issues from documented recurring patterns and allows the report to recommend systemic remediation rather than isolated fixes.
@@ -124,7 +127,7 @@ Every finding in this phase must cite the relevant rule range (e.g., `[RC-008..R
124
127
  - **Latency profiles:** Are p50, p95, p99 latency targets defined and achievable?
125
128
  - **Error budget:** What percentage of the error budget has been consumed? Is the module in "protect" or "innovate" mode?
126
129
  - **Availability:** Does the module's uptime target (99.9%, 99.99%) match its actual architecture?
127
- - If no SLOs are defined, recommend defining them. Reference: Google SRE (https://sre.google/sre-book/service-level-objectives/).
130
+ - If no SLOs are defined, recommend defining them. Reference: Google SRE (<https://sre.google/sre-book/service-level-objectives/>).
128
131
  - **Database Schema Analysis:**
129
132
  - **Missing indexes:** Queries filtering/joining on unindexed columns.
130
133
  - **Wide table scans:** SELECT * or queries without WHERE clauses on large tables.
@@ -154,6 +157,7 @@ For each HLD claim extracted in Phase 1, validate it against code:
154
157
  Surface gaps as findings with prefix `[HLD-DRIFT: §<section>]` (Important if the gap is documentation-vs-implementation drift; Critical if the code violates a stated invariant or security claim).
155
158
 
156
159
  ### Phase 4: Identify Actionable Fixes (Spec Generation)
160
+
157
161
  Instead of mutating the source code, translate all findings into clear, actionable requirements that a developer (or agent) can implement via Test-Driven Development.
158
162
 
159
163
  ### Phase 5: Resilience & Chaos Engineering Assessment
@@ -225,11 +229,13 @@ reviewer: "{model name from runtime}"
225
229
  **Verdict:** PASS / CONDITIONAL PASS / FAIL
226
230
 
227
231
  **Verdict criteria:**
232
+
228
233
  - **FAIL** = any Critical issue found.
229
234
  - **CONDITIONAL PASS** = no Critical issues but Important issues exist.
230
235
  - **PASS** = only Minor issues or no issues.
231
236
 
232
237
  Format findings as actionable tasks:
238
+
233
239
  ```markdown
234
240
  ### [Critical/Important/Minor] Issue Name `[RC-### or CQ-### or SEC-## if applicable]`
235
241
  **File:** path/to/file:line
@@ -245,6 +251,7 @@ Cite the most specific rule ID from `core/guardrails/review-checks.md` (RC-###),
245
251
  **For Phase 3 (Security):** Load `core/guardrails/security.md` and apply the 5-step security reasoning chain. Hard red line violations (SEC-01…SEC-10) are always Critical. Run `core/guardrails/dependency-triage.md` procedure for any dependency manifest files in the module's scope `[RC-014]`.
246
252
 
247
253
  **Constraints:**
254
+
248
255
  - Do not refactor code yourself.
249
256
  - Flag ambiguous fixes for human review instead of guessing.
250
257
  - If the module is too large, decompose it and review sub-modules sequentially.
@@ -272,6 +279,7 @@ Every deep-review report must end with a `## Next Actions` section listing the s
272
279
  ```
273
280
 
274
281
  Rules:
282
+
275
283
  - Production-blocking findings (`[SEC-*]`, ACID violations, unbounded resource use) produce blocker rows.
276
284
  - Suggest `/draft:adr` for structural changes, `/draft:new-track` for multi-week remediation, `/draft:incident-response` for hot issues, `/draft:tech-debt` for systemic items.
277
285
  - Cap at 10 actions; group related fixes under one row.
@@ -283,14 +291,16 @@ Rules:
283
291
  After deep-review audit completion:
284
292
 
285
293
  **If architecture debt found:**
286
- ```
294
+
295
+ ```text
287
296
  "Architecture debt identified in module audit. Consider:
288
297
  → /draft:tech-debt — Catalog and prioritize the architecture debt
289
298
  → /draft:adr — Document undiscovered design decisions found during review"
290
299
  ```
291
300
 
292
301
  **If documentation gaps found:**
293
- ```
302
+
303
+ ```text
294
304
  → /draft:documentation runbook — Generate operational runbook for this module"
295
305
  ```
296
306
 
@@ -307,11 +317,13 @@ If `draft/graph/schema.yaml` does not exist, set `Graph files queried: NONE` and
307
317
  ## Graph Usage Report (append to report)
308
318
 
309
319
  Emit the canonical footer from [core/shared/graph-usage-report.md](../../core/shared/graph-usage-report.md) §Canonical footer. The lint hook `scripts/tools/check-graph-usage-report.sh` validates the section on save.
320
+
310
321
  ## Skill Telemetry
311
322
 
312
323
  As the last step after saving the deep-review report, emit a metrics record. Best-effort — never block.
313
324
 
314
325
  **Payload fields:**
326
+
315
327
  ```json
316
328
  {
317
329
  "skill": "deep-review",
@@ -327,6 +339,7 @@ As the last step after saving the deep-review report, emit a metrics record. Bes
327
339
  ```
328
340
 
329
341
  **Emit call:**
342
+
330
343
  ```bash
331
344
  # Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
332
345
  # is not exported into skill Bash). See core/shared/tool-resolver.md.
@@ -17,11 +17,12 @@ When `draft/graph/schema.yaml` exists, this skill **must** follow the graph-firs
17
17
 
18
18
  Filesystem `grep` is reserved for source-text scans (migration file names, flag-key strings). Module/impact discovery goes through the graph.
19
19
 
20
- ## Red Flags — STOP if you're:
20
+ ## Red Flags — STOP if you're
21
21
 
22
22
  See [shared red flags](../../core/shared/red-flags.md) — applies to all code-touching skills.
23
23
 
24
24
  Skill-specific:
25
+
25
26
  - Deploying without a rollback plan
26
27
  - Skipping database migration verification
27
28
  - Deploying on Friday without explicit team approval
@@ -87,6 +88,7 @@ not be considered "ready to deploy" if `pre_deploy_status != passing`.
87
88
  ## Step 1: Parse Arguments
88
89
 
89
90
  Check for arguments:
91
+
90
92
  - `/draft:deploy-checklist` — Interactive: detect active track or ask for service name
91
93
  - `/draft:deploy-checklist <service>` — Generate checklist for named service
92
94
  - `/draft:deploy-checklist track <id>` — Generate from track's change scope
@@ -111,7 +113,7 @@ Generate a four-phase checklist customized to the project's tech stack. Adapt it
111
113
 
112
114
  ### Phase 0: HLD/LLD Gate (track-scoped only, when hld.md exists)
113
115
 
114
- > ** blocker:** the HLD's §Checklist sections were the design-time commitment. If they are still empty at deploy time, the design was never validated against operational reality. This phase enforces that.
116
+ > **blocker:** the HLD's §Checklist sections were the design-time commitment. If they are still empty at deploy time, the design was never validated against operational reality. This phase enforces that.
115
117
 
116
118
  For `criticality ∈ {high, mission-critical}` (read from `hld.md` frontmatter `classification.criticality`), every row below MUST be checked before Phase 1 begins. For `standard` criticality, missing rows produce warnings but do not block. For `low`, this phase is informational.
117
119
 
@@ -176,6 +178,7 @@ If a partial file is needed for tracking, write it with `status: BLOCKED` in the
176
178
  ### Rollback Triggers
177
179
 
178
180
  Initiate rollback if ANY of these occur:
181
+
179
182
  - Error rate exceeds 2x baseline
180
183
  - p95 latency exceeds 3x baseline
181
184
  - Data corruption detected
@@ -195,10 +198,12 @@ Initiate rollback if ANY of these occur:
195
198
  ## Step 4: Present and Track
196
199
 
197
200
  Present the checklist interactively. For each critical item (marked **bold**):
201
+
198
202
  - If unchecked and user wants to proceed: warn "Critical item unchecked: [item]. Are you sure? [y/N]"
199
203
  - Default: stop and address critical items
200
204
 
201
205
  Allow the user to:
206
+
202
207
  - Check off items as they complete them
203
208
  - Add custom items specific to this deployment
204
209
  - Mark items as N/A with justification
@@ -219,6 +224,7 @@ Include the report header table immediately after frontmatter:
219
224
  ```
220
225
 
221
226
  Save to:
227
+
222
228
  - Track-scoped: `draft/tracks/<id>/deploy-checklist.md`
223
229
  - Standalone: `draft/deploy-checklist-<timestamp>.md` with symlink `deploy-checklist-latest.md`
224
230
 
@@ -241,6 +247,7 @@ If `draft/graph/schema.yaml` does not exist, set `Graph files queried: NONE` and
241
247
  ## Graph Usage Report (append to checklist)
242
248
 
243
249
  Emit the canonical footer from [core/shared/graph-usage-report.md](../../core/shared/graph-usage-report.md). The lint hook `scripts/tools/check-graph-usage-report.sh` validates the section on save.
250
+
244
251
  ## Cross-Skill Dispatch
245
252
 
246
253
  - **Auto-invoked by:** `/draft:upload` (pre-upload verification)
@@ -7,7 +7,7 @@ description: Technical documentation writing and maintenance. Modes — readme,
7
7
 
8
8
  You are generating or updating technical documentation for this project using structured writing principles.
9
9
 
10
- ## Red Flags — STOP if you're:
10
+ ## Red Flags — STOP if you're
11
11
 
12
12
  - Writing docs without reading the code first
13
13
  - Duplicating information that exists elsewhere (link instead)
@@ -22,6 +22,7 @@ You are generating or updating technical documentation for this project using st
22
22
  ## Pre-Check
23
23
 
24
24
  1. Check for Draft context:
25
+
25
26
  ```bash
26
27
  ls draft/ 2>/dev/null
27
28
  ```
@@ -41,6 +42,7 @@ If `draft/` doesn't exist, this skill works standalone — generate docs from co
41
42
  ## Step 2: Gather Source Material
42
43
 
43
44
  ### README Mode
45
+
44
46
  - Read existing `README.md` (if any)
45
47
  - Read `draft/product.md` — Product vision, users, goals
46
48
  - Read `draft/tech-stack.md` — Technologies, setup requirements
@@ -48,6 +50,7 @@ If `draft/` doesn't exist, this skill works standalone — generate docs from co
48
50
  - Scan for `Makefile`, `package.json`, `pyproject.toml` — Build/run commands
49
51
 
50
52
  ### Runbook Mode
53
+
51
54
  - Read `draft/architecture.md` or `draft/.ai-context.md` — Service topology, dependencies
52
55
  - Read `draft/workflow.md` — Deployment conventions
53
56
  - Read `draft/tech-stack.md` — Infrastructure details
@@ -55,12 +58,14 @@ If `draft/` doesn't exist, this skill works standalone — generate docs from co
55
58
  - If Jira MCP available: check recent incident tickets for the service
56
59
 
57
60
  ### API Mode
61
+
58
62
  - Read source code for public interfaces, exported functions, API routes
59
63
  - Read existing API docs (Swagger, OpenAPI, JSDoc, docstrings)
60
64
  - Read `draft/architecture.md` — API conventions, data models
61
65
  - Read `draft/tech-stack.md` — API framework details
62
66
 
63
67
  ### Onboarding Mode
68
+
64
69
  - Read ALL draft context files in order:
65
70
  1. `draft/product.md` — What is this project?
66
71
  2. `draft/tech-stack.md` — What technologies?
@@ -83,6 +88,7 @@ Follow these principles (from `core/agents/writer.md`):
83
88
  ## Step 4: Generate Document
84
89
 
85
90
  ### README Structure
91
+
86
92
  ```markdown
87
93
  # {Project Name}
88
94
 
@@ -105,6 +111,7 @@ Follow these principles (from `core/agents/writer.md`):
105
111
  ```
106
112
 
107
113
  ### Runbook Structure
114
+
108
115
  ```markdown
109
116
  # Runbook: {Service Name}
110
117
 
@@ -128,6 +135,7 @@ Follow these principles (from `core/agents/writer.md`):
128
135
  ```
129
136
 
130
137
  ### API Documentation Structure
138
+
131
139
  ```markdown
132
140
  # API: {Module Name}
133
141
 
@@ -144,6 +152,7 @@ Follow these principles (from `core/agents/writer.md`):
144
152
  ```
145
153
 
146
154
  ### Onboarding Structure
155
+
147
156
  ```markdown
148
157
  # Welcome to {Project Name}
149
158
 
@@ -172,6 +181,7 @@ Follow these principles (from `core/agents/writer.md`):
172
181
  ## Step 5: Output
173
182
 
174
183
  Save to:
184
+
175
185
  - README: `README.md` in project root
176
186
  - Runbook: `draft/docs/runbook-<service>.md`
177
187
  - API: `draft/docs/api-<module>.md`
@@ -180,6 +190,7 @@ Save to:
180
190
  Create `draft/docs/` directory if needed.
181
191
 
182
192
  **Pre-save validation:**
193
+
183
194
  - Every file path referenced in the doc resolves to a real file (broken links are a common LLM failure mode here).
184
195
  - Every relative link in the doc resolves under the project root.
185
196
  - Code blocks copied from sources match the current commit (no stale snippets).
@@ -7,7 +7,7 @@ description: "Lists Draft's canonical workflow commands, explains the Context-Dr
7
7
 
8
8
  Draft is a methodology for structured software development: **Context → Spec & Plan → Implement → Verify**
9
9
 
10
- ## Red Flags - STOP if you're:
10
+ ## Red Flags - STOP if you're
11
11
 
12
12
  - Jumping straight to implementation without reading existing Draft context
13
13
  - Suggesting `/draft:implement` before a track has an approved spec and plan
@@ -22,16 +22,19 @@ Draft is a methodology for structured software development: **Context → Spec &
22
22
  ## Workflow Commands
23
23
 
24
24
  ### Canonical Workflow
25
- ```
25
+
26
+ ```text
26
27
  init → plan → implement → review → upload
27
28
  ↑ |
28
29
  └────────────┘ (review auto-invoked at phase boundaries)
29
30
  ```
30
31
 
31
32
  ### Primary Workflow (Parent) Commands
33
+
32
34
  These 7 canonical parent commands coordinate and orchestrate the entire development lifecycle, automatically routing to specialist subcommands when appropriate.
33
35
 
34
36
  ### Routed Core Workflows (5 routers)
37
+
35
38
  The 5 router commands provide intent-based dispatch into the 20+ specialist commands. Use the router form for discoverability; leaf commands remain supported for compatibility.
36
39
 
37
40
  | Router | Scope | Dispatches To (examples) |
@@ -47,39 +50,45 @@ The 5 router commands provide intent-based dispatch into the 20+ specialist comm
47
50
  ---
48
51
 
49
52
  ### Specialist & Subcommands
53
+
50
54
  These commands remain available for targeted, specialist execution outside parent command orchestration. **Every command below appears exactly once in this reference.**
51
55
 
52
56
  #### 1. Planning & Architecture
53
- * `/draft:new-track` - Create a new feature/bug track with structured `spec.md` and `plan.md`
54
- * `/draft:decompose` - Perform module-level decomposition with dependency mapping
55
- * `/draft:change` - Safely manage and document mid-track requirement changes and plan updates
56
- * `/draft:adr` - Write Architecture Decision Records to capture permanent technical choices
57
+
58
+ - `/draft:new-track` - Create a new feature/bug track with structured `spec.md` and `plan.md`
59
+ - `/draft:decompose` - Perform module-level decomposition with dependency mapping
60
+ - `/draft:change` - Safely manage and document mid-track requirement changes and plan updates
61
+ - `/draft:adr` - Write Architecture Decision Records to capture permanent technical choices
57
62
 
58
63
  #### 2. Quality & Testing
59
- * `/draft:quick-review` - Fast, lightweight 4-dimension code review for staged changes or diffs
60
- * `/draft:bughunt` - Exhaustive 14-dimension codebase-wide bug hunt with verification protocol
61
- * `/draft:deep-review` - Rigorous module-scoped lifecycle audit (ACID compliance, resilience)
62
- * `/draft:coverage` - Measure and report code coverage (targeting 95%+ for changed code)
63
- * `/draft:testing-strategy` - Design testing plan and identify coverage/mocking strategies
64
- * `/draft:learn` - Discover coding patterns from recent Git diffs and update `draft/guardrails.md`
64
+
65
+ - `/draft:quick-review` - Fast, lightweight 4-dimension code review for staged changes or diffs
66
+ - `/draft:bughunt` - Exhaustive 14-dimension codebase-wide bug hunt with verification protocol
67
+ - `/draft:deep-review` - Rigorous module-scoped lifecycle audit (ACID compliance, resilience)
68
+ - `/draft:coverage` - Measure and report code coverage (targeting 95%+ for changed code)
69
+ - `/draft:testing-strategy` - Design testing plan and identify coverage/mocking strategies
70
+ - `/draft:learn` - Discover coding patterns from recent Git diffs and update `draft/guardrails.md`
65
71
 
66
72
  #### 3. Operations & Debugging
67
- * `/draft:status` - Display a comprehensive overview of active track phases, tasks, and modules
68
- * `/draft:revert` - Safely roll back active tasks or commits using Git-aware tracking
69
- * `/draft:debug` - Structured 4-stage debugging flow (reproduce → isolate → diagnose → fix)
70
- * `/draft:standup` - Summarize git activity and file changes for standup reporting
71
- * `/draft:deploy-checklist` - Pre-deployment checklist verification with automated rollback triggers
72
- * `/draft:upload` - Pre-upload gate: review, HLD approvals, validator chain, then git upload/PR
73
- * `/draft:incident-response` - Coordinate incident lifecycle (triage → mitigate → postmortem)
73
+
74
+ - `/draft:status` - Display a comprehensive overview of active track phases, tasks, and modules
75
+ - `/draft:revert` - Safely roll back active tasks or commits using Git-aware tracking
76
+ - `/draft:debug` - Structured 4-stage debugging flow (reproduce → isolate → diagnose → fix)
77
+ - `/draft:standup` - Summarize git activity and file changes for standup reporting
78
+ - `/draft:deploy-checklist` - Pre-deployment checklist verification with automated rollback triggers
79
+ - `/draft:upload` - Pre-upload gate: review, HLD approvals, validator chain, then git upload/PR
80
+ - `/draft:incident-response` - Coordinate incident lifecycle (triage → mitigate → postmortem)
74
81
 
75
82
  #### 4. Setup & Documentation
76
- * `/draft` - Display this command overview and help reference
77
- * `/draft:init` - Single scope-aware entry point: builds the root-first code graph (`draft/graph/`) and project context; run at the repo root or inside any sub-module (monorepo context comes from running it at root)
78
- * `/draft:discover` - Phase 0 code-spike report (hotspots, mode flags, open questions) before spec freeze
79
- * `/draft:documentation` - Generate structured codebase documentation (API, Onboarding, Runbooks)
80
- * `/draft:tech-debt` - Audit technical debt across 6 key dimensions
83
+
84
+ - `/draft` - Display this command overview and help reference
85
+ - `/draft:init` - Single scope-aware entry point: builds the root-first code graph (`draft/graph/`) and project context; run at the repo root or inside any sub-module (monorepo context comes from running it at root)
86
+ - `/draft:discover` - Phase 0 code-spike report (hotspots, mode flags, open questions) before spec freeze
87
+ - `/draft:documentation` - Generate structured codebase documentation (API, Onboarding, Runbooks)
88
+ - `/draft:tech-debt` - Audit technical debt across 6 key dimensions
81
89
 
82
90
  **Integration:**
91
+
83
92
  | Command | Purpose |
84
93
  |---------|---------|
85
94
  | `/draft:jira` | Unified Jira workflows (preview / create / review) |
@@ -123,9 +132,10 @@ flowchart TD
123
132
  ## Actionability: Command Invocation Examples
124
133
 
125
134
  ### Example 1: `/draft:status`
135
+
126
136
  Parses active tracks, phases, tasks, and module mappings:
127
137
 
128
- ```
138
+ ```yaml
129
139
  PROJECT: Bookshelf API Service
130
140
 
131
141
  [track-042] OAuth2 Integration — [~] In Progress (Phase 2/3, 4/9 tasks)
@@ -137,9 +147,10 @@ PROJECT: Bookshelf API Service
137
147
  ```
138
148
 
139
149
  ### Example 2: `/draft:implement`
150
+
140
151
  Reads `plan.md`, picks the current incomplete task, and continues it (TDD-aware):
141
152
 
142
- ```
153
+ ```text
143
154
  Active track: [track-042] OAuth2 Integration
144
155
  Current task: [~] 2.1 Implement token generation endpoint
145
156
  TDD: on → writing tests/auth/token_generation_test.go (Red stage)
@@ -163,9 +174,9 @@ Used throughout `plan.md` files and referenced by the validation checkpoints abo
163
174
 
164
175
  You can also use natural language. Prefer the 5 router commands (`/draft:plan`, `/draft:ops`, `/draft:docs`, `/draft:discover`, `/draft:jira`) for grouped access; they analyze intent and dispatch.
165
176
 
166
- * **[quality-guide.md](./quality-guide.md)** — Quality Audit Spectrum, command choices, and coordination with external bug-hunting tools.
167
- * **[context-files.md](./context-files.md)** — Schema, role, and usage of each file inside the `draft/` context directory.
168
- * **[intent-mapping.md](./intent-mapping.md)** — Maps natural language phrasing to precise Draft commands for conversational AI usage.
177
+ - **[quality-guide.md](./quality-guide.md)** — Quality Audit Spectrum, command choices, and coordination with external bug-hunting tools.
178
+ - **[context-files.md](./context-files.md)** — Schema, role, and usage of each file inside the `draft/` context directory.
179
+ - **[intent-mapping.md](./intent-mapping.md)** — Maps natural language phrasing to precise Draft commands for conversational AI usage.
169
180
 
170
181
  ---
171
182
 
@@ -6,7 +6,7 @@ When the `draft/` directory exists at the root of a project, the files within it
6
6
 
7
7
  All context files reside in `draft/` at your project root:
8
8
 
9
- ```
9
+ ```text
10
10
  draft/
11
11
  ├── architecture.md # Full human engineering reference (Source of Truth)
12
12
  ├── .ai-context.md # Token-optimized AI context (derived automatically)
@@ -22,36 +22,43 @@ draft/
22
22
  ## Detailed File Reference
23
23
 
24
24
  ### 1. `draft/architecture.md` (Engineering Source of Truth)
25
+
25
26
  * **Purpose:** Comprehensive, human-readable reference detailing the system's design, domain model, services, module diagrams, and key data flows.
26
27
  * **When to read:** When designing new components, onboarding, or reviewing module boundaries.
27
28
  * **When to update:** After running decomposition, making major architectural changes, or completing an epic.
28
29
 
29
30
  ### 2. `draft/.ai-context.md` (Token-Optimized AI Context)
31
+
30
32
  * **Purpose:** A derived, lightweight (200-400 lines) copy of the architecture file designed specifically to maximize AI model efficiency. It omits verbose descriptions and captures essential system definitions, directory structures, and module APIs.
31
33
  * **When to read:** AI models read this automatically on every invocation to orient themselves.
32
34
  * **When to update:** Generated automatically whenever `draft/architecture.md` changes. Do not edit this file manually.
33
35
 
34
36
  ### 3. `draft/product.md` (Product & Business Vision)
37
+
35
38
  * **Purpose:** Defines the high-level business goals, core user personas, key workflows, success metrics, and long-term vision.
36
39
  * **When to read:** Before proposing features or starting plans, to verify alignment with business goals.
37
40
  * **When to update:** When product strategy changes or a new epic is initiated.
38
41
 
39
42
  ### 4. `draft/tech-stack.md` (Constraints & Stack Decisions)
43
+
40
44
  * **Purpose:** Records explicit details of the languages, frameworks, databases, libraries, deployment environment, and testing tools used. Contains absolute constraints (e.g., "No external ORMs allowed").
41
45
  * **When to read:** Before proposing libraries or deciding how to implement tasks.
42
46
  * **When to update:** When upgrading dependencies or making team-wide tech stack decisions.
43
47
 
44
48
  ### 5. `draft/workflow.md` (Work & Style Preferences)
49
+
45
50
  * **Purpose:** Outlines coding style conventions, test-driven development (TDD) rules, commit message guidelines, git branch naming schemes, and build scripts.
46
51
  * **When to read:** During implementation and review cycles to ensure compliance.
47
52
  * **When to update:** When adjusting developer processes, lint rules, or build tooling.
48
53
 
49
54
  ### 6. `draft/guardrails.md` (Learned Patterns & Anti-Patterns)
55
+
50
56
  * **Purpose:** Stores positive code conventions and negative anti-patterns discovered during development. This serves as an automated memory for the AI.
51
57
  * **When to read:** Before coding to avoid repeating common codebase-specific mistakes.
52
58
  * **When to update:** Run `/draft:learn` to automatically extract rules from your Git diffs or write them manually when discovering a repeated bug.
53
59
 
54
60
  ### 7. `draft/tracks.md` (Track Registry)
61
+
55
62
  * **Purpose:** Registers all active, completed, and blocked tracks (feature or bug fixes). Contains IDs, descriptions, and current status markers.
56
63
  * **When to read:** Before planning new work to prevent duplication, or when generating status reports.
57
64
  * **When to update:** Automatically updated by `/draft:plan` and `/draft:status`.
@@ -16,26 +16,34 @@ This guide helps you choose the most effective quality control and review comman
16
16
  ## Command Decision Guide
17
17
 
18
18
  ### 1. Fast Feedback / Pre-Commit Sanity Check
19
+ >
19
20
  > [!TIP]
20
21
  > Use **`/draft:quick-review`** when you want a fast, lightweight sanity check of your modified files before opening a PR or running full reviews.
22
+
21
23
  - **When to run:** Before staging changes, during local development loops.
22
24
  - **Why:** Zero setup, rapid turnaround, checks standard dimensions (security, performance, styling).
23
25
 
24
26
  ### 2. Track Completion & Pull Request Quality Gate
27
+ >
25
28
  > [!IMPORTANT]
26
29
  > Use **`/draft:review`** (the canonical review command) when you finish a development phase or an entire track.
30
+
27
31
  - **When to run:** Before submitting work for final PR approval.
28
32
  - **Why:** It validates the implementation directly against the active track's `spec.md` and `plan.md` to ensure all acceptance criteria and quality gates are met. It also auto-invokes coverage checks when TDD is active.
29
33
 
30
34
  ### 3. Debugging Hard-to-Find Defects or Refactoring
35
+ >
31
36
  > [!WARNING]
32
37
  > Use **`/draft:bughunt`** if you are encountering elusive bugs, regression errors, or before refactoring a legacy module.
38
+
33
39
  - **When to run:** Prior to refactoring complex areas, or when users report intermittent production bugs.
34
40
  - **Why:** Conducts a deep, 14-dimension sweep specifically designed to surface edge cases, race conditions, memory leaks, and logic flaws.
35
41
 
36
42
  ### 4. Shipping Core Infrastructure to Production
43
+ >
37
44
  > [!CAUTION]
38
45
  > Use **`/draft:deep-review`** before launching a critical service, API, database layer, or high-throughput component.
46
+
39
47
  - **When to run:** Before major deployments or architectural sign-offs.
40
48
  - **Why:** Audits the architecture for ACID compliance, concurrency safety, fault tolerance, rate limiting, and telemetry, providing a formal readiness score.
41
49
 
@@ -45,7 +53,7 @@ This guide helps you choose the most effective quality control and review comman
45
53
 
46
54
  Many AI tools and editors provide built-in bug-hunting agents (such as Claude Code's native `bughunt` or other automated scanners). Draft's quality commands are designed to be **complementary**:
47
55
 
48
- * **Built-in Agents:** Typically focus on fast, generic static analysis, automated linting, and rapid parallel auto-fixes.
49
- * **Draft Quality Commands:** Leverage project-specific context (including `draft/architecture.md`, `draft/product.md`, `draft/tech-stack.md`, and `draft/guardrails.md`). This eliminates false positives and ensures findings align with your specific domain constraints, team conventions, and technical stack choices.
56
+ - **Built-in Agents:** Typically focus on fast, generic static analysis, automated linting, and rapid parallel auto-fixes.
57
+ - **Draft Quality Commands:** Leverage project-specific context (including `draft/architecture.md`, `draft/product.md`, `draft/tech-stack.md`, and `draft/guardrails.md`). This eliminates false positives and ensures findings align with your specific domain constraints, team conventions, and technical stack choices.
50
58
 
51
59
  For maximum quality assurance, run built-in scanners in parallel with Draft commands!
@@ -7,7 +7,7 @@ description: Initialize or refresh the knowledge-graph snapshot for a repository
7
7
 
8
8
  Initialize or refresh the `draft/graph/` knowledge-graph snapshot for a single repository. This is the narrow "give me a fresh structural graph" command — it does **not** generate `architecture.md`/`.ai-context.md` and does **not** re-inject doc diagram slots (both are `/draft:init`). For scope-aware, root-first graph memory across a monorepo (root spine + module→root links), use `/draft:init --graph-only`.
9
9
 
10
- ## Red Flags - STOP if you're:
10
+ ## Red Flags - STOP if you're
11
11
 
12
12
  - Reporting counts without actually running `graph-snapshot.sh`
13
13
  - Claiming the graph is built when the engine was unavailable
@@ -7,7 +7,8 @@ description: Generate a project-wide impact report on Draft track delivery — p
7
7
 
8
8
  Generate a project-wide impact report measuring Context-Driven Development effectiveness across all tracks.
9
9
 
10
- ## Red Flags - STOP if you're:
10
+ ## Red Flags - STOP if you're
11
+
11
12
  - Profiling code coverage instead of measuring track-level impact.
12
13
  - Rewriting tracker logic when local state objects are available for inspection.
13
14
  - Generating reports without reading existing track metadata first.
@@ -92,6 +93,7 @@ Every impact/telemetry report must end with a `## Next Actions` section listing
92
93
  ```
93
94
 
94
95
  Rules:
96
+
95
97
  - Impact reports are advisory — `Blocker? = no` is the default; mark `yes` only when a metric breach demands immediate process change.
96
98
  - Suggest `/draft:tech-debt` for systemic friction, `/draft:adr` for methodology adjustments, `/draft:tour` for onboarding gaps.
97
99
  - Cap at 7 actions.