@drafthq/draft 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/.claude-plugin/marketplace.json +38 -0
  2. package/.claude-plugin/plugin.json +26 -0
  3. package/LICENSE +21 -0
  4. package/README.md +272 -0
  5. package/bin/README.md +49 -0
  6. package/cli/bin/draft.js +13 -0
  7. package/cli/src/cli.js +113 -0
  8. package/cli/src/hosts/claude-code.js +46 -0
  9. package/cli/src/hosts/codex.js +33 -0
  10. package/cli/src/hosts/cursor.js +50 -0
  11. package/cli/src/hosts/index.js +24 -0
  12. package/cli/src/hosts/opencode.js +39 -0
  13. package/cli/src/installer.js +61 -0
  14. package/cli/src/lib/fsx.js +34 -0
  15. package/cli/src/lib/graph.js +23 -0
  16. package/cli/src/lib/log.js +32 -0
  17. package/cli/src/lib/paths.js +14 -0
  18. package/core/agents/architect.md +338 -0
  19. package/core/agents/debugger.md +193 -0
  20. package/core/agents/ops.md +104 -0
  21. package/core/agents/planner.md +158 -0
  22. package/core/agents/rca.md +314 -0
  23. package/core/agents/reviewer.md +256 -0
  24. package/core/agents/writer.md +110 -0
  25. package/core/guardrails/README.md +4 -0
  26. package/core/guardrails/code-quality.md +4 -0
  27. package/core/guardrails/dependency-triage.md +4 -0
  28. package/core/guardrails/design-norms.md +4 -0
  29. package/core/guardrails/language-standards.md +4 -0
  30. package/core/guardrails/review-checks.md +4 -0
  31. package/core/guardrails/secure-patterns.md +4 -0
  32. package/core/guardrails/security.md +4 -0
  33. package/core/guardrails.md +22 -0
  34. package/core/knowledge-base.md +127 -0
  35. package/core/methodology.md +1221 -0
  36. package/core/shared/condensation.md +224 -0
  37. package/core/shared/context-verify.md +44 -0
  38. package/core/shared/cross-skill-dispatch.md +127 -0
  39. package/core/shared/discovery-schema.md +75 -0
  40. package/core/shared/draft-context-loading.md +282 -0
  41. package/core/shared/git-report-metadata.md +106 -0
  42. package/core/shared/graph-query.md +239 -0
  43. package/core/shared/graph-usage-report.md +22 -0
  44. package/core/shared/jira-sync.md +170 -0
  45. package/core/shared/parallel-analysis.md +386 -0
  46. package/core/shared/parallel-fanout.md +10 -0
  47. package/core/shared/pattern-learning.md +146 -0
  48. package/core/shared/red-flags.md +58 -0
  49. package/core/shared/template-contract.md +22 -0
  50. package/core/shared/template-hygiene.md +10 -0
  51. package/core/shared/tool-resolver.md +10 -0
  52. package/core/shared/vcs-commands.md +97 -0
  53. package/core/shared/verification-gates.md +47 -0
  54. package/core/templates/CHANGELOG.md +70 -0
  55. package/core/templates/ai-context-export.md +8 -0
  56. package/core/templates/ai-context.md +270 -0
  57. package/core/templates/ai-profile.md +41 -0
  58. package/core/templates/architecture.md +203 -0
  59. package/core/templates/dependency-graph.md +103 -0
  60. package/core/templates/discovery.md +79 -0
  61. package/core/templates/guardrails.md +143 -0
  62. package/core/templates/hld.md +327 -0
  63. package/core/templates/intake-questions.md +403 -0
  64. package/core/templates/jira.md +119 -0
  65. package/core/templates/lld.md +283 -0
  66. package/core/templates/metadata.json +66 -0
  67. package/core/templates/plan.md +130 -0
  68. package/core/templates/product.md +110 -0
  69. package/core/templates/rca.md +86 -0
  70. package/core/templates/root-architecture.md +127 -0
  71. package/core/templates/root-product.md +53 -0
  72. package/core/templates/root-tech-stack.md +117 -0
  73. package/core/templates/service-index.md +55 -0
  74. package/core/templates/session-summary.md +8 -0
  75. package/core/templates/spec.md +165 -0
  76. package/core/templates/tech-matrix.md +101 -0
  77. package/core/templates/tech-stack.md +169 -0
  78. package/core/templates/track-architecture.md +311 -0
  79. package/core/templates/workflow.md +187 -0
  80. package/integrations/agents/AGENTS.md +24384 -0
  81. package/integrations/copilot/.github/copilot-instructions.md +24384 -0
  82. package/integrations/gemini/.gemini.md +26 -0
  83. package/package.json +53 -0
  84. package/scripts/fetch-memory-engine.sh +116 -0
  85. package/scripts/lib.sh +256 -0
  86. package/scripts/tools/_lib.sh +220 -0
  87. package/scripts/tools/adr-index.sh +117 -0
  88. package/scripts/tools/check-graph-usage-report.sh +95 -0
  89. package/scripts/tools/check-scope-conflicts.sh +139 -0
  90. package/scripts/tools/check-skill-line-caps.sh +115 -0
  91. package/scripts/tools/check-template-noop.sh +87 -0
  92. package/scripts/tools/check-track-hygiene.sh +230 -0
  93. package/scripts/tools/classify-files.sh +231 -0
  94. package/scripts/tools/cycle-detect.sh +75 -0
  95. package/scripts/tools/detect-test-framework.sh +135 -0
  96. package/scripts/tools/diff-templates-vs-tracks.sh +176 -0
  97. package/scripts/tools/emit-skill-metrics.sh +71 -0
  98. package/scripts/tools/fix-whitespace.sh +192 -0
  99. package/scripts/tools/freshness-check.sh +143 -0
  100. package/scripts/tools/git-metadata.sh +203 -0
  101. package/scripts/tools/graph-callers.sh +74 -0
  102. package/scripts/tools/graph-impact.sh +93 -0
  103. package/scripts/tools/graph-snapshot.sh +102 -0
  104. package/scripts/tools/hotspot-rank.sh +75 -0
  105. package/scripts/tools/manage-symlinks.sh +85 -0
  106. package/scripts/tools/mermaid-from-graph.sh +92 -0
  107. package/scripts/tools/migrate-track-frontmatter.sh +241 -0
  108. package/scripts/tools/parse-git-log.sh +135 -0
  109. package/scripts/tools/parse-reports.sh +114 -0
  110. package/scripts/tools/render-track.sh +145 -0
  111. package/scripts/tools/run-coverage.sh +153 -0
  112. package/scripts/tools/scan-markers.sh +144 -0
  113. package/scripts/tools/skill-caps.conf +24 -0
  114. package/scripts/tools/validate-frontmatter.sh +125 -0
  115. package/scripts/tools/verify-citations.sh +250 -0
  116. package/scripts/tools/verify-doc-anchors.sh +204 -0
  117. package/scripts/tools/verify-graph-binary.sh +154 -0
  118. package/skills/GRAPH.md +332 -0
  119. package/skills/adr/SKILL.md +374 -0
  120. package/skills/assist-review/SKILL.md +49 -0
  121. package/skills/bughunt/SKILL.md +668 -0
  122. package/skills/bughunt/references/regression-tests.md +399 -0
  123. package/skills/change/SKILL.md +267 -0
  124. package/skills/coverage/SKILL.md +336 -0
  125. package/skills/debug/SKILL.md +201 -0
  126. package/skills/decompose/SKILL.md +656 -0
  127. package/skills/deep-review/SKILL.md +326 -0
  128. package/skills/deploy-checklist/SKILL.md +254 -0
  129. package/skills/discover/SKILL.md +66 -0
  130. package/skills/docs/SKILL.md +42 -0
  131. package/skills/documentation/SKILL.md +197 -0
  132. package/skills/draft/SKILL.md +177 -0
  133. package/skills/draft/context-files.md +57 -0
  134. package/skills/draft/intent-mapping.md +37 -0
  135. package/skills/draft/quality-guide.md +51 -0
  136. package/skills/graph/SKILL.md +107 -0
  137. package/skills/impact/SKILL.md +86 -0
  138. package/skills/implement/SKILL.md +794 -0
  139. package/skills/incident-response/SKILL.md +245 -0
  140. package/skills/index/SKILL.md +848 -0
  141. package/skills/init/SKILL.md +1784 -0
  142. package/skills/init/references/architecture-spec.md +1259 -0
  143. package/skills/integrations/SKILL.md +53 -0
  144. package/skills/jira/SKILL.md +577 -0
  145. package/skills/jira/references/review.md +1322 -0
  146. package/skills/learn/SKILL.md +478 -0
  147. package/skills/new-track/SKILL.md +841 -0
  148. package/skills/ops/SKILL.md +57 -0
  149. package/skills/plan/SKILL.md +60 -0
  150. package/skills/quick-review/SKILL.md +216 -0
  151. package/skills/revert/SKILL.md +178 -0
  152. package/skills/review/SKILL.md +1114 -0
  153. package/skills/standup/SKILL.md +183 -0
  154. package/skills/status/SKILL.md +183 -0
  155. package/skills/tech-debt/SKILL.md +318 -0
  156. package/skills/testing-strategy/SKILL.md +195 -0
  157. package/skills/tour/SKILL.md +38 -0
  158. package/skills/upload/SKILL.md +117 -0
