ai-dev-requirements 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,114 +1,154 @@
1
- # 需求符合性校验规范
1
+ # Requirement Coverage Validation
2
+
3
+ > Validate the current implementation plan against approved user stories before requesting plan approval or starting implementation.
4
+
5
+ ## Gate Position
6
+
7
+ ```text
8
+ Approved User Stories
9
+ |
10
+ v
11
+ Implementation Plan
12
+ |
13
+ v
14
+ Coverage Validation
15
+ |
16
+ +---- Conditional or Fail ----> revise and revalidate
17
+ |
18
+ v
19
+ Plan Approval
20
+ |
21
+ v
22
+ Implementation
23
+ ```
2
24
 
3
- > 在技术设计完成后、代码实现前,逐条校验设计方案是否完整覆盖产品需求。
25
+ Coverage validation always runs. A passing report unlocks the plan-approval prompt; it does not itself authorize implementation.
4
26
 
5
- ---
27
+ ## Inputs
6
28
 
7
- ## 校验时机
29
+ | Input | Requirement |
30
+ |-------|-------------|
31
+ | Source context | Usable source or sanitized source summary with decisions and assumptions |
32
+ | User stories | Current Gate 1-approved `user-stories.md` revision |
33
+ | Harness plan | Current `implementation-plan.md` revision |
34
+ | Repository evidence | Relevant architecture, tests, conventions, and available deterministic checks |
8
35
 
