@chrono-meta/fh-gate 1.1.0 → 1.2.1

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 (68) 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 +61 -8
  9. package/bin/fh-goal.js +9 -0
  10. package/bin/fh-run.js +9 -0
  11. package/docs/codex-compat.md +123 -0
  12. package/docs/pillars.svg +70 -0
  13. package/knowledge/shared/harness-core/fh_integration_contract.md +45 -28
  14. package/package.json +30 -6
  15. package/plugins/fh-commons/README.md +37 -0
  16. package/plugins/fh-commons/agents/quench-challenger.md +373 -0
  17. package/plugins/fh-commons/skills/convergence-loop/SKILL.md +155 -0
  18. package/plugins/fh-commons/skills/deliberation/SKILL.md +288 -0
  19. package/plugins/fh-commons/skills/mcp-circuit-breaker/SKILL.md +196 -0
  20. package/plugins/fh-commons/skills/token-budget-gate/SKILL.md +175 -0
  21. package/plugins/fh-meta/agents/fact-checker.md +121 -0
  22. package/plugins/fh-meta/agents/hub-persona-auditor.md +109 -0
  23. package/plugins/fh-meta/agents/persona-innovator.md +195 -0
  24. package/plugins/fh-meta/skills/agent-composer/SKILL.md +461 -0
  25. package/plugins/fh-meta/skills/agent-composer/SKILL_detail.md +464 -0
  26. package/plugins/fh-meta/skills/apex-review/SKILL.md +185 -0
  27. package/plugins/fh-meta/skills/asset-placement-gate/SKILL.md +135 -0
  28. package/plugins/fh-meta/skills/contention-layer/SKILL.md +127 -0
  29. package/plugins/fh-meta/skills/context-bridge-dispatch/SKILL.md +30 -0
  30. package/plugins/fh-meta/skills/context-bridge-dispatch/SKILL_detail.md +144 -0
  31. package/plugins/fh-meta/skills/context-doctor/SKILL.md +341 -0
  32. package/plugins/fh-meta/skills/cross-ecosystem-synergy-detection/SKILL.md +202 -0
  33. package/plugins/fh-meta/skills/deep-clarify/SKILL.md +144 -0
  34. package/plugins/fh-meta/skills/edit-manifest/SKILL.md +210 -0
  35. package/plugins/fh-meta/skills/field-harvest/SKILL.md +384 -0
  36. package/plugins/fh-meta/skills/frontier-digest/SKILL.md +272 -0
  37. package/plugins/fh-meta/skills/goal-quench/SKILL.md +509 -0
  38. package/plugins/fh-meta/skills/harness-doctor/SKILL.md +277 -0
  39. package/plugins/fh-meta/skills/harness-doctor/SKILL_detail.md +484 -0
  40. package/plugins/fh-meta/skills/harvest-loop/SKILL.md +231 -0
  41. package/plugins/fh-meta/skills/harvest-loop/SKILL_detail.md +201 -0
  42. package/plugins/fh-meta/skills/hub-cc-pr-reviewer/SKILL.md +129 -0
  43. package/plugins/fh-meta/skills/hub-cc-pr-reviewer/SKILL_detail.md +158 -0
  44. package/plugins/fh-meta/skills/install-doctor/SKILL.md +207 -0
  45. package/plugins/fh-meta/skills/install-wizard/SKILL.md +613 -0
  46. package/plugins/fh-meta/skills/marketplace-gate/SKILL.md +193 -0
  47. package/plugins/fh-meta/skills/memory-hygiene/SKILL.md +143 -0
  48. package/plugins/fh-meta/skills/meta-prompt-builder/SKILL.md +167 -0
  49. package/plugins/fh-meta/skills/meta-prompt-builder/SKILL_detail.md +37 -0
  50. package/plugins/fh-meta/skills/pipeline-conductor/SKILL.md +430 -0
  51. package/plugins/fh-meta/skills/plugin-recommender/SKILL.md +221 -0
  52. package/plugins/fh-meta/skills/plugin-recommender/SKILL_detail.md +220 -0
  53. package/plugins/fh-meta/skills/prompt-regression/SKILL.md +178 -0
  54. package/plugins/fh-meta/skills/public-surface-audit/SKILL.md +224 -0
  55. package/plugins/fh-meta/skills/return-path-gate/SKILL.md +257 -0
  56. package/plugins/fh-meta/skills/self-marketing-lint/SKILL.md +129 -0
  57. package/plugins/fh-meta/skills/sim-conductor/SKILL.md +364 -0
  58. package/plugins/fh-meta/skills/sim-conductor/SKILL_detail.md +337 -0
  59. package/plugins/fh-meta/skills/skill-splitter/SKILL.md +126 -0
  60. package/plugins/fh-meta/skills/skill-splitter/SKILL_detail.md +185 -0
  61. package/plugins/fh-meta/skills/source-grounding-audit/SKILL.md +230 -0
  62. package/plugins/fh-meta/skills/source-grounding-audit/SKILL_detail.md +182 -0
  63. package/plugins/fh-meta/skills/steel-quench/SKILL.md +226 -0
  64. package/plugins/fh-meta/skills/steel-quench/SKILL_detail.md +453 -0
  65. package/plugins/fh-meta/skills/verify-bidirectional/SKILL.md +238 -0
  66. package/scripts/fh-gate.sh +175 -40
  67. package/scripts/fh-goal.sh +182 -0
  68. package/scripts/fh-run.sh +269 -0
