@event4u/agent-config 7.0.2 → 7.2.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 (140) hide show
  1. package/.claude-plugin/marketplace.json +9 -1
  2. package/CHANGELOG.md +117 -0
  3. package/README.md +4 -2
  4. package/dist/agent-src/commands/council/default.md +28 -20
  5. package/dist/agent-src/commands/evals/fix.json +5 -1
  6. package/dist/agent-src/commands/fix/comments.md +101 -0
  7. package/dist/agent-src/commands/fix.md +5 -2
  8. package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +65 -0
  9. package/dist/agent-src/contexts/execution/auto-orchestration-activation.md +68 -0
  10. package/dist/agent-src/contexts/execution/host-capability-manifest.md +68 -0
  11. package/dist/agent-src/contexts/execution/orchestration-benchmark-gate.md +62 -0
  12. package/dist/agent-src/contexts/execution/orchestration-telemetry.md +59 -0
  13. package/dist/agent-src/contexts/execution/roadmap-process-loop.md +8 -3
  14. package/dist/agent-src/contexts/execution/subagent-response-contract.md +56 -0
  15. package/dist/agent-src/contexts/execution/subagent-routing.md +57 -0
  16. package/dist/agent-src/contexts/execution/subagent-spawn-contract.md +54 -0
  17. package/dist/agent-src/contexts/execution/subagent-steering.md +71 -0
  18. package/dist/agent-src/contexts/execution/verify-budget.md +50 -0
  19. package/dist/agent-src/rules/brand-source-of-truth.md +10 -0
  20. package/dist/agent-src/rules/delegation-policy.md +85 -0
  21. package/dist/agent-src/rules/design-fidelity.md +98 -0
  22. package/dist/agent-src/rules/domain-safety-pii.md +22 -0
  23. package/dist/agent-src/rules/legal-safety-floor.md +182 -0
  24. package/dist/agent-src/rules/lethal-trifecta-guard.md +25 -22
  25. package/dist/agent-src/rules/output-discipline.md +85 -0
  26. package/dist/agent-src/rules/telegraph-speak.md +4 -1
  27. package/dist/agent-src/rules/token-budget-discipline.md +94 -0
  28. package/dist/agent-src/scripts/archive_completed_roadmaps.ts +102 -15
  29. package/dist/agent-src/scripts/update_roadmap_progress.ts +30 -3
  30. package/dist/agent-src/skills/accessibility-auditor/SKILL.md +20 -5
  31. package/dist/agent-src/skills/ai-council/SKILL.md +28 -1
  32. package/dist/agent-src/skills/blade-ui/SKILL.md +9 -0
  33. package/dist/agent-src/skills/contract-review/SKILL.md +125 -0
  34. package/dist/agent-src/skills/contract-review/evals/triggers.json +17 -0
  35. package/dist/agent-src/skills/dashboard-design/SKILL.md +21 -5
  36. package/dist/agent-src/skills/design-intelligence/SKILL.md +96 -0
  37. package/dist/agent-src/skills/design-review/SKILL.md +83 -0
  38. package/dist/agent-src/skills/design-system-capture/SKILL.md +234 -0
  39. package/dist/agent-src/skills/design-tokens/SKILL.md +1 -0
  40. package/dist/agent-src/skills/dpa-review/SKILL.md +130 -0
  41. package/dist/agent-src/skills/dpa-review/evals/triggers.json +17 -0
  42. package/dist/agent-src/skills/existing-ui-audit/SKILL.md +15 -4
  43. package/dist/agent-src/skills/fe-design/SKILL.md +98 -16
  44. package/dist/agent-src/skills/flux/SKILL.md +8 -0
  45. package/dist/agent-src/skills/iconography/SKILL.md +1 -0
  46. package/dist/agent-src/skills/laravel/SKILL.md +1 -0
  47. package/dist/agent-src/skills/legal-intake-triage/SKILL.md +128 -0
  48. package/dist/agent-src/skills/legal-intake-triage/evals/triggers.json +17 -0
  49. package/dist/agent-src/skills/legal-practice-profile/SKILL.md +101 -0
  50. package/dist/agent-src/skills/legal-practice-profile/evals/triggers.json +17 -0
  51. package/dist/agent-src/skills/livewire/SKILL.md +8 -0
  52. package/dist/agent-src/skills/nda-triage/SKILL.md +114 -0
  53. package/dist/agent-src/skills/nda-triage/evals/triggers.json +17 -0
  54. package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +21 -9
  55. package/dist/agent-src/skills/reasoning-orchestrator/SKILL.md +3 -1
  56. package/dist/agent-src/skills/recursive-verification/SKILL.md +186 -0
  57. package/dist/agent-src/skills/roadmap-management/SKILL.md +17 -0
  58. package/dist/agent-src/skills/skill-writing/SKILL.md +18 -0
  59. package/dist/agent-src/skills/subagent-orchestration/SKILL.md +11 -0
  60. package/dist/agent-src/skills/tailwind-engineer/SKILL.md +17 -7
  61. package/dist/agent-src/skills/typography-system/SKILL.md +14 -0
  62. package/dist/agent-src/skills/ui-component-architect/SKILL.md +9 -0
  63. package/dist/agent-src/templates/agent-settings.md +64 -19
  64. package/dist/discovery/deprecation-report.md +1 -1
  65. package/dist/discovery/discovery-manifest.json +362 -43
  66. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  67. package/dist/discovery/discovery-manifest.summary.md +13 -5
  68. package/dist/discovery/orphan-report.md +1 -1
  69. package/dist/discovery/packs.json +56 -11
  70. package/dist/discovery/trust-report.md +7 -5
  71. package/dist/discovery/workspaces.json +38 -7
  72. package/dist/mcp/registry-manifest.json +3 -3
  73. package/dist/router.json +1 -1
  74. package/dist/server/routes/wizard.js +4 -3
  75. package/dist/server/routes/wizard.js.map +1 -1
  76. package/dist/server/schemas/settings.js +23 -0
  77. package/dist/server/schemas/settings.js.map +1 -1
  78. package/dist/ui/assets/{index-CoQo90sz.js → index-UjcTG_9O.js} +2 -2
  79. package/dist/ui/assets/index-UjcTG_9O.js.map +1 -0
  80. package/dist/ui/index.html +1 -1
  81. package/docs/RELEASE_STORY_TEMPLATE.md +37 -0
  82. package/docs/architecture.md +4 -4
  83. package/docs/benchmark.md +46 -0
  84. package/docs/catalog.md +18 -6
  85. package/docs/command-flows.md +7 -1
  86. package/docs/contracts/ai-council-config.md +17 -10
  87. package/docs/contracts/audit-log-v1.md +7 -0
  88. package/docs/contracts/auto-orchestration-v1.md +70 -0
  89. package/docs/contracts/capability-boundary.md +64 -0
  90. package/docs/contracts/command-clusters.md +1 -1
  91. package/docs/contracts/discovery-manifest.schema.json +2 -2
  92. package/docs/contracts/package-self-orientation.md +3 -0
  93. package/docs/contracts/subagent-boundary.md +54 -0
  94. package/docs/decisions/ADR-013-discovery-frontmatter-contract.md +32 -0
  95. package/docs/decisions/ADR-020-global-only-consumer-scope.md +13 -6
  96. package/docs/decisions/ADR-049-configuration-trust-boundary.md +11 -1
  97. package/docs/decisions/ADR-093-ai-council-config-user-global.md +10 -4
  98. package/docs/decisions/ADR-104-ai-council-config-global-only.md +119 -0
  99. package/docs/decisions/ADR-105-automatic-subagent-orchestration.md +102 -0
  100. package/docs/decisions/ADR-106-recursive-verification-benchmark-gate.md +126 -0
  101. package/docs/decisions/ADR-107-legal-domain-pack-adoption.md +70 -0
  102. package/docs/decisions/ADR-108-open-source-forever-no-commercial-tier.md +46 -0
  103. package/docs/decisions/INDEX.md +5 -0
  104. package/docs/getting-started.md +2 -2
  105. package/docs/guidelines/agent-infra/domain-eval-anti-pattern.md +53 -0
  106. package/docs/guidelines/agent-infra/domain-pack-architecture.md +56 -0
  107. package/docs/guidelines/design-antipatterns-triggers.json +17 -0
  108. package/docs/guidelines/design-antipatterns.md +170 -0
  109. package/docs/guidelines/design-modes.md +97 -0
  110. package/package.json +1 -1
  111. package/src/config/agent-settings.template.yml +103 -3
  112. package/src/config/discovery/packs.yml +24 -0
  113. package/src/config/discovery/workspaces.yml +7 -0
  114. package/src/scripts/_lib/auto_dispatch.ts +95 -0
  115. package/src/scripts/_lib/host_capability.ts +59 -0
  116. package/src/scripts/_lib/orchestration_gate.ts +98 -0
  117. package/src/scripts/_lib/subagent_bundle.ts +154 -0
  118. package/src/scripts/_lib/subagent_response.ts +82 -0
  119. package/src/scripts/_lib/subagent_routing.ts +81 -0
  120. package/src/scripts/_lib/subagent_spawn.ts +97 -0
  121. package/src/scripts/_lib/subagent_steering.ts +64 -0
  122. package/src/scripts/_lib/verify_budget.ts +54 -0
  123. package/src/scripts/ai_council/advisors.ts +4 -2
  124. package/src/scripts/ai_council/clients.ts +7 -1
  125. package/src/scripts/ai_council/config.ts +22 -17
  126. package/src/scripts/bench_ab_v2_run.ts +127 -0
  127. package/src/scripts/bench_ab_v2_stats.ts +39 -0
  128. package/src/scripts/check_council_config_location.ts +6 -5
  129. package/src/scripts/check_trunk_drift.ts +67 -0
  130. package/src/scripts/lint_design_quality.ts +321 -0
  131. package/src/scripts/lint_discovery_vocabulary.ts +6 -0
  132. package/src/scripts/lint_framework_leakage_allowlist.json +21 -0
  133. package/src/scripts/lint_legal_pack.ts +197 -0
  134. package/src/scripts/lint_output_slop.ts +223 -0
  135. package/src/scripts/lint_pack_risk_class.ts +79 -0
  136. package/src/scripts/probe_projection_fidelity.ts +7 -1
  137. package/src/scripts/schemas/agent-settings.schema.json +23 -0
  138. package/src/scripts/schemas/skill.schema.json +5 -0
  139. package/src/scripts/skill_linter.ts +3 -0
  140. package/dist/ui/assets/index-CoQo90sz.js.map +0 -1
