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
package/CHANGELOG.md ADDED
@@ -0,0 +1,72 @@
1
+ # Changelog
2
+
3
+ ## [1.12.0] - 2026-04-29
4
+
5
+ ### Added
6
+ - `cdd-kit doctor --json` for CI and machine-readable repository health checks.
7
+ - `cdd-kit upgrade --migrate-changes [--enable-context-governance]` to combine repo-level upgrade work with legacy change migration.
8
+ - `cdd-kit context request`, `cdd-kit context reject`, and `cdd-kit context list [--json]` for a fuller context expansion workflow.
9
+
10
+ ### Changed
11
+ - Default contract templates now include deterministic `summary`, `owner`, and `surface` metadata so fresh repos do not start with avoidable `contracts-index` warnings.
12
+ - `cdd-kit context-scan` now excludes `contracts/CHANGELOG.md` from the contracts index.
13
+ - Shared provider inference is now reused by `update`, `doctor`, and `upgrade`.
14
+ - Migration messaging now refers to the current cdd-kit format instead of pinning docs to one release number.
15
+
16
+ ### Docs
17
+ - README now includes production rollout guidance for old repos, with separate migration paths for completed specs and in-progress specs.
18
+ - Release checklist now covers `doctor --json`, `upgrade --migrate-changes`, and post-upgrade context governance decisions.
19
+
20
+ ## [1.11.0] - 2026-04-28
21
+
22
+ ### Added
23
+ - Context Governance v1 for new changes: `context-manifest.md`, `files-read` audit expectations, default forbidden paths, and legacy-vs-new gate behavior.
24
+ - Provider adapter scaffold for Claude Code and Codex: `init --provider claude|codex|both`, provider-aware `update`, and `.cdd/model-policy.json`.
25
+ - `cdd-kit context-scan`: deterministic `specs/context/project-map.md` and `specs/context/contracts-index.md` indexes for lower-token classification.
26
+ - `cdd-kit doctor`: repo health checks for missing config, provider guidance, stale context indexes, and contract summary gaps.
27
+ - `cdd-kit upgrade`: dry-run-first repo-level upgrade command that adds missing cdd-kit files without overwriting existing project guidance or contracts.
28
+ - `cdd-kit context approve <change-id> <request-id>`: approves pending expansion requests and records approved paths in the manifest.
29
+ - Atomic change dependencies with `cdd-kit new --depends-on` and gate blocking until upstream changes complete or archive.
30
+ - `/cdd-new`, `/cdd-resume`, and `/cdd-close` prompt hardening for manifest-scoped reads, hot/warm/cold data handling, and context index usage.
31
+
32
+ ### Changed
33
+ - `cdd-kit migrate` can add legacy or context-governed manifests and opt old changes into `context-governance: v1`.
34
+ - README now describes provider-neutral usage, context governance, upgrade flow, and context expansion approval.
35
+
36
+ ### Notes
37
+ - Context Governance audits and discourages unauthorized reads. It is not a runtime sandbox and still depends on agent-log evidence plus gate review.
38
+
39
+ ## [1.10.0] - 2026-04-27
40
+
41
+ ### Added
42
+ - `cdd-kit gate --strict`: pending `[ ]` tasks are errors in strict mode; pre-commit hook now uses `--strict` by default. Section-7 archive tasks (7.1, 7.2) are exempt.
43
+ - `cdd-kit gate`: artifact pointer validation in strict mode. Each path listed under `- artifacts:` in agent logs is verified to exist on disk.
44
+ - `cdd-kit gate`: tier-based agent-log requirements. Tier 0-1 changes must have `e2e-resilience-engineer`, `monkey-test-engineer`, and `stress-soak-engineer` logs; Tier 0-3 must have `contract-reviewer` and `qa-reviewer`.
45
+ - `cdd-kit gate`: differentiated minimum char counts per artifact (change-classification and test-plan >= 200, ci-gates >= 150, others >= 100).
46
+ - `cdd-kit gate`: scoped validate call to `--contracts --env --ci --versions`.
47
+ - `cdd-kit abandon <change-id> --reason <text>`: marks a change as abandoned in `tasks.md` and records it in `specs/archive/INDEX.md`.
48
+ - `cdd-kit archive <change-id>`: moves a completed change from `specs/changes/` to `specs/archive/<year>/`.
49
+ - `/cdd-close` skill synthesizes `archive.md` from `agent-log/` and `qa-report.md` before archiving, then invokes `contract-reviewer` for durable promotion diffs.
50
+ - `/cdd-resume` resumes an in-progress change across sessions by reading `tasks.md` and `agent-log/` to determine the next pending agent.
51
+ - `change-classifier` now outputs `## Inferred Acceptance Criteria` and `## Tasks Not Applicable`.
52
+ - All agents require `CURRENT_CHANGE_ID: <id>` in every prompt.
53
+ - `cdd-new` injects `CURRENT_CHANGE_ID` into every agent call, auto-marks N/A tasks with `[-]`, and passes acceptance criteria to `test-strategist`.
54
+ - `cdd-kit migrate <change-id> | --all [--dry-run]`: upgrades existing change directories from pre-v1.11 format. Adds YAML frontmatter plus `[x]/[-]/[ ]` legend to `tasks.md`; converts old `**Tier:** Tier N` to `## Tier\n- N`.
55
+
56
+ ### Fixed
57
+ - Tier detection regex tightened to avoid matching unfilled classifier templates.
58
+ - Agent read-scope placeholder `<current-change-id>` replaced with runtime `CURRENT_CHANGE_ID` injection.
59
+ - `archive.md` removed from `/cdd-new` opt-in surface because it is synthesized at close time.
60
+
61
+ ## [1.0.1] - 2026-04-20
62
+
63
+ ### Fixed
64
+ - CLI binary renamed from `cdd` to `cdd-kit` for npm uniqueness.
65
+ - Corrected bin path format for npm 11.x compatibility.
66
+
67
+ ## [1.0.0] - 2026-04-20
68
+
69
+ ### Added
70
+ - Initial release of the contract-driven-delivery CLI (`cdd-kit`).
71
+ - Commands: `init`, `new`, `gate`, `validate`, `detect-stack`.
72
+ - Tier-based change classification, contract scaffolding, and agent-log validation.
package/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # Contract-Driven Delivery Kit
2
2
 