9
- ```
10
- ③ 技术设计 → ④ 技能匹配 → ⑤ 最佳实践 → 【⑥ 需求符合性校验】 → ⑦ 代码实现
36
+ If the user stories are not approved or the plan is stale, stop before validation.
37
+
38
+ ## Step 1: Build The Traceability Matrix
39
+
40
+ Map each requirement to a story, harness task, and verification gate:
41
+
42
+ ```markdown
43
+ | Requirement | User Story | Harness Task | Verification Gate | Status |
44
+ |-------------|------------|--------------|-------------------|--------|
45
+ | R1 | US-1 | HT-DEV-1 | Targeted test and typecheck | Covered |
46
+ | R2 | US-2 | HT-DEV-2, HT-TEST-1 | Integration test | Covered |
47
+ | R3 | None | None | None | Missing |
11
48
  ```
12
49
 
13
- 校验通过后方可进入代码实现阶段。校验不通过则回退到技术设计阶段修正。
50
+ Use anonymized requirement labels in persisted artifacts. Do not reproduce private source text merely to populate the matrix.
14
51
 
15
- ## 校验输入
52
+ ## Step 2: Evaluate Every Requirement
16
53
 
17
- | 输入 | 来源 |
18
- |------|------|
19
- | 原始需求 | `requirements.md` |
20
- | 用户故事 + 验收标准 | `user-stories.md` |
21
- | 技术设计方案 | `design.md` |
22
- | 任务列表 | `tasks.md` |
54
+ Check:
23
55
 
24
- ## 校验流程
56
+ | Check | Passing Condition |
57
+ |-------|-------------------|
58
+ | Story coverage | Every core requirement maps to at least one approved user story |
59
+ | Acceptance criteria | Behavior is observable and includes relevant failure or boundary cases |
60
+ | Task coverage | Every acceptance criterion has an implementation, documentation, data, research, or verification owner |
61
+ | Mutation boundary | Each write task declares the files, modules, or external systems it may change |
62
+ | Dependency order | Every prerequisite appears before the task that depends on it |
63
+ | Verification coverage | Every user-visible behavior and critical contract has a deterministic check or explicit review gate |
64
+ | Review coverage | Risk determines an appropriate light, standard, or strict review level |
65
+ | Privacy and safety | No plan artifact requires credentials, full private source bodies, or undeclared mutations |
25
66
 
26
- ### Step 1: 构建需求追踪矩阵
67
+ ## Step 3: Run Coverage Sensors
27
68
 
28
- 逐条提取需求点,建立需求 用户故事 设计 → 任务的映射关系:
69
+ Use all applicable sensor classes:
29
70
 
30
- ```markdown
31
- | # | 需求点 | 用户故事 | 设计章节 | 实现任务 | 状态 |
32
- |---|--------|---------|---------|---------|------|
33
- | R1 | 用户可通过手机号登录 | US-1 | 3.1 认证模块 | Task-1, Task-2 | 覆盖 |
34
- | R2 | 登录失败锁定账户 | US-2 | 3.1 认证模块 | Task-3 | 覆盖 |
35
- | R3 | 支持第三方 OAuth | | | | 未覆盖 |
36
- ```
71
+ | Sensor Class | Checks | Examples |
72
+ |--------------|--------|----------|
73
+ | Maintainability | Internal quality and supportability | lint, typecheck, duplication, complexity, documentation consistency |
74
+ | Architecture | Structural and ownership boundaries | dependency direction, package exports, module ownership, public contracts |
75
+ | Behavior | User-visible correctness | unit tests, integration tests, browser checks, acceptance checks |
76
+ | Safety | Authorization and data handling | mutation confirmation, secrets, private-source retention, destructive actions |
77
+ | Change resilience | Requirement and compatibility drift | version invalidation, migration, backward compatibility, stale task decomposition |
78
+
79
+ When an existing task decomposition materially differs from the current requirement, classify it as a blocking mismatch and notify the developer. Do not silently implement the stale tasks.
80
+
81
+ ## Step 4: Classify The Result
37
82
 
38
- ### Step 2: 逐项校验
83
+ | Result | Condition | Next Action |
84
+ |--------|-----------|-------------|
85
+ | `Pass` | Every core requirement is covered and no blocking risk remains | Present the plan and report summary at Gate 2 |
86
+ | `Conditional` | Only low-risk, explicitly described exceptions remain | Pause for a developer decision; update artifacts and revalidate |
87
+ | `Fail` | A core requirement, decision, task, mutation boundary, or verification gate is missing | Return to the earliest affected phase |
39
88
 
40
- 对每个需求点检查以下 5 项:
89
+ Rules:
41
90
 
42
- | 校验项 | 说明 | 判定标准 |
43
- |--------|------|---------|
44
- | **故事覆盖** | 需求点是否有对应的用户故事 | 每个需求点至少映射到 1 US |
45
- | **验收标准完整** | 用户故事的 AC 是否可验证 | AC 使用 Given/When/Then,无模糊描述 |
46
- | **设计落地** | 设计方案是否包含该需求的技术实现 | design.md 中有对应章节或说明 |
47
- | **任务分解** | 是否有具体的实现任务 | tasks.md 中有对应的 task 条目 |
48
- | **边界覆盖** | 异常流、边界条件是否考虑 | AC 中包含异常场景或设计中有错误处理说明 |
91
+ - Coverage percentage is informative, not authoritative.
92
+ - A missing core requirement always fails.
93
+ - A high-risk ambiguity always fails and returns to `/grill-me`.
94
+ - An accepted low-risk exception must be recorded in the revised plan and report before revalidation.
95
+ - Gate 2 may be requested only after the current report is `Pass`.
49
96
 
50
- ### Step 3: 输出校验报告
97
+ ## Validation Report Contract
51
98
 
52
- 生成 `validation-report.md`,保存到 `docs/plans/{feature-name}/` 目录:
99
+ Write `docs/plans/{feature-name}/validation-report.md`:
53
100
 
54
101
  ```markdown
