@chrono-meta/fh-gate 1.0.3 → 1.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 (69) hide show
  1. package/.claude/agents/challenger.md +169 -0
  2. package/AGENTS.md +160 -0
  3. package/CATALOG.md +256 -0
  4. package/CHEATSHEET.md +367 -0
  5. package/CLAUDE.md +331 -0
  6. package/CONTRIBUTING.md +198 -0
  7. package/LICENSE +21 -0
  8. package/README.md +131 -418
  9. package/bin/fh-goal.js +9 -0
  10. package/bin/fh-run.js +9 -0
  11. package/docs/banner.png +0 -0
  12. package/docs/codex-compat.md +123 -0
  13. package/docs/pillars.svg +70 -0
  14. package/knowledge/shared/harness-core/fh_integration_contract.md +48 -29
  15. package/package.json +31 -6
  16. package/plugins/fh-commons/README.md +37 -0
  17. package/plugins/fh-commons/agents/quench-challenger.md +373 -0
  18. package/plugins/fh-commons/skills/convergence-loop/SKILL.md +155 -0
  19. package/plugins/fh-commons/skills/deliberation/SKILL.md +288 -0
  20. package/plugins/fh-commons/skills/mcp-circuit-breaker/SKILL.md +196 -0
  21. package/plugins/fh-commons/skills/token-budget-gate/SKILL.md +175 -0
  22. package/plugins/fh-meta/agents/fact-checker.md +121 -0
  23. package/plugins/fh-meta/agents/hub-persona-auditor.md +109 -0
  24. package/plugins/fh-meta/agents/persona-innovator.md +195 -0
  25. package/plugins/fh-meta/skills/agent-composer/SKILL.md +461 -0
  26. package/plugins/fh-meta/skills/agent-composer/SKILL_detail.md +464 -0
  27. package/plugins/fh-meta/skills/apex-review/SKILL.md +185 -0
  28. package/plugins/fh-meta/skills/asset-placement-gate/SKILL.md +135 -0
  29. package/plugins/fh-meta/skills/contention-layer/SKILL.md +127 -0
  30. package/plugins/fh-meta/skills/context-bridge-dispatch/SKILL.md +30 -0
  31. package/plugins/fh-meta/skills/context-bridge-dispatch/SKILL_detail.md +144 -0
  32. package/plugins/fh-meta/skills/context-doctor/SKILL.md +341 -0
  33. package/plugins/fh-meta/skills/cross-ecosystem-synergy-detection/SKILL.md +202 -0
  34. package/plugins/fh-meta/skills/deep-clarify/SKILL.md +144 -0
  35. package/plugins/fh-meta/skills/edit-manifest/SKILL.md +210 -0
  36. package/plugins/fh-meta/skills/field-harvest/SKILL.md +384 -0
  37. package/plugins/fh-meta/skills/frontier-digest/SKILL.md +272 -0
  38. package/plugins/fh-meta/skills/goal-quench/SKILL.md +509 -0
  39. package/plugins/fh-meta/skills/harness-doctor/SKILL.md +277 -0
  40. package/plugins/fh-meta/skills/harness-doctor/SKILL_detail.md +484 -0
  41. package/plugins/fh-meta/skills/harvest-loop/SKILL.md +231 -0
  42. package/plugins/fh-meta/skills/harvest-loop/SKILL_detail.md +201 -0
  43. package/plugins/fh-meta/skills/hub-cc-pr-reviewer/SKILL.md +129 -0
  44. package/plugins/fh-meta/skills/hub-cc-pr-reviewer/SKILL_detail.md +158 -0
  45. package/plugins/fh-meta/skills/install-doctor/SKILL.md +207 -0
  46. package/plugins/fh-meta/skills/install-wizard/SKILL.md +613 -0
  47. package/plugins/fh-meta/skills/marketplace-gate/SKILL.md +193 -0
  48. package/plugins/fh-meta/skills/memory-hygiene/SKILL.md +143 -0
  49. package/plugins/fh-meta/skills/meta-prompt-builder/SKILL.md +167 -0
  50. package/plugins/fh-meta/skills/meta-prompt-builder/SKILL_detail.md +37 -0
  51. package/plugins/fh-meta/skills/pipeline-conductor/SKILL.md +430 -0
  52. package/plugins/fh-meta/skills/plugin-recommender/SKILL.md +221 -0
  53. package/plugins/fh-meta/skills/plugin-recommender/SKILL_detail.md +220 -0
  54. package/plugins/fh-meta/skills/prompt-regression/SKILL.md +178 -0
  55. package/plugins/fh-meta/skills/public-surface-audit/SKILL.md +224 -0
  56. package/plugins/fh-meta/skills/return-path-gate/SKILL.md +257 -0
  57. package/plugins/fh-meta/skills/self-marketing-lint/SKILL.md +129 -0
  58. package/plugins/fh-meta/skills/sim-conductor/SKILL.md +364 -0
  59. package/plugins/fh-meta/skills/sim-conductor/SKILL_detail.md +337 -0
  60. package/plugins/fh-meta/skills/skill-splitter/SKILL.md +126 -0
  61. package/plugins/fh-meta/skills/skill-splitter/SKILL_detail.md +185 -0
  62. package/plugins/fh-meta/skills/source-grounding-audit/SKILL.md +230 -0
  63. package/plugins/fh-meta/skills/source-grounding-audit/SKILL_detail.md +182 -0
  64. package/plugins/fh-meta/skills/steel-quench/SKILL.md +226 -0
  65. package/plugins/fh-meta/skills/steel-quench/SKILL_detail.md +453 -0
  66. package/plugins/fh-meta/skills/verify-bidirectional/SKILL.md +238 -0
  67. package/scripts/fh-gate.sh +175 -40
  68. package/scripts/fh-goal.sh +182 -0
  69. package/scripts/fh-run.sh +269 -0
