create-agdf 0.11.4 → 0.12.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 (56) hide show
  1. package/README.md +1 -1
  2. package/generated/.agdf/control/templates/artefacts/BROWNFIELD_REVIEW.md +25 -0
  3. package/generated/.github/skills/agdf-brownfield-analysis/SKILL.md +26 -0
  4. package/generated/.github/skills/agdf-gate-check/SKILL.md +40 -18
  5. package/generated/.github/skills/agdf-interaction-locales.json +50 -0
  6. package/generated/.github/skills/agdf-runtime-contract.md +1 -0
  7. package/generated/.github/skills/contracts/gate-transition.md +7 -3
  8. package/generated/.github/skills/contracts/interaction.md +22 -0
  9. package/generated/.github/skills/contracts/modes.md +81 -0
  10. package/generated/.github/skills/contracts/task-target-resolution.md +102 -0
  11. package/generated/.opencode/AGDF.md +2 -0
  12. package/generated/.opencode/agdf-interaction-locales.json +50 -0
  13. package/generated/.opencode/agdf-runtime-contract.md +1 -0
  14. package/generated/.opencode/contracts/gate-transition.md +7 -3
  15. package/generated/.opencode/contracts/interaction.md +22 -0
  16. package/generated/.opencode/contracts/modes.md +81 -0
  17. package/generated/.opencode/contracts/task-target-resolution.md +102 -0
  18. package/generated/.opencode/skills/agdf-brownfield-analysis/SKILL.md +26 -0
  19. package/generated/.opencode/skills/agdf-gate-check/SKILL.md +40 -18
  20. package/generated/AGENTS.md +1 -0
  21. package/generated/plugins/agdf/.claude-plugin/plugin.json +1 -1
  22. package/generated/plugins/agdf/.codex-plugin/plugin.json +1 -1
  23. package/generated/plugins/agdf/control/templates/artefacts/BROWNFIELD_REVIEW.md +25 -0
  24. package/generated/plugins/agdf/meta/agdf-agent-router.md +16 -0
  25. package/generated/plugins/agdf/meta/agdf-interaction-locales.json +50 -0
  26. package/generated/plugins/agdf/meta/agdf-plugin.definition.json +1 -1
  27. package/generated/plugins/agdf/meta/agdf-runtime-contract.md +1 -0
  28. package/generated/plugins/agdf/meta/contracts/gate-transition.md +7 -3
  29. package/generated/plugins/agdf/meta/contracts/interaction.md +22 -0
  30. package/generated/plugins/agdf/meta/contracts/modes.md +81 -0
  31. package/generated/plugins/agdf/meta/contracts/task-target-resolution.md +102 -0
  32. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-interaction-locales.json +50 -0
  33. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-plugin.definition.json +1 -1
  34. package/generated/plugins/agdf/runtime/create-agdf/lib/control-evaluation/gate-policy.js +14 -7
  35. package/generated/plugins/agdf/runtime/create-agdf/lib/interaction-presentation.js +85 -0
  36. package/generated/plugins/agdf/runtime/create-agdf/package.json +5 -2
  37. package/generated/plugins/agdf/runtime/runtime-manifest.json +2 -2
  38. package/generated/plugins/agdf/scripts/check-runtime-integrity.mjs +119 -3
  39. package/generated/plugins/agdf/skills/brownfield-analysis/SKILL.md +26 -0
  40. package/generated/plugins/agdf/skills/gate-check/SKILL.md +40 -18
  41. package/lib/cli/application.js +13 -2
  42. package/lib/control-evaluation/gate-policy.js +14 -7
  43. package/lib/installers/opencode.js +128 -1
  44. package/lib/interaction-presentation.js +85 -0
  45. package/lib/live-agent/read-only-structured.js +43 -0
  46. package/lib/proportionality-benchmark/blind-prompt.js +37 -0
  47. package/lib/proportionality-benchmark/contracts.js +120 -0
  48. package/lib/proportionality-benchmark/corpus-loader.js +110 -0
  49. package/lib/proportionality-benchmark/evaluator.js +250 -0
  50. package/lib/proportionality-benchmark/index.js +7 -0
  51. package/lib/proportionality-benchmark/live-recorder.js +100 -0
  52. package/lib/proportionality-benchmark/report.js +51 -0
  53. package/lib/proportionality-benchmark/source-fingerprint.js +30 -0
  54. package/lib/skill-evals/live-recorder.js +3 -26
  55. package/opencode-plugin.js +40 -1
  56. package/package.json +5 -2
package/README.md CHANGED
@@ -149,7 +149,7 @@ Then verify the visible installation state:
149
149
  npx --yes @agdf/cli@latest opencode-status --json