55
- # 需求符合性校验报告
56
-
57
- ## 基本信息
58
- - 需求来源: [ONES/Jira/GitHub] #[ID]
59
- - 校验时间: [timestamp]
60
- - 校验结果: 通过 / ❌ 不通过
61
-
62
- ## 追踪矩阵
63
- | # | 需求点 | US | 设计 | 任务 | 状态 |
64
- |---|--------|----|------|------|------|
65
- | R1 | ... | US-1 | §3.1 | T-1 | |
66
-
67
- ## 覆盖统计
68
- - 需求总数: N
69
- - 已覆盖: X (X/N)
70
- - 未覆盖: Y
71
- - 部分覆盖: Z
72
-
73
- ## 未覆盖项
74
- | # | 需求点 | 缺失环节 | 建议处理方式 |
75
- |---|--------|---------|------------|
76
- | R3 | 支持第三方 OAuth | 无用户故事、无设计 | 补充 US 和设计,或与产品确认是否本期实现 |
77
-
78
- ## 风险项
79
- | # | 需求点 | 风险描述 | 建议 |
80
- |---|--------|---------|------|
81
- | R2 | 登录失败锁定 | AC 未定义锁定阈值和解锁方式 | 与产品确认具体规则 |
82
-
83
- ## 结论
84
- [通过/不通过,及后续行动]
85
- ```
102
+ # Coverage Validation Report
103
+
104
+ ## Artifact Revisions
105
+
106
+ - Stories revision: <revision>
107
+ - Plan revision: <revision>
108
+ - Result: Pass | Conditional | Fail
109
+
110
+ ## Traceability Matrix
111
+
112
+ | Requirement | User Story | Harness Task | Verification Gate | Status |
113
+ |-------------|------------|--------------|-------------------|--------|
114
+ | R1 | US-1 | HT-DEV-1 | <gate> | Covered |
86
115
 
87
- ## 校验判定规则
116
+ ## Sensor Results
88
117
 
89
- | 结果 | 条件 | 后续动作 |
90
- |------|------|---------|
91
- | 通过 | 所有需求点均已覆盖,无高风险项 | 进入 ⑦ 代码实现 |
92
- | ⚠️ 有条件通过 | 覆盖率 ≥ 90%,未覆盖项为低优先级且已标记 | 与开发者确认后进入实现,未覆盖项记入 backlog |
93
- | 不通过 | 存在未覆盖的核心需求,或高风险项未解决 | 回退到 ③ 技术设计,补充后重新校验 |
118
+ | Sensor Class | Status | Evidence or Gap |
119
+ |--------------|--------|-----------------|
120
+ | Maintainability | Pass | <evidence> |
121
+ | Architecture | Pass | <evidence> |
122
+ | Behavior | Pass | <evidence> |
123
+ | Safety | Pass | <evidence> |
124
+ | Change resilience | Pass | <evidence> |
94
125
 
95
- ## 暂停点
126
+ ## Exceptions And Risks
127
+
128
+ - <accepted exception or none>
129
+
130
+ ## Gate Decision
131
+
132
+ - Gate 2 eligible: Yes | No
133
+ - Required next action: <action or none>
134
+ ```
96
135
 
97
- 校验完成后 **必须暂停**,将校验报告呈现给开发者:
136
+ The report references artifact revisions so a changed story or plan makes the result visibly stale.
98
137
 
99
- - 如果通过:展示摘要,确认后继续
100
- - 如果不通过:展示未覆盖项和风险项,等待开发者决策(补充设计 / 与产品沟通 / 标记为后续迭代)
138
+ ## Common Omissions
101
139
 
102
- ## 常见遗漏模式
140
+ | Area | Validation Question |
141
+ |------|---------------------|
142
+ | Authorization | Who may perform the action, and where is the check verified? |
143
+ | Input validation | Are invalid, empty, oversized, and malformed inputs covered? |
144
+ | Concurrency | Can retries or concurrent writes create duplication, races, or stale state? |
145
+ | Performance | Is a measurable performance requirement mapped to an appropriate check? |
146
+ | Compatibility | Does the plan preserve supported callers, formats, and runtime versions? |
147
+ | Internationalization | Are locale behavior and fallback requirements explicit? |
148
+ | Accessibility | Are keyboard, semantic, contrast, and assistive-technology needs covered? |
149
+ | Requirement change | Do existing tasks and tests still match the current approved stories? |
150
+ | Sensitive data | Could artifacts, fixtures, logs, or examples expose private source content? |
103
151
 
104
- 以下是容易被忽略的需求类型,校验时需特别关注:
152
+ ## Invalidation
105
153
 
106
- | 类型 | 示例 |
107
- |------|------|
108
- | 权限控制 | "仅管理员可操作" — 是否有权限校验设计 |
109
- | 数据校验 | "手机号格式校验" — 前后端是否都有校验 |
110
- | 并发/竞态 | "库存扣减" — 是否考虑并发安全 |
111
- | 性能要求 | "列表页 1s 内加载" — 是否有分页/缓存设计 |
112
- | 兼容性 | "支持 IE11" — 是否影响技术选型 |
113
- | 国际化 | "支持中英文" — 是否有 i18n 方案 |
114
- | 无障碍 | "键盘可操作" — 是否有 a11y 设计 |
154
+ The report becomes stale when any approved story, plan task, mutation boundary, dependency, verification gate, or accepted exception changes. Rerun validation before requesting or reusing Gate 2 approval.
@@ -1,5 +1,9 @@
1
1
  # Service Layer Transform
