contract-driven-delivery 1.10.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/README.md +532 -135
  3. package/assets/CLAUDE.template.md +34 -0
  4. package/assets/CODEX.template.md +39 -0
  5. package/assets/agents/backend-engineer.md +15 -0
  6. package/assets/agents/change-classifier.md +57 -1
  7. package/assets/agents/ci-cd-gatekeeper.md +15 -0
  8. package/assets/agents/contract-reviewer.md +15 -0
  9. package/assets/agents/dependency-security-reviewer.md +2 -0
  10. package/assets/agents/e2e-resilience-engineer.md +15 -0
  11. package/assets/agents/frontend-engineer.md +15 -0
  12. package/assets/agents/monkey-test-engineer.md +15 -0
  13. package/assets/agents/qa-reviewer.md +15 -0
  14. package/assets/agents/repo-context-scanner.md +2 -0
  15. package/assets/agents/spec-architect.md +15 -0
  16. package/assets/agents/spec-drift-auditor.md +2 -0
  17. package/assets/agents/stress-soak-engineer.md +15 -0
  18. package/assets/agents/test-strategist.md +15 -0
  19. package/assets/agents/ui-ux-reviewer.md +2 -0
  20. package/assets/agents/visual-reviewer.md +2 -0
  21. package/assets/cdd/context-policy.json +25 -0
  22. package/assets/cdd/model-policy.json +5 -0
  23. package/assets/contracts/api/api-contract.md +3 -0
  24. package/assets/contracts/api/api-inventory.md +7 -0
  25. package/assets/contracts/api/error-format.md +7 -0
  26. package/assets/contracts/business/business-rules.md +3 -0
  27. package/assets/contracts/ci/ci-gate-contract.md +3 -0
  28. package/assets/contracts/css/css-contract.md +3 -0
  29. package/assets/contracts/css/design-tokens.md +7 -0
  30. package/assets/contracts/data/data-shape-contract.md +3 -0
  31. package/assets/contracts/env/env-contract.md +3 -0
  32. package/assets/hooks/pre-commit +1 -1
  33. package/assets/skills/cdd-close/SKILL.md +150 -0
  34. package/assets/skills/cdd-new/SKILL.md +94 -35
  35. package/assets/skills/cdd-resume/SKILL.md +114 -0
  36. package/assets/skills/contract-driven-delivery/templates/change-classification.md +9 -8
  37. package/assets/skills/contract-driven-delivery/templates/tasks.md +7 -0
  38. package/assets/specs-templates/change-classification.md +9 -8
  39. package/assets/specs-templates/context-manifest.md +49 -0
  40. package/assets/specs-templates/tasks.md +9 -0
  41. package/dist/cli/index.js +1846 -152
  42. package/docs/release-checklist.md +39 -0
  43. package/package.json +12 -6
@@ -1,5 +1,8 @@
1
1
  ---
2
2
  contract: data
3
+ summary: Data schema, invalid-data handling, and row-level compatibility rules.
4
+ owner: application-team
5
+ surface: data
3
6
  schema-version: 0.1.0
4
7
  last-changed: 2026-04-27
5
8
  breaking-change-policy: deprecate-2-minors
@@ -1,5 +1,8 @@
1
1
  ---
2
2
  contract: env
3
+ summary: Environment variable inventory, secret handling, and deployment sync policy.
4
+ owner: platform-team
5
+ surface: runtime-config
3
6
  schema-version: 0.1.0
4
7
  last-changed: 2026-04-27
5
8
  breaking-change-policy: deprecate-2-minors
