contract-driven-delivery 1.12.0 → 2.0.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 (38) hide show
  1. package/CHANGELOG.md +169 -0
  2. package/README.md +58 -38
  3. package/assets/CLAUDE.template.md +4 -12
  4. package/assets/agents/backend-engineer.md +5 -26
  5. package/assets/agents/change-classifier.md +87 -27
  6. package/assets/agents/ci-cd-gatekeeper.md +4 -25
  7. package/assets/agents/contract-reviewer.md +4 -25
  8. package/assets/agents/dependency-security-reviewer.md +4 -24
  9. package/assets/agents/e2e-resilience-engineer.md +4 -25
  10. package/assets/agents/frontend-engineer.md +4 -25
  11. package/assets/agents/monkey-test-engineer.md +4 -25
  12. package/assets/agents/qa-reviewer.md +4 -25
  13. package/assets/agents/repo-context-scanner.md +4 -24
  14. package/assets/agents/spec-architect.md +4 -25
  15. package/assets/agents/spec-drift-auditor.md +4 -24
  16. package/assets/agents/stress-soak-engineer.md +4 -25
  17. package/assets/agents/test-strategist.md +4 -25
  18. package/assets/agents/ui-ux-reviewer.md +4 -24
  19. package/assets/agents/visual-reviewer.md +4 -24
  20. package/assets/cdd/model-policy.json +20 -1
  21. package/assets/hooks/post-tool-use-files-read.sh +55 -0
  22. package/assets/skills/cdd-close/SKILL.md +9 -9
  23. package/assets/skills/cdd-new/SKILL.md +201 -198
  24. package/assets/skills/cdd-resume/SKILL.md +16 -16
  25. package/assets/skills/contract-driven-delivery/SKILL.md +6 -0
  26. package/assets/skills/contract-driven-delivery/references/agent-log-protocol.md +147 -0
  27. package/assets/skills/contract-driven-delivery/scripts/generate_change_scaffold.py +1 -1
  28. package/assets/skills/contract-driven-delivery/scripts/validate_spec_traceability.py +1 -1
  29. package/assets/skills/contract-driven-delivery/templates/agent-log.example.yml +14 -0
  30. package/assets/skills/contract-driven-delivery/templates/change-classification.md +1 -1
  31. package/assets/skills/contract-driven-delivery/templates/tasks.yml +39 -0
  32. package/assets/specs-templates/change-classification.md +1 -1
  33. package/assets/specs-templates/context-manifest.md +8 -13
  34. package/assets/specs-templates/tasks.yml +39 -0
  35. package/dist/cli/index.js +11057 -829
  36. package/package.json +7 -3
  37. package/assets/skills/contract-driven-delivery/templates/tasks.md +0 -50
  38. package/assets/specs-templates/tasks.md +0 -52
