openhermes 1.12.1 → 2.5.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 (80) hide show
  1. package/README.md +126 -207
  2. package/autorecall.mjs +79 -12
  3. package/bootstrap.mjs +123 -24
  4. package/curator.mjs +4 -40
  5. package/harness/commands/harness-audit.md +1 -1
  6. package/harness/commands/learn.md +2 -2
  7. package/harness/commands/memory-search.md +2 -2
  8. package/harness/commands/ohc.md +13 -0
  9. package/harness/constitution/soul.md +16 -4
  10. package/harness/instructions/RUNTIME.md +6 -3
  11. package/harness/prompts/architect.txt +14 -0
  12. package/harness/prompts/build-cpp.md +15 -1
  13. package/harness/prompts/build-error-resolver.md +15 -9
  14. package/harness/prompts/build-go.md +14 -0
  15. package/harness/prompts/build-java.md +15 -1
  16. package/harness/prompts/build-kotlin.md +15 -1
  17. package/harness/prompts/build-rust.md +14 -0
  18. package/harness/prompts/code-reviewer.md +15 -9
  19. package/harness/prompts/doc-updater.md +13 -0
  20. package/harness/prompts/docs-lookup.md +11 -0
  21. package/harness/prompts/e2e-runner.txt +12 -0
  22. package/harness/prompts/explore.md +16 -4
  23. package/harness/prompts/harness-optimizer.md +12 -0
  24. package/harness/prompts/loop-operator.md +11 -0
  25. package/harness/prompts/planner.md +15 -9
  26. package/harness/prompts/refactor-cleaner.md +14 -0
  27. package/harness/prompts/review-cpp.md +14 -1
  28. package/harness/prompts/review-database.md +13 -0
  29. package/harness/prompts/review-go.md +13 -0
  30. package/harness/prompts/review-java.md +14 -1
  31. package/harness/prompts/review-kotlin.md +13 -0
  32. package/harness/prompts/review-python.md +14 -1
  33. package/harness/prompts/review-rust.md +13 -0
  34. package/harness/prompts/security-reviewer.md +15 -9
  35. package/harness/prompts/tdd-guide.md +14 -0
  36. package/harness/rules/audit.md +2 -2
  37. package/harness/rules/delegation.md +0 -2
  38. package/harness/rules/handoff.md +267 -0
  39. package/harness/rules/memory-management.md +4 -4
  40. package/harness/rules/precedence.md +1 -1
  41. package/harness/rules/retrieval.md +5 -5
  42. package/harness/rules/runtime-guards.md +1 -1
  43. package/harness/rules/self-heal.md +1 -1
  44. package/harness/rules/session-start.md +5 -5
  45. package/harness/rules/skills-management.md +2 -2
  46. package/harness/rules/verification.md +4 -4
  47. package/harness/scripts/sync-commands.mjs +259 -0
  48. package/index.mjs +6 -2
  49. package/lib/ambient-memory.mjs +167 -0
  50. package/lib/handoff.mjs +176 -0
  51. package/lib/hardening.mjs +13 -8
  52. package/lib/memory-tools-plugin.mjs +107 -54
  53. package/lib/ohc/block-sync.mjs +69 -0
  54. package/lib/ohc/compress/search.mjs +152 -0
  55. package/lib/ohc/compress/state.mjs +76 -0
  56. package/lib/ohc/config.mjs +172 -16
  57. package/lib/ohc/message-ids.mjs +168 -0
  58. package/lib/ohc/notify.mjs +150 -0
  59. package/lib/ohc/protected-patterns.mjs +54 -0
  60. package/lib/ohc/prune-apply.mjs +134 -0
  61. package/lib/ohc/pruner.mjs +406 -55
  62. package/lib/ohc/reaper.mjs +12 -3
  63. package/lib/ohc/state.mjs +246 -15
  64. package/lib/ohc/strategies/deduplication.mjs +72 -0
  65. package/lib/ohc/strategies/index.mjs +2 -0
  66. package/lib/ohc/strategies/purge-errors.mjs +43 -0
  67. package/lib/ohc/token-utils.mjs +26 -0
  68. package/lib/ohc/updater.mjs +36 -13
  69. package/lib/paths.mjs +0 -3
  70. package/lib/search.mjs +48 -0
  71. package/package.json +6 -2
  72. package/schemas/audit.schema.json +22 -1
  73. package/schemas/backlog.schema.json +23 -2
  74. package/schemas/checkpoint.schema.json +23 -2
  75. package/schemas/constraint.schema.json +23 -2
  76. package/schemas/decision.schema.json +23 -2
  77. package/schemas/instinct.schema.json +23 -2
  78. package/schemas/mistake.schema.json +23 -2
  79. package/schemas/verification_receipt.schema.json +23 -2
  80. package/skill-builder.mjs +12 -23
