contract-driven-delivery 1.12.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.
@@ -49,6 +49,42 @@ If no description is provided, ask the user: "Please describe the change you wan
49
49
 
50
50
  ---
51
51
 
52
+ ## Step 0: Request quality check (BEFORE classifier)
53
+
54
+ Non-engineers often submit ambiguous requests like "fix the slow report" or
55
+ "make it nicer". These cost a full classifier round-trip when the right move is
56
+ to ask back. Before scaffolding anything, verify the request contains all
57
+ three elements below. Rephrase the request internally in this shape:
58
+
59
+ | Element | Example | Required? |
60
+ |---|---|---|
61
+ | 1. Affected surface | "the order export page", "the JWT login flow" | always |
62
+ | 2. Desired behavior change | "complete in <10s", "support 2FA via TOTP" | always |
63
+ | 3. Observable success criterion | "1000-row export finishes without timeout", "user with 2FA can log in end-to-end" | always |
64
+
65
+ If any element is missing or ambiguous, **STOP. Do NOT call `cdd-kit new` or
66
+ the classifier.** Ask the user back in this exact shape:
67
+
68
+ ```
69
+ Before I start a tracked change, I need to lock down three things:
70
+
71
+ Affected surface: <best guess from request, or empty>
72
+ Desired behavior: <best guess, or empty>
73
+ Success criterion: <empty — please fill>
74
+
75
+ Could you confirm or fill in the missing pieces?
76
+ ```
77
+
78
+ Only proceed to Step 1 once all three are answered or the user explicitly says
79
+ "proceed without success criterion". Record the user's clarifications verbatim
80
+ in `change-request.md` § Original Request.
81
+
82
+ The cost of this step: 1 short message round-trip. The cost of skipping it:
83
+ one full classifier+contract-reviewer cycle, often 5-10× more tokens, plus an
84
+ inevitable re-classification when the agents discover the ambiguity.
85
+
86
+ ---
87
+
52
88
  ## Write Responsibilities
53
89
 
54
90
  **This distinction is critical — follow it for every step:**
@@ -99,176 +135,21 @@ Verify these files exist:
99
135
 
100
136
  Do not use broad search or ad hoc reads to classify the change before `context-scan` has completed.
101
137
 