package/CHANGELOG.md CHANGED
@@ -1,5 +1,174 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.0.0] - 2026-04-30
4
+
5
+ ### BREAKING: structured YAML for tasks and agent-log
6
+
7
+ - `tasks.md` is replaced by `tasks.yml`. The previous markdown-frontmatter +
8
+ checklist hybrid is gone. The new file is a single YAML document validated
9
+ by `src/schemas/tasks.schema.ts` (JSON Schema, draft-07). Task items use
10
+ `status: pending | done | skipped` instead of `[ ] / [x] / [-]` checkboxes.
11
+ - `agent-log/<agent>.md` is replaced by `agent-log/<agent>.yml`, validated by
12
+ `src/schemas/agent-log.schema.ts`. The "field: value" prose convention is
13
+ gone; agents now emit a structured YAML record with `change-id`, `agent`,
14
+ `timestamp` (ISO 8601), `status`, `files-read`, `artifacts`, and
15
+ `next-action`.
16
+ - `cdd-kit gate` parses both files with `js-yaml` and validates them with
17
+ `ajv`. Errors and warnings now reference YAML paths rather than markdown
18
+ line patterns.
19
+ - All bundled templates, skill prompts, agent prompts, and Python helper
20
+ scripts have been updated to point at the new file names.
21
+
22
+ ### Upgrading
23
+
24
+ Run `cdd-kit migrate <change-id>` (or `cdd-kit migrate --all`) to convert
25
+ existing changes:
26
+
27
+ - `tasks.md` is parsed (frontmatter + markdown checklist) and rewritten as
28
+ `tasks.yml`. The legacy `tasks.md` is deleted.
29
+ - Every `agent-log/*.md` is parsed and rewritten as `agent-log/*.yml`. The
30
+ legacy markdown logs are deleted.
31
+ - A backup of the change directory is written to
32
+ `.cdd/migrate-backup/<stamp>/<change-id>/` before any rewrite.
33
+
34
+ ### Notes
35
+
36
+ This is a breaking release; pin to `^1.16.0` if you still depend on the old
37
+ markdown formats.
38
+
39
+ ## [1.16.0] - 2026-04-30
40
+
41
+ ### Visual narration: per-agent stage badges
42
+
43
+ - `/cdd-new` skill now instructs main Claude to prefix every agent
44
+ invocation announcement with a colored emoji badge tagging the role and
45
+ stage. Non-engineer users can scan the chat stream and see "we're at
46
+ review now, not implementation" without reading prompts.
47
+ - Six color buckets:
48
+ - 🟣 decision (classifier, architect — opus-class)
49
+ - 🔵 implementation (backend, frontend, ci-cd, sonnet-class)
50
+ - 🟡 test planning (test-strategist)
51
+ - 🟠 heavy testing (e2e, monkey, stress — Tier 0–1 only; orange = scope warning)
52
+ - 🟢 review (read-only verdicts)
53
+ - ⚫ audits & scans (background, read-only)
54
+ - `/cdd-resume` references the same badge table so resumed flows look
55
+ consistent.
56
+
57
+ ### Notes
58
+
59
+ This is the only PR in the v1.13 follow-up series that changes the visible
60
+ chat narration. Prompt-only; no code or test changes.
61
+
62
+ ## [1.15.0] - 2026-04-30
63
+
64
+ ### Workflow safety net (defaults that protect non-engineers)
65
+
66
+ - `cdd-kit new` auto-runs `context-scan` when `specs/context/*.md` indexes are
67
+ missing or stale (B5 hash-based check). Avoids classifier wasting a round
68
+ on outdated paths. New `--skip-scan` for advanced users.
69
+ - `cdd-kit gate` now lints `tasks.md` frontmatter:
70
+ - Requires `change-id` and `status`.
71
+ - Validates `status` against known set (`in-progress`, `completed`,
72
+ `gate-blocked`, `abandoned`, `needs-review`, `complete`, `done`).
73
+ - Warns on unknown keys with did-you-mean suggestions (e.g. `Tier:` →
74
+ `did you mean tier?`). Catches the typo class that previously caused
75
+ silent enforcement skips.
76
+ - `cdd-kit gate` now detects `depends-on` cycles via DFS and reports the
77
+ full cycle path (e.g. `feat-a → feat-b → feat-c → feat-a`).
78
+ - `cdd-kit doctor --fix`: auto-resolves the safe subset of warnings
79
+ - regenerates stale or missing `specs/context/*.md` indexes
80
+ - populates empty `model-policy.json` roles with defaults
81
+ - leaves invasive fixes (`.cdd/*` missing → suggests `cdd-kit upgrade`)
82
+ for the user to confirm
83
+ - `cdd-kit gate`: artifact-pointer existence check now runs **by default**
84
+ (previously `--strict`-only). Use `--lax` to skip for legacy repos with
85
+ unfixed agent logs.
86
+
87
+ ### Tests
88
+
89
+ - 11 new tests across `gate.test.ts` (frontmatter lint, DAG cycle, default
90
+ pointer check), `new.test.ts` (auto-scan), `doctor.test.ts` (--fix).
91
+ - Updated `gate.test.ts` test 13b — its premise inverted by PR-3 #6.
92
+ - Updated `writeValidChangeArtifacts` helper to include required frontmatter.
93
+
94
+ ## [1.14.0] - 2026-04-30
95
+
96
+ ### Agent efficiency for non-engineer users
97
+
98
+ - `/cdd-new` Step 0: request-quality pre-lint. Refuses to run when the user's
99
+ request is missing affected-surface, desired-behavior, or success-criterion.
100
+ Avoids one full classifier round-trip on ambiguous requests.
101
+ - `change-classifier`: atomic-split detection. Mega-requests crossing 2+
102
+ change-types or 3+ surfaces now return an `## Atomic Split Proposal` table
103
+ with suggested `cdd-kit new --depends-on` commands instead of a single
104
+ Tier 0/1 monolith. Estimated 40-60% token saving on multi-feature requests.
105
+ - `references/agent-log-protocol.md`: every agent must self-validate its log
106
+ block before sending its response. Prevents the round-trip where gate
107
+ catches a malformed log and forces a full agent re-run.
108
+ - `/cdd-new` Step 4 fix-back: structured error-to-agent routing table. Each
109
+ gate error class now has a defined re-invocation owner and a templated
110
+ prompt prefix that includes the verbatim gate error. No more "blind retry".
111
+
112
+ ### Notes
113
+
114
+ This release is prompt-only (no code changes in `src/`). Improvements are
115
+ qualitative for the AI agent flow, not exposed as new CLI flags.
116
+
117
+ ## [1.13.0] - 2026-04-29
118
+
119
+ ### Token-budget reductions
120
+ - Shared `references/agent-log-protocol.md` — extracted the duplicated agent-log
121
+ format block out of all 16 agent prompts. Total agent-prompt size dropped
122
+ from 1675 → 1344 lines (≈20% smaller). One source of truth, no drift.
123
+ - `/cdd-new` skill no longer inlines the 5 change-template bodies; `cdd-kit
124
+ new` writes them from disk. Skill went from 483 → ~340 lines (≈30%).
125
+ - Tier 5 fast-path for docs/prompts/config-only changes — classifier now
126
+ short-circuits the full agent flow when no source/tests/contracts are
127
+ touched; bounds doc-only token cost to 2 read-only reviews.
128
+ - `context-manifest.md` template no longer duplicates the forbidden-paths list
129
+ that `.cdd/context-policy.json` already carries.
130
+ - `cdd-kit context-scan` now caps per-directory entries to 50 and supports
131
+ `--surface <path>` to scope the project map to a sub-tree.
132
+
133
+ ### Stability hardening
134
+ - Tier source moved to `tasks.md` frontmatter `tier: <0-5>`. The legacy
135
+ `## Tier\n- N` and `**Tier:** Tier N` formats remain as fallback-only;
136
+ bold-only legacy format produces a migration warning instead of silently
137
+ skipping tier-specific agent enforcement.
138
+ - Section-7 archive exemption is no longer hard-coded `7\.[12]`; reads from
139
+ `tasks.md` frontmatter `archive-tasks: ["7.1", "7.2"]` (default preserved).
140
+ - `cdd-kit migrate` is now atomic: per-session backup at
141
+ `.cdd/migrate-backup/<timestamp>/`, two-phase tmp-write + rename, restore
142
+ hint on failure. New `--no-backup` opt-out.
143
+ - `cdd-kit migrate` now backfills `tier:` and `archive-tasks:` into legacy
144
+ `tasks.md` frontmatter automatically.
145
+ - `cdd-kit doctor` freshness check is now content-hash based, not mtime.
146
+ `git clone` no longer triggers spurious staleness warnings.
147
+ - `cdd-kit context approve|reject --all-pending` resolves every pending
148
+ Context Expansion Request in one command.
149
+ - `cdd-kit gate` now reconciles agent self-reported `files-read:` against the
150
+ runtime hook log at `.cdd/runtime/<change-id>-files-read.jsonl`. Undeclared
151
+ reads warn (or fail under `--strict`).
152
+ - `hooks/post-tool-use-files-read.sh` — Claude Code PostToolUse hook scaffold
153
+ that records actual Read/Grep/Glob targets for the gate to verify.
154
+ - `cdd-kit gate` now invokes `validate` in-process instead of via
155
+ `spawnSync(process.execPath, [process.argv[1], ...])`. No more `argv[1]`
156
+ indirection or extra Node startup.
157
+ - `.cdd/model-policy.json` ships with real role-to-model defaults (no longer
158
+ empty `{}`). `cdd-kit doctor` warns when an installed agent's `model:`
159
+ frontmatter drifts from policy. `init`/`upgrade` preserve any custom
160
+ `roles` overrides instead of clobbering them.
161
+
162
+ ### Skill updates
163
+ - `/cdd-new` now lints classifier output before writing files (`## Tier`,
164
+ `## Required Agents`, `## Inferred Acceptance Criteria` must be filled).
165
+ - `/cdd-new` writes the classifier's tier into `tasks.md` frontmatter as the
166
+ authoritative source.
167
+
168
+ ### Tests
169
+ - 19 new tests covering B1–B7 + A5 + B3. 39 gate tests, 15 migrate tests, 9
170
+ context tests, 7 doctor tests all pass.
171
+
3
172
  ## [1.12.0] - 2026-04-29