@@ -20,7 +20,9 @@
20
20
  "task_id": { "type": "string" },
21
21
  "db_refs": { "type": "array", "items": { "type": "string" } },
22
22
  "file_refs": { "type": "array", "items": { "type": "string" } },
23
- "log_refs": { "type": "array", "items": { "type": "string" } }
23
+ "log_refs": { "type": "array", "items": { "type": "string" } },
24
+ "harness_root": { "type": "string" },
25
+ "project_root": { "type": "string" }
24
26
  }
25
27
  },
26
28
  "created_at": { "type": "string", "format": "date-time", "description": "ISO-8601 timestamp" },
@@ -39,6 +41,25 @@
39
41
  "active_constraints": { "type": "array", "items": { "type": "string" }, "description": "Constraint IDs currently enforced" },
40
42
  "blockers": { "type": "array", "items": { "type": "string" }, "description": "What is preventing progress" },
41
43
  "next_actions": { "type": "array", "items": { "type": "string" }, "description": "Concrete next steps" },
42
- "risk_notes": { "type": "array", "items": { "type": "string" }, "description": "Open questions, untested assumptions, fragile state" }
44
+ "risk_notes": { "type": "array", "items": { "type": "string" }, "description": "Open questions, untested assumptions, fragile state" },
45
+ "description": { "type": "string", "description": "Optional description" },
46
+ "environment_fingerprint": {
47
+ "type": "object",
48
+ "description": "System fingerprint at creation time",
49
+ "properties": {
50
+ "cwd": { "type": "string" },
51
+ "harness_root": { "type": "string" },
52
+ "project_root": { "type": "string" },
53
+ "project": { "type": "string" },
54
+ "session_id": { "type": "string" },
55
+ "os": { "type": "string" },
56
+ "release": { "type": "string" },
57
+ "arch": { "type": "string" },
58
+ "shell": { "type": "string" },
59
+ "provider": { "type": "string" },
60
+ "model": { "type": "string" },
61
+ "sha256": { "type": "string" }
62
+ }
63
+ }
43
64
  }
44
65
  }
@@ -20,7 +20,9 @@
20
20
  "task_id": { "type": "string" },
21
21
  "db_refs": { "type": "array", "items": { "type": "string" } },
22
22
  "file_refs": { "type": "array", "items": { "type": "string" } },
23
- "log_refs": { "type": "array", "items": { "type": "string" } }
23
+ "log_refs": { "type": "array", "items": { "type": "string" } },
24
+ "harness_root": { "type": "string" },
25
+ "project_root": { "type": "string" }
24
26
  }
25
27
  },
26
28
  "created_at": { "type": "string", "format": "date-time", "description": "ISO-8601 timestamp" },
@@ -36,6 +38,25 @@
36
38
  "rule": { "type": "string", "description": "The constraint rule text" },
37
39
  "enforcement": { "type": "string", "enum": ["hard", "soft"], "description": "Whether violations are blocked (hard) or warned (soft)" },
38
40
  "source_kind": { "type": "string", "enum": ["user", "runtime", "safety", "tool", "policy"], "description": "What kind of source produced this constraint" },
39
- "active": { "type": "boolean", "description": "Whether this constraint is currently enforced" }
41
+ "active": { "type": "boolean", "description": "Whether this constraint is currently enforced" },
42
+ "description": { "type": "string", "description": "Optional description" },
43
+ "environment_fingerprint": {
44
+ "type": "object",
45
+ "description": "System fingerprint at creation time",
46
+ "properties": {
47
+ "cwd": { "type": "string" },
48
+ "harness_root": { "type": "string" },
49
+ "project_root": { "type": "string" },
50
+ "project": { "type": "string" },
51
+ "session_id": { "type": "string" },
52
+ "os": { "type": "string" },
53
+ "release": { "type": "string" },
54
+ "arch": { "type": "string" },
55
+ "shell": { "type": "string" },
56
+ "provider": { "type": "string" },
57
+ "model": { "type": "string" },
58
+ "sha256": { "type": "string" }
59
+ }
60
+ }
40
61
  }