102
- The generated scaffold contains the artifacts below. Fill `change-request.md` with the user's request before invoking the classifier.
103
-
104
- Update `specs/changes/<change-id>/change-request.md` with the user's description filled in:
105
- ```
106
- # Change Request: <change-id>
107
-
108
- ## Original Request
109
- <user's exact description, verbatim>
110
-
111
- ## Business / User Goal
112
- <infer from the description>
113
-
114
- ## Non-goals
115
-
116
- ## Constraints
117
-
118
- ## Known Context
138
+ The generated scaffold contains the artifacts listed in the table below. **All
139
+ templates are written from disk by `cdd-kit new` — do not paste template bodies
140
+ into this prompt.** The on-disk source of truth lives in `specs/templates/` of
141
+ the kit and is bundled into every install.
119
142
 
120
- ## Open Questions
121
-
122
- ## Requested Delivery Date / Priority
123
- as soon as possible
124
- ```
125
-
126
- `specs/changes/<change-id>/change-classification.md` starts from this blank template:
127
- ```
128
- # Change Classification
129
-
130
- ## Change Types
131
- - primary:
132
- - secondary:
133
-
134
- ## Risk Level
135
- - low / medium / high / critical
136
-
137
- ## Impact Radius
138
- - isolated / module-level / cross-module / system-wide
139
-
140
- ## Tier
141
- - 0 / 1 / 2 / 3 / 4 / 5
142
-
143
- ## Architecture Review Required
144
- - yes / no
145
- - reason: (fill only if yes)
146
-
147
- ## Required Artifacts
148
- Always required: change-request.md, change-classification.md, test-plan.md, ci-gates.md, tasks.md
149
-
150
- ## Optional Artifacts (default: no — set yes only with explicit reason)
151
- | artifact | create? | reason |
143
+ | File | Source | Your job |
152
144
  |---|---|---|
153
- | current-behavior.md | no | |
154
- | proposal.md | no | |
155
- | spec.md | no | |
156
- | design.md | no | |
157
- | qa-report.md | no | |
158
- | regression-report.md | no | |
159
-
160
- ## Required Contracts
161
- - API:
162
- - CSS/UI:
163
- - Env:
164
- - Data shape:
165
- - Business logic:
166
- - CI/CD:
167
-
168
- ## Required Test Families
169
- - unit:
170
- - contract:
171
- - integration:
172
- - E2E:
173
- - visual:
174
- - data-boundary:
175
- - resilience:
176
- - fuzz/monkey:
177
- - stress:
178
- - soak:
179
-
180
- ## Required Agents
181
-
182
- ## Assumptions / Clarifications
183
- ```
184
-
185
- `specs/changes/<change-id>/test-plan.md` starts from this blank template:
186
- ```
187
- # Test Plan: <change-id>
188
-
189
- ## Acceptance Criteria → Test Mapping
190
- | criterion id | test family | test file path | tier |
191
- |---|---|---|---|
192
-
193
- ## Test Families Required
194
- | family | tier | notes |
195
- |---|---|---|
196
- | (unit / contract / integration / e2e / data-boundary / resilience / monkey / stress / soak) | | |
197
-
198
- ## Out of Scope
145
+ | `change-request.md` | `specs/templates/change-request.md` | Fill the `## Original Request` section with the user's exact description before invoking the classifier; leave the rest blank |
146
+ | `change-classification.md` | `specs/templates/change-classification.md` | Replace blank template with classifier output (Step 2) |
147
+ | `test-plan.md` | `specs/templates/test-plan.md` | `test-strategist` writes this directly |
148
+ | `ci-gates.md` | `specs/templates/ci-gates.md` | `ci-cd-gatekeeper` writes this directly |
149
+ | `tasks.md` | `specs/templates/tasks.md` | Tick checkboxes as agents complete; backfill `tier:` frontmatter from classifier (Step 2.4) |
150
+ | `context-manifest.md` | `specs/templates/context-manifest.md` | Replace from classifier `## Context Manifest Draft` (Step 2) |
199
151
 
200
- ## Notes
201
- (Keep under 10 lines. Implementation detail belongs in the test files themselves.)
202
- ```
203
-
204
- `specs/changes/<change-id>/ci-gates.md` starts from this blank template:
205
- ```
206
- # CI Gates: <change-id>
207
-
208
- ## Required Gates (block merge if failing)
209
-
210
- ## Informational Gates (report only)
211
-
212
- ## Nightly / Weekly / Manual Gates
213
-
214
- ## Promotion Policy
215
- ```
216
-
217
- `specs/changes/<change-id>/tasks.md` starts with ALL checkboxes unchecked:
218
- ```
219
- ---
220
- change-id: <change-id>
221
- status: in-progress
222
- context-governance: v1
223
- depends-on: []
224
- ---
225
-
226
- <!-- [x]=done [-]=N/A [ ]=pending -->
227
-
228
- # Tasks: <change-id>
229
-
230
- ## 1. Preparation
231
- - [ ] 1.1 Confirm classification and required artifacts
232
- - [ ] 1.2 Confirm contracts to update
233
- - [ ] 1.3 Confirm CI/CD gate plan
234
-
235
- ## 2. Contract Updates
236
- - [ ] 2.1 API contract
237
- - [ ] 2.2 CSS/UI contract
238
- - [ ] 2.3 Env contract
239
- - [ ] 2.4 Data shape contract
240
- - [ ] 2.5 Business logic contract
241
- - [ ] 2.6 CI/CD contract
242
-
243
- ## 3. Tests First
244
- - [ ] 3.1 Unit/contract tests
245
- - [ ] 3.2 Integration tests
246
- - [ ] 3.3 E2E/resilience tests
247
- - [ ] 3.4 Data-boundary/monkey tests
248
- - [ ] 3.5 Stress/soak tests if required
249
-
250
- ## 4. Implementation
251
- - [ ] 4.1 Backend
252
- - [ ] 4.2 Frontend
253
- - [ ] 4.3 Env/deploy
254
- - [ ] 4.4 CI/CD workflows
255
-
256
- ## 5. Review
257
- - [ ] 5.1 UI/UX review
258
- - [ ] 5.2 Visual review
259
- - [ ] 5.3 Contract review
260
- - [ ] 5.4 QA review
261
-
262
- ## 6. Verification
263
- - [ ] 6.1 Local gates
264
- - [ ] 6.2 PR required gates
265
- - [ ] 6.3 Informational gates
266
- - [ ] 6.4 Nightly/weekly/manual gates if required
267
-
268
- ## 7. Archive
269
- - [ ] 7.1 Archive change
270
- - [ ] 7.2 Promote durable learnings to contracts or CLAUDE.md
271
- ```
152
+ If `cdd-kit new` reports a missing template, run `cdd-kit upgrade --yes`.
272
153
 
273
154
  ---
274
155
 
@@ -290,14 +171,48 @@ The classifier must include a `## Context Manifest Draft` section with:
290
171
  - required tests