4
173
 
5
174
  ### Added
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Contract-Driven Delivery Kit
2
2
 
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.
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, with deterministic context indexes and manifest-backed read-scope auditing to keep long agent runs reviewable.
4
4
 
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.
5
+ Designed for solo developers and small teams building brownfield production systems (dashboards, APIs, workflow tools, data apps), especially when non-engineers or product owners want AI to do the implementation while they stay in the spec-author and reviewer seat.
6
6
 
7
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
8
 
@@ -90,16 +90,19 @@ or
90
90
 
91
91
  **What happens:**
92
92
  1. Claude generates a `change-id` (e.g. `add-jwt-auth`) and scaffolds `specs/changes/add-jwt-auth/`
93
- 2. The `change-classifier` agent (Opus) reads the request, classifies risk and tier, decides which agents are needed
94
- 3. Agents run in order: contracts → test plan → spec/architecture review (if needed) backend engineer frontend engineer CI/CD gates QA
95
- 4. Each agent produces machine-verifiable evidence (agent-log files)
96
- 5. `cdd-kit gate <change-id>` runs automatically to confirm all artifacts are complete
97
- 6. Claude reports a summary and the suggested git commit
93
+ 2. If the request is ambiguous, Claude asks back for affected surface, desired behavior, and success criterion before spending a classifier round-trip
94
+ 3. The `change-classifier` agent (Opus) reads the request, classifies risk and tier, decides which agents are needed
95
+ 4. If the request is too broad, the classifier can return an atomic split proposal instead of forcing one Tier 0/1 monolith
96
+ 5. For Tier 0-1 work, Claude's narration uses stage badges so users can tell whether the flow is deciding, implementing, testing, or reviewing
97
+ 6. Agents run in order: contracts test plan → spec/architecture review (if needed) → backend engineer → frontend engineer → CI/CD gates → QA
98
+ 7. Each agent produces machine-verifiable evidence (agent-log files)
99
+ 8. `cdd-kit gate <change-id>` runs automatically to confirm all artifacts are complete
100
+ 9. Claude reports a summary and the suggested git commit
98
101
 