41
62
  }
@@ -20,7 +20,9 @@
20
20
  "task_id": { "type": "string" },
21
21
  "db_refs": { "type": "array", "items": { "type": "string" } },
22
22
  "file_refs": { "type": "array", "items": { "type": "string" } },
23
- "log_refs": { "type": "array", "items": { "type": "string" } }
23
+ "log_refs": { "type": "array", "items": { "type": "string" } },
24
+ "harness_root": { "type": "string" },
25
+ "project_root": { "type": "string" }
24
26
  }
25
27
  },
26
28
  "created_at": { "type": "string", "format": "date-time", "description": "ISO-8601 timestamp" },
@@ -37,6 +39,25 @@
37
39
  "choice": { "type": "string", "description": "The specific choice made" },
38
40
  "reason": { "type": "string", "description": "Rationale for the choice" },
39
41
  "consequences": { "type": "array", "items": { "type": "string" }, "description": "Expected or observed consequences" },
40
- "supersedes": { "type": "array", "items": { "type": "string" }, "description": "Decision IDs this decision supersedes" }
42
+ "supersedes": { "type": "array", "items": { "type": "string" }, "description": "Decision IDs this decision supersedes" },
43
+ "description": { "type": "string", "description": "Optional description" },
44
+ "environment_fingerprint": {
45
+ "type": "object",
46
+ "description": "System fingerprint at creation time",
47
+ "properties": {
48
+ "cwd": { "type": "string" },
49
+ "harness_root": { "type": "string" },
50
+ "project_root": { "type": "string" },
51
+ "project": { "type": "string" },
52
+ "session_id": { "type": "string" },
53
+ "os": { "type": "string" },
54
+ "release": { "type": "string" },
55
+ "arch": { "type": "string" },
56
+ "shell": { "type": "string" },
57
+ "provider": { "type": "string" },
58
+ "model": { "type": "string" },
59
+ "sha256": { "type": "string" }
60
+ }
61
+ }
41
62
  }
42
63
  }
@@ -20,7 +20,9 @@
20
20
  "task_id": { "type": "string" },
21
21
  "db_refs": { "type": "array", "items": { "type": "string" } },
22
22
  "file_refs": { "type": "array", "items": { "type": "string" } },
23
- "log_refs": { "type": "array", "items": { "type": "string" } }
23
+ "log_refs": { "type": "array", "items": { "type": "string" } },
24
+ "harness_root": { "type": "string" },
25
+ "project_root": { "type": "string" }
24
26
  }
25
27
  },
26
28
  "created_at": { "type": "string", "format": "date-time", "description": "ISO-8601 timestamp" },
@@ -37,6 +39,25 @@
37
39
  "action": { "type": "string", "description": "Recommended action when triggered" },
38
40
  "success_count": { "type": "integer", "minimum": 0, "default": 0, "description": "Number of successful applications" },
39
41
  "failure_count": { "type": "integer", "minimum": 0, "default": 0, "description": "Number of failed applications" },
40
- "promotion_state": { "type": "string", "enum": ["project", "candidate_global", "global"], "description": "Current promotion level" }
42
+ "promotion_state": { "type": "string", "enum": ["project", "candidate_global", "global"], "description": "Current promotion level" },
43
+ "description": { "type": "string", "description": "Optional description" },
44
+ "environment_fingerprint": {
45
+ "type": "object",
46
+ "description": "System fingerprint at creation time",
47
+ "properties": {
48
+ "cwd": { "type": "string" },
49
+ "harness_root": { "type": "string" },
50
+ "project_root": { "type": "string" },
51
+ "project": { "type": "string" },
52
+ "session_id": { "type": "string" },
53
+ "os": { "type": "string" },
54
+ "release": { "type": "string" },
55
+ "arch": { "type": "string" },
56
+ "shell": { "type": "string" },
57
+ "provider": { "type": "string" },
58
+ "model": { "type": "string" },
59
+ "sha256": { "type": "string" }
60
+ }
61
+ }
41
62
  }
42
63
  }
@@ -26,7 +26,9 @@
26
26
  "task_id": { "type": "string" },
27
27
  "db_refs": { "type": "array", "items": { "type": "string" } },