3
- **cdd-kit** is a Claude Code development kit that turns AI agents into a disciplined engineering team: contracts-first, test-first, spec-first. Every change goes through classification, contract review, TDD, implementation, and gate verification — automatically orchestrated by Claude Code skills.
3
+ **cdd-kit** is a contract-driven delivery kit for AI coding agents. It started with Claude Code skills and now keeps the core workflow provider-neutral: contracts-first, test-first, spec-first. Every change goes through classification, contract review, TDD, implementation, and gate verification.
4
4
 
5
5
  Designed for solo developers and small teams building brownfield production systems (dashboards, APIs, workflow tools, data apps) who want AI to do all the implementation while they stay in the spec-author and reviewer seat.
6
6
 
7
+ **Context Governance v1** adds a manifest-driven audit layer for AI agents. New changes include `context-manifest.md`, `agent-log` entries are expected to report `files-read`, and `cdd-kit gate` audits those reads against allowed and forbidden paths. This is governance and review support, not a sandbox.
8
+
7
9
  ---
8
10
 
9
11
  ## Install
@@ -212,22 +214,60 @@ Installs agents and skill into `~/.claude` and scaffolds project files.
212
214
  cdd-kit init # global + local (recommended)
213
215
  cdd-kit init --global-only # only install into ~/.claude
214
216
  cdd-kit init --local-only # only scaffold project files
217
+ cdd-kit init --provider codex # scaffold Codex-oriented project guidance
218
+ cdd-kit init --provider both # scaffold Claude Code + Codex guidance
215
219
  cdd-kit init --force # overwrite existing project files
216
220
  ```
217
221
 
218
- Creates: `contracts/`, `specs/templates/`, `CLAUDE.md`, `AGENTS.md`, `hooks/`
222
+ Creates: `contracts/`, `specs/templates/`, provider guidance files (`CLAUDE.md`, `AGENTS.md`, and/or `CODEX.md`), `hooks/`
219
223
 
220
224
  ---
221
225
 
222
226
  ### `cdd-kit update`
223
227
 
224
- Updates agents and skill in `~/.claude` to the latest installed version. Does not touch `contracts/` or `CLAUDE.md`.
228
+ Updates provider assets to the latest installed version. By default, `update` reads `.cdd/model-policy.json` and updates only the matching provider adapter. It does not overwrite project guidance files such as `CLAUDE.md`, `AGENTS.md`, or `CODEX.md`.
225
229
 
226
230
  ```bash