@@ -0,0 +1,341 @@
1
+ ---
2
+ name: context-doctor
3
+ description: Reduces token waste in Claude Code sessions. Scans projects to automatically generate .claudeignore files, and guides on over-read files and /clear timing. In hub environments, regularly audits bloated CLAUDE.md/MEMORY.md/memory/*.md files and proposes compression. Usable standalone without a hub clone.
4
+ user-invocable: true
5
+ allowed-tools: ["Read", "Write", "Bash", "Glob", "Grep"]
6
+ model: sonnet
7
+ complexity_routing:
8
+ base: sonnet
9
+ high: opus
10
+ escalate_when:
11
+ - cold_start
12
+ - cross_project
13
+ ---
14
+
15
+ # context-doctor — Token Efficiency Diagnosis + Automatic Prescription
16
+
17
+ Diagnoses the 3 main causes of session token waste and prescribes immediate remedies:
18
+ 1. No `.claudeignore` → unnecessary files loaded wholesale into context
19
+ 2. Repeated full reads of large files → paying the same cost N times
20
+ 3. Not using `/clear` after direction changes → continuing work with accumulated noise
21
+
22
+ **Standalone install** — this skill works normally with plugin install only, without cloning the full meta-harness.
23
+
24
+ ## Execution Steps
25
+
26
+ ### Step 1. `.claudeignore` Diagnosis + Generation
27
+
28
+ ```bash
29
+ # Check whether .claudeignore exists in current project root
30
+ ls -la .claudeignore 2>/dev/null || echo "MISSING"
31
+ ```
32
+
33
+ **If absent**: Scan project structure and auto-generate.
34
+
35
+ **If already present**: Keep existing content + suggest additional patterns only (no overwrite). Check for sentinel comment (`# context-doctor:`) and add to first line if absent.
36
+
37
+ ```bash
38
+ # Project type detection
39
+ ls package.json pyproject.toml build.gradle pom.xml 2>/dev/null | head -5
40
+ # Top-level directory list
41
+ ls -d */ 2>/dev/null | head -20
42
+ ```
43
+
44
+ Generation criteria — by project type:
45
+
46
+ | Detected type | Additional patterns |
47
+ |---|---|
48
+ | Node.js (`package.json`) | `node_modules/` · `dist/` · `build/` · `.next/` · `coverage/` |
49
+ | Python (`pyproject.toml` / `setup.py`) | `__pycache__/` · `.venv/` · `*.egg-info/` · `dist/` · `.pytest_cache/` |
50
+ | Java (`pom.xml` / `build.gradle`) | `target/` · `build/` · `.gradle/` |
51
+ | Common (always include) | `.git/` · `*.log` · `*.lock` · `*.min.js` · `*.min.css` |
52
+
53
+ Present preview to user after generation → save after confirmation.
54
+
55
+ Automatically add sentinel comment to first line when generating/updating:
56
+ ```
57
+ # context-doctor: configured YYYY-MM-DD
58
+ ```
59
+ → Suppresses auto-invocation in subsequent sessions.
60
+
61
+ ### Step 2. Large File Detection + Split Strategy Guidance
62
+
63
+ ```bash
64
+ # Detect files exceeding 500 lines (top 10)
65
+ find . -name "*.py" -o -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.java" -o -name "*.kt" \
66
+ | grep -v node_modules | grep -v .git \
67
+ | xargs wc -l 2>/dev/null | sort -rn | head -11 | tail -10
68
+ ```
69
+
70
+ When files exceeding 500 lines are found:
71
+
72
+ ```
73
+ ⚠️ Large file detected: {filename} ({N} lines)
74
+ Full read cost: ~{token count} tokens
75
+ Recommended: split reads with offset + limit
76
+ Example: Read({filename}, offset=0, limit=100) → proceed section by section
77
+ ```
78
+
79
+ **Repeated full-read pattern** (burst pattern) detection criteria:
80
+ - 3+ files over 500 lines exist and `.claudeignore` was absent
81
+ - User mentions "read it all at once" / "re-read the whole thing every time"
82
+
83
+ When burst pattern is detected → **trigger harvest-loop integration in Step 4**.
84
+
85
+ ### Step 3. `/clear` + Model Switching Timing Guide
86
+
87
+ Check session state with the user, then prescribe according to context:
88
+
89
+ **Wrap-then-Compact** (when approaching context limit — CC subscription only):
90
+
91
+ When context is near the limit and you want to *preserve state* rather than reset:
92
+ 1. Ask Claude: `"wrap up — completed items, modified files, pending tasks"`
93
+ 2. Claude writes a structured summary → that summary anchors the `/compact` output
94
+ 3. Run `/compact` — the wrap becomes the cold-start primer for next session
95
+
96
+ > This is superior to blind `/compact` because you control what's preserved. Bedrock/API has no meter warning — CC subscription only.
97
+
98
+ → Full pattern + table: `CHEATSHEET.md §10 Lever 6`
99
+
100
+ **`/clear` recommended situations** (reset, not preserve):
101
+ ```
102
+ □ Work direction has changed significantly (exploration → implementation, bug fix → refactor, etc.)
103
+ □ Switching to a different track/project
104
+ □ Error debugging has gone long and noise has accumulated
105
+ □ Previous attempts are unrelated to current work
106
+ ```
107
+
108
+ → Recommend immediate `/clear` and restart in fresh context.
109
+
110
+ **Model switching criteria**:
111
+
112
+ | Current task | Recommended | Command |
113
+ |---|---|---|
114
+ | Complex design decisions · architecture review | Opus | `/model opus` |
115
+ | Code writing · file editing · refactoring | Sonnet (default) | — |
116
+ | Simple file lookup · short Q&A | Haiku | `/model haiku` |
117
+
118
+ > Models are tools for allocating the right expertise to complexity. Opus for simple tasks = wasted expertise; Haiku for design decisions = insufficient expertise. Switch models when task nature changes.
119
+
120
+ ### Step 4. harvest-loop Integration (burst pattern recording)
121
+
122
+ When burst pattern is detected (if `tracks/_audit/` exists):
123
+
124
+ ```bash
125
+ # Check latest weekly_audit file
126
+ ls -1t tracks/_audit/weekly_audit_*.md 2>/dev/null | head -1
127
+ ```
128
+
129
+ If found: Suggest adding the following to the `## Check Items` or `## Token Efficiency` section of that file:
130
+
131
+ ```markdown
132
+ ### Token Efficiency Check (context-doctor)
133
+ - [ ] .claudeignore is up to date
134
+ - [ ] 500+ line large files list and whether split reads are followed
135
+ - [ ] Whether burst pattern occurred (3+ full reads of same large file)
136
+ - [ ] Whether /clear was used after direction changes
137
+ ```
138
+
139
+ Environments without `tracks/_audit/` (Mode C — plugin only):
140
+ → Output items to terminal only, skip file writes.
141
+
142
+ ### Step 5. CC Context Structure Regular Audit (Hub Environment Only)
143
+
144
+ **Hub environment detection condition**: CLAUDE.md contains "your-hub" or "meta hub" + `memory/MEMORY.md` exists.
145
+
146
+ ```bash
147
+ # CLAUDE.md line count
148
+ wc -l CLAUDE.md .claude/CLAUDE.md 2>/dev/null | sort -rn | head -3
149
+
150
+ # MEMORY.md line count (200-line limit)
151
+ wc -l memory/MEMORY.md 2>/dev/null
152
+
153
+ # memory/*.md files exceeding 30K
154
+ find memory -name "*.md" -size +30k 2>/dev/null | xargs wc -l | sort -rn | head -10
155
+
156
+ # SKILL.md files > 300 lines with no SKILL_detail.md (skill-splitter candidates)
157
+ find plugins -name "SKILL.md" 2>/dev/null | while read f; do
158
+ lines=$(wc -l < "$f")
159
+ detail=$(dirname "$f")/SKILL_detail.md
160
+ [ "$lines" -gt 300 ] && [ ! -f "$detail" ] && echo "[skill-splitter candidate] $f ($lines lines)"
161
+ done
162
+ ```
163
+
164
+ **Audit thresholds + prescriptions**:
165
+
166
+ | Target | Threshold | Prescription |
167
+ |---|---|---|
168
+ | CLAUDE.md | Exceeds 300 lines | Section-by-section compression / move completed sections to archive |
169
+ | MEMORY.md | Exceeds 180 lines | Check entry count + move `✅ CLOSED` items to archive section |
170
+ | memory/*.md single file | Exceeds 30K (300 lines) | Suggest splitting accumulated history into separate files |
171
+ | SKILL.md (any) | > 300 lines AND no SKILL_detail.md | Propose `/skill-splitter` — governance-semantic split (not compression); compression removes content, splitting routes it on-demand |
172
+
173
+ Audit result report format:
174
+ ```
175
+ CC Context Audit Results
176
+ CLAUDE.md: {N} lines {status}
177
+ MEMORY.md: {N} lines / 200-line limit ({remaining} lines remaining)
178
+ Bloated files ({30K+}):
179
+ - {filename}: {N} lines → compression recommended
180
+ Recommended actions: {summary}
181
+ ```
182
+
183
+ **Frequency**: When explicitly called with `/context-doctor` or auto-invoked at session start when MEMORY.md is detected at 180+ lines.
184
+
185
+ > Skip Step 5 when not in a hub environment.
186
+
187
+ ## Context Hierarchy (L1/L2/L3)
188
+
189
+ Information buried in the middle of a long context window suffers measurable accuracy loss — the "lost in the middle" effect, ~10–30% degradation for mid-context information (see `../../../../knowledge/shared/harness-core/harness_frontier_diagnosis_2026-06-02.md`). The remedy is two-fold: tier the context, and place the most important instructions at the **start and end**, never buried in the middle.
190
+
191
+ **Three tiers — keep each within its band**:
192
+
193
+ | Tier | What lives here | Rough budget | FH example |
194
+ |---|---|---|---|
195
+ | **L1 — always-on** | System / critical instructions that must hold every turn | ~2–5K tokens | `CLAUDE.md` core rules, active session.md header |
196
+ | **L2 — session summary** | Current task state, decisions made this session | ~5–20K tokens | active track session file, `reference_next_session_starter.md` |
197
+ | **L3 — on-demand** | Reference material retrieved only when needed | unbounded, loaded then dropped | `knowledge/` docs, large source files via Read offset/limit |
198
+
199
+ **Placement norm** (applies to CLAUDE.md, prompts, and dispatched Context Cards):
200
+ - Put the load-bearing rule or task goal in the **first lines and restate it in the last lines**.
201
+ - Do not park a critical constraint in the middle of a long document — it is the most likely place to be missed.
202
+ - Promote frequently-needed L3 docs to L2 summaries; demote stale L1/L2 content to L3 (load on demand) rather than keeping it always-on.
203
+
204
+ When auditing CLAUDE.md / MEMORY.md in Step 5, check tier placement too: a critical rule sitting mid-file is a placement defect even if the file is within its line budget.
205
+
206
+ ## Compression Pass
207
+
208
+ Optional step, run when context is large (e.g. after Step 5 flags a bloated file, or an L3 doc is long but must be loaded). This goes **beyond** `.claudeignore` — `.claudeignore` blocks files from loading; compression shrinks content that does need to load. LLMLingua-style compression is reported to reach ~100K→20K token reductions with minimal loss on long retrieved context (see `../../../../knowledge/shared/harness-core/harness_frontier_diagnosis_2026-06-02.md` Provenance).
209
+
210
+ Advisory and tool-agnostic — recommend (and, where a doc is being authored/edited in-session, apply) these reductions:
211
+
212
+ - Strip boilerplate: repeated headers/footers, navigation, license blocks, generated banners.
213
+ - Collapse repeated or near-duplicate sections into a single canonical statement plus a pointer.
214
+ - Summarize long retrieved docs to the task-relevant slice before pinning them into context; keep the full doc as an L3 file to re-read only if needed.
215
+ - Prefer Read offset/limit over full-file reads for large files (ties back to Step 2).
216
+
217
+ Keep it reversible: compress the *working copy* in context, not the source of truth on disk, unless the user is explicitly editing that file.
218
+
219
+ ### Tooling — Headroom (external option)
220
+
221
+ The advisory pass above is tool-agnostic, but a concrete, reversible, local-first implementation exists: **Headroom** (`github.com/chopratejas/headroom`, open source, v0.22). It compresses tool outputs, logs, files, and RAG chunks before they reach the LLM — **vendor/coverage-reported** at 60–95% fewer tokens with the same answers ([The Register, 2026-05-31](https://www.theregister.com/ai-ml/2026/05/31/netflix-wiz-creates-app-to-slash-ai-bills-then-open-sources-it/5248702); figures unverified by FH). General token-efficiency basis: `../../../../knowledge/shared/harness-core/harness_frontier_diagnosis_2026-06-02.md`.
222
+
223
+ **Redundancy-category targeting** (its key insight — import this into the pass): the high-yield targets are *machine-generated, schema-repetitive* payloads, not prose. Prioritize compressing, in order:
224
+
225
+ 1. **MCP tool outputs** — ~70% redundant JSON (most relevant to FH: heavy MCP sessions burn tokens here).
226
+ 2. **Logs** — ~90% jettisonable.
227
+ 3. **DB dumps / structured query output** — one schema, repeated rows.
228
+ 4. **File trees / directory listings** — repeated path metadata.
229
+
230
+ Plain prose docs compress far less — spend the budget on the four categories above first.
231
+
232
+ **Integration surfaces** (all local, runtime-side — outside the FH repo, so for the user's local setup, not a hub asset):
233
+ - **Library** — `compress(messages)` inline (Python/TS).
234
+ - **Proxy** — `headroom proxy --port 8787`, zero code change, then point the client at it.
235
+ - **MCP server / agent-wrap** — wrap an MCP server or the agent CLI directly.
236
+
237
+ Caveats: v0.22 is still early — pilot before relying on it; compression carries a quality/accuracy tradeoff, so its local-first + reversible design (matching the reversibility rule above) is the safeguard. See the repo for exact config — do not assume flags.
238
+
239
+ ## External User Environment Adaptation
240
+
241
+ | Environment | Behavior |
242
+ |---|---|
243
+ | Meta-harness cloned (Mode A) | Perform full Steps 1–5 / integrate with harvest-loop files |
244
+ | Plugin only (Mode C) | Perform Steps 1–3 / Step 4 output only (no file writes) |
245
+ | External general environment | Focus on `.claudeignore` generation + large file guidance |
246
+
247
+ ## Invocation Triggers
248
+
249
+ ### Auto-Invocation Conditions (at session start)
250
+
251
+ Invokes **only when `.claudeignore` is absent**:
252
+ ```
253
+ "This project has no .claudeignore. Token waste may be occurring. Check with /context-doctor?"
254
+ ```
255
+
256
+ When `.claudeignore` exists → skip auto-invocation (treated as already configured).
257
+
258
+ > **Burst pattern auto-detection (500+ line files) is excluded from auto-invocation** — only performs on explicit call. Firing every session becomes noise.
259
+
260
+ ### Suppress Mechanism
261
+
262
+ context-doctor adds a sentinel comment to the first line when generating or updating `.claudeignore`:
263
+
264
+ ```
265
+ # context-doctor: configured 2026-05-10
266
+ ```
267
+
268
+ Auto-invocation decision order:
269
+ 1. `.claudeignore` absent → auto-invoke O
270
+ 2. `.claudeignore` present + sentinel present → auto-invoke X (fully suppressed)
271
+ 3. `.claudeignore` present + sentinel absent (manually written) → auto-invoke X (file existence itself is suppress signal)
272
+
273
+ **Manual suppress**: User adds the following to the first line of `.claudeignore` for permanent suppress:
274
+ ```
275
+ # context-doctor: suppress
276
+ ```
277
+
278
+ Explicit invocation (`/context-doctor`) always runs regardless of suppress state.
279
+
280
+ ### Explicit Triggers
281
+
282
+ - `/context-doctor`
283
+ - "token waste", "session is slow", "reading the whole file", "claudeignore", "context cleanup"
284
+ - "context diet", "memory audit", "CLAUDE.md is heavy", "MEMORY.md size"
285
+
286
+ ### Natural Language Triggers (activates without internal vocabulary)
287
+
288
+ Also activates when an external user expresses without token/context terminology:
289
+
290
+ | Example utterance | Intent | Mapped diagnosis |
291
+ |---|---|---|
292
+ | "The context seems to be getting too large" | Suspected context bloat | Step 5 (hub) / Step 2 |
293
+ | "Tokens are being wasted" | Suspected token efficiency degradation | Step 1 + Step 2 |
294
+ | "The conversation feels inefficient" | Suspected accumulated session noise | Step 3 (/clear timing) |
295
+ | "Why is Claude so slow?" | Burst pattern or context overload | Step 2 |
296
+ | "Seems like it keeps re-reading the same thing" | Repeated full-read detected | Step 2 (burst pattern) |
297
+ | "Answers get weird as the session gets longer" | Accumulated context noise | Step 3 (/clear recommended) |
298
+ | "Context is getting full", "context meter is high" | Approaching context limit | Step 3 — propose Wrap-then-Compact pattern |
299
+
300
+ ## Three-Doctor Loop Integration
301
+
302
+ ### context-doctor's Role in Three-Doctor Loop
303
+
304
+ ```
305
+ harness-doctor → current skeleton diagnosis "Is the structure correct? Any drift/complexity/broken references?"
306
+ context-doctor → current context diagnosis "Is Context Collapse occurring?"
307
+ sim-conductor → future behavior prediction "What happens when a real person uses this system?"
308
+ ```
309
+
310
+ context-doctor is the **current context diagnostic role** among the three skills. It detects token waste/burst patterns/context contamination and presents prescriptions (.claudeignore/clear timing), which harness-doctor (skeleton) and sim-conductor (future behavior) then pick up to complete the closed loop.
311
+
312
+ ---
313
+
314
+ > **Context Anxiety**: Agents make uncertain inferences when relevant context is absent — this is the engineering rationale behind the context-doctor/bridge structure. (Anthropic official naming 2025)
315
+
316
+ context-doctor (token/context) · harness-doctor (structure) · sim-conductor (simulation/ideation) — the three skills form a **diagnosis→prescription→re-diagnosis** closed loop.
317
+
318
+ | Situation | Next skill |
319
+ |---|---|
320
+ | Want to also check structure after resolving token waste | `/harness-doctor` |
321
+ | Want to validate prescription results from external user perspective | `/sim-conductor Area A` |
322
+ | SKILL.md diagnosed as over-loaded (> 300 lines, no SKILL_detail.md) | `/skill-splitter` — governance-semantic split |
323
+ | All three skills mentioned simultaneously | Three-Doctor Loop circuit activated — diagnosis→prescription→re-diagnosis cycle
324
+
325
+ ## Done When
326
+
327
+ | Condition | Completion verdict |
328
+ |---|---|
329
+ | Diagnosis results output to conversation (relevant stages among Steps 1~5) | ✅ Diagnosis complete |
330
+ | `.claudeignore` created or modified + path output | ✅ Prescription complete |
331
+ | Large file detected with split strategy guidance output | ✅ Step 2 complete |
332
+ | "No context structure issues" judgment output | ✅ Health check complete |
333
+
334
+ **This skill's Done When = "diagnosis report output complete"**. Actual resolution of prescription items is in the user's or follow-up work domain and is not included in this skill's completion criteria.
335
+
336
+ **External validation path**: harvest-loop Step 3.75 Critic isolated Agent can independently judge against the above criteria (`skill_quality_rubric.md` verifiable criteria). Automatically linked when subsequent steel-quench runs.
337
+
338
+ **→ Three-Doctor Loop chain (auto-propose after diagnosis):**
339
+ - Prescription modifies SKILL.md / rules / CLAUDE.md → **propose `/harness-doctor`** re-check after fix (structural integrity)
340
+ - Prescription addresses user-facing context (onboarding, README, install guides) → **propose `/sim-conductor Area A`** (external user impact validation)
341
+ - SKILL.md detected as over-loaded → **auto-propose `/skill-splitter`**: `"I see [skill-name] SKILL.md is [N] lines with no SKILL_detail.md. Want me to run /skill-splitter to do a governance-semantic split?"`
@@ -0,0 +1,202 @@
1
+ ---
2
+ name: cross-ecosystem-synergy-detection
3
+ description: Automatically discovers useful combinations (synergy pairs) across multiple installed plugins and skills, and presents them as a ranked table. Proactively suggests undiscovered synergies when new projects or skills are registered in the registry. Activates on phrases like "do my installed tools work well together?", "they seem to work in isolation", "find synergies".
4
+ user-invocable: true
5
+ allowed-tools: ["Read", "Grep", "Glob", "Bash"]
6
+ model: sonnet
7
+ complexity_routing:
8
+ base: sonnet
9
+ high: opus
10
+ escalate_when:
11
+ - cross_project
12
+ - cold_start
13
+ ---
14
+
15
+ # cross-ecosystem-synergy-detection — Multi-Ecosystem Automatic Synergy Discovery
16
+
17
+ Automatically discovers cross-invocable pairs in environments with multiple installed plugins and cross-CLI tools, and derives a synergy ranking table.
18
+
19
+ ## Activation Triggers
20
+
21
+ 1. **Multi-ecosystem component environment specified**: "multiple plugins/cross-CLI installed", "synergy with other components", "cross-ecosystem", "run together"
22
+ 2. **New component added/removed**: "component install", "add/remove component"
23
+ 3. **Synergy check phrasing**: "are they working in isolation?", "can they be integrated?", "environment check", "combination effect"
24
+ 4. **Registry change detected** (optional): If a user-maintained `LOCAL_SKILL_REGISTRY.md` is present, Step 7 runs when a new project/skill is registered. The registry is not auto-created — absent file → Step 7 self-skips (see Step 7 guard).
25
+
26
+ **Exception**: Single-component environments (1 or fewer installed → no meaningful activation)
27
+
28
+ ### Natural Language Triggers (General user phrasing — activates without internal vocabulary)
29
+
30
+ | Example phrasing | Intent |
31
+ |---|---|
32
+ | "Do my installed tools work well together?" | Check synergy of installed plugins/skills |
33
+ | "Would using this and that together be better?" | Explore cross-invocation possibilities |
34
+ | "I have multiple plugins installed in Claude — am I using them well?" | Diagnose installation ecosystem utilization |
35
+ | "My tools seem to be working in isolation" | Detect namespace/cwd fragmentation |
36
+ | "I just installed something new — check for conflicts with existing setup" | Check after adding new component |
37
+ | "I have multiple installs but not sure if I'm using them right" | Diagnose installation ecosystem utilization |
38
+ | "Wouldn't this and that work better together?" | Explore cross-invocation possibilities |
39
+ | "My tools feel disconnected and inconvenient" | Detect namespace/cwd fragmentation |
40
+ | "Wouldn't combining these plugins be more powerful?" | Explore component combination synergies |
41
+ | "I feel like there's synergy here — find it" | Automatic cross-invocation pair discovery |
42
+
43
+ ## Processing Steps (6-step)
44
+
45
+ ### Step 1. Installation Inventory Direct Inspection
46
+
47
+ ```bash
48
+ cat ~/.claude/plugins/installed_plugins.json
49
+ # fields: name, version, installPath, gitCommitSha
50
+ ```
51
+
52
+ Additional checks:
53
+ - `~/.claude/settings.json` `enabledPlugins` (actually active assets)
54
+ - Check `installed_plugins.json` ↔ `enabledPlugins` consistency (catch drift)
55
+
56
+ ### Step 2. Asset Matrix Extraction per Component
57
+
58
+ ```bash
59
+ ls {installPath}/skills/ # SKILL.md units
60
+ ls {installPath}/agents/ # *.md units
61
+ ls {installPath}/commands/
62
+ ls {installPath}/.mcp.json
63
+ ls {installPath}/hooks/
64
+ ```
65
+
66
+ Extract each asset's frontmatter `description` + `allowed-tools` + `model`. Merge `plugin.json keywords`.
67
+
68
+ ### Step 3. Cross-Invocation Possible Pair Matrix Derivation
69
+
70
+ Call mechanism compatibility:
71
+ - **Skill**: Can be called directly as `{component-name}:{skill-name}`
72
+ - **Agent**: Can be called directly as `{component-name}:{agent-name}` via subagent_type
73
+ - **Hook**: Auto-triggered (no direct cross-component calls)
74
+ - **MCP**: Per-tool calls (namespace separated)
75
+
76
+ ### Step 4. Synergy Grade Derivation (★~★★★)
77
+
78
+ | Grade | Compatibility conditions |
79
+ |---|---|
80
+ | **★★★** | Directly complementary work areas + immediate cross-invocation compatible |
81
+ | **★★** | Complementary work areas + callable but cwd mismatch at certain points |
82
+ | **⚠️★** | Cross-invocable but risk of work area conflict |
83
+
84
+ ★★★ found → candidate for automatic cross-invocation documentation
85
+ ⚠️★ found → document risk + explicitly state avoidance rules
86
+
87
+ ### Step 5. Risk Catch
88
+
89
+ - **cwd fragmentation**: Component A and B operating in different cwds → work area separation
90
+ - **Namespace conflict**: Same skill name exposed across multiple components simultaneously
91
+ - **Drift**: Install path commit SHA ↔ original repo HEAD mismatch
92
+ - **Hook conflict**: Same event matcher across multiple components → inspect settings.json integration
93
+
94
+ When risk found → user explicit decision gate (no automatic patching)
95
+
96
+ ### Step 6. Result Persistence (Optional)
97
+
98
+ When persisting results:
99
+ - Record discovered synergy pairs in result file
100
+ - Confirm absence of equivalent external tools (environment comparison verification)
101
+
102
+ ### Step 7. Proactive Discovery — Proactive Mode
103
+
104
+ > Trigger: Runs when a new section/skill is registered in a user-maintained `LOCAL_SKILL_REGISTRY.md` (optional, user-created; absent → self-skip)
105
+
106
+ **Purpose**: FH proactively discovers and proposes synergies that previously required human ideas to find.
107
+
108
+ #### 7-1. Dynamically Discover and Read Registry Path
109
+
110
+ ```bash
111
+ # Auto-discover FH install path (avoid hardcoding)
112
+ FH_INSTALL=$(python3 -c "
113
+ import json, pathlib
114
+ p = pathlib.Path.home() / '.claude/plugins/installed_plugins.json'
115
+ if p.exists():
116
+ data = json.loads(p.read_text())
117
+ plugins = data if isinstance(data, list) else data.get('plugins', [])
118
+ for pl in plugins:
119
+ if 'forge-harness' in pl.get('name','') or 'fh' in pl.get('name','').lower():
120
+ print(pl.get('installPath',''))
121
+ break
122
+ " 2>/dev/null)
123
+
124
+ REGISTRY="${FH_INSTALL}/.claude/registry/LOCAL_SKILL_REGISTRY.md"
125
+ if [ -f "$REGISTRY" ]; then
126
+ cat "$REGISTRY"
127
+ else
128
+ echo "[SKIP] LOCAL_SKILL_REGISTRY.md not found — skipping Step 7. Rerun with manual path if needed."
129
+ exit 0
130
+ fi
131
+ ```
132
+
133
+ If file exists, extract `one-line description` + `example phrases` from newly registered projects/skills. If absent, skip Step 7 entirely.
134
+
135
+ #### 7-2. Load Existing Synergy Pair List
136
+
137
+ Load already-registered synergy pairs (including ★ grade) → prevent duplicate proposals.
138
+
139
+ #### 7-3. Derive Undiscovered Synergy Candidates
140
+
141
+ Compare domain of new skill/project against entire existing registry:
142
+
143
+ | Decision criteria | Synergy grade candidate |
144
+ |---|---|
145
+ | Output of one becomes input of another | ★★★ |
146
+ | Different layers in same domain (generate↔analyze, build↔verify) | ★★★ |
147
+ | Can run sequentially in same cwd | ★★ |
148
+ | Domain overlap but different perspectives | ★ |
149
+
150
+ #### 7-4. Proactive Proposal Output Format
151
+
152
+ ```
153
+ ## Undiscovered Synergy Candidates (Proactive Detection)
154
+
155
+ | # | Pair | Grade Candidate | Discovery basis |
156
+ |---|---|---|---|
157
+ | 1 | `{new skill}` ↔ `{existing skill}` | ★★★ | {one-line description} |
158
+
159
+ → Add to synergy reference file? [Y / N]
160
+ ```
161
+
162
+ - **Y** → Automatically append to synergy reference file as new pair section
163
+ - **N** → Collect reason and discard or defer recording
164
+
165
+ #### 7-5. Guards
166
+
167
+ - 0 candidates → Output "No new synergy pairs found between newly registered skills and existing assets." then exit
168
+ - No duplicate proposals of already-registered pairs (cross-check with 7-2 load results)
169
+
170
+ ---
171
+
172
+ ## External Environment Adaptation
173
+
174
+ The internal GHE org inventory and cluster classifications shown in original developer environment are organization-specific examples.
175
+ External users automatically derive their own inventory via Step 1 `installed_plugins.json` inspection alone.
176
+
177
+ | Original developer environment | External environment fallback |
178
+ |---|---|
179
+ | Internal GHE org inventory | Direct inspection of user's install ecosystem |
180
+ | Cluster classification | Auto-clustering by `keywords` distribution |
181
+ | Synergy grade baseline (8 items) | Auto-accumulated from user environment simulation results |
182
+
183
+ ## Done When
184
+
185
+ ```
186
+ All Steps 1~6 completed (Step 7 Proactive Mode only when registry change detected)
187
+ + Synergy ranking table (★~★★★) output
188
+ + User explicit decision gate completed if risk catch items exist
189
+ + User confirmed whether to persist results
190
+ ```
191
+
192
+ ## Constraints
193
+
194
+ - No editing of external component asset bodies
195
+ - Automatic cross-invocation documentation / new risk avoidance rule creation = only on user's explicit decision
196
+ - For organization-specific environment examples, maintain a local reference file
197
+
198
+ ## References
199
+
200
+ - `feedback_tool_output_direct_inspection_first` (Step 1·2 direct inspection obligation)
201
+ - `feedback_simplification_evidence` (simplification guard justified concession)
202
+ - `feedback_no_personal_commit_to_shared_repo` (no editing external plugin bodies)
@@ -0,0 +1,144 @@
1
+ ---
2
+ name: deep-clarify
3
+ description: Clarifies ambiguous requests through Socratic dialogue, drawing out goals, completion criteria, and constraints to produce a structured spec document. Pre-dispatch requirement clarification step for agent dispatch. Triggered by "I don't know what to build", "how should I approach this", "organize this for me", "clarify this", "deep-clarify".
4
+ user-invocable: true
5
+ allowed-tools: ["Read", "Write", "Bash", "Glob"]
6
+ model: sonnet
7
+ complexity_routing:
8
+ base: sonnet
9
+ high: opus
10
+ escalate_when:
11
+ - cross_project
12
+ - high_stakes
13
+ ---
14
+
15
+ # deep-clarify — Socratic Requirement Clarification
16
+
17
+ A skill that clarifies vague or open-ended requests through conversation to produce **actionable spec documents**.
18
+ An independent extension of the "direction confirmation" protocol from agent-composer Step 0-a.
19
+
20
+ ## Triggers
21
+
22
+ - `/deep-clarify`
23
+ - "I don't know what to build", "How should I approach this?"
24
+ - "Organize the requirements", "Write a spec document"
25
+ - "What should I do with this?", "The direction is unclear"
26
+ - When agent-composer detects pre-dispatch clarification is needed and delegates automatically
27
+
28
+ ## Core Principles
29
+
30
+ **Criteria for asking vs inferring**:
31
+ - Things only the human can know (goal, priorities, constraints, completion criteria) → ask
32
+ - Things AI can infer (implementation method, file location, technology choices) → infer and present as `(inferred: X)`
33
+ - Questions: **maximum 3 rounds, maximum 2 questions per round** — do not overuse
34
+
35
+ ---
36
+
37
+ ## Step 1. Request Analysis
38
+
39
+ Quickly identify the following from the user's request.
40
+
41
+ ```
42
+ Clarity check:
43
+ □ Final state (what will be different when done?) — ask if unclear
44
+ □ Completion criteria (how will it be verified?) — ask if unclear
45
+ □ Constraints (what must not be done, what must not be touched) — ask if unclear
46
+ □ Priority (fast vs thorough, now vs later) — ask if unclear
47
+ ```
48
+
49
+ **Direct entry conditions** (skip to Step 3 without questions):
50
+ - Request is specific and completion criteria are clear → draft spec document and confirm
51
+ - Clarity at the level of "add Y feature to file X"
52
+
53
+ ---
54
+
55
+ ## Step 2. Socratic Dialogue
56
+
57
+ ### Round 1 — Goal / Completion Criteria (core 2 questions)
58
+
59
+ ```
60
+ Clarification needed.
61
+
62
+ 1. Completion criteria: What does a completed [task name] look like?
63
+ (inferred: [inferred completion criteria] — confirm if correct)
64
+
65
+ 2. Scope: Which of [A / B / C] takes priority?
66
+ (inferred: [inferred choice] — reason: [rationale])
67
+ ```
68
+
69
+ ### Round 2 — Constraints / Priority (only if needed)
70
+
71
+ Skip if Round 1 resolves everything.
72
+
73
+ ```
74
+ 1. Is there anything this task must absolutely not do?
75
+ 2. Which takes priority: fast completion vs solid design?
76
+ ```
77
+
78
+ ### Round 3 — Final Confirmation (only if needed)
79
+
80
+ Draft the spec first, then single confirmation: "Is this the right direction?"
81
+
82
+ ---
83
+
84
+ ## Step 3. Generate Spec Document
85
+
86
+ Structure and save the results of the conversation.
87
+
88
+ ```bash
89
+ # Save path
90
+ .claude/specs/{task-slug}.md
91
+ ```
92
+
93
+ ### Spec Document Format
94
+
95
+ ```markdown
96
+ # Spec: {task title}
97
+ Created: {date} | Status: draft
98
+
99
+ ## Goal
100
+ {One sentence — what is being built and why}
101
+
102
+ ## Completion Criteria
103
+ - [ ] {verifiable condition 1}
104
+ - [ ] {verifiable condition 2}
105
+
106
+ ## Scope
107
+ Included: {what is explicitly included}
108
+ Excluded: {what is explicitly excluded}
109
+
110
+ ## Constraints
111
+ - {technical constraint}
112
+ - {what must not be done}
113
+
114
+ ## Priority
115
+ {Fast completion / Solid design / Balanced} — {reason}
116
+
117
+ ## References
118
+ {related files / existing skills / prerequisite work}
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Step 4. Follow-up Connections
124
+
125
+ After generating the spec document, suggest the appropriate next path:
126
+
127
+ | Situation | Connected skill |
128
+ |---|---|
129
+ | Agent orchestration needed for implementation | `agent-composer` — pass spec document path |
130
+ | Plan / design review needed | `plan` agent — build plan based on spec |
131
+ | Single task is now clear | Start implementation directly |
132
+ | Audit needed before external sharing | `hub-persona-auditor` |
133
+
134
+ ---
135
+
136
+ ## Done When
137
+
138
+ | Condition | Completion verdict |
139
+ |---|---|
140
+ | Socratic dialogue complete + spec document saved | ✅ Clarification complete |
141
+ | Spec path output: `.claude/specs/{slug}.md` | ✅ Save complete |
142
+ | Follow-up skill connection suggestion output | ✅ Handoff complete |
143
+
144
+ **This skill's Done When = "actionable spec document saved".** Implementation itself is the domain of follow-up agents/skills.