contract-driven-delivery 2.0.16 → 2.0.17

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 (28) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +69 -81
  3. package/assets/CLAUDE.template.md +3 -3
  4. package/assets/CODEX.template.md +5 -5
  5. package/assets/agents/backend-engineer.md +29 -31
  6. package/assets/agents/change-classifier.md +28 -33
  7. package/assets/agents/ci-cd-gatekeeper.md +21 -25
  8. package/assets/agents/contract-reviewer.md +21 -26
  9. package/assets/agents/dependency-security-reviewer.md +21 -26
  10. package/assets/agents/e2e-resilience-engineer.md +19 -23
  11. package/assets/agents/frontend-engineer.md +29 -31
  12. package/assets/agents/monkey-test-engineer.md +19 -23
  13. package/assets/agents/qa-reviewer.md +20 -25
  14. package/assets/agents/repo-context-scanner.md +17 -22
  15. package/assets/agents/spec-architect.md +17 -21
  16. package/assets/agents/spec-drift-auditor.md +17 -22
  17. package/assets/agents/stress-soak-engineer.md +17 -21
  18. package/assets/agents/test-strategist.md +24 -28
  19. package/assets/agents/ui-ux-reviewer.md +16 -21
  20. package/assets/agents/visual-reviewer.md +19 -24
  21. package/assets/skills/cdd-new/SKILL.md +112 -119
  22. package/assets/skills/contract-driven-delivery/SKILL.md +3 -3
  23. package/assets/skills/contract-driven-delivery/references/agent-log-protocol.md +68 -157
  24. package/assets/skills/contract-driven-delivery/references/code-map-protocol.md +57 -35
  25. package/assets/skills/contract-driven-delivery/templates/agent-log.example.yml +6 -0
  26. package/assets/skills/contract-driven-delivery/templates/change-classification.md +2 -2
  27. package/dist/cli/index.js +2353 -2134
  28. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.0.17] - 2026-05-07
4
+
5
+ Focused index-assisted development release. Agents now get a smaller, more
6
+ precise pre-read path through the code-map, while `cdd-kit gate` returns to
7
+ delivery-quality validation instead of post-run harness paperwork.
8
+
9
+ ### Added
10
+
11
+ - **`cdd-kit index query <term>`**: searches `.cdd/code-map.yml` for matching
12
+ files, imports, symbols, and line ranges, auto-refreshing a missing or stale
13
+ map before returning candidates.
14
+ - **`cdd-kit index impact <path-or-symbol>`**: reports indexed local imports and
15
+ dependent files so agents can inspect the smallest useful modification scope
16
+ before editing.
17
+
18
+ ### Changed
19
+
20
+ - **Gate is now delivery-quality only**: `cdd-kit gate` validates required
21
+ artifacts, tasks, tier consistency, dependencies, and contract validators,
22
+ without requiring agent logs, files-read lists, or code-map freshness as
23
+ merge blockers.
24
+ - **Agent prompts prefer index-first targeting**: implementation agents are
25
+ instructed to use `index query` before broad source reads and `index impact`
26
+ before editing chosen source files.
27
+ - **Agent logs are optional handoff notes**: prompt templates and protocols no
28
+ longer require agents to create logs or reconstruct every file they read just
29
+ to satisfy a gate.
30
+
3
31
  ## [2.0.16] - 2026-05-06
4
32
 
5
33
  New-change scaffold hardening so freshly opened proposals use the installed
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # Contract-Driven Delivery Kit
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, with deterministic context indexes and manifest-backed read-scope auditing to keep long agent runs reviewable.
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 to keep agent work targeted.
4
4
 
5
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
- **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.
7
+ **Context Governance v1** adds a manifest-driven planning layer for AI agents. New changes include `context-manifest.md`; agents should use `cdd-kit index query` and `cdd-kit index impact` before broad source reads. `cdd-kit gate` focuses on delivery quality, not post-run read paperwork.
8
8
 
9
9
  ---
10
10
 
@@ -38,7 +38,7 @@ cdd-kit init
38
38
 
39
39
  ## How to Direct Claude Code
40
40
 
