openhermes 4.0.1 → 4.3.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 (50) hide show
  1. package/ETHOS.md +6 -3
  2. package/LICENSE +21 -21
  3. package/README.md +111 -81
  4. package/bootstrap.ts +405 -0
  5. package/harness/agents/openhermes.md +45 -55
  6. package/harness/codex/AUTOPILOT.md +126 -0
  7. package/harness/codex/CONSTITUTION.md +14 -11
  8. package/harness/codex/ROUTING.md +35 -69
  9. package/harness/commands/oh-log.md +18 -0
  10. package/harness/instructions/RUNTIME.md +27 -51
  11. package/harness/skills/oh-builder/SKILL.md +27 -16
  12. package/harness/skills/oh-caveman/SKILL.md +9 -0
  13. package/harness/skills/oh-expert/SKILL.md +6 -0
  14. package/harness/skills/oh-facade/SKILL.md +298 -0
  15. package/harness/skills/oh-freeze/SKILL.md +9 -0
  16. package/harness/skills/oh-full-output/SKILL.md +81 -0
  17. package/harness/skills/oh-fusion/SKILL.md +314 -0
  18. package/harness/skills/oh-gauntlet/SKILL.md +10 -6
  19. package/harness/skills/oh-grill/SKILL.md +9 -5
  20. package/harness/skills/oh-guard/SKILL.md +9 -0
  21. package/harness/skills/oh-handoff/SKILL.md +9 -0
  22. package/harness/skills/oh-health/SKILL.md +8 -4
  23. package/harness/skills/oh-init/SKILL.md +80 -13
  24. package/harness/skills/oh-investigate/SKILL.md +57 -8
  25. package/harness/skills/oh-issue/SKILL.md +9 -0
  26. package/harness/skills/oh-learn/SKILL.md +81 -8
  27. package/harness/skills/oh-manifest/SKILL.md +55 -11
  28. package/harness/skills/oh-plan-review/SKILL.md +15 -8
  29. package/harness/skills/oh-planner/SKILL.md +18 -8
  30. package/harness/skills/oh-prd/SKILL.md +9 -0
  31. package/harness/skills/oh-refactor/SKILL.md +426 -0
  32. package/harness/skills/oh-retro/SKILL.md +9 -0
  33. package/harness/skills/oh-review/SKILL.md +12 -5
  34. package/harness/skills/oh-security/SKILL.md +4 -0
  35. package/harness/skills/oh-ship/SKILL.md +10 -0
  36. package/harness/skills/oh-skill-craft/SKILL.md +88 -0
  37. package/harness/skills/oh-skills-link/SKILL.md +9 -0
  38. package/harness/skills/oh-skills-list/SKILL.md +9 -0
  39. package/harness/skills/oh-triage/SKILL.md +11 -0
  40. package/index.ts +3 -0
  41. package/lib/{harness-resolver.mjs → harness-resolver.ts} +16 -12
  42. package/lib/logger.ts +75 -0
  43. package/package.json +16 -10
  44. package/tsconfig.json +16 -0
  45. package/bootstrap.mjs +0 -174
  46. package/harness/instructions/CONVENTIONS.md +0 -206
  47. package/index.mjs +0 -3
  48. package/lib/logger.mjs +0 -62
  49. package/test/plugins-behavioral.test.mjs +0 -64
  50. package/test/plugins.test.mjs +0 -62
