create-agdf 0.8.7 → 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 +67 -8
  2. package/generated/.github/skills/agdf-brownfield-analysis/SKILL.md +6 -2
  3. package/generated/.github/skills/agdf-clean-implementation-review/SKILL.md +9 -1
  4. package/generated/.github/skills/agdf-code-review/SKILL.md +9 -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 +12 -5
  8. package/generated/.github/skills/agdf-qa-gate/SKILL.md +12 -2
  9. package/generated/.github/skills/agdf-release-or/SKILL.md +7 -2
  10. package/generated/.github/skills/agdf-runtime-contract.md +11 -812
  11. package/generated/.github/skills/agdf-task-plan-review/SKILL.md +10 -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 -812
  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 +9 -1
  30. package/generated/.opencode/skills/agdf-code-review/SKILL.md +9 -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 +12 -5
  34. package/generated/.opencode/skills/agdf-qa-gate/SKILL.md +12 -2
  35. package/generated/.opencode/skills/agdf-release-or/SKILL.md +7 -2
  36. package/generated/.opencode/skills/agdf-task-plan-review/SKILL.md +10 -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 -812
  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 +9 -1
  51. package/generated/plugins/agdf/skills/code-review/SKILL.md +9 -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 +12 -5
  55. package/generated/plugins/agdf/skills/qa-gate/SKILL.md +12 -2
  56. package/generated/plugins/agdf/skills/release-or/SKILL.md +7 -2
  57. package/generated/plugins/agdf/skills/task-plan-review/SKILL.md +10 -1
  58. package/package.json +1 -1
