contract-driven-delivery 1.11.0 → 1.16.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.
- package/CHANGELOG.md +205 -0
- package/README.md +194 -24
- package/assets/CLAUDE.template.md +10 -0
- package/assets/CODEX.template.md +39 -0
- package/assets/agents/backend-engineer.md +4 -23
- package/assets/agents/change-classifier.md +130 -24
- package/assets/agents/ci-cd-gatekeeper.md +4 -23
- package/assets/agents/contract-reviewer.md +4 -23
- package/assets/agents/dependency-security-reviewer.md +4 -22
- package/assets/agents/e2e-resilience-engineer.md +4 -23
- package/assets/agents/frontend-engineer.md +4 -23
- package/assets/agents/monkey-test-engineer.md +4 -23
- package/assets/agents/qa-reviewer.md +4 -23
- package/assets/agents/repo-context-scanner.md +4 -22
- package/assets/agents/spec-architect.md +4 -23
- package/assets/agents/spec-drift-auditor.md +4 -22
- package/assets/agents/stress-soak-engineer.md +4 -23
- package/assets/agents/test-strategist.md +4 -23
- package/assets/agents/ui-ux-reviewer.md +4 -22
- package/assets/agents/visual-reviewer.md +4 -22
- package/assets/cdd/context-policy.json +25 -0
- package/assets/cdd/model-policy.json +24 -0
- package/assets/contracts/api/api-contract.md +3 -0
- package/assets/contracts/api/api-inventory.md +7 -0
- package/assets/contracts/api/error-format.md +7 -0
- package/assets/contracts/business/business-rules.md +3 -0
- package/assets/contracts/ci/ci-gate-contract.md +3 -0
- package/assets/contracts/css/css-contract.md +3 -0
- package/assets/contracts/css/design-tokens.md +7 -0
- package/assets/contracts/data/data-shape-contract.md +3 -0
- package/assets/contracts/env/env-contract.md +3 -0
- package/assets/hooks/post-tool-use-files-read.sh +55 -0
- package/assets/skills/cdd-close/SKILL.md +37 -10
- package/assets/skills/cdd-new/SKILL.md +200 -164
- package/assets/skills/cdd-resume/SKILL.md +31 -3
- package/assets/skills/contract-driven-delivery/references/agent-log-protocol.md +117 -0
- package/assets/specs-templates/context-manifest.md +44 -0
- package/assets/specs-templates/tasks.md +4 -0
- package/dist/cli/index.js +2149 -342
- package/docs/release-checklist.md +39 -0
- package/package.json +6 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [1.16.0] - 2026-04-30
|
|
4
|
+
|
|
5
|
+
### Visual narration: per-agent stage badges
|
|
6
|
+
|
|
7
|
+
- `/cdd-new` skill now instructs main Claude to prefix every agent
|
|
8
|
+
invocation announcement with a colored emoji badge tagging the role and
|
|
9
|
+
stage. Non-engineer users can scan the chat stream and see "we're at
|
|
10
|
+
review now, not implementation" without reading prompts.
|
|
11
|
+
- Six color buckets:
|
|
12
|
+
- 🟣 decision (classifier, architect — opus-class)
|
|
13
|
+
- 🔵 implementation (backend, frontend, ci-cd, sonnet-class)
|
|
14
|
+
- 🟡 test planning (test-strategist)
|
|
15
|
+
- 🟠 heavy testing (e2e, monkey, stress — Tier 0–1 only; orange = scope warning)
|
|
16
|
+
- 🟢 review (read-only verdicts)
|
|
17
|
+
- ⚫ audits & scans (background, read-only)
|
|
18
|
+
- `/cdd-resume` references the same badge table so resumed flows look
|
|
19
|
+
consistent.
|
|
20
|
+
|
|
21
|
+
### Notes
|
|
22
|
+
|
|
23
|
+
This is the only PR in the v1.13 follow-up series that changes the visible
|
|
24
|
+
chat narration. Prompt-only; no code or test changes.
|
|
25
|
+
|
|
26
|
+
## [1.15.0] - 2026-04-30
|
|
27
|
+
|
|
28
|
+
### Workflow safety net (defaults that protect non-engineers)
|
|
29
|
+
|
|
30
|
+
- `cdd-kit new` auto-runs `context-scan` when `specs/context/*.md` indexes are
|
|
31
|
+
missing or stale (B5 hash-based check). Avoids classifier wasting a round
|
|
32
|
+
on outdated paths. New `--skip-scan` for advanced users.
|
|
33
|
+
- `cdd-kit gate` now lints `tasks.md` frontmatter:
|
|
34
|
+
- Requires `change-id` and `status`.
|
|
35
|
+
- Validates `status` against known set (`in-progress`, `completed`,
|
|
36
|
+
`gate-blocked`, `abandoned`, `needs-review`, `complete`, `done`).
|
|
37
|
+
- Warns on unknown keys with did-you-mean suggestions (e.g. `Tier:` →
|
|
38
|
+
`did you mean tier?`). Catches the typo class that previously caused
|
|
39
|
+
silent enforcement skips.
|
|
40
|
+
- `cdd-kit gate` now detects `depends-on` cycles via DFS and reports the
|
|
41
|
+
full cycle path (e.g. `feat-a → feat-b → feat-c → feat-a`).
|
|
42
|
+
- `cdd-kit doctor --fix`: auto-resolves the safe subset of warnings
|
|
43
|
+
- regenerates stale or missing `specs/context/*.md` indexes
|
|
44
|
+
- populates empty `model-policy.json` roles with defaults
|
|
45
|
+
- leaves invasive fixes (`.cdd/*` missing → suggests `cdd-kit upgrade`)
|
|
46
|
+
for the user to confirm
|
|
47
|
+
- `cdd-kit gate`: artifact-pointer existence check now runs **by default**
|
|
48
|
+
(previously `--strict`-only). Use `--lax` to skip for legacy repos with
|
|
49
|
+
unfixed agent logs.
|
|
50
|
+
|
|
51
|
+
### Tests
|
|
52
|
+
|
|
53
|
+
- 11 new tests across `gate.test.ts` (frontmatter lint, DAG cycle, default
|
|
54
|
+
pointer check), `new.test.ts` (auto-scan), `doctor.test.ts` (--fix).
|
|
55
|
+
- Updated `gate.test.ts` test 13b — its premise inverted by PR-3 #6.
|
|
56
|
+
- Updated `writeValidChangeArtifacts` helper to include required frontmatter.
|
|
57
|
+
|
|
58
|
+
## [1.14.0] - 2026-04-30
|
|
59
|
+
|
|
60
|
+
### Agent efficiency for non-engineer users
|
|
61
|
+
|
|
62
|
+
- `/cdd-new` Step 0: request-quality pre-lint. Refuses to run when the user's
|
|
63
|
+
request is missing affected-surface, desired-behavior, or success-criterion.
|
|
64
|
+
Avoids one full classifier round-trip on ambiguous requests.
|
|
65
|
+
- `change-classifier`: atomic-split detection. Mega-requests crossing 2+
|
|
66
|
+
change-types or 3+ surfaces now return an `## Atomic Split Proposal` table
|
|
67
|
+
with suggested `cdd-kit new --depends-on` commands instead of a single
|
|
68
|
+
Tier 0/1 monolith. Estimated 40-60% token saving on multi-feature requests.
|
|
69
|
+
- `references/agent-log-protocol.md`: every agent must self-validate its log
|
|
70
|
+
block before sending its response. Prevents the round-trip where gate
|
|
71
|
+
catches a malformed log and forces a full agent re-run.
|
|
72
|
+
- `/cdd-new` Step 4 fix-back: structured error-to-agent routing table. Each
|
|
73
|
+
gate error class now has a defined re-invocation owner and a templated
|
|
74
|
+
prompt prefix that includes the verbatim gate error. No more "blind retry".
|
|
75
|
+
|
|
76
|
+
### Notes
|
|
77
|
+
|
|
78
|
+
This release is prompt-only (no code changes in `src/`). Improvements are
|
|
79
|
+
qualitative for the AI agent flow, not exposed as new CLI flags.
|
|
80
|
+
|
|
81
|
+
## [1.13.0] - 2026-04-29
|
|
82
|
+
|
|
83
|
+
### Token-budget reductions
|
|
84
|
+
- Shared `references/agent-log-protocol.md` — extracted the duplicated agent-log
|
|
85
|
+
format block out of all 16 agent prompts. Total agent-prompt size dropped
|
|
86
|
+
from 1675 → 1344 lines (≈20% smaller). One source of truth, no drift.
|
|
87
|
+
- `/cdd-new` skill no longer inlines the 5 change-template bodies; `cdd-kit
|
|
88
|
+
new` writes them from disk. Skill went from 483 → ~340 lines (≈30%).
|
|
89
|
+
- Tier 5 fast-path for docs/prompts/config-only changes — classifier now
|
|
90
|
+
short-circuits the full agent flow when no source/tests/contracts are
|
|
91
|
+
touched; bounds doc-only token cost to 2 read-only reviews.
|
|
92
|
+
- `context-manifest.md` template no longer duplicates the forbidden-paths list
|
|
93
|
+
that `.cdd/context-policy.json` already carries.
|
|
94
|
+
- `cdd-kit context-scan` now caps per-directory entries to 50 and supports
|
|
95
|
+
`--surface <path>` to scope the project map to a sub-tree.
|
|
96
|
+
|
|
97
|
+
### Stability hardening
|
|
98
|
+
- Tier source moved to `tasks.md` frontmatter `tier: <0-5>`. The legacy
|
|
99
|
+
`## Tier\n- N` and `**Tier:** Tier N` formats remain as fallback-only;
|
|
100
|
+
bold-only legacy format produces a migration warning instead of silently
|
|
101
|
+
skipping tier-specific agent enforcement.
|
|
102
|
+
- Section-7 archive exemption is no longer hard-coded `7\.[12]`; reads from
|
|
103
|
+
`tasks.md` frontmatter `archive-tasks: ["7.1", "7.2"]` (default preserved).
|
|
104
|
+
- `cdd-kit migrate` is now atomic: per-session backup at
|
|
105
|
+
`.cdd/migrate-backup/<timestamp>/`, two-phase tmp-write + rename, restore
|
|
106
|
+
hint on failure. New `--no-backup` opt-out.
|
|
107
|
+
- `cdd-kit migrate` now backfills `tier:` and `archive-tasks:` into legacy
|
|
108
|
+
`tasks.md` frontmatter automatically.
|
|
109
|
+
- `cdd-kit doctor` freshness check is now content-hash based, not mtime.
|
|
110
|
+
`git clone` no longer triggers spurious staleness warnings.
|
|
111
|
+
- `cdd-kit context approve|reject --all-pending` resolves every pending
|
|
112
|
+
Context Expansion Request in one command.
|
|
113
|
+
- `cdd-kit gate` now reconciles agent self-reported `files-read:` against the
|
|
114
|
+
runtime hook log at `.cdd/runtime/<change-id>-files-read.jsonl`. Undeclared
|
|
115
|
+
reads warn (or fail under `--strict`).
|
|
116
|
+
- `hooks/post-tool-use-files-read.sh` — Claude Code PostToolUse hook scaffold
|
|
117
|
+
that records actual Read/Grep/Glob targets for the gate to verify.
|
|
118
|
+
- `cdd-kit gate` now invokes `validate` in-process instead of via
|
|
119
|
+
`spawnSync(process.execPath, [process.argv[1], ...])`. No more `argv[1]`
|
|
120
|
+
indirection or extra Node startup.
|
|
121
|
+
- `.cdd/model-policy.json` ships with real role-to-model defaults (no longer
|
|
122
|
+
empty `{}`). `cdd-kit doctor` warns when an installed agent's `model:`
|
|
123
|
+
frontmatter drifts from policy. `init`/`upgrade` preserve any custom
|
|
124
|
+
`roles` overrides instead of clobbering them.
|
|
125
|
+
|
|
126
|
+
### Skill updates
|
|
127
|
+
- `/cdd-new` now lints classifier output before writing files (`## Tier`,
|
|
128
|
+
`## Required Agents`, `## Inferred Acceptance Criteria` must be filled).
|
|
129
|
+
- `/cdd-new` writes the classifier's tier into `tasks.md` frontmatter as the
|
|
130
|
+
authoritative source.
|
|
131
|
+
|
|
132
|
+
### Tests
|
|
133
|
+
- 19 new tests covering B1–B7 + A5 + B3. 39 gate tests, 15 migrate tests, 9
|
|
134
|
+
context tests, 7 doctor tests all pass.
|
|
135
|
+
|
|
136
|
+
## [1.12.0] - 2026-04-29
|
|
137
|
+
|
|
138
|
+
### Added
|
|
139
|
+
- `cdd-kit doctor --json` for CI and machine-readable repository health checks.
|
|
140
|
+
- `cdd-kit upgrade --migrate-changes [--enable-context-governance]` to combine repo-level upgrade work with legacy change migration.
|
|
141
|
+
- `cdd-kit context request`, `cdd-kit context reject`, and `cdd-kit context list [--json]` for a fuller context expansion workflow.
|
|
142
|
+
|
|
143
|
+
### Changed
|
|
144
|
+
- Default contract templates now include deterministic `summary`, `owner`, and `surface` metadata so fresh repos do not start with avoidable `contracts-index` warnings.
|
|
145
|
+
- `cdd-kit context-scan` now excludes `contracts/CHANGELOG.md` from the contracts index.
|
|
146
|
+
- Shared provider inference is now reused by `update`, `doctor`, and `upgrade`.
|
|
147
|
+
- Migration messaging now refers to the current cdd-kit format instead of pinning docs to one release number.
|
|
148
|
+
|
|
149
|
+
### Docs
|
|
150
|
+
- README now includes production rollout guidance for old repos, with separate migration paths for completed specs and in-progress specs.
|
|
151
|
+
- Release checklist now covers `doctor --json`, `upgrade --migrate-changes`, and post-upgrade context governance decisions.
|
|
152
|
+
|
|
153
|
+
## [1.11.0] - 2026-04-28
|
|
154
|
+
|
|
155
|
+
### Added
|
|
156
|
+
- Context Governance v1 for new changes: `context-manifest.md`, `files-read` audit expectations, default forbidden paths, and legacy-vs-new gate behavior.
|
|
157
|
+
- Provider adapter scaffold for Claude Code and Codex: `init --provider claude|codex|both`, provider-aware `update`, and `.cdd/model-policy.json`.
|
|
158
|
+
- `cdd-kit context-scan`: deterministic `specs/context/project-map.md` and `specs/context/contracts-index.md` indexes for lower-token classification.
|
|
159
|
+
- `cdd-kit doctor`: repo health checks for missing config, provider guidance, stale context indexes, and contract summary gaps.
|
|
160
|
+
- `cdd-kit upgrade`: dry-run-first repo-level upgrade command that adds missing cdd-kit files without overwriting existing project guidance or contracts.
|
|
161
|
+
- `cdd-kit context approve <change-id> <request-id>`: approves pending expansion requests and records approved paths in the manifest.
|
|
162
|
+
- Atomic change dependencies with `cdd-kit new --depends-on` and gate blocking until upstream changes complete or archive.
|
|
163
|
+
- `/cdd-new`, `/cdd-resume`, and `/cdd-close` prompt hardening for manifest-scoped reads, hot/warm/cold data handling, and context index usage.
|
|
164
|
+
|
|
165
|
+
### Changed
|
|
166
|
+
- `cdd-kit migrate` can add legacy or context-governed manifests and opt old changes into `context-governance: v1`.
|
|
167
|
+
- README now describes provider-neutral usage, context governance, upgrade flow, and context expansion approval.
|
|
168
|
+
|
|
169
|
+
### Notes
|
|
170
|
+
- Context Governance audits and discourages unauthorized reads. It is not a runtime sandbox and still depends on agent-log evidence plus gate review.
|
|
171
|
+
|
|
172
|
+
## [1.10.0] - 2026-04-27
|
|
173
|
+
|
|
174
|
+
### Added
|
|
175
|
+
- `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.
|
|
176
|
+
- `cdd-kit gate`: artifact pointer validation in strict mode. Each path listed under `- artifacts:` in agent logs is verified to exist on disk.
|
|
177
|
+
- `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`.
|
|
178
|
+
- `cdd-kit gate`: differentiated minimum char counts per artifact (change-classification and test-plan >= 200, ci-gates >= 150, others >= 100).
|
|
179
|
+
- `cdd-kit gate`: scoped validate call to `--contracts --env --ci --versions`.
|
|
180
|
+
- `cdd-kit abandon <change-id> --reason <text>`: marks a change as abandoned in `tasks.md` and records it in `specs/archive/INDEX.md`.
|
|
181
|
+
- `cdd-kit archive <change-id>`: moves a completed change from `specs/changes/` to `specs/archive/<year>/`.
|
|
182
|
+
- `/cdd-close` skill synthesizes `archive.md` from `agent-log/` and `qa-report.md` before archiving, then invokes `contract-reviewer` for durable promotion diffs.
|
|
183
|
+
- `/cdd-resume` resumes an in-progress change across sessions by reading `tasks.md` and `agent-log/` to determine the next pending agent.
|
|
184
|
+
- `change-classifier` now outputs `## Inferred Acceptance Criteria` and `## Tasks Not Applicable`.
|
|
185
|
+
- All agents require `CURRENT_CHANGE_ID: <id>` in every prompt.
|
|
186
|
+
- `cdd-new` injects `CURRENT_CHANGE_ID` into every agent call, auto-marks N/A tasks with `[-]`, and passes acceptance criteria to `test-strategist`.
|
|
187
|
+
- `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`.
|
|
188
|
+
|
|
189
|
+
### Fixed
|
|
190
|
+
- Tier detection regex tightened to avoid matching unfilled classifier templates.
|
|
191
|
+
- Agent read-scope placeholder `<current-change-id>` replaced with runtime `CURRENT_CHANGE_ID` injection.
|
|
192
|
+
- `archive.md` removed from `/cdd-new` opt-in surface because it is synthesized at close time.
|
|
193
|
+
|
|
194
|
+
## [1.0.1] - 2026-04-20
|
|
195
|
+
|
|
196
|
+
### Fixed
|
|
197
|
+
- CLI binary renamed from `cdd` to `cdd-kit` for npm uniqueness.
|
|
198
|
+
- Corrected bin path format for npm 11.x compatibility.
|
|
199
|
+
|
|
200
|
+
## [1.0.0] - 2026-04-20
|
|
201
|
+
|
|
202
|
+
### Added
|
|
203
|
+
- Initial release of the contract-driven-delivery CLI (`cdd-kit`).
|
|
204
|
+
- Commands: `init`, `new`, `gate`, `validate`, `detect-stack`.
|
|
205
|
+
- Tier-based change classification, contract scaffolding, and agent-log validation.
|
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# Contract-Driven Delivery Kit
|
|
2
2
|
|
|
3
|
-
**cdd-kit** is a
|
|
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)
|
|
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
|
+
|
|
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.
|
|
6
8
|
|
|
7
9
|
---
|
|
8
10
|
|
|
@@ -88,11 +90,14 @@ or
|
|
|
88
90
|
|
|
89
91
|
**What happens:**
|
|
90
92
|
1. Claude generates a `change-id` (e.g. `add-jwt-auth`) and scaffolds `specs/changes/add-jwt-auth/`
|
|
91
|
-
2.
|
|
92
|
-
3.
|
|
93
|
-
4.
|
|
94
|
-
5.
|
|
95
|
-
6.
|
|
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
|
|
96
101
|
|
|
97
102
|
**You stay in control by:**
|
|
98
103
|
- Reviewing the `change-classification.md` before implementation starts
|
|
@@ -212,22 +217,61 @@ Installs agents and skill into `~/.claude` and scaffolds project files.
|
|
|
212
217
|
cdd-kit init # global + local (recommended)
|
|
213
218
|
cdd-kit init --global-only # only install into ~/.claude
|
|
214
219
|
cdd-kit init --local-only # only scaffold project files
|
|
220
|
+
cdd-kit init --provider codex # scaffold Codex-oriented project guidance
|
|
221
|
+
cdd-kit init --provider both # scaffold Claude Code + Codex guidance
|
|
215
222
|
cdd-kit init --force # overwrite existing project files
|
|
216
223
|
```
|
|
217
224
|
|
|
218
|
-
Creates: `contracts/`, `specs/templates/`, `CLAUDE.md`, `AGENTS.md`, `hooks/`
|
|
225
|
+
Creates: `contracts/`, `specs/templates/`, provider guidance files (`CLAUDE.md`, `AGENTS.md`, and/or `CODEX.md`), `hooks/`
|
|
219
226
|
|
|
220
227
|
---
|
|
221
228
|
|
|
222
229
|
### `cdd-kit update`
|
|
223
230
|
|
|
224
|
-
Updates
|
|
231
|
+
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
232
|
|
|
226
233
|
```bash
|
|
227
234
|
cdd-kit update
|
|
228
235
|
cdd-kit update --yes # apply without confirmation
|
|
236
|
+
cdd-kit update --provider codex
|
|
237
|
+
cdd-kit update --provider both
|
|
229
238
|
```
|
|
230
239
|
|
|
240
|
+
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`.
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
### `cdd-kit doctor`
|
|
245
|
+
|
|
246
|
+
Inspects repo-level cdd-kit health. Default mode is read-only; `--fix` applies only the safe auto-remediations.
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
cdd-kit doctor
|
|
250
|
+
cdd-kit doctor --strict
|
|
251
|
+
cdd-kit doctor --fix
|
|
252
|
+
cdd-kit doctor --json
|
|
253
|
+
cdd-kit doctor --provider codex
|
|
254
|
+
```
|
|
255
|
+
|
|
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.
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
### `cdd-kit upgrade`
|
|
261
|
+
|
|
262
|
+
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.
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
cdd-kit upgrade
|
|
266
|
+
cdd-kit upgrade --yes
|
|
267
|
+
cdd-kit upgrade --yes --migrate-changes
|
|
268
|
+
cdd-kit upgrade --yes --migrate-changes --enable-context-governance
|
|
269
|
+
cdd-kit upgrade --provider codex --yes
|
|
270
|
+
cdd-kit upgrade --provider both --yes
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
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.
|
|
274
|
+
|
|
231
275
|
---
|
|
232
276
|
|
|
233
277
|
### `cdd-kit gate <change-id>`
|
|
@@ -237,20 +281,26 @@ The single quality gate for a change. Blocks merge if anything is missing or inc
|
|
|
237
281
|
```bash
|
|
238
282
|
cdd-kit gate add-jwt-auth
|
|
239
283
|
cdd-kit gate add-jwt-auth --strict
|
|
284
|
+
cdd-kit gate add-jwt-auth --lax
|
|
240
285
|
```
|
|
241
286
|
|
|
242
287
|
Checks:
|
|
243
|
-
- All
|
|
288
|
+
- 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
289
|
- Each artifact has sufficient content (not a stub): change-classification ≥ 200 chars, test-plan ≥ 200, ci-gates ≥ 150, others ≥ 100
|
|
245
290
|
- `change-classification.md` contains a tier or risk marker
|
|
246
291
|
- `agent-log/*.md` files all have `status: complete` (not blocked)
|
|
292
|
+
- 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`
|
|
293
|
+
- Atomic `depends-on` upstream changes are completed or archived before dependent work gates
|
|
247
294
|
- Tier 0–1 changes have `e2e-resilience-engineer`, `monkey-test-engineer`, and `stress-soak-engineer` logs
|
|
248
295
|
- Tier 0–3 changes have `contract-reviewer` and `qa-reviewer` logs
|
|
249
296
|
- All contract validators pass
|
|
250
297
|
|
|
251
298
|
`--strict` additionally:
|
|
252
299
|
- Treats any pending `[ ]` tasks (except section 7 archive items) as errors
|
|
253
|
-
-
|
|
300
|
+
- Treats runtime-vs-declared `files-read` drift as errors
|
|
301
|
+
- Treats legacy changes missing `context-manifest.md` or `files-read` audit data as errors
|
|
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.
|
|
254
304
|
|
|
255
305
|
Pre-commit hook uses `--strict` by default (installed via `cdd-kit install-hooks`).
|
|
256
306
|
|
|
@@ -315,18 +365,78 @@ Upgrades pre-v1.11.0 change directories to the current format.
|
|
|
315
365
|
cdd-kit migrate add-jwt-auth # migrate one change
|
|
316
366
|
cdd-kit migrate --all # migrate all changes in specs/changes/
|
|
317
367
|
cdd-kit migrate --all --dry-run # preview without writing
|
|
368
|
+
cdd-kit migrate --all --enable-context-governance
|
|
318
369
|
```
|
|
319
370
|
|
|
320
371
|
What it upgrades:
|
|
321
372
|
- `tasks.md`: adds YAML frontmatter (`change-id`, `status: in-progress`) and `[x]/[-]/[ ]` legend if missing
|
|
322
373
|
- `change-classification.md`: detects old `**Tier:** Tier N` format and appends the new `## Tier\n- N` section so tier-based gate checks activate
|
|
374
|
+
- `context-manifest.md`: adds a legacy manifest scaffold by default so old changes can continue with warning-only context audit behavior
|
|
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
|
|
376
|
+
|
|
377
|
+
`agent-log/*.md` must use this `files-read` format for context-governed changes:
|
|
378
|
+
|
|
379
|
+
```md
|
|
380
|
+
- files-read:
|
|
381
|
+
- contracts/api/api-contract.md
|
|
382
|
+
- src/server/routes/users.ts
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
Paths must be repo-relative. Absolute paths and `..` parent traversal are rejected.
|
|
323
386
|
|
|
324
387
|
Run this after upgrading from v1.10 or earlier if you have mid-flight changes.
|
|
325
388
|
|
|
326
389
|
```bash
|
|
327
390
|
cdd-kit migrate --all
|
|
328
391
|
git add specs/changes/
|
|
329
|
-
git commit -m "chore: migrate changes to
|
|
392
|
+
git commit -m "chore: migrate changes to current cdd-kit format"
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
### `cdd-kit context request <change-id> <request-id>`
|
|
398
|
+
|
|
399
|
+
Records a pending Context Expansion Request in `context-manifest.md`.
|
|
400
|
+
|
|
401
|
+
```bash
|
|
402
|
+
cdd-kit context request add-jwt-auth CER-001 --path src/server/users.ts tests/users.test.ts --reason "paired implementation and regression coverage"
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
Use this when an agent needs more context than its current work packet allows.
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
### `cdd-kit context approve <change-id> <request-id>`
|
|
410
|
+
|
|
411
|
+
Approves a pending Context Expansion Request in `context-manifest.md` and adds its `requested_paths` to `## Approved Expansions`.
|
|
412
|
+
|
|
413
|
+
```bash
|
|
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
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
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.
|
|
419
|
+
|
|
420
|
+
---
|
|
421
|
+
|
|
422
|
+
### `cdd-kit context reject <change-id> <request-id>`
|
|
423
|
+
|
|
424
|
+
Rejects a pending Context Expansion Request and records `status: rejected` in the manifest.
|
|
425
|
+
|
|
426
|
+
```bash
|
|
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
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
### `cdd-kit context list <change-id>`
|
|
434
|
+
|
|
435
|
+
Lists all Context Expansion Requests for a change.
|
|
436
|
+
|
|
437
|
+
```bash
|
|
438
|
+
cdd-kit context list add-jwt-auth
|
|
439
|
+
cdd-kit context list add-jwt-auth --json
|
|
330
440
|
```
|
|
331
441
|
|
|
332
442
|
---
|
|
@@ -354,8 +464,14 @@ Scaffolds an empty change directory. Normally you use `/cdd-new` (the Claude Cod
|
|
|
354
464
|
cdd-kit new add-user-auth
|
|
355
465
|
cdd-kit new add-user-auth --all # include optional templates too
|
|
356
466
|
cdd-kit new add-user-auth --force # overwrite existing directory
|
|
467
|
+
cdd-kit new add-user-api --depends-on add-user-db
|
|
468
|
+
cdd-kit new add-user-auth --skip-scan
|
|
357
469
|
```
|
|
358
470
|
|
|
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.md` frontmatter.
|
|
474
|
+
|
|
359
475
|
---
|
|
360
476
|
|
|
361
477
|
### `cdd-kit install-hooks`
|
|
@@ -396,25 +512,78 @@ cdd-kit detect-stack
|
|
|
396
512
|
|
|
397
513
|
---
|
|
398
514
|
|
|
399
|
-
|
|
515
|
+
### `cdd-kit context-scan`
|
|
516
|
+
|
|
517
|
+
Builds deterministic, low-token context indexes for classifiers and orchestrators.
|
|
518
|
+
|
|
519
|
+
```bash
|
|
520
|
+
cdd-kit context-scan
|
|
521
|
+
cdd-kit context-scan --surface src/server # scope project-map to a sub-tree (large monorepos)
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
Outputs:
|
|
525
|
+
- `specs/context/project-map.md`: ASCII directory tree with schema metadata, visible file/dir counts, and excluded paths from `.cdd/context-policy.json`
|
|
526
|
+
- `specs/context/contracts-index.md`: contract inventory table plus deterministic details from YAML frontmatter or `<!-- cdd: ... -->` metadata
|
|
527
|
+
|
|
528
|
+
Recommended contract metadata:
|
|
529
|
+
|
|
530
|
+
```yaml
|
|
531
|
+
---
|
|
532
|
+
contract: api
|
|
533
|
+
summary: User API endpoint rules and compatibility policy.
|
|
534
|
+
owner: backend-team
|
|
535
|
+
surface: user-management
|
|
536
|
+
---
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
The classifier should read these two files before proposing `context-manifest.md` allowed paths.
|
|
540
|
+
|
|
541
|
+
---
|
|
542
|
+
|
|
543
|
+
## Migrating an Older Production Repo
|
|
400
544
|
|
|
401
545
|
```bash
|
|
402
546
|
npm update -g contract-driven-delivery
|
|
403
|
-
cdd-kit
|
|
547
|
+
cdd-kit upgrade --yes
|
|
548
|
+
cdd-kit context-scan
|
|
549
|
+
cdd-kit doctor --strict
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
### Old completed specs
|
|
553
|
+
|
|
554
|
+
If a change is already finished, merged, or only kept for audit/history:
|
|
404
555
|
|
|
405
|
-
|
|
556
|
+
```bash
|
|
406
557
|
cdd-kit migrate --all
|
|
407
558
|
git add specs/changes/
|
|
408
|
-
git commit -m "chore: migrate changes to
|
|
559
|
+
git commit -m "chore: migrate changes to current cdd-kit format"
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
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.
|
|
563
|
+
|
|
564
|
+
### Old in-progress specs
|
|
565
|
+
|
|
566
|
+
If a change is still being actively developed:
|
|
567
|
+
|
|
568
|
+
```bash
|
|
569
|
+
cdd-kit upgrade --yes --migrate-changes
|
|
570
|
+
cdd-kit context-scan
|
|
571
|
+
cdd-kit doctor --strict
|
|
409
572
|
```
|
|
410
573
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
-
|
|
414
|
-
- `cdd-kit
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
574
|
+
Then choose one path per active change:
|
|
575
|
+
|
|
576
|
+
- Conservative path: keep the migrated legacy manifest, resume work, and let `gate` warn on missing `files-read` data while the team transitions.
|
|
577
|
+
- 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.
|
|
578
|
+
|
|
579
|
+
### Recommended rollout for production repos already burned by token overuse
|
|
580
|
+
|
|
581
|
+
1. Run `cdd-kit upgrade --yes` once per repo after updating the npm package.
|
|
582
|
+
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.
|
|
583
|
+
3. Run `cdd-kit doctor --strict` in CI.
|
|
584
|
+
4. Migrate old completed specs with plain `cdd-kit migrate`.
|
|
585
|
+
5. Migrate active specs with `cdd-kit migrate --enable-context-governance` only after reviewing the generated manifest.
|
|
586
|
+
6. Teach agents to use `cdd-kit context request/approve/reject/list` instead of silently widening context.
|
|
418
587
|
|
|
419
588
|
---
|
|
420
589
|
|
|
@@ -445,7 +614,8 @@ your-repo/
|
|
|
445
614
|
│ └── templates/
|
|
446
615
|
├── tests/
|
|
447
616
|
├── CLAUDE.md ← Claude's project guide (edit this)
|
|
448
|
-
|
|
617
|
+
├── AGENTS.md ← agent roster (auto-managed)
|
|
618
|
+
└── CODEX.md ← Codex project guide when initialized for Codex
|
|
449
619
|
```
|
|
450
620
|
|
|
451
621
|
---
|
|
@@ -40,3 +40,13 @@ 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 (`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.
|
|
@@ -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.
|
|
@@ -47,19 +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
|
|
51
|
-
|
|
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
|
-
- artifacts:
|
|
59
|
-
- <evidence-type>: <concrete pointer>
|
|
60
|
-
- <evidence-type>: <concrete pointer>
|
|
61
|
-
- next-action: <one line, or "none">
|
|
62
|
-
```
|
|
50
|
+
After completing your task, write or append to
|
|
51
|
+
`specs/changes/<change-id>/agent-log/<your-agent-name>.md`. 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.
|
|
63
54
|
|
|
64
55
|
### Required artifacts for this agent
|
|
65
56
|
- `files-changed`: list of `path/to/file.ts:line-range`
|
|
@@ -67,16 +58,6 @@ with this exact structure (lines starting with `- ` are required):
|
|
|
67
58
|
- `test-output`: last 10 lines of `npm test` or equivalent stdout
|
|
68
59
|
- `contracts-touched`: list of contract file paths or "none"
|
|
69
60
|
|
|
70
|
-
### Rules
|
|
71
|
-
- NEVER omit this log file. `cdd-kit gate` rejects changes whose agent-log
|
|
72
|
-
is missing the `status:` line or has an invalid status.
|
|
73
|
-
- If you cannot complete the task, set `status: blocked` and write a
|
|
74
|
-
concrete `next-action` (NOT "investigate further" — write the actual
|
|
75
|
-
next step a human can act on).
|
|
76
|
-
- Evidence must be concrete: file:line, command name + last-10-line stdout,
|
|
77
|
-
contract path + section, test name, etc. NEVER write "verified" or "OK"
|
|
78
|
-
without a pointer.
|
|
79
|
-
|
|
80
61
|
## Read scope
|
|
81
62
|
|
|
82
63
|
- Allowed: `contracts/`, `tests/`, `src/`, `specs/changes/<current-change-id>/`
|