@@ -14,7 +14,7 @@ change_ids=$(echo "$staged" | grep -oE '^specs/changes/[^/]+' | sort -u | sed 's
14
14
 
15
15
  for id in $change_ids; do
16
16
  echo "[cdd-kit] running gate for change: $id"
17
- if ! cdd-kit gate "$id"; then
17
+ if ! cdd-kit gate "$id" --strict; then
18
18
  echo "[cdd-kit] gate failed for $id — commit rejected."
19
19
  echo "[cdd-kit] fix issues above; --no-verify bypasses but defeats the kit."
20
20
  exit 1
@@ -0,0 +1,150 @@
1
+ ---
2
+ name: cdd-close
3
+ description: Close and archive a completed change. Confirms all tasks are done, promotes durable learnings, then runs cdd-kit archive. Args: <change-id>
4
+ ---
5
+
6
+ # cdd-close — Close and Archive a Change
7
+
8
+ ## Purpose
9
+
10
+ A change is "done" when:
11
+ 1. Gate has passed (`cdd-kit gate <change-id>` exits 0)
12
+ 2. PR is merged (or change is abandoned)
13
+ 3. Durable learnings have been promoted to hot sources: `contracts/`, `CLAUDE.md`, or `CODEX.md`
14
+
15
+ This skill drives steps 2–3 and physically moves the change to `specs/archive/`.
16
+
17
+ ## Hot / Warm / Cold Data Rules
18
+
19
+ - Hot data: `contracts/`, source files, tests, CI config, `CLAUDE.md`, `CODEX.md`.
20
+ - Warm data: the active `specs/changes/<change-id>/` directory while the change is open.
21
+ - Cold data: `specs/archive/` after close.
22
+
23
+ Cold data is historical evidence, not current requirements. Do not promote claims from old specs or archive prose unless they are backed by agent-log evidence, QA evidence, changed contracts, changed tests, or passing gates from this change.
24
+
25
+ ## Input
26
+
27
+ The skill argument is the change-id (e.g., `add-jwt-auth`).
28
+
29
+ If not provided, ask: "Which change-id do you want to close?"
30
+
31
+ ---
32
+
33
+ ## Abandon path
34
+
35
+ If the user wants to **abandon** this change (not close as complete):
36
+
37
+ ```
38
+ cdd-kit abandon <change-id> --reason "<reason>"
39
+ ```
40
+
41
+ This marks `tasks.md` as `status: abandoned` and records it in `specs/archive/INDEX.md`. The directory is preserved for git history. Do NOT run the rest of this skill after abandoning.
42
+
43
+ ---
44
+
45
+ ## Step 1: Confirm gate status
46
+
47
+ Run: `cdd-kit gate <change-id>`
48
+
49
+ If gate fails: stop and report failures. Do NOT archive a change that hasn't passed gate.
50
+
51
+ Exception: if `tasks.md` contains `status: gate-blocked`, ask the user: "This change was gate-blocked. Abandon it? (yes/no)". If yes, run `cdd-kit abandon <change-id> --reason "gate-blocked after 3 attempts"` and stop.
52
+
53
+ ---
54
+
55
+ ## Step 2: Review tasks.md section 7
56
+
57
+ Read `specs/changes/<change-id>/tasks.md`.
58
+
59
+ Check section 7:
60
+ - `7.1 Archive change` — will be ticked after Step 4
61
+ - `7.2 Promote durable learnings to contracts or CLAUDE.md` — must be done NOW
62
+
63
+ If `7.2` is `[ ]`, proceed to Step 2.5. If already `[x]` or `[-]`, skip Steps 2.5 and 3.
64
+
65
+ ---
66
+
67
+ ## Step 2.5: Create archive.md
68
+
69
+ Read only active evidence for this change:
70
+ - `specs/changes/<change-id>/agent-log/` (all log files)
71
+ - `specs/changes/<change-id>/qa-report.md` (if exists)
72
+ - `specs/changes/<change-id>/ci-gates.md`
73
+ - `specs/changes/<change-id>/context-manifest.md`
74
+ - `specs/changes/<change-id>/tasks.md`
75
+
76
+ Do not read `specs/archive/` while closing a change. Historical archives are cold data and must not be used as current requirements.
77
+
78
+ Synthesize a `specs/changes/<change-id>/archive.md` file with:
79
+ - **Change Summary**: 1 paragraph what was changed and why
80
+ - **Final Behavior**: what the system now does differently
81
+ - **Final Contracts Updated**: list from agent-log evidence
82
+ - **Final Tests Added / Updated**: list from agent-log evidence
83
+ - **Final CI/CD Gates**: list from ci-gates.md
84
+ - **Production Reality Findings**: any surprises or deviations from the plan (from qa-reviewer agent-log)
85
+ - **Lessons Promoted to Standards**: (leave blank — to be filled in Step 3)
86
+ - **Follow-up Work**: any known issues deferred
87
+ - **Cold Data Warning**: "This archive is historical evidence. Current requirements live in contracts/ and active project guidance."
88
+
89
+ This file records the close-out evidence, but Step 3 promotion must still be evidence-gated. Archive prose alone is not enough to change hot data.
90
+
91
+ ---
92
+
93
+ ## Step 3: Promote learnings (task 7.2)
94
+
95
+ Read `specs/changes/<change-id>/archive.md` section `## Lessons Promoted to Standards` and cross-check every proposed lesson against agent-log, QA report, contract/test changes, or gate evidence from this change.
96
+
97
+ Classify each candidate:
98
+ - **promote-to-contract**: stable product/system behavior, API/data/env/business/CI rule, compatibility rule, or testable invariant.
99
+ - **promote-to-guidance**: durable workflow guidance for future agents, provider-specific operating instructions, or project-specific agent constraints. Target `CLAUDE.md` and/or `CODEX.md`.
100
+ - **do-not-promote**: one-off implementation detail, abandoned approach, temporary workaround, historical rationale, or anything contradicted by current contracts.
101
+
102
+ If there are lessons to promote, invoke `contract-reviewer` with:
103
+ - The archive.md lessons section
104
+ - Supporting evidence from agent-log / QA / changed contracts / changed tests
105
+ - Instruction: "Review these lessons and propose specific additions only for evidence-backed durable rules. For each lesson, output: classification, target file, target section, proposed text (≤ 5 lines), evidence path, schema-version bump required (yes/no). Reject any cold-data-only or one-off lesson."
106
+
107
+ After contract-reviewer responds:
108
+ 1. Apply each approved contract addition to the contract file (YOU write)
109
+ 2. Apply each approved guidance addition to `CLAUDE.md` and/or `CODEX.md` only if it is provider/project guidance, not product behavior
110
+ 3. Run `cdd-kit validate --contracts` to confirm contract format is preserved
111
+ 4. Run `cdd-kit context-scan` so future classifiers see updated hot context indexes
112
+ 5. Fill in `## Lessons Promoted to Standards` in archive.md with what was promoted, where, and evidence path
113
+ 6. Tick `7.2` in tasks.md
114
+
115
+ If there are no lessons to promote, mark `[-]` for 7.2 with rationale.
116
+
117
+ ---
118
+
119
+ ## Step 4: Archive
120
+
121
+ Run: `cdd-kit archive <change-id>`
122
+
123
+ If successful, tick `7.1` in tasks.md (the file is now in specs/archive/, update it there):
124
+ `specs/archive/<year>/<change-id>/tasks.md` — change `7.1` from `[ ]` to `[x]`.
125
+
126
+ ---
127
+
128
+ ## Step 5: Report
129
+
130
+ ```
131
+ ## /cdd-close complete
132
+
133
+ Change ID: <change-id>
134
+ Archived to: specs/archive/<year>/<change-id>/
135
+ Learnings promoted: <list what was added to contracts/CLAUDE.md/CODEX.md, or "none">
136
+
137
+ specs/changes/<change-id>/ has been removed from the active surface.
138
+ Token cost of future sessions reduced by ~<N> files.
139
+ ```
140
+
141
+ ---
142
+
143
+ ## Rules
144
+
145
+ - NEVER archive before gate passes (unless user explicitly confirms abandoned)
146
+ - NEVER skip Step 3 — lessons rot if not promoted
147
+ - NEVER treat `specs/archive/` as hot requirements
148
+ - NEVER promote a lesson without an evidence path from this change
149
+ - Product behavior belongs in `contracts/`; agent workflow guidance belongs in `CLAUDE.md` and/or `CODEX.md`
150
+ - The archive command is irreversible without git — remind user to commit after archiving
@@ -64,13 +64,15 @@ If no description is provided, ask the user: "Please describe the change you wan
64
64
 
65
65
  ## Artifact opt-in policy
66
66
 
67
- Only create optional artifacts (`current-behavior.md`, `proposal.md`, `spec.md`, `design.md`, `qa-report.md`, `regression-report.md`, `archive.md`) when the classifier's `change-classification.md` explicitly marks them as `yes`.
67
+ Only create optional artifacts (`current-behavior.md`, `proposal.md`, `spec.md`, `design.md`, `qa-report.md`, `regression-report.md`) when the classifier's `change-classification.md` explicitly marks them as `yes`.
68
+
69
+ Note: `archive.md` is created during `/cdd-close`, not during `/cdd-new` — it is not part of the classifier's opt-in surface.
68
70
 
69
71
  If the classifier marks an artifact as `no` or leaves it blank, **do not create the file** — even if a review agent could contribute to it.
70
72
 
71
73
  The 5 always-required artifacts are: `change-request.md`, `change-classification.md`, `test-plan.md`, `ci-gates.md`, `tasks.md`.
72
74
 
73
- ## Step 1: Generate change-id and scaffold
75
+ ## Step 1: Generate change-id, scaffold, and scan context
74
76
 
75
77
  Derive a `change-id` from the description:
76
78
  - kebab-case, max 5 words
@@ -78,9 +80,28 @@ Derive a `change-id` from the description:
78
80
 
79
81
  Check that `specs/changes/<change-id>/` does not already exist. If it does, append `-2` (or next available suffix).
80
82
 
81
- **Create all scaffold files using Write (do NOT run a Python script; do NOT use Edit on pre-existing files):**
83
+ Create the scaffold with the CLI so every provider gets the same templates:
84
+
85
+ ```bash
86
+ cdd-kit new <change-id>
87
+ ```
88
+
89
+ Then build deterministic context indexes before invoking any classifier:
90
+
91
+ ```bash
92
+ cdd-kit context-scan
93
+ ```
94
+
95
+ Verify these files exist:
96
+ - `specs/changes/<change-id>/context-manifest.md`
97
+ - `specs/context/project-map.md`
98
+ - `specs/context/contracts-index.md`
82
99
 
83
- Create `specs/changes/<change-id>/change-request.md` with the user's description filled in:
100
+ Do not use broad search or ad hoc reads to classify the change before `context-scan` has completed.
101
+
102
+ The generated scaffold contains the artifacts below. Fill `change-request.md` with the user's request before invoking the classifier.
103
+
104
+ Update `specs/changes/<change-id>/change-request.md` with the user's description filled in:
84
105
  ```
85
106
  # Change Request: <change-id>
86
107
 
@@ -102,7 +123,7 @@ Create `specs/changes/<change-id>/change-request.md` with the user's description
102
123
  as soon as possible
103
124
  ```
104
125
 
105
- Create `specs/changes/<change-id>/change-classification.md` with blank template:
126
+ `specs/changes/<change-id>/change-classification.md` starts from this blank template:
106
127
  ```
107
128
  # Change Classification
108
129
 
@@ -116,18 +137,25 @@ Create `specs/changes/<change-id>/change-classification.md` with blank template:
116
137
  ## Impact Radius
117
138
  - isolated / module-level / cross-module / system-wide
118
139
 
140
+ ## Tier
141
+ - 0 / 1 / 2 / 3 / 4 / 5
142
+
143
+ ## Architecture Review Required
144
+ - yes / no
145
+ - reason: (fill only if yes)
146
+
119
147
  ## Required Artifacts
120
- | artifact | required | reason |
121
- |---|---:|---|
122
- | current-behavior.md | | |
123
- | proposal.md | | |
124
- | spec.md | | |
125
- | design.md | | |
126
- | contracts.md | | |
127
- | test-plan.md | yes | every implementation change requires test planning |
128
- | ci-gates.md | yes | every implementation change requires CI/CD gate planning |
129
- | qa-report.md | | |
130
- | regression-report.md | | |
148
+ Always required: change-request.md, change-classification.md, test-plan.md, ci-gates.md, tasks.md
149
+
150
+ ## Optional Artifacts (default: no — set yes only with explicit reason)
151
+ | artifact | create? | reason |
152
+ |---|---|---|
153
+ | current-behavior.md | no | |
154
+ | proposal.md | no | |
155
+ | spec.md | no | |
156
+ | design.md | no | |
157
+ | qa-report.md | no | |
158
+ | regression-report.md | no | |
131
159
 
132
160
  ## Required Contracts
133
161
  - API:
@@ -154,28 +182,26 @@ Create `specs/changes/<change-id>/change-classification.md` with blank template:
154
182
  ## Assumptions / Clarifications
155
183
  ```
156
184
 
157
- Create `specs/changes/<change-id>/test-plan.md` with blank template:
185
+ `specs/changes/<change-id>/test-plan.md` starts from this blank template:
158
186
  ```
159
187
  # Test Plan: <change-id>
160
188
 
161
- ## Scope
162
-
163
- ## Unit Tests
164
-
165
- ## Contract Tests
166
-
167
- ## Integration Tests
189
+ ## Acceptance Criteria → Test Mapping
190
+ | criterion id | test family | test file path | tier |
191
+ |---|---|---|---|
168
192
 
169
- ## E2E Tests
170
-
171
- ## Resilience / Data-Boundary Tests
172
-
173
- ## Stress / Soak Tests
193
+ ## Test Families Required
194
+ | family | tier | notes |
195
+ |---|---|---|
196
+ | (unit / contract / integration / e2e / data-boundary / resilience / monkey / stress / soak) | | |
174
197
 
175
198
  ## Out of Scope
199
+
200
+ ## Notes
201
+ (Keep under 10 lines. Implementation detail belongs in the test files themselves.)
176
202
  ```
177
203
 
178
- Create `specs/changes/<change-id>/ci-gates.md` with blank template:
204
+ `specs/changes/<change-id>/ci-gates.md` starts from this blank template:
179
205
  ```
180
206
  # CI Gates: <change-id>
181
207
 
@@ -188,8 +214,17 @@ Create `specs/changes/<change-id>/ci-gates.md` with blank template:
188
214
  ## Promotion Policy
189
215
  ```
190
216
 
191
- Create `specs/changes/<change-id>/tasks.md` with ALL checkboxes unchecked:
217
+ `specs/changes/<change-id>/tasks.md` starts with ALL checkboxes unchecked:
192
218
  ```
219
+ ---
220
+ change-id: <change-id>
221
+ status: in-progress
222
+ context-governance: v1
223
+ depends-on: []
224
+ ---
225
+
226
+ <!-- [x]=done [-]=N/A [ ]=pending -->
227
+
193
228
  # Tasks: <change-id>
194
229
 
195
230
  ## 1. Preparation
@@ -241,16 +276,30 @@ Create `specs/changes/<change-id>/tasks.md` with ALL checkboxes unchecked:
241
276
 
242
277
  Invoke `change-classifier` agent with:
243
278
  - The user's change description
244
- - The project profile at `specs/project-profile.md` (if it exists)
245
- - The existing contracts in `contracts/` (if any)
279
+ - `specs/changes/<change-id>/change-request.md`
280
+ - `specs/changes/<change-id>/context-manifest.md`
281
+ - `specs/context/project-map.md`
282
+ - `specs/context/contracts-index.md`
283
+
284
+ Do not authorize the classifier to read `contracts/`, `src/`, `tests/`, or broad repository search during initial classification. It must use the context indexes to propose candidate paths.
285
+
286
+ The classifier must include a `## Context Manifest Draft` section with:
287
+ - affected surfaces
288
+ - allowed paths for each required agent work packet
289
+ - required contracts
290
+ - required tests
291
+ - any context expansion requests that must be approved before implementation
246
292
 
247
293
  **change-classifier is read-only** — it will return its output as text. After it responds:
248
294
 
249
295
  1. **YOU write** `specs/changes/<change-id>/change-classification.md` — replace the blank template with the classifier's classification output.
250
296
  2. **YOU write** `specs/changes/<change-id>/agent-log/change-classifier.md` — copy the Agent Log block from the classifier's response.
251
- 3. **YOU tick** `tasks.md` item `1.1`.
297
+ 3. **YOU update** `specs/changes/<change-id>/context-manifest.md` from the classifier's `## Context Manifest Draft`.
298
+ 4. **YOU tick** `tasks.md` item `1.1`.
252
299
 
253
- Wait until these three writes are done before continuing.
300
+ Wait until these four writes are done before continuing.
301
+
302
+ **After writing change-classification.md**: read the classifier's `## Tasks Not Applicable` list. For each listed task ID (e.g., `2.2`, `4.2`), update `tasks.md` to change that item from `[ ]` to `[-]`. Do this before invoking any other agent.
254
303
 
255
304
  ---
256
305
 
@@ -264,6 +313,13 @@ Read `change-classification.md` to determine the tier. Then invoke agents **in t
264
313
 
265
314
  If any agent sets `status: blocked` in its log, halt immediately and report the agent's `next-action` to the user — do not proceed to subsequent agents.
266
315
 
316
+ **When invoking any agent, always begin the prompt with:**
317
+ ```
318
+ CURRENT_CHANGE_ID: <change-id>
319
+ Change directory: specs/changes/<change-id>/
320
+ ```
321
+ This ensures the agent's Read scope restriction points to the correct directory.
322
+
267
323
  ---
268
324
 
269
325
  ### Tier 4–5 (low risk: docs, prompts, config-only, no behavior change)
@@ -286,6 +342,7 @@ If any agent sets `status: blocked` in its log, halt immediately and report the
286
342
 
287
343
  2. **`test-strategist`** (write-capable) — writes `specs/changes/<change-id>/test-plan.md` directly.
288
344
  - YOU tick: applicable items in section 3 based on what test families were planned
345
+ - Provide the classifier's `## Inferred Acceptance Criteria` list to test-strategist. These become the `criterion id` column in the Acceptance Criteria → Test Mapping table.
289
346
 
290
347
  3. **`spec-architect`** (write-capable) — only if `change-classification.md` contains `Architecture Review Required: yes`.
291
348
  - YOU tick: `1.3` (if it produced a gate plan)
@@ -422,3 +479,5 @@ Please review the above items and re-run: cdd-kit gate <change-id>
422
479
  ## After Completion
423
480
 
424
481
  The `/cdd-new` workflow is now complete. **Return to normal assistant mode immediately.** Answer any question the user asks — including questions unrelated to this change, new feature discussions, debugging help, or general conversation — without requiring them to use a specific command. The git commit shown in the report is a suggestion, not a required next step; do not wait for it before resuming normal behavior.
482
+
483
+ When the change is merged and ready to close, run `/cdd-close <change-id>` to promote learnings and archive the change directory.
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: cdd-resume
3
+ description: Resume an in-progress change across sessions. Reads tasks.md and agent-log/ to determine where to continue. Args: <change-id>
4
+ ---
5
+
6
+ # cdd-resume — Resume a Change
7
+
8
+ ## Purpose
9
+
10
+ Use when returning to a change after a session break, or when `/cdd-new` was interrupted.
11
+
12
+ ## Input
13
+
14
+ Provide the `change-id`. If unsure, run `cdd-kit list` to see active changes.
15
+
16
+ ---
17
+
18
+ ## Step 0: Detect format version
19
+
20
+ Before reading state, check if `specs/changes/<change-id>/tasks.md` starts with `---` (YAML frontmatter).
21
+
22
+ If it does NOT start with `---`, this change was created with a pre-v1.11 version of cdd-kit. Run:
23
+
24
+ ```
25
+ cdd-kit migrate <change-id>
26
+ ```
27
+
28
+ Then commit the migration:
29
+ ```
30
+ git add specs/changes/<change-id>/tasks.md specs/changes/<change-id>/change-classification.md
31
+ git commit -m "chore: migrate <change-id> to v1.11 format"
32
+ ```
33
+
34
+ If there are many mid-flight changes, suggest `cdd-kit migrate --all` instead.
35
+
36
+ ---
37
+
38
+ ## Step 1: Read current state
39
+
40
+ Read only these state files first:
41
+ - `specs/changes/<change-id>/tasks.md`
42
+ - `specs/changes/<change-id>/context-manifest.md` if present
43
+ - `specs/changes/<change-id>/agent-log/*.md`
44
+ - `specs/changes/<change-id>/change-classification.md`
45
+
46
+ Do not run broad repository search during resume. Do not read `src/`, `tests/`, or `contracts/` unless the current `context-manifest.md` authorizes that path or an approved expansion lists it.
47
+
48
+ From `tasks.md`:
49
+ - Identify all `[x]` (done) items
50
+ - Identify all `[-]` (N/A) items
51
+ - Identify all `[ ]` (pending) items
52
+
53
+ Read `specs/changes/<change-id>/agent-log/` to list which agents have already run.
54
+
55
+ Read `specs/changes/<change-id>/change-classification.md` to recall the tier and required agents.
56
+
57
+ Read `specs/changes/<change-id>/context-manifest.md`:
58
+ - Identify allowed paths and approved expansions.
59
+ - Identify pending Context Expansion Requests.
60
+ - If any request has `status: pending`, stop before invoking agents. Report the request id, requested paths, and reason; ask the user to approve, reject, or narrow it.
61
+ - If `context-manifest.md` is missing on a legacy change, run `cdd-kit migrate <change-id>` before continuing. For context-governed changes, missing manifest is blocking.
62
+
63
+ ---
64
+
65
+ ## Step 2: Report state and ask to continue
66
+
67
+ Output a resume summary:
68
+
69
+ ```
70
+ ## Resume: <change-id>
71
+
72
+ Tier: <tier>
73
+ Status: <in-progress | gate-blocked>
74
+
75
+ Completed agents: <list from agent-log/>
76
+ Pending tasks: <list of [ ] items>
77
+ Pending context expansions: <none | list request ids and paths>
78
+ Allowed context: <short summary from context-manifest.md>
79
+
80
+ Next agent to run: <agent-name> (based on tier flow and what's missing)
81
+ ```
82
+
83
+ Ask the user: "Continue from <next-agent>? (yes/no)"
84
+
85
+ ---
86
+
87
+ ## Step 3: Continue the flow
88
+
89
+ If user confirms, resume from the next agent in the Tier sequence (refer to `/cdd-new` Step 3 for the agent order).
90
+
91
+ **Critical**: Inject this block at the start of every agent prompt:
92
+
93
+ ```
94
+ CURRENT_CHANGE_ID: <change-id>
95
+ Change directory: specs/changes/<change-id>/
96
+ Context manifest: specs/changes/<change-id>/context-manifest.md
97
+ Read only paths allowed by the context manifest and approved expansions.
98
+ If more context is needed, stop and output a Context Expansion Request instead of reading outside the manifest.
99
+ ```
100
+
101
+ Do NOT re-run agents that already have a `status: complete` agent-log.
102
+
103
+ Continue until all required agents are done, then run `cdd-kit gate <change-id>`.
104
+
105
+ ---
106
+
107
+ ## Rules
108
+
109
+ - Never re-run an agent that already has `status: complete` in its agent-log
110
+ - Never start from Step 1 of `/cdd-new` — only resume from the next pending agent
111
+ - Never use broad search to reconstruct state; resume from `tasks.md`, `context-manifest.md`, and `agent-log/`
112
+ - Never continue past pending Context Expansion Requests
113
+ - If tasks.md has `status: abandoned`, report to user and stop
114
+ - If tasks.md has `status: gate-blocked`, go directly to gate retry (max 3)
@@ -10,14 +10,18 @@
10
10
  ## Impact Radius
11
11
  - isolated / module-level / cross-module / system-wide
12
12
 
13
- ## Required Artifacts
13
+ ## Tier
14
+ - 0 / 1 / 2 / 3 / 4 / 5
14
15
 
15
- The following 5 artifacts are always required for implementation changes:
16
- `change-request.md`, `change-classification.md`, `test-plan.md`, `ci-gates.md`, `tasks.md`
16
+ ## Architecture Review Required
17
+ - yes / no
18
+ - reason: (fill only if yes)
17
19
 
18
- Optional artifacts — only create when explicitly needed:
20
+ ## Required Artifacts
21
+ Always required: change-request.md, change-classification.md, test-plan.md, ci-gates.md, tasks.md
19
22
 
20
- | artifact | create? (yes / no) | reason |
23
+ ## Optional Artifacts (default: no — set yes only with explicit reason)
24
+ | artifact | create? | reason |
21
25
  |---|---|---|
22
26
  | current-behavior.md | no | |
23
27
  | proposal.md | no | |
@@ -25,9 +29,6 @@ Optional artifacts — only create when explicitly needed:
25
29
  | design.md | no | |
26
30
  | qa-report.md | no | |
27
31
  | regression-report.md | no | |
28
- | archive.md | no | |
29
-
30
- Default is **no**. Change classifier must explicitly set `yes` with a reason.
31
32
 
32
33
  ## Required Contracts
33
34
  - API:
@@ -1,3 +1,10 @@
1
+ ---
2
+ change-id: <change-id>
3
+ status: in-progress
4
+ ---
5
+
6
+ <!-- [x]=done [-]=N/A [ ]=pending -->
7
+
1
8
  # Tasks
2
9
 
3
10
  ## 1. Preparation
@@ -10,14 +10,18 @@
10
10
  ## Impact Radius
11
11
  - isolated / module-level / cross-module / system-wide
12
12
 
13
- ## Required Artifacts
13
+ ## Tier
14
+ - 0 / 1 / 2 / 3 / 4 / 5
14
15
 
15
- The following 5 artifacts are always required for implementation changes:
16
- `change-request.md`, `change-classification.md`, `test-plan.md`, `ci-gates.md`, `tasks.md`
16
+ ## Architecture Review Required
17
+ - yes / no
18
+ - reason: (fill only if yes)
17
19
 
18
- Optional artifacts — only create when explicitly needed:
20
+ ## Required Artifacts
21
+ Always required: change-request.md, change-classification.md, test-plan.md, ci-gates.md, tasks.md
19
22
 
20
- | artifact | create? (yes / no) | reason |
23
+ ## Optional Artifacts (default: no — set yes only with explicit reason)
24
+ | artifact | create? | reason |
21
25
  |---|---|---|
22
26
  | current-behavior.md | no | |
23
27
  | proposal.md | no | |
@@ -25,9 +29,6 @@ Optional artifacts — only create when explicitly needed:
25
29
  | design.md | no | |
26
30
  | qa-report.md | no | |
27
31
  | regression-report.md | no | |
28
- | archive.md | no | |
29
-
30
- Default is **no**. Change classifier must explicitly set `yes` with a reason.
31
32
 
32
33
  ## Required Contracts
33
34
  - API:
@@ -0,0 +1,49 @@
1
+ # Context Manifest
2
+
3
+ This manifest defines the approved context boundaries for agents working on this change.
4
+
5
+ ## Affected Surfaces
6
+ -
7
+
8
+ ## Allowed Paths
9
+ - specs/changes/<change-id>/
10
+
11
+ ## Forbidden Paths
12
+ - .claude/worktrees/**
13
+ - .git/**
14
+ - node_modules/**
15
+ - dist/**
16
+ - build/**
17
+ - assets/**
18
+ - specs/archive/**
19
+ - specs/changes/* except specs/changes/<change-id>/
20
+
21
+ ## Required Contracts
22
+ -
23
+
24
+ ## Required Tests
25
+ -
26
+
27
+ ## Agent Work Packets
28
+
29
+ ### change-classifier
30
+ - allowed:
31
+ - specs/changes/<change-id>/
32
+ - specs/context/project-map.md
33
+ - specs/context/contracts-index.md
34
+
35
+ ## Context Expansion Requests
36
+
37
+ <!--
38
+ Agents must request context expansion instead of reading outside their work packet.
39
+ Use this format only for real requests:
40
+
41
+ - request-id: CER-001
42
+ requested_paths:
43
+ - src/example.ts
44
+ reason: why this file is required
45
+ status: pending
46
+ -->
47
+
48
+ ## Approved Expansions
49
+ -
@@ -1,3 +1,12 @@
1
+ ---
2
+ change-id: <change-id>
3
+ status: in-progress
4
+ context-governance: v1
5
+ depends-on: []
6
+ ---
7
+
8
+ <!-- [x]=done [-]=N/A [ ]=pending -->
9
+
1
10
  # Tasks
2
11
 
3
12
  ## 1. Preparation