@@ -0,0 +1,370 @@
1
+ # AGDF Runtime Contract — Interaction
2
+
3
+ ## Run Status Card
4
+
5
+ When a run needs an operational status view, use the Run Status Card as a compact projection of existing control state.
6
+ It must not introduce a second gate model or override `agdf-gate-check`, `delivery-map`, QA, OR, or user approvals.
7
+
8
+ - `mode`: `quick_task | verified_change | structured_delivery | unknown`
9
+ - `run_id`: the exactly selected canonical run
10
+ - `presentation_language`: the resolved complete locale-pack tag; absent, unsupported or incomplete packs resolve to the registry's deterministic `en` fallback
11
+ - `status`: `open | blocked | pass | warn | revise | block | in_progress`
12
+ - `current_gate`: current user gate or internal step
13
+ - `mode_slice_decision`: `undecided | quick_task | verified_change | structured_slice | structured_delivery | block`
14
+ - `allowed_now`: outputs or actions currently permitted
15
+ - `forbidden_now`: outputs or actions currently forbidden
16
+ - `blocking_condition`: current blocker or `none`
17
+ - `missing_approval`: exact missing approval formula or `none`
18
+ - `next_gate_after_approval`: the next user gate or internal step unlocked by the missing approval, or `none`
19
+ - `allowed_after_approval`: concise description of what becomes allowed after the missing approval, or `none`
20
+ - `user_visible_outcome_after_approval`: concise user-facing result of approving the current gate
21
+ - `internal_next_step`: the next agent-controlled process step, or `none`
22
+ - `next_user_gate`: the next actual user approval gate, or `none`
23
+ - `user_action_required`: `yes` only when the user must provide another deliberate approval or decision; otherwise `no`
24
+ - `evidence`: concrete evidence references currently visible
25
+ - `next_skill`: next AGDF skill or `none`
26
+ - `next_step`: the single next permissible process action
27
+ - `quality_outlook`: the next meaningful quality-improvement focus, or `none`
28
+
29
+ `next_step` and `quality_outlook` are intentionally different:
30
+
31
+ - `next_step` is process permission: what may happen next.
32
+ - `quality_outlook` is quality direction: what would most improve confidence, maintainability, evidence, or delivery integrity if further investment is made.
33
+
34
+ `quality_outlook` must not unlock gates, imply QA pass, or substitute for missing evidence.
35
+
36
+ `allowed_now` and `allowed_after_approval` are intentionally different:
37
+
38
+ - `allowed_now` is current authority under the active gate.
39
+ - `allowed_after_approval` is the immediate authority unlocked only after the exact `missing_approval` is supplied.
40
+
41
+ `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.
42
+
43
+
44
+ ### Breadcrumb
45
+
46
+ The compact human Run Status Card may include a single-line path-derived breadcrumb that
47
+ shows the user's position in the delivery journey. It is derived from the Mode/Slice
48
+ Decision and the Approvals table — not a fixed template.
49
+
50
+ | Mode/Slice | Breadcrumb gates |
51
+ |---|---|
52
+ | structured_delivery / structured_slice | `UR · PRD · SD · TP · QA · UAT` |
53
+ | verified_change | `UR · Verified Change · OR` |
54
+ | quick_task | `UR · Quick Task` |
55
+ | block | `UR · Block` |
56
+
57
+ - `✓` fulfilled, `●` current, `○` open.
58
+ - Non-applicable gates are absent (no `–` placeholders, no thinned standard template).
59
+ - `verified_change` is one collapsed node, not a degraded standard route.
60
+ - The breadcrumb is a derived, non-authorising projection. It does not add a new gate
61
+ model or override the Gate Transition Model.
62
+ - The machine-readable `status_card` JSON may carry a derived `breadcrumb` array
63
+ `[{gate, status}]` for the presentation layer; this is additive and does not replace
64
+ any existing field.
65
+
66
+ ### Post-Acceptance Transition Narration
67
+
68
+ After each accepted gate approval, the agent emits exactly one status line using the
69
+ template:
70
+
71
+ ```text
72
+ <what was satisfied> → <what the agent does next internally> → <user action: yes/no>
73
+ ```
74
+
75
+ This narration is temporally and structurally separate from the Gate Transition Card:
76
+
77
+ - The Gate Transition Card is **pre-approval** (in the orientation envelope); it is
78
+ subjunctive and contains the exact `Approval:` value.
79
+ - The narration is **post-acceptance** (after the gate advanced); it is indicative and
80
+ does not contain the `Approval:` value.
81
+ - Both never appear in the same assistant message.
82
+ - The narration does not repeat the decision's effect (the card's job) and uses its own
83
+ template, not the card's three-question form.
84
+ - For internal steps (Brownfield Review, Brownfield Analysis), the narration states what
85
+ the agent does next and that no user action is required, without exposing
86
+ `next_user_gate: none` or asking for a second approval.
87
+
88
+ ### Internal-State Collapse
89
+
90
+ The derived-projection principle above applies explicitly to internal sub-states. The
91
+ full Run Status Card (machine/audit projection) keeps all fields unchanged. Only the
92
+ compact human card collapses internal sub-states to stable human labels:
93
+
94
+ | Internal sub-state | Human label | Stays explicit |
95
+ |---|---|---|
96
+ | `verified_change`: missing/draft/invalid/eligible/executed | "Compact change under review" | `escalated` → "Escalated to structured delivery" |
97
+ | `context_graph_required_action`: link/update/create/resolve_drift | "Project memory maintained" | `open_gap` → "Graph gap open" |
98
+ | `multi_scope_state`: clear/ambiguous | (not shown) | `blocked` → "Ambiguous scope, clarification needed" |
99
+
100
+ `open_gap` and `escalated` remain explicitly visible. The full machine projection retains
101
+ all raw values unchanged.
102
+
103
+
104
+ ## Gate Transition Card
105
+
106
+ Every ready `gate_approval` uses one fixed visible sequence: first the compact
107
+ approval-time Run Status Card, then the Gate Transition Card, then exactly one
108
+ native question or exact-text fallback. Both cards derive from one immutable,
109
+ non-authorizing presentation snapshot produced after canonical selected-run,
110
+ gate and durable-artefact readiness evaluation. The snapshot never selects a
111
+ run, decides a gate, persists state or grants approval.
112
+
113
+ The two distinct card blocks form one Approval Orientation Envelope in one
114
+ immediately preceding assistant message. The agent must complete that message
115
+ before invoking any native question tool or emitting an exact-text approval
116
+ request. Splitting the cards across separate assistant turns or invoking the
117
+ tool after only one card is a failed interaction, not a valid presentation.
118
+
119
+ The first visible line of that envelope is the localized action-oriented title
120
+ of the current user gate, rendered as a level-two Markdown heading or equivalent
121
+ accessible host heading inside the compact approval-time Run Status Card.
122
+ `AGDF Status`, `Run Status Card`, `Gate Transition Card`, raw gate identifiers
123
+ and machine values are semantic or diagnostic labels only and must not become
124
+ the primary heading. The action title appears exactly once and does not replace,
125
+ merge or reorder either required card block.
126
+
127
+ The compact approval-time Run Status Card contains exactly six operational
128
+ fields: selected run, readiness status, current gate, missing exact approval,
129
+ one next action and quality outlook. It uses localized human-readable labels
130
+ and must not contain evidence, diagnostic codes, raw control-state keys,
131
+ allowed/forbidden inventories or machine values. The complete Run Status Card remains the operational,
132
+ CLI and audit projection and remains available for complete detail outside the
133
+ approval-time compact view.
134
+
135
+ The Gate Transition Card is the second orientation message. It is derived from
136
+ the same snapshot and canonical post-approval transition, but it is not another
137
+ state model, persisted record, renderer or approval authority. It turns only
138
+ the decision-relevant subset into concise product copy immediately before the
139
+ host-native question or exact-text fallback.
140
+
141
+ The card answers exactly three user questions, in this order:
142
+
143
+ 1. **Where am I?** A localized human-readable gate title, deterministic human
144
+ run title, selected `run_id` as secondary context, compact `UR · PRD · SD · TP`
145
+ artefact links and a clear ready-for-decision state.
146
+ 2. **What does this decision do?** The exact `Approval: <GateName>` value, its
147
+ concrete next outcome and the most important boundary that remains.
148
+ 3. **What happens next?** The immediate agent-controlled action and the next
149
+ actual user decision when one exists; otherwise a plain statement that no
150
+ further user action is required now.
151
+
152
+ Use this compact composition:
153
+
154
+ ```text
155
+ <localized gate title> · <human run title> · <run_id>
156
+ <UR link or localized missing text> · <PRD link or localized missing text> · <SD link or localized missing text> · <TP link or localized missing text>
157
+ <localized ready-for-decision line>
158
+
159
+ <localized approve heading>
160
+ `Approval: <GateName>` <localized concrete effect>. <localized remaining boundary>.
161
+
162
+ <localized next heading>
163
+ <localized immediate agent action>. <localized next user decision or no-action statement>.
164
+ ```
165
+
166
+ Resolve all AGDF-owned explanatory text through the canonical Interaction
167
+ Locale Registry. `en` and `de` are initial reviewed packs, not a closed locale
168
+ list. English is the deterministic fallback for absent, unsupported or
169
+ incomplete packs. Gate identifiers, `run_id`, canonical paths and exact
170
+ approval values are never translated. The visible gate title is localized;
171
+ for example, the German title may be `Lösungsdesign` while the authorization
172
+ value remains `Approval: SD`. Meaning, ordering and authority boundaries are
173
+ identical across locale packs.
174
+
175
+ The Gate Transition Card must not be a Markdown table or dashboard. It must not
176
+ present raw control-state keys, machine status values, diagnostic codes,
177
+ evidence lists, allowed/forbidden inventories or implementation detail that is
178
+ not needed for the decision. It must not repeat the native question. The card
179
+ normally fits in one title, one readiness line and two short content blocks.
180
+ Run and gate identity may appear in both cards to anchor the shared snapshot;
181
+ status rows, action inventories and transition prose must not be duplicated.
182
+
183
+ For `Approval: TP`, the effect is permission to run pre-implementation
184
+ Brownfield Analysis, implementation remains gated until that analysis passes,
185
+ and the next block states plainly that no further user decision is required
186
+ now. Brownfield Analysis must not be presented as a user gate.
187
+
188
+
189
+ ## Native Interaction Contract
190
+
191
+ Native host controls improve how a decision is presented; they do not create a second approval model or authority source.
192
+
193
+ Every AGDF interaction belongs to exactly one semantic kind:
194
+
195
+ - `clarification`: asks for missing intent or a choice that does not itself authorize a gated transition.
196
+ - `tool_permission`: requests host-owned authority for a command, file change, network access, external path, app action or comparable technical side effect.
197
+ - `gate_approval`: requests deliberate user input for the one current AGDF user gate after its durable artefact and selected run are ready.
198
+ - `blocked`: explains a blocker and the one permissible recovery action without offering approval controls.
199
+ - `status`: reports current state without asking for a decision.
200
+
201
+ The semantic interaction envelope is:
202
+
203
+ ```text
204
+ interaction_kind: clarification | tool_permission | gate_approval | blocked | status
205
+ surface: codex | claude | opencode | fallback
206
+ run_id: required for gate_approval
207
+ current_gate: required for gate_approval
208
+ native_attempt_required: true only after ready-gate and adapter-capability preflight prove exact value transport and safe deliberate waiting
209
+ prompt: required
210
+ options: required for a structured question
211
+ effects: required when the interaction can cause side effects
212
+ required_evidence: required for gate_approval
213
+ auto_resolution: forbidden for gate_approval
214
+ response_origin: deliberate_user_input for gate_approval
215
+ ```
216
+
217
+ This envelope is not a new persisted record. The selected canonical `RUN_STATE.md` and existing artefact chain remain the durable authority.
218
+
219
+ Before presenting `gate_approval` for any user gate (`UR`, `PRD`, `SD`, `TP`,
220
+ `QA`, or `UAT`), the agent must emit the compact localized Run Status Card and
221
+ the localized Gate Transition Card as two distinct blocks in that order within
222
+ one immediately preceding assistant message. Neither card is optional, hidden
223
+ in the question text or replaced by a host button label. Do not invoke the
224
+ native question tool until the complete two-card envelope is visible. Native
225
+ buttons or exact-text fallback may appear only after both cards. Render the two
226
+ cards once per eligible attempt; an unavailable or not-applied native control
227
+ proceeds to exact text without repeating them.
228
+
229
+ Before presenting `gate_approval`, the agent must:
230
+
231
+ 1. resolve exactly one selected run;
232
+ 2. run the canonical gate evaluation and confirm that the current gate's durable artefact is present and ready;
233
+ 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;
234
+ 4. wait for deliberate user input without a timeout, default, preselection, hook-supplied answer or agent-to-agent substitute;
235
+ 5. re-run canonical gate evaluation against the same `run_id` and expected gate immediately before persistence;
236
+ 6. reject missing evidence, ambiguous or wrong run, wrong gate, stale state and any response that is no longer valid;
237
+ 7. persist an accepted approval only through the existing control-state workflow.
238
+
239
+ For a ready `gate_approval`, interaction kind and native capability are separate. Evaluate callability,
240
+ deliberate wait safety and canonical approval-value transport before invocation. `native_attempt_required`
241
+ is true only when current evidence proves `exact_option_value` or `separate_label_and_value` transport
242
+ with safe deliberate waiting. Decorated-only, missing, conflicting or unknown capability fails closed to
243
+ `unavailable_before_invocation`; unsafe waiting fails closed to `unsafe_to_wait`. Both expose false and use
244
+ exact text without invoking the adapter. A report-only CLI evaluation has no verified current host adapter
245
+ and therefore exposes false. Hooks may prepare context but must not answer, approve or replace an eligible attempt.
246
+ An adapter that requires a visible suffix such as `(Recommended)` on its approving option is
247
+ `decorated_label_only`: do not invoke it for an AGDF gate. `Approval: <GateName> (Recommended)` is never a
248
+ valid AGDF approval option or authorization value; use the undecorated exact-text fallback instead.
249
+
250
+ The first eligible native-attempt has a single bounded outcome: the declared
251
+ host control is presented, or the agent immediately uses the exact-text
252
+ fallback. A host that does not apply the control does not trigger a second
253
+ native prompt. AGDF must not simulate or force host-owned presentation.
254
+
255
+ An eligible interaction must make its presentation outcome visible and
256
+ distinguishable: `presented`, `unavailable_before_invocation`,
257
+ `attempted_not_applied`, or `unsafe_to_wait`. This is transient presentation
258
+ evidence only, never a persisted approval, selected-run authority or substitute
259
+ for post-response revalidation. A textual fallback names the outcome, gives the
260
+ exact approval value and confirms that authority is unchanged. A fresh explicit
261
+ user request may reopen the unchanged decision after revalidation; it is not an
262
+ automatic retry.
263
+
264
+ 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.
265
+
266
+ Surface adapter rules:
267
+
268
+ | Surface | Native question adapter | Gate-safe use | Technical permission boundary |
269
+ |---|---|---|---|
270
+ | Codex | native `request_user_input` or equivalent short-question control when callable | invoke on the first eligible attempt when preflight proves `exact_option_value`; if unavailable or not applied, use exact text without retry | Codex command, edit, network, external-directory and app-action approvals remain host-owned `tool_permission`. |
271
+ | 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. |
272
+ | 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. |
273
+ | 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. |
274
+
275
+ 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.
276
+
277
+ 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.
278
+
279
+ ### Interaction Locale Contract
280
+
281
+ User-facing native questions, option descriptions, primary chat cards, exact-text
282
+ fallback and human CLI output use the configured project chat language from
283
+ `.agdf/control/config.json` and the canonical registry
284
+ `agdf-interaction-locales.json`:
285
+
286
+ - resolve an exact complete pack, then its language subtag, then deterministic English fallback;
287
+ - `en` and `de` are the initial complete packs; additional reviewed complete packs are supported without changing runtime logic;
288
+ - an incomplete pack is unsupported and must fail to English as a unit;
289
+ - one interaction must not mix presentation languages, including labels and descriptions;
290
+ - durable artefacts, runtime rules, task identifiers and machine-facing approval values remain English;
291
+ - the exact approval value remains `Approval: <GateName>` in every locale;
292
+ - localized `revise`, `decline` and `cancel` labels are presentation text only and never carry gate authority;
293
+ - host-owned chrome follows the host's own UI language and must not be presented as AGDF-translated chat copy.
294
+
295
+ 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.
296
+
297
+ ### Gate-Rationale-Registry
298
+
299
+ The locale registry contains a deterministic, localized `gateRationale` section with one
300
+ curated one-liner per gate and internal step. The agent retrieves rationale strings via
301
+ the `gateRationale()` function; it does not generate rationale prose. Rationale strings
302
+ are the same across invocations for the same gate and locale.
303
+
304
+ The registry covers all user gates (`UR`, `PRD`, `SD`, `TP`, `QA`, `UAT`) and all internal
305
+ steps (`Brownfield Review`, `Mode/Slice Decision`, `Brownfield Analysis`, `CD+Tests`, `CR`,
306
+ `OR`). Each string stays within the declared `lengthBudgets.description` budget. Key parity
307
+ across locale packs is enforced by the existing `validateLocaleRegistry` baseline
308
+ comparison.
309
+
310
+ A one-liner cannot explain the full protective function. The user needs enough to accept
311
+ that the gate makes sense, not the complete rationale. Deeper context is available on
312
+ demand through the "Why?" interaction.
313
+
314
+ ### On-Demand "Why?" Interaction
315
+
316
+ When the user asks "why?" at any gate or internal step, the agent responds with a `status`
317
+ interaction containing the curated rationale (Gate-Rationale-Registry) plus one line of
318
+ fulfilled/protects context composed from existing state.
319
+
320
+ - The response is deterministic, non-authorizing, and does not display approval controls.
321
+ - It is a separate `status` interaction, never merged with the `gate_approval` sequence.
322
+ - The `gate_approval` options remain exactly `approve | revise | decline | cancel`; no
323
+ "why" option is added.
324
+ - The response never breaks `APPROVAL_SEQUENCE` or `validateApprovalOrientationSnapshot`.
325
+ - Default output is unchanged when the user does not ask.
326
+ - The fulfilled line is composed from the selected run's Approvals table and artefact
327
+ status; the protects-against line is composed from the gate's rationale and existing
328
+ `primary.actions` copy. The agent does not generate new prose.
329
+
330
+ ### Human Decision Presentation Contract
331
+
332
+ The primary user surface is a pure projection of the selected canonical run.
333
+ It must never become a second evaluator, state store, renderer authority or
334
+ approval path. Native controls, exact-text fallback and human CLI output use
335
+ the same semantic payload and outcome ordering; machine JSON retains its
336
+ stable field names and diagnostic values.
337
+
338
+ For every primary chat card:
339
+
340
+ 1. Resolve a human run title deterministically from the current artefact
341
+ heading, approved UR heading, first non-empty Objective line, then normalized
342
+ `run_id`.
343
+ 2. Show `UR · PRD · SD · TP` in that stable order. Existing selected-run
344
+ artefacts are links with readable labels; missing artefacts use localized
345
+ non-link text. Never guess a path or emit a broken link.
346
+ 3. Use a localized visible gate title while preserving the exact gate identifier
347
+ and `Approval: <GateName>` authorization value.
348
+ 4. Keep primary copy decision-oriented. Raw keys such as `next_user_gate`,
349
+ `mode_slice_decision` and `required_next_gate`, diagnostic codes and machine
350
+ status values belong to JSON or audit detail, not the primary interaction.
351
+
352
+ For a ready approval, explicit options are ordered `approve`, `revise`,
353
+ `decline`; an explicit `cancel` follows only on surfaces that support it, while
354
+ host dismissal maps to `cancel` on three-choice surfaces. Do not preselect,
355
+ auto-submit, recommend as authorization, skip or reorder an option. Labels and
356
+ descriptions use the same resolved locale and must have distinct, non-empty
357
+ accessible names. Translation length budgets must preserve meaning without
358
+ truncation being the only distinction.
359
+
360
+ Normalize outcomes as distinct values:
361
+
362
+ ```text
363
+ approve | revise | decline | cancel | no_response | timeout | empty | invalid | stale
364
+ ```
365
+
366
+ Missing input, timeout, cancellation and empty input are not decline. Only
367
+ `approve` backed by the exact revalidated `Approval: <GateName>` value may
368
+ advance a gate. Clarification, blocked, internal-step and status-only
369
+ interactions must not display gate-approval controls.
370
+
@@ -0,0 +1,91 @@
1
+ # AGDF Runtime Contract — Modes
2
+
3
+ ## Mode Selection
4
+
5
+ | Mode | Default | Escalate When |
6
+ |---|---|---|
7
+ | 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 |
8
+ | Structured Delivery Mode | formal delivery runs, gate-relevant work, release-critical changes | always use gate discipline, internal reviews, and OR |
9
+
10
+ Quick Task Mode must not become ritual gate overhead.
11
+ Structured Delivery must not bypass missing approvals.
12
+ 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.
13
+ UR, PRD, SD, TP and QA report approvals require durable artefacts or linked authoritative repository SoT entries before the next gate can open.
14
+
15
+ ## Quick Task Output
16
+
17
+ Quick Tasks are intentionally lightweight, but they must not become invisible.
18
+ Use this compact output shape when no formal gate artefact is required:
19
+
20
+ - `result`: what changed or was concluded
21
+ - `evidence`: files, commands, observations, or reasoning that support the result
22
+ - `risk`: remaining risk or `none`
23
+ - `next_step`: the single next useful action or `none`
24
+
25
+ Do not add a separate `Quality outlook` line for pure Quick Tasks unless the task became a relevant run.
26
+
27
+ ### Verified Change
28
+
29
+ `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.
30
+
31
+ 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:
32
+
33
+ 1. exactly one repository-relative canonical owner and bounded source/derived paths;
34
+ 2. no gate, permission, security, persistence, architecture, external API, CLI or release behavior impact;
35
+ 3. deterministic propagation when derived paths exist, plus at least one deterministic validation command;
36
+ 4. a full baseline commit plus tracked and untracked worktree baseline paths captured before eligibility, with no candidate path already dirty; and
37
+ 5. an explicit `structured_slice` or `structured_delivery` escalation target.
38
+
39
+ 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.
40
+
41
+ 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.
42
+
43
+ ### Non-Normative Trivial Change Boundary
44
+
45
+ A `quick_task` whose entire diff stays fully outside all of the following paths may close using only
46
+ the compact output shape above, and must not create, rewrite or expand any selected canonical
47
+ `RUN_STATE.md` core
48
+ sections (Run Meta, Objective, Current Control State, Source And Scope State, Run Status Card,
49
+ Approvals, Artefacts, Mode/Slice Decision, Artefact Chain, Evidence, Missing Evidence, Risks, Context
50
+ Graph Impact, Knowledge Persistence Decision, Closeout):
51
+
52
+ - `plugin/skills/**`
53
+ - `plugin/control/templates/**`
54
+ - `plugin/meta/**`
55
+ - `create-agdf/lib/**`
56
+ - `create-agdf/bin/**`
57
+ - any other executable code file, in any language, anywhere in the repository
58
+
59
+ A `MASTER_BACKLOG.md` entry is required only when the change is otherwise a "Relevant Run" below. A
60
+ change that is not clearly and fully outside every listed path fails closed to the existing, unchanged
61
+ ceremony — ambiguity is never read as permission for the lighter path.
62
+
63
+ #### Narrow Code-Fix Criterion
64
+
65
+ A change that touches one of the otherwise-excluded code paths above may still close with only the
66
+ compact Quick Task Output shape — Code Review remains mandatory regardless — when **all** of the
67
+ following hold. Any single condition failing, or any ambiguity about whether a condition holds, keeps
68
+ the full existing ceremony unchanged:
69
+
70
+ 1. The diff is confined to a single function, or a function together with its direct,
71
+ necessarily-coupled caller, in exactly one file.
72
+ 2. A new or updated automated regression test exercises the fixed behavior and passes.
73
+ 3. No PRD, SD, TP, gate name, exact approval formula, or documented CLI flag/output-schema field is
74
+ added, removed, or changed — only internal correctness of already-approved behavior.
75
+ 4. `doctor` (or the locally available equivalent) and the directly affected existing test suite both
76
+ pass unchanged in shape after the fix, with no assertion skipped or weakened beyond what the fix
77
+ itself introduces.
78
+
79
+
80
+ ## Bug Lightweight Track
81
+
82
+ 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:
83
+
84
+ - the defect is tied to a concrete symptom or ticket
85
+ - the expected behavior is clear enough to test
86
+ - no new product semantics, architecture, policy, persistence or cross-owner decision is introduced
87
+ - a durable bug artefact or linked authoritative issue records reproduction, actual behavior, expected behavior, fix boundary, open questions and evidence plan
88
+
89
+ The Bug Lightweight Track does not remove QA, OR, evidence, Brownfield fit or exact approvals required by the target repository.
90
+ If the bug grows beyond the stated boundary, escalate to normal AGDF gate flow.
91
+
@@ -0,0 +1,100 @@
1
+ # AGDF Runtime Contract — Quality
2
+
3
+ ## Quality Readiness Projection
4
+
5
+ After CD+Tests, when any of the four review/QA artefacts exists, surfaces may show one compact
6
+ derived `Quality Readiness` projection. It answers the user-facing question "what is the current
7
+ quality outcome and what should happen next?" without replacing evidence or creating another
8
+ decision authority.
9
+
10
+ - It contains exactly four rows, in this order: `Plan coverage` from `agdf-task-plan-review`,
11
+ `Solution integrity` from `agdf-clean-implementation-review`, `Code quality` from `agdf-code-review`,
12
+ and `QA decision` from `agdf-qa-gate`.
13
+ - `agdf-qa-gate` is always labeled as the sole decision owner. The other three rows are evidence
14
+ dimensions, not competing pass/revise/block decisions.
15
+ - Overall status reuses canonical severity ordering. Missing or conflicting required evidence
16
+ must not render `pass`; surface `revise` or `block` with the decisive reason and one permitted
17
+ next action instead.
18
+ - The projection is derived, non-persistent and non-authorizing. It cannot accept an approval,
19
+ advance a gate, suppress a report or replace the Run Status Card, Gate Transition Card, JSON
20
+ projection or durable review artefacts.
21
+ - Show compact rows on `pass`. On `revise` or `block`, expand only the decisive row with its
22
+ canonical report reference; do not paste complete reports into chat.
23
+
24
+
25
+ ## Chat Output Discipline
26
+
27
+ Durable artefacts are for the repository, not for flooding the chat.
28
+ When a skill creates or updates `.agdf/control/` files, gate artefacts, reviews, QA reports or OR reports, the chat response must stay compact:
29
+
30
+ - name the artefact path and status
31
+ - summarize the decision or content in a few lines
32
+ - state the current gate, forbidden work and next permissible step
33
+ - mention validation evidence when available
34
+
35
+ 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.
36
+ For larger or more formal work, create or update the durable artefacts fully, then reference them by path and summarize what changed.
37
+
38
+ ### Chat and Tool-Call Discipline
39
+
40
+ Chat output shows decisions and outcomes. Files show evidence and detail. The agent
41
+ minimises both the number of tool calls and the amount of accompanying chat text. This
42
+ is surface-agnostic: it changes agent behaviour and framework text, not host rendering.
43
+ Whether a host renders a tool-call block visibly is a host concern; the framework ensures
44
+ the agent makes fewer calls and produces less text around them.
45
+
46
+ Skill output compaction:
47
+
48
+ - QA, Code Review, TP Review and Clean Implementation Review output is 1 line at `pass`:
49
+ `<skill>: pass — <one-line summary>`.
50
+ - At `revise`/`block`: the decisive dimension, reason and next action. The Quality
51
+ Readiness projection is shown only at `revise`/`block`, not at `pass`.
52
+ - Full reports remain in durable files; the chat references the path.
53
+
54
+ Tool-call batching:
55
+
56
+ - `RUN_STATE.md` is written once per user gate approval, not once per field change. The
57
+ agent keeps intermediate state in memory between gate approvals and writes the complete
58
+ updated state in one operation.
59
+ - The agent does not `read` existing artefacts for format reference. Skill instructions
60
+ carry the format/structure inline. If a specific existing artefact must be inspected
61
+ for content (not format), the read has no accompanying commentary.
62
+ - Artefact writes are silent: the agent names the path and a 1-line summary only when an
63
+ artefact is first created or significantly changed — not on every state update.
64
+ - Validation commands (tests, integrity, diff) show pass/fail only. Full output appears
65
+ only on failure.
66
+
67
+ Always visible:
68
+
69
+ - Gate decisions (Run Status Card, Gate Transition Card, approval question).
70
+ - Post-acceptance narration (1 line per gate transition).
71
+ - Delivery summary (UAT/OR compact summary).
72
+ - Errors, blockers and evidence at `revise`/`block`.
73
+
74
+
75
+ ## Quality Contract Output
76
+
77
+ Structured Delivery skills use this shape when relevant:
78
+
79
+ - `decision`: `pass | revise | block | not_applicable`
80
+ - `evidence`: concrete artefacts, files, tests, logs, diffs, or observations
81
+ - `missing_evidence`: missing proof needed for a stronger claim
82
+ - `risks`: remaining risks, assumptions, fallbacks, drift, or blockers
83
+ - `required_next_step`: exactly the next clean step
84
+ - `impact_codes`: affected Quality Contract codes, if the target repo has a registry
85
+
86
+ A skill may briefly remind this shape, but must not duplicate a complete code or rule matrix.
87
+
88
+
89
+ ## Skill Output
90
+
91
+ Every skill output should be as short as possible and as concrete as needed.
92
+ It must distinguish:
93
+
94
+ - facts
95
+ - evidence
96
+ - assumptions
97
+ - interpretations
98
+ - missing evidence
99
+ - the next permissible step
100
+
@@ -19,7 +19,11 @@ The skill answers:
19
19
  - whether Context Graph impact exists without automatically creating a node