@@ -0,0 +1,461 @@
1
+ ---
2
+ name: agent-composer
3
+ description: Reads the current work context and plans the optimal agent dispatch. Clarifies direction with 1-2 questions when unclear; infers and proceeds immediately when execution path is unclear. Runs an automatic recording gate after each Wave completes. Triggered by "compose agents", "which agent should I use?", "run in parallel", or "agent-composer".
4
+ user-invocable: true
5
+ allowed-tools: ["Read", "Bash", "Glob", "Grep"]
6
+ model: opus
7
+ ---
8
+
9
+ # agent-composer — Agent Composition Layer
10
+
11
+ A coordinator skill that reads the work context and decides "which agents to dispatch, when, and in what order."
12
+ Selects the optimal combination from the FH skill pool and either outputs a fan-out plan or executes it directly.
13
+
14
+ ## Triggers
15
+
16
+ - `/agent-composer`
17
+ - "Which agent should I use?", "Pick one automatically", "Compose the agents"
18
+ - "Set up the agents", "Decide which agents to use"
19
+ - "Split the work and run in parallel", "Process with multiple agents"
20
+ - "Build the dispatch plan", "Run in parallel splits"
21
+ - When the task is complex or spans multiple projects
22
+
23
+ ## Core Principles
24
+
25
+ - **Compose only**: Does not perform work directly. Outputs the dispatch plan and executes after user approval.
26
+ - **Parallel first**: When 2+ tasks are independent, propose parallel fan-out instead of sequential.
27
+ - **Minimal composition**: Only the agents needed. Over-provisioning agents creates inefficiency.
28
+ - **Coordinator ≠ executor**: Only collects results (fan-in) and presents an integrated report.
29
+
30
+ ---
31
+
32
+ ## Step 0. Context Collection
33
+
34
+ Identify 4 items from the request: task type · scope · constraints · natural-language goal → skill mapping.
35
+ Check `LOCAL_SKILL_REGISTRY.md` for project-local skills; check `.mcp.json` or `CLAUDE.md` for external plugins.
36
+
37
+ > **Detail**: See `SKILL_detail.md §Step-0` — NL pattern mapping table, cross-install detection, registry lookup format — read when auto-mapping an ambiguous request.
38
+
39
+ ---
40
+
41
+ ## Step 0.2 — Capability Fit Analysis
42
+
43
+ > **Schema**: `knowledge/shared/harness-core/tpa_schema.md` — `artifact_type` enum determines `role_match` lookup domain for scoring.
44
+ > Runs before dispatching agents. **Skip if user specifies exact agents by name.**
45
+
46
+ For each subtask in the composition plan:
47
+
48
+ 1. **Read agent registry**: `.claude/agents/*.md` + installed plugin agents
49
+ Extract: `role` · `allowed_tools` · `writes` · `declared_capabilities`
50
+ 2. **Score capability fit**: `[subtask_type]` × `[agent capabilities]` → `fit_score` (0.0–1.0)
51
+ 3. **GAP**: `fit_score < 0.5` for a required-weight subtask
52
+ → query `/plugin-recommender`: "agent for [subtask_type] in [context]"
53
+ → includes Codex marketplace + Claude Code marketplace (not just FH native)
54
+ → user: **install** / **skip** / **use general-purpose fallback**
55
+
56
+ ### Capability Fit Scoring Table
57
+
58
+ | Subtask type | Strong fit signal | Weak fit signal |
59
+ |---|---|---|
60
+ | Adversarial review | `subagent_type="challenger"`, artifact_type match | general-purpose only |
61
+ | Phantom detection | `source-grounding-audit` | general-purpose only |
62
+ | Persona simulation | `hub-persona-auditor`, deep-insight persona | general-purpose only |
63
+ | Code generation | `writes: true` + code tools | `writes: false` or no code tools |
64
+ | Audit-only | `writes: false` (safe) | `writes: true` (risky for audit) |
65
+
66
+ **Behavioral rule**: A `writes: false` agent (e.g. fact-checker, hub-persona-auditor) must NOT be assigned a task requiring edits. Capability fit scoring catches this statically before dispatch.
67
+
68
+ **Behavioral rule**: Degraded composition — when any required-weight role is filled with general-purpose fallback, output `⚠️ degraded: [role]` in the composition plan. Do not silently use general-purpose for a specialized role.
69
+
70
+ > **Detail**: See `SKILL_detail.md §CapabilityFit` — scoring procedure, agent registry reading, plugin-recommender query format, worked examples — read when executing Step 0.2.
71
+
72
+ ---
73
+
74
+ ## Step 0-a. Clarification Protocol
75
+
76
+ > Execution condition: Only when direction or goal is unclear (skip → go directly to Step 0-b if clear)
77
+
78
+ **Core principle**: Only ask when what the person must provide (direction · insight · decision) is unclear.
79
+ Execution method · agent selection · recording location → infer and proceed — do not ask.
80
+
81
+ ### Direction vs. Execution Decision Table
82
+
83
+ | Request type | Classification | Action |
84
+ |---|---|---|
85
+ | "Do X" — target and completion criteria are clear | Clear | Immediately enter Step 0-b |
86
+ | "Improve X" — improvement dimension unclear | Direction unclear | Ask for clarification |
87
+ | "Something feels off" — diagnosis target unclear | Execution unclear → infer | Auto-dispatch harness-doctor |
88
+ | "Run the pipeline" — trigger is clear | Clear | Run harvest-loop based on recent work |
89
+ | No request — session context exists | Execution unclear → infer | Auto-compose based on CATALOG/MEMORY, then confirm |
90
+
91
+ > **Detail**: See `SKILL_detail.md §Clarification` — 2-question format, 4-question structured confirmation, meta-prompting intervention — read when direction ambiguity requires a clarification block.
92
+
93
+ ---
94
+
95
+ ## Step 0-b. Wave 0 — Reconnaissance Dispatch (Mandatory Before New Tasks)
96
+
97
+ > Execution condition: For cross-project tasks or when scope is unclear. Skip for single-project tasks with clear scope.
98
+
99
+ This orchestrator does not read files or understand structure directly — **even reconnaissance work is dispatched as agents.** All tasks including new assets → fact-checker (A) mandatory in Wave 0.
100
+
101
+ > **Detail**: See `SKILL_detail.md §Wave-0` — self-contained brief requirements, deferred ToolSearch pre-requisite pattern — read when writing a recon agent brief.
102
+
103
+ ---
104
+
105
+ ## Step 1. Agent Mapping
106
+
107
+ Default composition table by task type.
108
+
109
+ > **Note**: This table lists known installed agents. Capability fit scoring in Step 0.2 overrides static mapping when `agent_cards.json` has more current data.
110
+
111
+ > **Call method distinction**: `(S)` = Skill tool call / `(A)` = Background dispatch via Agent tool
112
+
113
+ | Task type | Default composition | Parallel |
114
+ |---|---|:---:|
115
+ | **[Wave 0] Recon (all tasks)** | Recon agent (A) — file/structure understanding. Direct orchestrator execution forbidden | — |
116
+ | **[Wave 0] All tasks including new assets** | fact-checker (A) — proactive duplicate/stale validation | — |
117
+ | Meta-simulation quality validation | sim-conductor (S) — devil-advocate + newcomer + power-user | ✅ Parallel |
118
+ | Field pattern harvest | field-harvest (S) | — |
119
+ | Harness structural diagnosis | harness-doctor (S) | — |
120
+ | New asset placement decision | asset-placement-gate (S) | — |
121
+ | External user entry point audit | hub-persona-auditor (A) | — |
122
+ | Naming/innovation scan | persona-innovator (A) | — |
123
+ | Cross-project simultaneous work | N field agents (A) | ✅ Parallel |
124
+ | Three-Doctor Loop | harness-doctor (S) + context-doctor (S) + sim-conductor (S) | ✅ Parallel |
125
+ | Pre-PR code review | sim-conductor D-code 3 personas (S) | ✅ Parallel |
126
+ | Learning cross-validation | verify-bidirectional (S) | — |
127
+ | Ecosystem synergy exploration | cross-ecosystem-synergy-detection (S) | — |
128
+ | Plugin recommendation | plugin-recommender (S) | — |
129
+ | Install conflict diagnosis | install-doctor (S) | — |
130
+ | Onboarding install | install-wizard (S) — ⚠️ interactive; `--dry-run` for bg parallel | — |
131
+ | Hub PR review | hub-cc-pr-reviewer (S) — requires PR number first | — |
132
+ | **Decision-maker approval review** | apex-review (S) — CTO/tech lead/QA lead personas + HTML deck | — |
133
+ | **Project local skills** | LOCAL_SKILL_REGISTRY lookup → relevant project skill (A/S) | Per project |
134
+
135
+ ---
136
+
137
+ ## Step 2. Composition Plan Output
138
+
139
+ ```
140
+ agent-composer — Composition Plan
141
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
142
+ Task: {task summary}
143
+ Composition: {N} agents | Parallel: {Y/N} | Estimated time: ~{N} min
144
+
145
+ Wave 0 (Recon):
146
+ [R] Recon agent — {file/structure understanding goal}
147
+
148
+ Wave 1 (Parallel):
149
+ [A] {agent name} — {role in 1 line}
150
+ [B] {agent name} — {role in 1 line}
151
+
152
+ Wave 2 (after Wave 1 completes):
153
+ [D] {agent name} — {executed after result integration}
154
+
155
+ fan-in: integrate results after Wave completes → output report
156
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
157
+ Execute? (Y: run all / E: edit then run / N: cancel)
158
+ ```
159
+
160
+ ---
161
+
162
+ ## Step 2.5 — Model Routing Decision (complexity_routing)
163
+
164
+ ### Routing Rules
165
+
166
+ 1. No `complexity_routing` in skill frontmatter → use `model:` field as-is
167
+ 2. `complexity_routing` present + any `escalate_when` condition matches → use `high` model
168
+ 3. No conditions match → use `base` model
169
+
170
+ Include 1-line routing audit in composition plan output: `[Model routing] harness-doctor: cold_start → opus`
171
+
172
+ ### Default Architecture
173
+
174
+ | Mode | Orchestrator | Executor | When |
175
+ |---|---|---|---|
176
+ | **Base** | sonnet | sonnet | Default — all tasks |
177
+ | **Amplified** | opus | sonnet | `EXECUTION_TIER: full/max` · plan mode · `cross_project` + `high_stakes` both detected |
178
+
179
+ **Simplification guard**: Single-Wave, single-project tasks → Sonnet sufficient. Do not escalate.
180
+
181
+ > **Detail**: See `SKILL_detail.md §Model-Routing` — escalation condition evaluation table, amplified audit log format.
182
+
183
+ ---
184
+
185
+ ## Step 2.7 — Destructive Action Gate
186
+
187
+ After scanning the composition plan, if any of the following types are found, mark with 🚨 and output a separate warning before Step 3.
188
+
189
+ | Type | Examples |
190
+ |---|---|
191
+ | External send | git push/force, PR create/merge, Slack/wiki upload |
192
+ | File/data destruction | rm -rf, DB DROP/DELETE, file overwrite, branch delete |
193
+ | Production impact | Service deploy, migration, permission/config changes |
194
+
195
+ If 🚨 items exist, insert before the standard Y/E/N in Step 3:
196
+
197
+ ```
198
+ ⚠️ Irreversible operations are included:
199
+ - [type] [specific operation]
200
+ Do you want to proceed? (yes / no)
201
+ ```
202
+
203
+ `no` → remove that operation or cancel entirely. Safe remaining operations can continue.
204
+
205
+ ---
206
+
207
+ ## Step 3. Approval → Execution
208
+
209
+ - **Y**: Execute immediately. Generate Context Cards (Step 3-a), then dispatch parallel agents in a single message.
210
+ - **E**: User modifies plan then re-confirms.
211
+ - **N**: Cancel.
212
+
213
+ > **Detail**: See `SKILL_detail.md §Worktree-Isolation` — Step 3.1 parallel proposal mode with git worktree isolation — read when 2+ agents write to overlapping files.
214
+
215
+ ### Step 3-runtime. Dispatch Runtime Selection
216
+
217
+ Use the runtime available in the current session:
218
+
219
+ | Runtime | Dispatch mechanism |
220
+ |---|---|
221
+ | Claude Code | `Agent(...)` for agents, slash/skill invocation for skills |
222
+ | Codex-primary | `FH_BACKEND=codex npx --package @chrono-meta/fh-gate fh-run --agent {agent}` or `--skill {skill}` |
223
+ | Generic shell | `FH_BACKEND=auto npx --package @chrono-meta/fh-gate fh-run ...` |
224
+
225
+ When using `fh-run`, pass each agent's Context Card through `--prompt` and pass target files with repeated `--file` arguments. The fan-in obligation is unchanged: collect each adapter output, then synthesize one integrated report before proceeding to the next wave.
226
+
227
+ ### Step 3-a. Context Card Injection (required for 2+ parallel agents)
228
+
229
+ Sub-agents are spawned in isolation — they cannot see the live conversation. Inject a Context Card into each agent prompt before dispatch to prevent context blindness (duplicate work, stale direction, missing constraints).
230
+
231
+ **N≤2 (standard)**:
232
+ ```
233
+ [Session Context Card]
234
+ Purpose: {session goal}
235
+ Completed: {done items + file paths — agent must know to avoid duplication}
236
+ This agent's task: {specific task for this agent}
237
+ Note: {constraints / history the agent must know}
238
+ ```
239
+
240
+ **N≥3 (Registry mode — DACS-inspired, arXiv:2604.07911)**:
241
+ ```
242
+ [Session Context Card]
243
+ Purpose: {session goal}
244
+ Completed: {done items + file paths}
245
+ This agent's task: {specific task}
246
+ Note: {constraints}
247
+
248
+ [Agent Registry]
249
+ Agent-1 ({role}): {≤1 sentence — what it's doing, key files}
250
+ Agent-2 ({role}): {≤1 sentence}
251
+ ... (all agents except this one)
252
+ ```
253
+ Total Registry ≤200 tokens. Each agent receives its own full card + compressed view of all other agents.
254
+
255
+ **Coordination-overhead budget** (apply before each Wave):
256
+
257
+ | Rule | Constraint |
258
+ |---|---|
259
+ | **Per-wave fan-out cap** | ≤4 agents per dispatch wave. Above 4: decompose hierarchically (supervisor → sub-waves), not flat fan-out |
260
+ | **Capability-aware routing** | Match each subtask to agent's `role` + `allowed_tools` + `writes`. Never dispatch a `writes: false` audit agent (e.g., fact-checker, hub-persona-auditor) for a task requiring edits |
261
+
262
+ Rationale: orchestrator-worker coordination adds ~+285% token overhead at N≥5 flat fan-out (DACS, arXiv:2604.07911). Sub-waves amortize this.
263
+
264
+ **Focus Mode** (N≥3, on-demand only): When an agent signals `"Need full context from Agent-X to proceed"` → re-dispatch that agent with Agent-X's full Context Card + Registry-compressed view of others. Use only when genuinely needed — adds one round-trip.
265
+
266
+ **Omit card**: Simple read-only lookup agents with no context dependency may skip injection.
267
+
268
+ ---
269
+
270
+ ## Step 3.5 — Inter-Wave Adaptation Check (Runtime Adaptation)
271
+
272
+ After Wave N completes, before Wave N+1, evaluate:
273
+
274
+ **① Premise Reversal** — Does Wave N result reverse a Wave N+1 premise? → revise plan, confirm with user
275
+ **② Repeated Failure** — Same agent failed 2+ times? → exclude + suggest replacement
276
+ **③ Early-Harvest Trigger** — 3+ new patterns discovered? → propose mini-harvest before Wave N+1
277
+
278
+ **Simplification guard**: Skip for simple tasks with only one Wave (Wave 0 + Wave 1).
279
+
280
+ > **Detail**: See `SKILL_detail.md §Wave-Adaptation` — adaptation check output format.
281
+
282
+ ---
283
+
284
+ ## Step 4. fan-in — Result Integration
285
+
286
+ > **M/S/R tier criteria**: M = blocks external user entry / structural conflict / immediate action required · S = feature degradation / address within next session · R = improvement value / backlog
287
+
288
+ Each agent finding must satisfy the **loom fan-in contract** (3 fields minimum): `tier | location | fix suggestion`. Results not meeting this format → mark "format non-compliant" and re-request or skip.
289
+
290
+ Integrate results into M/S/R tiers → output completion report:
291
+
292
+ ```
293
+ agent-composer — Complete
294
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
295
+ Executed: {N} | Time: ~{N} min | Parallel gain: {N}x vs sequential
296
+ M: {N} items → [action suggestion]
297
+ S: {N} items → backlog
298
+ R: {N} items → backlog
299
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
300
+ ```
301
+
302
+ > **Detail**: See `SKILL_detail.md §fan-in-Contract` — per-row format spec, format non-compliant handling.
303
+
304
+ ---
305
+
306
+ ## Step 4-b. State Transition Gate
307
+
308
+ After fan-in report, evaluate conditions and auto-suggest the next Wave:
309
+
310
+ | Condition | Wave suggestion |
311
+ |---|---|
312
+ | ① M-tier > 0 | **Wave next-M**: fact-checker (A) → hub-cc-pr-reviewer (S) |
313
+ | ② persona-innovator naming candidates > 0 | **Wave next-I**: delegate to user + asset-placement-gate (S) |
314
+ | ③ External absorption signal High > 0 | **Wave next-E**: persona-innovator Mode E (A) + meta-prompt-builder (S) |
315
+ | ⑤ Design conflict / 2+ conflicting suggestions | **Wave next-D**: deliberation (S) — verdict folds back into Step 4-b |
316
+ | ④ All 0 | **End**: "backlog only, defer to next session" |
317
+
318
+ Naming/direction/deliberation decisions: auto-execution forbidden — user confirmation required.
319
+
320
+ ---
321
+
322
+ ## Step 4-c. Auto-Recording Gate
323
+
324
+ | Condition | Auto action |
325
+ |---|---|
326
+ | 2+ new files created or 3+ existing files changed, **or M-tier resolved** | harvest-loop lightweight mode (field-harvest → contention → verify-bidirectional) |
327
+ | Architecture/direction decision made | "Record this decision? [1-line summary]" — save after confirmation |
328
+ | None of the above | Fall back to field-harvest proposal |
329
+
330
+ Auto-recording allowed scope: file change lists + execution results. Decision content and naming require confirmation.
331
+
332
+ > **Detail**: See `SKILL_detail.md §Auto-Recording` — Wave execution recording format, harvest-loop lightweight mode pipeline, human decision gate.
333
+
334
+ ---
335
+
336
+ ## Step 5. Wave 4 — Final Judgment Gate
337
+
338
+ Execute after all Waves 0~3 complete. Auto-skip for simple exploration or planning tasks.
339
+
340
+ ### Judgment Logic
341
+
342
+ ```
343
+ IF M-tier == 0 AND S-tier < 3:
344
+ → PASS (merge approved)
345
+ ELIF M-tier >= 1:
346
+ → BLOCK (immediate fix required)
347
+ ELSE: # M-tier == 0 AND S-tier >= 3
348
+ → PASS (S-tier allows backlog — not a merge block reason)
349
+ ```
350
+
351
+ | Judgment | Auto-proposal |
352
+ |---|---|
353
+ | **PASS** | field-harvest proposal: "Are there patterns to harvest from this Wave?" |
354
+ | **BLOCK** | Fix M-tier items → suggest re-entry into Wave 1 |
355
+
356
+ > **Detail**: See `SKILL_detail.md §Wave4` — entry conditions, judgment output format, auto-proposal format.
357
+
358
+ ---
359
+
360
+ ## Phase Guard Pattern (Stage Entry Gate)
361
+
362
+ | Dependency | Rule |
363
+ |---|---|
364
+ | Wave 0 (recon) not complete | Cannot enter Wave 1 |
365
+ | Wave 2 (fan-in) not complete | Cannot enter Wave 4 |
366
+ | State transition (Step 4-b) not complete | Cannot enter Wave next-M/I/E/D |
367
+
368
+ Maximize parallel fan-out among independent agents; dependent stages wait for prior Wave completion.
369
+
370
+ ---
371
+
372
+ ## Step 6. Round Wrap + Proactive Next Step
373
+
374
+ Execute after Wave 4 PASS + Step 4-c recording complete.
375
+ 3-line completion summary → up to 3 next-round suggestions → fh_signal persistence confirmation.
376
+
377
+ **Proactive suggestion priority** (suggest only 1):
378
+
379
+ | Situation detected | Suggestion |
380
+ |---|---|
381
+ | 2+ FH files modified | `harness-doctor` auto-run (after user confirmation) |
382
+ | New skill/plugin added | `cross-ecosystem-synergy-detection` |
383
+ | Important artifact completed | `steel-quench` |
384
+ | No frontier-digest today + large session | `frontier-digest` |
385
+ | None | "ready for next session" |
386
+
387
+ **Anti-redundancy guard**: if this composition was invoked **by** goal-quench (detect `.claude/goal-quench.active` present with `mode: pro|max`), suppress any suggestion that points back to `/goal-quench` — goal-quench is already the caller, so re-suggesting it is a redundant, confusing loop. Return control to goal-quench instead. See Cross-reference below.
388
+
389
+ > **Detail**: See `SKILL_detail.md §Round-Wrap` — 6-1 completion summary format, 6-2 next round suggestions format, 6-3 fh_signal persistence format.
390
+
391
+ ---
392
+
393
+ ## Execution Tier
394
+
395
+ | Tier | Tokens | Scope |
396
+ |:---:|:---:|---|
397
+ | **light** | ~5K | Wave 0 + Wave 1 single → output → end |
398
+ | **standard** | ~15K | Wave 0 + Wave 1 multi → fan-in → one proactive suggestion |
399
+ | **full** | ~30K | + Wave N state transition → conditional lightweight harvest |
400
+ | **max** | ~60K+ | + Three-Doctor Loop → full harvest-loop → next Wave follow-up |
401
+
402
+ Configure via `EXECUTION_TIER: standard` in CLAUDE.md. Temporary override: "use light mode" / "run at max".
403
+
404
+ ---
405
+
406
+ ## Simplification Guard
407
+
408
+ - Single-agent tasks → guide user to call that skill directly (skip agent-composer)
409
+ - Risk of two agents editing the same file in the same Wave → recommend Wave separation
410
+
411
+ ### Fan-out Scale Tiers
412
+
413
+ | Tier | Count | Behavior |
414
+ |---|---|---|
415
+ | **Small** | 2–4 | Dispatch immediately (within per-wave cap) |
416
+ | **Medium** | 5–16 | Decompose into sub-waves of ≤4; confirm scale before dispatch |
417
+ | **Large** | 17+ | Worktree isolation mandatory + explicit user approval required |
418
+
419
+ ---
420
+
421
+ ## Done When
422
+
423
+ ```
424
+ All stages Step 0~6 complete
425
+ + Wave composition plan finalized + execution complete
426
+ + fan-in loom complete: M-tier 0 AND S-tier < 3 → PASS
427
+ or user has confirmed Wave end
428
+ + When deliberation was invoked: wait for verdict before closing Wave N+1;
429
+ verdict folds back into Step 4-b fan-in result set
430
+ + Auto-recording gate (Step 4-c) complete (lightweight harvest-loop status confirmed)
431
+ ```
432
+
433
+ > **Sprint Contract**: Done When must be in an externally verifiable contract format — "criteria a third party can confirm," not "when it feels done." (Anthropic official validation 2025)
434
+
435
+ ---
436
+
437
+ ## Identity
438
+
439
+ agent-composer is the FH **coordinator** above specialist agents — decides "which agent combination is optimal." Also acts as **Curator**: detects stale/duplicate agents and proposes merge candidates.
440
+
441
+ | Human domain | System domain |
442
+ |---|---|
443
+ | What to build, why (direction + insight) | Which agents and how (composition + ordering) |
444
+ | Final adoption decision | Pipeline execution + result aggregation |
445
+ | Naming/framing | Recording + quality gates |
446
+
447
+ If unclear item is in human domain → ask. System domain → infer and proceed.
448
+ (Brain/Hands decoupling: agent-composer is Brain-only. Brain = goal parsing → Wave construction → gate decisions.)
449
+
450
+ ---
451
+
452
+ ## Cross-reference — goal-quench (upstream caller)
453
+
454
+ `goal-quench`'s **pro / max** modes invoke agent-composer for goal decomposition (goal-quench Phase 1.5 Step B). The relationship is one-directional and the entry points differ by intent:
455
+
456
+ | User intent | Entry point | agent-composer's role |
457
+ |---|---|---|
458
+ | "Compose/dispatch agents for this work" | `/agent-composer` directly | Primary — composes and runs the Wave plan |
459
+ | "Run a large/budget-gated `/goal` safely" | `/goal-quench --pro` / `--max` | Sub-step — receives the task in compose-only mode, returns a sub-goal Wave plan, hands control back to goal-quench |
460
+
461
+ **Routing note**: when a user frames a large or token-sensitive `/goal` run, prefer `/goal-quench` as the entry point — it wraps this skill with budget + quality gates that a bare agent-composer run does not provide. agent-composer does **not** re-invoke goal-quench (that is the caller); the Step 6 anti-redundancy guard enforces this.