291
172
  - any context expansion requests that must be approved before implementation
292
173
 
293
- **change-classifier is read-only** — it will return its output as text. After it responds:
174
+ **change-classifier is read-only** — it will return its output as text.
175
+
176
+ ### If the classifier returns `## Atomic Split Proposal`
177
+
178
+ The classifier has decided this request is too big for a single change. Do
179
+ NOT proceed with the rest of `/cdd-new`. Instead:
180
+
181
+ 1. Show the user the full `## Atomic Split Proposal` table verbatim.
182
+ 2. Ask: "Run these as separate changes (recommended), or force a single
183
+ monolithic change?"
184
+ 3. If user picks "separate":
185
+ - For each row in the proposal table, run `cdd-kit new <change-id>` with
186
+ the listed `--depends-on`.
187
+ - Then say: "I created N change directories. Want me to run `/cdd-new`
188
+ against the first one now?" — wait for confirmation; do not auto-loop.
189
+ 4. If user picks "force monolithic":
190
+ - Re-invoke change-classifier with `force-monolithic` appended to the
191
+ change-request and proceed with whatever Tier the classifier returns.
192
+ 5. Delete the partially-scaffolded change directory you created in Step 1
193
+ if the user picked "separate" and the originally-derived change-id is
194
+ not in the proposal — it would otherwise sit empty and confuse `cdd-kit
195
+ list`.
196
+
197
+ ### Classifier output lint (B8): refuse stub responses
198
+
199
+ Before writing any files, verify the classifier response contains:
200
+
201
+ - `## Tier` followed by `- N` where N is a single digit 0-5 (NOT `0 / 1 / 2 / 3 / 4 / 5` — that is the unfilled placeholder).
202
+ - `## Required Agents` with at least one agent name.
203
+ - `## Inferred Acceptance Criteria` with at least one filled `AC-1: …` line.
204
+
205
+ If any of these are missing or still hold the literal placeholder text, STOP. Re-prompt the classifier with the missing pieces named explicitly. Do NOT write classification.md — gate will reject it as a stub anyway and you will have wasted the round-trip.
206
+
207
+ ### When the classifier output passes lint
294
208
 
295
209
  1. **YOU write** `specs/changes/<change-id>/change-classification.md` — replace the blank template with the classifier's classification output.
296
210
  2. **YOU write** `specs/changes/<change-id>/agent-log/change-classifier.md` — copy the Agent Log block from the classifier's response.
297
211
  3. **YOU update** `specs/changes/<change-id>/context-manifest.md` from the classifier's `## Context Manifest Draft`.
298
- 4. **YOU tick** `tasks.md` item `1.1`.
212
+ 4. **YOU update** `tasks.md` frontmatter: set `tier: <N>` to the classifier's tier digit. This is now the authoritative source for `cdd-kit gate` tier-based agent enforcement (the classification.md `## Tier` section is fallback only).
213
+ 5. **YOU tick** `tasks.md` item `1.1`.
299
214
 
300
- Wait until these four writes are done before continuing.
215
+ Wait until these five writes are done before continuing.
301
216
 