20
20
 
21
21
  ## Runtime Contract
22
- Use `../../agdf-runtime-contract.md` for Quality Contract output, Context Graph fields, gate terms, and non-duplication rules.
22
+ Use these focused runtime-contract modules:
23
+
24
+ - `../../contracts/gate-transition.md`
25
+ - `../../contracts/context-graph.md`
26
+ - `../../contracts/quality.md`
23
27
 
24
28
  Brownfield-specific output must make evidence, missing existing-system view, parallel-structure risk, reuse strategy, and the minimal next step visible.
25
29
  When `.agdf/control/` is present, persist or link `post_ur_review` output under `.agdf/control/artefacts/<key>/BROWNFIELD_REVIEW.md`.
@@ -96,7 +100,7 @@ When used as Brownfield Review after `Approval: UR`, do not recommend PRD, SD, T
96
100
  7. Check SoT/runtime/product-semantics drift.
97
101
  8. Check primary visible ownership for UI/status/recovery paths.
98
102
  9. Check UI monolith risk for large surfaces or central hooks.
99
- 10. Check Context Graph impact according to `../../agdf-runtime-contract.md`.
103
+ 10. Check Context Graph impact according to `../../contracts/context-graph.md`.
100
104
  11. Recommend the minimal clean implementation path.
101
105
 
