@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.
- package/.claude-plugin/marketplace.json +38 -0
- package/.claude-plugin/plugin.json +26 -0
- package/LICENSE +21 -0
- package/README.md +272 -0
- package/bin/README.md +49 -0
- package/cli/bin/draft.js +13 -0
- package/cli/src/cli.js +113 -0
- package/cli/src/hosts/claude-code.js +46 -0
- package/cli/src/hosts/codex.js +33 -0
- package/cli/src/hosts/cursor.js +50 -0
- package/cli/src/hosts/index.js +24 -0
- package/cli/src/hosts/opencode.js +39 -0
- package/cli/src/installer.js +61 -0
- package/cli/src/lib/fsx.js +34 -0
- package/cli/src/lib/graph.js +23 -0
- package/cli/src/lib/log.js +32 -0
- package/cli/src/lib/paths.js +14 -0
- package/core/agents/architect.md +338 -0
- package/core/agents/debugger.md +193 -0
- package/core/agents/ops.md +104 -0
- package/core/agents/planner.md +158 -0
- package/core/agents/rca.md +314 -0
- package/core/agents/reviewer.md +256 -0
- package/core/agents/writer.md +110 -0
- package/core/guardrails/README.md +4 -0
- package/core/guardrails/code-quality.md +4 -0
- package/core/guardrails/dependency-triage.md +4 -0
- package/core/guardrails/design-norms.md +4 -0
- package/core/guardrails/language-standards.md +4 -0
- package/core/guardrails/review-checks.md +4 -0
- package/core/guardrails/secure-patterns.md +4 -0
- package/core/guardrails/security.md +4 -0
- package/core/guardrails.md +22 -0
- package/core/knowledge-base.md +127 -0
- package/core/methodology.md +1221 -0
- package/core/shared/condensation.md +224 -0
- package/core/shared/context-verify.md +44 -0
- package/core/shared/cross-skill-dispatch.md +127 -0
- package/core/shared/discovery-schema.md +75 -0
- package/core/shared/draft-context-loading.md +282 -0
- package/core/shared/git-report-metadata.md +106 -0
- package/core/shared/graph-query.md +239 -0
- package/core/shared/graph-usage-report.md +22 -0
- package/core/shared/jira-sync.md +170 -0
- package/core/shared/parallel-analysis.md +386 -0
- package/core/shared/parallel-fanout.md +10 -0
- package/core/shared/pattern-learning.md +146 -0
- package/core/shared/red-flags.md +58 -0
- package/core/shared/template-contract.md +22 -0
- package/core/shared/template-hygiene.md +10 -0
- package/core/shared/tool-resolver.md +10 -0
- package/core/shared/vcs-commands.md +97 -0
- package/core/shared/verification-gates.md +47 -0
- package/core/templates/CHANGELOG.md +70 -0
- package/core/templates/ai-context-export.md +8 -0
- package/core/templates/ai-context.md +270 -0
- package/core/templates/ai-profile.md +41 -0
- package/core/templates/architecture.md +203 -0
- package/core/templates/dependency-graph.md +103 -0
- package/core/templates/discovery.md +79 -0
- package/core/templates/guardrails.md +143 -0
- package/core/templates/hld.md +327 -0
- package/core/templates/intake-questions.md +403 -0
- package/core/templates/jira.md +119 -0
- package/core/templates/lld.md +283 -0
- package/core/templates/metadata.json +66 -0
- package/core/templates/plan.md +130 -0
- package/core/templates/product.md +110 -0
- package/core/templates/rca.md +86 -0
- package/core/templates/root-architecture.md +127 -0
- package/core/templates/root-product.md +53 -0
- package/core/templates/root-tech-stack.md +117 -0
- package/core/templates/service-index.md +55 -0
- package/core/templates/session-summary.md +8 -0
- package/core/templates/spec.md +165 -0
- package/core/templates/tech-matrix.md +101 -0
- package/core/templates/tech-stack.md +169 -0
- package/core/templates/track-architecture.md +311 -0
- package/core/templates/workflow.md +187 -0
- package/integrations/agents/AGENTS.md +24384 -0
- package/integrations/copilot/.github/copilot-instructions.md +24384 -0
- package/integrations/gemini/.gemini.md +26 -0
- package/package.json +53 -0
- package/scripts/fetch-memory-engine.sh +116 -0
- package/scripts/lib.sh +256 -0
- package/scripts/tools/_lib.sh +220 -0
- package/scripts/tools/adr-index.sh +117 -0
- package/scripts/tools/check-graph-usage-report.sh +95 -0
- package/scripts/tools/check-scope-conflicts.sh +139 -0
- package/scripts/tools/check-skill-line-caps.sh +115 -0
- package/scripts/tools/check-template-noop.sh +87 -0
- package/scripts/tools/check-track-hygiene.sh +230 -0
- package/scripts/tools/classify-files.sh +231 -0
- package/scripts/tools/cycle-detect.sh +75 -0
- package/scripts/tools/detect-test-framework.sh +135 -0
- package/scripts/tools/diff-templates-vs-tracks.sh +176 -0
- package/scripts/tools/emit-skill-metrics.sh +71 -0
- package/scripts/tools/fix-whitespace.sh +192 -0
- package/scripts/tools/freshness-check.sh +143 -0
- package/scripts/tools/git-metadata.sh +203 -0
- package/scripts/tools/graph-callers.sh +74 -0
- package/scripts/tools/graph-impact.sh +93 -0
- package/scripts/tools/graph-snapshot.sh +102 -0
- package/scripts/tools/hotspot-rank.sh +75 -0
- package/scripts/tools/manage-symlinks.sh +85 -0
- package/scripts/tools/mermaid-from-graph.sh +92 -0
- package/scripts/tools/migrate-track-frontmatter.sh +241 -0
- package/scripts/tools/parse-git-log.sh +135 -0
- package/scripts/tools/parse-reports.sh +114 -0
- package/scripts/tools/render-track.sh +145 -0
- package/scripts/tools/run-coverage.sh +153 -0
- package/scripts/tools/scan-markers.sh +144 -0
- package/scripts/tools/skill-caps.conf +24 -0
- package/scripts/tools/validate-frontmatter.sh +125 -0
- package/scripts/tools/verify-citations.sh +250 -0
- package/scripts/tools/verify-doc-anchors.sh +204 -0
- package/scripts/tools/verify-graph-binary.sh +154 -0
- package/skills/GRAPH.md +332 -0
- package/skills/adr/SKILL.md +374 -0
- package/skills/assist-review/SKILL.md +49 -0
- package/skills/bughunt/SKILL.md +668 -0
- package/skills/bughunt/references/regression-tests.md +399 -0
- package/skills/change/SKILL.md +267 -0
- package/skills/coverage/SKILL.md +336 -0
- package/skills/debug/SKILL.md +201 -0
- package/skills/decompose/SKILL.md +656 -0
- package/skills/deep-review/SKILL.md +326 -0
- package/skills/deploy-checklist/SKILL.md +254 -0
- package/skills/discover/SKILL.md +66 -0
- package/skills/docs/SKILL.md +42 -0
- package/skills/documentation/SKILL.md +197 -0
- package/skills/draft/SKILL.md +177 -0
- package/skills/draft/context-files.md +57 -0
- package/skills/draft/intent-mapping.md +37 -0
- package/skills/draft/quality-guide.md +51 -0
- package/skills/graph/SKILL.md +107 -0
- package/skills/impact/SKILL.md +86 -0
- package/skills/implement/SKILL.md +794 -0
- package/skills/incident-response/SKILL.md +245 -0
- package/skills/index/SKILL.md +848 -0
- package/skills/init/SKILL.md +1784 -0
- package/skills/init/references/architecture-spec.md +1259 -0
- package/skills/integrations/SKILL.md +53 -0
- package/skills/jira/SKILL.md +577 -0
- package/skills/jira/references/review.md +1322 -0
- package/skills/learn/SKILL.md +478 -0
- package/skills/new-track/SKILL.md +841 -0
- package/skills/ops/SKILL.md +57 -0
- package/skills/plan/SKILL.md +60 -0
- package/skills/quick-review/SKILL.md +216 -0
- package/skills/revert/SKILL.md +178 -0
- package/skills/review/SKILL.md +1114 -0
- package/skills/standup/SKILL.md +183 -0
- package/skills/status/SKILL.md +183 -0
- package/skills/tech-debt/SKILL.md +318 -0
- package/skills/testing-strategy/SKILL.md +195 -0
- package/skills/tour/SKILL.md +38 -0
- package/skills/upload/SKILL.md +117 -0
|
@@ -0,0 +1,841 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: new-track
|
|
3
|
+
description: "Start a new feature or bug track. Collaborative intake process with structured questions, AI guidance, and progressive refinement before generating spec.md and plan.md. Use when the user asks to 'start a new track', 'create a feature track', 'add a bug fix track', or says 'I want to build X', 'fix the Y bug', 'plan a refactor'."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Create New Track
|
|
7
|
+
|
|
8
|
+
Create a new track (feature, bug fix, or refactor) for Context-Driven Development. This is a **collaborative process** — be an active participant providing guidance, fact-checking, and expertise grounded in vetted sources.
|
|
9
|
+
|
|
10
|
+
**Feature Description:** $ARGUMENTS
|
|
11
|
+
|
|
12
|
+
## Red Flags - STOP if you're:
|
|
13
|
+
|
|
14
|
+
- Creating a track without reading existing Draft context (product.md, tech-stack.md, .ai-context.md)
|
|
15
|
+
- Asking questions without contributing expertise or trade-off analysis
|
|
16
|
+
- Rushing through intake without probing deeper with "why"
|
|
17
|
+
- Generating spec/plan without user confirmation at checkpoints
|
|
18
|
+
- Skipping risk identification
|
|
19
|
+
- Not citing sources when giving architectural advice
|
|
20
|
+
|
|
21
|
+
**Collaborative understanding, not speed.**
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Pre-Check
|
|
26
|
+
|
|
27
|
+
1. Verify Draft is initialized:
|
|
28
|
+
```bash
|
|
29
|
+
ls draft/product.md draft/tech-stack.md draft/workflow.md draft/tracks.md 2>/dev/null
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
If missing, tell user: "Project not initialized. Run `/draft:init` first."
|
|
33
|
+
|
|
34
|
+
2. Check for `--quick` flag in `$ARGUMENTS`:
|
|
35
|
+
- If present: **strip `--quick` from `$ARGUMENTS` now** (before Step 1) and store the cleaned text as the working description for all subsequent steps. Proceed to Step 1, then go directly to **Step 1.5: Quick Mode**.
|
|
36
|
+
- Quick mode is for: hotfixes, tiny isolated changes, work scoped to 1-3 hours
|
|
37
|
+
|
|
38
|
+
3. Load full project context (these documents ARE the big picture — every track must be grounded in them):
|
|
39
|
+
- Read `draft/product.md` — product vision, users, goals, constraints, guidelines (optional section)
|
|
40
|
+
- Read `draft/tech-stack.md` — languages, frameworks, patterns, code style, accepted patterns
|
|
41
|
+
- Read `draft/.ai-context.md` (if exists) — system map, modules, data flows, invariants, security architecture. Falls back to `draft/architecture.md` for legacy projects.
|
|
42
|
+
- Read `draft/workflow.md` — TDD preference, commit conventions, review process
|
|
43
|
+
- Read `draft/guardrails.md` (if exists) — hard guardrails, learned conventions, learned anti-patterns
|
|
44
|
+
- Read `draft/tracks.md` — existing tracks to check for overlap or dependencies
|
|
45
|
+
- **Scan recent track impact memory** (overlap detection): for each completed track in `draft/tracks/*/metadata.json` updated within the last 30 days, read the `impact` block (if present). Build a map `module → [recent_track_ids]`. After Step 4 (scope distillation), once the candidate modules for the new track are known, intersect them with this map. If overlap exists, surface it in the intake summary:
|
|
46
|
+
```
|
|
47
|
+
Overlap warning: track <id> recently touched modules <A>, <B>.
|
|
48
|
+
Review draft/tracks/<id>/metadata.json#impact before proceeding.
|
|
49
|
+
```
|
|
50
|
+
This is informational, not blocking — the user decides whether to proceed, depend on the prior track, or rebase scope.
|
|
51
|
+
|
|
52
|
+
4. Load guidance references:
|
|
53
|
+
- Read `core/templates/intake-questions.md` — structured questions for intake
|
|
54
|
+
- Read `core/knowledge-base.md` — vetted sources for AI guidance
|
|
55
|
+
|
|
56
|
+
## Step 1: Generate Track ID
|
|
57
|
+
|
|
58
|
+
Create a short, kebab-case ID from the description (use the stripped description if `--quick` was present):
|
|
59
|
+
- "Add user authentication" → `add-user-auth`
|
|
60
|
+
- "Fix login bug" → `fix-login-bug`
|
|
61
|
+
|
|
62
|
+
Check if `draft/tracks/<track_id>/` already exists. If collision detected, append `-<ISO-date>` suffix (e.g., `feature-auth-2026-02-21`). Verify the suffixed path is also free before proceeding.
|
|
63
|
+
|
|
64
|
+
### Branch Creation (Toolchain-Aware)
|
|
65
|
+
|
|
66
|
+
See `core/shared/vcs-commands.md` for command conventions.
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
git checkout -b <track_id>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Step 1.5: Quick Mode Path (`--quick` only)
|
|
73
|
+
|
|
74
|
+
**Skip if:** `--quick` was not present in `$ARGUMENTS`.
|
|
75
|
+
|
|
76
|
+
Skip all intake conversation. Ask only two questions:
|
|
77
|
+
|
|
78
|
+
1. "What exactly needs to change? (1-2 sentences)"
|
|
79
|
+
2. "How will you know it's done? (list acceptance criteria)"
|
|
80
|
+
|
|
81
|
+
Then generate both files directly:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
mkdir -p draft/tracks/<track_id>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**`draft/tracks/<track_id>/spec.md`** (minimal — no YAML frontmatter needed):
|
|
88
|
+
|
|
89
|
+
```markdown
|
|
90
|
+
# Spec: [Title]
|
|
91
|
+
|
|
92
|
+
**Track ID:** <track_id>
|
|
93
|
+
**Type:** quick
|
|
94
|
+
|
|
95
|
+
## What
|
|
96
|
+
|
|
97
|
+
[description from question 1]
|
|
98
|
+
|
|
99
|
+
## Acceptance Criteria
|
|
100
|
+
|
|
101
|
+
- [ ] [from question 2, one per line]
|
|
102
|
+
|
|
103
|
+
## Non-Goals
|
|
104
|
+
|
|
105
|
+
- No scope expansion beyond what's described above
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**`draft/tracks/<track_id>/plan.md`** (flat — single phase, no phases ceremony):
|
|
109
|
+
|
|
110
|
+
```markdown
|
|
111
|
+
# Plan: [Title]
|
|
112
|
+
|
|
113
|
+
**Track ID:** <track_id>
|
|
114
|
+
|
|
115
|
+
## Phase 1: Complete
|
|
116
|
+
|
|
117
|
+
**Goal:** [one-line summary from spec]
|
|
118
|
+
**Verification:** [how to confirm ACs are met — run tests / manual check]
|
|
119
|
+
|
|
120
|
+
### Tasks
|
|
121
|
+
|
|
122
|
+
- [ ] **Task 1:** [derived from AC 1]
|
|
123
|
+
- [ ] **Task N:** Verify — [run tests or check from AC]
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Then execute **Step 8** (Create Metadata & Update Tracks) with these overrides for quick tracks:
|
|
127
|
+
- `"type": "quick"` (not `feature|bugfix|refactor`)
|
|
128
|
+
- `"phases": {"total": 1, "completed": 0}` (plan has exactly 1 phase)
|
|
129
|
+
|
|
130
|
+
Skip Steps 2–7.
|
|
131
|
+
|
|
132
|
+
After Step 8 completes, announce:
|
|
133
|
+
```
|
|
134
|
+
Quick track created: <track_id>
|
|
135
|
+
|
|
136
|
+
Files: spec.md (minimal), plan.md (flat)
|
|
137
|
+
Next: /draft:implement
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Step 2: Create Draft Files
|
|
143
|
+
|
|
144
|
+
Create the track directory and draft files immediately with skeleton structure:
|
|
145
|
+
|
|
146
|
+
### Create `draft/tracks/<track_id>/spec-draft.md`:
|
|
147
|
+
|
|
148
|
+
**MANDATORY: Include YAML frontmatter with git metadata.** Gather git info first:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
git branch --show-current # LOCAL_BRANCH
|
|
152
|
+
git rev-parse --abbrev-ref @{upstream} 2>/dev/null || echo "none" # REMOTE/BRANCH
|
|
153
|
+
git rev-parse HEAD # FULL_SHA
|
|
154
|
+
git rev-parse --short HEAD # SHORT_SHA
|
|
155
|
+
git log -1 --format=%ci HEAD # COMMIT_DATE
|
|
156
|
+
git log -1 --format=%s HEAD # COMMIT_MESSAGE
|
|
157
|
+
git status --porcelain | head -1 | wc -l # 0 = clean, >0 = dirty
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
```markdown
|
|
161
|
+
---
|
|
162
|
+
project: "{PROJECT_NAME}"
|
|
163
|
+
module: "root"
|
|
164
|
+
track_id: "<track_id>"
|
|
165
|
+
generated_by: "draft:new-track"
|
|
166
|
+
generated_at: "{ISO_TIMESTAMP}"
|
|
167
|
+
git:
|
|
168
|
+
branch: "{LOCAL_BRANCH}"
|
|
169
|
+
remote: "{REMOTE/BRANCH}"
|
|
170
|
+
commit: "{FULL_SHA}"
|
|
171
|
+
commit_short: "{SHORT_SHA}"
|
|
172
|
+
commit_date: "{COMMIT_DATE}"
|
|
173
|
+
commit_message: "{COMMIT_MESSAGE}"
|
|
174
|
+
dirty: {true|false}
|
|
175
|
+
synced_to_commit: "{FULL_SHA}"
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
# Specification Draft: [Title]
|
|
179
|
+
|
|
180
|
+
| Field | Value |
|
|
181
|
+
|-------|-------|
|
|
182
|
+
| **Branch** | `{LOCAL_BRANCH}` → `{REMOTE/BRANCH}` |
|
|
183
|
+
| **Commit** | `{SHORT_SHA}` — {COMMIT_MESSAGE} |
|
|
184
|
+
| **Generated** | {ISO_TIMESTAMP} |
|
|
185
|
+
| **Synced To** | `{FULL_SHA}` |
|
|
186
|
+
|
|
187
|
+
**Track ID:** <track_id>
|
|
188
|
+
**Status:** [ ] Drafting
|
|
189
|
+
|
|
190
|
+
> This is a working draft. Content will evolve through conversation.
|
|
191
|
+
|
|
192
|
+
## Context References
|
|
193
|
+
- **Product:** `draft/product.md` — [pending]
|
|
194
|
+
- **Tech Stack:** `draft/tech-stack.md` — [pending]
|
|
195
|
+
- **Architecture:** `draft/.ai-context.md` — [pending]
|
|
196
|
+
|
|
197
|
+
## Problem Statement
|
|
198
|
+
[To be developed through intake conversation]
|
|
199
|
+
|
|
200
|
+
## Background & Why Now
|
|
201
|
+
[To be developed through intake conversation]
|
|
202
|
+
|
|
203
|
+
## Requirements
|
|
204
|
+
### Functional
|
|
205
|
+
[To be developed through intake conversation]
|
|
206
|
+
|
|
207
|
+
### Non-Functional
|
|
208
|
+
[To be developed through intake conversation]
|
|
209
|
+
|
|
210
|
+
## Acceptance Criteria
|
|
211
|
+
[To be developed through intake conversation]
|
|
212
|
+
|
|
213
|
+
## Non-Goals
|
|
214
|
+
[To be developed through intake conversation]
|
|
215
|
+
|
|
216
|
+
## Technical Approach
|
|
217
|
+
[To be developed through intake conversation]
|
|
218
|
+
|
|
219
|
+
## Success Metrics
|
|
220
|
+
<!-- Remove metrics that don't apply -->
|
|
221
|
+
|
|
222
|
+
| Category | Metric | Target | Measurement |
|
|
223
|
+
|----------|--------|--------|-------------|
|
|
224
|
+
| Performance | [e.g., API response time] | [e.g., <200ms p95] | [e.g., APM dashboard] |
|
|
225
|
+
| Quality | [e.g., Test coverage] | [e.g., >90%] | [e.g., CI coverage report] |
|
|
226
|
+
| Business | [e.g., User adoption rate] | [e.g., 50% in 30 days] | [e.g., Analytics] |
|
|
227
|
+
| UX | [e.g., Task completion rate] | [e.g., >95%] | [e.g., User testing] |
|
|
228
|
+
|
|
229
|
+
## Stakeholders & Approvals
|
|
230
|
+
<!-- Add roles relevant to your organization -->
|
|
231
|
+
|
|
232
|
+
| Role | Name | Approval Required | Status |
|
|
233
|
+
|------|------|-------------------|--------|
|
|
234
|
+
| Product Owner | [name] | Spec sign-off | [ ] |
|
|
235
|
+
| Tech Lead | [name] | Architecture review | [ ] |
|
|
236
|
+
| Security | [name] | Security review (if applicable) | [ ] |
|
|
237
|
+
| QA | [name] | Test plan review | [ ] |
|
|
238
|
+
|
|
239
|
+
### Approval Gates
|
|
240
|
+
- [ ] Spec approved by Product Owner
|
|
241
|
+
- [ ] Architecture reviewed by Tech Lead
|
|
242
|
+
- [ ] Security review completed (if touching auth, data, or external APIs)
|
|
243
|
+
- [ ] Test plan reviewed by QA
|
|
244
|
+
|
|
245
|
+
## Risk Assessment
|
|
246
|
+
<!-- Score: Probability (1-5) × Impact (1-5). Risks scoring ≥9 require mitigation plans. -->
|
|
247
|
+
|
|
248
|
+
| Risk | Probability | Impact | Score | Mitigation |
|
|
249
|
+
|------|-------------|--------|-------|------------|
|
|
250
|
+
| [e.g., Third-party API instability] | 3 | 4 | 12 | [e.g., Circuit breaker + fallback cache] |
|
|
251
|
+
| [e.g., Data migration failure] | 2 | 5 | 10 | [e.g., Dry-run migration + rollback script] |
|
|
252
|
+
| [e.g., Scope creep] | 3 | 3 | 9 | [e.g., Strict non-goals enforcement] |
|
|
253
|
+
|
|
254
|
+
## Deployment Strategy
|
|
255
|
+
<!-- Define rollout approach for production delivery. For bug fixes and minor refactors, this section may be removed or marked N/A. -->
|
|
256
|
+
|
|
257
|
+
### Rollout Phases
|
|
258
|
+
1. **Canary** (1-5% traffic) — Validate core flows, monitor error rates
|
|
259
|
+
2. **Limited GA** (25%) — Expand to subset, watch performance metrics
|
|
260
|
+
3. **Full GA** (100%) — Complete rollout
|
|
261
|
+
|
|
262
|
+
### Feature Flags
|
|
263
|
+
- Flag name: `[feature_flag_name]`
|
|
264
|
+
- Default: `off`
|
|
265
|
+
- Kill switch: [yes/no]
|
|
266
|
+
|
|
267
|
+
### Rollback Plan
|
|
268
|
+
- Trigger: [e.g., error rate >1%, latency >500ms p95]
|
|
269
|
+
- Process: [e.g., disable feature flag, revert deployment]
|
|
270
|
+
- Data rollback: [e.g., migration revert script, N/A]
|
|
271
|
+
|
|
272
|
+
### Monitoring
|
|
273
|
+
- Dashboard: [link or name]
|
|
274
|
+
- Alerts: [e.g., PagerDuty rule for error rate spike]
|
|
275
|
+
- Key metrics: [e.g., error rate, latency, throughput]
|
|
276
|
+
|
|
277
|
+
## Open Questions
|
|
278
|
+
[Tracked during conversation]
|
|
279
|
+
|
|
280
|
+
## Conversation Log
|
|
281
|
+
> Key decisions and reasoning captured during intake.
|
|
282
|
+
|
|
283
|
+
[Conversation summary will be added here]
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Create `draft/tracks/<track_id>/plan-draft.md`:
|
|
287
|
+
|
|
288
|
+
**MANDATORY: Include YAML frontmatter with git metadata** (same git info as spec-draft.md):
|
|
289
|
+
|
|
290
|
+
```markdown
|
|
291
|
+
---
|
|
292
|
+
project: "{PROJECT_NAME}"
|
|
293
|
+
module: "root"
|
|
294
|
+
track_id: "<track_id>"
|
|
295
|
+
generated_by: "draft:new-track"
|
|
296
|
+
generated_at: "{ISO_TIMESTAMP}"
|
|
297
|
+
git:
|
|
298
|
+
branch: "{LOCAL_BRANCH}"
|
|
299
|
+
remote: "{REMOTE/BRANCH}"
|
|
300
|
+
commit: "{FULL_SHA}"
|
|
301
|
+
commit_short: "{SHORT_SHA}"
|
|
302
|
+
commit_date: "{COMMIT_DATE}"
|
|
303
|
+
commit_message: "{COMMIT_MESSAGE}"
|
|
304
|
+
dirty: {true|false}
|
|
305
|
+
synced_to_commit: "{FULL_SHA}"
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
# Plan Draft: [Title]
|
|
309
|
+
|
|
310
|
+
| Field | Value |
|
|
311
|
+
|-------|-------|
|
|
312
|
+
| **Branch** | `{LOCAL_BRANCH}` → `{REMOTE/BRANCH}` |
|
|
313
|
+
| **Commit** | `{SHORT_SHA}` — {COMMIT_MESSAGE} |
|
|
314
|
+
| **Generated** | {ISO_TIMESTAMP} |
|
|
315
|
+
| **Synced To** | `{FULL_SHA}` |
|
|
316
|
+
|
|
317
|
+
**Track ID:** <track_id>
|
|
318
|
+
**Spec:** ./spec.md
|
|
319
|
+
**Status:** [ ] Drafting
|
|
320
|
+
|
|
321
|
+
> This is a working draft. Phases will be defined after spec is finalized.
|
|
322
|
+
|
|
323
|
+
## Overview
|
|
324
|
+
[To be developed after spec finalization]
|
|
325
|
+
|
|
326
|
+
## Phases
|
|
327
|
+
[To be developed after spec finalization]
|
|
328
|
+
|
|
329
|
+
## Notes
|
|
330
|
+
[Tracked during conversation]
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
Announce: "Created draft files. Let's build out the specification through conversation."
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## Step 3: Collaborative Intake
|
|
338
|
+
|
|
339
|
+
Follow the structured intake from `core/templates/intake-questions.md`. You are an **active collaborator**, not just a questioner.
|
|
340
|
+
|
|
341
|
+
### Your Role as AI Collaborator
|
|
342
|
+
|
|
343
|
+
For each question:
|
|
344
|
+
1. **Ask** the question clearly
|
|
345
|
+
2. **Listen** to the user's response
|
|
346
|
+
3. **Contribute** your expertise:
|
|
347
|
+
- Pattern recognition from industry experience
|
|
348
|
+
- Trade-off analysis with citations from knowledge-base.md
|
|
349
|
+
- Risk identification the user may not see
|
|
350
|
+
- Fact-checking against project context (.ai-context.md, tech-stack.md)
|
|
351
|
+
- Alternative approaches with pros/cons
|
|
352
|
+
4. **Update** spec-draft.md with what's been established
|
|
353
|
+
5. **Summarize** periodically: "Here's what we have so far..."
|
|
354
|
+
|
|
355
|
+
### Citation Style
|
|
356
|
+
|
|
357
|
+
Ground advice in vetted sources:
|
|
358
|
+
- "Consider CQRS here (DDIA, Ch. 11) — separates read/write concerns."
|
|
359
|
+
- "This could violate the Dependency Rule (Clean Architecture)."
|
|
360
|
+
- "Circuit breaker pattern (Release It!) would help prevent cascade failures."
|
|
361
|
+
- "Watch for OWASP A01:2021 — Broken Access Control."
|
|
362
|
+
|
|
363
|
+
### Red Flags - STOP if you're:
|
|
364
|
+
|
|
365
|
+
- Asking questions without contributing expertise
|
|
366
|
+
- Accepting answers without probing deeper with "why"
|
|
367
|
+
- Not citing sources when giving architectural advice
|
|
368
|
+
- Skipping risk identification
|
|
369
|
+
- Not updating drafts as conversation progresses
|
|
370
|
+
- Rushing toward generation instead of understanding
|
|
371
|
+
- Not referencing product.md, tech-stack.md, .ai-context.md
|
|
372
|
+
|
|
373
|
+
**The goal is collaborative understanding, not speed.**
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
377
|
+
## Step 3A: Intake Flow (Feature / Refactor)
|
|
378
|
+
|
|
379
|
+
### Phase 1: Existing Documentation
|
|
380
|
+
- "Do you have existing documentation for this work? (PRD, RFC, design doc, Jira ticket)"
|
|
381
|
+
- If yes: Ingest, extract key points, identify gaps
|
|
382
|
+
- AI contribution: "I've extracted [X, Y, Z]. I notice [gap] isn't covered yet."
|
|
383
|
+
|
|
384
|
+
### Phase 2: Problem Space
|
|
385
|
+
Walk through problem questions from intake-questions.md:
|
|
386
|
+
- What problem are we solving?
|
|
387
|
+
- Why does this problem matter now?
|
|
388
|
+
- Who experiences this pain?
|
|
389
|
+
- What's the scope boundary?
|
|
390
|
+
|
|
391
|
+
After each answer:
|
|
392
|
+
- Contribute relevant patterns, similar problems, domain concepts
|
|
393
|
+
- Challenge assumptions with "why" questions
|
|
394
|
+
- Update spec-draft.md Problem Statement section
|
|
395
|
+
|
|
396
|
+
**Checkpoint:** "Here's the problem as I understand it: [summary]. Does this capture it?"
|
|
397
|
+
|
|
398
|
+
### Phase 3: Solution Space
|
|
399
|
+
Walk through solution questions:
|
|
400
|
+
- What's the simplest version that solves this?
|
|
401
|
+
- Why this approach over alternatives?
|
|
402
|
+
- What are we explicitly NOT doing?
|
|
403
|
+
- How does this fit with current architecture?
|
|
404
|
+
|
|
405
|
+
After each answer:
|
|
406
|
+
- Present 2-3 alternative approaches with trade-offs
|
|
407
|
+
- Cross-reference .ai-context.md (or architecture.md) for integration points
|
|
408
|
+
- Suggest tech-stack.md patterns to leverage
|
|
409
|
+
- Update spec-draft.md Technical Approach and Non-Goals sections
|
|
410
|
+
|
|
411
|
+
**Checkpoint:** "The proposed approach is [summary]. I've identified these alternatives: [list]. Your reasoning for this choice is [X]. Correct?"
|
|
412
|
+
|
|
413
|
+
### Phase 4: Risk & Constraints
|
|
414
|
+
Walk through risk questions:
|
|
415
|
+
- What could go wrong?
|
|
416
|
+
- What dependencies or blockers exist?
|
|
417
|
+
- Why might this fail?
|
|
418
|
+
- Security or compliance considerations?
|
|
419
|
+
|
|
420
|
+
After each answer:
|
|
421
|
+
- Surface risks user may not have considered
|
|
422
|
+
- Reference OWASP, distributed systems fallacies, failure modes
|
|
423
|
+
- Fact-check assumptions against project context
|
|
424
|
+
- Update spec-draft.md with risks as Open Questions
|
|
425
|
+
|
|
426
|
+
**Checkpoint:** "Key risks identified: [list]. Are there others you're aware of?"
|
|
427
|
+
|
|
428
|
+
### Phase 5: Success Criteria
|
|
429
|
+
Walk through success questions:
|
|
430
|
+
- How do we know this is complete?
|
|
431
|
+
- How will we verify it works?
|
|
432
|
+
- What would make stakeholders accept this?
|
|
433
|
+
|
|
434
|
+
After each answer:
|
|
435
|
+
- Suggest measurable, testable acceptance criteria
|
|
436
|
+
- Recommend testing strategies appropriate to feature type
|
|
437
|
+
- Align with product.md goals
|
|
438
|
+
- Update spec-draft.md Acceptance Criteria section
|
|
439
|
+
|
|
440
|
+
**Checkpoint:** "Acceptance criteria so far: [list]. Missing anything?"
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
444
|
+
### Step 3A.5: Cross-Skill Integration (Feature/Refactor)
|
|
445
|
+
|
|
446
|
+
#### Refactor Tracks → Tech-Debt Offer
|
|
447
|
+
|
|
448
|
+
If track type is refactor:
|
|
449
|
+
```
|
|
450
|
+
"Want to run a tech-debt analysis to prioritize what to address?
|
|
451
|
+
→ /draft:tech-debt scans 6 debt categories with prioritization
|
|
452
|
+
Run tech-debt analysis? [Y/n]"
|
|
453
|
+
```
|
|
454
|
+
If accepted: invoke `/draft:plan "tech debt for this refactor"`, use its prioritized output to scope the refactor spec.
|
|
455
|
+
|
|
456
|
+
#### Design Decision Detection → ADR Suggestion
|
|
457
|
+
|
|
458
|
+
If spec introduces technology not in `tech-stack.md` or changes service boundaries in `.ai-context.md`:
|
|
459
|
+
```
|
|
460
|
+
"This involves a significant design decision. Consider running:
|
|
461
|
+
→ /draft:plan \"adr ...\" to document the architectural decision"
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
---
|
|
465
|
+
|
|
466
|
+
## Step 3B: Intake Flow (Bug & RCA)
|
|
467
|
+
|
|
468
|
+
For bugs, incidents, or Jira-sourced issues. Tighter scope, investigation-focused.
|
|
469
|
+
|
|
470
|
+
### Phase 1: Symptoms & Context
|
|
471
|
+
- "What's the exact error or unexpected behavior?"
|
|
472
|
+
- "Who is affected? How often does this occur?"
|
|
473
|
+
- "When did this start? Any recent changes?"
|
|
474
|
+
|
|
475
|
+
AI contribution: Pattern recognition for common bug types, severity assessment.
|
|
476
|
+
|
|
477
|
+
### Phase 2: Reproduction
|
|
478
|
+
- "What are the exact steps to reproduce?"
|
|
479
|
+
- "What environment conditions are required?"
|
|
480
|
+
- "What's the expected vs actual behavior?"
|
|
481
|
+
|
|
482
|
+
AI contribution: Suggest additional reproduction scenarios, edge cases to check.
|
|
483
|
+
|
|
484
|
+
### Phase 3: Blast Radius
|
|
485
|
+
- "What still works correctly?"
|
|
486
|
+
- "Where does the failure boundary lie?"
|
|
487
|
+
|
|
488
|
+
AI contribution: Help narrow investigation scope, reference architecture.md for module boundaries.
|
|
489
|
+
|
|
490
|
+
### Phase 4: Code Locality
|
|
491
|
+
- "Where do you suspect the bug is?"
|
|
492
|
+
- "What's the entry point and failure point?"
|
|
493
|
+
|
|
494
|
+
AI contribution: Suggest investigation approach, reference debugging patterns.
|
|
495
|
+
|
|
496
|
+
Update spec-draft.md with bug-specific structure after gathering sufficient context.
|
|
497
|
+
|
|
498
|
+
### Step 3B.5: Auto-Triage Pipeline (Bug Tracks)
|
|
499
|
+
|
|
500
|
+
**Trigger:** Track type is bug/RCA AND any of: Jira ticket ID found, description contains "incident", "outage", "SEV", "regression", "crash".
|
|
501
|
+
|
|
502
|
+
When triggered, execute the auto-triage pipeline before proceeding to Step 4:
|
|
503
|
+
|
|
504
|
+
#### Triage Step 1: Gather External Context
|
|
505
|
+
|
|
506
|
+
If Jira ticket provided:
|
|
507
|
+
1. Pull ticket via Jira MCP: `get_issue()`, `get_issue_description()`, `get_issue_comments()`
|
|
508
|
+
2. Extract from ticket: URLs, log paths, stack traces, reproduction steps, affected services
|
|
509
|
+
3. Use `curl`/`wget` to fetch any URLs mentioned (dashboards, error pages, API responses)
|
|
510
|
+
4. Use `ssh` to access log locations on remote nodes (if paths like `/home/log/`, node IPs mentioned)
|
|
511
|
+
5. Collect all gathered data into a triage context bundle
|
|
512
|
+
|
|
513
|
+
#### Triage Step 2: Offer Debug Session
|
|
514
|
+
|
|
515
|
+
```
|
|
516
|
+
"Bug track detected with [Jira context / error description]. Run a structured debug session before writing the spec?
|
|
517
|
+
→ /draft:discover debug will help reproduce and isolate the issue
|
|
518
|
+
Run debug session? [Y/n]"
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
If accepted:
|
|
522
|
+
- Invoke `/draft:discover "debug ..."` (routes to debug) with gathered triage context
|
|
523
|
+
- Feed the Debug Report into spec-draft.md "Reproduction" and "Root Cause Hypothesis" sections
|
|
524
|
+
|
|
525
|
+
#### Triage Step 3: RCA Analysis
|
|
526
|
+
|
|
527
|
+
If debug session produced findings:
|
|
528
|
+
- Invoke RCA agent methodology from `core/agents/rca.md`
|
|
529
|
+
- Perform 5 Whys analysis using debug findings
|
|
530
|
+
- Assess blast radius from `.ai-context.md`
|
|
531
|
+
- Quantify SLO impact
|
|
532
|
+
|
|
533
|
+
#### Triage Step 4: Generate rca.md
|
|
534
|
+
|
|
535
|
+
Create `draft/tracks/<track_id>/rca.md` using the template from `core/templates/rca.md`:
|
|
536
|
+
- Include root cause, classification, timeline, evidence, prevention items
|
|
537
|
+
- Include YAML frontmatter with git metadata
|
|
538
|
+
- Link to debug report and gathered evidence
|
|
539
|
+
|
|
540
|
+
#### Triage Step 5: Sync to Jira
|
|
541
|
+
|
|
542
|
+
If Jira ticket linked, sync via `core/shared/jira-sync.md`:
|
|
543
|
+
- Attach `rca.md` to ticket
|
|
544
|
+
- Post comment: "[draft] rca-complete: Root cause identified — {1-line summary}. Prevention: {count} items."
|
|
545
|
+
|
|
546
|
+
#### Triage Step 6: Developer Checkpoint
|
|
547
|
+
|
|
548
|
+
```
|
|
549
|
+
"RCA complete. Findings:
|
|
550
|
+
Root cause: {summary}
|
|
551
|
+
Classification: {type}
|
|
552
|
+
Blast radius: {affected modules}
|
|
553
|
+
|
|
554
|
+
→ Want me to write regression tests for this? [Y/n]
|
|
555
|
+
→ Ready to proceed with the fix? [Y/n]"
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
Only proceed to spec/plan generation after developer approval.
|
|
559
|
+
|
|
560
|
+
### Step 3B.6: Incident Context Detection
|
|
561
|
+
|
|
562
|
+
If track description contains "incident", "outage", "SEV", or "postmortem":
|
|
563
|
+
- Check for existing postmortem: `ls draft/tracks/*/incident-*.md 2>/dev/null`
|
|
564
|
+
- If none found, suggest: "Run `/draft:ops incident-response postmortem` first to capture incident context."
|
|
565
|
+
- If found, feed postmortem findings into spec-draft.md.
|
|
566
|
+
|
|
567
|
+
---
|
|
568
|
+
|
|
569
|
+
## Step 4: Draft Review & Refinement
|
|
570
|
+
|
|
571
|
+
After completing intake sections:
|
|
572
|
+
|
|
573
|
+
1. Present complete spec-draft.md summary
|
|
574
|
+
2. List any remaining Open Questions
|
|
575
|
+
3. Ask: "Want to refine any section, or ready to finalize?"
|
|
576
|
+
|
|
577
|
+
If refining:
|
|
578
|
+
- Continue conversation on specific sections
|
|
579
|
+
- Update drafts as discussion progresses
|
|
580
|
+
- Return to this step when ready
|
|
581
|
+
|
|
582
|
+
---
|
|
583
|
+
|
|
584
|
+
## Step 4.5: Elicitation Pass
|
|
585
|
+
|
|
586
|
+
Before finalizing, offer a quick spec stress-test. This takes 2 minutes and often surfaces blind spots.
|
|
587
|
+
|
|
588
|
+
Based on the track type (feature / bug / refactor), present 3 pre-selected challenge techniques:
|
|
589
|
+
|
|
590
|
+
**Feature tracks:**
|
|
591
|
+
1. **Pre-mortem** — "It's 6 months later and this feature failed. What went wrong?"
|
|
592
|
+
2. **Scope Boundary** — "What's the smallest version that still achieves the core goal?"
|
|
593
|
+
3. **Edge Case Storm** — Surface 5 boundary conditions not yet in the ACs
|
|
594
|
+
|
|
595
|
+
**Bug tracks:**
|
|
596
|
+
1. **Root Cause Depth** — "Is the reported symptom the real bug, or a symptom of something deeper?"
|
|
597
|
+
2. **Blast Radius** — "What else could this fix inadvertently break?"
|
|
598
|
+
3. **Regression Risk** — "What existing behavior might this change inadvertently affect?"
|
|
599
|
+
|
|
600
|
+
**Refactor tracks:**
|
|
601
|
+
1. **Behavior Preservation** — "List every externally visible behavior that must be identical before and after"
|
|
602
|
+
2. **Integration Impact** — "Which callers will break if this interface changes?"
|
|
603
|
+
3. **Rollback Complexity** — "If this refactor needs reverting mid-flight, what's the path?"
|
|
604
|
+
|
|
605
|
+
Present to the user:
|
|
606
|
+
|
|
607
|
+
```
|
|
608
|
+
Quick stress-test before finalizing — pick one or skip:
|
|
609
|
+
|
|
610
|
+
1. [Technique name] — [one-line prompt]
|
|
611
|
+
2. [Technique name] — [one-line prompt]
|
|
612
|
+
3. [Technique name] — [one-line prompt]
|
|
613
|
+
|
|
614
|
+
Enter 1–3, or "skip":
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
- **If a number is chosen:** Apply that technique to the current spec-draft.md. Show what it reveals. Update spec-draft.md if findings are significant (new ACs, revised non-goals, added risks).
|
|
618
|
+
- **If "skip":** Proceed directly to Step 5. No friction.
|
|
619
|
+
|
|
620
|
+
---
|
|
621
|
+
|
|
622
|
+
## Step 5: Finalize Specification
|
|
623
|
+
|
|
624
|
+
When user confirms spec is ready:
|
|
625
|
+
|
|
626
|
+
1. Finalize `spec-draft.md` → `spec.md`:
|
|
627
|
+
1. Read `spec-draft.md` content.
|
|
628
|
+
2. Write content to `spec.md`.
|
|
629
|
+
3. Verify `spec.md` exists and has non-empty content.
|
|
630
|
+
4. Delete `spec-draft.md`.
|
|
631
|
+
2. Update `spec.md` status to `[x] Complete`
|
|
632
|
+
3. Update Context References with specific connections to product.md, tech-stack.md, .ai-context.md
|
|
633
|
+
4. Add Conversation Log summary with key decisions and reasoning
|
|
634
|
+
|
|
635
|
+
Present final spec.md for acknowledgment.
|
|
636
|
+
|
|
637
|
+
---
|
|
638
|
+
|
|
639
|
+
## Step 6: Create Plan
|
|
640
|
+
|
|
641
|
+
Based on finalized spec, build out plan-draft.md:
|
|
642
|
+
|
|
643
|
+
### For Feature / Refactor:
|
|
644
|
+
Create phased breakdown:
|
|
645
|
+
- Phase 1: Foundation / Setup
|
|
646
|
+
- Phase 2: Core Implementation
|
|
647
|
+
- Phase 3: Integration & Polish
|
|
648
|
+
|
|
649
|
+
For each phase:
|
|
650
|
+
- Define Goal and Verification criteria
|
|
651
|
+
- Break into specific Tasks with file references
|
|
652
|
+
- Identify dependencies between tasks
|
|
653
|
+
|
|
654
|
+
AI contribution:
|
|
655
|
+
- Suggest task ordering based on dependencies
|
|
656
|
+
- Reference tech-stack.md for implementation patterns
|
|
657
|
+
- Identify testing requirements per task
|
|
658
|
+
- Flag integration points with .ai-context.md modules
|
|
659
|
+
|
|
660
|
+
### For Bug & RCA:
|
|
661
|
+
Use fixed 3-phase structure:
|
|
662
|
+
- Phase 1: Investigate & Reproduce
|
|
663
|
+
- Phase 2: Root Cause Analysis
|
|
664
|
+
- Phase 3: Fix & Verify
|
|
665
|
+
|
|
666
|
+
Reference `core/agents/rca.md` for detailed process.
|
|
667
|
+
|
|
668
|
+
### Conditional Plan Tasks (Auto-Embedded)
|
|
669
|
+
|
|
670
|
+
Based on track context, automatically include these tasks in the appropriate plan phase:
|
|
671
|
+
|
|
672
|
+
- **If track modifies production code:** Add final task in last phase:
|
|
673
|
+
`- [ ] Run /draft:deploy-checklist before deploying`
|
|
674
|
+
|
|
675
|
+
- **If spec mentions new APIs, services, or components:** Add documentation task:
|
|
676
|
+
`- [ ] Update documentation (run /draft:documentation api|runbook)`
|
|
677
|
+
|
|
678
|
+
- **If testing-strategy.md exists or TDD enabled:** Add in Phase 1:
|
|
679
|
+
`- [ ] Verify testing strategy covers this track (run /draft:testing-strategy if not done)`
|
|
680
|
+
|
|
681
|
+
Present plan-draft.md for review.
|
|
682
|
+
|
|
683
|
+
---
|
|
684
|
+
|
|
685
|
+
## Step 7: Finalize Plan
|
|
686
|
+
|
|
687
|
+
When user confirms plan is ready:
|
|
688
|
+
|
|
689
|
+
1. Update plan-draft.md status to `[x] Complete`
|
|
690
|
+
2. Write final content to `plan.md`, then delete `plan-draft.md`
|
|
691
|
+
3. Validate phases against spec requirements
|
|
692
|
+
4. Ensure all acceptance criteria are covered by tasks
|
|
693
|
+
|
|
694
|
+
Present final plan.md for acknowledgment.
|
|
695
|
+
|
|
696
|
+
---
|
|
697
|
+
|
|
698
|
+
## Step 8: Create Metadata & Update Tracks
|
|
699
|
+
|
|
700
|
+
### Pre-Validation
|
|
701
|
+
|
|
702
|
+
Before creating metadata, verify final files exist:
|
|
703
|
+
|
|
704
|
+
```bash
|
|
705
|
+
ls draft/tracks/<track_id>/spec.md draft/tracks/<track_id>/plan.md 2>/dev/null
|
|
706
|
+
```
|
|
707
|
+
|
|
708
|
+
If either missing:
|
|
709
|
+
- ERROR: "Track creation incomplete. Missing files: [list missing]"
|
|
710
|
+
- "Expected: spec.md and plan.md in draft/tracks/<track_id>/"
|
|
711
|
+
- Halt - do not create metadata.json or update tracks.md
|
|
712
|
+
|
|
713
|
+
### Create `draft/tracks/<track_id>/metadata.json`:
|
|
714
|
+
|
|
715
|
+
```json
|
|
716
|
+
{
|
|
717
|
+
"id": "<track_id>",
|
|
718
|
+
"title": "[Title]",
|
|
719
|
+
"type": "feature|bugfix|refactor",
|
|
720
|
+
"status": "planning",
|
|
721
|
+
"created": "[ISO timestamp]",
|
|
722
|
+
"updated": "[ISO timestamp]",
|
|
723
|
+
"phases": {
|
|
724
|
+
"total": 3,
|
|
725
|
+
"completed": 0
|
|
726
|
+
},
|
|
727
|
+
"tasks": {
|
|
728
|
+
"total": "<count all `- [ ]` task lines in plan.md>",
|
|
729
|
+
"completed": 0
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
```
|
|
733
|
+
|
|
734
|
+
Count all `- [ ]` task lines in `plan.md` and set `tasks.total` in `metadata.json` accordingly instead of 0.
|
|
735
|
+
|
|
736
|
+
**Note:** ISO timestamps can use either `Z` or `.000Z` suffix (both valid ISO 8601). No format constraint enforced — both second precision (`2026-02-08T12:00:00Z`) and millisecond precision (`2026-02-08T12:00:00.000Z`) are acceptable.
|
|
737
|
+
|
|
738
|
+
### Verify metadata.json
|
|
739
|
+
|
|
740
|
+
Before updating tracks.md, verify metadata.json was written successfully:
|
|
741
|
+
|
|
742
|
+
```bash
|
|
743
|
+
cat draft/tracks/<track_id>/metadata.json | python3 -c "import sys,json; json.load(sys.stdin)" 2>/dev/null || echo "INVALID"
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
If invalid or missing:
|
|
747
|
+
- ERROR: "Failed to write valid metadata.json for track <track_id>"
|
|
748
|
+
- Halt - do not update tracks.md (prevents orphaned track entries)
|
|
749
|
+
|
|
750
|
+
### Update `draft/tracks.md`:
|
|
751
|
+
|
|
752
|
+
Add under Active:
|
|
753
|
+
|
|
754
|
+
```markdown
|
|
755
|
+
## Active
|
|
756
|
+
|
|
757
|
+
### [track_id] - [Title]
|
|
758
|
+
- **Status:** [ ] Planning
|
|
759
|
+
- **Created:** [date]
|
|
760
|
+
- **Phases:** 0/3
|
|
761
|
+
- **Path:** `./tracks/<track_id>/`
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
### Cleanup (Defensive)
|
|
765
|
+
|
|
766
|
+
Remove draft files if they still exist (defensive cleanup for failed renames):
|
|
767
|
+
|
|
768
|
+
```bash
|
|
769
|
+
rm -f draft/tracks/<track_id>/spec-draft.md
|
|
770
|
+
rm -f draft/tracks/<track_id>/plan-draft.md
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
The `-f` flag ensures idempotent cleanup whether files exist or not.
|
|
774
|
+
|
|
775
|
+
### Post-Validation
|
|
776
|
+
|
|
777
|
+
Verify tracks.md was updated successfully:
|
|
778
|
+
|
|
779
|
+
```bash
|
|
780
|
+
grep "<track_id>" draft/tracks.md
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
If not found:
|
|
784
|
+
- ERROR: "Failed to update tracks.md with new track entry"
|
|
785
|
+
- "Expected track_id '<track_id>' in draft/tracks.md Active section"
|
|
786
|
+
- Provide recovery: "Manually add track entry to draft/tracks.md or remove draft/tracks/<track_id>/ and retry"
|
|
787
|
+
|
|
788
|
+
---
|
|
789
|
+
|
|
790
|
+
## Completion
|
|
791
|
+
|
|
792
|
+
Announce:
|
|
793
|
+
"Track created: <track_id>
|
|
794
|
+
|
|
795
|
+
Created:
|
|
796
|
+
- draft/tracks/<track_id>/spec.md
|
|
797
|
+
- draft/tracks/<track_id>/plan.md
|
|
798
|
+
- draft/tracks/<track_id>/metadata.json
|
|
799
|
+
|
|
800
|
+
Updated:
|
|
801
|
+
- draft/tracks.md
|
|
802
|
+
|
|
803
|
+
Key decisions documented in spec.md Conversation Log.
|
|
804
|
+
|
|
805
|
+
Next: Review the spec and plan, then run `/draft:implement` to begin."
|
|
806
|
+
|
|
807
|
+
---
|
|
808
|
+
|
|
809
|
+
## Cross-Skill Dispatch
|
|
810
|
+
|
|
811
|
+
### Jira Sync at Completion
|
|
812
|
+
|
|
813
|
+
If Jira ticket is linked (from spec.md or metadata.json), sync via `core/shared/jira-sync.md`:
|
|
814
|
+
- Attach `spec.md` and `plan.md` to ticket
|
|
815
|
+
- Post comment: "[draft] spec-complete: Specification and plan generated for track {id}. {phase_count} phases, {task_count} tasks."
|
|
816
|
+
|
|
817
|
+
### Completion Suggestions
|
|
818
|
+
|
|
819
|
+
Based on track type, suggest relevant follow-ups:
|
|
820
|
+
|
|
821
|
+
**Bug tracks:**
|
|
822
|
+
```
|
|
823
|
+
"Track ready for implementation. Also consider:
|
|
824
|
+
→ /draft:ops incident-response postmortem — If this bug caused an incident
|
|
825
|
+
→ /draft:discover debug — Structured investigation
|
|
826
|
+
→ git bisect — Find the exact commit that introduced this bug"
|
|
827
|
+
```
|
|
828
|
+
|
|
829
|
+
**Feature tracks:**
|
|
830
|
+
```
|
|
831
|
+
"Track ready for implementation.
|
|
832
|
+
Next: /draft:implement
|
|
833
|
+
Also: /draft:discover \"test strategy\" — Define test approach for this feature"
|
|
834
|
+
```
|
|
835
|
+
|
|
836
|
+
**Refactor tracks:**
|
|
837
|
+
```
|
|
838
|
+
"Track ready for implementation.
|
|
839
|
+
Next: /draft:implement
|
|
840
|
+
Also: /draft:plan \"adr ...\" — Document refactoring decisions"
|
|
841
|
+
```
|