302
217
  **After writing change-classification.md**: read the classifier's `## Tasks Not Applicable` list. For each listed task ID (e.g., `2.2`, `4.2`), update `tasks.md` to change that item from `[ ]` to `[-]`. Do this before invoking any other agent.
303
218
 
@@ -320,6 +235,58 @@ Change directory: specs/changes/<change-id>/
320
235
  ```
321
236
  This ensures the agent's Read scope restriction points to the correct directory.
322
237
 
238
+ ### Agent stage badges (UI v1)
239
+
240
+ When you announce that you are about to invoke an agent, prefix the
241
+ announcement with the matching emoji + role tag from the table below. This
242
+ helps a non-engineer scanning the chat stream tell what stage they are in
243
+ without reading the full prompt. Use the badges only in your own narration to
244
+ the user; do not put them inside the prompt sent to the agent.
245
+
246
+ | Stage | Agent | Badge |
247
+ |---|---|---|
248
+ | Decision | `change-classifier` | 🟣 `[classifier]` |
249
+ | Decision | `spec-architect` | 🟣 `[architect]` |
250
+ | Implementation | `backend-engineer` | 🔵 `[backend]` |
251
+ | Implementation | `frontend-engineer` | 🔵 `[frontend]` |
252
+ | Implementation | `ci-cd-gatekeeper` | 🔵 `[ci-cd]` |
253
+ | Implementation | `test-strategist` | 🟡 `[test-plan]` |
254
+ | Heavy testing (Tier 0–1 only) | `e2e-resilience-engineer` | 🟠 `[e2e]` |
255
+ | Heavy testing (Tier 0–1 only) | `monkey-test-engineer` | 🟠 `[monkey]` |
256
+ | Heavy testing (Tier 0–1 only) | `stress-soak-engineer` | 🟠 `[stress]` |
257
+ | Review | `contract-reviewer` | 🟢 `[contracts]` |
258
+ | Review | `qa-reviewer` | 🟢 `[qa]` |
259
+ | Review | `ui-ux-reviewer` | 🟢 `[ui-ux]` |
260
+ | Review | `visual-reviewer` | 🟢 `[visual]` |
261
+ | Review | `dependency-security-reviewer` | 🟢 `[deps-sec]` |
262
+ | Audit | `spec-drift-auditor` | ⚫ `[drift]` |
263
+ | Audit | `repo-context-scanner` | ⚫ `[repo-scan]` |
264
+
265
+ Color semantics:
266
+ - 🟣 purple: deciding what we will do (heavy model, opus-class)
267
+ - 🔵 blue: writing code (sonnet-class implementation)
268
+ - 🟡 yellow: planning tests (sonnet-class)
269
+ - 🟠 orange: heavy testing — only appears for Tier 0–1, signals high-risk scope
270
+ - 🟢 green: reviewing what was done (no code writes; just verdicts)
271
+ - ⚫ neutral: audits and scans (read-only background work)
272
+
273
+ Format: emoji is followed by a single space, then the bracket-tag, then the
274
+ human-readable narration.
275
+
276
+ Examples:
277
+
278
+ ```
279
+ 🟣 [classifier] Reading the request and project map…
280
+ 🟢 [contracts] Confirming the API contract is unchanged. (read-only)
281
+ 🔵 [backend] Implementing the JWT issuance endpoint and writing failing
282
+ tests first per TDD policy.
283
+ 🟠 [stress] Tier 1 high-risk change — running soak test for 30 min.
284
+ ```
285
+
286
+ These badges are pure narration. They MUST NOT be sent inside the agent's
287
+ prompt; the agent's behavior is defined by the agent prompt files in
288
+ `.claude/agents/<name>.md`, not by this badge.
289
+
323
290
  ---
324
291
 
325
292
  ### Tier 4–5 (low risk: docs, prompts, config-only, no behavior change)
@@ -414,14 +381,50 @@ cdd-kit gate <change-id>
414
381
  - YOU tick: `tasks.md` item `6.1`
415
382
  - Proceed to Step 5.
416
383
 
417
- **If gate fails**:
418
- 1. Read the gate error output carefully
419
- 2. Identify which artifact is missing, stub, or invalid
420
- 3. Re-invoke the specific agent responsible for that artifact with the exact fix required
421
- 4. Re-run `cdd-kit gate <change-id>`
422
- 5. Repeat until gate passes (max 3 iterations; if still failing after 3, report to user)
384
+ **If gate fails — structured fix-back routing**:
385
+
386
+ Capture gate's full stderr verbatim. Parse error lines and route each to the
387
+ right owner. The patterns below are exhaustive every gate error message
388
+ matches one of them.
389
+
390
+ | Error pattern | Route to | Re-invocation prompt seed |
391
+ |---|---|---|
392
+ | `agent-log/<name>.md: …` | the named agent | "PREVIOUS GATE FAILURE FOR THIS AGENT: <full error line>. Fix only your `agent-log/<name>.md`. Re-output your Agent Log block." |
393
+ | `change-classification.md: …` | `change-classifier` | "PREVIOUS CLASSIFICATION FAILED GATE: <error>. Re-emit only the failing section." |
394
+ | `context-manifest.md: …` | `change-classifier` | "PREVIOUS MANIFEST FAILED GATE: <error>. Re-emit `## Context Manifest Draft`." |
395
+ | `tasks.md: …` (frontmatter / pending) | YOU (main Claude) — direct edit | n/a — fix `tasks.md` yourself. Don't re-invoke an agent for a file you own. |
396
+ | `Tier <N> change requires agent-log/<X>.md` | invoke the missing agent `<X>` | "TIER <N> REQUIRES THIS LOG. Run your full work, not just the log." |
397
+ | `dependency <id>: upstream change is not completed` | n/a — STOP | Tell user: "Upstream change `<id>` must complete before this change can gate. Run `/cdd-new <id>` first or run `cdd-kit archive <id>` if it's already done." |
398
+ | `validators returned non-zero` | `contract-reviewer` | "PREVIOUS CONTRACT VALIDATION FAILED: <last 10 lines of validator stderr>. Reconcile contracts." |
399
+
400
+ **Re-invocation prompt template** (always use this exact prefix when re-invoking an agent for fix-back):
401
+
402
+ ```
403
+ CURRENT_CHANGE_ID: <change-id>
404
+ Change directory: specs/changes/<change-id>/
405
+
406
+ PREVIOUS GATE FAILURE FOR THIS AGENT (re-invocation):
407
+ <the exact gate error line(s) tied to this agent>
408
+
409
+ FIX TARGET:
410
+ <the specific file or section that needs to change>
411
+
412
+ REFERENCES:
413
+ - references/agent-log-protocol.md (log format)
414
+ - references/<agent-specific-standard>.md (if applicable)
415
+
416
+ Fix this exact issue without re-doing your prior work. Re-output only the
417
+ section that changed plus your updated Agent Log block.
418
+ ```
419
+
420
+ After re-invoking, re-run `cdd-kit gate <change-id>`. Repeat up to **3 times**. Each
421
+ iteration must be on a strictly smaller error set — if the same error returns
422
+ twice, halt and surface to user (an agent stuck in a loop is more expensive
423
+ than a human read).
423
424
 