102
106
  ## Output
@@ -18,7 +18,10 @@ This skill answers:
18
18
  - is it maintainable or workaround-heavy
19
19
 
20
20
  ## Runtime Contract
21
- Use `../../agdf-runtime-contract.md` for Quality Contract output, Context Graph fields, gate terms, and non-duplication rules.
21
+ Use these focused runtime-contract modules:
22
+
23
+ - `../../contracts/quality.md`
24
+ - `../../contracts/context-graph.md`
22
25
 
23
26
  Clean-review-specific output must make the primary solution, fallbacks, workarounds, parallel structures, exit criteria, and next cleanup/review step visible.
24
27
 
@@ -91,6 +94,11 @@ Use this compact structure:
91
94
  - `revise`: solution works but contains avoidable fallback, unclear ownership, or missing evidence.
92
95
  - `block`: solution creates a second SoT, a second owner, unbounded fallback, or masks unresolved product semantics.
93
96
 
97
+ ### Compact Chat Output
98
+
99
+ At `pass`: one line — `Clean Review: pass — <one-line summary>`.
100
+ At `revise`/`block`: show the specific fallback/workaround/parallel-structure risk with file references.
101
+
94
102
  ## Forbidden
95
103
  This skill must not:
96
104
 
@@ -17,7 +17,10 @@ It answers:
17
17
  - whether Brownfield, TP, or clean-review follow-up remains open