150
150
  ```
151
151
 
152
- The status command reports global configuration, package loadability, global native-skill completeness, installed host/plugin-SDK version divergence, declaration-level support for both experimental hooks, durable repository activation, legacy local-surface compatibility and session signals. SDK declarations are not proof that a live host invoked a hook, and host/SDK divergence is warning-only rather than auto-aligned. The command does not infer an active OpenCode session from config alone.
152
+ The status command reports global configuration, package loadability, global native-skill completeness, installed host/plugin-SDK version divergence, declaration-level support for both experimental hooks, durable repository activation, legacy local-surface compatibility and session signals. SDK declarations are not proof that a live host invoked a hook. Status is read-only and keeps divergence warning-only; the explicit `opencode` install command attempts to align the SDK only to the exact detected host version and returns a partial result when alignment is unavailable, fails or cannot be verified. The command does not infer an active OpenCode session from config alone.
153
153
  In JSON schema version 1, `repository_surface.gate_check_agent` remains a deprecated compatibility alias for the native `gate_check_skill` path so existing status consumers keep working during the agent-to-skill migration.
154
154
 
155
155
  Use the `opencode-repo` target when a repository should opt into the globally installed AGDF OpenCode runtime:
@@ -55,6 +55,31 @@ Brownfield cites repository evidence.
55
55
  - evidence:
56
56
  - transparency_note:
57
57
 
58
+ ## Structured Depth Evidence
59
+
60
+ - depth_policy_version: `1`
61
+ - depth_facts_status: `complete | missing | conflicting | not_applicable`
62
+ - primary_reason_code:
63
+ - decisive_full_depth_triggers:
64
+ - rejected_alternative:
65
+ - missing_or_conflicting_facts:
66
+ - depth_evidence_refs:
67
+
68
+ Use `not_applicable` only when an unchanged Quick/Compact or Verified Change path is selected before
69
+ Structured Depth. A positive structured decision requires complete facts. Missing or conflicting
70
+ decisive facts without an already-evidenced full-depth trigger persist `decision: block` and name
71
+ the evidence owner and precise Brownfield/Mode-Slice re-evaluation action.
72
+
73
+ | check_id | result | evidence |
74
+ |---|---|---|
75
+ | coherent_outcome | `pass | fail | unknown | not_applicable` | |
76
+ | authority_boundary | `pass | fail | unknown | not_applicable` | |
77
+ | owner_consumer_coordination | `pass | fail | unknown | not_applicable` | |
78
+ | full_depth_impacts_absent | `pass | fail | unknown | not_applicable` | |
79
+ | migration_propagation_bounded | `pass | fail | unknown | not_applicable` | |
80
+ | failure_recovery_local | `pass | fail | unknown | not_applicable` | |
81
+ | independently_acceptable | `pass | fail | unknown | not_applicable` | |
82
+
58
83
  ## PRD / SD Open Questions
59
84
 
60
85
  | Question | Required gate | Impact |
@@ -22,6 +22,7 @@ The skill answers:
22
22
  Use these focused runtime-contract modules:
23
23
 
24
24
  - `../contracts/gate-transition.md`
25
+ - `../contracts/modes.md`
25
26
  - `../contracts/context-graph.md`
26
27
  - `../contracts/quality.md`
27
28
 
@@ -54,6 +55,19 @@ not applicable; Brownfield records cite repository evidence. Do not create a sec
54
55
  11. Large UI surfaces and state hooks must be checked for mixed render, view-model, derived state, orchestration, persistence, and recovery ownership.
55
56
  12. Context Graph impact must be curated; it is not a review log or version index.
56
57
  13. Specification archive migrations must follow the archive index if present.
58
+ 14. In `post_ur_review`, evaluate unchanged compact paths first. For a structured candidate, apply
59
+ only the `Structured Depth Decision` in `modes.md`; do not recreate its trigger/check matrix in
60
+ this skill.
61
+ 15. A positive structured decision requires `depth_policy_version: 1`,
62
+ `depth_facts_status: complete`, complete evidence for all seven bounded-slice checks, a primary
63
+ reason code, rejected alternative and evidence references. A decisive full-depth trigger may
64
+ support `structured_delivery`; `structured_slice` requires every bounded-slice check to pass.
65
+ 16. Missing or conflicting decisive facts without an already-evidenced full-depth trigger persist
66
+ the existing `block` decision with `depth_facts_missing | depth_facts_conflicting`, named facts,
67
+ their evidence owner where known, a Brownfield Review link and a precise next action for evidence
68
+ completion and Brownfield/Mode-Slice re-evaluation.
69
+ 17. Owner, file, consumer, task or derived-path counts must never select a structured depth by
70
+ themselves.
57
71
 
58
72
  ## When To Use
59
73
  - after `agdf-gate-check` permits `Brownfield Review` or the selected canonical run record names Brownfield Review as the next allowed action
@@ -107,6 +121,11 @@ When used as Brownfield Review after `Approval: UR`, do not recommend PRD, SD, T
107
121
  9. Check UI monolith risk for large surfaces or central hooks.
108
122
  10. Check Context Graph impact according to `../contracts/context-graph.md`.
109
123
  11. Recommend the minimal clean implementation path.
124
+ 12. In `post_ur_review`, record `depth_policy_version`, `depth_facts_status`,
125
+ `primary_reason_code`, `decisive_full_depth_triggers`, `rejected_alternative`,
126
+ `missing_or_conflicting_facts`, `depth_evidence_refs` and evidence for all seven bounded-slice
127
+ check IDs in the Brownfield Review. Then persist the completed review and the existing
128
+ Mode/Slice Decision atomically.
110
129
 
111
130
  ## Output
112
131
  Use a concise structure:
@@ -133,6 +152,13 @@ For `post_ur_review`, include the four UI/UX routing fields immediately after `s
133
152
  definition is required, its `ready | blocked | not_applicable` result must be visible before PRD
