create-agdf 0.8.9 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/bin/create-agdf.js +43 -2
  2. package/generated/.github/skills/agdf-brownfield-analysis/SKILL.md +6 -2
  3. package/generated/.github/skills/agdf-clean-implementation-review/SKILL.md +4 -1
  4. package/generated/.github/skills/agdf-code-review/SKILL.md +4 -1
  5. package/generated/.github/skills/agdf-delivery-closeout/SKILL.md +5 -1
  6. package/generated/.github/skills/agdf-delivery-path-search/SKILL.md +5 -1
  7. package/generated/.github/skills/agdf-gate-check/SKILL.md +8 -2
  8. package/generated/.github/skills/agdf-qa-gate/SKILL.md +6 -2
  9. package/generated/.github/skills/agdf-release-or/SKILL.md +7 -2
  10. package/generated/.github/skills/agdf-runtime-contract.md +11 -851
  11. package/generated/.github/skills/agdf-task-plan-review/SKILL.md +5 -1
  12. package/generated/.github/skills/contracts/closeout.md +29 -0
  13. package/generated/.github/skills/contracts/context-graph.md +48 -0
  14. package/generated/.github/skills/contracts/control-scaffold.md +109 -0
  15. package/generated/.github/skills/contracts/gate-transition.md +134 -0
  16. package/generated/.github/skills/contracts/interaction.md +370 -0
  17. package/generated/.github/skills/contracts/modes.md +91 -0
  18. package/generated/.github/skills/contracts/quality.md +100 -0
  19. package/generated/.opencode/AGDF.md +9 -1
  20. package/generated/.opencode/agdf-runtime-contract.md +11 -851
  21. package/generated/.opencode/contracts/closeout.md +29 -0
  22. package/generated/.opencode/contracts/context-graph.md +48 -0
  23. package/generated/.opencode/contracts/control-scaffold.md +109 -0
  24. package/generated/.opencode/contracts/gate-transition.md +134 -0
  25. package/generated/.opencode/contracts/interaction.md +370 -0
  26. package/generated/.opencode/contracts/modes.md +91 -0
  27. package/generated/.opencode/contracts/quality.md +100 -0
  28. package/generated/.opencode/skills/agdf-brownfield-analysis/SKILL.md +6 -2
  29. package/generated/.opencode/skills/agdf-clean-implementation-review/SKILL.md +4 -1
  30. package/generated/.opencode/skills/agdf-code-review/SKILL.md +4 -1
  31. package/generated/.opencode/skills/agdf-delivery-closeout/SKILL.md +5 -1
  32. package/generated/.opencode/skills/agdf-delivery-path-search/SKILL.md +5 -1
  33. package/generated/.opencode/skills/agdf-gate-check/SKILL.md +8 -2
  34. package/generated/.opencode/skills/agdf-qa-gate/SKILL.md +6 -2
  35. package/generated/.opencode/skills/agdf-release-or/SKILL.md +7 -2
  36. package/generated/.opencode/skills/agdf-task-plan-review/SKILL.md +5 -1
  37. package/generated/AGENTS.md +9 -1
  38. package/generated/plugins/agdf/.codex-plugin/plugin.json +4 -4
  39. package/generated/plugins/agdf/meta/agdf-agent-router.md +9 -1
  40. package/generated/plugins/agdf/meta/agdf-plugin.definition.json +14 -8
  41. package/generated/plugins/agdf/meta/agdf-runtime-contract.md +11 -851
  42. package/generated/plugins/agdf/meta/contracts/closeout.md +29 -0
  43. package/generated/plugins/agdf/meta/contracts/context-graph.md +48 -0
  44. package/generated/plugins/agdf/meta/contracts/control-scaffold.md +109 -0
  45. package/generated/plugins/agdf/meta/contracts/gate-transition.md +134 -0
  46. package/generated/plugins/agdf/meta/contracts/interaction.md +370 -0
  47. package/generated/plugins/agdf/meta/contracts/modes.md +91 -0
  48. package/generated/plugins/agdf/meta/contracts/quality.md +100 -0
  49. package/generated/plugins/agdf/skills/brownfield-analysis/SKILL.md +6 -2
  50. package/generated/plugins/agdf/skills/clean-implementation-review/SKILL.md +4 -1
  51. package/generated/plugins/agdf/skills/code-review/SKILL.md +4 -1
  52. package/generated/plugins/agdf/skills/delivery-closeout/SKILL.md +5 -1
  53. package/generated/plugins/agdf/skills/delivery-path-search/SKILL.md +5 -1
  54. package/generated/plugins/agdf/skills/gate-check/SKILL.md +8 -2
  55. package/generated/plugins/agdf/skills/qa-gate/SKILL.md +6 -2
  56. package/generated/plugins/agdf/skills/release-or/SKILL.md +7 -2
  57. package/generated/plugins/agdf/skills/task-plan-review/SKILL.md +5 -1
  58. package/package.json +1 -1
@@ -1,855 +1,15 @@
1
1
  # AGDF Runtime Contract
2
2
 
3
- This contract centralizes recurring runtime rules for AGDF skills.
4
- It is the operational reference for skill outputs, but it is not a second copy of the framework documentation.
3
+ This manifest indexes the thematic runtime-contract modules used by AGDF skills and runtime validation.
5
4
 
6
- ## Mode Selection
7
-
8
- | Mode | Default | Escalate When |
5
+ | Module | Path | Coverage |
9
6
  |---|---|---|
