@comfanion/workflow 4.38.1-dev.9 → 4.38.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/bin/cli.js +7 -0
  2. package/package.json +1 -1
  3. package/src/build-info.json +3 -2
  4. package/src/opencode/FLOW.yaml +0 -284
  5. package/src/opencode/agents/reviewer.md +17 -193
  6. package/src/opencode/config.yaml +0 -10
  7. package/src/opencode/gitignore +28 -0
  8. package/src/opencode/opencode.json +2 -1
  9. package/src/opencode/package.json +6 -2
  10. package/src/opencode/plugins/__tests__/custom-compaction.test.ts +829 -0
  11. package/src/opencode/plugins/__tests__/file-indexer.test.ts +425 -0
  12. package/src/opencode/plugins/__tests__/helpers/mock-ctx.ts +171 -0
  13. package/src/opencode/plugins/__tests__/leak-stress.test.ts +315 -0
  14. package/src/opencode/plugins/__tests__/usethis-todo.test.ts +102 -0
  15. package/src/opencode/plugins/__tests__/version-check.test.ts +223 -0
  16. package/src/opencode/plugins/custom-compaction.ts +29 -9
  17. package/src/opencode/plugins/file-indexer.ts +79 -54
  18. package/src/opencode/plugins/usethis-todo-publish.ts +36 -0
  19. package/src/opencode/plugins/usethis-todo-ui.ts +37 -0
  20. package/src/opencode/plugins/version-check.ts +55 -14
  21. package/src/opencode/skills/code-review/SKILL.md +165 -38
  22. package/src/opencode/skills/dev-epic/SKILL.md +28 -16
  23. package/src/opencode/skills/dev-sprint/SKILL.md +26 -11
  24. package/src/opencode/skills/dev-story/SKILL.md +13 -0
  25. package/src/opencode/skills/prd-writing/SKILL.md +28 -8
  26. package/src/opencode/skills/prd-writing/template.md +36 -17
  27. package/src/opencode/skills/story-writing/template.md +8 -0
  28. package/src/opencode/tools/usethis_todo.ts +344 -0
@@ -16,6 +16,75 @@ How to perform thorough code reviews for implemented stories.
16
16
 
17
17
  Ensure code quality, correctness, and adherence to project standards before merging.
18
18
 