134
153
  readiness. A required `blocked` result is at least `revise` for this routing step.
135
154
 
155
+ For a structured `post_ur_review` candidate, also include the complete `Structured Depth Evidence`
156
+ section from `BROWNFIELD_REVIEW.md`. The decision projection must show the primary reason, decisive
157
+ dimensions, bounded-slice result, rejected alternative, evidence and required next gate. For
158
+ missing/conflicting facts, show product-language `depth_unresolved` while persisting `block`; name
159
+ the gap and exact recovery action. Structural instruction checks can detect missing contract
160
+ elements but do not prove semantic model compliance or live-host behavior.
161
+
136
162
  ## Pass / Revise / Block Guidance
137
163
  - `pass`: existing owners are understood, reuse path is clear, and no blocking drift or parallel structure risk remains.
138
164
  - `revise`: relevant evidence, tests, ownership, or reuse path is incomplete.
@@ -20,6 +20,7 @@ This skill must not create later artefacts such as PRD, SD, TP, CD, CR, QA, or U
20
20
  ## Runtime Contract
21
21
  Use these focused runtime-contract modules:
22
22
 
23
+ - `../contracts/task-target-resolution.md`
23
24
  - `../contracts/gate-transition.md`
24
25
  - `../contracts/interaction.md`
25
26
  - `../contracts/control-scaffold.md`
@@ -75,6 +76,12 @@ The CLI reports are validators and JSON evidence, not the primary user experienc
75
76
 
76
77
  Plugin `AGDF_*` environment variables set by the OpenCode `shell.env` hook are convenience only and must not be used as the only proof of activation; host shell-env propagation to spawned tool shells is not guaranteed and is OpenCode-owned, not AGDF-owned. A relative glob or `grep` for `.agdf/control/config.json` must not be used as proof of presence or absence of `.agdf/control/config.json`; an absolute `read` or the canonical CLI probe is required.
77
78
 
79
+ ## OpenCode Subagent Enforcement Boundary
80
+
81
+ OpenCode plugin hooks (`tool.execute.before`) do not intercept tool calls from subagents spawned via the `task` tool (anomalyco/opencode issue #5894, PR #36238 open). AGDF enforcement through plugin hooks applies to primary-agent tool calls only; in the subagent path, AGDF governance is auditing-only, not enforcement.
82
+
83
+ This is a host limitation, not an AGDF-owned defect. Do not claim that AGDF gates are technically enforced in the OpenCode subagent path. Do not route work to a subagent to bypass a primary-agent gate. When subagent work touches gate-relevant files, verify the result through the canonical validator (`doctor --json`, `gate-check --json`) after the subagent returns, not during.
84
+
78
85
  ## Native Interaction Path
79
86
 
80
87
  `../contracts/interaction.md` is the complete normative owner for interaction kinds, locale,
@@ -84,12 +91,15 @@ do not restate or infer a surface matrix in this skill.
84
91
 
85
92
  This skill owns only these operational responsibilities:
86
93
 
87
- 1. Select exactly one run and evaluate its current gate.
88
- 2. Confirm that the required durable artefact is present and ready.
89
- 3. Consume the canonical `approval_presentation` verbatim for the selected run, gate and revision.
90
- 4. Present that projection and obtain deliberate input through the contract-selected native or exact-text path.
91
- 5. Revalidate the same run, gate and revision immediately after the response and before persistence.
92
- 6. Persist only a currently valid exact approval through the existing control-state workflow.
94
+ 1. Resolve or revalidate the primary task target before selecting repository control state.
95
+ 2. Derive repository activation only from the resolved governance target; an evidence source or
96
+ working directory is not sufficient.
97
+ 3. Select exactly one run and evaluate its current gate.
98
+ 4. Confirm that the required durable artefact is present and ready.
99
+ 5. Consume the canonical `approval_presentation` verbatim for the selected run, gate and revision.
100
+ 6. Present that projection and obtain deliberate input through the contract-selected native or exact-text path.
101
+ 7. Revalidate the same target, run, gate and revision immediately after the response and before persistence.
102
+ 8. Persist only a currently valid exact approval through the existing control-state workflow.
93
103
 
94
104
  For status, blocked, read-only or rationale interactions, consume the canonical
95
105
  `status_presentation.markdown` verbatim and apply the locale contract without asking for approval.
@@ -156,18 +166,30 @@ Use what is available:
156
166
  If a status is not explicit, do not assume it is satisfied.
157
167
 
158
168
  ## Workflow
159
- 1. Check exact approvals.
160
- 2. Check artefact status.
161
- 3. Determine the earliest blocking user gate or internal mandatory step.
162
- 4. Derive allowed and forbidden outputs.
163
- 5. Name the exact missing approval, if any.
164
- 6. If consent was only implicit, say it is not yet approval and provide the exact formula.
165
- 7. Ensure the next step follows the gate transition table. In particular, never jump from `Approval: UR` to implementation.
166
- 8. Treat a generic "start", "continue" or "leg los" request as a request to perform only the current next allowed action.
167
- 9. After Brownfield Review, choose the smallest safe process path before creating later artefacts.
168
- 10. If the selected path is not visibly recorded with scope reason and evidence, keep the run at `Mode/Slice Decision`.
169
- 11. When `.agdf/control/` is missing or incomplete, make the next allowed artefact action explicit. For a fresh request, that means draft the minimal UR in the response, then request `Approval: UR`. Do not write a full control scaffold unless durable control state was explicitly requested or is already the repository's live AGDF working state.
170
- 12. If branch, workspace and durable artefacts disagree, do not choose a scope silently; report the ambiguity and ask for the smallest clarifying gate action.
169
+ 1. Resolve or revalidate the primary target through `task-target-resolution.md`.
170
+ 2. If resolution is unresolved, consume the canonical target orientation, request only its
171
+ clarification/recovery action and stop before repository activation, gate evaluation or mutation.
172
+ 3. Derive the governance target from the primary target; never from `cwd` or an evidence source alone.
173
+ 4. Check exact approvals.
174
+ 5. Check artefact status.
175
+ 6. Determine the earliest blocking user gate or internal mandatory step.
176
+ 7. Derive allowed and forbidden outputs.
177
+ 8. Name the exact missing approval, if any.
178
+ 9. If consent was only implicit, say it is not yet approval and provide the exact formula.
179
+ 10. Ensure the next step follows the gate transition table. In particular, never jump from `Approval: UR` to implementation.
180
+ 11. Treat a generic "start", "continue" or "leg los" request as a request to perform only the current next allowed action.
181
+ 12. After Brownfield Review, choose the smallest safe process path before creating later artefacts.
182
+ 13. If the selected path is not visibly recorded with scope reason and evidence, keep the run at `Mode/Slice Decision`.
183
+ 14. When `.agdf/control/` is missing or incomplete, make the next allowed artefact action explicit. For a fresh request, that means draft the minimal UR in the response, then request `Approval: UR`. Do not write a full control scaffold unless durable control state was explicitly requested or is already the repository's live AGDF working state.
184
+ 15. If branch, workspace and durable artefacts disagree, do not choose a scope silently; report the ambiguity and ask for the smallest clarifying gate action.
185
+
186
+ ### Task Target Orientation
187
+
188
+ When target/context separation is material, the target changed, or resolution is unresolved, consume
189
+ `task_target_orientation.markdown` verbatim from `renderTaskTargetOrientation` in
190
+ `../contracts/interaction.md`. Do not reconstruct its fields or maintain a skill-local target
191
+ template. If the renderer returns `null`, fail closed to target clarification and do not proceed to
192
+ repository activation, Scope Classification or gate evaluation.
171
193
 
172
194
  ### Scope Classification Output
173
195
  When this skill classifies a fresh scope as ungated (Quick Task or Trivial Change Boundary), consume
@@ -58,6 +58,31 @@
58
58
  "escalation": "Escalation triggers",
59
59
  "challenge": "Challenge path"
60
60
  },
