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
@@ -1,28 +1,101 @@
1
1
  ---
2
2
  name: oh-learn
3
- description: "Review, search, prune, and export session learnings"
3
+ description: "Extract, evolve, and promote session learnings as instincts. Review, search, prune, export."
4
+ tier: 2
5
+ triggers:
6
+ - "learn from session"
7
+ - "extract patterns"
8
+ - "run oh-learn"
9
+ route:
10
+ pass: done
11
+ fail: surface
12
+ blocker: surface
4
13
  ---
5
14
 
6
15
  # oh-learn
7
16
 
17
+ Learning engine for the harness. Distills patterns from sessions into **instincts** (trigger-action pairs with confidence), clusters them into skill candidates, and graduates high-signal patterns from project to global scope.
18
+
19
+ ## Instinct Data Model
20
+
21
+ Every learning stored as one JSONL line in `~/.local/share/opencode/openhermes/plans/<project-name>-instincts.jsonl`:
22
+
23
+ ```json
24
+ { "trigger": "situation pattern", "action": "recommended response", "confidence": 0.5, "applications": 1, "successes": 1, "category": "coding", "source": "oh-learn:extract", "ts": "2026-05-15T12:00:00Z" }
25
+ ```
26
+
27
+ **Rules:**
28
+ - **Trigger** — specific, matchable situation. *Not* general advice.
29
+ - **Action** — executable response. *Not* a belief.
30
+ - **Confidence** — starts at 0.5, increments +0.05 per successful application, decays -0.02 per day without use.
31
+ - **Category** — one of: `coding`, `testing`, `security`, `git`, `planning`, `orchestration`, `debugging`, `ux`.
32
+
8
33
  ## When to Use
9
- To review what the agent has learned across sessions, search for specific patterns, prune stale knowledge, or export learnings for documentation.
10
34
 
11
- ## Workflow
12
- 1. **Review** — show recent learnings with context
13
- 2. **Search** — find learnings matching specific topics or patterns
14
- 3. **Prune** — remove stale, redundant, or superseded learnings
15
- 4. **Export** — format learnings for documentation or sharing
35
+ After completing a significant piece of work, at session handoff, or when you notice the same pattern repeat 2+ times in one session. Also on explicit user request.
36
+
37
+ ## Workflows
38
+
39
+ ### Extract
40
+ Mine the current session for reusable patterns.
41
+
42
+ 1. Scan recent conversation + code changes for repeated decision patterns
43
+ 2. For each distinct pattern write an instinct: trigger, action, confidence=0.5, category
44
+ 3. Read existing `~/.local/share/opencode/openhermes/plans/<project-name>-instincts.jsonl`, check for near-duplicate triggers
45
+ 4. If duplicate found: merge — `confidence = max(existing, 0.8 × new)`, increment applications
46
+ 5. If new: append line to file
47
+
48
+ **Good instinct:** trigger=`"tsc --noEmit shows 10+ errors after batch edit"`, action=`"Fix errors one at a time, re-running tsc after each, rather than batch-fixing"`, category=`"debugging"`
49
+
50
+ **Bad instinct:** `"Write clean code"` — too vague to trigger on.
51
+
52
+ ### Evolve
53
+ Cluster related instincts into skill/command/agent candidates.
54
+
55
+ 1. Read all instincts from `~/.local/share/opencode/openhermes/plans/<project-name>-instincts.jsonl`
56
+ 2. Group by `category`, then by trigger topic similarity
57
+ 3. **If cluster ≥ 5 instincts AND avg confidence ≥ 0.7** → generate `oh-skill-craft` spec for a new skill
58
+ 4. **If cluster 3-4 instincts with confidence ≥ 0.8** → suggest update to existing skill
59
+ 5. Output candidate summary with trigger list and extracted core pattern
60
+
61
+ ### Promote
62
+ Graduate high-confidence instincts from project to global scope.
63
+
64
+ 1. Scan `~/.local/share/opencode/openhermes/plans/<project-name>-instincts.jsonl` for instincts with `confidence >= 0.85 AND applications >= 10`
65
+ 2. Filter out project-specific patterns (reference paths, local APIs, domain terms)
66
+ 3. Append filtered candidates to `%USERPROFILE%\.config\opencode\instincts.jsonl` (global)
67
+ 4. Tag promoted instincts with `"promoted": true` in project file
68
+ 5. Report: "Promoted N instincts to global scope"
69
+
70
+ ### Review
71
+ Show instinct summary: total count, confidence distribution, category breakdown, recently promoted.
72
+
73
+ ### Search
74
+ Find instincts by topic, trigger fragment, category, or confidence range.
75
+
76
+ ### Prune
77
+ Remove instincts stale for 30+ days with confidence < 0.3, or superseded by a higher-confidence instinct covering the same trigger.
78
+
79
+ ### Export
80
+ Serialize instincts to portable JSON for sharing across projects or teams:
81
+
82
+ ```json
83
+ { "version": 1, "exported": "2026-05-15T12:00:00Z", "instincts": [...] }
84
+ ```
16
85
 