28
28
  "file_refs": { "type": "array", "items": { "type": "string" } },
29
- "log_refs": { "type": "array", "items": { "type": "string" } }
29
+ "log_refs": { "type": "array", "items": { "type": "string" } },
30
+ "harness_root": { "type": "string" },
31
+ "project_root": { "type": "string" }
30
32
  }
31
33
  },
32
34
  "confidence": { "type": "number", "minimum": 0, "maximum": 1, "default": 1.0 },
@@ -38,6 +40,25 @@
38
40
  "updated_at": { "type": "string", "format": "date-time", "description": "ISO-8601 timestamp" },
39
41
  "review_at": { "type": ["string", "null"], "format": "date-time", "description": "ISO-8601 or null" },
40
42
  "decay_at": { "type": ["string", "null"], "format": "date-time", "description": "ISO-8601 or null" },
41
- "archived_at": { "type": ["string", "null"], "format": "date-time", "description": "ISO-8601 or null" }
43
+ "archived_at": { "type": ["string", "null"], "format": "date-time", "description": "ISO-8601 or null" },
44
+ "description": { "type": "string", "description": "Optional description" },
45
+ "environment_fingerprint": {
46
+ "type": "object",
47
+ "description": "System fingerprint at creation time",
48
+ "properties": {
49
+ "cwd": { "type": "string" },
50
+ "harness_root": { "type": "string" },
51
+ "project_root": { "type": "string" },
52
+ "project": { "type": "string" },
53
+ "session_id": { "type": "string" },
54
+ "os": { "type": "string" },
55
+ "release": { "type": "string" },
56
+ "arch": { "type": "string" },
57
+ "shell": { "type": "string" },
58
+ "provider": { "type": "string" },
59
+ "model": { "type": "string" },
60
+ "sha256": { "type": "string" }
61
+ }
62
+ }
42
63
  }
43
64
  }
@@ -20,7 +20,9 @@
20
20
  "task_id": { "type": "string" },
21
21
  "db_refs": { "type": "array", "items": { "type": "string" } },
22
22
  "file_refs": { "type": "array", "items": { "type": "string" } },
23
- "log_refs": { "type": "array", "items": { "type": "string" } }
23
+ "log_refs": { "type": "array", "items": { "type": "string" } },
24
+ "harness_root": { "type": "string" },
25
+ "project_root": { "type": "string" }
24
26
  }
25
27
  },
26
28
  "created_at": { "type": "string", "format": "date-time", "description": "ISO-8601 timestamp" },
@@ -62,6 +64,25 @@
62
64
  "result_detail": { "type": "string", "description": "Detailed result description or output summary" },
63
65
  "supersedes": { "type": "array", "items": { "type": "string" }, "description": "Receipt IDs this receipt supersedes" },
64
66
  "superseded_by": { "type": "array", "items": { "type": "string" }, "description": "Receipt IDs that supersede this one" },
65
- "invalidation_reason": { "type": "string", "description": "If status is expired/superseded, why the receipt was invalidated" }
67
+ "invalidation_reason": { "type": "string", "description": "If status is expired/superseded, why the receipt was invalidated" },
68
+ "description": { "type": "string", "description": "Optional description" },
69
+ "environment_fingerprint": {
70
+ "type": "object",
71
+ "description": "System fingerprint at creation time",
72
+ "properties": {
73
+ "cwd": { "type": "string" },
74
+ "harness_root": { "type": "string" },
75
+ "project_root": { "type": "string" },
76
+ "project": { "type": "string" },
77
+ "session_id": { "type": "string" },
78
+ "os": { "type": "string" },
79
+ "release": { "type": "string" },
80
+ "arch": { "type": "string" },
81
+ "shell": { "type": "string" },
82
+ "provider": { "type": "string" },
83
+ "model": { "type": "string" },
84
+ "sha256": { "type": "string" }
85
+ }
86
+ }
66
87
  }
67
88
  }
package/skill-builder.mjs CHANGED
@@ -1,18 +1,8 @@
1
1
  import path from "node:path"
2
2
  import fs from "node:fs"
3
3
  import os from "node:os"