@@ -0,0 +1,314 @@
1
+ ---
2
+ name: oh-fusion
3
+ description: "Skill ingestion pipeline: discover, analyze, filter, adapt, fuse, and integrate external skills into the OH harness. Use when the user has an existing skill, finds a skill in their .agents/skills, or wants to bring an external capability into OH."
4
+ tier: 3
5
+ benefits-from: [oh-skill-craft, oh-skills-link, oh-expert]
6
+ triggers:
7
+ - "import skill"
8
+ - "ingest skill"
9
+ - "fuse skill"
10
+ - "merge skills"
11
+ - "port skill"
12
+ - "add skill from"
13
+ - "make this OH-native"
14
+ - "skill fusion"
15
+ - "oh-fusion"
16
+ - "integrate skill"
17
+ - "convert skill"
18
+ - "bring in a skill"
19
+ - "transfer skill"
20
+ - "copy skill"
21
+ - "adopt skill"
22
+ route:
23
+ pass:
24
+ - oh-skills-link
25
+ - oh-skill-craft
26
+ fail: oh-skill-craft
27
+ blocker: surface
28
+ ---
29
+
30
+ # oh-fusion
31
+
32
+ The skill ingestion pipeline: discover external skills, evaluate signal quality, filter out noise, adapt to OH conventions, fuse multiple into one, and integrate into the harness.
33
+
34
+ Every skill you run through `oh-fusion` becomes part of the closed loop — wired into AUTOPILOT, ROUTING.md, AGENTS.md, and the self-driving engine.
35
+
36
+ ## When to Use
37
+
38
+ - The user points at a skill in `.agents/skills` and says "make this OH-native"
39
+ - The user has a skill from `npx skills` ecosystem they want integrated
40
+ - The user provides raw skill content and asks "is this worth keeping?"
41
+ - Multiple skills need fusing into one (like the `oh-facade` fusion in this session)
42
+ - Any external capability needs to become an `oh-*` skill with full wiring
43
+
44
+ ## Pipeline
45
+
46
+ 6-phase closed loop:
47
+
48
+ ```
49
+ Discovery → Analysis → Decision → Adaptation → Fusion (opt) → Integration
50
+
51
+ oh-skills-link (verify)
52
+ ```
53
+
54
+ ---
55
+
56
+ ## Phase 1: Discovery
57
+
58
+ Input: user's skill source
59
+ Output: raw skill content loaded for analysis
60
+
61
+ ### Sources
62
+
63
+ | Source | How to access |
64
+ |---|---|
65
+ | `.agents/skills/<name>/SKILL.md` | Read the file directly |
66
+ | `npx skills` package | Run `npx skills find <query>` or check `skills.sh` |
67
+ | URL to a skill | Fetch the content via web fetch |
68
+ | User-provided path | Resolve and read |
69
+ | User-provided content inline | Capture the raw text |
70
+ | Multiple skills (for fusion) | Load all, enter Phase 2 on each |
71
+
72
+ ### Discovery Checklist
73
+
74
+ Before proceeding, confirm:
75
+ - [ ] Skill content is loaded and readable
76
+ - [ ] Frontmatter is present (name, description)
77
+ - [ ] There are no access restrictions or permissions needed
78
+ - [ ] For multiple skills: all are loaded and ready for comparison
79
+
80
+ ---
81
+
82
+ ## Phase 2: Analysis
83
+
84
+ Input: raw skill content
85
+ Output: structured analysis report with signal score
86
+
87
+ ### 2a. Depth Scoring
88
+
89
+ Measure the skill's substantive content:
90
+
91
+ | Metric | How to assess |
92
+ |---|---|
93
+ | Total lines | SKILL.md length |
94
+ | Concrete rules count | Number of "must", "never", "always", "banned" directives |
95
+ | Example count | Number of code blocks showing before/after or usage |
96
+ | Anti-patterns listed | Explicit "don't do this" sections |
97
+ | Workflow steps | Number of sequential, actionable steps |
98
+ | Routing table | Does it define pass/fail/blocker routing? |
99
+
100
+ **Scoring:**
101
+ - **High signal** (70-100): Multiple concrete rules, examples, anti-patterns, workflow steps, routing
102
+ - **Medium signal** (30-69): Some structure but thin on specifics, few examples
103
+ - **Low signal** (0-29): Vague descriptions, no concrete rules, no anti-patterns, "be creative" level
104
+
105
+ ### 2b. Overlap Detection
106
+
107
+ Compare against all existing OH skills (`harness/skills/oh-*/SKILL.md`):
108
+
109
+ - Does any existing OH skill cover the same domain?
110
+ - Is the overlap partial (complementary) or complete (redundant)?
111
+ - Does the external skill have unique content OH lacks?
112
+
113
+ ### 2c. Convention Check
114
+
115
+ Does the skill follow good practices?
116
+
117
+ - [ ] Has clear description for triggering
118
+ - [ ] Has concrete, actionable instructions (not just philosophy)
119
+ - [ ] Has anti-patterns or failure modes documented
120
+ - [ ] Has examples or code blocks
121
+ - [ ] Has measurable outcomes (not subjective "make it good")
122
+ - [ ] Avoids time-sensitive references (dates, version numbers)
123
+ - [ ] Avoids platform-specific assumptions that don't apply
124
+
125
+ ### 2d. Report
126
+
127
+ Output a structured report:
128
+
129
+ ```markdown
130
+ ## Analysis: <skill-name>
131
+
132
+ **Source:** <path or origin>
133
+ **Depth score:** <0-100> — <High/Medium/Low>
134
+ **Total lines:** <N> | Concrete rules: <N> | Examples: <N> | Anti-patterns: <N>
135
+ **Overlap:** <existing OH skill> — <none/partial/complete>
136
+ **Verdict:** <keep / fuse / discard / ask>
137
+
138
+ **Strengths:**
139
+ - <what this skill does well>
140
+
141
+ **Weaknesses:**
142
+ - <what is missing or weak>
143
+
144
+ **Recommended action:** <port directly / fuse with X > / discard>
145
+ ```
146
+
147
+ ---
148
+
149
+ ## Phase 3: Decision
150
+
151
+ Based on the analysis, decide what to do:
152
+
153
+ | Verdict | Action |
154
+ |---|---|
155
+ | **Keep** | High signal, no overlap, OH conventions missing. Port directly to `oh-<name>`. |
156
+ | **Fuse** | Medium-high signal, partial overlap with existing OH skill(s). Merge complementary DNA. |
157
+ | **Discard** | Low signal, complete overlap, too niche, or no actionable content. Surface reasoning. |
158
+ | **Ask** | Ambiguous quality, unclear domain fit, or user needs to choose between approaches. Surface findings. |
159
+
160
+ **Decision principles:**
161
+ - When in doubt between keep and fuse, prefer fuse — conserves routing slots and reduces surface area
162
+ - When in doubt between keep and discard, prefer keep if there is ANY unique signal — the autopilot won't load it unless triggered
163
+ - Never fuse incompatible domains (e.g., UI design into a security skill) — the result is confusing
164
+
165
+ ---
166
+
167
+ ## Phase 4: Adaptation
168
+
169
+ Input: raw skill content to keep/fuse
170
+ Output: OH-native SKILL.md
171
+
172
+ ### 4a. Rewrite Frontmatter
173
+
174
+ ```markdown
175
+ ---
176
+ name: oh-<new-name>
177
+ description: "Adapted from <source>. <Core function>. Use when <triggers>."
178
+ tier: <2|3|4>
179
+ benefits-from: [<relevant oh- skills this depends on>]
180
+ triggers:
181
+ - "<trigger phrase from original, adapted>"
182
+ - "<new trigger phrases for OH context>"
183
+ ---
184
+ ```
185
+
186
+ ### 4b. Structure the Body
187
+
188
+ OH skill structure:
189
+ 1. **Summary** — one paragraph of what the skill does
190
+ 2. **When to Use** — clear triggering context
191
+ 3. **Workflow** — numbered steps (the core of the skill)
192
+ 4. **Anti-patterns** — what NOT to do
193
+ 5. **Routing** — pass/fail/blocker table
194
+
195
+ Adaptation rules:
196
+ - Remove all emojis from content
197
+ - Replace ecosystem-specific terminology with OH equivalents
198
+ - Convert relative paths to OH harness conventions
199
+ - Add routing table based on skill's purpose
200
+ - Keep all concrete rules, examples, and anti-patterns from the original
201
+ - Discard fluff, philosophy, and motivational language
202
+ - Preserve the original's unique signal — that's why you're importing it
203
+
204
+ ### 4c. Naming
205
+
206
+ - Name must match `^[a-z0-9]+(-[a-z0-9]+)*$`
207
+ - Prefix with `oh-`
208
+ - Use the original name if it maps well, adapt if not
209
+ - For fusions: invent a new name that captures the combined purpose
210
+
211
+ ---
212
+
213
+ ## Phase 5: Fusion (optional — skip for single-skill imports)
214
+
215
+ Input: 2+ analyzed skill contents with "fuse" verdict
216
+ Output: one unified skill that merges complementary DNA
217
+
218
+ ### 5a. Identify Complementary DNA
219
+
220
+ For each skill being fused, identify:
221
+ - **Unique rules/concepts** — content that only this skill has
222
+ - **Overlapping content** — same idea expressed differently (keep the better version)
223
+ - **Conflicting directives** — skills that say opposite things (surface to user)
224
+
225
+ ### 5b. Merge Architecture
226
+
227
+ Structure the fused skill so each source contributes its strength:
228
+
229
+ ```markdown
230
+ ## <Combined Workflow>
231
+
232
+ ### Phase A: <from skill 1>
233
+ <what skill 1 contributes>
234
+
235
+ ### Phase B: <from skill 2>
236
+ <what skill 2 contributes>
237
+
238
+ ### Phase C: <from skill 3>
239
+ <what skill 3 contributes>
240
+ ```
241
+
242
+ Do NOT just concatenate. The fused skill must read as a single coherent workflow, not three documents glued together.
243
+
244
+ ### 5c. Name the Fusion
245
+
246
+ The name should signal the combined purpose, not the individual sources.
247
+ - `oh-facade` (from redesign + design-taste + high-end-visual) — not `oh-redesign-plus-taste`
248
+ - Apply the same principle here
249
+
250
+ ---
251
+
252
+ ## Phase 6: Integration
253
+
254
+ Input: OH-native SKILL.md
255
+ Output: skill fully wired into the harness
256
+
257
+ ### 6a. Create the Skill File
258
+
259
+ Write to `~/.config/opencode/skills/oh-<name>/SKILL.md` (user dir, survives npm updates).
260
+ If the user has an alternative preference (`~/.agents/skills/`), use that instead.
261
+ The file structure follows the standard OH skill template.
262
+
263
+ ### 6b. Wire into AUTOPILOT
264
+
265
+ Add an entry to the auto-classify matrix in `harness/codex/AUTOPILOT.md`:
266
+ - Signal keywords that should trigger this skill
267
+ - Classification label
268
+ - Action: "Load **oh-<name>**. Do not ask."
269
+
270
+ ### 6c. Wire routing into frontmatter
271
+
272
+ Add `route:` frontmatter to the skill — no ROUTING.md edit needed. The dynamic routing system reads `route.pass`, `route.fail`, and `route.blocker` directly from the skill's own `SKILL.md`. The skill becomes routable automatically:
273
+
274
+ ```yaml
275
+ route:
276
+ pass: <next skill or done>
277
+ fail: <fallback skill or surface>
278
+ blocker: surface
279
+ ```
280
+
281
+ ### 6d. Wire into AGENTS.md
282
+
283
+ Add to the skills table in `AGENTS.md`:
284
+ - Skill, tier, purpose
285
+ - Increment the total count
286
+
287
+ ### 6e. Wire into openhermes.md
288
+
289
+ Add to the orchestrator's skill list in `harness/agents/openhermes.md`.
290
+
291
+ ### 6f. Verify Discovery
292
+
293
+ Route to `oh-skills-link` to confirm the skill is discoverable by OpenCode.
294
+
295
+ ---
296
+
297
+ ## Routing
298
+
299
+ | Outcome | Route |
300
+ |---|---|
301
+ | integration complete | -> oh-skills-link (verify discovery) |
302
+ | fusion with iteration needed | -> oh-skill-craft (optimize via eval loop) |
303
+ | analysis: discard | -> surface findings to user |
304
+ | analysis: ask | -> surface findings + recommendations to user |
305
+ | blocker | -> surface to user |
306
+
307
+ ## Anti-patterns
308
+
309
+ - Importing a skill without analyzing it first — always run Phase 2
310
+ - Keeping everything from the source — 50% of most external skills is fluff. Be ruthless.
311
+ - Fusing incompatible domains — the result confuses both the model and the user
312
+ - Naming after the source ("oh-tailwind-v2") instead of the capability ("oh-styles")
313
+ - Skipping route frontmatter — a skill without `route.pass`/`route.fail`/`route.blocker` won't auto-route
314
+ - Overwriting existing routing entries without checking for collisions
@@ -4,14 +4,18 @@ description: "Rigorous multi-axis testing gauntlet: unit, integration, edge case
4
4
  tier: 4
