openhermes 4.3.0 → 4.11.2

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 (143) hide show
  1. package/CONTEXT.md +10 -1
  2. package/README.md +54 -42
  3. package/bootstrap.ts +396 -142
  4. package/harness/agents/oh-browser.md +97 -0
  5. package/harness/agents/oh-builder.md +78 -0
  6. package/harness/agents/oh-facade.md +75 -0
  7. package/harness/agents/oh-fusion.md +45 -0
  8. package/harness/agents/oh-gauntlet.md +71 -0
  9. package/harness/agents/oh-grill.md +71 -0
  10. package/harness/agents/oh-investigate.md +60 -0
  11. package/harness/agents/oh-manifest.md +95 -0
  12. package/harness/agents/oh-plan-review.md +40 -0
  13. package/harness/agents/oh-planner.md +50 -0
  14. package/harness/agents/oh-refactor.md +37 -0
  15. package/harness/agents/oh-retro.md +46 -0
  16. package/harness/agents/oh-review.md +85 -0
  17. package/harness/agents/oh-security.md +83 -0
  18. package/harness/agents/oh-ship.md +76 -0
  19. package/harness/agents/oh-skill-craft.md +38 -0
  20. package/harness/agents/openhermes.md +28 -73
  21. package/harness/codex/AUTOPILOT.md +235 -87
  22. package/harness/codex/CHARTER.md +80 -0
  23. package/harness/instructions/SHELL.md +76 -0
  24. package/harness/lib/background/background.test.ts +197 -0
  25. package/harness/lib/background/index.ts +7 -0
  26. package/harness/lib/background/interfaces.ts +31 -0
  27. package/harness/lib/background/manager.ts +320 -0
  28. package/harness/lib/composer/compose.test.ts +168 -0
  29. package/harness/lib/composer/compose.ts +65 -0
  30. package/harness/lib/composer/fragments/01-identity.md +1 -0
  31. package/harness/lib/composer/fragments/02-delegation.md +6 -0
  32. package/harness/lib/composer/fragments/03-permissions.md +13 -0
  33. package/harness/lib/composer/fragments/04-task-flow.md +15 -0
  34. package/harness/lib/composer/fragments/05-confidence.md +5 -0
  35. package/harness/lib/composer/fragments/06-parallelization.md +17 -0
  36. package/harness/lib/composer/fragments/07-shell.md +41 -0
  37. package/harness/lib/composer/fragments/08-routing.md +8 -0
  38. package/harness/lib/composer/fragments/09-guardrails.md +12 -0
  39. package/harness/lib/composer/index.ts +1 -0
  40. package/harness/lib/hooks/builtins/confidence-gate-hook.ts +70 -0
  41. package/harness/lib/hooks/builtins/delegation-depth-hook.ts +59 -0
  42. package/harness/lib/hooks/builtins/error-recovery-hook.ts +107 -0
  43. package/harness/lib/hooks/builtins/memory-sync-hook.ts +73 -0
  44. package/harness/lib/hooks/builtins/plan-check-hook.ts +43 -0
  45. package/harness/lib/hooks/builtins/route-tracking-hook.ts +147 -0
  46. package/harness/lib/hooks/builtins/sanity-check-hook.ts +52 -0
  47. package/harness/lib/hooks/builtins/shell-detect-hook.ts +96 -0
  48. package/harness/lib/hooks/hooks.test.ts +1016 -0
  49. package/harness/lib/hooks/index.ts +30 -0
  50. package/harness/lib/hooks/registry.ts +416 -0
  51. package/harness/lib/hooks/types.ts +71 -0
  52. package/harness/lib/memory/index.ts +18 -0
  53. package/harness/lib/memory/interfaces.ts +53 -0
  54. package/harness/lib/memory/memory-manager.ts +205 -0
  55. package/harness/lib/memory/memory.test.ts +491 -0
  56. package/harness/lib/memory/plan-store.ts +366 -0
  57. package/harness/lib/recovery/handler.ts +243 -0
  58. package/harness/lib/recovery/index.ts +14 -0
  59. package/harness/lib/recovery/interfaces.ts +48 -0
  60. package/harness/lib/recovery/patterns.ts +149 -0
  61. package/harness/lib/recovery/recovery.test.ts +312 -0
  62. package/harness/lib/sanity/anomaly-tracker.ts +127 -0
  63. package/harness/lib/sanity/checker.ts +178 -0
  64. package/harness/lib/sanity/index.ts +13 -0
  65. package/harness/lib/sanity/interfaces.ts +24 -0
  66. package/harness/lib/sanity/sanity.test.ts +472 -0
  67. package/harness/lib/sync/file-watcher.ts +174 -0
  68. package/harness/lib/sync/index.ts +11 -0
  69. package/harness/lib/sync/interfaces.ts +27 -0
  70. package/harness/lib/sync/plan-sync.ts +536 -0
  71. package/harness/lib/sync/sync.test.ts +832 -0
  72. package/harness/skills/oh-ascii/DEEP.md +292 -0
  73. package/harness/skills/oh-ascii/SKILL.md +31 -0
  74. package/harness/skills/oh-ascii/scripts/check_ascii_alignment.py +596 -0
  75. package/harness/skills/oh-browser/DEEP.md +54 -0
  76. package/harness/skills/oh-browser/SKILL.md +30 -0
  77. package/harness/skills/oh-builder/DEEP.md +63 -0
  78. package/harness/skills/oh-builder/SKILL.md +12 -90
  79. package/harness/skills/oh-expert/DEEP.md +85 -0
  80. package/harness/skills/oh-expert/SKILL.md +13 -106
  81. package/harness/skills/oh-facade/DEEP.md +182 -0
  82. package/harness/skills/oh-facade/SKILL.md +15 -279
  83. package/harness/skills/oh-freeze/DEEP.md +18 -0
  84. package/harness/skills/oh-freeze/SKILL.md +10 -19
  85. package/harness/skills/oh-full-output/DEEP.md +25 -0
  86. package/harness/skills/oh-full-output/SKILL.md +12 -65
  87. package/harness/skills/oh-fusion/DEEP.md +120 -0
  88. package/harness/skills/oh-fusion/SKILL.md +17 -295
  89. package/harness/skills/oh-gauntlet/DEEP.md +77 -0
  90. package/harness/skills/oh-gauntlet/SKILL.md +13 -105
  91. package/harness/skills/oh-grill/DEEP.md +51 -0
  92. package/harness/skills/oh-grill/SKILL.md +12 -63
  93. package/harness/skills/oh-guard/DEEP.md +19 -0
  94. package/harness/skills/oh-guard/SKILL.md +10 -24
  95. package/harness/skills/oh-handoff/DEEP.md +48 -0
  96. package/harness/skills/oh-handoff/SKILL.md +13 -23
  97. package/harness/skills/oh-health/DEEP.md +74 -0
  98. package/harness/skills/oh-health/SKILL.md +13 -76
  99. package/harness/skills/oh-init/DEEP.md +85 -0
  100. package/harness/skills/oh-init/SKILL.md +13 -127
  101. package/harness/skills/oh-investigate/DEEP.md +171 -0
  102. package/harness/skills/oh-investigate/SKILL.md +13 -66
  103. package/harness/skills/oh-issue/DEEP.md +21 -0
  104. package/harness/skills/oh-issue/SKILL.md +11 -27
  105. package/harness/skills/oh-manifest/DEEP.md +92 -0
  106. package/harness/skills/oh-manifest/SKILL.md +12 -109
  107. package/harness/skills/oh-plan-review/DEEP.md +90 -0
  108. package/harness/skills/oh-plan-review/SKILL.md +13 -115
  109. package/harness/skills/oh-planner/DEEP.md +172 -0
  110. package/harness/skills/oh-planner/SKILL.md +12 -149
  111. package/harness/skills/oh-prd/DEEP.md +45 -0
  112. package/harness/skills/oh-prd/SKILL.md +10 -26
  113. package/harness/skills/oh-refactor/DEEP.md +122 -0
  114. package/harness/skills/oh-refactor/SKILL.md +17 -410
  115. package/harness/skills/oh-retro/DEEP.md +26 -0
  116. package/harness/skills/oh-retro/SKILL.md +12 -24
  117. package/harness/skills/oh-review/DEEP.md +87 -0
  118. package/harness/skills/oh-review/SKILL.md +11 -97
  119. package/harness/skills/oh-security/DEEP.md +83 -0
  120. package/harness/skills/oh-security/SKILL.md +14 -96
  121. package/harness/skills/oh-ship/DEEP.md +141 -0
  122. package/harness/skills/oh-ship/SKILL.md +14 -32
  123. package/harness/skills/oh-skill-craft/DEEP.md +369 -0
  124. package/harness/skills/oh-skill-craft/SKILL.md +13 -177
  125. package/harness/skills/oh-skills-link/DEEP.md +16 -0
  126. package/harness/skills/oh-skills-link/SKILL.md +10 -20
  127. package/harness/skills/oh-skills-list/DEEP.md +20 -0
  128. package/harness/skills/oh-skills-list/SKILL.md +9 -22
  129. package/harness/skills/oh-triage/DEEP.md +23 -0
  130. package/harness/skills/oh-triage/SKILL.md +8 -24
  131. package/harness/skills/oh-worktree/DEEP.md +169 -0
  132. package/harness/skills/oh-worktree/SKILL.md +32 -0
  133. package/lib/harness-resolver.ts +8 -10
  134. package/package.json +7 -5
  135. package/tsconfig.json +1 -1
  136. package/harness/codex/CONSTITUTION.md +0 -73
  137. package/harness/codex/ROUTING.md +0 -92
  138. package/harness/commands/oh-doctor.md +0 -26
  139. package/harness/commands/oh-log.md +0 -18
  140. package/harness/instructions/RUNTIME.md +0 -30
  141. package/harness/skills/oh-caveman/SKILL.md +0 -42
  142. package/harness/skills/oh-learn/SKILL.md +0 -101
  143. package/lib/logger.ts +0 -75