424
- **Terminal state after 3 failures**: Add a line at the top of `tasks.md` reading `status: gate-blocked` and report all blocking items to the user. The change is paused — do not proceed to Step 5.
425
+ **Terminal state after 3 failures**: Update `tasks.md` frontmatter with
426
+ `status: gate-blocked` and report all remaining errors to the user, grouped
427
+ by responsible agent, so they know who to manually direct next.
425
428
 
426
429
  ---
427
430
 
@@ -86,7 +86,7 @@ Ask the user: "Continue from <next-agent>? (yes/no)"
86
86
 
87
87
  ## Step 3: Continue the flow
88
88
 
89
- If user confirms, resume from the next agent in the Tier sequence (refer to `/cdd-new` Step 3 for the agent order).
89
+ If user confirms, resume from the next agent in the Tier sequence (refer to `/cdd-new` Step 3 for the agent order, and `/cdd-new` "Agent stage badges" for the colored badges to use in your narration).
90
90
 
91
91
  **Critical**: Inject this block at the start of every agent prompt:
92
92
 
@@ -0,0 +1,117 @@
1
+ # Agent Log Protocol
2
+
3
+ All cdd-kit agents share the same machine-verifiable agent-log format. This file
4
+ is the single source of truth — agent prompts reference it instead of inlining
5
+ the format. `cdd-kit gate` parses these files; drift here equals silent gate
6
+ skips, so do not re-document this in agent prompts.
7
+
8
+ ## Output target
9
+
10
+ Each agent writes (or has main Claude write) one file per run:
11
+
12
+ ```
13
+ specs/changes/<change-id>/agent-log/<agent-name>.md
14
+ ```
15
+
16
+ If the same agent runs more than once for a change (e.g., after fix-back),
17
+ overwrite the file — only the latest run is gate-relevant.
18
+
19
+ ## Required structure
20
+
21
+ ```
22
+ # <Agent Display Name> Log
23
+ - change-id: <id>
24
+ - timestamp: <ISO 8601, e.g. 2026-04-27T14:30:00Z>
25
+ - status: complete | needs-review | blocked
26
+ - files-read:
27
+ - <repo-relative path>
28
+ - <repo-relative path>
29
+ - artifacts:
30
+ - <evidence-type>: <concrete pointer>
31
+ - <evidence-type>: <concrete pointer>
32
+ - next-action: <one line, or "none">
33
+ ```
34
+
35
+ ### Field rules
36
+
37
+ - `change-id` — must match the directory name. Mismatch is a contract violation.
38
+ - `timestamp` — ISO 8601 UTC. Used by spec-drift-auditor for ordering.
39
+ - `status` — exactly one of `complete | needs-review | blocked`. Anything
40
+ else (e.g. `done`, `OK`, `pending`) fails gate.
41
+ - `files-read` — required for context-governed changes (`tasks.md` frontmatter
42
+ has `context-governance: v1`). Each entry must be a repo-relative path.
43
+ Absolute paths and `..` traversal are rejected. If you legitimately read
44
+ nothing beyond your own change directory, write:
45
+ ```
46
+ - files-read:
47
+ - specs/changes/<change-id>/
48
+ ```
49
+ - `artifacts` — concrete pointers only. Allowed forms:
50
+ - `path/to/file.ts:10-45`
51
+ - `tests/foo.test.ts::should reject empty body`
52
+ - `cdd-kit gate <id>: 0 errors` (command + outcome)
53
+ - `contracts/api/api-contract.md#endpoints` (file + anchor)
54
+ - **Never** `verified`, `OK`, `done`, or unscoped prose.
55
+ - `next-action` — when `status: blocked`, this must be ≥ 10 chars and
56
+ not `none`. When `status: complete`, `none` is acceptable.
57
+
58
+ ## Per-agent additional artifact requirements
59
+
60
+ Each agent prompt lists its own `### Required artifacts for this agent`. The
61
+ gate does not enforce those today; they are a discipline contract enforced by
62
+ `qa-reviewer` and `contract-reviewer`. If you add a required artifact in an
63
+ agent prompt, also update the qa-reviewer checklist.
64
+
65
+ ## Self-validation before submitting your response
66
+
67
+ **Every agent MUST self-validate its draft Agent Log block before finishing.**
68
+ A malformed log block forces `cdd-kit gate` to fail, which forces the skill
69
+ to re-invoke you, which costs the user another full agent round. Self-lint is
70
+ ~5 seconds; a re-run is minutes and dollars.
71
+
72
+ Before sending your final response, re-read your `## Agent Log` block and
73
+ verify each item:
74
+
75
+ - [ ] **All four required keys exist**: `status`, `files-read`, `artifacts`,
76
+ `next-action`. (Plus `change-id`, `timestamp` at the top.)
77
+ - [ ] **`status` is one of**: `complete`, `needs-review`, `blocked` — not
78
+ `done`, `OK`, `pending`, `wip`, or anything else.
79
+ - [ ] **Every `artifacts:` line has a concrete pointer**:
80
+ - GOOD: `tests-added: tests/foo.test.ts::should reject empty body`
81
+ - GOOD: `files-changed: src/api/users.ts:45-67`
82
+ - GOOD: `test-output: 5 passed (last 10 lines: …)`
83
+ - BAD: `tests-added: verified`
84
+ - BAD: `files-changed: yes`
85
+ - BAD: `contract: OK`
86
+ Reject any line whose value would not let a reviewer click through.
87
+ - [ ] **If `status: blocked`, `next-action`** is ≥ 10 chars, is NOT `none`,
88
+ `investigate further`, `tbd`, or `n/a`, and names the actual next step
89
+ a human can act on.
90
+ - [ ] **Every `files-read:` entry**: repo-relative path, no leading `/`,
91
+ no `..`, no `~`. If you read your own change directory only, write
92
+ `- specs/changes/<change-id>/`.
93
+
94
+ If any check fails, **fix the block before sending your response**. Do not
95
+ ship a known-bad log and rely on the gate to catch it.
96
+
97
+ ## Gate enforcement summary
98
+
99
+ `cdd-kit gate` rejects an agent log when any of these are true:
100
+
101
+ 1. The file is missing for a tier-required agent (see CONTRACTS for tier matrix).
102
+ 2. `status:` line is missing or has an unknown value.
103
+ 3. `status: blocked` without a concrete `next-action`.
104
+ 4. `files-read` is missing for a context-governed change, or contains an
105
+ absolute path / `..` segment / forbidden path.
106
+ 5. With `--strict`: any `- artifacts:` entry whose value looks like a path but
107
+ does not exist on disk.
108
+
109
+ ## Why this lives in references/
110
+
111
+ The historical mistake was duplicating the protocol inside every agent prompt.
112
+ Sixteen agents × ~30 lines = ~480 lines of identical text loaded on every
113
+ spawn. Moving it here:
114
+
115
+ - Cuts per-agent prompt size by 25–35%.
116
+ - Makes drift between agents impossible (one file to change).
117
+ - Lets gate.ts behavior, tests, and prompts stay in sync via this single doc.
@@ -1,22 +1,16 @@
1
1
  # Context Manifest