41
- > All workflows are started by typing a **natural language instruction** to Claude Code in your IDE or terminal. The `/cdd-*` prefixed commands are Claude Code skills not shell commands.
41
+ > All workflows are started by typing a **natural language instruction** to Claude Code in your IDE or terminal. The `/cdd-*` prefixed commands are Claude Code skills ??not shell commands.
42
42
 
43
43
  ### Starting a new project (first time)
44
44
 
@@ -94,8 +94,8 @@ or
94
94
  3. The `change-classifier` agent (Opus) reads the request, classifies risk and tier, decides which agents are needed
95
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
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)
97
+ 6. Agents run in order: contracts ??test plan ??spec/architecture review (if needed) ??backend engineer ??frontend engineer ??CI/CD gates ??QA
98
+ 7. Agents write implementation artifacts and optional concise handoff notes
99
99
  8. `cdd-kit gate <change-id>` runs automatically to confirm all artifacts are complete
100
100
  9. Claude reports a summary and the suggested git commit
101
101
 
@@ -108,7 +108,7 @@ Use a lightweight maintenance lane for small corrections where the intent is alr
108
108
  | Lane | Examples | Required record |
109
109
  |---|---|---|
110
110
  | maintenance / micro-change | typo fixes, comment updates, README cleanup, formatting, lint-only fixes, tiny local test repair | normal commit message and test output if applicable |
111
- | tracked CDD change | behavior changes, contract updates, API/data/env/security/CI changes, cross-module refactors, high-risk bug fixes | `specs/changes/<id>/`, `tasks.yml`, `context-manifest.md`, agent logs, and `cdd-kit gate` |
111
+ | tracked CDD change | behavior changes, contract updates, API/data/env/security/CI changes, cross-module refactors, high-risk bug fixes | `specs/changes/<id>/`, `tasks.yml`, `context-manifest.md`, and `cdd-kit gate` |
112
112
 
113
113
  Do not add hard pre-commit rules that block every `src/`, `tests/`, or `contracts/` edit unless your team explicitly wants that policy. The default kit favors low-friction traceability: make risky changes reviewable, but let obvious maintenance edits stay small.
114
114
 
@@ -118,8 +118,8 @@ Machine-readable metadata such as future `change.yml` / `trace.yml` should follo
118
118
 
119
119
  CDD uses two agent classes on purpose:
120
120
 
121
- - `change-classifier`, `contract-reviewer`, `qa-reviewer`, `visual-reviewer`, `dependency-security-reviewer`, `ui-ux-reviewer`, `repo-context-scanner`, and `spec-drift-auditor` are read-only. They return analysis, verdicts, or an `Agent Log` YAML block; main Claude writes the corresponding files.
122
- - `backend-engineer`, `frontend-engineer`, `e2e-resilience-engineer`, `monkey-test-engineer`, `stress-soak-engineer`, `ci-cd-gatekeeper`, `test-strategist`, and `spec-architect` are write-capable. They write their own implementation artifacts and their own `agent-log/*.yml`.
121
+ - `change-classifier`, `contract-reviewer`, `qa-reviewer`, `visual-reviewer`, `dependency-security-reviewer`, `ui-ux-reviewer`, `repo-context-scanner`, and `spec-drift-auditor` are read-only. They return analysis, verdicts, or optional handoff notes; main Claude writes the corresponding files.
122
+ - `backend-engineer`, `frontend-engineer`, `e2e-resilience-engineer`, `monkey-test-engineer`, `stress-soak-engineer`, `ci-cd-gatekeeper`, `test-strategist`, and `spec-architect` are write-capable. They write their own implementation artifacts directly.
123
123
 
124
124
  This split is deliberate:
125
125
 
@@ -130,7 +130,7 @@ This split is deliberate:
130
130
  **You stay in control by:**
131
131
  - Reviewing the `change-classification.md` before implementation starts
132
132
  - Checking the `test-plan.md` to confirm the right test families are planned
133
- - Reading the final `agent-log/qa-reviewer.yml` for the release-readiness verdict
133
+ - Reading the final QA summary for the release-readiness verdict
134
134
 
135
135
  ---
136
136
 
@@ -148,7 +148,7 @@ This split is deliberate:
148
148
  /cdd-new add Redis caching layer to the reporting queries
