contract-driven-delivery 1.11.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 (39) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/README.md +174 -17
  3. package/assets/CLAUDE.template.md +18 -0
  4. package/assets/CODEX.template.md +39 -0
  5. package/assets/agents/backend-engineer.md +2 -0
  6. package/assets/agents/change-classifier.md +47 -1
  7. package/assets/agents/ci-cd-gatekeeper.md +2 -0
  8. package/assets/agents/contract-reviewer.md +2 -0
  9. package/assets/agents/dependency-security-reviewer.md +2 -0
  10. package/assets/agents/e2e-resilience-engineer.md +2 -0
  11. package/assets/agents/frontend-engineer.md +2 -0
  12. package/assets/agents/monkey-test-engineer.md +2 -0
  13. package/assets/agents/qa-reviewer.md +2 -0
  14. package/assets/agents/repo-context-scanner.md +2 -0
  15. package/assets/agents/spec-architect.md +2 -0
  16. package/assets/agents/spec-drift-auditor.md +2 -0
  17. package/assets/agents/stress-soak-engineer.md +2 -0
  18. package/assets/agents/test-strategist.md +2 -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/skills/cdd-close/SKILL.md +37 -10
  33. package/assets/skills/cdd-new/SKILL.md +44 -11
  34. package/assets/skills/cdd-resume/SKILL.md +30 -2
  35. package/assets/specs-templates/context-manifest.md +49 -0
  36. package/assets/specs-templates/tasks.md +2 -0
  37. package/dist/cli/index.js +1508 -256
  38. package/docs/release-checklist.md +39 -0
  39. package/package.json +6 -3
@@ -0,0 +1,25 @@
1
+ {
2
+ "forbiddenPaths": [
3
+ ".claude/worktrees/**",
4
+ ".git/**",
5
+ "node_modules/**",
6
+ "dist/**",
7
+ "build/**",
8
+ "assets/**",
9
+ "specs/archive/**",
10
+ "specs/changes/*"
11
+ ],
12
+ "contextExpansion": {
13
+ "mode": "auto-safe",
14
+ "autoApprovePatterns": [
15
+ "src/**",
16
+ "tests/**",
17
+ "contracts/**",
18
+ "specs/changes/<current-change-id>/**"
19
+ ]
20
+ },
21
+ "audit": {
22
+ "requireFilesRead": true,
23
+ "unknownFilesRead": "warn-for-legacy-fail-for-new"
24
+ }
25
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "provider": "claude",
3
+ "generated_at": null,
4
+ "roles": {}
5
+ }
@@ -1,5 +1,8 @@
1
1
  ---
2
2
  contract: api
3
+ summary: API behavior, compatibility rules, and endpoint contract requirements.
4
+ owner: application-team
5
+ surface: api
3
6
  schema-version: 0.1.0
4
7
  last-changed: 2026-04-27
5
8
  breaking-change-policy: deprecate-2-minors
@@ -1,3 +1,10 @@
1
+ ---
2
+ contract: api-inventory
3
+ summary: Endpoint inventory categories and ownership map for non-standard API surfaces.
4
+ owner: application-team
5
+ surface: api
6
+ ---
7
+
1
8
  # API Inventory
2
9
 
3
10
  | method | path | category | owner | contract test | notes |
@@ -1,3 +1,10 @@
1
+ ---
2
+ contract: api-error-format
3
+ summary: Standard error payload shape, safety rules, and reusable error code table.
4
+ owner: application-team
5
+ surface: api
6
+ ---
7
+
1
8
  # API Error Format
2
9
 
3
10
  ## Standard Error Shape
@@ -1,5 +1,8 @@
1
1
  ---
2
2
  contract: business
3
+ summary: Business decision tables, rule inventory, and change policy for behavior updates.
4
+ owner: application-team
5
+ surface: domain-behavior
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: ci
3
+ summary: CI gate inventory, artifact retention, and rollback requirements.
4
+ owner: platform-team
5
+ surface: delivery-pipeline
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: css
3
+ summary: UI token policy, component styling rules, and visual review constraints.
4
+ owner: application-team
5
+ surface: ui
3
6
  schema-version: 0.1.0
4
7
  last-changed: 2026-04-27
5
8
  breaking-change-policy: deprecate-2-minors
@@ -1,3 +1,10 @@
1
+ ---
2
+ contract: design-tokens
3
+ summary: Canonical design token inventory for colors, spacing, typography, and layering.
4
+ owner: design-system
5
+ surface: ui
6
+ ---
7
+
1
8
  # Design Tokens
2
9
 
3
10
  ## Colors
@@ -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
@@ -10,10 +10,18 @@ description: Close and archive a completed change. Confirms all tasks are done,
10
10
  A change is "done" when:
11
11
  1. Gate has passed (`cdd-kit gate <change-id>` exits 0)
12
12
  2. PR is merged (or change is abandoned)
13
- 3. Durable learnings have been promoted to `contracts/` or `CLAUDE.md`
13
+ 3. Durable learnings have been promoted to hot sources: `contracts/`, `CLAUDE.md`, or `CODEX.md`
14
14
 
15
15
  This skill drives steps 2–3 and physically moves the change to `specs/archive/`.
16
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
+
17
25
  ## Input
18
26
 
19
27
  The skill argument is the change-id (e.g., `add-jwt-auth`).
@@ -58,7 +66,14 @@ If `7.2` is `[ ]`, proceed to Step 2.5. If already `[x]` or `[-]`, skip Steps 2.
58
66
 
59
67
  ## Step 2.5: Create archive.md
60
68
 
61
- Read `specs/changes/<change-id>/agent-log/` (all log files) and `specs/changes/<change-id>/qa-report.md` (if exists).
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.
62
77
 
63
78
  Synthesize a `specs/changes/<change-id>/archive.md` file with:
64
79
  - **Change Summary**: 1 paragraph what was changed and why
@@ -69,24 +84,33 @@ Synthesize a `specs/changes/<change-id>/archive.md` file with:
69
84
  - **Production Reality Findings**: any surprises or deviations from the plan (from qa-reviewer agent-log)
70
85
  - **Lessons Promoted to Standards**: (leave blank — to be filled in Step 3)
71
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."
72
88
 
73
- This file is the source for Step 3's learning promotion.
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.
74
90
 
75
91
  ---
76
92
 
77
93
  ## Step 3: Promote learnings (task 7.2)
78
94
 
79
- Read `specs/changes/<change-id>/archive.md` section `## Lessons Promoted to Standards`.
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.
80
101
 
81
102
  If there are lessons to promote, invoke `contract-reviewer` with:
82
103
  - The archive.md lessons section
83
- - Instruction: "Review these lessons and propose specific additions to the relevant contract files. For each lesson, output: target file, target section, proposed text (≤ 5 lines), schema-version bump required (yes/no)."
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."
84
106
 
85
107
  After contract-reviewer responds:
86
- 1. Apply each proposed addition to the contract file (YOU write)
87
- 2. Run `cdd-kit validate --contracts` to confirm format is preserved
88
- 3. Fill in `## Lessons Promoted to Standards` in archive.md with what was promoted
89
- 4. Tick `7.2` in tasks.md
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
90
114
 
91
115
  If there are no lessons to promote, mark `[-]` for 7.2 with rationale.
92
116
 