5
5
  benefits-from: [oh-expert, oh-builder]
6
6
  triggers:
7
- - "gauntlet"
7
+ - "run the gauntlet on"
8
8
  - "test everything"
9
9
  - "rigorous testing"
10
10
  - "review all angles"
11
- - "qa"
12
- - "full review"
13
- - "run the gauntlet"
14
- - "validate"
11
+ - "qa the feature"
12
+ - "full review of the code"
13
+ - "validate this feature"
14
+ - "thorough testing"
15
+ route:
16
+ pass: oh-ship
17
+ fail: oh-builder
18
+ blocker: surface
15
19
  ---
16
20
 
17
21
  # oh-gauntlet
@@ -34,7 +38,7 @@ If tests are missing or weak, flag what should be added. Do not add them here
34
38
 
35
39
  Spawn two sub-agents simultaneously:
36
40
 
37
- **Standards sub-agent:** Read the repo's documented standards (CONTEXT.md, AGENTS.md, eslint config, ADRs, STYLE.md, CONVENTIONS.md). Then read the diff. Report every place the diff violates a documented standard. Cite the standard source. Distinguish hard violations from judgement calls.
41
+ **Standards sub-agent:** Read the repo's documented standards (CONTEXT.md, AGENTS.md, eslint config, ADRs). Then read the diff. Report every place the diff violates a documented standard. Cite the standard source. Distinguish hard violations from judgement calls.
38
42
 