149
149
  ```
150
150
 
151
- The change-classifier will detect that these are architectural or contract-level changes, assign a higher risk tier (0–2), and automatically require:
151
+ The change-classifier will detect that these are architectural or contract-level changes, assign a higher risk tier (0??), and automatically require:
152
152
  - Architecture review (`spec-architect` agent)
153
153
  - E2E, resilience, stress, and monkey tests
154
154
  - Updated contracts before any implementation begins
@@ -170,7 +170,7 @@ What changes are currently in progress? (cdd-kit list)
170
170
  ```
171
171
 
172
172
  **What happens:**
173
- 1. Claude reads `tasks.yml` and `agent-log/` to determine what was completed
173
+ 1. Claude reads `tasks.yml` and existing change artifacts to determine what was completed
174
174
  2. Reports the current state (which agents ran, which tasks are pending)
175
175
  3. Asks if you want to continue from the next pending agent
176
176
  4. Resumes the full agent flow from where it stopped, with no duplication
@@ -189,9 +189,9 @@ After the PR is merged:
189
189
 
190
190
  **What happens:**
191
191
  1. Runs `cdd-kit gate` to confirm the change still passes
192
- 2. Synthesizes `archive.md` a permanent record of what changed, what tests were added, and what lessons were found
192
+ 2. Synthesizes `archive.md` ??a permanent record of what changed, what tests were added, and what lessons were found
193
193
  3. Promotes only evidence-backed durable learnings to `contracts/` or project guidance (`CLAUDE.md`/`CODEX.md`). General agents record evidence and findings only; durable learning promotion happens during `/cdd-close` Step 3.
194
- 4. Runs `cdd-kit archive add-jwt-auth` moves the change from `specs/changes/` to `specs/archive/2026/`
194
+ 4. Runs `cdd-kit archive add-jwt-auth` ??moves the change from `specs/changes/` to `specs/archive/2026/`
195
195
  5. Reduces the active context that future Claude sessions need to load
196
196
 
197
197
  ---
@@ -235,7 +235,7 @@ Active changes:
235
235
 
236
236
  ## CLI Reference
237
237
 
238
- These are shell commands not Claude Code skills. Run them directly in the terminal, or Claude Code will run them on your behalf.
238
+ These are shell commands ??not Claude Code skills. Run them directly in the terminal, or Claude Code will run them on your behalf.
239
239
 
240
240
  ### `cdd-kit init`
241
241
 
@@ -311,36 +311,27 @@ The single quality gate for a change. Blocks merge if anything is missing or inc
311
311
  ```bash
312
312
  cdd-kit gate add-jwt-auth
313
313
  cdd-kit gate add-jwt-auth --strict
314
- cdd-kit gate add-jwt-auth --lax
315
314
  ```
316
315
 
317
316
  Checks:
318
317
  - 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`)
319
- - Each artifact has sufficient content (not a stub): change-classification ≥ 200 chars, test-plan ≥ 200, ci-gates ≥ 150, others ≥ 100
320
- - `change-classification.md` contains a tier or risk marker
321
- - `agent-log/*.yml` files all have a completed status (`complete`, with `done` and `approved` accepted as compatibility aliases) and are not blocked
322
- - 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`
323
- - Atomic `depends-on` upstream changes are completed or archived before dependent work gates
324
- - Tier 0–1 changes have `e2e-resilience-engineer`, `monkey-test-engineer`, and `stress-soak-engineer` logs
325
- - Tier 0–3 changes have `contract-reviewer` and `qa-reviewer` logs
326
- - All contract validators pass
318
+ - Each artifact has sufficient content and is not a stub.
319
+ - `change-classification.md` contains a tier or risk marker.
320
+ - Atomic `depends-on` upstream changes are completed or archived before dependent work gates.
321
+ - All contract validators pass.
327
322
 
328
323
  `--strict` additionally:
329
324
  - Treats any task with `status: pending` (except IDs listed in `archive-tasks`) as an error
330
- - Treats runtime-vs-declared `files-read` drift as errors
331
- - Treats legacy changes missing `context-manifest.md` or `files-read` audit data as errors
332
-
333
- 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.
325
+ - Treats legacy changes missing `context-manifest.md` as errors
334
326
 
335
327
  Pre-commit hook uses `--strict` by default (installed via `cdd-kit install-hooks`).
336
328
 
337
329
  ```
338
- gate passed for change: add-jwt-auth
330
+ ?? gate passed for change: add-jwt-auth
339
331
 
340
- gate failed for change: feat-001
341
- change-classification.md: appears to be a stub (< 200 meaningful chars)
342
- ✗ Tier 1 change requires agent-log/e2e-resilience-engineer.yml
343
- ✗ 1 task(s) still pending (mark archive items in archive-tasks frontmatter; mark N/A items as status: skipped)
332
+ ?? gate failed for change: feat-001
333
+ ?? change-classification.md: appears to be a stub (< 200 meaningful chars)
334
+ ?? 1 task(s) still pending (mark archive items in archive-tasks frontmatter; mark N/A items as status: skipped)
344
335
  ```
345
336
 
346
337
  ---
@@ -368,11 +359,11 @@ Physically moves a completed change from `specs/changes/` to `specs/archive/<yea
368
359
 
369
360
  ```bash
370
361
  cdd-kit archive add-jwt-auth
371
- # Archived: specs/changes/add-jwt-auth specs/archive/2026/add-jwt-auth
372
- # Index updated: specs/archive/INDEX.md
362
+ # ?? Archived: specs/changes/add-jwt-auth ??specs/archive/2026/add-jwt-auth
363
+ # ?? Index updated: specs/archive/INDEX.md
373
364
  ```
374
365
 
375
- 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.
366
+ 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.
376
367
 
377
368
  ---
378
369
 
@@ -382,7 +373,7 @@ Marks a change as abandoned. Updates `tasks.yml` status to `abandoned`, records
382
373
 
383
374
  ```bash
384
375
  cdd-kit abandon add-jwt-auth --reason "using Auth0 instead"
385
- # Change add-jwt-auth marked as abandoned.
376
+ # ?? Change add-jwt-auth marked as abandoned.
386
377
  ```
387
378
 
388
379
  ---
@@ -401,10 +392,10 @@ cdd-kit migrate --all --enable-context-governance
401
392
  What it upgrades:
402
393
  - `tasks.yml`: converts legacy `tasks.md` checklist/frontmatter into structured YAML task records
403
394
  - `change-classification.md`: detects old `**Tier:** Tier N` format and appends the new `## Tier\n- N` section so tier-based gate checks activate
404
- - `context-manifest.md`: adds a legacy manifest scaffold by default so old changes can continue with warning-only context audit behavior
405
- - `--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
395
+ - `context-manifest.md`: adds a legacy manifest scaffold by default so old changes can use the same pre-read planning layer
396
+ - `--enable-context-governance`: explicitly adds `context-governance: v1` and a context-governed manifest scaffold for pre-read planning
406
397
 
407
- `agent-log/*.yml` must use this `files-read` format for context-governed changes:
398
+ If you choose to emit `agent-log/*.yml`, keep `files-read` optional and concise:
408
399
 
409
400
  ```yaml
410
401
  files-read:
@@ -412,10 +403,8 @@ files-read:
412
403
  - src/server/routes/users.ts
413
404
  ```
414
405
 
415
- Paths must be repo-relative. Absolute paths and `..` parent traversal are rejected.
416
- If a logged read is legitimate but gate says it is unauthorized, add that path
417
- to `context-manifest.md` `## Allowed Paths` or approve a Context Expansion
418
- Request. Do not remove it from `files-read`; that list is the audit trail.
406
+ Paths should be repo-relative. Do not reconstruct this list after the fact;
407
+ use `cdd-kit context check` before invoking agents when read scope matters.
419
408
 
420
409
  Run this after upgrading from v1.10 or earlier if you have mid-flight changes.
421
410
 
@@ -449,11 +438,10 @@ cdd-kit context check add-todos-ui --path src/components/Sidebar.vue src/stores/
449
438
  cdd-kit context check add-ci-gate --path contracts/ci/ci-gate-contract.md .github/workflows/contract-driven-gates.yml
450
439
  ```
451
440
 
452
- The check uses the same authorization model as `cdd-kit gate`: `## Allowed
453
- Paths`, `## Approved Expansions`, repo-relative path rules, and the forbidden
454
- baseline in `.cdd/context-policy.json`. If the command fails and the read is
455
- legitimate, update the manifest or record/approve a Context Expansion Request
456
- before the agent reads the file.
441
+ The check uses `## Allowed Paths`, `## Approved Expansions`, repo-relative path
442
+ rules, and the forbidden baseline in `.cdd/context-policy.json`. If the command
443
+ fails and the read is legitimate, update the manifest or record/approve a
444
+ Context Expansion Request before the agent reads the file.
457
445
 
458
446
  ---
459
447
 
@@ -466,7 +454,7 @@ cdd-kit context approve add-jwt-auth CER-001
466
454
  cdd-kit context approve add-jwt-auth --all-pending # bulk approve every pending request
467
455
  ```
468
456
 
469
- 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.
457
+ This keeps expansion history explicit while avoiding manual manifest editing.
470
458
 
471
459
  ---
472
460
 
@@ -531,7 +519,7 @@ Installs a pre-commit Git hook that auto-runs `cdd-kit gate --strict` on any sta
531
519
 
532
520
  ```bash
533
521
  cdd-kit install-hooks
534
- # pre-commit hook installed at .git/hooks/pre-commit
522
+ # ?? pre-commit hook installed at .git/hooks/pre-commit
535
523
  ```
536
524
 
537
525
  Idempotent. Preserves existing hook content. Bypass with `--no-verify` is possible but defeats enforcement.
@@ -624,8 +612,8 @@ cdd-kit doctor --strict
624
612
 
625
613
  Then choose one path per active change:
626
614
 
627
- - Conservative path: keep the migrated legacy manifest, resume work, and let `gate` warn on missing `files-read` data while the team transitions.
628
- - 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.
615
+ - Conservative path: keep the migrated legacy manifest and resume work; use `context check` before invoking agents.
616
+ - Tight context path: run `cdd-kit migrate <change-id> --enable-context-governance`, review `context-manifest.md`, narrow `Allowed Paths`, and use `cdd-kit context check` before invoking agents.
629
617
 
630
618
  ### Recommended rollout for production repos already burned by token overuse
631
619
 
@@ -642,31 +630,31 @@ Then choose one path per active change:
642
630
 
643
631
  ```
644
632
  your-repo/
645
- ├── contracts/
646
- │ ├── api/api-contract.md what endpoints exist and how they behave
647
- │ ├── css/css-contract.md design tokens, component states
648
- │ ├── data/data-shape-contract.md schemas, types, nullability
649
- │ ├── env/env-contract.md every env var, secret flags, defaults
650
- │ ├── business/business-rules.md rules, edge cases, decision tables
651
- │ └── ci/ci-gate-contract.md gate tiers, promotion, rollback
652
- ├── specs/
653
- │ ├── project-profile.md overall system description
654
- │ ├── changes/ active in-progress changes
655
- │ │ └── <change-id>/
656
- │ │ ├── change-request.md (required)
657
- │ │ ├── change-classification.md (required)
658
- │ │ ├── test-plan.md (required)
659
- │ │ ├── ci-gates.md (required)
660
- │ │ ├── tasks.yml (required)
661
- │ │ └── agent-log/ machine-verifiable evidence per agent
662
- │ ├── archive/ completed and abandoned changes
663
- │ │ ├── INDEX.md
664
- │ │ └── 2026/<change-id>/
665
- │ └── templates/
666
- ├── tests/
667
- ├── CLAUDE.md Claude's project guide (edit this)
668
- ├── AGENTS.md agent roster (auto-managed)
669
- └── CODEX.md Codex project guide when initialized for Codex
633
+ ???€ contracts/
634
+ ?? ???€ api/api-contract.md ??what endpoints exist and how they behave
635
+ ?? ???€ css/css-contract.md ??design tokens, component states
636
+ ?? ???€ data/data-shape-contract.md ??schemas, types, nullability
637
+ ?? ???€ env/env-contract.md ??every env var, secret flags, defaults
638
+ ?? ???€ business/business-rules.md ??rules, edge cases, decision tables
639
+ ?? ???€ ci/ci-gate-contract.md ??gate tiers, promotion, rollback
640
+ ???€ specs/
641
+ ?? ???€ project-profile.md ??overall system description
642
+ ?? ???€ changes/ ??active in-progress changes
643
+ ?? ?? ???€ <change-id>/
644
+ ?? ?? ???€ change-request.md (required)
645
+ ?? ?? ???€ change-classification.md (required)
646
+ ?? ?? ???€ test-plan.md (required)
647
+ ?? ?? ???€ ci-gates.md (required)
648
+ ?? ?? ???€ tasks.yml (required)
649
+ ?? ?? ???€ agent-log/ optional handoff notes
650
+ ?? ???€ archive/ ??completed and abandoned changes
651
+ ?? ?? ???€ INDEX.md
652
+ ?? ?? ???€ 2026/<change-id>/
653
+ ?? ???€ templates/
654
+ ???€ tests/
655
+ ???€ CLAUDE.md ??Claude's project guide (edit this)
656
+ ???€ AGENTS.md ??agent roster (auto-managed)
657
+ ???€ CODEX.md ??Codex project guide when initialized for Codex
670
658
  ```
671
659
 
672
660
  ---
@@ -675,9 +663,9 @@ your-repo/
675
663
 
676
664
  | Tier | Risk level | Example changes | Extra agents |
677
665
  |---|---|---|---|
678
- | 0–1 | High / critical | Auth, payments, migrations, concurrency | E2E + monkey + stress/soak |
679
- | 2–3 | Medium | Feature with API change, bug fix with behavior change | Contract review + QA |
680
- | 4–5 | Low | Docs, prompts, config only, no behavior change | Contract review + QA |
666
+ | 0?? | High / critical | Auth, payments, migrations, concurrency | E2E + monkey + stress/soak |
667
+ | 2?? | Medium | Feature with API change, bug fix with behavior change | Contract review + QA |
668
+ | 4?? | Low | Docs, prompts, config only, no behavior change | Contract review + QA |
681
669
 
682
670
  ---
683
671
 
@@ -52,14 +52,14 @@ For context-governed changes, read `specs/changes/<change-id>/context-manifest.m
52
52
  reads are legitimate, expand `Allowed Paths` or approve a Context Expansion
53
53
  Request before the agent reads the files.
54
54
  - If more context is needed, stop and write a Context Expansion Request in the manifest (`cdd-kit context request`).
55
- - The full agent-log format (including `files-read:` schema) is defined in
55
+ - Optional agent-log notes are defined in
56
56
  `~/.claude/skills/contract-driven-delivery/references/agent-log-protocol.md`.
57
57
  Read that once; do not paraphrase it elsewhere.
58
58
 
59
59
  ## CDD Operational Notes
60
60
 
61
- - After each agent returns, verify its agent-log exists, tick the related
62
- `tasks.yml` items immediately, and only then move to the next agent.
61
+ - After each agent returns, tick the related `tasks.yml` items immediately,
62
+ and only then move to the next agent.
63
63
  - Pre-existing test failures may be excluded from the current gate only when
64
64
  `qa-report.md` records the failing test, baseline evidence, why it is outside
65
65
  scope, owner, and follow-up.
@@ -22,9 +22,9 @@ Read `specs/changes/<change-id>/context-manifest.md` before using file-reading o
22
22
  Request before the agent reads the files.
23
23
  - Do not use broad repository search unless the manifest authorizes it.
24
24
  - If more context is needed, stop and write a Context Expansion Request in the manifest.
25
- - Record every file read through tools in the relevant `agent-log/*.yml` under `files-read:`.
25
+ - Optional `agent-log/*.yml` notes may include `files-read:` when that list is cheap and accurate.
26
26
 
27
- Required `agent-log/*.yml` format:
27
+ Optional `agent-log/*.yml` read note:
28
28
 
29
29
  ```yaml
30
30
  files-read:
@@ -32,7 +32,7 @@ files-read:
32
32
  - src/server/routes/users.ts
33
33
  ```
34
34
 
35
- Every entry must be a repo-relative path. Do not omit files, use absolute paths, or use `..`.
35
+ Every entry should be a repo-relative path. Do not reconstruct this list after the fact.
36
36
 
37
37
  ## Hot And Cold Data
38
38
 
@@ -44,8 +44,8 @@ Cold historical data is evidence, not current requirements.
44
44
 
45
45
  ## Operational Notes
46
46
 
47
- - After each agent returns, verify its agent-log exists, tick the related
48
- `tasks.yml` items immediately, and only then move to the next agent.
47
+ - After each agent returns, tick the related `tasks.yml` items immediately,
48
+ then move to the next agent.
49
49
  - Pre-existing test failures may be excluded from the current gate only when
50
50
  `qa-report.md` records the failing test, baseline evidence, why it is outside
51
51
  scope, owner, and follow-up.
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: backend-engineer
3
3
  description: Implement backend changes only after specs, contracts, tests, and CI gates are defined; maintain thin controllers, service boundaries, validation, and error handling.
4
4
  tools: Read, Grep, Glob, Edit, MultiEdit, Bash
@@ -11,7 +11,8 @@ Before editing production code, read the change artifacts, API/env/data/business
11
11
 
12
12
  ## Code map (READ FIRST)
13
13
 
14
- Before reading ANY source file (`.py`, `.js`, `.jsx`, `.mjs`, `.cjs`, `.ts`, `.tsx`, `.vue`), FIRST `Read .cdd/code-map.yml`.
14
+ Before reading ANY source file (`.py`, `.js`, `.jsx`, `.mjs`, `.cjs`, `.ts`, `.tsx`, `.vue`), FIRST run `cdd-kit index query "<symbol-or-file>"` or `Read .cdd/code-map.yml`.
15
+ Before editing a chosen source file, run `cdd-kit index impact "<path-or-symbol>"` to identify indexed local imports and dependents.
15
16
 
16
17
  The map is the size oracle. For each file you intend to read:
17
18
 
@@ -21,9 +22,10 @@ The map is the size oracle. For each file you intend to read:
21
22
  `interfaces:` / `types:` / `enums:`) `lines: A-B` field and
22
23
  `Read <path> offset:A limit:(B-A+1)`.
23
24
 
24
- If `.cdd/code-map.yml` is missing or `cdd-kit gate` reports it stale,
25
- do NOT proceed by reading whole files. Emit an agent-log with
26
- `status: needs-review` and `next-action: "regenerate code-map (run cdd-kit code-map)"`.
25
+ Prefer `cdd-kit index query` because it auto-refreshes missing or stale maps
26
+ before returning candidates. If you cannot run commands and `.cdd/code-map.yml`
27
+ is missing or stale, avoid broad source reads and ask the harness/user to
28
+ regenerate the map.
27
29
 
28
30
  See `references/code-map-protocol.md` for the full protocol.
29
31
 
@@ -35,23 +37,23 @@ See `references/code-map-protocol.md` for the full protocol.
35
37
  - Validate input at the boundary.
36
38
  - Return standardized errors, not raw exceptions.
37
39
  - Preserve backward compatibility unless the spec explicitly marks a breaking change.
38
- - **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.
40
+ - **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??.2 are your responsibility.
39
41
  - Update CI/CD workflows when required by `ci-gates.md`.
40
42
 
41
43
  ## Common pitfalls
42
44
 
43
- - N+1 queries fetch related rows in a single query or with explicit batching, not in a loop.
44
- - Connection / transaction leaks every acquired connection or transaction must be released on every code path including errors.
45
- - Idempotency write endpoints that may retry (payments, webhooks, queue handlers) need idempotency keys.
46
- - Timeout vs retry interaction outer retry on top of long inner timeout multiplies wall time; bound both.
47
- - Context propagation pass request-scoped context (auth, locale, trace id, deadline) through service layers; do not read globals.
48
- - Read-after-write consistency a write followed by an immediate read on a replica may return stale data.
49
- - Pagination always sort by a stable column + tie-breaker (id), never offset-paginate over mutable data.
45
+ - N+1 queries ??fetch related rows in a single query or with explicit batching, not in a loop.
46
+ - Connection / transaction leaks ??every acquired connection or transaction must be released on every code path including errors.
47
+ - Idempotency ??write endpoints that may retry (payments, webhooks, queue handlers) need idempotency keys.
48
+ - Timeout vs retry interaction ??outer retry on top of long inner timeout multiplies wall time; bound both.
49
+ - Context propagation ??pass request-scoped context (auth, locale, trace id, deadline) through service layers; do not read globals.
50
+ - Read-after-write consistency ??a write followed by an immediate read on a replica may return stale data.
51
+ - Pagination ??always sort by a stable column + tie-breaker (id), never offset-paginate over mutable data.
50
52
 
51
53
  ## Read scope
52
54
 
53
- Source of truth: `specs/changes/<change-id>/context-manifest.md` `## Allowed Paths`.
54
- Read it first (your prompt header has `CURRENT_CHANGE_ID`). Read only paths it lists or paths under `## Approved Expansions`. `cdd-kit gate` validates `files-read:` against this list and rejects unauthorized paths.
55
+ Source of truth: `specs/changes/<change-id>/context-manifest.md` ??`## Allowed Paths`.
56
+ Read it first (your prompt header has `CURRENT_CHANGE_ID`). Read only paths it lists or paths under `## Approved Expansions`. Use this boundary as pre-read discipline, not as post-run paperwork.
55
57
 
56
58
  Need a path not listed? File a `## Context Expansion Requests` entry (see `specs/templates/context-manifest.md`) with `status: pending` and stop until the user approves via `cdd-kit context approve <change-id> <CER-id>`.
57
59
 
@@ -64,41 +66,37 @@ Report changed files, contract updates, tests added, commands run, known risks,
64
66
  ## Artifact discipline
65
67
 
66
68
  Implementation code goes into source files. Do NOT write runnable code into any `specs/changes/<id>/` artifact.
67
- In your agent log, reference file paths and function names do not paste code blocks.
69
+ In your agent log, reference file paths and function names ??do not paste code blocks.
68
70
 
69
- ## Machine-Verifiable Evidence
71
+ ## Optional Handoff Evidence
70
72
 
71
- After completing your task, write or append to
72
- `specs/changes/<change-id>/agent-log/<your-agent-name>.yml`. Required fields,
73
- field rules, and gate-enforcement behavior are defined once in
74
- `references/agent-log-protocol.md` do not duplicate them in this prompt.
73
+ If a short handoff note is useful, write or append to
74
+ `specs/changes/<change-id>/agent-log/<your-agent-name>.yml`. Optional fields
75
+ and field rules are defined once in
76
+ `references/agent-log-protocol.md` ??do not duplicate them in this prompt.
75
77
 
76
- ### Required artifacts for this agent
78
+ ### Suggested artifacts for this agent
77
79
 
78
80
  `artifacts` is a YAML array of `{type, pointer}` items in your agent log
79
81
  (see `references/agent-log-protocol.md` for the full schema and self-validation
80
- checklist). Do NOT write top-level `files-changed:` / `tests-added:` keys
81
- those are `type` values, not log keys.
82
+ checklist). Do NOT write top-level `files-changed:` / `tests-added:` keys ??those are `type` values, not log keys.
82
83
 
83
- Minimum required `type` values for this agent (each must appear at least once
84
- in your `artifacts:` array; add more items per type as needed):
84
+ Recommended `type` values for this agent when you emit an optional agent log:
85
85
 
86
86
  - `files-changed`: source files modified
87
87
  - `tests-added`: new or updated test cases
88
88
  - `test-output`: last 10 lines of `npm test` (or equivalent) stdout
89
89
  - `contracts-touched`: contract files updated, or "none"
90
90
 
91
- Copy this exact shape into your agent log; replace each `<pointer>` with a
91
+ If you emit a log, copy this shape and replace each `<pointer>` with a
92
92
  concrete pointer (path:line-range, test-id, URL, or pass/fail string):
93
93
 
94
94
  ```yaml
95
95
  artifacts:
96
96
  - { type: files-changed, pointer: "src/api/users.ts:10-45" }
97
97
  - { type: tests-added, pointer: "tests/api/users.test.ts::should reject empty body" }
98
- - { type: test-output, pointer: "5 passed (last 10 lines: …)" }
98
+ - { type: test-output, pointer: "5 passed (last 10 lines: ??" }
99
99
  - { type: contracts-touched, pointer: "contracts/api/api-contract.md#endpoints" }
100
100
  ```
101
101
 
102
- If a required `type` does not apply to your run, emit one item with
103
- `pointer: "n/a (<one-line reason>)"` rather than omitting the type — the gate
104
- counts presence, qa-reviewer audits the reason.
102
+ If a recommended `type` does not apply to your run, either omit it or use `pointer: "n/a (<one-line reason>)"` so reviewers can tell the omission was intentional.