4
- import { atomicWriteJson, fingerprintEnvironment, readJson, sanitizeRecord } from "./lib/hardening.mjs"
5
- import { getConfigRoot, getDataRoot, getMemoryRoot } from "./lib/paths.mjs"
6
-
7
- function buildEnvironmentFingerprint(root, directory, project) {
8
- return fingerprintEnvironment({
9
- cwd: directory,
10
- harnessRoot: root,
11
- projectRoot: directory,
12
- project: project?.name || path.basename(directory),
13
- sessionId: project?.session_id || null,
14
- })
15
- }
4
+ import { atomicWriteJson, buildEnvironmentFingerprint, readJson, sanitizeRecord } from "./lib/hardening.mjs"
5
+ import { getDataRoot, getMemoryRoot } from "./lib/paths.mjs"
16
6
 
17
7
  const COMPLEXITY_THRESHOLD = { toolCalls: 8, subagents: 2 }
18
8
  let sessionStats = { toolCalls: 0, subagents: 0, startTime: Date.now() }
@@ -30,9 +20,12 @@ export const SkillBuilderPlugin = async ({ project, directory }) => {
30
20
  }
31
21
 
32
22
  if (event.type === "session.idle") {
33
- const durationMin = Math.round((Date.now() - sessionStats.startTime) / 60000)
34
- const isComplex = sessionStats.toolCalls >= COMPLEXITY_THRESHOLD.toolCalls
35
- || sessionStats.subagents >= COMPLEXITY_THRESHOLD.subagents
23
+ const stats = { ...sessionStats }
24
+ sessionStats = { toolCalls: 0, subagents: 0, startTime: Date.now() }
25
+
26
+ const durationMin = Math.round((Date.now() - stats.startTime) / 60000)
27
+ const isComplex = stats.toolCalls >= COMPLEXITY_THRESHOLD.toolCalls
28
+ || stats.subagents >= COMPLEXITY_THRESHOLD.subagents
36
29
 
37
30
  if (isComplex) {
38
31
  try {
@@ -44,18 +37,15 @@ export const SkillBuilderPlugin = async ({ project, directory }) => {
44
37
  const hasOpenCandidate = Array.isArray(backlogIndex)
45
38
  ? backlogIndex.some(e => e.status === "open" && String(e.summary || "").includes("[skill-candidate]"))
46
39
  : false
47
- if (hasOpenCandidate) {
48
- sessionStats = { toolCalls: 0, subagents: 0, startTime: Date.now() }
49
- return
50
- }
40
+ if (hasOpenCandidate) return
51
41
  const environmentFingerprint = buildEnvironmentFingerprint(root, directory, project)
52
42
  const record = {
53
43
  id,
54
44
  class: "backlog",
55
45
  scope: "global",
56
- summary: `[skill-candidate] Complex session: ${sessionStats.toolCalls} tool calls, ${sessionStats.subagents} subagents, ${durationMin}min`,
57
- description: `Session exceeded complexity thresholds (toolCalls>=${COMPLEXITY_THRESHOLD.toolCalls} or subagents>=${COMPLEXITY_THRESHOLD.subagents}). Session had ${sessionStats.toolCalls} tool calls and ${sessionStats.subagents} subagent spawns over ${durationMin} minutes.`,
58
- title: `Skill candidate: Complex session (${sessionStats.toolCalls} tool calls${sessionStats.subagents ? `, ${sessionStats.subagents} subagents`:""})`,
46
+ summary: `[skill-candidate] Complex session: ${stats.toolCalls} tool calls, ${stats.subagents} subagents, ${durationMin}min`,
47
+ description: `Session exceeded complexity thresholds (toolCalls>=${COMPLEXITY_THRESHOLD.toolCalls} or subagents>=${COMPLEXITY_THRESHOLD.subagents}). Session had ${stats.toolCalls} tool calls and ${stats.subagents} subagent spawns over ${durationMin} minutes.`,
48
+ title: `Skill candidate: Complex session (${stats.toolCalls} tool calls${stats.subagents ? `, ${stats.subagents} subagents`:""})`,
59
49
  priority: "medium",
60
50
  trigger: "drift",
61
51
  status: "open",
@@ -92,7 +82,6 @@ export const SkillBuilderPlugin = async ({ project, directory }) => {
92
82
 
93
83
  } catch (err) { process.stderr.write(`[skill-builder] backlog write error: ${err?.message || err}\n`) }
94
84
  }
95
- sessionStats = { toolCalls: 0, subagents: 0, startTime: Date.now() }
96
85
  }
97
86
  },
98
87
  }