@@ -0,0 +1,127 @@
1
+ ---
2
+ project: "{PROJECT_NAME}"
3
+ module: "root"
4
+ generated_by: "draft:index"
5
+ generated_at: "{ISO_TIMESTAMP}"
6
+ ---
7
+
8
+ # Architecture: [Org/Product Name]
9
+
10
+ | Field | Value |
11
+ |-------|-------|
12
+ | **Branch** | `{LOCAL_BRANCH}` → `{REMOTE/BRANCH}` |
13
+ | **Commit** | `{SHORT_SHA}` — {COMMIT_MESSAGE} |
14
+ | **Generated** | {ISO_TIMESTAMP} |
15
+ | **Synced To** | `{FULL_SHA}` |
16
+
17
+ > Synthesized from [X] service contexts.
18
+ > This is a **system-of-systems** view. For service internals, see individual service contexts.
19
+ > Re-running `/draft:index` will update auto-generated sections but preserve manual edits.
20
+
21
+ ---
22
+
23
+ ## System Overview
24
+
25
+ **Key Takeaway:** [One paragraph synthesizing overall system purpose from service summaries — what this platform does, who it serves, and its primary value proposition]
26
+
27
+ ### System Topology
28
+
29
+ ```mermaid
30
+ graph TD
31
+ subgraph "External"
32
+ Users[Users/Clients]
33
+ ThirdParty[Third-Party Services]
34
+ end
35
+
36
+ subgraph "Edge Layer"
37
+ Gateway[API Gateway]
38
+ end
39
+
40
+ subgraph "Core Services"
41
+ ServiceA[Service A]
42
+ ServiceB[Service B]
43
+ end
44
+
45
+ subgraph "Data Layer"
46
+ DB[(Database)]
47
+ Cache[(Cache)]
48
+ end
49
+
50
+ Users --> Gateway
51
+ Gateway --> ServiceA
52
+ Gateway --> ServiceB
53
+ ServiceA --> DB
54
+ ServiceB --> Cache
55
+ ```
56
+
57
+ > Diagram auto-generated from service dependencies. Edit to add context.
58
+
59
+ ## Service Directory
60
+
61
+ | Service | Responsibility | Tech | Status | Details |
62
+ |---------|---------------|------|--------|---------|
63
+ | [service-name] | [One-line responsibility] | [Primary tech] | ✓ Active | [→ architecture](../services/[name]/draft/.ai-context.md) |
64
+
65
+ > **Status:** ✓ Active = initialized and maintained, ○ Legacy = initialized but deprecated, ? = not initialized
66
+
67
+ ## Shared Infrastructure
68
+
69
+ <!-- Extracted from common external dependencies across services -->
70
+
71
+ | Component | Purpose | Used By |
72
+ |-----------|---------|---------|
73
+ | [PostgreSQL] | [Primary datastore] | [service-a, service-b] |
74
+ | [Redis] | [Caching, sessions] | [service-a, service-c] |
75
+ | [RabbitMQ] | [Async messaging] | [service-b, service-d] |
76
+
77
+ ## Cross-Service Patterns
78
+
79
+ <!-- Extracted from common conventions across service .ai-context.md (or architecture.md) files -->
80
+
81
+ | Pattern | Description | Services |
82
+ |---------|-------------|----------|
83
+ | [JWT Auth] | [All services validate JWT via auth-service] | [all] |
84
+ | [Event-Driven] | [Async events via message queue] | [notifications, reports] |
85
+
86
+ ## Data Flows
87
+
88
+ ### [Primary Flow Name]
89
+
90
+ ```mermaid
91
+ sequenceDiagram
92
+ participant Client
93
+ participant Gateway
94
+ participant ServiceA
95
+ participant ServiceB
96
+ participant DB
97
+
98
+ Client->>Gateway: Request
99
+ Gateway->>ServiceA: Route
100
+ ServiceA->>ServiceB: Internal call
101
+ ServiceB->>DB: Query
102
+ DB-->>ServiceB: Result
103
+ ServiceB-->>ServiceA: Response
104
+ ServiceA-->>Gateway: Response
105
+ Gateway-->>Client: Response
106
+ ```
107
+
108
+ > Add primary cross-service data flows here.
109
+
110
+ <!-- MANUAL START -->
111
+ ## Architectural Decisions
112
+
113
+ [Document key architectural decisions, trade-offs, and rationale here — preserved on re-index]
114
+
115
+ ### ADR-001: [Decision Title]
116
+
117
+ **Context:** [Why this decision was needed]
118
+ **Decision:** [What was decided]
119
+ **Consequences:** [Impact of the decision]
120
+
121
+ <!-- MANUAL END -->
122
+
123
+ ## Notes
124
+
125
+ - For detailed service architecture, navigate to individual service contexts via the Details column
126
+ - This file is regenerable via `/draft:index`
127
+ - Manual edits between `<!-- MANUAL START -->` and `<!-- MANUAL END -->` are preserved
@@ -0,0 +1,53 @@
1
+ ---
2
+ project: "{PROJECT_NAME}"
3
+ module: "root"
4
+ generated_by: "draft:index"
5
+ generated_at: "{ISO_TIMESTAMP}"
6
+ ---
7
+
8
+ # Product: [Org/Product Name]
9
+
10
+ | Field | Value |
11
+ |-------|-------|
12
+ | **Branch** | `{LOCAL_BRANCH}` → `{REMOTE/BRANCH}` |
13
+ | **Commit** | `{SHORT_SHA}` — {COMMIT_MESSAGE} |
14
+ | **Generated** | {ISO_TIMESTAMP} |
15
+ | **Synced To** | `{FULL_SHA}` |
16
+
17
+ > Synthesized from [X] service contexts.
18
+ > Edit this file to refine the overall product vision.
19
+ > Re-running `/draft:index` will update auto-generated sections but preserve manual edits.
20
+
21
+ ---
22
+
23
+ ## Vision
24
+
25
+ [Synthesized from common themes across service visions — describe what the overall product/platform does and why it matters]
26
+
27
+ ## Target Users
28
+
29
+ <!-- Aggregated and deduplicated from all service product.md files -->
30
+
31
+ - **[User Type 1]**: [Their needs across the platform]
32
+ - **[User Type 2]**: [Their needs across the platform]
33
+
34
+ ## Service Capabilities
35
+
36
+ | Capability | Provided By | Description |
37
+ |------------|-------------|-------------|
38
+ | [Capability] | [service-name] | [Brief description] |
39
+
40
+ ## Cross-Cutting Concerns
41
+
42
+ <!-- Extracted from common patterns across services -->
43
+
44
+ - **Authentication**: [How auth works across services]
45
+ - **Observability**: [Common logging/tracing approach]
46
+ - **Data Privacy**: [Compliance patterns]
47
+
48
+ <!-- MANUAL START -->
49
+ ## Strategic Context
50
+
51
+ [Add manual strategic context, roadmap notes, or business priorities here — preserved on re-index]
52
+
53
+ <!-- MANUAL END -->
@@ -0,0 +1,117 @@
1
+ ---
2
+ project: "{PROJECT_NAME}"
3
+ module: "root"
4
+ generated_by: "draft:index"
5
+ generated_at: "{ISO_TIMESTAMP}"
6
+ ---
7
+
8
+ # Tech Stack: [Org/Product Name]
9
+
10
+ | Field | Value |
11
+ |-------|-------|
12
+ | **Branch** | `{LOCAL_BRANCH}` → `{REMOTE/BRANCH}` |
13
+ | **Commit** | `{SHORT_SHA}` — {COMMIT_MESSAGE} |
14
+ | **Generated** | {ISO_TIMESTAMP} |
15
+ | **Synced To** | `{FULL_SHA}` |
16
+
17
+ > Synthesized from [X] service contexts.
18
+ > This defines **org-wide standards**. Service-specific additions are in their local tech-stack.md.
19
+ > Re-running `/draft:index` will update auto-generated sections but preserve manual edits.
20
+
21
+ ---
22
+
23
+ ## Org Standards
24
+
25
+ ### Languages
26
+
27
+ - **Primary**: [Most common language] — [X]% of services
28
+ - **Secondary**: [Second most common] — [Y]% of services
29
+ - **Specialized**: [Other languages] — approved for specific use cases
30
+
31
+ ### Frameworks
32
+
33
+ | Purpose | Standard | Alternatives |
34
+ |---------|----------|--------------|
35
+ | HTTP API | [Framework] | [Approved alternatives] |
36
+ | Background Jobs | [Framework] | - |
37
+ | Testing | [Framework] | - |
38
+
39
+ ### Data Storage
40
+
41
+ | Type | Standard | When to Use |
42
+ |------|----------|-------------|
43
+ | OLTP | PostgreSQL | Default for relational data |
44
+ | Document | MongoDB | Approved for specific use cases |
45
+ | Cache | Redis | Session, cache, rate limiting |
46
+ | Search | Elasticsearch | Full-text search requirements |
47
+
48
+ ### Messaging
49
+
50
+ | Pattern | Standard |
51
+ |---------|----------|
52
+ | Async Events | RabbitMQ |
53
+ | Event Streaming | Kafka (approved for high-volume) |
54
+
55
+ ### Infrastructure
56
+
57
+ | Component | Standard |
58
+ |-----------|----------|
59
+ | Container | Docker |
60
+ | Orchestration | Kubernetes |
61
+ | CI/CD | GitHub Actions |
62
+ | Registry | [Container registry] |
63
+ | Secrets | [Secrets manager] |
64
+
65
+ ## Approved Variances
66
+
67
+ Services may deviate from standards with documented justification:
68
+
69
+ | Service | Variance | Standard | Justification |
70
+ |---------|----------|----------|---------------|
71
+ | [ml-service] | Python | Go/TypeScript | ML ecosystem requirements |
72
+ | [analytics] | MongoDB | PostgreSQL | Time-series workload |
73
+
74
+ > Add new variances via PR to this file. Variances without justification will be flagged.
75
+
76
+ ## Shared Libraries
77
+
78
+ Internal libraries all services should use:
79
+
80
+ | Library | Purpose | Current Version |
81
+ |---------|---------|-----------------|
82
+ | @org/auth-client | Auth service integration | 2.x |
83
+ | @org/logging | Structured logging | 1.x |
84
+ | @org/errors | Error handling patterns | 1.x |
85
+ | @org/config | Configuration management | 1.x |
86
+
87
+ ## Code Patterns
88
+
89
+ Org-wide conventions:
90
+
91
+ | Pattern | Standard | Reference |
92
+ |---------|----------|-----------|
93
+ | Error Handling | [Custom error classes with codes] | @org/errors |
94
+ | Logging | [Structured JSON, correlation IDs] | @org/logging |
95
+ | API Versioning | [URL path: /v1/, /v2/] | API guidelines |
96
+ | Authentication | [JWT validation via auth-service] | Auth spec |
97
+
98
+ <!-- MANUAL START -->
99
+ ## Technology Decisions
100
+
101
+ [Document org-wide technology decisions and rationale here — preserved on re-index]
102
+
103
+ ### TDR-001: [Decision Title]
104
+
105
+ **Context:** [Why this decision was needed]
106
+ **Decision:** [What was decided]
107
+ **Services Affected:** [Which services]
108
+
109
+ <!-- MANUAL END -->
110
+
111
+ ## Compliance
112
+
113
+ | Requirement | Standard | Enforcement |
114
+ |-------------|----------|-------------|
115
+ | Secrets | Never in code, use secrets manager | CI scan |
116
+ | Dependencies | Weekly vulnerability scan | Dependabot |
117
+ | Containers | Base images from approved list | CI policy |
@@ -0,0 +1,55 @@
1
+ ---
2
+ project: "{PROJECT_NAME}"
3
+ module: "root"
4
+ generated_by: "draft:index"
5
+ generated_at: "{ISO_TIMESTAMP}"
6
+ ---
7
+
8
+ # Service Index
9
+
10
+ | Field | Value |
11
+ |-------|-------|
12
+ | **Branch** | `{LOCAL_BRANCH}` → `{REMOTE/BRANCH}` |
13
+ | **Commit** | `{SHORT_SHA}` — {COMMIT_MESSAGE} |
14
+ | **Generated** | {ISO_TIMESTAMP} |
15
+ | **Synced To** | `{FULL_SHA}` |
16
+
17
+ > Auto-generated. Do not edit directly.
18
+ > Re-run `/draft:index` to update.
19
+
20
+ ---
21
+
22
+ ## Overview
23
+
24
+ | Metric | Count |
25
+ |--------|-------|
26
+ | Total Services Detected | [X] |
27
+ | Initialized | [Y] |
28
+ | Uninitialized | [Z] |
29
+
30
+ ## Service Registry
31
+
32
+ | Service | Status | Tech Stack | Dependencies | Team | Details |
33
+ |---------|--------|------------|--------------|------|---------|
34
+ | [service-name] | ✓ | [lang, db] | [deps] | [@team] | [→ architecture](../services/[name]/draft/.ai-context.md) |
35
+ | [service-name] | ○ | - | - | - | Not initialized |
36
+
37
+ > **Status Legend:** ✓ = initialized, ○ = not initialized
38
+
39
+ ## Uninitialized Services
40
+
41
+ The following services have not been initialized with `/draft:init`:
42
+
43
+ - `[path/to/service]/`
44
+
45
+ Run `/draft:index --init-missing` or initialize individually with:
46
+ ```bash
47
+ cd [path/to/service] && /draft:init
48
+ ```
49
+
50
+ <!-- MANUAL START -->
51
+ ## Notes
52
+
53
+ [Add any manual notes about services here - this section is preserved on re-index]
54
+
55
+ <!-- MANUAL END -->
@@ -0,0 +1,8 @@
1
+ ---
2
+ name: session-summary
3
+ description: Foundations stub — will be expanded with export / summary logic
4
+ ---
5
+
6
+ # session-summary (Draft Foundations)
7
+
8
+ Portable stub. Content generalized from proven internal patterns.
@@ -0,0 +1,165 @@
1
+ ---
2
+ project: "{PROJECT_NAME}"
3
+ module: "root"
4
+ track_id: "{TRACK_ID}"
5
+ generated_by: "draft:new-track"
6
+ generated_at: "{ISO_TIMESTAMP}"
7
+ # Stable frontmatter only (WS-8). All ephemeral fields — git pinning, status,
8
+ # classification, scope_includes/excludes, synced_to_commit — live in
9
+ # metadata.json and surface via <!-- META:<key> --> directives below.
10
+
11
+ # Classification — mirrors metadata.json:classification (WS-8).
12
+ classification:
13
+ criticality: "" # tier1 | tier2 | tier3
14
+ data_classification: "" # public | internal | confidential | restricted
15
+ deployment_surface: "" # cloud | on-prem | mobile | desktop | hybrid
16
+
17
+ # Approvers — pre-fill into hld.md / lld.md Approvals tables on `/draft:decompose`.
18
+ # Manual entry today; will be auto-populated by the organizational MCP server when available.
19
+ # Use comma-separated names or @-handles. Leave empty strings until MCP integration ships.
20
+ approvers:
21
+ tech_leads: "" # HLD: Technical Leads
22
+ arb_leads: "" # HLD: Architecture Review Board Leads
23
+ cloudops_leads: "" # HLD: Cloud Operations (SaaS-deployed services)
24
+ qa_leads: "" # HLD: Quality Assurance (on-prem services)
25
+ pm_leads: "" # HLD: Product Management Leads
26
+ team_leads: "" # LLD: Team Leads
27
+ qa: "" # LLD: Quality Assurance
28
+ ---
29
+
30
+ # Specification: [Title]
31
+
32
+ | Field | Value |
33
+ |-------|-------|
34
+ | **Branch** | <!-- META:git.branch --> → <!-- META:git.remote --> |
35
+ | **Commit** | <!-- META:git.commit_short --> — <!-- META:git.commit_message --> |
36
+ | **Generated** | {ISO_TIMESTAMP} |
37
+ | **Synced To** | <!-- META:synced_to_commit --> |
38
+ | **Classification** | <!-- META:classification.criticality --> / <!-- META:classification.data_classification --> / <!-- META:classification.deployment_surface --> |
39
+
40
+ **Track ID:** {TRACK_ID}
41
+ **Status:** <!-- META:status --> <!-- REQUIRED -->
42
+
43
+ > This is a working draft. Content will evolve through conversation. Status
44
+ > is rendered from `metadata.json:status`; never edit it inline.
45
+
46
+ ## Context References
47
+ - **Product:** `draft/product.md` — [pending]
48
+ - **Tech Stack:** `draft/tech-stack.md` — [pending]
49
+ - **Architecture:** `draft/.ai-context.md` — [pending]
50
+ - **Discovery (Phase 0 spike):** `./discovery.md` — code-spike output (file-level
51
+ hotspots, mode-selection flags, open questions). Generated by `draft:discover`.
52
+
53
+ > **Citations.** Use `path/to/file.ext:LINE` (or `LINE-RANGE`) for code references.
54
+ > `scripts/tools/verify-citations.sh` resolves these against `synced_to_commit`.
55
+ > Prefer the source-side anchor `// DRAFT-CITE: <id>` over raw line numbers when
56
+ > the call site is likely to move during refactors — verifiers prefer the anchor.
57
+ > Wrap illustrative-only citations in `<!-- VERIFIER:IGNORE START -->` /
58
+ > `<!-- VERIFIER:IGNORE END -->` so they don't fail the verifier.
59
+
60
+ ## Problem Statement
61
+ [To be developed through intake conversation]
62
+
63
+ ## Background & Why Now
64
+ [To be developed through intake conversation]
65
+
66
+ ## Requirements
67
+ ### Functional
68
+ [To be developed through intake conversation]
69
+
70
+ ### Non-Functional
71
+ [To be developed through intake conversation]
72
+
73
+ ## Acceptance Criteria
74
+
75
+ > **Required columns (WS-7):** each AC carries a `test_id` linking it to a
76
+ > concrete test case so reviewers can audit coverage at a glance.
77
+
78
+ | AC | Description | test_id | <!-- REQUIRED -->
79
+ |----|-------------|---------|
80
+ | AC-1 | _TBD_ac_1_description_ | _TBD_ac_1_test_id_ |
81
+ | AC-2 | _TBD_ac_2_description_ | _TBD_ac_2_test_id_ |
82
+
83
+ ## Non-Goals
84
+ [To be developed through intake conversation]
85
+
86
+ ## Technical Approach
87
+ [To be developed through intake conversation]
88
+
89
+ ## Eligibility / Cap Policy <!-- OPTIONAL -->
90
+
91
+ > Only populate when the track introduces eligibility gates or caps. Every
92
+ > cap value carries `derived_from` tying the number to a source (flag,
93
+ > threshold, vendor limit, benchmark). Pure invention is rejected by review.
94
+
95
+ | Gate | v1 default | derived_from | Rationale | <!-- REQUIRED if section present -->
96
+ |------|------------|--------------|-----------|
97
+ | _TBD_gate_1_ | _TBD_gate_1_default_ | _TBD_gate_1_derived_from_ | _TBD_gate_1_rationale_ |
98
+
99
+ ## Success Metrics
100
+ <!-- Remove metrics that don't apply -->
101
+
102
+ | Category | Metric | Target | Measurement |
103
+ |----------|--------|--------|-------------|
104
+ | Performance | [e.g., API response time] | [e.g., <200ms p95] | [e.g., APM dashboard] |
105
+ | Quality | [e.g., Test coverage] | [e.g., >90%] | [e.g., CI coverage report] |
106
+ | Business | [e.g., User adoption rate] | [e.g., 50% in 30 days] | [e.g., Analytics] |
107
+ | UX | [e.g., Task completion rate] | [e.g., >95%] | [e.g., User testing] |
108
+
109
+ ## Stakeholders & Approvals
110
+ <!-- Add roles relevant to your organization -->
111
+
112
+ | Role | Name | Approval Required | Status | <!-- REQUIRED -->
113
+ |------|------|-------------------|--------|
114
+ | Product Owner | _TBD_approver_product_owner_ | Spec sign-off | [ ] |
115
+ | Tech Lead | _TBD_approver_tech_lead_ | Architecture review | [ ] |
116
+ | Security | _TBD_approver_security_ | Security review (if applicable) | [ ] |
117
+ | QA | _TBD_approver_qa_ | Test plan review | [ ] |
118
+
119
+ ### Approval Gates
120
+ - [ ] Spec approved by Product Owner
121
+ - [ ] Architecture reviewed by Tech Lead
122
+ - [ ] Security review completed (if touching auth, data, or external APIs)
123
+ - [ ] Test plan reviewed by QA
124
+
125
+ ## Risk Assessment
126
+ <!-- Score: Probability (1-5) x Impact (1-5). Risks scoring >=9 require mitigation plans. -->
127
+
128
+ > **Required columns (WS-7):** `mitigation_test_id` links each risk to the
129
+ > test row that demonstrates the mitigation works.
130
+
131
+ | Risk | Probability | Impact | Score | Mitigation | mitigation_test_id | <!-- REQUIRED -->
132
+ |------|-------------|--------|-------|------------|--------------------|
133
+ | _TBD_risk_1_ | _TBD_risk_1_prob_ | _TBD_risk_1_impact_ | _TBD_risk_1_score_ | _TBD_risk_1_mitigation_ | _TBD_risk_1_test_id_ |
134
+ | _TBD_risk_2_ | _TBD_risk_2_prob_ | _TBD_risk_2_impact_ | _TBD_risk_2_score_ | _TBD_risk_2_mitigation_ | _TBD_risk_2_test_id_ |
135
+
136
+ ## Deployment Strategy
137
+ <!-- Define rollout approach for production delivery -->
138
+
139
+ ### Rollout Phases
140
+ 1. **Canary** (1-5% traffic) — Validate core flows, monitor error rates
141
+ 2. **Limited GA** (25%) — Expand to subset, watch performance metrics
142
+ 3. **Full GA** (100%) — Complete rollout
143
+
144
+ ### Feature Flags
145
+ - Flag name: `[feature_flag_name]`
146
+ - Default: `off`
147
+ - Kill switch: [yes/no]
148
+
149
+ ### Rollback Plan
150
+ - Trigger: [e.g., error rate >1%, latency >500ms p95]
151
+ - Process: [e.g., disable feature flag, revert deployment]
152
+ - Data rollback: [e.g., migration revert script, N/A]
153
+
154
+ ### Monitoring
155
+ - Dashboard: [link or name]
156
+ - Alerts: [e.g., PagerDuty rule for error rate spike]
157
+ - Key metrics: [e.g., error rate, latency, throughput]
158
+
159
+ ## Open Questions
160
+ [Tracked during conversation]
161
+
162
+ ## Conversation Log
163
+ > Key decisions and reasoning captured during intake.
164
+
165
+ [Conversation summary will be added here]
@@ -0,0 +1,101 @@
1
+ ---
2
+ project: "{PROJECT_NAME}"
3
+ module: "root"
4
+ generated_by: "draft:index"
5
+ generated_at: "{ISO_TIMESTAMP}"
6
+ ---
7
+
8
+ # Technology Matrix
9
+
10
+ | Field | Value |
11
+ |-------|-------|
12
+ | **Branch** | `{LOCAL_BRANCH}` → `{REMOTE/BRANCH}` |
13
+ | **Commit** | `{SHORT_SHA}` — {COMMIT_MESSAGE} |
14
+ | **Generated** | {ISO_TIMESTAMP} |
15
+ | **Synced To** | `{FULL_SHA}` |
16
+
17
+ > Auto-generated. Do not edit directly.
18
+ > Re-run `/draft:index` to update.
19
+
20
+ ---
21
+
22
+ ## Org Standards
23
+
24
+ Technologies used by majority of services (>50%):
25
+
26
+ | Technology | Category | Usage | Services |
27
+ |------------|----------|-------|----------|
28
+ | [PostgreSQL] | Database | [X]% | [list] |
29
+ | [Redis] | Caching | [X]% | [list] |
30
+ | [Docker] | Container | [X]% | [list] |
31
+ | [GitHub Actions] | CI/CD | [X]% | [list] |
32
+
33
+ ## Technology Distribution
34
+
35
+ ### Languages
36
+
37
+ | Language | Services | Percentage | Notes |
38
+ |----------|----------|------------|-------|
39
+ | [Go] | [auth, users, gateway] | [45%] | Preferred for performance-critical |
40
+ | [TypeScript] | [billing, notifications] | [40%] | Preferred for rapid development |
41
+ | [Python] | [ml-service, analytics] | [15%] | ML/data workloads only |
42
+
43
+ ### Databases
44
+
45
+ | Database | Services | Use Case |
46
+ |----------|----------|----------|
47
+ | PostgreSQL | [auth, billing, users] | Primary OLTP |
48
+ | MongoDB | [notifications, analytics] | Document store |
49
+ | Redis | [auth, gateway] | Cache, sessions |
50
+
51
+ ### Frameworks
52
+
53
+ | Framework | Language | Services |
54
+ |-----------|----------|----------|
55
+ | [Gin] | Go | auth, users, gateway |
56
+ | [Express] | TypeScript | billing |
57
+ | [FastAPI] | Python | ml-service |
58
+
59
+ ### Message Queues
60
+
61
+ | Queue | Services | Pattern |
62
+ |-------|----------|---------|
63
+ | [RabbitMQ] | notifications, reports | Pub/sub |
64
+ | [Kafka] | analytics | Event streaming |
65
+
66
+ ## Variance Report
67
+
68
+ Services deviating from org standards:
69
+
70
+ | Service | Deviation | Standard | Justification |
71
+ |---------|-----------|----------|---------------|
72
+ | [ml-service] | Python | Go/TypeScript | ML ecosystem requirements |
73
+ | [analytics] | MongoDB | PostgreSQL | Time-series workload |
74
+ | [legacy-reports] | Java | Go/TypeScript | Legacy, migration planned |
75
+
76
+ ## Shared Libraries
77
+
78
+ Internal libraries used across services:
79
+
80
+ | Library | Purpose | Version | Used By | Repo |
81
+ |---------|---------|---------|---------|------|
82
+ | [@org/auth-client] | Auth service client | 2.x | billing, gateway, notifications | [link] |
83
+ | [@org/logging] | Structured logging | 1.x | all services | [link] |
84
+ | [@org/errors] | Error handling | 1.x | auth, billing, users | [link] |
85
+
86
+ ## Version Matrix
87
+
88
+ Current versions in production:
89
+
90
+ | Service | Language Version | Framework Version | Last Updated |
91
+ |---------|-----------------|-------------------|--------------|
92
+ | auth-service | Go 1.21 | Gin 1.9 | [date] |
93
+ | billing-service | Node 20 | Express 4.18 | [date] |
94
+ | user-service | Go 1.21 | Gin 1.9 | [date] |
95
+
96
+ <!-- MANUAL START -->
97
+ ## Technology Roadmap
98
+
99
+ [Add planned technology changes, deprecations, or migrations here — preserved on re-index]
100
+
101
+ <!-- MANUAL END -->