18
18
 
19
19
  ## Runtime Contract
20
- Use `../../agdf-runtime-contract.md` for Quality Contract output, Context Graph fields, gate terms, and non-duplication rules.
20
+ Use these focused runtime-contract modules:
21
+
22
+ - `../../contracts/quality.md`
23
+ - `../../contracts/context-graph.md`
21
24
 
22
25
  Code-review-specific output must make actual findings, missing review scope, evidence strength, and the next required step visible.
23
26
 
@@ -84,6 +87,11 @@ Use this compact structure:
84
87
  - `block`: a hard defect, security risk, data-integrity risk, or unresolved critical uncertainty remains.
85
88
  - `not_applicable`: no code changes were present for review.
86
89
 
90
+ ### Compact Chat Output
91
+
92
+ At `pass`: one line — `Code Review: pass — <one-line summary>`.
93
+ At `revise`/`block`: show blocking findings with file references. Full report remains in durable file or inline evidence as specified.
94
+
87
95
  ## Forbidden
88
96
  This skill must not:
89
97
 
@@ -20,7 +20,11 @@ It answers:
20
20
  This skill does not replace `agdf-qa-gate`, `agdf-release-or`, user approvals, or gate decisions.
21
21
 
22
22
  ## Runtime Contract
23
- Use `../../agdf-runtime-contract.md` for closeout discipline, gate terms, Context Graph fields, and non-duplication rules.
23
+ Use these focused runtime-contract modules:
24
+
25
+ - `../../contracts/closeout.md`
26
+ - `../../contracts/context-graph.md`
27
+ - `../../contracts/gate-transition.md`
24
28
 
25
29
  ## Rules
26
30
  1. Delivery follows gate clarity.