@@ -0,0 +1,68 @@
1
+ # Host-Capability Manifest
2
+
3
+ Resolved once per session by the **agent** (not a long-running process) and
4
+ cached for the rest of the session. Tells the orchestration layer which
5
+ subagent primitives the current host actually exposes, so auto-dispatch never
6
+ attempts a primitive the host cannot run.
7
+
8
+ ## Schema
9
+
10
+ A single JSON object, `schema_version: 1`:
11
+
12
+ ```json
13
+ {
14
+ "schema_version": 1,
15
+ "subagent_spawn": false,
16
+ "parallel_spawn": false,
17
+ "status_polling": false,
18
+ "separate_quota_pool": false
19
+ }
20
+ ```
21
+
22
+ ## Resolution
23
+
24
+ The agent fills the manifest from two inputs, in order:
25
+
26
+ 1. The agent's own knowledge of the **current host** and its documented
27
+ subagent primitives.
28
+ 2. An **optional** settings override `subagents.host_capabilities` in
29
+ `.agent-settings.yml`. Any field present there wins for that field; any
30
+ field omitted falls back to the safe default below.
31
+
32
+ The manifest is resolved once and cached — the agent does not re-resolve it
33
+ mid-session.
34
+
35
+ ## Safe default — unknown host assumes nothing
36
+
37
+ ```
38
+ SAFE DEFAULT = ALL FIELDS false.
39
+ AN UNKNOWN HOST IS ASSUMED TO HAVE NO SUBAGENT PRIMITIVE.
40
+ A MISSING OR INVALID FIELD IS false, NEVER true.
41
+ ```
42
+
43
+ This is a hard rule. When the host is unrecognized, or a field is absent /
44
+ malformed in the override, the field resolves to `false`. The orchestration
45
+ layer then degrades to in-session execution rather than attempting an
46
+ unsupported primitive.
47
+
48
+ ## Fields
49
+
50
+ | Field | Type | Gates downstream |
51
+ |---|---|---|
52
+ | `subagent_spawn` | bool | Any delegation at all. `false` → no subagent is ever spawned; everything runs in-session. |
53
+ | `parallel_spawn` | bool | Concurrent dispatch of multiple subagents. `false` → delegation is serial, one subagent at a time. |
54
+ | `status_polling` | bool | Monitoring running subagents (progress / completion checks). `false` → fire-and-collect only, no mid-run polling. |
55
+ | `separate_quota_pool` | bool | Quota-arbitrage bonus (Phase 2) — subagents draw from a distinct quota pool than the session. `false` → assume shared quota. |
56
+
57
+ A field being `true` is a **precondition**, not a mandate: `parallel_spawn:
58
+ true` permits concurrency but the dispatch cap still applies (see
59
+ `subagents.max_parallel` in subagent-configuration.md).
60
+
61
+ ## Related
62
+
63
+ - [`subagent-configuration`](../subagent-configuration.md) — the `subagents.*`
64
+ settings keys and the model / parallelism resolution this manifest sits
65
+ alongside.
66
+ - [`orchestration-telemetry`](orchestration-telemetry.md) — records what the
67
+ resolved manifest actually enabled per dispatch.
68
+ Phase-0 substrate belongs to.
@@ -0,0 +1,62 @@
1
+ # Orchestration Benchmark & Default-Flip Gate (Phase 6)
2
+
3
+ The falsification gate the whole auto-orchestration roadmap is built around.
4
+ Reaching the user's "default `on`" is a **measured milestone**, not an
5
+ assumption: the shipped default for `subagents.auto` flips toward `on` only
6
+ when a real benchmark proves a net win at held quality.
7
+
8
+ ## Measurement — pin the method
9
+
10
+ Measure orchestrated vs. single-agent on a representative delegable-task set
11
+ using the existing `bench:ab` value harness. Pin the comparison method:
12
+
13
+ - **Paired** — the same task set runs both arms (single-agent, auto-orchestrated).
14
+ - **Activation-aware** — the orchestration layer is toggled per arm via
15
+ `subagents.enabled` / `subagents.auto`, not a global confound.
16
+ - **Metrics** — token delta, wall-clock, and an outcome-quality score (held at
17
+ or above the single-agent baseline).
18
+
19
+ The measurement is an **empirical run with live API spend on a task corpus** —
20
+ it is authorised and run out of band, not produced by this package's code. This
21
+ context defines the gate; it does not fake the result.
22
+
23
+ ## Pass gate (defined up front)
24
+
25
+ ```
26
+ GATE PASSES ⇔ net token-OR-time win on the delegable-task subset
27
+ AND output quality held at/above the single-agent baseline.
28
+ HONEST-NULL EXIT: no win, or quality regressed → KEEP the conservative default.
29
+ ```
30
+
31
+ `gateVerdict()` encodes pass = `net_win && quality_held`.
32
+
33
+ ## Default flip — one line, host-gated
34
+
35
+ On a **passing** gate, the shipped default for `subagents.auto` becomes `on`
36
+ **only** on hosts whose capability manifest reports `subagent_spawn: true`
37
+ (`off` elsewhere). `resolveShippedDefault()` encodes this. The flip itself is a
38
+ one-line edit to the `subagents.auto` default in
39
+ `src/config/agent-settings.template.yml` — no code change, host-gated by the
40
+ manifest at runtime.
41
+
42
+ Until the gate passes, the shipped default stays `ask` (conservative). This is
43
+ the reconciliation of the user's "default on" goal with the council's
44
+ "prove-first": `on` is the destination, reached by evidence, not assumed.
45
+
46
+ ## Reproducibility
47
+
48
+ The benchmark report (arms, task set, metrics, verdict) is reproducible from
49
+ the pinned `bench:ab` scenario + the gate helper, so the default-flip decision
50
+ is auditable rather than asserted.
51
+
52
+ ## Reference implementation
53
+
54
+ [`src/scripts/_lib/orchestration_gate.ts`](../../../../src/scripts/_lib/orchestration_gate.ts)
55
+ (`gateVerdict`, `resolveShippedDefault`), covered by
56
+ [`tests/scripts/_lib_orchestration_gate.test.ts`](../../../../tests/scripts/_lib_orchestration_gate.test.ts).
57
+
58
+ ## Related
59
+
60
+ - [`auto-orchestration-activation`](auto-orchestration-activation.md) — the `subagents.auto` key this gate sets the default for.
61
+ - [`host-capability-manifest`](host-capability-manifest.md) — `subagent_spawn` gates the flip.
62
+ - [`orchestration-telemetry`](orchestration-telemetry.md) — the per-dispatch metrics the benchmark aggregates.
@@ -0,0 +1,59 @@
1
+ # Orchestration Telemetry
2
+
3
+ Per-dispatch orchestration metrics, recorded for every auto-dispatch the
4
+ orchestration layer performs. These ride as an **optional** `orchestration`
5
+ sub-object on the existing audit-log-v1 JSONL line — additive and
6
+ non-breaking. A line without an `orchestration` object is still a valid
7
+ audit-log-v1 line; readers that do not understand the field ignore it (per the
8
+ v1 forward-compat rule on unknown fields).
9
+
10
+ ## Shape
11
+
12
+ ```json
13
+ {
14
+ "task_size_estimate": 0,
15
+ "spawn_count": 0,
16
+ "tiers": [],
17
+ "token_delta": 0,
18
+ "wall_clock_ms": 0,
19
+ "outcome": "DONE",
20
+ "verify_mode": "deterministic"
21
+ }
22
+ ```
23
+
24
+ ## Field semantics
25
+
26
+ | Field | Type | Meaning |
27
+ |---|---|---|
28
+ | `task_size_estimate` | int | Pre-dispatch estimate of the task's size (the orchestrator's sizing heuristic). Counts only, no body. |
29
+ | `spawn_count` | int | Number of subagents dispatched for this task. `0` → handled in-session. |
30
+ | `tiers` | string[] | Model tiers dispatched to, one entry per spawn class (e.g. `["sonnet","opus"]`). Tier names only, no prompts. |
31
+ | `token_delta` | int | Net token cost of the dispatch versus the in-session baseline. Counts only. |
32
+ | `wall_clock_ms` | int | Wall-clock duration of the dispatch, milliseconds. |
33
+ | `outcome` | enum | One of `DONE` · `DONE_WITH_CONCERNS` · `NEEDS_CONTEXT` · `BLOCKED` · `killed`. |
34
+ | `verify_mode` | enum | How the dispatch's output was verified: `deterministic` · `judge` · `none`. |
35
+
36
+ ## Privacy floor
37
+
38
+ Counts and ids only — **no bodies**. This preserves the audit-log-v1 privacy
39
+ floor: no prompts, no conversation snippets, no subagent output, no secrets.
40
+ `tiers` carries tier names, never model prompts or completions.
41
+
42
+ ## Example line
43
+
44
+ One JSON object per line, UTF-8, no trailing whitespace. The `orchestration`
45
+ object is an additive extension on an otherwise standard audit-log-v1 line:
46
+
47
+ ```json
48
+ {"schema_version":1,"id":"01HXY...","ts":"2026-06-23T12:34:56Z","work_id":"PROJ-7-2026-06-23T12-30-00Z","phase":"implement","outcome":"success","confidence_band":"high","risk_class":"low","memory":{"asks":2,"hits":1},"verify":{"claims":1,"first_try_passes":1},"rules_applied":["verify-before-complete"],"persona":"backend","input_kind":"orchestration","type":"phase","orchestration":{"task_size_estimate":3,"spawn_count":2,"tiers":["sonnet","opus"],"token_delta":4200,"wall_clock_ms":18500,"outcome":"DONE","verify_mode":"deterministic"}}
49
+ ```
50
+
51
+ ## Related
52
+
53
+ - [`audit-log-v1`](../../../../docs/contracts/audit-log-v1.md) — the frozen
54
+ JSONL contract this object rides on; the `orchestration` field is optional
55
+ and additive, schema_version unchanged.
56
+ - [`host-capability-manifest`](host-capability-manifest.md) — the manifest that
57
+ decides whether a dispatch is even attempted; `spawn_count` and `tiers`
58
+ reflect what it enabled.
59
+ Phase-0 instrumentation belongs to.
@@ -259,9 +259,14 @@ Loop MUST:
259
259
  On picks 3 / 4 / 5 → apply change, re-evaluate decision table,