39
43
  **Spec sub-agent:** Read the spec source (plan.md, issue, PRD, or user's description). Then read the diff. Report: (a) requirements that are missing or partial, (b) scope creep (behavior not asked for), (c) requirements that look implemented but wrong. Quote the spec.
40
44
 
@@ -4,12 +4,16 @@ description: "Stress-test plans and designs through relentless Socratic question
4
4
  tier: 3
5
5
  benefits-from: [oh-expert, oh-planner]
6
6
  triggers:
7
- - "grill"
8
7
  - "stress test this plan"
9
- - "challenge this"
10
- - "grill me"
11
- - "poke holes"
12
- - "interrogate"
8
+ - "challenge this plan"
9
+ - "grill me on this"
10
+ - "poke holes in this plan"
11
+ - "interrogate this plan"
12
+ - "stress test this design"
13
+ route:
14
+ pass: oh-planner
15
+ fail: oh-expert
16
+ blocker: surface
13
17
  ---
14
18
 
15
19
  # oh-grill
@@ -1,6 +1,15 @@
1
1
  ---
2
2
  name: oh-guard
3
3
  description: "Safety confirmation mode — warn before destructive operations"
4
+ tier: 2
5
+ triggers:
6
+ - "confirm before"
7
+ - "safety confirmation"
8
+ - "guard mode"
9
+ route:
10
+ pass: mode
11
+ fail: mode
12
+ blocker: surface
4
13
  ---
5
14
 
6
15
  # oh-guard
@@ -1,6 +1,15 @@
1
1
  ---
2
2
  name: oh-handoff
3
3
  description: "Compact session state into a structured handoff document"
4
+ tier: 2
5
+ triggers:
6
+ - "session handoff"
7
+ - "handoff to another agent"
8
+ - "handoff the session"
9
+ route:
10
+ pass: done
11
+ fail: surface
12
+ blocker: surface
4
13
  ---
5
14
 
6
15
  # oh-handoff
@@ -3,12 +3,16 @@ name: oh-health
3
3
  description: "Code quality dashboard: runs project tools (typecheck, lint, test, dead code detection), computes weighted composite 0-10 score, persists history, shows trend. Read-only — no fixes."
4
4
  tier: 2
5
5
  triggers:
6
- - "health check"
7
- - "code quality"
6
+ - "health check the codebase"
7
+ - "code quality check"
8
8
  - "quality dashboard"
9
9
  - "how healthy is the codebase"
10
- - "run all checks"
11
- - "health"
10
+ - "run all project checks"
11
+ - "code health"
12
+ route:
13
+ pass: surface
14
+ fail: oh-investigate
15
+ blocker: surface
12
16
  ---
13
17
 
14
18
  # oh-health
@@ -1,22 +1,86 @@
1
1
  ---
2
2
  name: oh-init
3
- description: "Initialize project for agent-assisted development: scaffold CONTEXT.md, AGENTS.md, docs/adr/, configure issue tracker and triage labels."
3
+ description: "Initialize project for OpenHermes: wire AGENTS.md, configure domain docs, issue tracker, and triage labels. Does NOT create .opencode/ directory."
4
4
  tier: 2
5
5
  triggers:
6
- - "init project"
7
- - "setup project"
8
- - "initialize"
9
- - "onboard"
10
- - "scaffold"
6
+ - "init this project for oh"
7
+ - "setup project for openhermes"
8
+ - "initialize openhermes setup"
9
+ - "onboard this project"
10
+ - "scaffold project setup"
11
+ - "oh takeover this project"
12
+ route:
13
+ pass: done
14
+ fail: oh-init
15
+ blocker: surface
11
16
  ---
12
17
 
13
18
  # oh-init
14
19
 
15
- Per-repo setup for agent-assisted development. Run once per repo. Walks through configuration decisions one at a time.
20
+ Per-repo setup for OpenHermes-assisted development. Run once per repo. Wires AGENTS.md, configures domain docs, issue tracker, and triage labels. Does NOT create a `.opencode/` directory — plan files go to `~/.local/share/opencode/openhermes/plans/`.
21
+
22
+ Complements OpenCode's built-in `/init` command (which creates `AGENTS.md` with project build/test/architecture notes). Run oh-init after or instead — they serve different layers.
16
23
 
17
24
  ## Process
18
25
 
19
- ### 1. Issue Tracker
26
+ ### Phase 0: Check Existing State
27
+ Before writing anything, detect what already exists:
28
+
29
+ - ☐ `AGENTS.md` exists? (If yes, was it created by OpenCode `/init` or manually?)
30
+ - ☐ `opencode.json` / `opencode.jsonc` present?
31
+ - ☐ Canonical plan files (`~/.local/share/opencode/openhermes/plans/<project-name>-plan-*.md`)?
32
+ - ☐ `CONTEXT.md` exists?
33
+ - ☐ `docs/agents/` directory exists?
34
+
35
+ Report findings. If everything exists, offer to skip or verify and exit.
36
+
37
+ ### Phase 1: AGENTS.md Wiring
38
+
39
+ Check if AGENTS.md exists:
40
+
41
+ **If AGENTS.md does not exist:**
42
+ Create it with OpenHermes orchestrator header + prompts for project info:
43
+
44
+ ```markdown
45
+ # <project-name>
46
+
47
+ OpenHermes is the primary orchestrator. All routing, planning, and delegation flows through oh-* skills.
48
+
49
+ ## Project Context
50
+
51
+ - **Language**: <fill in>
52
+ - **Package manager**: <fill in>
53
+ - **Build command**: <fill in>
54
+ - **Test command**: <fill in>
55
+ - **Lint/type check**: <fill in>
56
+
57
+ ## Key Directives
58
+
59
+ - Plan first. Write to `~/.local/share/opencode/openhermes/plans/<project-name>-plan-<nnn>.md` before multi-file changes.
60
+ - **OpenHermes never executes tasks directly. It talks/reports to the user and delegates everything to sub-agents.**
61
+ - Verify before claiming success. Read files, run commands, confirm output.
62
+ - Never write code, run tests, or edit files in the main context — always delegate.
63
+ - Use oh-* skills on demand. Load via OpenCode's skill tool when relevant.
64
+ - Plan file is self-contained (Tasks, Completed, Work Log sections).
65
+ ```
66
+
67
+ Then ask the user to fill in the Project Context fields. Offer to auto-detect from package manifests.
68
+
69
+ **If AGENTS.md exists** (e.g., created by OpenCode `/init`):
70
+ Append an `## OpenHermes Orchestrator` section to the end:
71
+
72
+ ```markdown
73
+ ## OpenHermes Orchestrator
74
+
75
+ OpenHermes is the primary orchestrator for this session.
76
+
77
+ - **Orchestrator**: OpenHermes — hub-and-spoke routing through oh-* skills
78
+ - **Plan**: `~/.local/share/opencode/openhermes/plans/<project-name>-plan-<nnn>.md` — always check before starting work
79
+ - **Never execute**: OpenHermes talks/reports to the user and delegates everything to sub-agents
80
+ - **Verify before claim**: read files, run commands, confirm output
81
+ ```
82
+
83
+ ### Phase 2: Issue Tracker
20
84
  Detect the git hosting platform:
21
85
  - **GitHub** — `gh` CLI
22
86
  - **GitLab** — `glab` CLI
@@ -25,7 +89,7 @@ Detect the git hosting platform:
25
89
 
26
90
  Confirm with the user. Write the result to `docs/agents/issue-tracker.md`.
27
91
 
28
- ### 2. Triage Labels
92
+ ### Phase 3: Triage Labels
29
93
  The `triage` skill uses these label strings to move issues through a state machine:
30
94
  - `needs-triage` — maintainer needs to evaluate
31
95
  - `needs-info` — waiting on reporter
@@ -35,7 +99,7 @@ The `triage` skill uses these label strings to move issues through a state machi
35
99
 
36
100
  If the repo already has different label names, map them. Write to `docs/agents/triage-labels.md`.
37
101
 
38
- ### 3. Domain Docs
102
+ ### Phase 4: Domain Docs
39
103
  Configure how the project organizes domain language:
40
104
  - **Single-context** — one `CONTEXT.md` + `docs/adr/` at repo root
41
105
  - **Multi-context** — `CONTEXT-MAP.md` pointing to per-context files
@@ -44,7 +108,7 @@ Scaffold `CONTEXT.md` with project name, domain description, and placeholder glo
44
108
 
45
109
  Write to `docs/agents/domain.md`.
46
110
 
47
- ### 4. Agent Skills Block
111
+ ### Phase 5: Agent Skills Block
48
112
  Add a `## Agent skills` section to `AGENTS.md` (or `CLAUDE.md` if it exists):
49
113
 
50
114
  ```markdown
@@ -60,14 +124,17 @@ Add a `## Agent skills` section to `AGENTS.md` (or `CLAUDE.md` if it exists):
60
124
  <summary>. See docs/agents/domain.md.
61
125
  ```
62
126
 
63
- ### 5. Decision Record
64
- Record: "oh-init completed for project \<name\> on \<date\>."
127
+ ### Phase 6: Decision Record
128
+ Record: "oh-init completed for project <name> on <date>."
65
129
 
66
130
  ## Anti-patterns
67
131
  - Running init without understanding the project domain
68
132
  - Scaffolding CONTEXT.md without populating any terms
69
133
  - Creating ADR directory but never writing ADRs
70
134
  - Creating both AGENTS.md and CLAUDE.md — edit the one that exists
135
+ - Overwriting an existing AGENTS.md created by OpenCode `/init` (append instead)
136
+ - Creating `.opencode/` directory — plan files go to OpenCode's canonical storage, not a hidden project dir
137
+ - Empty instinct file never getting populated (run oh-learn extract periodically)
71
138
 
72
139
  ## Routing
73
140
 
@@ -1,6 +1,16 @@
1
1
  ---
2
2
  name: oh-investigate
3
3
  description: "Systematic bug diagnosis with root cause investigation"
4
+ tier: 2
5
+ triggers:
6
+ - "investigate this bug"
7
+ - "debug this"
8
+ - "why is this broken"
9
+ - "root cause"
10
+ route:
11
+ pass: oh-builder
12
+ fail: oh-expert
13
+ blocker: surface
4
14
  ---
5
15
 
6
16
  # oh-investigate
@@ -8,14 +18,52 @@ description: "Systematic bug diagnosis with root cause investigation"
8
18
  ## When to Use
9
19
  When a bug is reported, a test fails, or unexpected behavior occurs. Use this before attempting any fix.
10
20
 
11
- ## Workflow
12
- 1. **Reproduce** — get a reliable reproduction case (script, test, or steps)
13
- 2. **Minimise** strip away unrelated code until the minimal reproduction remains
14
- 3. **Hypothesise** — list possible root causes, rank by likelihood
15
- 4. **Instrument**add logging, assertions, or debug output to test hypothesis
16
- 5. **Fix** — implement the smallest correct change addressing root cause
17
- 6. **Regression test** verify fix doesn't break existing behavior
18
- 7. **Document** — log the root cause and fix in the handoff, issue, or docs that are actually in scope
21
+ ## Phase 0 — Build a feedback loop
22
+
23
+ **This is the actual skill. Everything else is mechanical.**
24
+
25
+ If you have a fast, deterministic, agent-runnable pass/fail signal for the bug, you will find the cause bisection, hypothesis-testing, and instrumentation are just consuming that signal. If you don't have one, no amount of staring at code will save you.
26
+
27
+ Spend disproportionate effort here. **Be aggressive. Be creative. Refuse to give up.**
28
+
29
+ ### Ways to construct a feedback loop (try in this order)
30
+
31
+ 1. **Failing test** at whatever seam reaches the bug.
32
+ 2. **Curl / HTTP script** against a running dev server.
33
+ 3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot.
34
+ 4. **Headless browser script** — drive the UI, assert on DOM/console/network.
35
+ 5. **Replay a captured trace** — save a real payload/event log, replay it in isolation.
36
+ 6. **Throwaway harness** — minimal subset of the system exercising the bug code path with a single call.
37
+ 7. **Property / fuzz loop** — run 1000 random inputs, look for the failure mode.
38
+ 8. **Bisection harness** — automate "boot at state X, check, repeat" so you can `git bisect run` it.
39
+ 9. **Differential loop** — run same input through old-version vs new-version, diff outputs.
40
+ 10. **HITL script** — last resort. Drive a human with a structured loop.
41
+
42
+ ### Iterate on the loop itself
43
+
44
+ - Can I make it faster? (Cache setup, skip unrelated init, narrow the scope.)
45
+ - Can I make the signal sharper? (Assert on the specific symptom, not "didn't crash".)
46
+ - Can I make it more deterministic? (Pin time, seed RNG, isolate filesystem.)
47
+
48
+ A 30-second flaky loop is barely better than no loop. A 2-second deterministic loop is a debugging superpower.
49
+
50
+ ### Non-deterministic bugs
51
+
52
+ The goal is not a clean repro but a **higher reproduction rate**. Loop the trigger 100×, parallelise, add stress, narrow timing windows. A 50%-flake bug is debuggable; 1% is not.
53
+
54
+ ### When you genuinely cannot build a loop
55
+
56
+ Stop and say so explicitly. List what you tried. Do **not** proceed to hypothesise without a loop.
57
+
58
+ ## Workflow (consumes the loop)
59
+
60
+ 1. **Reproduce** — run the loop, confirm the bug appears. The loop must match the user's described failure, not a different nearby failure.
61
+ 2. **Minimise** — strip away unrelated code until the minimal reproduction remains.
62
+ 3. **Hypothesise** — generate 3–5 ranked falsifiable hypotheses before testing any. Each must state a prediction: "If X is the cause, then changing Y will make the bug disappear".
63
+ 4. **Instrument** — one probe per hypothesis. Change one variable at a time. Tag every debug log with a unique prefix (e.g. `[DEBUG-a4f2]`) for easy cleanup.
64
+ 5. **Fix** — write the regression test at a correct seam first. Watch it fail. Apply the smallest correct change. Watch it pass. Re-run the Phase 0 loop against the original scenario.
65
+ 6. **Regression test** — verify fix doesn't break existing behavior. If no correct seam exists for a regression test, that itself is a finding — flag the architecture gap.
66
+ 7. **Document** — log the root cause and fix in the handoff, issue, or relevant docs. State which hypothesis was correct so the next debugger learns.
19
67
 
20
68
  ## Iron Law
21
69
  No fixes without root cause. Surface-level fixes compound into technical debt.
@@ -25,6 +73,7 @@ No fixes without root cause. Surface-level fixes compound into technical debt.
25
73
  - Changing code without reproducing the bug first
26
74
  - "Shotgun" debugging — changing multiple things hoping one sticks
27
75
  - Not documenting root cause for future reference
76
+ - Proceeding to hypothesise without a feedback loop
28
77
 
29
78
  ## Routing
30
79
 
@@ -1,6 +1,15 @@
1
1
  ---
2
2
  name: oh-issue
3
3
  description: "Break a plan, spec, or PRD into independently-grabbable GitHub issues"
4
+ tier: 2
5
+ triggers:
6
+ - "break into issues"
7
+ - "create issues from plan"
8
+ - "issue breakdown"
9
+ route:
10
+ pass: done
11
+ fail: oh-planner
12
+ blocker: surface
4
13
  ---
5
14
 
6
15
  # oh-issue