17
86
  ## Anti-patterns
87
+
18
88
  - Hoarding every observation (most things aren't learnings)
19
89
  - Never pruning (stale knowledge is worse than no knowledge)
20
90
  - Storing what, not why (context-less facts are forgettable)
91
+ - Over-promoting: not every pattern is globally useful
92
+ - Extracting without applying: instincts that never trigger are noise
93
+ - Ignoring confidence: treating all instincts as equally reliable
21
94
 
22
95
  ## Routing
23
96
 
24
97
  | Outcome | Route |
25
98
  |---------|-------|
26
- | pass | → [done — read-only report] |
99
+ | pass | → [done — report summary] |
27
100
  | fail | → [surface gaps to user] |
28
101
  | blocker | → surface to user |
@@ -4,37 +4,53 @@ description: "Full build loop: plan → build → verify → loop until done or
4
4
  tier: 4
5
5
  benefits-from: [oh-planner, oh-builder, oh-expert]
6
6
  triggers:
7
- - "manifest"
8
- - "full build"
7
+ - "run the full build"
8
+ - "full build pipeline"
9
9
  - "build loop"
10
10
  - "build until done"
11
- - "orchestrate"
12
- - "pipeline"
11
+ - "orchestrate this build"
12
+ - "pipeline from plan"
13
13
  - "run the plan"
14
+ - "manifest this"
15
+ route:
16
+ pass: oh-planner
17
+ fail: oh-expert
18
+ blocker: surface
14
19
  ---
15
20
 
16
21
  # oh-manifest
17
22
 
18
- Full build orchestration loop. Runs planner → builder → verify → repeat until done or a blocker is surfaced. Uses gstack decision principles to auto-resolve intermediate questions. Only interrupts the user for genuine blockers.
23
+ Full build orchestration loop. Runs pre-flight checks → planner → builder → verify → repeat until done or a blocker is surfaced. Uses decision principles to auto-resolve intermediate questions. Only interrupts the user for genuine blockers.
19
24
 
20
25
  ## Pipeline
21
26
 
27
+ ### Phase 0: Pre-Flight
28
+
29
+ Before any work begins, ALL of these MUST pass:
30
+
31
+ - ☐ **Quality baseline** — existing tests pass (if any). Capture output for before/after comparison.
32
+ - ☐ **Rollback path** — clean `git stash` or a committed state you can return to.
33
+ - ☐ **Branch isolation** — confirm you are on a working branch, not main/master.
34
+ - ☐ **Scope documented** — plan or task description exists and is unambiguous.
35
+
36
+ If any check fails → **STOP**. Report which check failed and why. Do not proceed to Phase 1 until the blocker is resolved.
37
+
22
38
  ### Step 1: Plan
23
- - If `.opencode/plan.md` exists, load and verify it is current
39
+ - If a plan file (`~/.local/share/opencode/openhermes/plans/<project-name>-plan-<nnn>.md`) exists, load and verify it is current
24
40
  - If not, run `oh-planner` (Mode A, B, or C depending on context)
25
41
  - Auto-decide minor scope decisions using decision principles
26
42
  - Surface only: premises that need human judgment, or plan/alternative conflicts
27
43
 
28
44
  ### Step 2: Build
29
- - For each phase in plan.md, run `oh-builder` (Mode D: From Plan)
45
+ - For each phase in the plan file, run `oh-builder` (Mode D: From Plan)
30
46
  - Implements phases in dependency order
31
47
  - Parallelizable phases may be delegated to sub-agents
32
48
  - Auto-decide implementation choices using decision principles
33
49
 
34
50
  ### Step 3: Verify
35
- - Check each phase against its verification criteria in plan.md
51
+ - Check each phase against its verification criteria in the plan file
36
52
  - Run tests if they exist
37
- - If phase passes: mark complete in plan.md, proceed to next
53
+ - If phase passes: mark complete in plan file, proceed to next
38
54
  - If phase fails: diagnose (use oh-expert self-diagnosis), fix, re-verify
39
55
  - If fix is impossible within scope: surface blocker
40
56
 
@@ -43,6 +59,32 @@ Full build orchestration loop. Runs planner → builder → verify → repeat un
43
59
  - Phase failed and cannot be fixed → BLOCKER (surface to user with context)
44
60
  - Phase passed but new work discovered → add to plan, continue loop
45
61
 
62
+ ## Loop Patterns
63
+
64
+ Select a pattern based on the nature of the work:
65
+
66
+ | Pattern | Use When | Behavior |
67
+ |---------|----------|----------|
68
+ | **sequential** | Normal feature work | One phase at a time, verify each before next |
69
+ | **continuous-pr** | Multi-step refactors | Each phase is its own PR — commit, push, PR per phase |
70
+ | **infinite** | Watch mode, CI repair | Continue until external stop signal or budget exhausted |
71
+ | **rfc-dag** | Complex dependency chains | Resolve phase ordering by DAG; parallelize independent branches |
72
+
73
+ Default is **sequential**. Switch patterns only when the work structure demands it.
74
+
75
+ ## Escalation Triggers
76
+
77
+ These conditions cause the loop to **pause** and surface to the user:
78
+
79
+ | Trigger | Condition | Action |
80
+ |---------|-----------|--------|
81
+ | **Stall** | 2 consecutive checkpoints with zero measurable progress | Pause. Report what was attempted, what blocked. |
82
+ | **Retry storm** | Same error message 3+ times in the loop | Stop retrying. Surface error with attempted fixes. |
83
+ | **Cost drift** | Cumulative changes exceed scope documented in pre-flight | Pause. Show diff between planned and actual scope. |
84
+ | **Quality regression** | Verify phase scores lower than pre-flight baseline | Pause. Report degraded metrics. Do not push through. |
85
+
86
+ These are not optional suggestions. When a trigger fires, the loop **must** pause and report.
87
+
46
88
  ## Decision Principles
47
89
 
48
90
  Auto-resolve these without asking the user:
@@ -69,11 +111,13 @@ When a blocker is encountered:
69
111
  4. **Wait for user decision** before continuing
70
112
 
71
113
  ## Anti-patterns
114
+ - Skipping pre-flight (every loop needs a baseline and a rollback plan)
72
115
  - Auto-deciding premises (fundamental assumptions need user input)
73
116
  - Pushing through blockers (surface immediately, don't try 5 workarounds silently)
74
117
  - Skipping verification (verify every phase, not just the final result)
75
- - Parallelizing dependent phases (respect the dependency order in plan.md)
76
- - Forgetting to update plan.md with completion status
118
+ - Parallelizing dependent phases (respect the dependency order in the plan file)
119
+ - Forgetting to update the plan file with completion status
120
+ - Ignoring escalation triggers (stall means pause, not try harder)
77
121
 
78
122
  ## Routing
79
123
 
@@ -4,15 +4,22 @@ description: "Multi-lens plan review: 4 perspectives in one skill. Choose Engine
4
4
  tier: 3
5
5
  benefits-from: [oh-planner, oh-expert]
6
6
  triggers:
7
- - "plan review"
8
- - "review the plan"
9
- - "architecture review"
10
- - "design review"
11
- - "ux review"
12
- - "dx review"
7
+ - "review this plan"
8
+ - "review the plan file"
9
+ - "architecture review of"
10
+ - "design review the plan"
11
+ - "ux review this plan"
12
+ - "dx review the plan"
13
13
  - "strategy review"
14
- - "eng review"
14
+ - "engineering review"
15
15
  - "ceo review"
16
+ - "review plan from"
17
+ route:
18
+ pass:
19
+ - oh-grill
20
+ - oh-manifest
21
+ fail: oh-planner
22
+ blocker: surface
16
23
  ---
17
24
 
18
25
  # oh-plan-review
@@ -110,7 +117,7 @@ Product/CEO review with 4 scope modes.
110
117
 
111
118
  ## Output
112
119
 
113
- After each lens, the plan file (`/.opencode/plan.md`) is updated with findings and decisions. The user reviews and accepts changes interactively.
120
+ After each lens, the plan file (`~/.local/share/opencode/openhermes/plans/<project-name>-plan-<nnn>.md`) is updated with findings and decisions. The user reviews and accepts changes interactively.
114
121
 
115
122
  ## Rules
116
123
 
@@ -6,17 +6,23 @@ benefits-from: [oh-expert, oh-grill]
6
6
  triggers:
7
7
  - "plan this"
8
8
  - "how should I build"
9
- - "architecture"
9
+ - "plan the architecture for"
10
10
  - "design this feature"
11
11
  - "brainstorm"
12
12
  - "autoplan"
13
- - "strategy"
14
- - "scope this"
13
+ - "strategy for this feature"
14
+ - "scope this feature"
15
+ - "create a plan for"
16
+ - "whats the plan for"
17
+ route:
18
+ pass: oh-grill
19
+ fail: oh-planner
20
+ blocker: surface
15
21
  ---
16
22
 
17
23
  # oh-planner
18
24
 
19
- The ALL-arounder planner. Merges brainstorm, architecture analysis, strategy review, and automatic plan review into one skill. Produces `.opencode/plan.md` that oh-builder consumes.
25
+ The ALL-arounder planner. Merges brainstorm, architecture analysis, strategy review, and automatic plan review into one skill. Produces a plan file in OpenCode's canonical storage at `~/.local/share/opencode/openhermes/plans/`.
20
26
 
21
27
  ## Entry Modes
22
28
 
@@ -80,9 +86,7 @@ Never auto-decide: premises (need human judgment) or cases where both the plan a
80
86
 
81
87
  ## Plan Artifact
82
88
 
83
- Output goes in `.opencode/plan.md` with this structure (matching the global AGENTS.md schema).
84
-
85
- **Then save a copy** to `%USERPROFILE%/.config/opencode/task/<project-name>-plan-<nnn>.md` per AGENTS.md persistent plan rules.
89
+ Output goes in `~/.local/share/opencode/openhermes/plans/<project-name>-plan-<nnn>.md` (OpenCode's canonical storage, sequence-numbered per-session/project). The plan ID matches the filename.
86
90
 
87
91
  ```markdown
88
92
  # PLAN: <project-name>
@@ -93,7 +97,7 @@ Status: active
93
97
  Created: <local-date-time>
94
98
  Updated: <local-date-time>
95
99
  Project Path: <absolute-project-path>
96
- Plan Path: .opencode/plan.md
100
+ Plan Path: ~/.local/share/opencode/openhermes/plans/<project-name>-plan-<nnn>.md
97
101
  Objective: <short objective>
98
102
 
99
103
  ## Current State
@@ -123,6 +127,10 @@ Objective: <short objective>
123
127
 
124
128
  - <what's done>
125
129
 
130
+ ## Work Log
131
+
132
+ <timestamped entries for subagent handoffs>
133
+
126
134
  ## Blockers
127
135
 
128
136
  - None
@@ -142,6 +150,8 @@ Objective: <short objective>
142
150
  <anything else>
143
151
  ```
144
152
 
153
+ The plan file is self-contained — Tasks, Completed, Subagents, and Work Log sections eliminate the need for separate todo.md or work-log.md files.
154
+
145
155
  ## Anti-patterns
146
156
  - Skipping strategy review for complex features (architecture mistakes compound)
147
157
  - Plans at wrong granularity — too vague to execute or too detailed to read
@@ -1,6 +1,15 @@
1
1
  ---
2
2
  name: oh-prd
3
3
  description: "Turn conversation context into a PRD and publish as GitHub issue"
4
+ tier: 2
5
+ triggers:
6
+ - "write a prd"
7
+ - "product requirements"
8
+ - "prd for"
9
+ route:
10
+ pass: oh-issue
11
+ fail: oh-grill
12
+ blocker: surface
4
13
  ---
5
14
 
6
15
  # oh-prd