2
2
 
3
- This manifest defines the approved context boundaries for agents working on this change.
3
+ This manifest defines the approved context boundaries for agents working on
4
+ this change. The forbidden-paths baseline lives in `.cdd/context-policy.json`
5
+ and is automatically applied by `cdd-kit gate` — do not duplicate it here.
4
6
 
5
7
  ## Affected Surfaces
6
8
  -
7
9
 
8
10
  ## Allowed Paths
9
11
  - specs/changes/<change-id>/
10
-
11
- ## Forbidden Paths
12
- - .claude/worktrees/**
13
- - .git/**
14
- - node_modules/**
15
- - dist/**
16
- - build/**
17
- - assets/**
18
- - specs/archive/**
19
- - specs/changes/* except specs/changes/<change-id>/
12
+ - specs/context/project-map.md
13
+ - specs/context/contracts-index.md
20
14
 
21
15
  ## Required Contracts
22
16
  -
@@ -35,8 +29,8 @@ This manifest defines the approved context boundaries for agents working on this
35
29
  ## Context Expansion Requests
36
30
 
37
31
  <!--
38
- Agents must request context expansion instead of reading outside their work packet.
39
- Use this format only for real requests:
32
+ Agents must request context expansion instead of reading outside their work
33
+ packet. Format example for real requests:
40
34
 
41
35
  - request-id: CER-001
42
36
  requested_paths:
@@ -44,6 +38,7 @@ Use this format only for real requests:
44
38
  reason: why this file is required
45
39
  status: pending
46
40
  -->
41
+ -
47
42
 
48
43
  ## Approved Expansions
49
44
  -
@@ -1,7 +1,9 @@
1
1
  ---
2
2
  change-id: <change-id>
3
3
  status: in-progress
4
+ tier:
4
5
  context-governance: v1
6
+ archive-tasks: ["7.1", "7.2"]
5
7
  depends-on: []
6
8
  ---
7
9