@@ -108,7 +132,7 @@ If successful, tick `7.1` in tasks.md (the file is now in specs/archive/, update
108
132
 
109
133
  Change ID: <change-id>
110
134
  Archived to: specs/archive/<year>/<change-id>/
111
- Learnings promoted: <list what was added to contracts/CLAUDE.md, or "none">
135
+ Learnings promoted: <list what was added to contracts/CLAUDE.md/CODEX.md, or "none">
112
136
 
113
137
  specs/changes/<change-id>/ has been removed from the active surface.
114
138
  Token cost of future sessions reduced by ~<N> files.
@@ -120,4 +144,7 @@ Token cost of future sessions reduced by ~<N> files.
120
144
 
121
145
  - NEVER archive before gate passes (unless user explicitly confirms abandoned)
122
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`
123
150
  - The archive command is irreversible without git — remind user to commit after archiving
@@ -72,7 +72,7 @@ If the classifier marks an artifact as `no` or leaves it blank, **do not create
72
72
 
73
73
  The 5 always-required artifacts are: `change-request.md`, `change-classification.md`, `test-plan.md`, `ci-gates.md`, `tasks.md`.
74
74
 
75
- ## Step 1: Generate change-id and scaffold
75
+ ## Step 1: Generate change-id, scaffold, and scan context
76
76
 
77
77
  Derive a `change-id` from the description:
78
78
  - kebab-case, max 5 words
@@ -80,9 +80,28 @@ Derive a `change-id` from the description:
80
80
 
81
81
  Check that `specs/changes/<change-id>/` does not already exist. If it does, append `-2` (or next available suffix).
82
82
 
83
- **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
84
 
85
- Create `specs/changes/<change-id>/change-request.md` with the user's description filled in:
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`
99
+
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:
86
105
  ```
87
106
  # Change Request: <change-id>
88
107
 
@@ -104,7 +123,7 @@ Create `specs/changes/<change-id>/change-request.md` with the user's description
104
123
  as soon as possible
105
124
  ```
106
125
 
107
- Create `specs/changes/<change-id>/change-classification.md` with blank template:
126
+ `specs/changes/<change-id>/change-classification.md` starts from this blank template:
108
127
  ```
109
128
  # Change Classification
110
129
 
@@ -163,7 +182,7 @@ Always required: change-request.md, change-classification.md, test-plan.md, ci-g
163
182
  ## Assumptions / Clarifications
164
183
  ```
165
184
 
166
- Create `specs/changes/<change-id>/test-plan.md` with blank template:
185
+ `specs/changes/<change-id>/test-plan.md` starts from this blank template:
167
186
  ```
168
187
  # Test Plan: <change-id>
169
188
 
@@ -182,7 +201,7 @@ Create `specs/changes/<change-id>/test-plan.md` with blank template:
182
201
  (Keep under 10 lines. Implementation detail belongs in the test files themselves.)
183
202
  ```
184
203
 
185
- Create `specs/changes/<change-id>/ci-gates.md` with blank template:
204
+ `specs/changes/<change-id>/ci-gates.md` starts from this blank template:
186
205
  ```
187
206
  # CI Gates: <change-id>
188
207
 
@@ -195,11 +214,13 @@ Create `specs/changes/<change-id>/ci-gates.md` with blank template:
195
214
  ## Promotion Policy
196
215
  ```
197
216
 
198
- Create `specs/changes/<change-id>/tasks.md` with ALL checkboxes unchecked:
217
+ `specs/changes/<change-id>/tasks.md` starts with ALL checkboxes unchecked:
199
218
  ```
200
219
  ---
201
220
  change-id: <change-id>
202
221
  status: in-progress
222
+ context-governance: v1
223
+ depends-on: []
203
224
  ---
204
225
 
205
226
  <!-- [x]=done [-]=N/A [ ]=pending -->
@@ -255,16 +276,28 @@ status: in-progress
255
276
 
256
277
  Invoke `change-classifier` agent with:
257
278
  - The user's change description
258
- - The project profile at `specs/project-profile.md` (if it exists)
259
- - 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
260
292
 
261
293
  **change-classifier is read-only** — it will return its output as text. After it responds:
262
294
 
263
295
  1. **YOU write** `specs/changes/<change-id>/change-classification.md` — replace the blank template with the classifier's classification output.
264
296
  2. **YOU write** `specs/changes/<change-id>/agent-log/change-classifier.md` — copy the Agent Log block from the classifier's response.
265
- 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`.
266
299
 
267
- Wait until these three writes are done before continuing.
300
+ Wait until these four writes are done before continuing.
268
301
 
269
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.
270
303
 
@@ -37,7 +37,15 @@ If there are many mid-flight changes, suggest `cdd-kit migrate --all` instead.
37
37
 
38
38
  ## Step 1: Read current state
39
39
 
40
- Read `specs/changes/<change-id>/tasks.md`:
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`:
41
49
  - Identify all `[x]` (done) items
42
50
  - Identify all `[-]` (N/A) items
43
51
  - Identify all `[ ]` (pending) items
@@ -46,6 +54,12 @@ Read `specs/changes/<change-id>/agent-log/` to list which agents have already ru
46
54
 
47
55
  Read `specs/changes/<change-id>/change-classification.md` to recall the tier and required agents.
48
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
+
49
63
  ---
50
64
 
51
65
  ## Step 2: Report state and ask to continue
@@ -60,6 +74,8 @@ Status: <in-progress | gate-blocked>
60
74
 
61
75
  Completed agents: <list from agent-log/>
62
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>
63
79
 
64
80
  Next agent to run: <agent-name> (based on tier flow and what's missing)
65
81
  ```
@@ -72,7 +88,17 @@ Ask the user: "Continue from <next-agent>? (yes/no)"
72
88
 
73
89
  If user confirms, resume from the next agent in the Tier sequence (refer to `/cdd-new` Step 3 for the agent order).
74
90
 
75
- **Critical**: Inject `CURRENT_CHANGE_ID: <change-id>` at the start of every agent prompt. Do NOT re-run agents that already have a `status: complete` agent-log.
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.
76
102
 
77
103
  Continue until all required agents are done, then run `cdd-kit gate <change-id>`.
78
104
 
@@ -82,5 +108,7 @@ Continue until all required agents are done, then run `cdd-kit gate <change-id>`
82
108
 
83
109
  - Never re-run an agent that already has `status: complete` in its agent-log
84
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
85
113
  - If tasks.md has `status: abandoned`, report to user and stop
86
114
  - If tasks.md has `status: gate-blocked`, go directly to gate retry (max 3)
@@ -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,6 +1,8 @@
1
1
  ---
2
2
  change-id: <change-id>
3
3
  status: in-progress
4
+ context-governance: v1
5
+ depends-on: []
4
6
  ---
5
7
 
6
8
  <!-- [x]=done [-]=N/A [ ]=pending -->