61
+ "taskTargetResolution": {
62
+ "title": "AGDF task target",
63
+ "field": "Field",
64
+ "value": "Value",
65
+ "state": "Resolution",
66
+ "resolved": "Resolved",
67
+ "unresolved": "Clarification required",
68
+ "primaryTarget": "Primary target",
69
+ "governanceTarget": "Governance target",
70
+ "evidenceSources": "Evidence sources",
71
+ "workingDirectory": "Working directory",
72
+ "targetChanged": "Target changed",
73
+ "yes": "yes",
74
+ "none": "none",
75
+ "reason": "Reason",
76
+ "nextAction": "Next action",
77
+ "reasonCodes": {
78
+ "explicit_target": "Explicit current-turn target",
79
+ "continued_target": "Confirmed target continued",
80
+ "multiple_plausible_targets": "Multiple plausible work targets",
81
+ "target_content_mismatch": "Requested change mismatches target",
82
+ "target_unavailable": "Named target is unavailable",
83
+ "no_reliable_target": "No reliable work target"
84
+ }
85
+ },
61
86
  "internalStateLabels": {
62
87
  "verifiedChange": "Compact change under review",
63
88
  "verifiedChangeEscalated": "Escalated to structured delivery",
@@ -284,6 +309,31 @@
284
309
  "escalation": "Eskalationsauslöser",
285
310
  "challenge": "Widerspruchspfad"
286
311
  },