227
231
  cdd-kit update
228
232
  cdd-kit update --yes # apply without confirmation
233
+ cdd-kit update --provider codex
234
+ cdd-kit update --provider both
229
235
  ```
230
236
 
237
+ Codex currently has no global assets to update, so Codex-only projects report that they are already up to date. Run `cdd-kit init --local-only --provider codex` if a project is missing `CODEX.md`.
238
+
239
+ ---
240
+
241
+ ### `cdd-kit doctor`
242
+
243
+ Inspects repo-level cdd-kit health without writing files.
244
+
245
+ ```bash
246
+ cdd-kit doctor
247
+ cdd-kit doctor --strict
248
+ cdd-kit doctor --json
249
+ cdd-kit doctor --provider codex
250
+ ```
251
+
252
+ Checks for missing `.cdd/` policy files, provider guidance (`CLAUDE.md`, `AGENTS.md`, `CODEX.md`), context indexes, stale `specs/context/*` outputs, and contract summary metadata gaps. `--strict` treats warnings as errors. `--json` emits a machine-readable report for CI or wrapper scripts.
253
+
254
+ ---
255
+
256
+ ### `cdd-kit upgrade`
257
+
258
+ Adds missing repo-level cdd-kit files after upgrading the npm package. It preserves existing contracts and guidance files; default mode is a dry run.
259
+
260
+ ```bash
261
+ cdd-kit upgrade
262
+ cdd-kit upgrade --yes
263
+ cdd-kit upgrade --yes --migrate-changes
264
+ cdd-kit upgrade --yes --migrate-changes --enable-context-governance
265
+ cdd-kit upgrade --provider codex --yes
266
+ cdd-kit upgrade --provider both --yes
267
+ ```
268
+
269
+ Use this for old repos that already have `contracts/` or `specs/` but are missing new assets such as `.cdd/context-policy.json`, `.cdd/model-policy.json`, `CODEX.md`, or newer templates. Add `--migrate-changes` if you also want to upgrade existing `specs/changes/<change-id>/` directories in the same run.
270
+
231
271
  ---
232
272
 
233
273
  ### `cdd-kit gate <change-id>`
@@ -240,10 +280,12 @@ cdd-kit gate add-jwt-auth --strict
240
280
  ```
241
281
 
242
282
  Checks:
243
- - All 5 required artifacts exist (`change-request.md`, `change-classification.md`, `test-plan.md`, `ci-gates.md`, `tasks.md`)
283
+ - All required artifacts exist (`change-request.md`, `change-classification.md`, `test-plan.md`, `ci-gates.md`, `tasks.md`; new context-governed changes also require `context-manifest.md`)
244
284
  - Each artifact has sufficient content (not a stub): change-classification ≥ 200 chars, test-plan ≥ 200, ci-gates ≥ 150, others ≥ 100
245
285
  - `change-classification.md` contains a tier or risk marker
246
286
  - `agent-log/*.md` files all have `status: complete` (not blocked)
287
+ - For context-governed changes, `agent-log/*.md` files include a structured `- files-read:` list and those repo-relative paths are audited against `context-manifest.md` and `.cdd/context-policy.json`
288
+ - Atomic `depends-on` upstream changes are completed or archived before dependent work gates
247
289
  - Tier 0–1 changes have `e2e-resilience-engineer`, `monkey-test-engineer`, and `stress-soak-engineer` logs
248
290
  - Tier 0–3 changes have `contract-reviewer` and `qa-reviewer` logs
249
291
  - All contract validators pass
@@ -251,6 +293,7 @@ Checks:
251
293
  `--strict` additionally:
252
294
  - Treats any pending `[ ]` tasks (except section 7 archive items) as errors
253
295
  - Validates that every file path listed in `agent-log` artifact pointers actually exists on disk
296
+ - Treats legacy changes missing `context-manifest.md` or `files-read` audit data as errors
254
297
 
255
298
  Pre-commit hook uses `--strict` by default (installed via `cdd-kit install-hooks`).
256
299
 
@@ -315,18 +358,76 @@ Upgrades pre-v1.11.0 change directories to the current format.
315
358
  cdd-kit migrate add-jwt-auth # migrate one change
316
359
  cdd-kit migrate --all # migrate all changes in specs/changes/
317
360
  cdd-kit migrate --all --dry-run # preview without writing
361
+ cdd-kit migrate --all --enable-context-governance
318
362
  ```
319
363
 
320
364
  What it upgrades:
321
365
  - `tasks.md`: adds YAML frontmatter (`change-id`, `status: in-progress`) and `[x]/[-]/[ ]` legend if missing
322
366
  - `change-classification.md`: detects old `**Tier:** Tier N` format and appends the new `## Tier\n- N` section so tier-based gate checks activate
367
+ - `context-manifest.md`: adds a legacy manifest scaffold by default so old changes can continue with warning-only context audit behavior
368
+ - `--enable-context-governance`: explicitly adds `context-governance: v1` and a context-governed manifest scaffold, making missing manifest or malformed `files-read` data hard gate failures
369
+
370
+ `agent-log/*.md` must use this `files-read` format for context-governed changes:
371
+
372
+ ```md
373
+ - files-read:
374
+ - contracts/api/api-contract.md
375
+ - src/server/routes/users.ts
376
+ ```
377
+
378
+ Paths must be repo-relative. Absolute paths and `..` parent traversal are rejected.
323
379
 
324
380
  Run this after upgrading from v1.10 or earlier if you have mid-flight changes.
325
381
 
326
382
  ```bash
327
383
  cdd-kit migrate --all
328
384
  git add specs/changes/
329
- git commit -m "chore: migrate changes to v1.11.0 format"
385
+ git commit -m "chore: migrate changes to current cdd-kit format"
386
+ ```
387
+
388
+ ---
389
+
390
+ ### `cdd-kit context request <change-id> <request-id>`
391
+
392
+ Records a pending Context Expansion Request in `context-manifest.md`.
393
+
394
+ ```bash
395
+ cdd-kit context request add-jwt-auth CER-001 --path src/server/users.ts tests/users.test.ts --reason "paired implementation and regression coverage"
396
+ ```
397
+
398
+ Use this when an agent needs more context than its current work packet allows.
399
+
400
+ ---
401
+
402
+ ### `cdd-kit context approve <change-id> <request-id>`
403
+
404
+ Approves a pending Context Expansion Request in `context-manifest.md` and adds its `requested_paths` to `## Approved Expansions`.
405
+
406
+ ```bash
407
+ cdd-kit context approve add-jwt-auth CER-001
408
+ ```
409
+
410
+ This keeps expansion history explicit while avoiding manual manifest editing. Agents still have to report `files-read` in `agent-log/*.md`; `cdd-kit gate` audits those paths against the manifest.
411
+
412
+ ---
413
+
414
+ ### `cdd-kit context reject <change-id> <request-id>`
415
+
416
+ Rejects a pending Context Expansion Request and records `status: rejected` in the manifest.
417
+
418
+ ```bash
419
+ cdd-kit context reject add-jwt-auth CER-001
420
+ ```
421
+
422
+ ---
423
+
424
+ ### `cdd-kit context list <change-id>`
425
+
426
+ Lists all Context Expansion Requests for a change.
427
+
428
+ ```bash
429
+ cdd-kit context list add-jwt-auth
430
+ cdd-kit context list add-jwt-auth --json
330
431
  ```
331
432
 
332
433
  ---
@@ -354,8 +455,11 @@ Scaffolds an empty change directory. Normally you use `/cdd-new` (the Claude Cod
354
455
  cdd-kit new add-user-auth
355
456
  cdd-kit new add-user-auth --all # include optional templates too
356
457
  cdd-kit new add-user-auth --force # overwrite existing directory
458
+ cdd-kit new add-user-api --depends-on add-user-db
357
459
  ```
358
460
 
461
+ For larger requests, split the work into atomic changes on the same feature branch and use `--depends-on` to record upstream order. `cdd-kit gate` blocks a dependent change until each upstream change is either archived or has `status: completed` in its `tasks.md` frontmatter.
462
+
359
463
  ---
360
464
 
361
465
  ### `cdd-kit install-hooks`
@@ -396,25 +500,77 @@ cdd-kit detect-stack
396
500
 
397
501
  ---
398
502
 
399
- ## Upgrading from v1.10 or earlier
503
+ ### `cdd-kit context-scan`
504
+
505
+ Builds deterministic, low-token context indexes for classifiers and orchestrators.
506
+
507
+ ```bash
508
+ cdd-kit context-scan
509
+ ```
510
+
511
+ Outputs:
512
+ - `specs/context/project-map.md`: ASCII directory tree with schema metadata, visible file/dir counts, and excluded paths from `.cdd/context-policy.json`
513
+ - `specs/context/contracts-index.md`: contract inventory table plus deterministic details from YAML frontmatter or `<!-- cdd: ... -->` metadata
514
+
515
+ Recommended contract metadata:
516
+
517
+ ```yaml
518
+ ---
519
+ contract: api
520
+ summary: User API endpoint rules and compatibility policy.
521
+ owner: backend-team
522
+ surface: user-management
523
+ ---
524
+ ```
525
+
526
+ The classifier should read these two files before proposing `context-manifest.md` allowed paths.
527
+
528
+ ---
529
+
530
+ ## Migrating an Older Production Repo
400
531
 
401
532
  ```bash
402
533
  npm update -g contract-driven-delivery
403
- cdd-kit update
534
+ cdd-kit upgrade --yes
535
+ cdd-kit context-scan
536
+ cdd-kit doctor --strict
537
+ ```
538
+
539
+ ### Old completed specs
540
+
541
+ If a change is already finished, merged, or only kept for audit/history:
404
542
 
405
- # If you have mid-flight changes:
543
+ ```bash
406
544
  cdd-kit migrate --all
407
545
  git add specs/changes/
408
- git commit -m "chore: migrate changes to v1.11.0 format"
546
+ git commit -m "chore: migrate changes to current cdd-kit format"
547
+ ```
548
+
549
+ This gives those legacy specs the new `tasks.md` frontmatter, tier markers, and a warning-mode `context-manifest.md` without forcing strict context governance on closed work.
550
+
551
+ ### Old in-progress specs
552
+
553
+ If a change is still being actively developed:
554
+
555
+ ```bash
556
+ cdd-kit upgrade --yes --migrate-changes
557
+ cdd-kit context-scan
558
+ cdd-kit doctor --strict
409
559
  ```
410
560
 
411
- **What changed in v1.11.0:**
412
- - `gate --strict` and pre-commit enforcement
413
- - Tier-based agent-log requirements (Tier 0–1 must have E2E/monkey/stress logs)
414
- - `cdd-kit abandon`, `cdd-kit archive`, `cdd-kit list`, `cdd-kit migrate` commands
415
- - `/cdd-resume` and `/cdd-close` Claude Code skills
416
- - `change-classifier` outputs Acceptance Criteria + Tasks Not Applicable
417
- - All agents require `CURRENT_CHANGE_ID` injection (handled automatically by skills)
561
+ Then choose one path per active change:
562
+
563
+ - Conservative path: keep the migrated legacy manifest, resume work, and let `gate` warn on missing `files-read` data while the team transitions.
564
+ - Strict path: run `cdd-kit migrate <change-id> --enable-context-governance`, review `context-manifest.md`, narrow `Allowed Paths`, and require agents to report `- files-read:` before continuing implementation.
565
+
566
+ ### Recommended rollout for production repos already burned by token overuse
567
+
568
+ 1. Run `cdd-kit upgrade --yes` once per repo after updating the npm package.
569
+ 2. Run `cdd-kit context-scan` so classifiers can read `specs/context/project-map.md` and `specs/context/contracts-index.md` instead of broad repo searches.
570
+ 3. Run `cdd-kit doctor --strict` in CI.
571
+ 4. Migrate old completed specs with plain `cdd-kit migrate`.
572
+ 5. Migrate active specs with `cdd-kit migrate --enable-context-governance` only after reviewing the generated manifest.
573
+ 6. Teach agents to use `cdd-kit context request/approve/reject/list` instead of silently widening context.
418
574
 
419
575
  ---
420
576
 
@@ -445,7 +601,8 @@ your-repo/
445
601
  │ └── templates/
446
602
  ├── tests/
447
603
  ├── CLAUDE.md ← Claude's project guide (edit this)
448
- └── AGENTS.md ← agent roster (auto-managed)
604
+ ├── AGENTS.md ← agent roster (auto-managed)
605
+ └── CODEX.md ← Codex project guide when initialized for Codex
449
606
  ```
450
607
 
451
608
  ---
@@ -40,3 +40,21 @@ This repository follows the Contract-Driven Delivery workflow.
40
40
  | `cdd-kit detect-stack` | detect the project tech stack |
41
41
 
42
42
  Run `cdd-kit detect-stack` to verify the detected tech stack.
43
+
44
+ ## Context Governance
45
+
46
+ For context-governed changes, read `specs/changes/<change-id>/context-manifest.md` before using file-reading or broad search tools.
47
+
48
+ - Read only paths allowed by the manifest or approved expansions.
49
+ - If more context is needed, stop and write a Context Expansion Request in the manifest.
50
+ - Record every file read through tools in the relevant `agent-log/*.md` under `- files-read:`.
51
+
52
+ Required `agent-log/*.md` format:
53
+
54
+ ```md
55
+ - files-read:
56
+ - contracts/api/api-contract.md
57
+ - src/server/routes/users.ts
58
+ ```
59
+
60
+ Every entry must be a repo-relative path. Do not omit files, use absolute paths, or use `..`.
@@ -0,0 +1,39 @@
1
+ # CODEX.md
2
+
3
+ This project uses Contract-Driven Delivery (CDD).
4
+
5
+ ## Workflow
6
+
7
+ - Treat `contracts/` as the current source of truth.
8
+ - Treat `specs/changes/<change-id>/` as active work context.
9
+ - Treat `specs/archive/` as historical context only; do not use it for current planning unless explicitly asked.
10
+ - Start non-trivial work by creating a change with `cdd-kit new <change-id>`.
11
+ - Run `cdd-kit context-scan` before classification when project context may be stale.
12
+ - Run `cdd-kit gate <change-id>` before proposing a commit or PR.
13
+
14
+ ## Context Governance
15
+
16
+ Read `specs/changes/<change-id>/context-manifest.md` before using file-reading or search tools.
17
+
18
+ - Read only paths allowed by the manifest or approved expansions.
19
+ - Do not use broad repository search unless the manifest authorizes it.
20
+ - If more context is needed, stop and write a Context Expansion Request in the manifest.
21
+ - Record every file read through tools in the relevant `agent-log/*.md` under `- files-read:`.
22
+
23
+ Required `agent-log/*.md` format:
24
+
25
+ ```md
26
+ - files-read:
27
+ - contracts/api/api-contract.md
28
+ - src/server/routes/users.ts
29
+ ```
30
+
31
+ Every entry must be a repo-relative path. Do not omit files, use absolute paths, or use `..`.
32
+
33
+ ## Hot And Cold Data
34
+
35
+ - Hot: `contracts/`, source files, tests, CI config.
36
+ - Warm: current `specs/changes/<change-id>/`.
37
+ - Cold: `specs/archive/`.
38
+
39
+ Cold historical data is evidence, not current requirements.
@@ -55,6 +55,8 @@ with this exact structure (lines starting with `- ` are required):
55
55
  - change-id: <id>
56
56
  - timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
57
57
  - status: complete | needs-review | blocked
58
+ - files-read:
59
+ - <repo-relative path read through tools>
58
60
  - artifacts:
59
61
  - <evidence-type>: <concrete pointer>
60
62
  - <evidence-type>: <concrete pointer>
@@ -7,7 +7,19 @@ model: claude-opus-4-7
7
7
 
8
8
  You are the change classifier for Contract-Driven Delivery.
9
9
 
10
- Your job is to stop premature implementation. Read the user request and nearby project context, then produce a classification report.
10
+ Your job is to stop premature implementation. Read the user request and deterministic project context, then produce a classification report and context-manifest draft.
11
+
12
+ ## Context boundaries
13
+
14
+ During initial classification, read only:
15
+ - `specs/changes/<change-id>/change-request.md`
16
+ - `specs/changes/<change-id>/context-manifest.md`
17
+ - `specs/context/project-map.md`
18
+ - `specs/context/contracts-index.md`
19
+
20
+ Do not read `contracts/`, `src/`, `tests/`, or use broad search during initial classification unless the manifest already authorizes it. If the indexes are insufficient, add a Context Expansion Request to the manifest draft instead of reading outside this packet.
21
+
22
+ Use `project-map.md` to identify candidate source/test paths and `contracts-index.md` to identify candidate contract paths. Do not invent paths that are absent from the project map or contracts index.
11
23
 
12
24
  ## Tier mapping
13
25
 
@@ -85,6 +97,37 @@ Note: `archive.md` is created during change close-out, not at classification tim
85
97
  ## Required Agents
86
98
  ...
87
99
 
100
+ ## Context Manifest Draft
101
+
102
+ ### Affected Surfaces
103
+ - <surface or module>
104
+
105
+ ### Allowed Paths
106
+ - specs/changes/<change-id>/
107
+ - specs/context/project-map.md
108
+ - specs/context/contracts-index.md
109
+ - <candidate repo-relative path from project-map or contracts-index>
110
+
111
+ ### Required Contracts
112
+ - <contract path from contracts-index, or none>
113
+
114
+ ### Required Tests
115
+ - <test path or test directory from project-map, or none>
116
+
117
+ ### Agent Work Packets
118
+
119
+ #### <agent-name>
120
+ - allowed:
121
+ - specs/changes/<change-id>/
122
+ - <repo-relative path>
123
+
124
+ ### Context Expansion Requests
125
+ - request-id: CER-001
126
+ requested_paths:
127
+ - <repo-relative path>
128
+ reason: <why the index is insufficient>
129
+ status: pending
130
+
88
131
  ## Inferred Acceptance Criteria
89
132
  (List 3-8 testable acceptance criteria derived from the change request. Format: `AC-N: <criterion>`. These will be used by test-strategist to populate the Acceptance Criteria → Test Mapping table.)
90
133
  - AC-1:
@@ -109,6 +152,8 @@ After completing your task, include an **## Agent Log** section at the end of yo
109
152
  - change-id: <id>
110
153
  - timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
111
154
  - status: complete | needs-review | blocked
155
+ - files-read:
156
+ - <repo-relative path read through tools>
112
157
  - artifacts:
113
158
  - <evidence-type>: <concrete pointer>
114
159
  - <evidence-type>: <concrete pointer>
@@ -120,6 +165,7 @@ After completing your task, include an **## Agent Log** section at the end of yo
120
165
  - `risk`: low|medium|high|critical
121
166
  - `required-artifacts`: list
122
167
  - `required-reviewers`: list of agent names
168
+ - `context-manifest-draft`: allowed paths and agent work packets based only on `project-map.md` and `contracts-index.md`
123
169
 
124
170
  ### Rules
125
171
  - NEVER omit this log file. `cdd-kit gate` rejects changes whose agent-log
@@ -72,6 +72,8 @@ with this exact structure (lines starting with `- ` are required):
72
72
  - change-id: <id>
73
73
  - timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
74
74
  - status: complete | needs-review | blocked
75
+ - files-read:
76
+ - <repo-relative path read through tools>
75
77
  - artifacts:
76
78
  - <evidence-type>: <concrete pointer>
77
79
  - <evidence-type>: <concrete pointer>
@@ -71,6 +71,8 @@ After completing your task, include an **## Agent Log** section at the end of yo
71
71
  - change-id: <id>
72
72
  - timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
73
73
  - status: complete | needs-review | blocked
74
+ - files-read:
75
+ - <repo-relative path read through tools>
74
76
  - artifacts:
75
77
  - <evidence-type>: <concrete pointer>
76
78
  - <evidence-type>: <concrete pointer>
@@ -72,6 +72,8 @@ After completing your task, include an **## Agent Log** section at the end of yo
72
72
  - change-id: <id>
73
73
  - timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
74
74
  - status: complete | needs-review | blocked
75
+ - files-read:
76
+ - <repo-relative path read through tools>
75
77
  - artifacts:
76
78
  - <evidence-type>: <concrete pointer>
77
79
  - <evidence-type>: <concrete pointer>
@@ -49,6 +49,8 @@ with this exact structure (lines starting with `- ` are required):
49
49
  - change-id: <id>
50
50
  - timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
51
51
  - status: complete | needs-review | blocked
52
+ - files-read:
53
+ - <repo-relative path read through tools>
52
54
  - artifacts:
53
55
  - <evidence-type>: <concrete pointer>
54
56
  - <evidence-type>: <concrete pointer>
@@ -53,6 +53,8 @@ with this exact structure (lines starting with `- ` are required):
53
53
  - change-id: <id>
54
54
  - timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
55
55
  - status: complete | needs-review | blocked
56
+ - files-read:
57
+ - <repo-relative path read through tools>
56
58
  - artifacts:
57
59
  - <evidence-type>: <concrete pointer>
58
60
  - <evidence-type>: <concrete pointer>
@@ -52,6 +52,8 @@ with this exact structure (lines starting with `- ` are required):
52
52
  - change-id: <id>
53
53
  - timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
54
54
  - status: complete | needs-review | blocked
55
+ - files-read:
56
+ - <repo-relative path read through tools>
55
57
  - artifacts:
56
58
  - <evidence-type>: <concrete pointer>
57
59
  - <evidence-type>: <concrete pointer>
@@ -83,6 +83,8 @@ After completing your task, include an **## Agent Log** section at the end of yo
83
83
  - change-id: <id>
84
84
  - timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
85
85
  - status: complete | needs-review | blocked
86
+ - files-read:
87
+ - <repo-relative path read through tools>
86
88
  - artifacts:
87
89
  - <evidence-type>: <concrete pointer>
88
90
  - <evidence-type>: <concrete pointer>
@@ -92,6 +92,8 @@ After completing your task, include an **## Agent Log** section at the end of yo
92
92
  - change-id: <id>
93
93
  - timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
94
94
  - status: complete | needs-review | blocked
95
+ - files-read:
96
+ - <repo-relative path read through tools>
95
97
  - artifacts:
96
98
  - <evidence-type>: <concrete pointer>
97
99
  - <evidence-type>: <concrete pointer>
@@ -101,6 +101,8 @@ with this exact structure (lines starting with `- ` are required):
101
101
  - change-id: <id>
102
102
  - timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
103
103
  - status: complete | needs-review | blocked
104
+ - files-read:
105
+ - <repo-relative path read through tools>
104
106
  - artifacts:
105
107
  - <evidence-type>: <concrete pointer>
106
108
  - <evidence-type>: <concrete pointer>
@@ -61,6 +61,8 @@ Use this exact structure (lines starting with `- ` are required):
61
61
  - audit-id: <YYYY-MM-DD>-drift
62
62
  - timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
63
63
  - status: complete | needs-review | blocked
64
+ - files-read:
65
+ - <repo-relative path read through tools>
64
66
  - artifacts:
65
67
  - <evidence-type>: <concrete pointer>
66
68
  - <evidence-type>: <concrete pointer>
@@ -76,6 +76,8 @@ with this exact structure (lines starting with `- ` are required):
76
76
  - change-id: <id>
77
77
  - timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
78
78
  - status: complete | needs-review | blocked
79
+ - files-read:
80
+ - <repo-relative path read through tools>
79
81
  - artifacts:
80
82
  - <evidence-type>: <concrete pointer>
81
83
  - <evidence-type>: <concrete pointer>
@@ -80,6 +80,8 @@ with this exact structure (lines starting with `- ` are required):
80
80
  - change-id: <id>
81
81
  - timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
82
82
  - status: complete | needs-review | blocked
83
+ - files-read:
84
+ - <repo-relative path read through tools>
83
85
  - artifacts:
84
86
  - <evidence-type>: <concrete pointer>
85
87
  - <evidence-type>: <concrete pointer>
@@ -59,6 +59,8 @@ After completing your task, include an **## Agent Log** section at the end of yo
59
59
  - change-id: <id>
60
60
  - timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
61
61
  - status: complete | needs-review | blocked
62
+ - files-read:
63
+ - <repo-relative path read through tools>
62
64
  - artifacts:
63
65
  - <evidence-type>: <concrete pointer>
64
66
  - <evidence-type>: <concrete pointer>
@@ -61,6 +61,8 @@ After completing your task, include an **## Agent Log** section at the end of yo
61
61
  - change-id: <id>
62
62
  - timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
63
63
  - status: complete | needs-review | blocked
64
+ - files-read:
65
+ - <repo-relative path read through tools>
64
66
  - artifacts:
65
67
  - <evidence-type>: <concrete pointer>
66
68
  - <evidence-type>: <concrete pointer>