260
260
  archive when gate clears.
261
261
 
262
- `count_deferred == 0` → archive proceeds via
263
- [`roadmap-management`](../../skills/roadmap-management/SKILL.md) skill
264
- (`git mv`, regen).
262
+ `count_deferred == 0` → archive. **Primary:** `archive_completed_roadmaps --all`
263
+ — untracked-safe (`git mv`, or plain `mv` in a pre-first-commit / untracked
264
+ consumer), rewrites inbound refs (index when tracked, filesystem when not),
265
+ regens dashboard; PR-independent (gap B). **Fallback (script not vendored):**
266
+ emit a one-line vendor instruction (`agents:init`), then the manual procedure in
267
+ [`roadmap-management`](../../skills/roadmap-management/SKILL.md) (mkdir
268
+ `archive/`, `mv`, ref-rewrite, regen). NEVER silently `git mv` (fails on
269
+ untracked, leaves a completed roadmap rotting).
265
270
 
266
271
  ## Scope deltas — what each wrapper binds
267
272
 
@@ -0,0 +1,56 @@
1
+ # Subagent Response Contract (Phase 3 / A3)
2
+
3
+ The structured body a subagent returns inside the 4-status envelope. The status
4
+ ([`subagent-steering`](subagent-steering.md): `DONE` / `DONE_WITH_CONCERNS` /
5
+ `NEEDS_CONTEXT` / `BLOCKED`) stays the envelope; this is the **body** the
6
+ orchestrator synthesises and re-verifies.
7
+
8
+ ## Shape
9
+
10
+ ```json
11
+ {
12
+ "summary": "",
13
+ "findings": [{ "title": "", "evidence_refs": ["file:line | id | path"], "mutating": false }],
14
+ "risks": [],
15
+ "confidence": "low | medium | high",
16
+ "handoff": ""
17
+ }
18
+ ```
19
+
20
+ - **Refs, not bodies.** `evidence_refs` are ref tokens (`file:line`, ids, paths),
21
+ never inline content — same minimal-slice / privacy floor as the spawn contract.
22
+ - `mutating` marks a finding whose action changes files/state (feeds the verify link).
23
+
24
+ ## Orchestrator synthesis duties
25
+
26
+ ```
27
+ NEVER ADOPT A SUBAGENT RETURN UNVERIFIED.
28
+ ```
29
+
30
+ On collecting returns, the orchestrator MUST:
31
+
32
+ 1. **Dedupe** findings across subagents.
33
+ 2. **Mark contradictions** between returns (do not silently pick one).
34
+ 3. **Re-check evidence gaps** — a finding with no `evidence_refs` is an unbacked
35
+ claim; resolve it with a real tool before adopting (`synthesisGaps`).
36
+ 4. **Downgrade or reject** risky findings; the final decision is the orchestrator's.
37
+
38
+ ## Confidence → verify-budget link
39
+
40
+ A **mutating** finding returned at **`low`** confidence forces the full
41
+ cross-model judge path — no deterministic-only pass — per
42
+ [`verify-budget`](verify-budget.md) (`forcesJudge`). High-confidence trivial
43
+ findings may still take the deterministic path. The chosen `verify_mode` is
44
+ recorded in [`orchestration-telemetry`](orchestration-telemetry.md).
45
+
46
+ ## Reference implementation
47
+
48
+ [`src/scripts/_lib/subagent_response.ts`](../../../../src/scripts/_lib/subagent_response.ts)
49
+ (`validateResponse`, `synthesisGaps`, `forcesJudge`), covered by
50
+ [`tests/scripts/_lib_subagent_response.test.ts`](../../../../tests/scripts/_lib_subagent_response.test.ts).
51
+
52
+ ## Related
53
+
54
+ - [`subagent-steering`](subagent-steering.md) — the 4-status envelope + lifecycle this body rides in.
55
+ - [`verify-budget`](verify-budget.md) — the deterministic-vs-judge budget the confidence link feeds.
56
+ - [`verify-before-complete`](../../rules/verify-before-complete.md) — the Iron Law behind "never adopt unverified".
@@ -0,0 +1,57 @@
1
+ # Subagent Routing (Phase 2 — downshift + quota arbitrage)
2
+
3
+ How a delegated sub-task's model is chosen. The orchestrator stays on the
4
+ session / high tier and routes each sub-task to the **lowest-capable** tier it
5
+ declares (cost + speed via model downshift). Quota arbitrage is an optional
6
+ bonus layered on top. Vendor-neutral throughout — no `.md` here names a
7
+ provider's model or billing rule.
8
+
9
+ ## Inputs
10
+
11
+ - The sub-task's declared `model_tier` (`lite | medium | high | inherit`,
12
+ per [`model-recommendations`](../model-recommendations.md)).
13
+ - `subagents.downshift`, `subagents.quota_arbitrage`, `subagents.model_map`
14
+ (see [`auto-orchestration-activation`](auto-orchestration-activation.md)).
15
+ - The host-capability manifest's `separate_quota_pool`
16
+ ([`host-capability-manifest`](host-capability-manifest.md)).
17
+
18
+ ## Policy
19
+
20
+ ```
21
+ ORCHESTRATOR STAYS ON THE SESSION / HIGH TIER.
22
+ A SUB-TASK RUNS ON THE LOWEST-CAPABLE TIER IT DECLARES (downshift on).
23
+ QUOTA ARBITRAGE IS A BONUS, NEVER LOAD-BEARING — REMOVE IT AND ROUTING IS
24
+ THE SAME MINUS THE QUOTA WIN.
25
+ ```
26
+
27
+ 1. **Downshift off** (`downshift: false`) → every sub-task runs on the session
28
+ tier. No routing change.
29
+ 2. **Downshift on** → a sub-task runs on its declared tier; an `inherit` task
30
+ runs on the session tier. The tier resolves to a model alias via
31
+ `model_map`; an empty entry means "use the tier's runtime default" — never a
32
+ baked-in provider model name.
33
+ 3. **Quota arbitrage** → prefer the **separate** quota pool for the sub-task
34
+ **only when** `subagents.quota_arbitrage == true` **and**
35
+ `manifest.separate_quota_pool == true`. Otherwise the shared pool is used and
36
+ the tier/model choice is unchanged. This is the only place the
37
+ "Sonnet-has-its-own-allowance" idea lives, and it lives as a runtime-detected
38
+ flag, never as portable prose.
39
+
40
+ ## Why vendor-neutral
41
+
42
+ A separate-quota-pool is a billing quirk of one host at one time. Encoding it
43
+ as `manifest.separate_quota_pool` (resolved per host) keeps the package
44
+ portable: hosts without it route identically, just without the bonus. No skill,
45
+ rule, or context asserts "model X is free".
46
+
47
+ ## Reference implementation
48
+
49
+ [`src/scripts/_lib/subagent_routing.ts`](../../../../src/scripts/_lib/subagent_routing.ts)
50
+ (`resolveSubagentRouting`), covered by
51
+ [`tests/scripts/_lib_subagent_routing.test.ts`](../../../../tests/scripts/_lib_subagent_routing.test.ts).
52
+
53
+ ## Related
54
+
55
+ - [`subagent-configuration`](../subagent-configuration.md) — implementer/judge model + parallelism.
56
+ - [`auto-orchestration-activation`](auto-orchestration-activation.md) — the enable/auto gate that runs first.
57
+ - [`host-capability-manifest`](host-capability-manifest.md) — source of `separate_quota_pool`.
@@ -0,0 +1,54 @@
1
+ # Subagent Spawn Contract (Phase 3 — task-optimal configuration)
2
+
3
+ How a delegated subagent is configured for its task. Composes the package's
4
+ existing config seams — role-mode + profile + persona + a **minimal** knowledge
5
+ slice — into a single spawn brief, so each subagent reacts optimally to its
6
+ task without re-inventing any taxonomy.
7
+
8
+ ## The brief
9
+
10
+ ```json
11
+ {
12
+ "task": "<the sub-task>",
13
+ "role_mode": "developer|reviewer|tester|po|incident|planner|null",
14
+ "profile": "<active profile id or null>",
15
+ "personas": ["<persona id>", "..."],
16
+ "knowledge_refs": ["<id-or-path>", "..."]
17
+ }
18
+ ```
19
+
20
+ ## Selection — reuse existing seams, no new taxonomy
21
+
22
+ | Element | Source |
23
+ |---|---|
24
+ | `role_mode` | The six contracts in [`role-contracts`](../../../docs/guidelines/agent-infra/role-contracts.md). A review sub-task → `reviewer`; a planning sub-task → `planner`; default → null (no contract). |
25
+ | `profile` | The active profile (`profile.id` in `.agent-settings.yml`); inherited from the session unless the sub-task is a different domain. |
26
+ | `personas` | The persona ids already cited in the task's skill frontmatter (review lenses). Capped at 2 (`MAX_PERSONAS`). |
27
+ | `knowledge_refs` | A SMALL set of knowledge references (ingest ids / file paths) relevant to the sub-task. Capped at 5 (`MAX_KNOWLEDGE_REFS`). |
28
+
29
+ Nothing here defines a new role / persona / profile — it selects from what the
30
+ package already ships.
31
+
32
+ ## Minimal-slice — hard invariant
33
+
34
+ ```
35
+ KNOWLEDGE IS PASSED AS A FEW REFERENCES, NEVER AS INLINE BODIES.
36
+ NEVER BULK-DUMP CONTEXT INTO A SUBAGENT.
37
+ ```
38
+
39
+ Per [`lethal-trifecta-guard`](../../rules/lethal-trifecta-guard.md), the
40
+ private-data leg stays narrow: the composer rejects inline bodies (multi-line /
41
+ oversized entries), accepts only ref-like tokens, and caps the count. Anything
42
+ dropped is recorded in `warnings` and surfaced — never silently widened.
43
+
44
+ ## Reference implementation
45
+
46
+ [`src/scripts/_lib/subagent_spawn.ts`](../../../../src/scripts/_lib/subagent_spawn.ts)
47
+ (`composeSpawnBrief`), covered by
48
+ [`tests/scripts/_lib_subagent_spawn.test.ts`](../../../../tests/scripts/_lib_subagent_spawn.test.ts).
49
+
50
+ ## Related
51
+
52
+ - [`auto-orchestration-activation`](auto-orchestration-activation.md) — runs before this; decides IF a subagent spawns.
53
+ - [`subagent-routing`](subagent-routing.md) — decides WHICH model the subagent runs on.
54
+ - [`role-mode-adherence`](../../rules/role-mode-adherence.md) — the role contract a spawned `role_mode` must honour.
@@ -0,0 +1,71 @@
1
+ # Subagent Steering & Guardrails (Phase 5)
2
+
3
+ First-class lifecycle for auto-dispatched subagents, plus the guardrails that
4
+ keep "auto-dispatch by default" from becoming a token sink.
5
+
6
+ ## Lifecycle
7
+
8
+ ```
9
+ dispatch → monitor → status → escalate / kill
10
+ ```
11
+
12
+ - **dispatch** — spawn per the [`spawn contract`](subagent-spawn-contract.md),
13
+ routed per [`subagent-routing`](subagent-routing.md).
14
+ - **monitor** — where the host manifest reports `status_polling: true`, check
15
+ progress; otherwise fire-and-collect.
16
+ - **status** — every return uses the fixed 4-status envelope from
17
+ [`subagent-orchestration`](../../skills/subagent-orchestration/SKILL.md):
18
+ `DONE` · `DONE_WITH_CONCERNS` · `NEEDS_CONTEXT` · `BLOCKED`.
19
+ - **escalate / kill** — the orchestrator may kill a runaway subagent and
20
+ escalate to the user. **The orchestrator never merges autonomously** —
21
+ integration is the orchestrator's call after verification, never the
22
+ subagent's.
23
+
24
+ ## Budget + parallel cap
25
+
26
+ - The N=3 autonomous budget (`autonomous-execution`) binds **per validation
27
+ target**: three consecutive failed attempts on the same target halts the run
28
+ and surfaces the three attempts. `budgetHalt()` is the deterministic counter.
29
+ - `subagents.max_parallel` caps concurrent dispatch. No speculative fan-out:
30
+ a subagent is spawned only for a classified-delegable target, never on spec.
31
+
32
+ ## Rollback guardrails — surfaced, not auto-disabled
33
+
34
+ ```
35
+ A CONFIG PACKAGE RUNS NO DAEMON. THERE IS NO AUTOMATIC COHORT-DISABLE.
36
+ BREACHES ARE SURFACED FROM THE AUDIT LOG FOR THE MAINTAINER / USER TO ACT ON.
37
+ THE ONLY AUTOMATIC STOP IS THE PER-TARGET N=3 BUDGET.
38
+ ```
39
+
40
+ The guardrail thresholds (`breachedGuardrails()`), read off the
41
+ [`orchestration-telemetry`](orchestration-telemetry.md) audit signals:
42
+
43
+ | Signal | Threshold | Meaning when breached |
44
+ |---|---|---|
45
+ | `token_blowup` | spend > 2× single-agent baseline | the layer is costing more than it saves |
46
+ | `spawn_failure` | > 10% of spawns fail | host/primitive instability — degrade to single-agent |
47
+ | `verify_skip` | > 1% complete without required verification | safety gap — investigate immediately |
48
+ | `user_override` | > 30% of users set the layer off | the default is wrong for this population |
49
+
50
+ A breach is a maintainer/user signal, surfaced — never an automatic flip.
51
+
52
+ ## Kill-switch
53
+
54
+ ```
55
+ subagents.enabled: false (or subagents.auto: off)
56
+ ```
57
+
58
+ A single, no-deploy settings flip fully disables the layer (`isLayerDisabled()`).
59
+ This is the canonical disable — no code change, effective on the next run.
60
+
61
+ ## Reference implementation
62
+
63
+ [`src/scripts/_lib/subagent_steering.ts`](../../../../src/scripts/_lib/subagent_steering.ts)
64
+ (`isLayerDisabled`, `budgetHalt`, `breachedGuardrails`), covered by
65
+ [`tests/scripts/_lib_subagent_steering.test.ts`](../../../../tests/scripts/_lib_subagent_steering.test.ts).
66
+
67
+ ## Related
68
+
69
+ - [`autonomous-execution`](../../rules/autonomous-execution.md) — the N=3 budget.
70
+ - [`auto-orchestration-activation`](auto-orchestration-activation.md) — `enabled`/`auto` keys.
71
+ - [`orchestration-telemetry`](orchestration-telemetry.md) — the audit signals the guardrails read.
@@ -0,0 +1,50 @@
1
+ # Verification Budget (Phase 4)
2
+
3
+ How auto-delegated work is verified without double-costing every trivial
4
+ delegation. Preserves `verify-before-complete` and the cross-model judge Iron
5
+ Law of [`subagent-orchestration`](../../skills/subagent-orchestration/SKILL.md),
6
+ while letting trivial sub-tasks skip a full LLM judge pass.
7
+
8
+ ## The budget
9
+
10
+ ```
11
+ TRIVIAL (below the change-size floor, read-only / no file writes)
12
+ → DETERMINISTIC verification: diff + dry-run + structural checks. No LLM judge.
13
+ OTHERWISE
14
+ → FULL CROSS-MODEL JUDGE (judge on a different model than the implementer).
15
+ A REQUIRED VERIFICATION THAT DID NOT RUN IS A SURFACED SAFETY GAP — NEVER A
16
+ SILENT PASS.
17
+ ```
18
+
19
+ The change-size floor (`TRIVIAL_CHANGE_FLOOR`) is the line at which the cost of
20
+ a judge pass exceeds its benefit. Read-only sub-tasks (queries, analysis with no
21
+ mutation) always verify deterministically — there is nothing to mis-write.
22
+
23
+ ## Recording + the gap check
24
+
25
+ Every dispatch records its `verify_mode` (`deterministic` | `judge` | `none`)
26
+ in the [`orchestration-telemetry`](orchestration-telemetry.md) object on the
27
+ audit-log line. After a dispatch, the orchestrator compares the **required**
28
+ mode (from the change shape) against the **recorded** mode; a required
29
+ verification recorded as `none`, or a non-trivial change verified only
30
+ deterministically, is a **gap** that is surfaced to the user — it never passes
31
+ silently. This is the audit-visible enforcement of the Iron Law.
32
+
33
+ ## Why this does not weaken the floor
34
+
35
+ `deterministic` is still verification — a real diff + dry-run + structural
36
+ check, not "skip it". The judge Iron Law still fires on every non-trivial,
37
+ mutating change. The budget only removes a redundant LLM pass on changes too
38
+ small to carry risk, where the deterministic check is sufficient evidence.
39
+
40
+ ## Reference implementation
41
+
42
+ [`src/scripts/_lib/verify_budget.ts`](../../../../src/scripts/_lib/verify_budget.ts)
43
+ (`selectVerifyMode`, `verificationGap`), covered by
44
+ [`tests/scripts/_lib_verify_budget.test.ts`](../../../../tests/scripts/_lib_verify_budget.test.ts).
45
+
46
+ ## Related
47
+
48
+ - [`verify-before-complete`](../../rules/verify-before-complete.md) — the Iron Law this preserves.
49
+ - [`subagent-orchestration`](../../skills/subagent-orchestration/SKILL.md) — the cross-model judge law.
50
+ - [`orchestration-telemetry`](orchestration-telemetry.md) — where `verify_mode` is recorded.
@@ -51,7 +51,17 @@ corpus from quietly replacing a value the brand already defines.
51
51
  marked as corpus-sourced, until `brand-identity` defines real tokens.