10
- | Quick Task Mode | small questions, reviews, debugging, local fixes without new product semantics | a new user capability, architecture/policy/persistence impact, formal artefacts, or approvals are involved |
11
- | Structured Delivery Mode | formal delivery runs, gate-relevant work, release-critical changes | always use gate discipline, internal reviews, and OR |
12
-
13
- Quick Task Mode must not become ritual gate overhead.
14
- Structured Delivery must not bypass missing approvals.
15
- New product semantics, functional change, user-visible behaviour, policy, persistence, architecture or release-critical work requires a durable UR in `.agdf/control/` or a linked authoritative repository SoT before later artefacts or implementation.
16
- UR, PRD, SD, TP and QA report approvals require durable artefacts or linked authoritative repository SoT entries before the next gate can open.
17
-
18
- ## Quick Task Output
19
-
20
- Quick Tasks are intentionally lightweight, but they must not become invisible.
21
- Use this compact output shape when no formal gate artefact is required:
22
-
23
- - `result`: what changed or was concluded
24
- - `evidence`: files, commands, observations, or reasoning that support the result
25
- - `risk`: remaining risk or `none`
26
- - `next_step`: the single next useful action or `none`
27
-
28
- Do not add a separate `Quality outlook` line for pure Quick Tasks unless the task became a relevant run.
29
-
30
- ### Verified Change
31
-
32
- `verified_change` is a compact, fail-closed path for a bounded user-visible change with one canonical owner and deterministic proof. It is neither a prose exception nor a new user approval gate.
33
-
34
- After `Approval: UR`, Brownfield Review may select `verified_change` only when a durable `VERIFIED_CHANGE.md` record can prove all of the following before implementation:
35
-
36
- 1. exactly one repository-relative canonical owner and bounded source/derived paths;
37
- 2. no gate, permission, security, persistence, architecture, external API, CLI or release behavior impact;
38
- 3. deterministic propagation when derived paths exist, plus at least one deterministic validation command;
39
- 4. a full baseline commit plus tracked and untracked worktree baseline paths captured before eligibility, with no candidate path already dirty; and
40
- 5. an explicit `structured_slice` or `structured_delivery` escalation target.
41
-
42
- The record is the compact Brownfield selection, eligibility, execution and mini-closeout artefact. The selected run may link the same normalized record path as Brownfield Review, Verified Change and OR only in `verified_change` mode and only with lifecycle-consistent role states; separate Brownfield and OR files remain supported. Permitted control paths derive only from recognized, explicitly linked artefacts beneath the selected run's own artefact directory.
43
-
44
- A missing, failed, unknown or ambiguous field/check must fail closed: mark the record `escalated` and continue at its declared structured target. Unrelated paths already dirty at baseline remain isolated; newly introduced unlisted paths invalidate the compact path. An executed record requires a machine-readable exact changed-path snapshot with passing scope status, passing validation evidence and, where applicable, passing propagation evidence. Active runs compare that snapshot with the current post-baseline worktree. Completed executed runs validate the persisted snapshot and record evidence without being retroactively invalidated by later unrelated live-worktree changes.
45
-
46
- ### Non-Normative Trivial Change Boundary
47
-
48
- A `quick_task` whose entire diff stays fully outside all of the following paths may close using only
49
- the compact output shape above, and must not create, rewrite or expand any selected canonical
50
- `RUN_STATE.md` core
51
- sections (Run Meta, Objective, Current Control State, Source And Scope State, Run Status Card,
52
- Approvals, Artefacts, Mode/Slice Decision, Artefact Chain, Evidence, Missing Evidence, Risks, Context
53
- Graph Impact, Knowledge Persistence Decision, Closeout):
54
-
55
- - `plugin/skills/**`
56
- - `plugin/control/templates/**`
57
- - `plugin/meta/**`
58
- - `create-agdf/lib/**`
59
- - `create-agdf/bin/**`
60
- - any other executable code file, in any language, anywhere in the repository
61
-
62
- A `MASTER_BACKLOG.md` entry is required only when the change is otherwise a "Relevant Run" below. A
63
- change that is not clearly and fully outside every listed path fails closed to the existing, unchanged
64
- ceremony — ambiguity is never read as permission for the lighter path.
65
-
66
- #### Narrow Code-Fix Criterion
67
-
68
- A change that touches one of the otherwise-excluded code paths above may still close with only the
69
- compact Quick Task Output shape — Code Review remains mandatory regardless — when **all** of the
70
- following hold. Any single condition failing, or any ambiguity about whether a condition holds, keeps
71
- the full existing ceremony unchanged:
72
-
73
- 1. The diff is confined to a single function, or a function together with its direct,
74
- necessarily-coupled caller, in exactly one file.
75
- 2. A new or updated automated regression test exercises the fixed behavior and passes.
76
- 3. No PRD, SD, TP, gate name, exact approval formula, or documented CLI flag/output-schema field is
77
- added, removed, or changed — only internal correctness of already-approved behavior.
78
- 4. `doctor` (or the locally available equivalent) and the directly affected existing test suite both
79
- pass unchanged in shape after the fix, with no assertion skipped or weakened beyond what the fix
80
- itself introduces.
81
-
82
- ## Run Status Card
83
-
84
- When a run needs an operational status view, use the Run Status Card as a compact projection of existing control state.
85
- It must not introduce a second gate model or override `gate-check`, `delivery-map`, QA, OR, or user approvals.
86
-
87
- - `mode`: `quick_task | verified_change | structured_delivery | unknown`
88
- - `run_id`: the exactly selected canonical run
89
- - `presentation_language`: the resolved complete locale-pack tag; absent, unsupported or incomplete packs resolve to the registry's deterministic `en` fallback
90
- - `status`: `open | blocked | pass | warn | revise | block | in_progress`
91
- - `current_gate`: current user gate or internal step
92
- - `mode_slice_decision`: `undecided | quick_task | verified_change | structured_slice | structured_delivery | block`
93
- - `allowed_now`: outputs or actions currently permitted
94
- - `forbidden_now`: outputs or actions currently forbidden
95
- - `blocking_condition`: current blocker or `none`
96
- - `missing_approval`: exact missing approval formula or `none`
97
- - `next_gate_after_approval`: the next user gate or internal step unlocked by the missing approval, or `none`
98
- - `allowed_after_approval`: concise description of what becomes allowed after the missing approval, or `none`
99
- - `user_visible_outcome_after_approval`: concise user-facing result of approving the current gate
100
- - `internal_next_step`: the next agent-controlled process step, or `none`
101
- - `next_user_gate`: the next actual user approval gate, or `none`
102
- - `user_action_required`: `yes` only when the user must provide another deliberate approval or decision; otherwise `no`
103
- - `evidence`: concrete evidence references currently visible
104
- - `next_skill`: next AGDF skill or `none`
105
- - `next_step`: the single next permissible process action
106
- - `quality_outlook`: the next meaningful quality-improvement focus, or `none`
107
-
108
- `next_step` and `quality_outlook` are intentionally different:
109
-
110
- - `next_step` is process permission: what may happen next.
111
- - `quality_outlook` is quality direction: what would most improve confidence, maintainability, evidence, or delivery integrity if further investment is made.
112
-
113
- `quality_outlook` must not unlock gates, imply QA pass, or substitute for missing evidence.
114
-
115
- `allowed_now` and `allowed_after_approval` are intentionally different:
116
-
117
- - `allowed_now` is current authority under the active gate.
118
- - `allowed_after_approval` is the immediate authority unlocked only after the exact `missing_approval` is supplied.
119
-
120
- `next_gate_after_approval` and `allowed_after_approval` must be `none` when no approval is missing, when the current step is internal, or when the run is in OR/completed handoff. They must not imply implementation, QA, release, commit, push or PR authority unless the existing gate model already allows that authority.
121
-
122
- ## Delivery Path Search
123
-
124
- Delivery Path Search is an optional read-only planning step for high-impact decisions with several materially different next actions.
125
-
126
- - It consumes current AGDF state and must reject gate-illegal candidates before model evaluation.
127
- - It returns one advisory recommendation or `no_safe_recommendation`.
128
- - It must report budgets, stopping reason and `full | tool_enforced | instruction_only` enforcement.
129
- - Model scores are judgements, not measurements.
130
- - Search output is evidence only. Canonical `gate-check` independently decides what may proceed.
131
- - The bounded first-release algorithm must not be labelled MCTS.
132
- - Surface adapters may translate transport and presentation, but must not fork scoring, search or gate semantics.
133
- - Optional AI-native candidate generation supplements the deterministic candidate baseline; it never replaces it.
134
- - Generated proposals are untrusted. The core must validate schema, exact canonical gate action, scope, duplicates and material diversity before evaluation.
135
- - Generation is opt-in and bounded to one call, five proposals, 30 seconds and five abstract cost units by default, within whole-run budgets.
136
- - External generation receives only bounded normalized control summaries and references, never secrets, full artefacts, raw prompts, hidden reasoning or source snapshots.
137
- - Generator status, provenance, accepted/rejected counts, separate budget use and typed failure must remain visible. Failure retains the deterministic baseline; automatic provider fallback is forbidden.
138
- - Codex and Claude Code may provide tool-enforced generator transports. Copilot, OpenCode and generic surfaces remain instruction-only without conforming evidence.
139
-
140
- The field names above are the stable machine-readable contract used by JSON
141
- reports and automation. Human-facing Markdown must present the same projection
142
- with readable labels such as `Current gate`, `Allowed now`, `Blocked by`,
143
- `Next step` and `Quality outlook`; do not expose snake_case keys as the visible
144
- Run Status Card. Keep that card compact: show `Status`, `Current gate`,
145
- `Allowed now`, `Blocked by`, `Missing approval`, `Next gate after approval`
146
- and `Allowed after approval` when a missing approval exists, `Next step` and
147
- `Quality outlook`. Keep mode, forbidden actions, evidence and next-skill detail
148
- in the surrounding control artefact when they are relevant.
149
-
150
- ### Breadcrumb
151
-
152
- The compact human Run Status Card may include a single-line path-derived breadcrumb that
153
- shows the user's position in the delivery journey. It is derived from the Mode/Slice
154
- Decision and the Approvals table — not a fixed template.
155
-
156
- | Mode/Slice | Breadcrumb gates |
157
- |---|---|
158
- | structured_delivery / structured_slice | `UR · PRD · SD · TP · QA · UAT` |
159
- | verified_change | `UR · Verified Change · OR` |
160
- | quick_task | `UR · Quick Task` |
161
- | block | `UR · Block` |
162
-
163
- - `✓` fulfilled, `●` current, `○` open.
164
- - Non-applicable gates are absent (no `–` placeholders, no thinned standard template).
165
- - `verified_change` is one collapsed node, not a degraded standard route.
166
- - The breadcrumb is a derived, non-authorising projection. It does not add a new gate
167
- model or override the Gate Transition Model.
168
- - The machine-readable `status_card` JSON may carry a derived `breadcrumb` array
169
- `[{gate, status}]` for the presentation layer; this is additive and does not replace
170
- any existing field.
171
-
172
- ### Post-Acceptance Transition Narration
173
-
174
- After each accepted gate approval, the agent emits exactly one status line using the
175
- template:
176
-
177
- ```text
178
- <what was satisfied> → <what the agent does next internally> → <user action: yes/no>
179
- ```
180
-
181
- This narration is temporally and structurally separate from the Gate Transition Card:
182
-
183
- - The Gate Transition Card is **pre-approval** (in the orientation envelope); it is
184
- subjunctive and contains the exact `Approval:` value.
185
- - The narration is **post-acceptance** (after the gate advanced); it is indicative and
186
- does not contain the `Approval:` value.
187
- - Both never appear in the same assistant message.
188
- - The narration does not repeat the decision's effect (the card's job) and uses its own
189
- template, not the card's three-question form.
190
- - For internal steps (Brownfield Review, Brownfield Analysis), the narration states what
191
- the agent does next and that no user action is required, without exposing
192
- `next_user_gate: none` or asking for a second approval.
193
-
194
- ### Internal-State Collapse
195
-
196
- The derived-projection principle above applies explicitly to internal sub-states. The
197
- full Run Status Card (machine/audit projection) keeps all fields unchanged. Only the
198
- compact human card collapses internal sub-states to stable human labels:
199
-
200
- | Internal sub-state | Human label | Stays explicit |
201
- |---|---|---|
202
- | `verified_change`: missing/draft/invalid/eligible/executed | "Compact change under review" | `escalated` → "Escalated to structured delivery" |
203
- | `context_graph_required_action`: link/update/create/resolve_drift | "Project memory maintained" | `open_gap` → "Graph gap open" |
204
- | `multi_scope_state`: clear/ambiguous | (not shown) | `blocked` → "Ambiguous scope, clarification needed" |
205
-
206
- `open_gap` and `escalated` remain explicitly visible. The full machine projection retains
207
- all raw values unchanged.
208
-
209
- ## Quality Readiness Projection
210
-
211
- After CD+Tests, when any of the four review/QA artefacts exists, surfaces may show one compact
212
- derived `Quality Readiness` projection. It answers the user-facing question "what is the current
213
- quality outcome and what should happen next?" without replacing evidence or creating another
214
- decision authority.
215
-
216
- - It contains exactly four rows, in this order: `Plan coverage` from `task-plan-review`,
217
- `Solution integrity` from `clean-implementation-review`, `Code quality` from `code-review`,
218
- and `QA decision` from `qa-gate`.
219
- - `qa-gate` is always labeled as the sole decision owner. The other three rows are evidence
220
- dimensions, not competing pass/revise/block decisions.
221
- - Overall status reuses canonical severity ordering. Missing or conflicting required evidence
222
- must not render `pass`; surface `revise` or `block` with the decisive reason and one permitted
223
- next action instead.
224
- - The projection is derived, non-persistent and non-authorizing. It cannot accept an approval,
225
- advance a gate, suppress a report or replace the Run Status Card, Gate Transition Card, JSON
226
- projection or durable review artefacts.
227
- - Show compact rows on `pass`. On `revise` or `block`, expand only the decisive row with its
228
- canonical report reference; do not paste complete reports into chat.
229
-
230
- ## Gate Transition Card
231
-
232
- Every ready `gate_approval` uses one fixed visible sequence: first the compact
233
- approval-time Run Status Card, then the Gate Transition Card, then exactly one
234
- native question or exact-text fallback. Both cards derive from one immutable,
235
- non-authorizing presentation snapshot produced after canonical selected-run,
236
- gate and durable-artefact readiness evaluation. The snapshot never selects a
237
- run, decides a gate, persists state or grants approval.
238
-
239
- The two distinct card blocks form one Approval Orientation Envelope in one
240
- immediately preceding assistant message. The agent must complete that message
241
- before invoking any native question tool or emitting an exact-text approval
242
- request. Splitting the cards across separate assistant turns or invoking the
243
- tool after only one card is a failed interaction, not a valid presentation.
244
-
245
- The first visible line of that envelope is the localized action-oriented title
246
- of the current user gate, rendered as a level-two Markdown heading or equivalent
247
- accessible host heading inside the compact approval-time Run Status Card.
248
- `AGDF Status`, `Run Status Card`, `Gate Transition Card`, raw gate identifiers
249
- and machine values are semantic or diagnostic labels only and must not become
250
- the primary heading. The action title appears exactly once and does not replace,
251
- merge or reorder either required card block.
252
-
253
- The compact approval-time Run Status Card contains exactly six operational
254
- fields: selected run, readiness status, current gate, missing exact approval,
255
- one next action and quality outlook. It uses localized human-readable labels
256
- and must not contain evidence, diagnostic codes, raw control-state keys,
257
- allowed/forbidden inventories or machine values. The complete Run Status Card remains the operational,
258
- CLI and audit projection and remains available for complete detail outside the
259
- approval-time compact view.
260
-
261
- The Gate Transition Card is the second orientation message. It is derived from
262
- the same snapshot and canonical post-approval transition, but it is not another
263
- state model, persisted record, renderer or approval authority. It turns only
264
- the decision-relevant subset into concise product copy immediately before the
265
- host-native question or exact-text fallback.
266
-
267
- The card answers exactly three user questions, in this order:
268
-
269
- 1. **Where am I?** A localized human-readable gate title, deterministic human
270
- run title, selected `run_id` as secondary context, compact `UR · PRD · SD · TP`
271
- artefact links and a clear ready-for-decision state.
272
- 2. **What does this decision do?** The exact `Approval: <GateName>` value, its
273
- concrete next outcome and the most important boundary that remains.
274
- 3. **What happens next?** The immediate agent-controlled action and the next
275
- actual user decision when one exists; otherwise a plain statement that no
276
- further user action is required now.
277
-
278
- Use this compact composition:
279
-
280
- ```text
281
- <localized gate title> · <human run title> · <run_id>
282
- <UR link or localized missing text> · <PRD link or localized missing text> · <SD link or localized missing text> · <TP link or localized missing text>
283
- <localized ready-for-decision line>
284
-
285
- <localized approve heading>
286
- `Approval: <GateName>` <localized concrete effect>. <localized remaining boundary>.
287
-
288
- <localized next heading>
289
- <localized immediate agent action>. <localized next user decision or no-action statement>.
290
- ```
291
-
292
- Resolve all AGDF-owned explanatory text through the canonical Interaction
293
- Locale Registry. `en` and `de` are initial reviewed packs, not a closed locale
294
- list. English is the deterministic fallback for absent, unsupported or
295
- incomplete packs. Gate identifiers, `run_id`, canonical paths and exact
296
- approval values are never translated. The visible gate title is localized;
297
- for example, the German title may be `Lösungsdesign` while the authorization
298
- value remains `Approval: SD`. Meaning, ordering and authority boundaries are
299
- identical across locale packs.
300
-
301
- The Gate Transition Card must not be a Markdown table or dashboard. It must not
302
- present raw control-state keys, machine status values, diagnostic codes,
303
- evidence lists, allowed/forbidden inventories or implementation detail that is
304
- not needed for the decision. It must not repeat the native question. The card
305
- normally fits in one title, one readiness line and two short content blocks.
306
- Run and gate identity may appear in both cards to anchor the shared snapshot;
307
- status rows, action inventories and transition prose must not be duplicated.
308
-
309
- For `Approval: TP`, the effect is permission to run pre-implementation
310
- Brownfield Analysis, implementation remains gated until that analysis passes,
311
- and the next block states plainly that no further user decision is required
312
- now. Brownfield Analysis must not be presented as a user gate.
313
-
314
- ## Source Precedence
315
-
316
- Every governed repository should make the normative instruction source visible.
317
- When several instruction files, generated copies, submodule rules, branch names, worktree diffs or chat summaries point in different directions, fail closed instead of inventing a primary authority.
318
-
319
- Default precedence:
320
-
321
- 1. safety, security and compliance instructions
322
- 2. repository-declared normative agent instructions
323
- 3. live `.agdf/control/` state or a linked authoritative repository SoT
324
- 4. approved gate artefacts
325
- 5. source code and verified runtime evidence
326
- 6. branch names, workspace deltas, chat history and model memory
327
-
328
- A branch name or uncommitted workspace delta is never sufficient scope proof by itself.
329
- It may support a scope only when it does not conflict with durable artefacts, approvals or source-of-truth records.
330
-
331
- ## Workstate And Scope Ambiguity
332
-
333
- If a repository contains multiple plausible active work lines, the agent must not silently choose one.
334
- List the evidenced competing lines with their latest known gate, artefact pointers, approvals and missing evidence.
335
- The next permissible step is scope clarification or the earliest common safe gate.
336
-
337
- Use `multi_scope_state: clear | ambiguous | blocked` when the control state needs to make this visible.
338
- `ambiguous` is at least a revise condition for delivery-map style reporting.
339
- `blocked` applies when continuing would produce later-gate artefacts, implementation or release claims for the wrong scope.
340
-
341
- ## Knowledge Persistence Decision
342
-
343
- Every relevant run should decide what happens to new durable knowledge.
344
- The decision is not a memory dump; it routes only reusable, evidenced information to the right owner.
345
-
346
- Use:
347
-
348
- - `memory_target: context_graph | sot_registry | scope_artifact | open_questions | none`
349
- - `memory_reason`: short reason for the target
350
- - `memory_refs`: paths or nodes affected
351
-
352
- Guidance:
353
-
354
- - Use `context_graph` for reusable Brownfield findings, decisions, risks, invariants and exit criteria.
355
- - Use `sot_registry` when source-of-truth ownership changes or drift is found.
356
- - Use `scope_artifact` for run-specific evidence, ticket details, screenshots, logs or local reproduction data.
357
- - Use `open_questions` when a durable question should survive the run but no answer is evidenced yet.
358
- - Use `none` for one-off observations without future decision value.
359
-
360
- ## Bug Lightweight Track
361
-
362
- For narrow defect work, a repository may use a lightweight bug scope instead of the full UR/PRD/SD/TP chain when all of the following are true:
363
-
364
- - the defect is tied to a concrete symptom or ticket
365
- - the expected behavior is clear enough to test
366
- - no new product semantics, architecture, policy, persistence or cross-owner decision is introduced
367
- - a durable bug artefact or linked authoritative issue records reproduction, actual behavior, expected behavior, fix boundary, open questions and evidence plan
368
-
369
- The Bug Lightweight Track does not remove QA, OR, evidence, Brownfield fit or exact approvals required by the target repository.
370
- If the bug grows beyond the stated boundary, escalate to normal AGDF gate flow.
371
-
372
- ## Domain Guardrail Packs
373
-
374
- Repositories may define domain guardrail packs for recurring high-risk surfaces such as UI, persistence, integration, financial calculations, policy, security, migration or release operations.
375
- A pack should define:
376
-
377
- - trigger patterns
378
- - required Brownfield touchpoints
379
- - protected invariants
380
- - required evidence
381
- - review or QA escalation conditions
382
-
383
- Domain guardrails are project-specific extensions.
384
- They must not override AGDF gates, approvals or the Runtime Contract.
385
-
386
- ## Support Answer Bridge
387
-
388
- When the user asks about a concrete ticket, issue, incident or support question, end with exactly one smallest useful next step.
389
- Do not treat that next step as approval.
390
- When the next step is gated, name the required approval or AGDF skill instead of implying work may proceed.
391
-
392
- ## Chat Output Discipline
393
-
394
- Durable artefacts are for the repository, not for flooding the chat.
395
- When a skill creates or updates `.agdf/control/` files, gate artefacts, reviews, QA reports or OR reports, the chat response must stay compact:
396
-
397
- - name the artefact path and status
398
- - summarize the decision or content in a few lines
399
- - state the current gate, forbidden work and next permissible step
400
- - mention validation evidence when available
401
-
402
- Do not paste full control files, full artefact bodies, full templates or full generated reports into the chat unless the user explicitly asks to see the full content.
403
- For larger or more formal work, create or update the durable artefacts fully, then reference them by path and summarize what changed.
404
-
405
- ### Chat and Tool-Call Discipline
406
-
407
- Chat output shows decisions and outcomes. Files show evidence and detail. The agent
408
- minimises both the number of tool calls and the amount of accompanying chat text. This
409
- is surface-agnostic: it changes agent behaviour and framework text, not host rendering.
410
- Whether a host renders a tool-call block visibly is a host concern; the framework ensures
411
- the agent makes fewer calls and produces less text around them.
412
-
413
- Skill output compaction:
414
-
415
- - QA, Code Review, TP Review and Clean Implementation Review output is 1 line at `pass`:
416
- `<skill>: pass — <one-line summary>`.
417
- - At `revise`/`block`: the decisive dimension, reason and next action. The Quality
418
- Readiness projection is shown only at `revise`/`block`, not at `pass`.
419
- - Full reports remain in durable files; the chat references the path.
420
-
421
- Tool-call batching:
422
-
423
- - `RUN_STATE.md` is written once per user gate approval, not once per field change. The
424
- agent keeps intermediate state in memory between gate approvals and writes the complete
425
- updated state in one operation.
426
- - The agent does not `read` existing artefacts for format reference. Skill instructions
427
- carry the format/structure inline. If a specific existing artefact must be inspected
428
- for content (not format), the read has no accompanying commentary.
429
- - Artefact writes are silent: the agent names the path and a 1-line summary only when an
430
- artefact is first created or significantly changed — not on every state update.
431
- - Validation commands (tests, integrity, diff) show pass/fail only. Full output appears
432
- only on failure.
433
-
434
- Always visible:
435
-
436
- - Gate decisions (Run Status Card, Gate Transition Card, approval question).
437
- - Post-acceptance narration (1 line per gate transition).
438
- - Delivery summary (UAT/OR compact summary).
439
- - Errors, blockers and evidence at `revise`/`block`.
440
-
441
- ## Relevant Run
442
-
443
- A relevant run is any run that changes durable state, creates or updates an AGDF artefact, changes code or runtime behaviour, performs a gate decision, blocks on a governance condition, produces QA/UAT/release evidence, or closes a delivery slice.
444
-
445
- OR is not mandatory for a pure explanation, read-only inspection, small review, or local debugging step that produces no durable state change and no gate consequence.
446
- When in doubt, use a short OR-lite only if it clarifies gate state, evidence, risk, or the next permissible step.
447
-
448
- A `quick_task` fully inside the Non-Normative Trivial Change Boundary above stays exempt from the full
449
- selected-run ceremony even when it is otherwise a relevant run. If a selected canonical
450
- `RUN_STATE.md` currently reflects another scope, append exactly one line to that run's
451
- `Prior Run Pointers` section noting what changed and that it is unrelated; do not edit any other
452
- section or any other existing line.
453
-
454
- ## Gate Rules
455
-
456
- - User gates: `UR -> PRD -> SD -> TP -> QA -> UAT`
457
- - Internal mandatory steps: `Brownfield Review -> Mode/Slice Decision -> Verified Change Execution | Brownfield Analysis -> CD+Tests -> CR -> OR`
458
- - On the approved-TP path, `CD+Tests` and `CR` are satisfied only by `done`; `not_applicable` may satisfy Brownfield Review or Brownfield Analysis, but it must not bypass implementation/test evidence or mandatory Code Review.
459
- - Exact approval formula: `Approval: <GateName>`
460
- - Legacy alias: `Freigabe: <GateName>` may be accepted when reviewing older German runs, but all new outputs must use `Approval: <GateName>`.
461
- - Implicit consent is not approval. Phrases such as "ok", "go ahead", "do it", "approved", "continue", "leg los" or "looks good" are work intent, not gate approval.
462
- - The earliest blocking gate wins.
463
- - For UR, PRD, SD, TP and QA, approval and durable artefact presence are separate requirements. A gate is not satisfied by approval text alone when its artefact is missing from `.agdf/control/` or not linked to the authoritative repository SoT.
464
- - Approval of one user gate permits work on the next allowed gate artefact or required internal step only. It does not permit implementation unless the approved gate is `TP` and required internal implementation prerequisites are satisfied.
465
- - Gates must never be skipped or inferred from urgency, tone, chat history, task wording or an instruction to "start". The next allowed action is always the next unsatisfied gate or internal mandatory step.
466
- - Missing control files or missing current-state fields do not forbid the agent from preparing the current allowed artefact. They forbid later-gate work and implementation. For a fresh request, the default allowed work is to draft a minimal UR in the response and request `Approval: UR`. Initialize or write `.agdf/control/` only when the user explicitly asks for durable AGDF control state, the repository already uses `.agdf/control/` as its live working state, or a deterministic CLI/CI setup path is being executed.
467
- - `Approval: UR` permits Brownfield Review after G-00 first, then a Mode/Slice Decision. It never permits implementation by itself.
468
- - PRD, SD and TP depth is chosen after Brownfield Review through the Mode/Slice Decision, not before existing-system impact is understood.
469
- - The Mode/Slice Decision must be visible before any PRD shortcut, Quick Task execution or implementation: record the decision, required next gate, scope reason and evidence in the selected canonical `RUN_STATE.md` or an equivalent linked control artefact.
470
- - `Approval: PRD` permits Solution Design drafting, not implementation.
471
- - `Approval: SD` permits Task/Test Plan drafting, not implementation.
472
- - `Approval: TP` permits implementation-preparation Brownfield Analysis and then CD+Tests when Brownfield evidence supports it.
473
- - `CD+Tests` is implementation and test status only, not a delivery signal.
474
- - `code-review` standardizes the mandatory `CR` step, but does not replace QA.
475
- - `qa-gate` decides final `pass | revise | block`.
476
- - `release-or` reports the run, but does not replace QA or produce the operative commit/PR handoff.
477
- - `delivery-closeout` owns the operative Git handoff text when QA/OR/UAT state allows it.
478
-
479
- ## Native Interaction Contract
480
-
481
- Native host controls improve how a decision is presented; they do not create a second approval model or authority source.
482
-
483
- Every AGDF interaction belongs to exactly one semantic kind:
484
-
485
- - `clarification`: asks for missing intent or a choice that does not itself authorize a gated transition.
486
- - `tool_permission`: requests host-owned authority for a command, file change, network access, external path, app action or comparable technical side effect.
487
- - `gate_approval`: requests deliberate user input for the one current AGDF user gate after its durable artefact and selected run are ready.
488
- - `blocked`: explains a blocker and the one permissible recovery action without offering approval controls.
489
- - `status`: reports current state without asking for a decision.
490
-
491
- The semantic interaction envelope is:
492
-
493
- ```text
494
- interaction_kind: clarification | tool_permission | gate_approval | blocked | status
495
- surface: codex | claude | opencode | fallback
496
- run_id: required for gate_approval
497
- current_gate: required for gate_approval
498
- native_attempt_required: true only after ready-gate and adapter-capability preflight prove exact value transport and safe deliberate waiting
499
- prompt: required
500
- options: required for a structured question
501
- effects: required when the interaction can cause side effects
502
- required_evidence: required for gate_approval
503
- auto_resolution: forbidden for gate_approval
504
- response_origin: deliberate_user_input for gate_approval
505
- ```
506
-
507
- This envelope is not a new persisted record. The selected canonical `RUN_STATE.md` and existing artefact chain remain the durable authority.
508
-
509
- Before presenting `gate_approval` for any user gate (`UR`, `PRD`, `SD`, `TP`,
510
- `QA`, or `UAT`), the agent must emit the compact localized Run Status Card and
511
- the localized Gate Transition Card as two distinct blocks in that order within
512
- one immediately preceding assistant message. Neither card is optional, hidden
513
- in the question text or replaced by a host button label. Do not invoke the
514
- native question tool until the complete two-card envelope is visible. Native
515
- buttons or exact-text fallback may appear only after both cards. Render the two
516
- cards once per eligible attempt; an unavailable or not-applied native control
517
- proceeds to exact text without repeating them.
518
-
519
- Before presenting `gate_approval`, the agent must:
520
-
521
- 1. resolve exactly one selected run;
522
- 2. run the canonical gate evaluation and confirm that the current gate's durable artefact is present and ready;
523
- 3. build one immutable non-authorizing presentation snapshot, emit its compact Run Status Card and Gate Transition Card in that order immediately before the gate question, then ask exactly one gate question that identifies `run_id` and `current_gate` and offers the exact approving value `Approval: <GateName>` followed by stable `revise` and `decline` outcomes; host-owned dismissal maps to `cancel` where only three choices are available;
524
- 4. wait for deliberate user input without a timeout, default, preselection, hook-supplied answer or agent-to-agent substitute;
525
- 5. re-run canonical gate evaluation against the same `run_id` and expected gate immediately before persistence;
526
- 6. reject missing evidence, ambiguous or wrong run, wrong gate, stale state and any response that is no longer valid;
527
- 7. persist an accepted approval only through the existing control-state workflow.
528
-
529
- For a ready `gate_approval`, interaction kind and native capability are separate. Evaluate callability,
530
- deliberate wait safety and canonical approval-value transport before invocation. `native_attempt_required`
531
- is true only when current evidence proves `exact_option_value` or `separate_label_and_value` transport
532
- with safe deliberate waiting. Decorated-only, missing, conflicting or unknown capability fails closed to
533
- `unavailable_before_invocation`; unsafe waiting fails closed to `unsafe_to_wait`. Both expose false and use
534
- exact text without invoking the adapter. A report-only CLI evaluation has no verified current host adapter
535
- and therefore exposes false. Hooks may prepare context but must not answer, approve or replace an eligible attempt.
536
- An adapter that requires a visible suffix such as `(Recommended)` on its approving option is
537
- `decorated_label_only`: do not invoke it for an AGDF gate. `Approval: <GateName> (Recommended)` is never a
538
- valid AGDF approval option or authorization value; use the undecorated exact-text fallback instead.
539
-
540
- The first eligible native-attempt has a single bounded outcome: the declared
541
- host control is presented, or the agent immediately uses the exact-text
542
- fallback. A host that does not apply the control does not trigger a second
543
- native prompt. AGDF must not simulate or force host-owned presentation.
544
-
545
- An eligible interaction must make its presentation outcome visible and
546
- distinguishable: `presented`, `unavailable_before_invocation`,
547
- `attempted_not_applied`, or `unsafe_to_wait`. This is transient presentation
548
- evidence only, never a persisted approval, selected-run authority or substitute
549
- for post-response revalidation. A textual fallback names the outcome, gives the
550
- exact approval value and confirms that authority is unchanged. A fresh explicit
551
- user request may reopen the unchanged decision after revalidation; it is not an
552
- automatic retry.
553
-
554
- A free-form native response is valid only when the existing exact-approval validator accepts it for the current gate after revalidation. A localized label, description, option position, recommendation style or host action never authorizes a gate. Revise, decline and cancel outcomes never advance a gate.
555
-
556
- Surface adapter rules:
557
-
558
- | Surface | Native question adapter | Gate-safe use | Technical permission boundary |
559
- |---|---|---|---|
560
- | Codex | native `request_user_input` or equivalent short-question control when callable | invoke only when preflight proves `exact_option_value` or `separate_label_and_value`; the current canonical `decorated_label_only` capability uses exact text without invoking the adapter | Codex command, edit, network, external-directory and app-action approvals remain host-owned `tool_permission`. |
561
- | Claude Code | `AskUserQuestion` | on the first eligible attempt, use only when no timeout can auto-continue and no hook supplies `answers` or `updatedInput`; if unavailable or not applied, use exact text without retry | Claude permissions and `ExitPlanMode` are not AGDF approval. |
562
- | OpenCode | built-in `question` | use with exact approval/revise/cancel options when `permission.question` permits it; explicit user deny selects exact-text fallback | `once`, `always`, `reject`, permission suggestions and auto mode are technical outcomes only. |
563
- | Fallback or non-interactive | concise exact text | wait for a new explicit user response; never synthesize or auto-resolve one | Host-specific technical permission remains separate. |
564
-
565
- Native structured questions are for real decision points. Prefer repository inspection over clarification and do not show them for status reporting, discoverable facts, routine read-only work or repeated non-ready gate prompts.
566
-
567
- Exact textual approvals remain canonical and fully supported on every surface. If native capability availability or safety is unknown, use the textual fallback. Host permission, plan approval, native question presentation, timeout/default behavior, hook output and agent messages never carry AGDF gate authority by themselves.
568
-
569
- ### Interaction Locale Contract
570
-
571
- User-facing native questions, option descriptions, primary chat cards, exact-text
572
- fallback and human CLI output use the configured project chat language from
573
- `.agdf/control/config.json` and the canonical registry
574
- `plugin/meta/agdf-interaction-locales.json`:
575
-
576
- - resolve an exact complete pack, then its language subtag, then deterministic English fallback;
577
- - `en` and `de` are the initial complete packs; additional reviewed complete packs are supported without changing runtime logic;
578
- - an incomplete pack is unsupported and must fail to English as a unit;
579
- - one interaction must not mix presentation languages, including labels and descriptions;
580
- - durable artefacts, runtime rules, task identifiers and machine-facing approval values remain English;
581
- - the exact approval value remains `Approval: <GateName>` in every locale;
582
- - localized `revise`, `decline` and `cancel` labels are presentation text only and never carry gate authority;
583
- - host-owned chrome follows the host's own UI language and must not be presented as AGDF-translated chat copy.
584
-
585
- The locale changes presentation only. It must not change gate meaning, option ordering, readiness, validation, revalidation or persistence. Host-provided free-text labels and skip actions are not AGDF-owned approval options and must never advance a gate.
586
-
587
- ### Gate-Rationale-Registry
588
-
589
- The locale registry contains a deterministic, localized `gateRationale` section with one
590
- curated one-liner per gate and internal step. The agent retrieves rationale strings via
591
- the `gateRationale()` function; it does not generate rationale prose. Rationale strings
592
- are the same across invocations for the same gate and locale.
593
-
594
- The registry covers all user gates (`UR`, `PRD`, `SD`, `TP`, `QA`, `UAT`) and all internal
595
- steps (`Brownfield Review`, `Mode/Slice Decision`, `Brownfield Analysis`, `CD+Tests`, `CR`,
596
- `OR`). Each string stays within the declared `lengthBudgets.description` budget. Key parity
597
- across locale packs is enforced by the existing `validateLocaleRegistry` baseline
598
- comparison.
599
-
600
- A one-liner cannot explain the full protective function. The user needs enough to accept
601
- that the gate makes sense, not the complete rationale. Deeper context is available on
602
- demand through the "Why?" interaction.
603
-
604
- ### On-Demand "Why?" Interaction
605
-
606
- When the user asks "why?" at any gate or internal step, the agent responds with a `status`
607
- interaction containing the curated rationale (Gate-Rationale-Registry) plus one line of
608
- fulfilled/protects context composed from existing state.
609
-
610
- - The response is deterministic, non-authorizing, and does not display approval controls.
611
- - It is a separate `status` interaction, never merged with the `gate_approval` sequence.
612
- - The `gate_approval` options remain exactly `approve | revise | decline | cancel`; no
613
- "why" option is added.
614
- - The response never breaks `APPROVAL_SEQUENCE` or `validateApprovalOrientationSnapshot`.
615
- - Default output is unchanged when the user does not ask.
616
- - The fulfilled line is composed from the selected run's Approvals table and artefact
617
- status; the protects-against line is composed from the gate's rationale and existing
618
- `primary.actions` copy. The agent does not generate new prose.
619
-
620
- ### Human Decision Presentation Contract
621
-
622
- The primary user surface is a pure projection of the selected canonical run.
623
- It must never become a second evaluator, state store, renderer authority or
624
- approval path. Native controls, exact-text fallback and human CLI output use
625
- the same semantic payload and outcome ordering; machine JSON retains its
626
- stable field names and diagnostic values.
627
-
628
- For every primary chat card:
629
-
630
- 1. Resolve a human run title deterministically from the current artefact
631
- heading, approved UR heading, first non-empty Objective line, then normalized
632
- `run_id`.
633
- 2. Show `UR · PRD · SD · TP` in that stable order. Existing selected-run
634
- artefacts are links with readable labels; missing artefacts use localized
635
- non-link text. Never guess a path or emit a broken link.
636
- 3. Use a localized visible gate title while preserving the exact gate identifier
637
- and `Approval: <GateName>` authorization value.
638
- 4. Keep primary copy decision-oriented. Raw keys such as `next_user_gate`,
639
- `mode_slice_decision` and `required_next_gate`, diagnostic codes and machine
640
- status values belong to JSON or audit detail, not the primary interaction.
641
-
642
- For a ready approval, explicit options are ordered `approve`, `revise`,
643
- `decline`; an explicit `cancel` follows only on surfaces that support it, while
644
- host dismissal maps to `cancel` on three-choice surfaces. Do not preselect,
645
- auto-submit, recommend as authorization, skip or reorder an option. Labels and
646
- descriptions use the same resolved locale and must have distinct, non-empty
647
- accessible names. Translation length budgets must preserve meaning without
648
- truncation being the only distinction.
649
-
650
- Normalize outcomes as distinct values:
651
-
652
- ```text
653
- approve | revise | decline | cancel | no_response | timeout | empty | invalid | stale
654
- ```
655
-
656
- Missing input, timeout, cancellation and empty input are not decline. Only
657
- `approve` backed by the exact revalidated `Approval: <GateName>` value may
658
- advance a gate. Clarification, blocked, internal-step and status-only
659
- interactions must not display gate-approval controls.
660
-
661
- ## Brownfield Review After G-00
662
-
663
- After an approved and durable UR, perform a lightweight `Brownfield Review` before PRD when Brownfield, UI, UX, admin, runtime, policy, persistence, architecture, ownership or source-of-truth impact is possible.
664
-
665
- This review is not a new user approval gate, not PRD, not SD, not TP and not implementation permission.
666
- It is the sizing and routing step that decides how much later gate discipline is actually needed.
667
-
668
- Its output is limited to:
669
-
670
- - workstream or follow-up-slice classification
671
- - `Mode/Slice Decision`: `quick_task | verified_change | structured_slice | structured_delivery | block`
672
- - affected existing owners, source-of-truth artefacts, contracts, policies, runtime paths or tests
673
- - reuse-before-create risks and parallel-structure risks
674
- - open questions that PRD or SD must resolve
675
- - whether implementation-preparation Brownfield Analysis will also be needed after TP
676
-
677
- Mode/Slice Decision rules:
678
-
679
- - `quick_task`: use only when Brownfield Review shows a narrow local change, no new product semantics beyond the approved UR, no architecture/policy/persistence/contract expansion, and evidence is sufficient to proceed with a small implementation plus relevant checks.
680
- - `verified_change`: use only when the compact record can prove one canonical owner, bounded clean-at-baseline paths, no prohibited impact, deterministic propagation/validation and a structured escalation target. It skips later approvals only after every condition is evidenced and machine-validated.
681
- - `structured_slice`: use when some formal artefacts are needed, but they can stay intentionally small and scoped to the approved slice.
682
- - `structured_delivery`: use when the change has broad product, architecture, runtime, policy, persistence, release or cross-owner impact.
683
- - `block`: use when ownership, SoT, impact, evidence or product direction is not clear enough to choose a safe path.
684
-
685
- A Mode/Slice Decision without scope reason and evidence is not recorded. Treat it as missing and keep the next step at `Mode/Slice Decision`.
686
-
687
- ## Gate Transition Model
688
-
689
- This table is the canonical transition model. Skills may reference it, but must not carry a second complete copy.
690
-
691
- | State | Current gate or step | Allowed | Forbidden | Missing approval |
692
- |---|---|---|---|---|
693
- | No approved UR | `UR` | clarify user need, formulate and persist UR, request `Approval: UR` | PRD, SD, TP, Brownfield Analysis, implementation, QA, release | `Approval: UR` |
694
- | `UR` approved and UR artefact persisted or linked, Brownfield Review missing | `Brownfield Review` | classify workstream, existing owners, SoT, reuse risks, change size and PRD/SD open questions; mark review done or not_applicable | PRD, SD, TP, implementation, QA, release | none |
695
- | Brownfield Review done or not_applicable, Mode/Slice Decision missing or incomplete | `Mode/Slice Decision` | decide `quick_task`, `verified_change`, `structured_slice`, `structured_delivery` or `block`; record scope reason, evidence and required next gate depth | PRD, SD, TP, implementation, QA, release | none |
696
- | Mode/Slice Decision is `quick_task` | `Quick Task Execution` | implement only the narrow approved UR scope, run relevant checks, record evidence and OR-lite when the run is relevant | broad PRD/SD/TP by ritual, scope expansion, QA or release claims without evidence | none |
697
- | Mode/Slice Decision is `verified_change`, record missing/draft/invalid | `Verified Change Execution` | create or repair compact record, capture baseline and prove eligibility with doctor/gate-check | implementation, QA, UAT, release | none |
698
- | Verified Change record is `eligible` | `Verified Change Execution` | implement only declared paths, run declared propagation/validation, record mini-closeout | unlisted paths, prohibited impacts, QA/UAT/release claims | none |
699
- | Verified Change record is `executed` | `OR` | use mini-closeout and offer delivery closeout when requested | PRD/SD/TP/QA/UAT by ritual; automatic VCS actions | none |
700
- | Verified Change record is `escalated` | `PRD` | draft the PRD for declared `structured_slice` or `structured_delivery` escalation target | implementation through Verified Change | `Approval: PRD` |
701
- | Mode/Slice Decision is `structured_slice` or `structured_delivery`, PRD missing or draft | `PRD` | draft/refine PRD at the smallest justified depth, define scope, acceptance criteria and non-goals, persist/link PRD, request `Approval: PRD` | SD, TP, implementation-preparation Brownfield Analysis, implementation, QA, release | `Approval: PRD` |
702
- | `PRD` approved and PRD artefact persisted or linked, SD missing or draft | `SD` | draft/refine Solution Design, ownership and architecture, persist/link SD, request `Approval: SD` | TP, implementation, QA, release | `Approval: SD` |
703
- | `SD` approved and SD artefact persisted or linked, TP missing or draft | `TP` | draft/refine Task/Test Plan, task IDs, evidence plan, persist/link TP, request `Approval: TP` | implementation, QA, release | `Approval: TP` |
704
- | `TP` approved and TP artefact persisted or linked, Brownfield Analysis missing | `Brownfield Analysis` | run Brownfield Analysis for approved TP scope | implementation, QA, release | none |
705
- | Brownfield Analysis passed for approved TP | `CD+Tests` | implement approved TP tasks and run tests | QA pass, UAT, release | none |
706
- | `CD+Tests` done for approved TP, CR missing | `CR` | run mandatory Code Review and resolve blocking findings | QA pass, UAT, release | none |
707
- | `CR` done, QA not approved | `QA` | run QA gate, persist/refine QA report, request `Approval: QA` | UAT, release | `Approval: QA` |
708
- | `QA` approved but QA report missing or not pass | `QA` | persist/link QA report with `pass` decision or revise/block evidence | UAT, release | none |
709
- | QA approved and QA report is `pass` or `passed`, UAT not approved | `UAT` | request `Approval: UAT`, prepare non-operative delivery summary | release and automatic VCS actions | `Approval: UAT` |
710
- | UAT approved | `OR` | produce OR or delivery closeout; prepare VCS handoff only when requested | automatic commit, push, PR or release | none |
711
-
712
- ## Brownfield Modes
713
-
714
- The `brownfield-analysis` skill has two explicit modes:
715
-
716
- - `post_ur_review`: lightweight sizing and routing after approved durable UR; decides Mode/Slice Decision before PRD depth or implementation is chosen.
717
- - `pre_implementation_analysis`: implementation-preparation analysis after approved durable TP; verifies reuse path, owners, regression risk and fit before `CD+Tests`.
718
-
719
- Do not mix the modes silently. Name the active mode in Brownfield output.
720
-
721
- ## Quality Contract Output
722
-
723
- Structured Delivery skills use this shape when relevant:
724
-
725
- - `decision`: `pass | revise | block | not_applicable`
726
- - `evidence`: concrete artefacts, files, tests, logs, diffs, or observations
727
- - `missing_evidence`: missing proof needed for a stronger claim
728
- - `risks`: remaining risks, assumptions, fallbacks, drift, or blockers
729
- - `required_next_step`: exactly the next clean step
730
- - `impact_codes`: affected Quality Contract codes, if the target repo has a registry
731
-
732
- A skill may briefly remind this shape, but must not duplicate a complete code or rule matrix.
733
-
734
- ## Context Graph Output
735
-
736
- When a run affects project memory or a Context Graph, use:
737
-
738
- - `Situation:` short plain-language summary when the impact is non-trivial
739
- - `context_graph_impact`: `none | link_only | update_existing_node | new_node_required | sot_drift`
740
- - `context_graph_refs`
741
- - `context_graph_reconciliation`: `resolved | not_applicable | open_gap`
742
- - `context_graph_required_action`: `none | link | update | create | resolve_drift`
743
- - `context_graph_gate_effect`: `none | warning | revise | block`
744
- - `context_graph_evidence`
745
-
746
- Do not create a new node for a mere version, a general chat summary, or a local observation without a concrete next clean step.
747
- `sot_drift` must not pass silently as a warning.
748
-
749
- ### Context Graph Reconciliation
750
-
751
- Relevant-run closeout must reconcile Context Graph impact before presenting a clean delivery handoff.
752
-
753
- - Use `not_applicable` only when `context_graph_impact: none` and no durable graph knowledge is claimed.
754
- - Use `resolved` when required graph work is complete and concrete refs are present.
755
- - Use `open_gap` when graph work remains pending, refs are missing, or a node/update must still be curated.
756
- - `link`, `update`, `create` and `resolve_drift` require either `resolved` evidence or an explicit `open_gap`.
757
- - Resolved `link_only`, `update_existing_node` and `new_node_required` states require concrete `context_graph_refs`; `none`, empty refs or vague future-action language are not enough.
758
- - OR and delivery-closeout must not present commit-ready, release-ready or otherwise clean handoff while `context_graph_reconciliation: open_gap` remains.
759
-
760
- ## Control Scaffold
761
-
762
- ### Run-Scoped Control State
763
-
764
- Canonical mutable run state lives at `.agdf/control/runs/<run_id>/RUN_STATE.md`, one file per run.
765
- Repository-level discovery is derived; do not maintain a writable active-run dashboard. Select with
766
- `--run`, then `AGDF_RUN_ID`, or automatically only when exactly one run is active. Ambiguity fails
767
- closed. Legacy `AGDF_RUN.md` is migration input or an explicitly rendered non-authoritative projection,
768
- never a second writable owner. Read-only commands must not migrate state.
769
-
770
- When a repository needs durable AGDF state, use the plugin-local `control/` scaffold as the starting point.
771
-
772
- - `config.json` stores project language preferences. Use `artifact_language` for generated AGDF artefacts and `chat_language` for user-facing responses unless the user explicitly asks otherwise. Runtime rules remain English.
773
- - `.agdf/control/runs/<run_id>/RUN_STATE.md` is the canonical current-run dashboard; legacy `AGDF_RUN.md` is migration input or an explicit non-authoritative projection.
774
- - `MASTER_BACKLOG.md` is the living pointer for active delivery work.
775
- - `BROWNFIELD_REVIEW.md` records the post-UR existing-system view and Mode/Slice Decision before PRD depth or Quick Task execution is chosen.
776
- - `SOT_REGISTRY.md` prevents parallel sources of truth.
777
- - `CONTEXT_GRAPH.md` stores durable Brownfield findings, decisions, risks, evidence and exit criteria.
778
- - `AGENT_QUALITY_CONTRACTS.json` stores reusable block, revise and warning conditions.
779
- - `memory_target`, `multi_scope_state` and branch/workspace evidence fields make ambiguity and persistence decisions visible without turning chat history into the source of truth.
780
- - OR reports live under `.agdf/control/artefacts/<key>/OR.md` when a run closeout is steering-relevant or should be auditable beyond the chat.
781
-
782
- ### Human-readable Master Backlog
783
-
784
- The Markdown backlog is a human steering view; CLI reports are its normalized
785
- machine projection.
786
-
787
- - Use readable status labels such as `In progress`, `Awaiting UAT` and
788
- `Completed` in Markdown.
789
- - Use links relative to `MASTER_BACKLOG.md`, such as
790
- `[UR](artefacts/<key>/UR.md)`, instead of exposing long raw paths.
791
- - Keep `Priority`, `Key`, `Work item`, `Status`, `Artefacts`, `Current spec`
792
- and `Next step` visible for active and planned work.
793
- - Keep one canonical template. Generated surface copies remain derived output.
794
- - Normalize human labels and link targets only at the CLI parser boundary.
795
- - Existing wide rows, raw paths and snake_case statuses remain supported for
796
- backward compatibility.
797
-
798
- The scaffold is not a second documentation site. Link to authoritative artefacts instead of copying them.
799
-
800
- ## Agent-Native Runtime And CLI Verification
801
-
802
- AGDF is agent-native first and CLI-verifiable by design.
803
-
804
- The primary operating path is the active skill plus the live `.agdf/control/` artefacts.
805
- Agents should read the repository state, apply this Runtime Contract, create or update only the currently allowed artefact, and make the next permissible step explicit.
806
- When control state is missing for a fresh request, keep the first step lightweight: draft the minimal UR in the response and request `Approval: UR`.
807
- Initialize a control scaffold only when durable AGDF control state is explicitly requested, already used by the repository, or required by a deterministic CLI/CI setup path.
808
-
809
- Helper commands are deterministic proof and automation interfaces, not the normal-work ritual:
810
-
811
- - `init` creates the machine-readable control scaffold.
812
- - `doctor --json` checks whether `.agdf/control/` is consistent and actionable; it is not the reviewer.
813
- - `gate-check --json` reports reproducible gate state; it does not replace the gate-check skill judgement.
814
- - `delivery-map --json` reports the delivery picture for CI, PRs, regression checks and audit trails.
815
-
816
- Machine-readable outputs should stay agent-friendly: stable decisions, blocking gate or current gate, missing approval, allowed outputs, forbidden outputs, next step, evidence and findings.
817
- They make the repository state checkable, but they do not replace the native skill workflow or the durable control artefacts.
818
-
819
- ## Delivery Map
820
-
821
- `delivery-map --json` is the machine-readable delivery picture for the selected canonical control state.
822
- It derives, but does not replace, the selected `RUN_STATE.md` and `MASTER_BACKLOG.md` state.
823
-
824
- It must expose:
825
-
826
- - approved or active artefacts and approvals
827
- - `UR -> PRD -> SD -> TP -> QA_REPORT` relationships
828
- - evidence refs, missing evidence and declared risks
829
- - multi-scope ambiguity and branch/workspace evidence limits when present
830
- - memory persistence target, reason and references when present
831
- - Context Graph impact and gate effect
832
- - the Run Status Card as a compact projection of current gate, next step and quality outlook
833
- - findings that explain why the delivery picture is `pass | warn | revise | block`
834
-
835
- Missing relationship evidence in the Artefact Chain is at least `revise` once the related gate artefact is approved or passed.
836
- Declared missing evidence, declared risk or Context Graph gate effect may escalate the delivery map to `warn`, `revise` or `block`.
837
-
838
- ## Skill Output
839
-
840
- Every skill output should be as short as possible and as concrete as needed.
841
- It must distinguish:
842
-
843
- - facts
844
- - evidence
845
- - assumptions
846
- - interpretations
847
- - missing evidence
848
- - the next permissible step
849
-
850
- ## Do Not Duplicate
851
-
852
- The explanatory framework lives in `docs/`.
853
- The operating philosophy lives in `plugin/meta/agdf-constitution.md`.
854
- The principles live in `plugin/meta/agdf-tenets.md`.
855
- This contract is only the compact runtime interface for skills.
7
+ | Gate transitions | `contracts/gate-transition.md` | Source precedence, scope ambiguity, gate rules, Brownfield routing and transition model |
8
+ | Interaction | `contracts/interaction.md` | Run Status Card, approval orientation, native interaction and locale contracts |
9
+ | Modes | `contracts/modes.md` | Mode selection, Quick Task, Verified Change, trivial and bug boundaries |
10
+ | Quality | `contracts/quality.md` | Quality readiness, chat discipline and quality output contracts |
11
+ | Context Graph | `contracts/context-graph.md` | Knowledge persistence and Context Graph reconciliation |
12
+ | Control scaffold | `contracts/control-scaffold.md` | Delivery Path Search, run state, CLI verification and Delivery Map |
13
+ | Closeout | `contracts/closeout.md` | Support bridge, relevant-run boundary and non-duplication |
14
+
15
+ The explanatory framework lives in `docs/`, the operating philosophy in `plugin/meta/agdf-constitution.md`, and the principles in `plugin/meta/agdf-tenets.md`.