99
102
  **You stay in control by:**
100
103
  - Reviewing the `change-classification.md` before implementation starts
101
104
  - Checking the `test-plan.md` to confirm the right test families are planned
102
- - Reading the final `agent-log/qa-reviewer.md` for the release-readiness verdict
105
+ - Reading the final `agent-log/qa-reviewer.yml` for the release-readiness verdict
103
106
 
104
107
  ---
105
108
 
@@ -139,12 +142,12 @@ What changes are currently in progress? (cdd-kit list)
139
142
  ```
140
143
 
141
144
  **What happens:**
142
- 1. Claude reads `tasks.md` and `agent-log/` to determine what was completed
145
+ 1. Claude reads `tasks.yml` and `agent-log/` to determine what was completed
143
146
  2. Reports the current state (which agents ran, which tasks are pending)
144
147
  3. Asks if you want to continue from the next pending agent
145
148
  4. Resumes the full agent flow from where it stopped, with no duplication
146
149
 
147
- > If you're upgrading from an older version and your change was created before v1.11.0, Claude will automatically run `cdd-kit migrate <change-id>` to upgrade the format before resuming.
150
+ > If you're upgrading from an older version and your change was created before v2.0.0, Claude will automatically run `cdd-kit migrate <change-id>` to upgrade the format before resuming.
148
151
 
149
152
  ---
150
153
 
@@ -240,16 +243,17 @@ Codex currently has no global assets to update, so Codex-only projects report th
240
243
 
241
244
  ### `cdd-kit doctor`
242
245
 
243
- Inspects repo-level cdd-kit health without writing files.
246
+ Inspects repo-level cdd-kit health. Default mode is read-only; `--fix` applies only the safe auto-remediations.
244
247
 
245
248
  ```bash
246
249
  cdd-kit doctor
247
250
  cdd-kit doctor --strict
251
+ cdd-kit doctor --fix
248
252
  cdd-kit doctor --json
249
253
  cdd-kit doctor --provider codex
250
254
  ```
251
255
 
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.
256
+ 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. `--fix` currently auto-runs `context-scan` for stale or missing indexes and backfills empty `.cdd/model-policy.json` role bindings, but deliberately does not run invasive repo upgrades for you.
253
257
 
254
258
  ---
255
259
 
@@ -277,24 +281,27 @@ The single quality gate for a change. Blocks merge if anything is missing or inc
277
281
  ```bash
278
282
  cdd-kit gate add-jwt-auth
279
283
  cdd-kit gate add-jwt-auth --strict
284
+ cdd-kit gate add-jwt-auth --lax
280
285
  ```
281
286
 
282
287
  Checks:
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`)
288
+ - All required artifacts exist (`change-request.md`, `change-classification.md`, `test-plan.md`, `ci-gates.md`, `tasks.yml`; new context-governed changes also require `context-manifest.md`)
284
289
  - Each artifact has sufficient content (not a stub): change-classification ≥ 200 chars, test-plan ≥ 200, ci-gates ≥ 150, others ≥ 100