19
+ ---
20
+
21
+ <workflow name="code-review">
22
+
23
+ <phase name="1-prepare" title="Preparation">
24
+ <action>Read the story file completely</action>
25
+ <action>Identify all acceptance criteria</action>
26
+ <action>Load docs/coding-standards/*.md for coding standards</action>
27
+ <action>Use search() to find similar patterns in codebase to compare against</action>
28
+ <action>Use search() in docs for architecture requirements</action>
29
+ <action>Review File List section for changed files</action>
30
+ </phase>
31
+
32
+ <phase name="2-security" title="Security Analysis (HIGH Priority)">
33
+ <critical>Security issues are ALWAYS high priority</critical>
34
+ <check>No hardcoded secrets, API keys, passwords</check>
35
+ <check>All user inputs validated and sanitized</check>
36
+ <check>Parameterized queries (no SQL injection)</check>
37
+ <check>Auth required on protected endpoints</check>
38
+ <check>Authorization checks before data access</check>
39
+ <check>Sensitive data not logged</check>
40
+ <check>Error messages don't leak internal details</check>
41
+ </phase>
42
+
43
+ <phase name="3-correctness" title="Correctness Analysis (HIGH Priority)">
44
+ <check>All acceptance criteria satisfied</check>
45
+ <check>Edge cases handled</check>
46
+ <check>Error scenarios have proper handling</check>
47
+ <check>No obvious logic errors</check>
48
+ <check>No race conditions</check>
49
+ </phase>
50
+
51
+ <phase name="4-tests" title="Testing Review (HIGH Priority)">
52
+ <check>Unit tests exist for new code</check>
53
+ <check>Tests cover happy path and errors</check>
54
+ <check>No flaky tests</check>
55
+ <check>Test names are descriptive</check>
56
+ <check>Run test suite: go test / npm test / pytest / cargo test</check>
57
+ <check>If failures → include in review report as HIGH priority</check>
58
+ </phase>
59
+
60
+ <phase name="5-quality" title="Code Quality (MEDIUM Priority)">
61
+ <check>Follows project architecture</check>
62
+ <check>Clear naming conventions</check>
63
+ <check>No code duplication</check>
64
+ <check>Functions are focused and small</check>
65
+ <check>Proper error wrapping</check>
66
+ <check>No N+1 query issues</check>
67
+ <check>Run linter: golangci-lint / eslint / ruff / cargo clippy</check>
68
+ </phase>
69
+
70
+ <phase name="6-write-file" title="Write Findings to Story File">
71
+ <critical>MANDATORY: Append review to story file for history/analytics</critical>
72
+ <step n="1">Read story file's ## Review section</step>
73
+ <step n="2">Count existing ### Review #N blocks → your review is N+1</step>
74
+ <step n="3">Append ### Review #N block with format below</step>
75
+ <step n="4">NEVER overwrite previous reviews — always APPEND</step>
76
+ </phase>
77
+
78
+ <phase name="7-return-summary" title="Return Summary to Caller">
79
+ <critical>Caller (@dev) uses YOUR output, not the file. Keep it actionable.</critical>
80
+ <step n="1">Return SHORT summary: verdict + action items</step>
81
+ <step n="2">Caller will use this directly without re-reading story file</step>
82
+ </phase>
83
+
84
+ </workflow>
85
+
86
+ ---
87
+
19
88
  ## Review Process
20
89
 
21
90
  ### 1. Preparation
@@ -101,38 +170,82 @@ For each AC in the story:
101
170
 
102
171
  All criteria met. Code is ready to merge.
103
172
 
104
- ```markdown
105
- ### Review Outcome: Approve
106
-
107
- All acceptance criteria satisfied. Code follows project standards.
108
- Ready for merge.
109
- ```
110
-
111
173
  ### 🔄 Changes Requested
112
174
 
113
175
  Issues found that need addressing.
114
176
 
177
+ ### ❌ Blocked
178
+
179
+ Major issues that prevent approval.
180
+
181
+ ## Write Findings to Story File (MANDATORY)
182
+
183
+ After completing the review, **append** your findings to the story file's `## Review` section.
184
+ Each review round is a separate `### Review #N` block. NEVER overwrite previous reviews — always append.
185
+
186
+ **How to determine review number:**
187
+ 1. Read the story file's `## Review` section
188
+ 2. Count existing `### Review #N` blocks
189
+ 3. Your review is `N + 1` (or `#1` if none exist)
190
+
191
+ **Format to append at the end of the story file:**
192
+
115
193
  ```markdown
116
- ### Review Outcome: Changes Requested
194
+ ### Review #{{N}} {{YYYY-MM-DD}}
117
195
 
118
- **Action Items:**
119
- - [ ] [High] Fix missing error handling in X
120
- - [ ] [Med] Add unit test for edge case Y
121
- - [ ] [Low] Improve variable naming in Z
196
+ **Verdict:** {{APPROVE | CHANGES_REQUESTED | BLOCKED}}
197
+ **Reviewer:** @reviewer (Marcus)
198
+
199
+ **Summary:** {{1-2 sentences}}
200
+
201
+ **Tests:** {{PASS | FAIL — details}}
202
+ **Lint:** {{PASS | FAIL — details}}
203
+
204
+ {{IF issues found:}}
205
+ #### Action Items
206
+ - [ ] [HIGH] `path/file.ts:42` — {{issue}} → Fix: {{specific fix}}
207
+ - [ ] [MED] `path/file.ts:100` — {{issue}} → Fix: {{specific fix}}
208
+ - [ ] [LOW] `path/file.ts:15` — {{issue}}
209
+
210
+ {{IF approve:}}
211
+ #### What's Good
212
+ - {{positive feedback}}
122
213
  ```
123
214
 
124
- ### Blocked
215
+ **Example first review with issues:**
125
216
 
126
- Major issues that prevent approval.
217
+ ```markdown
218
+ ### Review #1 — 2026-01-27
219
+
220
+ **Verdict:** CHANGES_REQUESTED
221
+ **Reviewer:** @reviewer (Marcus)
222
+
223
+ **Summary:** Missing error handling in CreateUser handler, no test for duplicate email.
224
+
225
+ **Tests:** PASS (12/12)
226
+ **Lint:** PASS
227
+
228
+ #### Action Items
229
+ - [ ] [HIGH] `internal/user/handler.go:42` — No error handling for DB timeout → Fix: wrap with domain error
230
+ - [ ] [MED] `internal/user/handler_test.go` — Missing duplicate email test → Fix: add TestCreateUser_DuplicateEmail
231
+ ```
232
+
233
+ **Example — second review after fixes:**
127
234
 
128
235
  ```markdown
129
- ### Review Outcome: Blocked
236
+ ### Review #2 — 2026-01-27
237
+
238
+ **Verdict:** APPROVE
239
+ **Reviewer:** @reviewer (Marcus)
130
240
 
131
- **Blocking Issues:**
132
- 1. Security vulnerability in authentication flow
133
- 2. Missing critical test coverage
241
+ **Summary:** All issues from Review #1 fixed. Error handling added, test coverage complete.
134
242
 
135
- Cannot proceed until blocking issues resolved.
243
+ **Tests:** PASS (14/14)
244
+ **Lint:** PASS
245
+
246
+ #### What's Good
247
+ - Clean error wrapping with domain errors
248
+ - Good test coverage for edge cases
136
249
  ```
137
250
 
138
251
  ## Severity Levels
@@ -164,39 +277,53 @@ func foo() error { ... }
164
277
 
165
278
  ## Updating Story File
166
279
 
167
- After review, add to story file:
280
+ **MANDATORY:** Use the format from "Write Findings to Story File" section above.
281
+ Append `### Review #N` block to the `## Review` section at the end of the story file.
282
+ NEVER overwrite previous reviews — history must be preserved for analytics.
168
283
 
169
- ```markdown
170
- ## Senior Developer Review (AI)
284
+ ## Return Summary to Caller (MANDATORY)
171
285
 
172
- ### Review Date
173
- 2024-01-15
286
+ After writing to story file, return a SHORT summary to the calling agent (@dev).
287
+ This prevents the caller from re-reading the story file.
174
288
 
175
- ### Review Outcome
176
- Changes Requested
289
+ **Format:**
177
290
 
178
- ### Action Items
179
- - [ ] [High] Add error handling to CreateUser handler
180
- - [ ] [Med] Add unit test for duplicate email validation
181
- - [ ] [Low] Rename 'x' to 'userCount'
291
+ ```
292
+ **VERDICT: {{APPROVE | CHANGES_REQUESTED | BLOCKED}}**
293
+
294
+ {{IF CHANGES_REQUESTED or BLOCKED:}}
295
+ Action items:
296
+ - [HIGH] `path/file.ts:42` — {{issue}} → {{fix}}
297
+ - [MED] `path/file.ts:100` — {{issue}} → {{fix}}
182
298
 
183
- ### Detailed Comments
184
- [Include detailed review comments here]
299
+ {{IF APPROVE:}}
300
+ All good. No issues found.
185
301
  ```
186
302
 
187
- If changes requested, also add:
303
+ **Example Changes Requested:**
188
304
 
189
- ```markdown
190
- ### Review Follow-ups (AI)
305
+ ```
306
+ **VERDICT: CHANGES_REQUESTED**
191
307
 
192
- - [ ] [AI-Review] [High] Add error handling to CreateUser handler
193
- - [ ] [AI-Review] [Med] Add unit test for duplicate email validation
308
+ Action items:
309
+ - [HIGH] `internal/user/handler.go:42` No error handling for DB timeout → wrap with domain error
310
+ - [MED] `internal/user/handler_test.go` — Missing duplicate email test → add TestCreateUser_DuplicateEmail
194
311
  ```
195
312
 
313
+ **Example — Approve:**
314
+
315
+ ```
316
+ **VERDICT: APPROVE**
317
+
318
+ All good. No issues found. Clean error wrapping, good test coverage.
319
+ ```
320
+
321
+ ---
322
+
196
323
  ## Best Practices
197
324
 
198
325
  1. **Be specific** - Point to exact file and line
199
326
  2. **Suggest solutions** - Don't just criticize
200
327
  3. **Prioritize** - Focus on important issues first
201
328
  4. **Be constructive** - Phrase feedback positively
202
- 5. **Use different LLM** - For fresh perspective
329
+ 5. **Use search()** - Find similar patterns before reviewing
@@ -78,6 +78,7 @@ metadata:
78
78
  </phase>
79
79
 
80
80
  <phase name="3-loop" title="Story Execution Loop">
81
+ <critical>Status flow: in_progress → review → done. NEVER mark done before review!</critical>
81
82
  <for-each item="story" in="pending_stories">
82
83
 
83
84
  <action name="execute-story">
@@ -86,21 +87,25 @@ metadata:
86
87
  - Execute tasks ONE BY ONE (or parallel if independent)
87
88
  - NEVER delegate entire story to @coder in one prompt
88
89
  - After each task: verify, mark done, next task
89
- - Clear task TODO when story done
90
90
  </action>
91
91
 
92
- <action name="mark-done">
93
- Mark story as completed in epic TODO
92
+ <action name="story-to-review">
93
+ All tasks done set story status: review
94
+ Mark story TODO as "review" (NOT "done" yet!)
94
95
  </action>
95
96
 
96
- <action name="review">
97
- Mark "Review Story" as in_progress
98
- Invoke @reviewer
97
+ <action name="review-story">
98
+ Invoke @reviewer on story code.
99
+ Reviewer does TWO things:
100
+ 1. WRITES findings to story file (## Review → ### Review #N) — for history
101
+ 2. RETURNS summary to you — use THIS, do NOT re-read story file
99
102
  <if condition="CHANGES_REQUESTED">
100
- Add fix tasks re-execute → re-review (max 3 attempts)
103
+ Use reviewer's returned action items directly.
104
+ Create fix tasks from action items → execute → re-review (max 3 attempts).
101
105
  </if>
102
106
  <if condition="APPROVED">
103
- Mark "Review Story" as completed
107
+ Set story status: done
108
+ Mark story TODO as completed
104
109
  </if>
105
110
  </action>
106
111
 
@@ -113,20 +118,22 @@ metadata:
113
118
 
114
119
  <action name="compact">
115
120
  Mark next story as in_progress in TODO
116
- Wait for auto-compaction
117
- Plugin reads TODO + state → resume
121
+ Wait for auto-compaction → resume
118
122
  </action>
119
123
 
120
124
  </for-each>
121
125
  </phase>
122
126
 
123
127
  <phase name="4-finalize" title="Finalize Epic">
124
- <step n="1">Run epic integration tests (mark in TODO)</step>
125
- <step n="2">Verify all AC from epic file (mark in TODO)</step>
126
- <step n="3">Set state: status="done"</step>
127
- <step n="4">Clear epic TODO list</step>
128
- <step n="5">Update .opencode/session-state.yaml (next epic or done)</step>
129
- <step n="6">Report completion with summary</step>
128
+ <critical>Epic also goes through review before done!</critical>
129
+ <step n="1">All stories done set epic status: review</step>
130
+ <step n="2">Run epic integration tests (mark in TODO)</step>
131
+ <step n="3">Verify all AC from epic file (mark in TODO)</step>
132
+ <step n="4">If tests fail fix → re-test</step>
133
+ <step n="5">All passed set epic status: done</step>
134
+ <step n="6">Clear epic TODO list</step>
135
+ <step n="7">Update .opencode/session-state.yaml (next epic or done)</step>
136
+ <step n="8">Report completion with summary</step>
130
137
  </phase>
131
138
 
132
139
  </workflow>
@@ -172,6 +179,11 @@ This file survives compaction and tells the agent where to resume.
172
179
  <rules>
173
180
  <do>Create clean TODO list for each epic</do>
174
181
  <do>Update epic state file BEFORE compaction</do>
182
+ <do>Execute stories IN ORDER as planned in epic file</do>
183
+ <do>Execute tasks within story ONE BY ONE (or parallel if independent)</do>
175
184
  <dont>Ask user for confirmation between stories — TODO is your guide</dont>
176
185
  <dont>Proceed to next story if review fails — enter fix loop</dont>
186
+ <dont>Reorder, skip, merge, or "optimize" story execution order</dont>
187
+ <dont>Combine tasks from different stories into one batch</dont>
188
+ <dont>Delegate entire story to @coder in one prompt — task by task only</dont>
177
189
  </rules>
@@ -90,6 +90,7 @@ metadata:
90
90
  </phase>
91
91
 
92
92
  <phase name="3-loop" title="Epic Execution Loop">
93
+ <critical>Status flow: in_progress → review → done. NEVER mark done before review!</critical>
93
94
  <for-each item="epic" in="pending_epics">
94
95
 
95
96
  <action name="execute-epic">
@@ -99,14 +100,20 @@ metadata:
99
100
  - Clears epic TODO when done
100
101
  </action>
101
102
 
102
- <action name="mark-done">
103
- Mark epic as completed in sprint TODO
103
+ <action name="epic-to-review">
104
+ All stories done set epic status: review
105
+ Mark epic TODO as "review" (NOT "done" yet!)
104
106
  </action>
105
107
 
106
108
  <action name="epic-review">
107
- Mark "Review Epic" as in_progress
108
109
  Run epic integration tests
109
- Mark "Review Epic" as completed
110
+ <if condition="TESTS_FAIL">
111
+ Fix → re-test (max 3 attempts)
112
+ </if>
113
+ <if condition="TESTS_PASS">
114
+ Set epic status: done
115
+ Mark epic TODO as completed
116
+ </if>
110
117
  </action>
111
118
 
112
119
  <action name="update-state">
@@ -117,19 +124,21 @@ metadata:
117
124
 
118
125
  <action name="compact">
119
126
  Mark next epic as in_progress in TODO
120
- Wait for auto-compaction
121
- Plugin reads sprint TODO → resume
127
+ Wait for auto-compaction → resume
122
128
  </action>
123
129
 
124
130
  </for-each>
125
131
  </phase>
126
132
 
127
133
  <phase name="4-finalize" title="Finalize Sprint">
128
- <step n="1">Run sprint integration tests (mark in TODO)</step>
129
- <step n="2">Set sprint status="done" in sprint-status.yaml</step>
130
- <step n="3">Clear sprint TODO list</step>
131
- <step n="4">Update .opencode/session-state.yaml (done)</step>
132
- <step n="5">Report completion with summary + metrics</step>
134
+ <critical>Sprint also goes through review before done!</critical>
135
+ <step n="1">All epics done set sprint status: review</step>
136
+ <step n="2">Run sprint integration tests (mark in TODO)</step>
137
+ <step n="3">If tests fail → fix → re-test</step>
138
+ <step n="4">All passed set sprint status: done in sprint-status.yaml</step>
139
+ <step n="5">Clear sprint TODO list</step>
140
+ <step n="6">Update .opencode/session-state.yaml (done)</step>
141
+ <step n="7">Report completion with summary + metrics</step>
133
142
  </phase>
134
143
 
135
144
  </workflow>
@@ -179,6 +188,12 @@ This file survives compaction and tells the agent where to resume.
179
188
  <rules>
180
189
  <do>Create ONE master TODO list for entire sprint at start</do>
181
190
  <do>Let dev-epic skill manage its own nested TODO</do>
191
+ <do>Execute epics IN ORDER as planned in sprint-status.yaml</do>
192
+ <do>Within each epic, execute stories IN ORDER as planned</do>
193
+ <do>Within each story, execute tasks ONE BY ONE (or parallel if independent)</do>
182
194
  <dont>Ask for confirmation between epics — sprint TODO is your guide</dont>
183
195
  <dont>Proceed to next epic if epic review fails — HALT and report</dont>
196
+ <dont>Reorder, skip, merge, or "optimize" epic/story execution order</dont>
197
+ <dont>Work on multiple stories or epics in parallel</dont>
198
+ <dont>Delegate entire story to @coder in one prompt — task by task only</dont>
184
199
  </rules>
@@ -114,6 +114,19 @@ metadata:
114
114
  </parallel-rules>
115
115
  </phase>
116
116
 
117
+ <phase name="4-review" title="Review BEFORE Done">
118
+ <critical>Status flow: in_progress → review → done. NEVER skip review!</critical>
119
+ <step n="1">All tasks done → set story status: review</step>
120
+ <step n="2">Run all tests, verify AC</step>
121
+ <step n="3">If called from /dev-epic: invoke @reviewer.
122
+ Reviewer does TWO things:
123
+ 1. WRITES findings to story file (## Review → ### Review #N) — for history
124
+ 2. RETURNS summary to you — use THIS, do NOT re-read story file</step>
125
+ <step n="4">If CHANGES_REQUESTED: use reviewer's returned action items directly → fix → re-review (max 3 attempts)</step>
126
+ <step n="5">Review passed → set story status: done</step>
127
+ <step n="6">Update .opencode/session-state.yaml</step>
128
+ </phase>
129
+
117
130
  </workflow>
118
131
 
119
132
  ## Session State (MANDATORY)
@@ -255,11 +255,22 @@ Brief prose section with:
255
255
  - Each module gets its own FR table
256
256
  - Example: "Order Management Module" → FR-ORD-001, FR-ORD-002
257
257
 
258
- **Table format:**
258
+ **Table format (with traceability):**
259
259
 
260
- | ID | Requirement | Priority |
261
- |----|-------------|----------|
262
- | FR-001 | {{requirement}} | P0 |
260
+ | ID | Requirement | Priority | Module | Doc Section | Arch § | Epic | Status |
261
+ |----|-------------|----------|--------|-------------|--------|------|--------|
262
+ | FR-001 | {{requirement}} | P0 | {{module}} | → Unit: `{{name}}` | §{{N}} | → Epic: `{{file}}` | ⬜ |
263
+
264
+ **Column filling:**
265
+ - **@pm (you):** ID, Requirement, Priority, Module — filled when writing PRD
266
+ - **@architect:** Doc Section, Arch § — filled when creating architecture/unit docs
267
+ - **@pm:** Epic — filled when creating epics (`/epics`)
268
+ - **@dev:** Status — marked ✅ when done
269
+
270
+ **Doc Section format:**
271
+ - Use `→ Unit: Name`, `→ Module: Name`, `→ Service: Name`, etc.
272
+ - Examples: `→ Unit: Task`, `→ Module: Auth`, `→ Service: NotificationService`
273
+ - Leave blank initially, @architect fills later
263
274
 
264
275
  With **Notes:** for business rules after each domain table.
265
276
 
@@ -272,10 +283,19 @@ FR-INV-001 # Inventory module
272
283
 
273
284
  ### 5. Non-Functional Requirements
274
285
 
275
- Tables for:
276
- - Performance (with metrics)
277
- - Security
278
- - Scalability
286
+ **Table format (with traceability):**
287
+
288
+ | ID | Requirement | Priority | Module | Doc Section | Arch § | Status |
289
+ |----|-------------|----------|--------|-------------|--------|--------|
290
+ | NFR-001 | {{requirement}} | P0 | — | — | §{{N}} | ⬜ |
291
+
292
+ **Column filling:**
293
+ - **@pm (you):** ID, Requirement, Priority, Module (if specific)
294
+ - **@architect:** Doc Section (if specific), Arch §
295
+ - **@dev:** Status
296
+
297
+ **Optional details section:**
298
+ Add Performance/Security/Scalability subsections if NFRs need detailed explanation.
279
299
 
280
300
  ### 6. Critical Business Rules
281
301
 
@@ -117,18 +117,21 @@ TaskFlow is a B2B platform for managing distributed teams. The system handles ta
117
117
 
118
118
  ## Functional Requirements
119
119
 
120
+ > **Traceability:** Each FR tracks Module, Unit, Architecture section, Epic, and Status.
121
+ > **Maintained by:** @pm (Epic), @architect (Module/Unit/Arch §), @dev (Status).
122
+
120
123
  ### {{Domain_1}}
121
124
 
122
- | ID | Requirement | Priority |
123
- |----|-------------|----------|
124
- | FR-001 | {{requirement}} | P0 |
125
- | FR-002 | {{requirement}} | P0 |
126
- | FR-003 | {{requirement}} | P1 |
125
+ | ID | Requirement | Priority | Module | Doc Section | Arch § | Epic | Status |
126
+ |----|-------------|----------|--------|-------------|--------|------|--------|
127
+ | FR-001 | {{requirement}} | P0 | {{module}} | → Unit: `{{name}}` | §{{N}} | → Epic: `{{file}}` | ⬜ |
128
+ | FR-002 | {{requirement}} | P0 | {{module}} | → Module: `{{name}}` | §{{N}} | → Epic: `{{file}}` | ⬜ |
129
+ | FR-003 | {{requirement}} | P1 | {{module}} | → Service: `{{name}}` | §{{N}} | → Epic: `{{file}}` | ⬜ |
127
130
 
128
- <!-- e.g.
129
- | FR-001 | User can create task with title, description, due date | P0 |
130
- | FR-002 | User can assign task to team member | P0 |
131
- | FR-003 | System sends notification on assignment | P1 |
131
+ <!-- Example:
132
+ | FR-001 | User can create task with title, description, due date | P0 | Task | → Unit: `Task` | §3.1 | → Epic: `epic-01-task-crud.md` | ✅ |
133
+ | FR-002 | User can assign task to team member | P0 | Task | → Unit: `Task` | §3.1 | → Epic: `epic-01-task-crud.md` | ⬜ |
134
+ | FR-003 | System sends notification on assignment | P1 | Notification | → Service: `NotificationService` | §3.3 | → Epic: `epic-03-notifications.md` | ⬜ |
132
135
  -->
133
136
 
134
137
  **Notes:**
@@ -136,24 +139,40 @@ TaskFlow is a B2B platform for managing distributed teams. The system handles ta
136
139
 
137
140
  ### {{Domain_2}}
138
141
 
139
- | ID | Requirement | Priority |
140
- |----|-------------|----------|
141
- | FR-010 | {{requirement}} | P0 |
142
+ | ID | Requirement | Priority | Module | Doc Section | Arch § | Epic | Status |
143
+ |----|-------------|----------|--------|-------------|--------|------|--------|
144
+ | FR-010 | {{requirement}} | P0 | {{module}} | → Unit: `{{name}}` | §{{N}} | → Epic: `{{file}}` | ⬜ |
142
145
 
143
146
  ---
144
147
 
145
148
  ## Non-Functional Requirements
146
149
 
150
+ > **Traceability:** NFRs also track Module (if specific), Architecture section, and Status.
151
+
152
+ | ID | Requirement | Priority | Module | Doc Section | Arch § | Status |
153
+ |----|-------------|----------|--------|-------------|--------|--------|
154
+ | NFR-001 | {{requirement}} | P0 | — | — | §{{N}} | ⬜ |
155
+ | NFR-002 | {{requirement}} | P0 | {{module}} | → Unit: `{{name}}` | §{{N}} | ⬜ |
156
+
157
+ <!-- Example:
158
+ | NFR-001 | API response time < 200ms (p95) | P0 | — | — | §5 Performance | ⬜ |
159
+ | NFR-002 | Task data encrypted at rest | P0 | Task | → Unit: `Task` | §4 Security | ⬜ |
160
+ -->
161
+
162
+ ---
163
+
164
+ ## Non-Functional Requirements (Details)
165
+
166
+ > Optional: Add detailed notes for complex NFRs here.
167
+
147
168
  ### Performance
148
- | Metric | Target |
149
- |--------|--------|
150
- | {{metric}} | {{value}} |
169
+ - {{details_if_needed}}
151
170
 
152
171
  ### Security
153
- - {{requirement}}
172
+ - {{details_if_needed}}
154
173
 
155
174
  ### Scalability
156
- - {{requirement}}
175
+ - {{details_if_needed}}
157
176
 
158
177
  ---
159
178
 
@@ -228,3 +228,11 @@ Before marking story as done, verify:
228
228
  - [ ] Tests pass
229
229
  - [ ] Code reviewed
230
230
  - [ ] No lint errors
231
+
232
+ ---
233
+
234
+ ## Review
235
+
236
+ <!-- Reviewer (@reviewer) appends review rounds here. DO NOT edit manually.
237
+ Each review is appended as ### Review #N with verdict and action items.
238
+ History is preserved for analytics. -->