2
2
 
3
+ > Optional specialized reference. Load only when the approved plan must reconcile frontend Mock contracts with backend API contracts. This pattern is not a default harness phase and does not authorize implementation by itself.
4
+
5
+ The current user stories, passing coverage report, approved plan, and repository conventions take precedence over this example.
6
+
3
7
  ## Problem
4
8
 
5
9
  Frontend uses Mock data during development. On integration, backend fields differ in three ways:
@@ -12,7 +16,7 @@ Frontend uses Mock data during development. On integration, backend fields diffe
12
16
 
13
17
  ## Solution: Transform in Service Layer
14
18
 
15
- **No separate `adapters/` directory.** Transform functions live inside service files. Components never change.
19
+ When the consuming project uses this pattern, keep transform functions inside service files instead of creating a separate `adapters/` directory. Components consume the stable frontend contract.
16
20
 
17
21
  ```
18
22
  Component → FrontendType ← service function return type
@@ -36,7 +40,7 @@ src/api/{module}/
36
40
  ## Implementation Pattern
37
41
 
38
42
  ```typescript
39
- // Frontend type (component contract, never changes)
43
+ // 1. Frontend type (component contract)
40
44
  export interface OrderInfo {
41
45
  orderId: string
42
46
  carrier: string
@@ -44,7 +48,7 @@ export interface OrderInfo {
44
48
  status: string
45
49
  }
46
50
 
47
- // Backend type (added during integration)
51
+ // 2. Backend type (added during integration)
48
52
  interface BackendOrderInfo {
49
53
  order_id: string
50
54
  carrier_info: { code: string; name: string }
@@ -52,7 +56,7 @@ interface BackendOrderInfo {
52
56
  status: number // numeric enum
53
57
  }
54
58
 
55
- // Transform function
59
+ // 3. Transform function
56
60
  const STATUS_MAP: Record<number, string> = {
57
61
  1: 'Pending', 2: 'Shipped', 3: 'Canceled',
58
62
  }
@@ -66,7 +70,7 @@ function transformOrder(raw: BackendOrderInfo): OrderInfo {
66
70
  }
67
71
  }
68
72
 
69
- // Query: backend frontend
73
+ // 4. Query: backend to frontend
70
74
  export function getOrderList(query: PageParams) {
71
75
  return request<PageResponse<BackendOrderInfo>>({
72
76
  url: '/api/order/page',
@@ -77,7 +81,7 @@ export function getOrderList(query: PageParams) {
77
81
  }))
78
82
  }
79
83
 
80
- // Submit: frontend backend
84
+ // 5. Submit: frontend to backend
81
85
  function toBackendParams(form: OrderForm): BackendOrderForm {
82
86
  return {
83
87
  order_id: form.orderId,
@@ -97,7 +101,7 @@ export function createOrder(form: OrderForm) {
97
101
  ## Integration Flow
98
102
 
99
103
  ```
100
- Backend ready Add BackendType Write transform Add .then(transform) Components unchanged
104
+ Backend ready -> Add BackendType -> Write transform -> Add `.then(transform)` -> Keep the component contract stable
101
105
  ```
102
106
 
103
107
  ## When Components Must Change
@@ -2,6 +2,8 @@
2
2
 
3
3
  Task types are scheduling primitives for the agent harness. They define how work may run, what isolation is required, and what review level applies before handoff.
4
4
 
5
+ Task type does not grant permission to execute. Lifecycle stage, gate state, dependencies, and mutation boundary must all allow the task to run.
6
+
5
7
  ## Task Types
6
8
 
7
9
  | Type | ID | Scheduler | Review Level | Harness Use |
@@ -32,10 +34,12 @@ Default `parallel_limit`: 5.
32
34
 
33
35
  ### Control
34
36
  - type: code:dev | code:fix | code:refactor | doc:write | doc:translate | research | data | test
37
+ - stage: discovery | planning | implementation | verification | handoff
35
38
  - agent_role: implementer | reviewer | researcher | tester | documenter
36
39
  - scheduler: parallel | isolated | serial
37
40
  - isolation_key: <module-or-file-path>
38
41
  - dependencies: []
42
+ - required_gates: [] | [stories_approved] | [stories_approved, coverage_passed, plan_approved]
39
43
  - review_level: light | standard | strict
40
44
  - feedback_mode: quiet_success | actionable_failure
41
45
  - retry_limit: 2
@@ -57,14 +61,28 @@ Default `parallel_limit`: 5.
57
61
  | Field | Required | Meaning |
58
62
  |-------|:---:|---------|
59
63
  | `type` | Yes | Work category and default review expectation |
64
+ | `stage` | Yes | Lifecycle phase in which the task is allowed to run |
60
65
  | `agent_role` | Yes | Primary role responsible for the task |
61
66
  | `scheduler` | Yes | Execution mode: `parallel`, `isolated`, or `serial` |
62
67
  | `isolation_key` | Yes for `isolated`, optional for others | Module, file, data source, or shared contract boundary |
63
68
  | `dependencies` | Yes | Task IDs that must finish first; use an empty list when none exist |
69
+ | `required_gates` | Yes | Current approvals and validation states required before execution |
64
70
  | `review_level` | Yes | `light`, `standard`, or `strict` |
65
71
  | `feedback_mode` | Yes | How verification output is exposed to the agent |
66
72
  | `retry_limit` | Yes | Maximum repair attempts before human escalation |
67
73
 
74
+ ## Gate Preconditions
75
+
76
+ | Task Stage | Default Required Gates | Mutation Rule |
77
+ |------------|------------------------|---------------|
78
+ | `discovery` | `[]` | Read-only fact gathering only; source mutations are forbidden |
79
+ | `planning` | `[stories_approved]` | May write planning artifacts, not implementation artifacts |
80
+ | `implementation` | `[stories_approved, coverage_passed, plan_approved]` | May mutate only the approved task boundary |
81
+ | `verification` | `[stories_approved, coverage_passed, plan_approved]` | Test-file writes require plan authorization; check execution is read-only |
82
+ | `handoff` | `[stories_approved, coverage_passed, plan_approved]` | May write only declared handoff artifacts |
83
+
84
+ Gate state is revision-bound. If an upstream artifact changes, affected tasks return to blocked even when an older approval exists.
85
+
68
86
  ## Review Levels
69
87
 
70
88
  | Level | Applies To | Required Review |
@@ -92,17 +110,19 @@ Verification output should act as backpressure:
92
110
 
93
111
  ### Control
94
112
  - type: doc:write
113
+ - stage: implementation
95
114
  - agent_role: documenter
96
115
  - scheduler: parallel
97
116
  - isolation_key: docs/readme
98
117
  - dependencies: []
118
+ - required_gates: [stories_approved, coverage_passed, plan_approved]
99
119
  - review_level: light
100
120
  - feedback_mode: quiet_success | actionable_failure
101
121
  - retry_limit: 2
102
122
 
103
123
  ### Inputs
104
124
  - Requirement: US-DOC-1
105
- - Context: docs/plans/harness/requirements.md
125
+ - Context: docs/plans/harness/user-stories.md
106
126
 
107
127
  ### Outputs
108
128
  - Artifact: README.md
@@ -119,10 +139,12 @@ Verification output should act as backpressure:
119
139
 
120
140
  ### Control
121
141
  - type: code:dev
142
+ - stage: implementation
122
143
  - agent_role: implementer
123
144
  - scheduler: isolated
124
145
  - isolation_key: src/tools/search-requirements.ts
125
146
  - dependencies: [HT-PLAN-1]
147
+ - required_gates: [stories_approved, coverage_passed, plan_approved]
126
148
  - review_level: strict
127
149
  - feedback_mode: quiet_success | actionable_failure
128
150
  - retry_limit: 2
@@ -146,10 +168,12 @@ Verification output should act as backpressure:
146
168
 
147
169
  ### Control
148
170
  - type: code:refactor
171
+ - stage: implementation
149
172
  - agent_role: implementer
150
173
  - scheduler: serial
151
174
  - isolation_key: global
152
175
  - dependencies: [HT-COVERAGE-1]
176
+ - required_gates: [stories_approved, coverage_passed, plan_approved]
153
177
  - review_level: strict
154
178
  - feedback_mode: quiet_success | actionable_failure
155
179
  - retry_limit: 2
@@ -168,6 +192,8 @@ Verification output should act as backpressure:
168
192
 
169
193
  ## Failure Handling
170
194
 
195
+ - If a required gate is missing or stale, keep the task blocked and return to the earliest invalidated phase.
196
+ - If execution requires a mutation outside the approved boundary, stop and revise the plan before writing.
171
197
  - If a `parallel` task conflicts with another task, stop both tasks and reclassify the boundary as `isolated`.
172
198
  - If an `isolated` task conflicts within the same key, serialize that key and continue other keys.
173
199
  - If a `serial` task fails, stop the harness and resolve the failure before scheduling more work.
@@ -4,10 +4,12 @@
4
4
 
5
5
  ### Control
6
6
  - type: code:dev
7
+ - stage: implementation
7
8
  - agent_role: implementer
8
9
  - scheduler: isolated
9
10
  - isolation_key: src/<module>/
10
11
  - dependencies: []
12
+ - required_gates: [stories_approved, coverage_passed, plan_approved]
11
13
  - review_level: strict
12
14
  - feedback_mode: quiet_success | actionable_failure
13
15
  - retry_limit: 2
@@ -18,6 +20,7 @@
18
20
  - Plan: docs/plans/<feature-name>/implementation-plan.md
19
21
 
20
22
  ### Steps
23
+ - Confirm every required gate applies to the current story, plan, and validation revisions.
21
24
  - Write or update the failing test that captures the acceptance criterion.
22
25
  - Run the targeted test and record the failure.
23
26
  - Implement the smallest production change inside the isolation key.
@@ -37,6 +40,7 @@
37
40
  - Type safety: `pnpm typecheck`
38
41
 
39
42
  ### Done When
43
+ - The task stayed inside the approved mutation boundary and used current gate approvals.
40
44
  - The user story acceptance criteria are covered by tests or explicit verification.
41
45
  - The implementation stays within the declared isolation key unless the plan is revised.
42
46
  - The targeted verification gate passes.
@@ -4,20 +4,23 @@
4
4
 
5
5
  ### Control
6
6
  - type: code:fix
7
+ - stage: implementation
7
8
  - agent_role: implementer
8
9
  - scheduler: isolated
9
10
  - isolation_key: <file-or-module-path>
10
11
  - dependencies: []
12
+ - required_gates: [stories_approved, coverage_passed, plan_approved]
11
13
  - review_level: standard
12
14
  - feedback_mode: quiet_success | actionable_failure
13
15
  - retry_limit: 2
14
16
 
15
17
  ### Inputs
16
18
  - Requirement: BUG-<number> or US-<number>
17
- - Failure Evidence: docs/plans/<feature-name>/requirements.md
18
- - Context: docs/plans/<feature-name>/execution-log.md
19
+ - Failure Evidence: sanitized issue context or reproducible local evidence
20
+ - Plan: docs/plans/<feature-name>/implementation-plan.md
19
21
 
20
22
  ### Steps
23
+ - Confirm every required gate applies to the current story, plan, and validation revisions.
21
24
  - Reproduce or describe the failure from evidence.
22
25
  - Add a regression test that fails for the defect.
23
26
  - Make the smallest fix inside the isolation key.
@@ -37,6 +40,7 @@
37
40
  - Quality: `pnpm lint`
38
41
 
39
42
  ### Done When
43
+ - The fix stayed inside the approved mutation boundary and used current gate approvals.
40
44
  - The original failure is covered by a regression test or explicit reproduction check.
41
45
  - The fix does not change unrelated behavior.
42
46
  - The regression gate passes.
@@ -4,10 +4,12 @@
4
4
 
5
5
  ### Control
6
6
  - type: code:refactor
7
+ - stage: implementation
7
8
  - agent_role: implementer
8
9
  - scheduler: serial
9
10
  - isolation_key: global
10
11
  - dependencies: []
12
+ - required_gates: [stories_approved, coverage_passed, plan_approved]
11
13
  - review_level: strict
12
14
  - feedback_mode: quiet_success | actionable_failure
13
15
  - retry_limit: 2
@@ -18,6 +20,7 @@
18
20
  - Coverage: docs/plans/<feature-name>/validation-report.md
19
21
 
20
22
  ### Steps
23
+ - Confirm every required gate applies to the current story, plan, and validation revisions.
21
24
  - Identify the public contracts that must remain stable.
22
25
  - Add or confirm tests around existing behavior before changing structure.
23
26
  - Refactor one bounded area at a time.
@@ -37,6 +40,7 @@
37
40
  - Build: `pnpm build`
38
41
 
39
42
  ### Done When
43
+ - The refactor stayed inside the approved mutation boundary and used current gate approvals.
40
44
  - Public behavior and contracts are preserved or intentionally changed in the plan.
41
45
  - Full verification gates pass.
42
46
  - Strict review has no blocking findings.
@@ -4,20 +4,23 @@
4
4
 
5
5
  ### Control
6
6
  - type: doc:write
7
+ - stage: implementation
7
8
  - agent_role: documenter
8
9
  - scheduler: parallel
9
10
  - isolation_key: docs/<artifact-name>
10
11
  - dependencies: []
12
+ - required_gates: [stories_approved, coverage_passed, plan_approved]
11
13
  - review_level: light
12
14
  - feedback_mode: quiet_success | actionable_failure
13
15
  - retry_limit: 2
14
16
 
15
17
  ### Inputs
16
18
  - Requirement: US-DOC-<number>
17
- - Source Context: docs/plans/<feature-name>/requirements.md
19
+ - Source Context: docs/plans/<feature-name>/user-stories.md
18
20
  - Plan Context: docs/plans/<feature-name>/implementation-plan.md
19
21
 
20
22
  ### Steps
23
+ - Confirm every required gate applies to the current story, plan, and validation revisions.
21
24
  - Identify the audience and required artifact.
22
25
  - Update the target document using the repository's existing style.
23
26
  - Keep terminology consistent with related docs.
@@ -36,6 +39,7 @@
36
39
  - Repository Gate: `pnpm lint`
37
40
 
38
41
  ### Done When
42
+ - The documentation stayed inside the approved mutation boundary and used current gate approvals.
39
43
  - The document accurately describes the implemented behavior or workflow.
40
44
  - Cross-references point to existing files.
41
45
  - Light review has no blocking findings.
@@ -4,10 +4,12 @@
4
4
 
5
5
  ### Control
6
6
  - type: research
7
+ - stage: discovery
7
8
  - agent_role: researcher
8
9
  - scheduler: parallel
9
10
  - isolation_key: research/<topic>
10
11
  - dependencies: []
12
+ - required_gates: []
11
13
  - review_level: light
12
14
  - feedback_mode: quiet_success | actionable_failure
13
15
  - retry_limit: 2
@@ -18,6 +20,7 @@
18
20
  - Decision Needed: <specific decision>
19
21
 
20
22
  ### Steps
23
+ - Keep the task read-only; discovery does not authorize source or external mutations.
21
24
  - Identify primary sources and repository-local evidence.
22
25
  - Gather only the context needed for the decision.
23
26
  - Compare viable options with tradeoffs.
@@ -37,6 +40,7 @@
37
40
  - Scope Check: recommendation answers the declared decision.
38
41
 
39
42
  ### Done When
43
+ - No source, repository, or external system was mutated.
40
44
  - The decision can be used directly by the harness plan.
41
45
  - Unknowns and assumptions are explicit.
42
46
  - Light review has no blocking findings.
@@ -4,10 +4,12 @@
4
4
 
5
5
  ### Control
6
6
  - type: test
7
+ - stage: verification
7
8
  - agent_role: tester
8
9
  - scheduler: parallel
9
10
  - isolation_key: tests/<module>/
10
11
  - dependencies: []
12
+ - required_gates: [stories_approved, coverage_passed, plan_approved]
11
13
  - review_level: standard
12
14
  - feedback_mode: quiet_success | actionable_failure
13
15
  - retry_limit: 2
@@ -18,6 +20,7 @@
18
20
  - Acceptance Criteria: docs/plans/<feature-name>/user-stories.md
19
21
 
20
22
  ### Steps
23
+ - Confirm every required gate applies to the current story, plan, and validation revisions before writing tests.
21
24
  - Identify the behavior, edge case, or regression to verify.
22
25
  - Add the smallest test that proves the behavior.
23
26
  - Run the test and confirm it fails when the implementation is absent or broken when practical.
@@ -36,6 +39,7 @@
36
39
  - Broader Gate: `pnpm test:run`
37
40
 
38
41
  ### Done When
42
+ - Test changes stayed inside the approved mutation boundary and used current gate approvals.
39
43
  - The test maps to an acceptance criterion or documented regression.
40
44
  - The targeted gate passes.
41
45
  - Standard review has no blocking findings.