@drafthq/draft 3.4.0 → 3.5.1

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.
@@ -12,7 +12,7 @@
12
12
  "name": "draft",
13
13
  "source": "./",
14
14
  "description": "Context-Driven Development: draft specs and plans before implementation. Structured workflows for features and fixes.",
15
- "version": "3.4.0",
15
+ "version": "3.5.1",
16
16
  "author": {
17
17
  "name": "mayurpise"
18
18
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "draft",
3
3
  "description": "Context-Driven Development: draft specs and plans before implementation. Structured workflows for features and fixes.",
4
- "version": "3.4.0",
4
+ "version": "3.5.1",
5
5
  "author": {
6
6
  "name": "mayurpise"
7
7
  },
@@ -2,7 +2,7 @@
2
2
  "name": "draft",
3
3
  "displayName": "Draft",
4
4
  "description": "Context-Driven Development: draft specs and plans before implementation. Structured workflows for features and fixes.",
5
- "version": "3.4.0",
5
+ "version": "3.5.1",
6
6
  "skills": "./skills/",
7
7
  "agents": "./core/agents/",
8
8
  "author": {
@@ -52,3 +52,12 @@ so a focused task knows exactly which source files to open.
52
52
  ## See also
53
53
 
54
54
  - [Related concept](../systems/other.md)
55
+
56
+ <!-- okf:concept-template v1
57
+ A stub or redirect-only page (e.g. "see architecture.md", an unreplaced
58
+ {PLACEHOLDER} token, or a body below the per-type minimum) FAILS
59
+ okf-validate-quality.sh and therefore does NOT satisfy okf-coverage-check.sh —
60
+ the bundle will not be promoted. Diagram types (Subsystem/Module/Feature/
61
+ Entrypoint) require ≥1 valid Mermaid block and ≥2 x-grounded-paths.
62
+ -->
63
+
@@ -336,6 +336,16 @@ DRAFT_INIT_MODE="${DRAFT_INIT_MODE:-auto}"
336
336
 
337
337
  The tier-gated default rests on **maintainability/readability** (one navigable concept per file, cleaner PRs, a generated `architecture.md` preserved for linear onboarding) — not on the A/B benchmark, which was accuracy-parity (`docs/audit/okf-benchmark.md`). `monolith` is **retained, not retired**: it is the tier-1/2 default, the A/B baseline, and the fallback. If `DRAFT_INIT_MODE` is unset, do not commit to a mode until **Step 1.4.5** has computed the tier.
338
338
 
339
+ **OKF Completeness Verification (blocking — tier 3+ `okf` mode).** Completeness is enforced by tooling, not honor system, so the wiki is generated completely for every module/sub-module/component on every run. Before promoting `draft.tmp/` → `draft/`, ALL must hold (see `references/okf-emitter.md` for the pipeline):
340
+
341
+ 1. `okf-plan-concepts.sh` ran and the expected/required/deferred counts were logged **before** any page was written (the concept boundary is a tool output, not an in-context guess).
342
+ 2. Every `required` entry in `concept-plan.json` has a non-stub page.
343
+ 3. `okf-validate-all.sh … --plan … --strict` exits 0 (structure + per-type quality + coverage all pass).
344
+ 4. `systems/coverage.md` was generated by tooling (verify the `<!-- okf:coverage-generated -->` marker) — no required package with `fan_in ≥ floor` is **MISSING**.
345
+ 5. On any failure: **do not** atomic-rename; surface `.state/validation-report.json`.
346
+
347
+ > **Red flag:** writing concept pages without first running `okf-plan-concepts.sh`, or finishing generation while any `required` plan entry is unwritten, is a **completeness failure** — not a stylistic one.
348
+
339
349
  ### Route Explicit Modes Before Initialization
340
350
 
341
351
  If the user explicitly invoked a specialist mode, route directly:
@@ -3291,7 +3301,10 @@ esac
3291
3301
  Everything else in `draft init` (5-phase analysis, graph snapshot, `.state/`
3292
3302
  hashing, scope detection, atomic staging) is **reused unchanged**. This mode adds
3293
3303
  a decomposition + serialization stage. It introduces **no new LLM analysis
3294
- engine** and exactly **one** new deterministic helper, `okf-validate.sh`.
3304
+ engine**; its deterministic helpers are `okf-plan-concepts.sh` (expected-concept
3305
+ set), `okf-validate.sh` (structure), `okf-validate-quality.sh` (per-type
3306
+ anti-stub), `okf-coverage-check.sh` (completeness), and `okf-validate-all.sh`
3307
+ (the single promotion gate that runs all three), plus `okf-render-views.sh`.
3295
3308
 
3296
3309
  ## Target layout
3297
3310
 
@@ -3384,25 +3397,64 @@ Derive concepts from the graph, not by hand:
3384
3397
 
3385
3398
  ```
3386
3399
  1. Survey → existing draft init 5-phase + graph snapshot (graph-snapshot.sh)
3387
- 2. Plan → derive the concept list (above) from graph clusters +
3388
- entrypoints + features. Topo-sort by dependency so pages that
3389
- others link to (overview, core subsystems) generate FIRST —
3390
- forward cross-links resolve.
3391
- 3. Generate → per concept, pull grounding from the graph and write the page:
3400
+ 2. Plan → DETERMINISTIC. okf-plan-concepts.sh derives the expected-concept
3401
+ set from the graph (every package with fan_in ≥ floor → required
3402
+ Subsystem/Module; entrypoints required; below-floor / allow-defer
3403
+ deferred with a reason) and writes draft.tmp/.state/concept-plan.json.
3404
+ okf-plan-concepts.sh --repo . [--scope PATH] \
3405
+ [--manifest FILE] [--min-fan-in 2] [--allow-defer GLOB]... \
3406
+ --out draft.tmp/.state/concept-plan.json
3407
+ This replaces the old in-context concept enumeration — the boundary
3408
+ of the work is now a tool output, not an LLM judgment, so modules
3409
+ cannot be silently dropped. LOG the counts (expected/required/
3410
+ deferred) BEFORE writing any page. `generated_order` is topo-ish
3411
+ (required + high-fan-in first) so forward cross-links resolve.
3412
+ 3. Generate → iterate concept-plan.generated_order; write ONE page per REQUIRED
3413
+ entry, grounding each from the graph:
3392
3414
  x-callers ← graph-callers.sh --symbol <c>
3393
3415
  x-grounded-paths ← graph-impact.sh --symbol <c> (blast radius)
3394
3416
  x-hotspot-score ← hotspot-rank.sh
3395
3417
  overview diagrams ← mermaid-from-graph.sh
3396
3418
  Record each source path → page in .state/path-to-concept.json.
3419
+ Loop post-condition: every required concept_id has an output file.
3420
+ ⚠ Writing pages via shell heredoc without reading x-grounded-paths
3421
+ sources, or finishing while any required entry is unwritten, is a
3422
+ completeness failure — not a stylistic one.
3397
3423
  4. Render views → ai-context.md (synopsis + Concept Map), architecture.md
3398
- (concatenated view), wiki/log.md (see M4).
3399
- 5. Validate → okf-validate.sh draft/wiki \
3400
- --path-index draft/.state/path-to-concept.json
3401
- FAIL the build (do not atomic-rename) on any dangle, missing
3402
- field, bad type, or path-index gap.
3403
- 6. Emit → mv draft.tmp/ draft/ ; update .state/.
3424
+ (concatenated view + coverage banner), wiki/log.md (see M4).
3425
+ 5. Validate → the promotion gate. Run all layers via the orchestrator:
3426
+ 5a. okf-validate-all.sh draft.tmp/wiki \
3427
+ --repo . \
3428
+ --plan draft.tmp/.state/concept-plan.json \
3429
+ --path-index draft.tmp/.state/path-to-concept.json \
3430
+ --strict --report draft.tmp/.state/validation-report.json
3431
+ It runs, in order: okf-validate.sh (structure + reverse index),
3432
+ okf-validate-quality.sh (per-type anti-stub / depth / mermaid lint),
3433
+ okf-coverage-check.sh (every required plan entry → real page).
3434
+ ANY layer failing ⇒ exit non-zero ⇒ DO NOT atomic-rename.
3435
+ coverage.md (systems/coverage.md) is regenerated by the coverage
3436
+ layer; it is tool-owned (marker <!-- okf:coverage-generated -->) —
3437
+ never hand-author it except deferral reasons in the manifest.
3438
+ 6. Emit → mv draft.tmp/ draft/ ONLY IF step 5 exit 0 ; update .state/.
3439
+ On failure keep draft.tmp/ and surface validation-report.json.
3440
+ ```
3441
+
3442
+ ### Validation report schema (`.state/validation-report.json`)
3443
+
3444
+ ```json
3445
+ { "valid": false, "bundle": "draft.tmp/wiki",
3446
+ "layers": { "structure": "pass", "quality": "pass", "coverage": "fail" } }
3404
3447
  ```
3405
3448
 
3449
+ ### Component manifest (optional — `--manifest FILE`)
3450
+
3451
+ When the graph engine is unavailable (or a repo wants an authoritative list), pass
3452
+ a plain-text manifest: one component name per line, `#` comments and blanks ignored.
3453
+ Every listed component becomes a REQUIRED concept; `--allow-defer GLOB` still moves
3454
+ matches to deferred. Without a manifest the plan comes from the graph, and only if
3455
+ both are unavailable does it fall back to a heuristic top-level-dir scan (which it
3456
+ marks `degraded: true`).
3457
+
3406
3458
  Page bodies are LLM-narrated for readability **but** the graph-derived
3407
3459
  frontmatter and the `Blast radius`/`Used by` sections are deterministic. To keep
3408
3460
  incremental carry-forward byte-identical (open decision 2), cache the narrated
@@ -3456,17 +3508,22 @@ section `index.md` tables are the injection slots for the routing tables.
3456
3508
  `draft init refresh` under `okf` mode:
3457
3509
 
3458
3510
  ```
3459
- 1. Diff hashes.json vs working tree → changed source paths
3460
- 2. path-to-concept.json → affected concept pages
3461
- 3. Regenerate ONLY affected concepts; carry the rest verbatim (cached narration)
3462
- 4. Re-render ai-context.md / architecture.md / log.md (cheap; always regenerated)
3463
- 5. Re-validate: okf-validate.sh on the bundle + path-index (cross-links touching
3464
- changed concepts must still resolve)
3465
- 6. Append log.md; update hashes.json + path-to-concept.json
3511
+ 1. Re-derive the plan: okf-plan-concepts.sh (modules added since last run become
3512
+ REQUIRED a new package can't slip through a refresh either)
3513
+ 2. Diff hashes.json vs working tree → changed source paths
3514
+ 3. path-to-concept.json → affected concept pages
3515
+ 4. Regenerate ONLY affected concepts; carry the rest verbatim (cached narration)
3516
+ 5. Re-render ai-context.md / architecture.md / log.md (cheap; always regenerated)
3517
+ 6. Re-validate (full gate): okf-validate-all.sh on the bundle with --plan and
3518
+ --path-index. Refresh re-runs structure + quality + coverage — a changed
3519
+ concept must still clear the quality bar, and a newly-required module must
3520
+ still be present.
3521
+ 7. Append log.md; update hashes.json + path-to-concept.json
3466
3522
  ```
3467
3523
 
3468
3524
  A 1-file change regenerates only the concept(s) that file grounds. Unchanged
3469
- concepts are byte-identical across runs.
3525
+ concepts are byte-identical across runs. The full gate still runs, so refresh
3526
+ cannot promote a bundle that a newly-added module left incomplete.
3470
3527
 
3471
3528
  ## Backward compatibility (§9)
3472
3529
 
@@ -22687,6 +22744,15 @@ so a focused task knows exactly which source files to open.
22687
22744
 
22688
22745
  - [Related concept](../systems/other.md)
22689
22746
 
22747
+ <!-- okf:concept-template v1
22748
+ A stub or redirect-only page (e.g. "see architecture.md", an unreplaced
22749
+ {PLACEHOLDER} token, or a body below the per-type minimum) FAILS
22750
+ okf-validate-quality.sh and therefore does NOT satisfy okf-coverage-check.sh —
22751
+ the bundle will not be promoted. Diagram types (Subsystem/Module/Feature/
22752
+ Entrypoint) require ≥1 valid Mermaid block and ≥2 x-grounded-paths.
22753
+ -->
22754
+
22755
+
22690
22756
  </core-file>
22691
22757
 
22692
22758
  ---
@@ -336,6 +336,16 @@ DRAFT_INIT_MODE="${DRAFT_INIT_MODE:-auto}"
336
336
 
337
337
  The tier-gated default rests on **maintainability/readability** (one navigable concept per file, cleaner PRs, a generated `architecture.md` preserved for linear onboarding) — not on the A/B benchmark, which was accuracy-parity (`docs/audit/okf-benchmark.md`). `monolith` is **retained, not retired**: it is the tier-1/2 default, the A/B baseline, and the fallback. If `DRAFT_INIT_MODE` is unset, do not commit to a mode until **Step 1.4.5** has computed the tier.
338
338
 
339
+ **OKF Completeness Verification (blocking — tier 3+ `okf` mode).** Completeness is enforced by tooling, not honor system, so the wiki is generated completely for every module/sub-module/component on every run. Before promoting `draft.tmp/` → `draft/`, ALL must hold (see `references/okf-emitter.md` for the pipeline):
340
+
341
+ 1. `okf-plan-concepts.sh` ran and the expected/required/deferred counts were logged **before** any page was written (the concept boundary is a tool output, not an in-context guess).
342
+ 2. Every `required` entry in `concept-plan.json` has a non-stub page.
343
+ 3. `okf-validate-all.sh … --plan … --strict` exits 0 (structure + per-type quality + coverage all pass).
344
+ 4. `systems/coverage.md` was generated by tooling (verify the `<!-- okf:coverage-generated -->` marker) — no required package with `fan_in ≥ floor` is **MISSING**.
345
+ 5. On any failure: **do not** atomic-rename; surface `.state/validation-report.json`.
346
+
347
+ > **Red flag:** writing concept pages without first running `okf-plan-concepts.sh`, or finishing generation while any `required` plan entry is unwritten, is a **completeness failure** — not a stylistic one.
348
+
339
349
  ### Route Explicit Modes Before Initialization
340
350
 
341
351
  If the user explicitly invoked a specialist mode, route directly:
@@ -3291,7 +3301,10 @@ esac
3291
3301
  Everything else in `draft init` (5-phase analysis, graph snapshot, `.state/`
3292
3302
  hashing, scope detection, atomic staging) is **reused unchanged**. This mode adds
3293
3303
  a decomposition + serialization stage. It introduces **no new LLM analysis
3294
- engine** and exactly **one** new deterministic helper, `okf-validate.sh`.
3304
+ engine**; its deterministic helpers are `okf-plan-concepts.sh` (expected-concept
3305
+ set), `okf-validate.sh` (structure), `okf-validate-quality.sh` (per-type
3306
+ anti-stub), `okf-coverage-check.sh` (completeness), and `okf-validate-all.sh`
3307
+ (the single promotion gate that runs all three), plus `okf-render-views.sh`.
3295
3308
 
3296
3309
  ## Target layout
3297
3310
 
@@ -3384,25 +3397,64 @@ Derive concepts from the graph, not by hand:
3384
3397
 
3385
3398
  ```
3386
3399
  1. Survey → existing draft init 5-phase + graph snapshot (graph-snapshot.sh)
3387
- 2. Plan → derive the concept list (above) from graph clusters +
3388
- entrypoints + features. Topo-sort by dependency so pages that
3389
- others link to (overview, core subsystems) generate FIRST —
3390
- forward cross-links resolve.
3391
- 3. Generate → per concept, pull grounding from the graph and write the page:
3400
+ 2. Plan → DETERMINISTIC. okf-plan-concepts.sh derives the expected-concept
3401
+ set from the graph (every package with fan_in ≥ floor → required
3402
+ Subsystem/Module; entrypoints required; below-floor / allow-defer
3403
+ deferred with a reason) and writes draft.tmp/.state/concept-plan.json.
3404
+ okf-plan-concepts.sh --repo . [--scope PATH] \
3405
+ [--manifest FILE] [--min-fan-in 2] [--allow-defer GLOB]... \
3406
+ --out draft.tmp/.state/concept-plan.json
3407
+ This replaces the old in-context concept enumeration — the boundary
3408
+ of the work is now a tool output, not an LLM judgment, so modules
3409
+ cannot be silently dropped. LOG the counts (expected/required/
3410
+ deferred) BEFORE writing any page. `generated_order` is topo-ish
3411
+ (required + high-fan-in first) so forward cross-links resolve.
3412
+ 3. Generate → iterate concept-plan.generated_order; write ONE page per REQUIRED
3413
+ entry, grounding each from the graph:
3392
3414
  x-callers ← graph-callers.sh --symbol <c>
3393
3415
  x-grounded-paths ← graph-impact.sh --symbol <c> (blast radius)
3394
3416
  x-hotspot-score ← hotspot-rank.sh
3395
3417
  overview diagrams ← mermaid-from-graph.sh
3396
3418
  Record each source path → page in .state/path-to-concept.json.
3419
+ Loop post-condition: every required concept_id has an output file.
3420
+ ⚠ Writing pages via shell heredoc without reading x-grounded-paths
3421
+ sources, or finishing while any required entry is unwritten, is a
3422
+ completeness failure — not a stylistic one.
3397
3423
  4. Render views → ai-context.md (synopsis + Concept Map), architecture.md
3398
- (concatenated view), wiki/log.md (see M4).
3399
- 5. Validate → okf-validate.sh draft/wiki \
3400
- --path-index draft/.state/path-to-concept.json
3401
- FAIL the build (do not atomic-rename) on any dangle, missing
3402
- field, bad type, or path-index gap.
3403
- 6. Emit → mv draft.tmp/ draft/ ; update .state/.
3424
+ (concatenated view + coverage banner), wiki/log.md (see M4).
3425
+ 5. Validate → the promotion gate. Run all layers via the orchestrator:
3426
+ 5a. okf-validate-all.sh draft.tmp/wiki \
3427
+ --repo . \
3428
+ --plan draft.tmp/.state/concept-plan.json \
3429
+ --path-index draft.tmp/.state/path-to-concept.json \
3430
+ --strict --report draft.tmp/.state/validation-report.json
3431
+ It runs, in order: okf-validate.sh (structure + reverse index),
3432
+ okf-validate-quality.sh (per-type anti-stub / depth / mermaid lint),
3433
+ okf-coverage-check.sh (every required plan entry → real page).
3434
+ ANY layer failing ⇒ exit non-zero ⇒ DO NOT atomic-rename.
3435
+ coverage.md (systems/coverage.md) is regenerated by the coverage
3436
+ layer; it is tool-owned (marker <!-- okf:coverage-generated -->) —
3437
+ never hand-author it except deferral reasons in the manifest.
3438
+ 6. Emit → mv draft.tmp/ draft/ ONLY IF step 5 exit 0 ; update .state/.
3439
+ On failure keep draft.tmp/ and surface validation-report.json.
3440
+ ```
3441
+
3442
+ ### Validation report schema (`.state/validation-report.json`)
3443
+
3444
+ ```json
3445
+ { "valid": false, "bundle": "draft.tmp/wiki",
3446
+ "layers": { "structure": "pass", "quality": "pass", "coverage": "fail" } }
3404
3447
  ```
3405
3448
 
3449
+ ### Component manifest (optional — `--manifest FILE`)
3450
+
3451
+ When the graph engine is unavailable (or a repo wants an authoritative list), pass
3452
+ a plain-text manifest: one component name per line, `#` comments and blanks ignored.
3453
+ Every listed component becomes a REQUIRED concept; `--allow-defer GLOB` still moves
3454
+ matches to deferred. Without a manifest the plan comes from the graph, and only if
3455
+ both are unavailable does it fall back to a heuristic top-level-dir scan (which it
3456
+ marks `degraded: true`).
3457
+
3406
3458
  Page bodies are LLM-narrated for readability **but** the graph-derived
3407
3459
  frontmatter and the `Blast radius`/`Used by` sections are deterministic. To keep
3408
3460
  incremental carry-forward byte-identical (open decision 2), cache the narrated
@@ -3456,17 +3508,22 @@ section `index.md` tables are the injection slots for the routing tables.
3456
3508
  `draft init refresh` under `okf` mode:
3457
3509
 
3458
3510
  ```
3459
- 1. Diff hashes.json vs working tree → changed source paths
3460
- 2. path-to-concept.json → affected concept pages
3461
- 3. Regenerate ONLY affected concepts; carry the rest verbatim (cached narration)
3462
- 4. Re-render ai-context.md / architecture.md / log.md (cheap; always regenerated)
3463
- 5. Re-validate: okf-validate.sh on the bundle + path-index (cross-links touching
3464
- changed concepts must still resolve)
3465
- 6. Append log.md; update hashes.json + path-to-concept.json
3511
+ 1. Re-derive the plan: okf-plan-concepts.sh (modules added since last run become
3512
+ REQUIRED a new package can't slip through a refresh either)
3513
+ 2. Diff hashes.json vs working tree → changed source paths
3514
+ 3. path-to-concept.json → affected concept pages
3515
+ 4. Regenerate ONLY affected concepts; carry the rest verbatim (cached narration)
3516
+ 5. Re-render ai-context.md / architecture.md / log.md (cheap; always regenerated)
3517
+ 6. Re-validate (full gate): okf-validate-all.sh on the bundle with --plan and
3518
+ --path-index. Refresh re-runs structure + quality + coverage — a changed
3519
+ concept must still clear the quality bar, and a newly-required module must
3520
+ still be present.
3521
+ 7. Append log.md; update hashes.json + path-to-concept.json
3466
3522
  ```
3467
3523
 
3468
3524
  A 1-file change regenerates only the concept(s) that file grounds. Unchanged
3469
- concepts are byte-identical across runs.
3525
+ concepts are byte-identical across runs. The full gate still runs, so refresh
3526
+ cannot promote a bundle that a newly-added module left incomplete.
3470
3527
 
3471
3528
  ## Backward compatibility (§9)
3472
3529
 
@@ -22687,6 +22744,15 @@ so a focused task knows exactly which source files to open.
22687
22744
 
22688
22745
  - [Related concept](../systems/other.md)
22689
22746
 
22747
+ <!-- okf:concept-template v1
22748
+ A stub or redirect-only page (e.g. "see architecture.md", an unreplaced
22749
+ {PLACEHOLDER} token, or a body below the per-type minimum) FAILS
22750
+ okf-validate-quality.sh and therefore does NOT satisfy okf-coverage-check.sh —
22751
+ the bundle will not be promoted. Diagram types (Subsystem/Module/Feature/
22752
+ Entrypoint) require ≥1 valid Mermaid block and ≥2 x-grounded-paths.
22753
+ -->
22754
+
22755
+
22690
22756
  </core-file>
22691
22757
 
22692
22758
  ---
@@ -0,0 +1,91 @@
1
+ # Draft - Context-Driven Development
2
+
3
+ You are operating with the Draft methodology for Context-Driven Development.
4
+
5
+ **Measure twice, code once.**
6
+
7
+ ## Core Workflow
8
+
9
+ **Context -> Spec & Plan -> Implement**
10
+
11
+ Every feature follows this lifecycle:
12
+ 1. **Setup** - Initialize project context (once per project)
13
+ 2. **New Track** - Create specification and plan
14
+ 3. **Implement** - Execute tasks with TDD workflow
15
+ 4. **Verify** - Confirm acceptance criteria met
16
+
17
+ ## Project Context Files
18
+
19
+ When `draft/` exists in the project, always consider:
20
+ - `draft/.ai-context.md` - Source of truth for AI agents (dense codebase understanding)
21
+ - `draft/architecture.md` - Human-readable engineering guide (derived from .ai-context.md)
22
+ - `draft/product.md` - Product vision and goals
23
+ - `draft/tech-stack.md` - Technical constraints
24
+ - `draft/workflow.md` - TDD and commit preferences
25
+ - `draft/tracks.md` - Active work items
26
+
27
+ ## Available Commands
28
+
29
+ | Command | Purpose |
30
+ |---------|---------|
31
+ | `draft` | Show overview and available commands |
32
+ | `draft init` | Initialize project (run once) |
33
+ | `draft index [--init-missing]` | Aggregate monorepo service contexts |
34
+ | `draft new-track <description>` | Create feature/bug track |
35
+ | `draft decompose` | Module decomposition with dependency mapping |
36
+ | `draft implement` | Execute tasks from plan |
37
+ | `draft coverage` | Code coverage report (target 95%+) |
38
+ | `draft bughunt [--track <id>]` | Systematic bug discovery |
39
+ | `draft review [--track <id>]` | Three-stage code review |
40
+ | `draft deep-review [module]` | Exhaustive production-grade module audit |
41
+ | `draft learn [promote\|migrate]` | Discover coding patterns, update guardrails |
42
+ | `draft adr [title]` | Architecture Decision Records |
43
+ | `draft status` | Show progress overview |
44
+ | `draft revert` | Git-aware rollback |
45
+ | `draft change <description>` | Handle mid-track requirement changes |
46
+ | `draft jira-preview [track-id]` | Generate jira-export.md for review |
47
+ | `draft jira-create [track-id]` | Create Jira issues from export via MCP |
48
+
49
+ ## Intent Mapping
50
+
51
+ Recognize these natural language patterns:
52
+
53
+ | User Says | Action |
54
+ |-----------|--------|
55
+ | "set up the project" | Run init |
56
+ | "index services", "aggregate context" | Run index |
57
+ | "new feature", "add X" | Create new track |
58
+ | "break into modules", "decompose" | Run decompose |
59
+ | "start implementing" | Execute implement |
60
+ | "check coverage", "test coverage" | Run coverage |
61
+ | "hunt bugs", "find bugs" | Run bug hunt |
62
+ | "review code", "review track", "check quality" | Run review |
63
+ | "deep review", "production audit", "module audit" | Run deep-review |
64
+ | "learn patterns", "update guardrails", "discover conventions" | Run learn |
65
+ | "what's the status" | Show status |
66
+ | "undo", "revert" | Run revert |
67
+ | "requirements changed", "scope changed", "update the spec" | Run change |
68
+ | "preview jira", "export to jira" | Run jira-preview |
69
+ | "create jira", "push to jira" | Run jira-create |
70
+ | "document decision", "create ADR" | Create architecture decision record |
71
+ | "help", "what commands" | Show draft overview |
72
+ | "the plan" | Read active track's plan.md |
73
+ | "the spec" | Read active track's spec.md |
74
+
75
+ ## Tracks
76
+
77
+ A **track** is a high-level unit of work (feature, bug fix, refactor). Each track contains:
78
+ - `spec.md` - Requirements and acceptance criteria
79
+ - `plan.md` - Phased task breakdown
80
+ - `metadata.json` - Status and timestamps
81
+
82
+ Located at: `draft/tracks/<track-id>/`
83
+
84
+ ## Status Markers
85
+
86
+ Recognize and use these throughout plan.md:
87
+ - `[ ]` - Pending
88
+ - `[~]` - In Progress
89
+ - `[x]` - Completed
90
+ - `[!]` - Blocked
91
+
@@ -0,0 +1,91 @@
1
+ # Draft - Context-Driven Development
2
+
3
+ You are operating with the Draft methodology for Context-Driven Development.
4
+
5
+ **Measure twice, code once.**
6
+
7
+ ## Core Workflow
8
+
9
+ **Context -> Spec & Plan -> Implement**
10
+
11
+ Every feature follows this lifecycle:
12
+ 1. **Setup** - Initialize project context (once per project)
13
+ 2. **New Track** - Create specification and plan
14
+ 3. **Implement** - Execute tasks with TDD workflow
15
+ 4. **Verify** - Confirm acceptance criteria met
16
+
17
+ ## Project Context Files
18
+
19
+ When `draft/` exists in the project, always consider:
20
+ - `draft/.ai-context.md` - Source of truth for AI agents (dense codebase understanding)
21
+ - `draft/architecture.md` - Human-readable engineering guide (derived from .ai-context.md)
22
+ - `draft/product.md` - Product vision and goals
23
+ - `draft/tech-stack.md` - Technical constraints
24
+ - `draft/workflow.md` - TDD and commit preferences
25
+ - `draft/tracks.md` - Active work items
26
+
27
+ ## Available Commands
28
+
29
+ | Command | Purpose |
30
+ |---------|---------|
31
+ | `draft` | Show overview and available commands |
32
+ | `draft init` | Initialize project (run once) |
33
+ | `draft index [--init-missing]` | Aggregate monorepo service contexts |
34
+ | `draft new-track <description>` | Create feature/bug track |
35
+ | `draft decompose` | Module decomposition with dependency mapping |
36
+ | `draft implement` | Execute tasks from plan |
37
+ | `draft coverage` | Code coverage report (target 95%+) |
38
+ | `draft bughunt [--track <id>]` | Systematic bug discovery |
39
+ | `draft review [--track <id>]` | Three-stage code review |
40
+ | `draft deep-review [module]` | Exhaustive production-grade module audit |
41
+ | `draft learn [promote\|migrate]` | Discover coding patterns, update guardrails |
42
+ | `draft adr [title]` | Architecture Decision Records |
43
+ | `draft status` | Show progress overview |
44
+ | `draft revert` | Git-aware rollback |
45
+ | `draft change <description>` | Handle mid-track requirement changes |
46
+ | `draft jira-preview [track-id]` | Generate jira-export.md for review |
47
+ | `draft jira-create [track-id]` | Create Jira issues from export via MCP |
48
+
49
+ ## Intent Mapping
50
+
51
+ Recognize these natural language patterns:
52
+
53
+ | User Says | Action |
54
+ |-----------|--------|
55
+ | "set up the project" | Run init |
56
+ | "index services", "aggregate context" | Run index |
57
+ | "new feature", "add X" | Create new track |
58
+ | "break into modules", "decompose" | Run decompose |
59
+ | "start implementing" | Execute implement |
60
+ | "check coverage", "test coverage" | Run coverage |
61
+ | "hunt bugs", "find bugs" | Run bug hunt |
62
+ | "review code", "review track", "check quality" | Run review |
63
+ | "deep review", "production audit", "module audit" | Run deep-review |
64
+ | "learn patterns", "update guardrails", "discover conventions" | Run learn |
65
+ | "what's the status" | Show status |
66
+ | "undo", "revert" | Run revert |
67
+ | "requirements changed", "scope changed", "update the spec" | Run change |
68
+ | "preview jira", "export to jira" | Run jira-preview |
69
+ | "create jira", "push to jira" | Run jira-create |
70
+ | "document decision", "create ADR" | Create architecture decision record |
71
+ | "help", "what commands" | Show draft overview |
72
+ | "the plan" | Read active track's plan.md |
73
+ | "the spec" | Read active track's spec.md |
74
+
75
+ ## Tracks
76
+
77
+ A **track** is a high-level unit of work (feature, bug fix, refactor). Each track contains:
78
+ - `spec.md` - Requirements and acceptance criteria
79
+ - `plan.md` - Phased task breakdown
80
+ - `metadata.json` - Status and timestamps
81
+
82
+ Located at: `draft/tracks/<track-id>/`
83
+
84
+ ## Status Markers
85
+
86
+ Recognize and use these throughout plan.md:
87
+ - `[ ]` - Pending
88
+ - `[~]` - In Progress
89
+ - `[x]` - Completed
90
+ - `[!]` - Blocked
91
+