312
+ "taskTargetResolution": {
313
+ "title": "AGDF-Arbeitsziel",
314
+ "field": "Feld",
315
+ "value": "Wert",
316
+ "state": "Auflösung",
317
+ "resolved": "Aufgelöst",
318
+ "unresolved": "Klärung erforderlich",
319
+ "primaryTarget": "Primäres Ziel",
320
+ "governanceTarget": "Governance-Ziel",
321
+ "evidenceSources": "Evidenzquellen",
322
+ "workingDirectory": "Arbeitsordner",
323
+ "targetChanged": "Ziel gewechselt",
324
+ "yes": "ja",
325
+ "none": "keines",
326
+ "reason": "Grund",
327
+ "nextAction": "Nächste Aktion",
328
+ "reasonCodes": {
329
+ "explicit_target": "Explizites Ziel im aktuellen Turn",
330
+ "continued_target": "Bestätigtes Ziel wird fortgesetzt",
331
+ "multiple_plausible_targets": "Mehrere plausible Arbeitsziele",
332
+ "target_content_mismatch": "Änderung passt nicht zum Zielinhalt",
333
+ "target_unavailable": "Benanntes Ziel ist nicht verfügbar",
334
+ "no_reliable_target": "Kein belastbares Arbeitsziel"
335
+ }
336
+ },
287
337
  "internalStateLabels": {
288
338
  "verifiedChange": "Kompakte Änderung wird geprüft",
289
339
  "verifiedChangeEscalated": "Eskaliert zu structured delivery",
@@ -4,6 +4,7 @@ This manifest indexes the thematic runtime-contract modules used by AGDF skills
4
4
 
5
5
  | Module | Path | Coverage |
6
6
  |---|---|---|
7
+ | Task target resolution | `contracts/task-target-resolution.md` | Primary target authority, evidence/mutation separation, governance derivation, continuation and fail-closed target states |
7
8
  | Gate transitions | `contracts/gate-transition.md` | Source precedence, scope ambiguity, gate rules, Brownfield routing and transition model |
8
9
  | Interaction | `contracts/interaction.md` | Run Status Card, approval orientation, native interaction and locale contracts |
9
10
  | Modes | `contracts/modes.md` | Mode selection, Quick Task, Verified Change, trivial and bug boundaries |
@@ -93,9 +93,13 @@ Mode/Slice Decision rules:
93
93
 
94
94
  - `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.
95
95
  - `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.
96
- - `structured_slice`: use when some formal artefacts are needed, but they can stay intentionally small and scoped to the approved slice.
97
- - `structured_delivery`: use when the change has broad product, architecture, runtime, policy, persistence, release or cross-owner impact.
98
- - `block`: use when ownership, SoT, impact, evidence or product direction is not clear enough to choose a safe path.
96
+ - `structured_slice` and `structured_delivery`: apply the sole normative `Structured Depth Decision`
97
+ in `modes.md`; this contract owns only the operational transition and does not duplicate its
98
+ trigger or bounded-slice matrix.
99
+ - `block`: use when ownership, SoT, impact, evidence or product direction is not clear enough to
100
+ choose a safe path. A `depth_unresolved` product result is persisted through this existing value
101
+ with `depth_facts_missing | depth_facts_conflicting`, a Brownfield Review evidence link and a
102
+ precise evidence-owner/re-evaluation next action; it never creates a new mode or advances a gate.
99
103
 
100
104
  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`.
101
105
 
@@ -338,6 +338,28 @@ repeat the sentence later in the same request. Existing-run status inspection re
338
338
  uses the existing status projection; this branch must not create a second status-card or narration
339
339
  owner.
340
340
 
341
+ ### Task Target Orientation
342
+
343
+ Task-target semantics and ordering live in `task-target-resolution.md`. When target/context
344
+ separation is material, a confirmed target changes, or resolution is unresolved, the agent consumes
345
+ the canonical `task_target_orientation.markdown` verbatim from `renderTaskTargetOrientation` in
346
+ `create-agdf/lib/interaction-presentation.js`.
347
+
348
+ The projection may show the primary target, governance target, evidence sources and working
349
+ directory for a resolved result. For an unresolved result it shows the localized reason and required
350
+ next action. It carries `authorizes: false`, never renders approval controls and never selects or
351
+ derives a target.
352
+
353
+ For a fresh request, render the target orientation before read-only orientation, Scope
354
+ Classification or any gate presentation when it is required. An unresolved result suppresses every
355
+ downstream orientation and gate surface. A resolved result with material target separation may be
356
+ followed by the one applicable downstream surface. Avoid a redundant target block for an obvious
357
+ unchanged target.
358
+
359
+ If the input is incomplete or contradictory, the renderer returns `null`. The agent then fails closed
360
+ to target clarification and must not model-reconstruct Markdown. `agdf-gate-check` must not maintain a
361
+ skill-local target-orientation template.
362
+
341
363
  ### Scope Classification Card
342
364
 
343
365
  When `agdf-gate-check` classifies a fresh scope as ungated (Quick Task or Trivial Change Boundary),
@@ -36,6 +36,87 @@ reason, evidence and required next depth in the same internal operation. `Mode/S
36
36
  only a fail-closed recovery step for incomplete or legacy records and is not a normal second user
37
37
  decision.
38
38
 
39
+ ### Structured Depth Decision
40
+
41
+ This section is the sole normative owner for choosing between `structured_slice` and
42
+ `structured_delivery`. Apply it only after an approved durable UR, a Brownfield Review of the
43
+ existing-system context, and unchanged evaluation of Quick Task/Compact Delivery and Verified
44
+ Change. A compact path must be ineligible or explicitly escalated, and the decisive depth facts must
45
+ be durably evidenced before a positive structured decision is recorded.
46
+
47
+ Choose `structured_delivery` when any one evidenced full-depth trigger applies:
48
+
49
+ 1. **Authority, policy or security** — a trust or authority boundary, permission, security,
50
+ compliance or normative policy changes, or independent decision owners require coordinated
51
+ approval.
52
+ 2. **Architecture or runtime** — execution, orchestration, durable execution, concurrency, failure
53
+ or recovery boundaries change beyond a local slice.
54
+ 3. **Persistence, data or migration** — persistent schema or meaning changes, data migration,
55
+ irreversible state transition, coordinated cutover, an extended compatibility window or
56
+ non-local rollback is required.
57
+ 4. **External or public contract** — an external API, public CLI behavior, protocol, file format or
58
+ compatibility-sensitive integration contract changes, including independent consumer
59
+ coordination or versioning.
60
+ 5. **Release, deployment or cross-host** — the work needs its own rollout, deployment, rollback,
61
+ feature-flag or release plan, or coordinated activation across hosts, products or operational
62
+ boundaries.
63
+ 6. **Unbounded consumer or owner coordination** — the outcome cannot be delivered as an
64
+ independently acceptable and reversible slice, or consumers or owners require a shared cutover
65
+ or compatibility window.
66
+
67
+ A single trigger is decisive because of its effect, never because of a numeric count.
68
+
69
+ Choose `structured_slice` only when `depth_facts_status` is `complete`, no full-depth trigger is
70
+ evidenced, and all seven bounded-slice checks are positively evidenced as `pass`:
71
+
72
+ | Check ID | Required evidence |
73
+ |---|---|
74
+ | `coherent_outcome` | One coherent user or product outcome has a clear acceptance boundary. |
75
+ | `authority_boundary` | Authority and source of truth are known and no new trust, policy, permission or security boundary is introduced. |
76
+ | `owner_consumer_coordination` | Owners and consumers are identified and coordination stays inside the slice without a shared external cutover. |
77
+ | `full_depth_impacts_absent` | Architecture, runtime, persistence, data, external API, public CLI, release and cross-host effects are evidenced as not full-depth relevant. |
78
+ | `migration_propagation_bounded` | Migration and propagation are bounded, compatible, testable and locally reversible. |
79
+ | `failure_recovery_local` | Failure, recovery and rollback remain controllable inside the slice. |
80
+ | `independently_acceptable` | The slice has independent acceptance signals and hides no unknown later work as a prerequisite. |
81
+
82
+ Multiple files, owners, consumers or derived paths do not fail these checks by themselves. File,
83
+ owner, consumer, task or derived-path counts are not a decision proxy and must never be used as a
84
+ threshold for either structured mode.
85
+
86
+ If a decisive fact is missing or conflicting and no evidenced full-depth trigger already supports
87
+ `structured_delivery`, the product-language result is `depth_unresolved`. This is not a persisted
88
+ mode. Persist the existing Mode/Slice value `block`, use `depth_facts_missing` or
89
+ `depth_facts_conflicting`, name the affected facts and evidence owner where known, link the
90
+ Brownfield Review, forbid later artefacts and implementation, and provide a precise next action for
91
+ evidence completion and Brownfield/Mode-Slice re-evaluation. Unknown facts must not default to
92
+ `structured_delivery`.
93
+
94
+ Positive decisions persist the existing `structured_slice | structured_delivery` value, required
95
+ next gate, a `scope_reason` containing the primary reason code and decisive rationale plus the
96
+ rejected alternative, and evidence linking the complete Structured Depth Evidence. Re-evaluate
97
+ before continuing whenever scope growth reveals a new full-depth trigger.
98
+
99
+ Normalized reason codes are audit and rationale categories, not new modes or gates:
100
+
101
+ - `bounded_structured_slice`
102
+ - `authority_policy_security_depth`
103
+ - `architecture_runtime_depth`
104
+ - `persistence_migration_depth`
105
+ - `external_contract_depth`
106
+ - `release_cross_host_depth`
107
+ - `unbounded_consumer_coordination`
108
+ - `depth_facts_missing`
109
+ - `depth_facts_conflicting`
110
+
111
+ Structured Slice and Structured Delivery use the same existing gate and approval sequence. Their
112
+ difference is artefact depth: Slice artefacts cover only the coherent bounded outcome and its owners,
113
+ contracts, propagation, recovery, tasks and tests; Full Delivery covers every affected authority,
114
+ architecture, runtime, consumer, migration, operational and release boundary.
115
+
116
+ Historical or deterministic benchmark observations are non-authorizing evidence. They do not define
117
+ this policy, retroactively regrade historical runs or prove live-host behavior. A future benchmark
118
+ may apply this policy only with complete, versioned neutral depth facts.
119
+
39
120
  ### Verified Change
40
121
 
41
122
  `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.
@@ -0,0 +1,102 @@
1
+ # AGDF Runtime Contract — Task Target Resolution
2
+
3
+ ## Purpose And Ordering
4
+
5
+ Resolve the user's primary work target before repository activation, Scope Classification, mode
6
+ selection or gate evaluation. Repository governance is downstream of the task target; the current
7
+ working directory, an inspected repository or a source mentioned as evidence must never become the
8
+ work target by accident.
9
+
10
+ The canonical order is:
11
+
12
+ 1. resolve or revalidate the task target;
13
+ 2. derive the governance target from that resolved target;
14
+ 3. activate repository-local AGDF control only for that governance target;
15
+ 4. then apply read-only orientation, Scope Classification, mode selection and gate evaluation.
16
+
17
+ If task-target resolution is unresolved, steps 2–4 and every mutation are forbidden.
18
+
19
+ ## Resolution Result
20
+
21
+ Use one normalized result:
22
+
23
+ - `resolution_state`: `resolved | unresolved`
24
+ - `reason_code`: `explicit_target | continued_target | multiple_plausible_targets |
25
+ target_content_mismatch | target_unavailable | no_reliable_target`
26
+ - `primary_target`: exactly one requested work object when resolved, otherwise empty
27
+ - `evidence_sources`: zero or more mentioned or inspected sources that do not gain mutation authority
28
+ - `working_directory`: execution context only, never target authority by itself
29
+ - `governance_target`: the repository whose control state applies to the primary target, otherwise empty
30
+ - `target_changed`: whether an explicit new target replaced the previously confirmed target
31
+ - `next_action`: required clarification, supply or retry action when unresolved
32
+
33
+ A resolved result requires a non-empty `primary_target` and a reason code of `explicit_target` or
34
+ `continued_target`. An unresolved result requires an empty `primary_target`, an empty
35
+ `governance_target`, one of the four unresolved reason codes and a non-empty `next_action`.
36
+ Contradictory or incomplete results fail closed.
37
+
38
+ ## Target Authority Precedence
39
+
40
+ Resolve in this order:
41
+
42
+ 1. an explicit file, artefact or repository named as the work target in the current user turn;
43
+ 2. a previously confirmed target only when the current turn unambiguously continues the same action,
44
+ object and scope;
45
+ 3. the current repository or working directory only when the request explicitly or deictically asks
46
+ for work on "this project", "this repository" or an equivalent current-scope reference;
47
+ 4. otherwise `no_reliable_target`.
48
+
49
+ An explicit current-turn target always replaces an inherited target. Make the change visible when
50
+ the previous target could otherwise remain plausible.
51
+
52
+ Do not fall back to the working directory, a neighboring file or an evidence source when the
53
+ explicit target is unavailable or its content does not support the requested change.
54
+
55
+ ## Evidence And Mutation Boundary
56
+
57
+ Reading, inspecting, mentioning or relying on a repository or artefact makes it an evidence source,
58
+ not a mutation target. Evidence access never grants mutation authority and never activates that
59
+ repository's AGDF control state.
60
+
61
+ Derive `governance_target` only from:
62
+
63
+ - the repository containing the resolved `primary_target`; or
64
+ - an explicit user statement that a named repository governs the target.
65
+
66
+ An external standalone artefact may have no repository governance target. In that case the router
67
+ continues with the applicable non-repository path; it must not borrow governance from the current
68
+ working directory.
69
+
70
+ ## Continuation And Target Change
71
+
72
+ A confirmed target may continue across related turns only when the current request remains
73
+ unambiguous. Revalidate it before every mutation or gate decision. New explicit target evidence wins.
74
+ New ambiguity ends the inherited binding and produces `multiple_plausible_targets`.
75
+
76
+ When a durable AGDF run exists, its Source And Scope State may record the confirmed target as
77
+ evidence. It does not override a newer explicit user target. Outside a run, continuation remains
78
+ transient conversation state; do not create a global target store or a second run-state owner.
79
+
80
+ ## Fail-Closed States
81
+
82
+ - `multiple_plausible_targets`: more than one work target remains plausible; list the candidates and
83
+ request the smallest clarification.
84
+ - `target_content_mismatch`: the requested content change is not supported by the explicit target's
85
+ observable content; name the mismatch and ask whether the target or requested change should change.
86
+ - `target_unavailable`: the named file, attachment or artefact cannot be inspected; request supply or
87
+ access and offer a visible retry.
88
+ - `no_reliable_target`: neither an explicit target nor an unambiguous continuation exists; request a
89
+ target.
90
+
91
+ These states forbid repository activation, Scope Classification, gate evaluation and mutation.
92
+ Never silently expand scope to make the request fit a different project.
93
+
94
+ ## Presentation Boundary
95
+
96
+ `contracts/interaction.md` owns the visible, non-authorizing Task Target Orientation.
97
+ `create-agdf/lib/interaction-presentation.js` owns its rendering. The renderer projects a normalized
98
+ result; it must not resolve targets, derive governance or become a state store.
99
+
100
+ Show orientation when target/context separation is material, when the target changes, or when the
101
+ result is unresolved. Avoid redundant presentation for an obvious unchanged target. Presentation
102
+ never grants mutation or gate authority.
@@ -73,6 +73,7 @@ Never jump directly from `Approval: UR`, implicit consent, or a generic "start"
73
73
  ## Runtime Contract
74
74
  For repeated output, gate, Quality Contract and Context Graph rules, use:
75
75
 
76
+ - `contracts/task-target-resolution.md` for primary target authority before repository activation
76
77
  - `contracts/gate-transition.md` for gate terms, Brownfield routing and transition rules
77
78
  - `contracts/interaction.md` for status cards, approval orientation and native interaction
78
79
  - `contracts/modes.md` for delivery-mode boundaries
@@ -126,3 +127,4 @@ For relevant runs that change durable state, code, artefacts or gate status:
126
127
  - An explicit user `permission.question: deny` remains authoritative and selects the exact-text AGDF fallback; never convert an OpenCode permission outcome or auto mode into gate approval.
127
128
  - Shared output and gate rules live in `.opencode/agdf-runtime-contract.md`.
128
129
  - Do not paste full control files, templates or artefact bodies into chat unless the user explicitly asks for the full content; summarize and link paths instead.
130
+ - OpenCode plugin hooks (`tool.execute.before`) do not intercept tool calls from subagents spawned via the `task` tool (issue #5894, PR #36238 open). AGDF enforcement through plugin hooks applies to primary-agent tool calls only; in the subagent path, AGDF governance is auditing-only. Do not route work to a subagent to bypass a primary-agent gate; verify subagent results through the canonical validator after the subagent returns.
@@ -58,6 +58,31 @@
58
58
  "escalation": "Escalation triggers",
59
59
  "challenge": "Challenge path"
60
60
  },
61
+ "taskTargetResolution": {
62
+ "title": "AGDF task target",
63
+ "field": "Field",
64
+ "value": "Value",
65
+ "state": "Resolution",
66
+ "resolved": "Resolved",
67
+ "unresolved": "Clarification required",
68
+ "primaryTarget": "Primary target",
69
+ "governanceTarget": "Governance target",
70
+ "evidenceSources": "Evidence sources",
71
+ "workingDirectory": "Working directory",
72
+ "targetChanged": "Target changed",
73
+ "yes": "yes",
74
+ "none": "none",
75
+ "reason": "Reason",
76
+ "nextAction": "Next action",
77
+ "reasonCodes": {
78
+ "explicit_target": "Explicit current-turn target",
79
+ "continued_target": "Confirmed target continued",
80
+ "multiple_plausible_targets": "Multiple plausible work targets",
81
+ "target_content_mismatch": "Requested change mismatches target",
82
+ "target_unavailable": "Named target is unavailable",
83
+ "no_reliable_target": "No reliable work target"
84
+ }
85
+ },
61
86
  "internalStateLabels": {
62
87
  "verifiedChange": "Compact change under review",
63
88
  "verifiedChangeEscalated": "Escalated to structured delivery",
@@ -284,6 +309,31 @@
284
309
  "escalation": "Eskalationsauslöser",
285
310
  "challenge": "Widerspruchspfad"
286
311
  },
312
+ "taskTargetResolution": {
313
+ "title": "AGDF-Arbeitsziel",
314
+ "field": "Feld",
315
+ "value": "Wert",
316
+ "state": "Auflösung",
317
+ "resolved": "Aufgelöst",
318
+ "unresolved": "Klärung erforderlich",
319
+ "primaryTarget": "Primäres Ziel",
320
+ "governanceTarget": "Governance-Ziel",
321
+ "evidenceSources": "Evidenzquellen",
322
+ "workingDirectory": "Arbeitsordner",
323
+ "targetChanged": "Ziel gewechselt",
324
+ "yes": "ja",
325
+ "none": "keines",
326
+ "reason": "Grund",
327
+ "nextAction": "Nächste Aktion",
328
+ "reasonCodes": {
329
+ "explicit_target": "Explizites Ziel im aktuellen Turn",
330
+ "continued_target": "Bestätigtes Ziel wird fortgesetzt",
331
+ "multiple_plausible_targets": "Mehrere plausible Arbeitsziele",
332
+ "target_content_mismatch": "Änderung passt nicht zum Zielinhalt",
333
+ "target_unavailable": "Benanntes Ziel ist nicht verfügbar",
334
+ "no_reliable_target": "Kein belastbares Arbeitsziel"
335
+ }
336
+ },
287
337
  "internalStateLabels": {
288
338
  "verifiedChange": "Kompakte Änderung wird geprüft",
289
339
  "verifiedChangeEscalated": "Eskaliert zu structured delivery",
@@ -4,6 +4,7 @@ This manifest indexes the thematic runtime-contract modules used by AGDF skills
4
4
 
5
5
  | Module | Path | Coverage |
6
6
  |---|---|---|
7
+ | Task target resolution | `contracts/task-target-resolution.md` | Primary target authority, evidence/mutation separation, governance derivation, continuation and fail-closed target states |
7
8
  | Gate transitions | `contracts/gate-transition.md` | Source precedence, scope ambiguity, gate rules, Brownfield routing and transition model |
8
9
  | Interaction | `contracts/interaction.md` | Run Status Card, approval orientation, native interaction and locale contracts |
9
10
  | Modes | `contracts/modes.md` | Mode selection, Quick Task, Verified Change, trivial and bug boundaries |
@@ -93,9 +93,13 @@ Mode/Slice Decision rules:
93
93
 
94
94
  - `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.
95
95
  - `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.
96
- - `structured_slice`: use when some formal artefacts are needed, but they can stay intentionally small and scoped to the approved slice.
97
- - `structured_delivery`: use when the change has broad product, architecture, runtime, policy, persistence, release or cross-owner impact.
98
- - `block`: use when ownership, SoT, impact, evidence or product direction is not clear enough to choose a safe path.
96
+ - `structured_slice` and `structured_delivery`: apply the sole normative `Structured Depth Decision`
97
+ in `modes.md`; this contract owns only the operational transition and does not duplicate its
98
+ trigger or bounded-slice matrix.
99
+ - `block`: use when ownership, SoT, impact, evidence or product direction is not clear enough to
100
+ choose a safe path. A `depth_unresolved` product result is persisted through this existing value
101
+ with `depth_facts_missing | depth_facts_conflicting`, a Brownfield Review evidence link and a
102
+ precise evidence-owner/re-evaluation next action; it never creates a new mode or advances a gate.
99
103
 
100
104
  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`.
101
105