52
52
  - Non-brand surfaces.
53
53
 
54
+ ## Design register note
55
+
56
+ When a consumer brand profile is present, the brand register ("the impression IS
57
+ the product") is active — use `brand-identity`, `iconography`, and
58
+ `design-intelligence` as the primary skill cluster. For product/dashboard/admin
59
+ surfaces within the same brand, the product register ("design serves the task")
60
+ may apply per-surface. See [`docs/guidelines/design-modes.md`](../docs/guidelines/design-modes.md)
61
+ for the full Brand-mode vs Product-mode discriminator.
62
+
54
63
  ## See also
55
64
 
56
65
  - [`brand-consistency`](brand-consistency.md) — validates emitted artifacts against the authoritative brand profile this rule establishes.
57
66
  - [`brand`](../skills/brand/SKILL.md) — the gap-fill corpus this rule subordinates to consumer brand.
67
+ - [`docs/guidelines/design-modes.md`](../docs/guidelines/design-modes.md) — brand vs product register discriminator and routing.
@@ -0,0 +1,85 @@
1
+ ---
2
+ type: "auto"
3
+ tier: "2b"
4
+ alwaysApply: false
5
+ source: "package"
6
+ description: "Delegable multi-part work + auto-orchestration enabled — decompose, tier-size each slice, dispatch to subagents instead of doing it all in-session"
7
+ triggers:
8
+ - keyword: "delegate"
9
+ - keyword: "orchestrate"
10
+ - keyword: "subagent"
11
+ - keyword: "parallel"
12
+ - phrase: "review these"
13
+ - phrase: "analyze the codebase"
14
+ - phrase: "for each"
15
+ load_context:
16
+ - "../contexts/execution/auto-orchestration-activation.md"
17
+ - "../contexts/execution/auto-dispatch-classification.md"
18
+ routes_to:
19
+ - "skill:subagent-orchestration"
20
+ workspaces:
21
+ - engineering
22
+ packs:
23
+ - engineering-base
24
+ ---
25
+
26
+ # Delegation Policy
27
+
28
+ The loadable auto-trigger for the automatic subagent-orchestration layer. It is
29
+ the single source of the "delegate by default" behaviour — the
30
+ `subagent-orchestration` skill and `reasoning-orchestrator` point here rather
31
+ than restating the trigger.
32
+
33
+ ## The Iron Law
34
+
35
+ ```
36
+ WHEN THE ACTIVATION GATE CLEARS, DECOMPOSE THE TASK, TIER-SIZE EACH SLICE,
37
+ AND DISPATCH TO SUBAGENTS — DO NOT DO ALL THE WORK IN-SESSION.
38
+ AMBIGUITY DEFAULTS TO ask / no-op — NEVER SPECULATIVE SPAWN.
39
+ THE ORCHESTRATOR NEVER ADOPTS A SUBAGENT RETURN UNVERIFIED.
40
+ ```
41
+
42
+ ## When it fires
43
+
44
+ Only when the activation gate from
45
+ [`auto-orchestration-activation`](../contexts/execution/auto-orchestration-activation.md)
46
+ clears — all of:
47
+
48
+ - `subagents.enabled` **and** `subagents.auto != off`,
49
+ - the host-capability manifest reports `subagent_spawn: true`,
50
+ - the task is classified **delegable** per
51
+ [`auto-dispatch-classification`](../contexts/execution/auto-dispatch-classification.md)
52
+ (≥1 independent, well-specified slice above the size floor).
53
+
54
+ `subagents.auto: ask` → ask once before dispatching (per
55
+ [`user-interaction`](user-interaction.md)); `auto: on` → surface the chosen mode
56
+ + per-subtask tiers in one line. Any gate failing, or `auto: off`, or no host
57
+ primitive → run in-session (clean no-op).
58
+
59
+ ## What it makes binding
60
+
61
+ 1. **Decompose** the task into independent / ordered slices.
62
+ 2. **Tier-size** each slice (`lite|medium|high`) per the classification context —
63
+ never the orchestrator's own session tier (the cost win is the per-call
64
+ downsize; see [`subagent-routing`](../contexts/execution/subagent-routing.md)).
65
+ 3. **Dispatch** via the matching `subagent-orchestration` mode (independent →
66
+ do-in-parallel; ordered → do-in-steps; risk/correctness → + judge).
67
+ 4. **Verify** every return per
68
+ [`verify-budget`](../contexts/execution/verify-budget.md); the cross-model
69
+ judge Iron Law and the N=3 budget ([`autonomous-execution`](autonomous-execution.md))
70
+ are never lifted.
71
+
72
+ ## Scope — does NOT
73
+
74
+ - Make the orchestrator switch its **own** model (the user owns `/model`).
75
+ - Fire on trivial / single-step / fully-in-head work.
76
+ - Spawn on an unclassifiable task — that is ask/no-op, not a speculative spawn.
77
+ - Lift any safety floor or delegate a Hard-Floor action
78
+ ([`non-destructive-by-default`](non-destructive-by-default.md)).
79
+
80
+ ## See also
81
+
82
+ - [`subagent-orchestration`](../skills/subagent-orchestration/SKILL.md) — the 7 modes this selects.
83
+ - [`subagent-boundary`](../docs/contracts/subagent-boundary.md) — what a subagent owns vs never owns (task-meaning, memory, pack-surface, safety-floor bypass).
84
+ - [`auto-orchestration-activation`](../contexts/execution/auto-orchestration-activation.md) — the gate.
85
+ - [`reasoning-orchestrator`](../skills/reasoning-orchestrator/SKILL.md) — RDP dispatch, now gated here.