@drafthq/draft 3.5.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.5.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.5.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.5.0",
5
+ "version": "3.5.1",
6
6
  "skills": "./skills/",
7
7
  "agents": "./core/agents/",
8
8
  "author": {
@@ -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
+
@@ -0,0 +1,122 @@
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/.ai-profile.md` - Ultra-compact profile (always loaded, 20-50 lines)
22
+ - `draft/architecture.md` - Human-readable engineering guide (source of truth)
23
+ - `draft/product.md` - Product vision and goals
24
+ - `draft/tech-stack.md` - Technical constraints
25
+ - `draft/workflow.md` - TDD and commit preferences
26
+ - `draft/tracks.md` - Active work items
27
+ - `draft/guardrails.md` - Hard rules and learned patterns
28
+
29
+ ## Available Commands
30
+
31
+ | Command | Purpose |
32
+ |---------|---------|
33
+ | `draft` | Show overview and available commands |
34
+ | `draft init` | Initialize project (run once) |
35
+ | `draft index [--init-missing]` | Aggregate monorepo service contexts |
36
+ | `draft new-track <description>` | Create feature/bug track |
37
+ | `draft decompose` | Module decomposition with dependency mapping |
38
+ | `draft implement` | Execute tasks from plan |
39
+ | `draft coverage` | Code coverage report (target 95%+) |
40
+ | `draft deploy-checklist [track <id>]` | Pre-deployment verification checklist |
41
+ | `draft bughunt [--track <id>]` | Systematic bug discovery |
42
+ | `draft review [--track <id>]` | Three-stage code review |
43
+ | `draft quick-review [file|pr <number>]` | Lightweight 4-dimension review |
44
+ | `draft deep-review [module]` | Exhaustive production-grade module audit |
45
+ | `draft testing-strategy [track <id>|path]` | Design test strategy with coverage targets |
46
+ | `draft learn [promote\|migrate]` | Discover coding patterns, update guardrails |
47
+ | `draft adr [title]` | Architecture Decision Records |
48
+ | `draft debug [description|track <id>]` | Structured debugging session |
49
+ | `draft standup [date|week|save]` | Generate standup summary |
50
+ | `draft tech-debt [path|track <id>]` | Identify and prioritize tech debt |
51
+ | `draft incident-response [new|update|postmortem]` | Incident management lifecycle |
52
+ | `draft documentation [readme|runbook|api|onboarding]` | Technical documentation |
53
+ | `draft status` | Show progress overview |
54
+ | `draft revert` | Git-aware rollback |
55
+ | `draft change <description>` | Handle mid-track requirement changes |
56
+ | `draft jira-preview [track-id]` | Generate jira-export.md for review |
57
+ | `draft jira-create [track-id]` | Create Jira issues from export via MCP |
58
+ | `draft tour` | Interactive onboarding tour |
59
+ | `draft impact` | Telemetry and analytics insights |
60
+ | `draft assist-review` | Assist human reviewers with architectural risk audit |
61
+
62
+ ## Intent Mapping
63
+
64
+ Recognize these natural language patterns:
65
+
66
+ | User Says | Action |
67
+ |-----------|--------|
68
+ | "set up the project" | Run init |
69
+ | "index services", "aggregate context" | Run index |
70
+ | "new feature", "add X" | Create new track |
71
+ | "break into modules", "decompose" | Run decompose |
72
+ | "start implementing" | Execute implement |
73
+ | "check coverage", "test coverage" | Run coverage |
74
+ | "deploy checklist", "pre-deploy check" | Run deploy-checklist |
75
+ | "hunt bugs", "find bugs" | Run bughunt |
76
+ | "review code", "review track", "check quality" | Run review |
77
+ | "quick review", "lightweight review" | Run quick-review |
78
+ | "deep review", "production audit", "module audit" | Run deep-review |
79
+ | "test strategy", "plan tests" | Run testing-strategy |
80
+ | "learn patterns", "update guardrails", "discover conventions" | Run learn |
81
+ | "document decision", "create ADR" | Create architecture decision record |
82
+ | "debug bug", "investigate issue" | Run debug |
83
+ | "standup", "daily summary" | Run standup |
84
+ | "tech debt", "identify debt" | Run tech-debt |
85
+ | "incident", "outage", "postmortem" | Run incident-response |
86
+ | "write docs", "document" | Run documentation |
87
+ | "what's the status" | Show status |
88
+ | "undo", "revert" | Run revert |
89
+ | "requirements changed", "scope changed", "update the spec" | Run change |
90
+ | "preview jira", "export to jira" | Run jira-preview |
91
+ | "create jira", "push to jira" | Run jira-create |
92
+ | "tour", "onboard me" | Run tour |
93
+ | "impact", "analytics" | Run impact |
94
+ | "assist review", "help reviewer" | Run assist-review |
95
+ | "help", "what commands" | Show draft overview |
96
+ | "the plan" | Read active track's plan.md |
97
+ | "the spec" | Read active track's spec.md |
98
+
99
+ ## Tracks
100
+
101
+ A **track** is a high-level unit of work (feature, bug fix, refactor). Each track contains:
102
+ - `spec.md` - Requirements and acceptance criteria
103
+ - `plan.md` - Phased task breakdown
104
+ - `metadata.json` - Status and timestamps
105
+
106
+ Located at: `draft/tracks/<track-id>/`
107
+
108
+ ## Status Markers
109
+
110
+ Recognize and use these throughout plan.md:
111
+ - `[ ]` - Pending
112
+ - `[~]` - In Progress
113
+ - `[x]` - Completed
114
+ - `[!]` - Blocked
115
+
116
+
117
+ ---
118
+
119
+ ## Init Command
120
+
121
+ When user says "init draft" or "draft init [refresh]":
122
+
@@ -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
+
@@ -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
+
@@ -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
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drafthq/draft",
3
- "version": "3.5.0",
3
+ "version": "3.5.1",
4
4
  "description": "Context-Driven Development for AI coding agents — install Draft into Claude Code, Cursor, Codex, or opencode.",
5
5
  "bin": {
6
6
  "draft": "cli/bin/draft.js"
@@ -203,6 +203,73 @@ memory_project_for_repo() {
203
203
  | head -1
204
204
  }
205
205
 
206
+ # Total physical RAM in MB (portable). Echoes a positive integer, or nothing.
207
+ _total_ram_mb() {
208
+ if [[ -r /proc/meminfo ]]; then
209
+ awk '/^MemTotal:/{printf "%d", $2/1024; exit}' /proc/meminfo
210
+ elif command -v sysctl >/dev/null 2>&1; then # macOS / BSD
211
+ local bytes; bytes="$(sysctl -n hw.memsize 2>/dev/null || true)"
212
+ [[ -n "$bytes" ]] && printf '%d' "$(( bytes / 1024 / 1024 ))"
213
+ fi
214
+ }
215
+
216
+ # Cgroup memory args for a transient scope. MemoryHigh throttles (reclaim/swap →
217
+ # slower, never thrashes the host); MemoryMax is the hard ceiling a few % above.
218
+ # Pure (no I/O) so it is unit-testable. Usage: _mem_bound_args <total_mb> <pct>
219
+ _mem_bound_args() {
220
+ local total="$1" pct="$2"
221
+ printf 'MemoryHigh=%dM MemoryMax=%dM' \
222
+ "$(( total * pct / 100 ))" "$(( total * (pct + 5) / 100 ))"
223
+ }
224
+
225
+ # Whether this host can confine a process to a memory-bounded cgroup v2 scope.
226
+ # Probes once (starts a throwaway scope) and caches the verdict for the process.
227
+ _DRAFT_CGROUP_OK=""
228
+ _can_cgroup_bound() {
229
+ if [[ -z "$_DRAFT_CGROUP_OK" ]]; then
230
+ if command -v systemd-run >/dev/null 2>&1 \
231
+ && [[ -e /sys/fs/cgroup/cgroup.controllers ]] \
232
+ && systemd-run --user --scope -q -p MemoryMax=64M -- true >/dev/null 2>&1; then
233
+ _DRAFT_CGROUP_OK=yes
234
+ else
235
+ _DRAFT_CGROUP_OK=no
236
+ fi
237
+ fi
238
+ [[ "$_DRAFT_CGROUP_OK" == yes ]]
239
+ }
240
+
241
+ # Index a repository under a memory bound. The codebase-memory-mcp engine
242
+ # self-budgets ~50% of *physical* RAM and is not cgroup-aware, so a first index
243
+ # of a huge repo can exhaust the host (the original 30 GB hang). On Linux we
244
+ # confine it to a transient cgroup scope sized to DRAFT_INDEX_MEM_PCT (default
245
+ # 25) of total RAM; CBM_WORKERS caps the engine's parallel working set so the
246
+ # throttle has less transient pressure to absorb. Where cgroup v2 + systemd-run
247
+ # are unavailable (e.g. macOS) the worker cap is the only bound. Never falls back
248
+ # from a started scope to an unbounded run — a bounded OOM fails the index
249
+ # cleanly (host stays alive) rather than re-triggering the hang.
250
+ # Echoes the engine's JSON result on stdout (same contract as memory_cli).
251
+ memory_index_bounded() {
252
+ local repo_abs="$1"
253
+ local json="{\"repo_path\":\"$repo_abs\"}"
254
+ export CBM_WORKERS="${CBM_WORKERS:-4}"
255
+ local total pct
256
+ total="$(_total_ram_mb)"
257
+ pct="${DRAFT_INDEX_MEM_PCT:-25}"
258
+ if [[ "${total:-0}" -gt 0 ]] && _can_cgroup_bound; then
259
+ local high_arg max_arg
260
+ read -r high_arg max_arg <<< "$(_mem_bound_args "$total" "$pct")"
261
+ if [[ -n "${DRAFT_MEMORY_DEBUG:-}" ]]; then
262
+ systemd-run --user --scope -q -p "$high_arg" -p "$max_arg" \
263
+ -- "$MEMORY_BIN" cli index_repository "$json"
264
+ else
265
+ systemd-run --user --scope -q -p "$high_arg" -p "$max_arg" \
266
+ -- "$MEMORY_BIN" cli index_repository "$json" 2>/dev/null
267
+ fi
268
+ else
269
+ memory_cli index_repository "$json"
270
+ fi
271
+ }
272
+
206
273
  # Ensure a repository is indexed in the engine; echo its project name.
207
274
  # Indexes on demand when absent. Returns 1 if the engine is unavailable.
208
275
  memory_ensure_index() {
@@ -212,7 +279,7 @@ memory_ensure_index() {
212
279
  local proj
213
280
  proj="$(memory_project_for_repo "$repo_abs" 2>/dev/null || true)"
214
281
  if [[ -z "$proj" ]]; then
215
- proj="$(memory_cli index_repository "{\"repo_path\":\"$repo_abs\"}" 2>/dev/null \
282
+ proj="$(memory_index_bounded "$repo_abs" \
216
283
  | jq -r '.project // empty' 2>/dev/null || true)"
217
284
  fi
218
285
  [[ -n "$proj" ]] || return 1