285
290
  - `change-classification.md` contains a tier or risk marker
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`
291
+ - `agent-log/*.yml` files all have `status: complete` (not blocked)
292
+ - For context-governed changes, `agent-log/*.yml` files include a structured `files-read:` list and those repo-relative paths are audited against `context-manifest.md` and `.cdd/context-policy.json`
288
293
  - Atomic `depends-on` upstream changes are completed or archived before dependent work gates
289
294
  - Tier 0–1 changes have `e2e-resilience-engineer`, `monkey-test-engineer`, and `stress-soak-engineer` logs
290
295
  - Tier 0–3 changes have `contract-reviewer` and `qa-reviewer` logs
291
296
  - All contract validators pass
292
297
 
293
298
  `--strict` additionally:
294
- - Treats any pending `[ ]` tasks (except section 7 archive items) as errors
295
- - Validates that every file path listed in `agent-log` artifact pointers actually exists on disk
299
+ - Treats any task with `status: pending` (except IDs listed in `archive-tasks`) as an error
300
+ - Treats runtime-vs-declared `files-read` drift as errors
296
301
  - Treats legacy changes missing `context-manifest.md` or `files-read` audit data as errors
297
302
 
303
+ Default mode also validates that artifact file pointers listed in `agent-log` evidence exist on disk. Use `--lax` only when cleaning up legacy repos with stale historical logs.
304
+
298
305
  Pre-commit hook uses `--strict` by default (installed via `cdd-kit install-hooks`).
299
306
 
300
307
  ```
@@ -302,8 +309,8 @@ Pre-commit hook uses `--strict` by default (installed via `cdd-kit install-hooks
302
309
 
303
310
  ✗ gate failed for change: feat-001
304
311
  ✗ change-classification.md: appears to be a stub (< 200 meaningful chars)
305
- ✗ Tier 1 change requires agent-log/e2e-resilience-engineer.md
306
- ✗ 1 task(s) still pending (use [-] for N/A items, [x] for done)
312
+ ✗ Tier 1 change requires agent-log/e2e-resilience-engineer.yml
313
+ ✗ 1 task(s) still pending (mark archive items in archive-tasks frontmatter; mark N/A items as status: skipped)
307
314
  ```
308
315
 
309
316
  ---
@@ -335,13 +342,13 @@ cdd-kit archive add-jwt-auth
335
342
  # ✓ Index updated: specs/archive/INDEX.md
336
343
  ```
337
344
 
338
- Warns (but does not block) if `tasks.md` has pending items or `status: gate-blocked`. Use after `/cdd-close` — the skill runs this automatically at the end.
345
+ Warns (but does not block) if `tasks.yml` has pending items or `status: gate-blocked`. Use after `/cdd-close` — the skill runs this automatically at the end.
339
346
 
340
347
  ---
341
348
 
342
349
  ### `cdd-kit abandon <change-id>`
343
350
 
344
- Marks a change as abandoned. Updates `tasks.md` status to `abandoned`, records the reason in `specs/archive/INDEX.md`. The directory stays on disk for git history.
351
+ Marks a change as abandoned. Updates `tasks.yml` status to `abandoned`, records the reason in `specs/archive/INDEX.md`. The directory stays on disk for git history.
345
352
 
346
353
  ```bash
347
354
  cdd-kit abandon add-jwt-auth --reason "using Auth0 instead"
@@ -352,7 +359,7 @@ cdd-kit abandon add-jwt-auth --reason "using Auth0 instead"
352
359
 
353
360
  ### `cdd-kit migrate <change-id> | --all`
354
361
 
355
- Upgrades pre-v1.11.0 change directories to the current format.
362
+ Upgrades pre-v2.0.0 change directories to the current format.
356
363
 
357
364
  ```bash
358
365
  cdd-kit migrate add-jwt-auth # migrate one change
@@ -362,15 +369,15 @@ cdd-kit migrate --all --enable-context-governance
362
369
  ```
363
370
 
364
371
  What it upgrades:
365
- - `tasks.md`: adds YAML frontmatter (`change-id`, `status: in-progress`) and `[x]/[-]/[ ]` legend if missing
372
+ - `tasks.yml`: converts legacy `tasks.md` checklist/frontmatter into structured YAML task records
366
373
  - `change-classification.md`: detects old `**Tier:** Tier N` format and appends the new `## Tier\n- N` section so tier-based gate checks activate
367
374
  - `context-manifest.md`: adds a legacy manifest scaffold by default so old changes can continue with warning-only context audit behavior
368
375
  - `--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
376
 
370
- `agent-log/*.md` must use this `files-read` format for context-governed changes:
377
+ `agent-log/*.yml` must use this `files-read` format for context-governed changes:
371
378
 
372
- ```md
373
- - files-read:
379
+ ```yaml
380
+ files-read:
374
381
  - contracts/api/api-contract.md
375
382
  - src/server/routes/users.ts
376
383
  ```
@@ -405,9 +412,10 @@ Approves a pending Context Expansion Request in `context-manifest.md` and adds i
405
412
 
406
413
  ```bash
407
414
  cdd-kit context approve add-jwt-auth CER-001
415
+ cdd-kit context approve add-jwt-auth --all-pending # bulk approve every pending request
408
416
  ```
409
417
 
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.
418
+ This keeps expansion history explicit while avoiding manual manifest editing. Agents still have to report `files-read` in `agent-log/*.yml`; `cdd-kit gate` audits those paths against the manifest.
411
419
 
412
420
  ---
413
421
 
@@ -417,6 +425,7 @@ Rejects a pending Context Expansion Request and records `status: rejected` in th
417
425
 
418
426
  ```bash
419
427
  cdd-kit context reject add-jwt-auth CER-001
428
+ cdd-kit context reject add-jwt-auth --all-pending # bulk reject every pending request
420
429
  ```
421
430
 
422
431
  ---
@@ -456,9 +465,12 @@ cdd-kit new add-user-auth
456
465
  cdd-kit new add-user-auth --all # include optional templates too
457
466
  cdd-kit new add-user-auth --force # overwrite existing directory
458
467
  cdd-kit new add-user-api --depends-on add-user-db
468
+ cdd-kit new add-user-auth --skip-scan
459
469
  ```
460
470
 
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.
471
+ By default, `cdd-kit new` auto-runs `cdd-kit context-scan` when `specs/context/` indexes are missing or stale. Use `--skip-scan` only if you intentionally want a bare scaffold without refreshing classifier indexes first.
472
+
473
+ 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.yml`.
462
474
 
463
475
  ---
464
476
 
@@ -506,6 +518,7 @@ Builds deterministic, low-token context indexes for classifiers and orchestrator
506
518
 
507
519
  ```bash
508
520
  cdd-kit context-scan
521
+ cdd-kit context-scan --surface src/server # scope project-map to a sub-tree (large monorepos)
509
522
  ```
510
523
 
511
524
  Outputs:
@@ -546,7 +559,7 @@ git add specs/changes/
546
559
  git commit -m "chore: migrate changes to current cdd-kit format"
547
560
  ```
548
561
 
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.
562
+ This gives those legacy specs a new `tasks.yml`, tier markers, and a warning-mode `context-manifest.md` without forcing strict context governance on closed work.
550
563
 
551
564
  ### Old in-progress specs
552
565
 
@@ -593,7 +606,7 @@ your-repo/
593
606
  │ │ ├── change-classification.md (required)
594
607
  │ │ ├── test-plan.md (required)
595
608
  │ │ ├── ci-gates.md (required)
596
- │ │ ├── tasks.md (required)
609
+ │ │ ├── tasks.yml (required)
597
610
  │ │ └── agent-log/ ← machine-verifiable evidence per agent
598
611
  │ ├── archive/ ← completed and abandoned changes
599
612
  │ │ ├── INDEX.md
@@ -617,15 +630,22 @@ your-repo/
617
630
 
618
631
  ---
619
632
 
620
- ## Task notation in `tasks.md`
633
+ ## Task notation in `tasks.yml`
621
634
 
622
- ```markdown
623
- - [x] 1.1 Confirm classification ← done
624
- - [-] 2.2 CSS/UI contract ← N/A (not applicable to this change)
625
- - [ ] 4.1 Backend implementation ← pending
626
- ```
627
-
628
- `cdd-kit gate --strict` treats any `[ ]` (except section 7 archive tasks) as an error. Use `[-]` for items that are genuinely not applicable to a given change.
635
+ ```yaml
636
+ tasks:
637
+ - id: "1.1"
638
+ title: Confirm classification
639
+ status: done
640
+ - id: "2.2"
641
+ title: CSS/UI contract
642
+ status: skipped
643
+ - id: "4.1"
644
+ title: Backend implementation
645
+ status: pending
646
+ ```
647
+
648
+ `cdd-kit gate --strict` treats any task with `status: pending` (except IDs listed in `archive-tasks`, which default to `7.1` and `7.2`) as an error. Use `status: skipped` for tasks that are genuinely not applicable to a given change.
629
649
 
630
650
  ---
631
651
 
@@ -46,15 +46,7 @@ Run `cdd-kit detect-stack` to verify the detected tech stack.
46
46
  For context-governed changes, read `specs/changes/<change-id>/context-manifest.md` before using file-reading or broad search tools.
47
47
 
48
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 `..`.
49
+ - If more context is needed, stop and write a Context Expansion Request in the manifest (`cdd-kit context request`).
50
+ - The full agent-log format (including `files-read:` schema) is defined in
51
+ `~/.claude/skills/contract-driven-delivery/references/agent-log-protocol.md`.
52
+ Read that once; do not paraphrase it elsewhere.
@@ -17,7 +17,7 @@ Before editing production code, read the change artifacts, API/env/data/business
17
17
  - Validate input at the boundary.
18
18
  - Return standardized errors, not raw exceptions.
19
19
  - Preserve backward compatibility unless the spec explicitly marks a breaking change.
20
- - **TDD**: Read `specs/changes/<id>/test-plan.md` first. Write failing unit, contract, and integration tests BEFORE writing feature code. Tests in `tasks.md` items 3.1–3.2 are your responsibility.
20
+ - **TDD**: Read `specs/changes/<id>/test-plan.md` first. Write failing unit, contract, and integration tests BEFORE writing feature code. Tests in `tasks.yml` items 3.1–3.2 are your responsibility.
21
21
  - Update CI/CD workflows when required by `ci-gates.md`.
22
22
 
23
23
  ## Common pitfalls
@@ -47,21 +47,10 @@ In your agent log, reference file paths and function names — do not paste code
47
47
 
48
48
  ## Machine-Verifiable Evidence
49
49
 
50
- After completing your task, write or append to `specs/changes/<change-id>/agent-log/<your-agent-name>.md`
51
- with this exact structure (lines starting with `- ` are required):
52
-
53
- ```
54
- # Backend Engineer Log
55
- - change-id: <id>
56
- - timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
57
- - status: complete | needs-review | blocked
58
- - files-read:
59
- - <repo-relative path read through tools>
60
- - artifacts:
61
- - <evidence-type>: <concrete pointer>
62
- - <evidence-type>: <concrete pointer>
63
- - next-action: <one line, or "none">
64
- ```
50
+ After completing your task, write or append to
51
+ `specs/changes/<change-id>/agent-log/<your-agent-name>.yml`. Required fields,
52
+ field rules, and gate-enforcement behavior are defined once in
53
+ `references/agent-log-protocol.md` — do not duplicate them in this prompt.
65
54
 
66
55
  ### Required artifacts for this agent
67
56
  - `files-changed`: list of `path/to/file.ts:line-range`
@@ -69,16 +58,6 @@ with this exact structure (lines starting with `- ` are required):
69
58
  - `test-output`: last 10 lines of `npm test` or equivalent stdout
70
59
  - `contracts-touched`: list of contract file paths or "none"
71
60
 
72
- ### Rules
73
- - NEVER omit this log file. `cdd-kit gate` rejects changes whose agent-log
74
- is missing the `status:` line or has an invalid status.
75
- - If you cannot complete the task, set `status: blocked` and write a
76
- concrete `next-action` (NOT "investigate further" — write the actual
77
- next step a human can act on).
78
- - Evidence must be concrete: file:line, command name + last-10-line stdout,
79
- contract path + section, test name, etc. NEVER write "verified" or "OK"
80
- without a pointer.
81
-
82
61
  ## Read scope
83
62
 
84
63
  - Allowed: `contracts/`, `tests/`, `src/`, `specs/changes/<current-change-id>/`
@@ -32,6 +32,87 @@ Use `project-map.md` to identify candidate source/test paths and `contracts-inde
32
32
 
33
33
  When in doubt, classify upward.
34
34
 
35
+ ### Atomic-split detection (BEFORE producing classification)
36
+
37
+ Non-engineer users often hand in mega-requests like "redesign the dashboard
38
+ and add JWT auth and migrate sessions". Running these as a single Tier 0/1
39
+ change burns 10+ agents in series, couples unrelated rollback risk, and
40
+ leaves no good fix-back path when one piece blocks.
41
+
42
+ Before producing a single classification, check these triggers:
43
+
44
+ - **Cross-feature**: 2+ unrelated change-types ("primary" categories) in one
45
+ request (e.g. `feature-add` + `migration` + `ui-redesign`).
46
+ - **Cross-surface**: 3+ distinct surfaces touched (auth + UI + DB + email +
47
+ export).
48
+ - **Contract-heavy**: ≥ 5 of the 6 contracts (api / css / env / data /
49
+ business / ci) need changes.
50
+ - **Task-heavy**: estimated > 10 task-IDs across sections 3-4 of `tasks.yml`.
51
+
52
+ If **any one trigger fires**, output `## Atomic Split Proposal` INSTEAD of the
53
+ normal classification, in this exact shape:
54
+
55
+ ```md
56
+ ## Atomic Split Proposal
57
+
58
+ This request spans <N> independent risk surfaces. Running it as one change
59
+ would require <N> agents in series and couple unrelated rollback risk.
60
+
61
+ Recommended atomic split (each is a separate `cdd-kit new`):
62
+
63
+ | change-id | scope | tier | depends-on |
64
+ |---|---|---|---|
65
+ | <kebab-id-1> | <one-line scope> | <0-5> | (none) |
66
+ | <kebab-id-2> | <one-line scope> | <0-5> | <kebab-id-1> |
67
+ | <kebab-id-3> | <one-line scope> | <0-5> | <kebab-id-1> |
68
+
69
+ Suggested commands (run in order):
70
+
71
+ \`\`\`bash
72
+ cdd-kit new <kebab-id-1>
73
+ cdd-kit new <kebab-id-2> --depends-on <kebab-id-1>
74
+ cdd-kit new <kebab-id-3> --depends-on <kebab-id-1>
75
+ \`\`\`
76
+
77
+ Estimated token savings vs single Tier 0/1 monolith: ~40-60% (parallel
78
+ review-agent overlap removed, smaller per-change context).
79
+
80
+ If you want to proceed as a single monolithic change anyway, reply with
81
+ `force-monolithic` and I will produce the normal Tier <X> classification
82
+ instead.
83
+ ```
84
+
85
+ When emitting an Atomic Split Proposal, **also include the standard
86
+ `## Agent Log` block** at the end so `cdd-kit gate` can record this run, but
87
+ mark `status: needs-review` and include `next-action: wait-for-user-approval`.
88
+ Do NOT produce other artifacts (no test-plan, no manifest draft) until the
89
+ user picks a path.
90
+
91
+ If no trigger fires, skip this section entirely and produce the normal
92
+ classification.
93
+
94
+ ### Tier 5 fast-path (token budget protection)
95
+
96
+ If, after reading the change-request and project-map, ALL of the following are
97
+ true, output Tier 5 and skip the heavy artifact list:
98
+
99
+ - Only `*.md`, `*.txt`, `prompts/*`, `AGENTS.md`, `CLAUDE.md`, `CODEX.md`,
100
+ `README*` are touched (no source, no tests, no contracts).
101
+ - No env var, secret, or runtime configuration change.
102
+ - No public API behavior change.
103
+
104
+ Tier 5 fast-path output minima:
105
+ - `## Tier` → `- 5`
106
+ - `## Required Agents` → `contract-reviewer` (read-only confirmation that no
107
+ contracts are touched) and `qa-reviewer` (release readiness, ~1 paragraph).
108
+ - `## Optional Artifacts` → all `no`.
109
+ - `## Required Tests` → all blank.
110
+
111
+ This exists because previously every doc-only change paid 8–12 agent
112
+ invocations of token cost. The fast-path bounds it to 2 read-only reviews. If
113
+ unsure whether the fast-path applies, classify Tier 4 instead and proceed
114
+ through the normal flow.
115
+
35
116
  ## Output
36
117
 
37
118
  Use this structure:
@@ -59,7 +140,7 @@ Use this structure:
59
140
  ## Required Artifacts
60
141
 
61
142
  The following 5 artifacts are always required for implementation changes:
62
- `change-request.md`, `change-classification.md`, `test-plan.md`, `ci-gates.md`, `tasks.md`
143
+ `change-request.md`, `change-classification.md`, `test-plan.md`, `ci-gates.md`, `tasks.yml`
63
144
 
64
145
  ## Optional Artifacts (default: no — set yes only with explicit reason)
65
146
 
@@ -135,7 +216,7 @@ Note: `archive.md` is created during change close-out, not at classification tim
135
216
  - AC-3:
136
217
 
137
218
  ## Tasks Not Applicable
138
- (List task IDs from tasks.md that are NOT applicable to this change, using the format `2.2, 2.3, 4.2`. Main Claude will mark these as [-] in tasks.md.)
219
+ (List task IDs from tasks.yml that are NOT applicable to this change, using the format `2.2, 2.3, 4.2`. Main Claude will mark these as `status: skipped` in tasks.yml.)
139
220
  - not-applicable:
140
221
 
141
222
  ## Clarifications or Assumptions
@@ -144,21 +225,10 @@ Note: `archive.md` is created during change close-out, not at classification tim
144
225
 
145
226
  ## Machine-Verifiable Evidence
146
227
 
147
- After completing your task, include an **## Agent Log** section at the end of your response with this exact structure (lines starting with `- ` are required). The calling skill will write this block to `specs/changes/<change-id>/agent-log/change-classifier.md`.
148
-
149
- ```
150
- ## Agent Log
151
- # Change Classifier Log
152
- - change-id: <id>
153
- - timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
154
- - status: complete | needs-review | blocked
155
- - files-read:
156
- - <repo-relative path read through tools>
157
- - artifacts:
158
- - <evidence-type>: <concrete pointer>
159
- - <evidence-type>: <concrete pointer>
160
- - next-action: <one line, or "none">
161
- ```
228
+ After completing your task, write or append to
229
+ `specs/changes/<change-id>/agent-log/<your-agent-name>.yml`. Required fields,
230
+ field rules, and gate-enforcement behavior are defined once in
231
+ `references/agent-log-protocol.md` do not duplicate them in this prompt.
162
232
 
163
233
  ### Required artifacts for this agent
164
234
  - `tier`: Tier 0-5
@@ -167,16 +237,6 @@ After completing your task, include an **## Agent Log** section at the end of yo
167
237
  - `required-reviewers`: list of agent names
168
238
  - `context-manifest-draft`: allowed paths and agent work packets based only on `project-map.md` and `contracts-index.md`
169
239
 
170
- ### Rules
171
- - NEVER omit this log file. `cdd-kit gate` rejects changes whose agent-log
172
- is missing the `status:` line or has an invalid status.
173
- - If you cannot complete the task, set `status: blocked` and write a
174
- concrete `next-action` (NOT "investigate further" — write the actual
175
- next step a human can act on).
176
- - Evidence must be concrete: file:line, command name + last-10-line stdout,
177
- contract path + section, test name, etc. NEVER write "verified" or "OK"
178
- without a pointer.
179
-
180
240
  ## Mixed and edge cases
181
241
 
182
242
  - A single request can be both `ui-only-change` and `api-only-change` — list both as primary; require both UI/UX-visual review AND contract tests.