@@ -1,42 +0,0 @@
1
- ---
2
- name: oh-caveman
3
- description: "Ultra-compressed communication mode — cut token usage ~75%"
4
- tier: 2
5
- triggers:
6
- - "compress your response"
7
- - "caveman mode"
8
- - "shorter answers"
9
- route:
10
- pass: mode
11
- fail: mode
12
- blocker: surface
13
- ---
14
-
15
- # oh-caveman
16
-
17
- ## When to Use
18
- When context is tight, tokens are precious, or user says "caveman mode." Drops filler, articles, and pleasantries while keeping full technical accuracy.
19
-
20
- ## Mode
21
- - No pleasantries, no hedging, no transitions
22
- - Fragments OK. One word when enough.
23
- - Short synonyms. Drop articles.
24
- - Code unchanged — only prose compresses.
25
- - Technical accuracy preserved at all costs.
26
-
27
- ## Example
28
- Normal: "I think we should probably look at the authentication module because there might be an issue with the token refresh logic."
29
- Caveman: "Check auth module — token refresh likely broken."
30
-
31
- ## Anti-patterns
32
- - Compressing code (code is already dense)
33
- - Omitting critical context to save tokens
34
- - Being unclear to be brief (accuracy > brevity)
35
-
36
- ## Routing
37
-
38
- | Outcome | Route |
39
- |---------|-------|
40
- | pass | → [return to prior skill — mode active] |
41
- | fail | → [fallback to normal communication mode] |
42
- | blocker | → surface to user |
@@ -1,101 +0,0 @@
1
- ---
2
- name: oh-learn
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
13
- ---
14
-
15
- # oh-learn
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
-
33
- ## When to Use
34
-
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
- ```
85
-
86
- ## Anti-patterns
87
-
88
- - Hoarding every observation (most things aren't learnings)
89
- - Never pruning (stale knowledge is worse than no knowledge)
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
94
-
95
- ## Routing
96
-
97
- | Outcome | Route |
98
- |---------|-------|
99
- | pass | → [done — report summary] |
100
- | fail | → [surface gaps to user] |
101
- | blocker | → surface to user |
package/lib/logger.ts DELETED
@@ -1,75 +0,0 @@
1
- import path from "node:path"
2
- import os from "node:os"
3
- import fs from "node:fs"
4
-
5
- export interface Logger {
6
- debug: (...args: unknown[]) => void
7
- info: (...args: unknown[]) => void
8
- warn: (...args: unknown[]) => void
9
- error: (...args: unknown[]) => void
10
- }
11
-
12
- const LEVELS: Record<string, number> = { debug: 0, info: 1, warn: 2, error: 3 }
13
-
14
- function resolveLevel(levelName: string | undefined): number | undefined {
15
- if (!levelName) return undefined
16
- return LEVELS[levelName as keyof typeof LEVELS]
17
- }
18
-
19
- const CURRENT_LEVEL = resolveLevel(process.env.OPENCODE_LOG_LEVEL?.trim().toLowerCase()) ?? (process.env.OPENHERMES_LOG_LEVEL?.trim().toLowerCase() === "debug" ? LEVELS.debug : LEVELS.warn)
20
-
21
- const LOG_DIR = path.join(os.homedir(), ".local", "share", "opencode", "log")
22
- const LOG_FILE = path.join(LOG_DIR, "openhermes.log")
23
-
24
- function ts(): string {
25
- const d = new Date()
26
- return `${d.getFullYear()}-${(d.getMonth()+1).toString().padStart(2,"0")}-${d.getDate().toString().padStart(2,"0")} ${d.getHours().toString().padStart(2,"0")}:${d.getMinutes().toString().padStart(2,"0")}:${d.getSeconds().toString().padStart(2,"0")}.${d.getMilliseconds().toString().padStart(3,"0")}`
27
- }
28
-
29
- function formatArgs(args: unknown[]): string {
30
- return args.map(a => {
31
- if (a === null) return "null"
32
- if (a === undefined) return "undefined"
33
- if (typeof a === "object") {
34
- try { return (a as Error)?.message || JSON.stringify(a) } catch { return String(a) }
35
- }
36
- return String(a)
37
- }).join(" ")
38
- }
39
-
40
- function shouldLog(levelName: string): boolean {
41
- return LEVELS[levelName] >= CURRENT_LEVEL
42
- }
43
-
44
- let _fd: number | null = null
45
- function getFd(): number {
46
- if (_fd) return _fd
47
- try {
48
- fs.mkdirSync(LOG_DIR, { recursive: true })
49
- _fd = fs.openSync(LOG_FILE, "a")
50
- } catch {
51
- _fd = -1
52
- }
53
- return _fd
54
- }
55
-
56
- export function createLogger(name: string): Logger {
57
- const prefix = `[openhermes:${name}]`
58
-
59
- function emit(levelName: string, ...args: unknown[]): void {
60
- if (!shouldLog(levelName)) return
61
- const fd = getFd()
62
- if (fd < 0) return
63
- const line = `${ts()} ${prefix} [${levelName.toUpperCase()}] ${formatArgs(args)}\n`
64
- try { fs.writeSync(fd, line) } catch {}
65
- }
66
-
67
- return {
68
- debug: (...args: unknown[]) => emit("debug", ...args),
69
- info: (...args: unknown[]) => emit("info", ...args),
70
- warn: (...args: unknown[]) => emit("warn", ...args),
71
- error: (...args: unknown[]) => emit("error", ...args),
72
- }
73
- }
74
-
75
- export const rootLogger: Logger = createLogger("root")