openhermes 1.5.6 → 1.12.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.
- package/LICENSE +21 -0
- package/README.md +217 -111
- package/autorecall.mjs +2 -12
- package/bootstrap.mjs +158 -8
- package/curator.mjs +1 -5
- package/harness/commands/checkpoint.md +68 -0
- package/harness/commands/eval.md +89 -0
- package/harness/commands/go-build.md +87 -0
- package/harness/commands/go-review.md +71 -0
- package/harness/commands/harness-audit.md +90 -0
- package/harness/commands/learn.md +2 -2
- package/harness/commands/loop-start.md +38 -0
- package/harness/commands/loop-status.md +30 -0
- package/harness/commands/memory-search.md +2 -2
- package/harness/commands/model-route.md +32 -0
- package/harness/commands/orchestrate.md +88 -0
- package/harness/commands/quality-gate.md +35 -0
- package/harness/commands/refactor-clean.md +102 -0
- package/harness/commands/rust-build.md +78 -0
- package/harness/commands/rust-review.md +65 -0
- package/harness/commands/setup-pm.md +65 -0
- package/harness/commands/skill-create.md +99 -0
- package/harness/commands/test-coverage.md +80 -0
- package/harness/commands/update-codemaps.md +81 -0
- package/harness/commands/update-docs.md +67 -0
- package/harness/commands/verify.md +68 -0
- package/harness/instructions/CONVENTIONS.md +206 -0
- package/harness/instructions/RUNTIME.md +8 -1
- package/harness/prompts/build-cpp.md +84 -0
- package/harness/prompts/build-error-resolver.md +2 -1
- package/harness/prompts/build-go.md +326 -0
- package/harness/prompts/build-java.md +126 -0
- package/harness/prompts/build-kotlin.md +123 -0
- package/harness/prompts/build-rust.md +94 -0
- package/harness/prompts/code-reviewer.md +2 -1
- package/harness/prompts/doc-updater.md +193 -0
- package/harness/prompts/docs-lookup.md +60 -0
- package/harness/prompts/explore.md +1 -0
- package/harness/prompts/harness-optimizer.md +30 -0
- package/harness/prompts/loop-operator.md +42 -0
- package/harness/prompts/planner.md +3 -2
- package/harness/prompts/refactor-cleaner.md +242 -0
- package/harness/prompts/review-cpp.md +68 -0
- package/harness/prompts/review-database.md +248 -0
- package/harness/prompts/review-go.md +244 -0
- package/harness/prompts/review-java.md +100 -0
- package/harness/prompts/review-kotlin.md +130 -0
- package/harness/prompts/review-python.md +88 -0
- package/harness/prompts/review-rust.md +64 -0
- package/harness/prompts/security-reviewer.md +3 -2
- package/harness/prompts/tdd-guide.md +214 -0
- package/harness/rules/delegation.md +28 -22
- package/harness/rules/memory-management.md +4 -4
- package/harness/rules/retrieval.md +5 -5
- package/harness/rules/runtime-guards.md +1 -1
- package/harness/rules/session-start.md +4 -4
- package/harness/rules/skills-management.md +2 -2
- package/harness/rules/state-drift.md +1 -1
- package/harness/rules/verification.md +4 -4
- package/harness/skills/coding-standards/SKILL.md +1 -1
- package/index.mjs +25 -4
- package/lib/hardening.mjs +11 -1
- package/lib/memory-tools-plugin.mjs +84 -71
- package/lib/ohc/config.mjs +30 -0
- package/lib/ohc/pruner.mjs +239 -0
- package/lib/ohc/reaper.mjs +61 -0
- package/lib/ohc/state.mjs +32 -0
- package/lib/ohc/updater.mjs +110 -0
- package/package.json +1 -1
- package/skill-builder.mjs +2 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 nathwn12
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
<p align="center">
|
|
7
7
|
<a href="https://www.npmjs.com/package/openhermes"><img src="https://img.shields.io/npm/v/openhermes?style=for-the-badge&label=version&color=FFD700" alt="npm version"></a>
|
|
8
|
-
<a href="https://github.com/nathwn12/openhermes/blob/
|
|
8
|
+
<a href="https://github.com/nathwn12/openhermes/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=for-the-badge" alt="License: MIT"></a>
|
|
9
9
|
<a href="https://opencode.ai"><img src="https://img.shields.io/badge/runs%20on-OpenCode-6366f1?style=for-the-badge" alt="Runs on OpenCode"></a>
|
|
10
10
|
<a href="https://github.com/nathwn12/openhermes/issues"><img src="https://img.shields.io/badge/issues-welcome-orange?style=for-the-badge" alt="Issues welcome"></a>
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
**Your OpenCode agent, leveled up.** Add it to your plugins and your agent gains a personality, a memory, a conscience,
|
|
15
|
+
**Your OpenCode agent, leveled up.** Add it to your plugins and your agent gains a personality, a memory, a conscience, 25 specialist subagents, 27 slash commands, 6 native memory tools, 10 procedural skills, autonomous checkpointing, and the discipline to self-improve.
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
npm i openhermes
|
|
@@ -23,6 +23,8 @@ npm i openhermes
|
|
|
23
23
|
> ☤ **Inspired by [Hermes Agent](https://github.com/NousResearch/hermes-agent)** — Nous Research's self-improving agent that brought closed learning loops, skill creation, and cross-session memory to the agent ecosystem. OpenHermes reimagines that vision **native to the OpenCode platform**: zero dependencies, no sidecars, no installers. Your entire agent OS in a single npm package.
|
|
24
24
|
>
|
|
25
25
|
> **Pruning inspiration**: The autonomous context-pressure system is heavily inspired by [Opencode-DCP (Dynamic Context Pruning)](https://github.com/Opencode-DCP/opencode-dynamic-context-pruning). The curator plugin's compaction-trigger logic and recall-cache freshness model are direct ports of DCP's approach, adapted to run inside OpenHermes with no sidecars or installers.
|
|
26
|
+
>
|
|
27
|
+
> **Subagent & command expansion**: The 18 language-specialist subagents and 19 orchestration commands are adapted from [Everything Claude Code (ECC)](https://github.com/everything-claude-code/ecc) — an open-source OpenCode plugin system.
|
|
26
28
|
|
|
27
29
|
---
|
|
28
30
|
|
|
@@ -32,10 +34,11 @@ npm i openhermes
|
|
|
32
34
|
<tr><td width="160"><b>🤖 Personality Layer</b></td><td>An 11-principle constitution (<code>soul.md</code>) injected into every session — pragmatic, concise, subagent-first, verify-don't-claim. Your agent stops rambling and starts delivering.</td></tr>
|
|
33
35
|
<tr><td><b>📌 Delegation Discipline</b></td><td>Mandated routing table — every non-trivial task goes to the right specialist subagent. Main context stays clean, coordination-only. No more bloated chat logs.</td></tr>
|
|
34
36
|
<tr><td><b>💾 9-Class Durable Memory</b></td><td>Checkpoints, decisions, constraints, instincts, mistakes, backlog items, audit reports, verification receipts, and session recall — all schema-validated, fingerprint-aware, persisted to disk.</td></tr>
|
|
35
|
-
<tr><td><b>🧰 Precision-First Retrieval</b></td><td>Gated retrieval with anti-spam controls. <code>
|
|
37
|
+
<tr><td><b>🧰 Precision-First Retrieval</b></td><td>Gated retrieval with anti-spam controls. <code>latest_memory</code> → <code>search_memory</code> → <code>fetch_memory</code> → <code>list_memory</code>. No full-index reads unless explicitly scoped. Memory stays lean.</td></tr>
|
|
36
38
|
<tr><td><b>🔥 Autonomous Checkpointing</b></td><td>Pre-compaction snapshots capture mission, current state, next actions, blockers, and risk notes so compaction never loses the plot.</td></tr>
|
|
37
39
|
<tr><td><b>🔄 Closed Learning Loop</b></td><td>Mistakes are logged with root cause + prevention rule. Complex sessions auto-generate skill-candidate backlogs. Strike tracking escalates repeat failures. The agent gets better — you don't have to teach it twice.</td></tr>
|
|
38
40
|
<tr><td><b>🛠 10 Bundled Procedural Skills</b></td><td>Pre-built skills for API design, backend patterns, coding standards, E2E testing, frontend patterns, frontend slides, security reviews, strategic compaction, TDD workflow, and verification loops. Discovered automatically — use <code>skill</code> to list and load.</td></tr>
|
|
41
|
+
<tr><td><b>🔎 Context Pruner</b></td><td>Agent-controlled compression via <code>ohc.json</code> (soft defaults) + <code>compress</code> tool with <code>targetTokens</code> override. No token claims — reports message count only. Recommend <code>compaction.auto: false</code> to prevent double pruning with OpenCode's built-in system.</td></tr>
|
|
39
42
|
<tr><td><b>🧩 Zero Infrastructure</b></td><td>No Python. No uv. No Docker. No PostgreSQL. No gateway. No cron daemon. Just Node.js and your existing OpenCode runtime.</td></tr>
|
|
40
43
|
</table>
|
|
41
44
|
|
|
@@ -69,18 +72,20 @@ Either way, **no other config needed.** The plugin auto-registers:
|
|
|
69
72
|
|
|
70
73
|
| What | Details |
|
|
71
74
|
|------|---------|
|
|
72
|
-
| **
|
|
73
|
-
| **
|
|
74
|
-
| **
|
|
75
|
+
| **25 subagents** | 7 core + 18 specialist:<br>**Core:** architect, planner, build-error-resolver, code-reviewer, security-reviewer, e2e-runner, explore<br>**Specialist:** tdd-guide, docs-lookup, doc-updater, refactor-cleaner, loop-operator, harness-optimizer, review-go, build-go, review-rust, build-rust, review-python, review-java, build-java, review-kotlin, build-kotlin, review-cpp, build-cpp, review-database |
|
|
76
|
+
| **27 slash commands** | `/plan`, `/build-fix`, `/code-review`, `/security`, `/doctor`, `/memory-search`, `/learn`, `/ohc`, `/orchestrate`, `/eval`, `/model-route`, `/quality-gate`, `/test-coverage`, `/update-docs`, `/update-codemaps`, `/refactor-clean`, `/verify`, `/checkpoint`, `/loop-start`, `/loop-status`, `/harness-audit`, `/setup-pm`, `/go-build`, `/go-review`, `/rust-build`, `/rust-review`, `/skill-create`, `/update-me` |
|
|
77
|
+
| **6 native memory tools** | `add_memory`, `fetch_memory`, `list_memory`, `latest_memory`, `search_memory`, `archive_memory` — in-process, no MCP server needed |
|
|
75
78
|
| **10 procedural skills** | API design, backend patterns, coding standards, E2E testing, frontend patterns, frontend slides, security review, strategic compaction, TDD workflow, verification loop |
|
|
76
|
-
| **
|
|
79
|
+
| **6 lifecycle plugins** | bootstrap, curator, autorecall, skill-builder, memory-tools, ohc |
|
|
77
80
|
|
|
78
81
|
You only need to define primary agents (like `build` or `OpenHermes`) in `opencode.json` — subagents are injected automatically.
|
|
79
82
|
|
|
83
|
+
> **🔄 Force update / repair:** Run `/update-me` anytime to clear the cached OpenHermes and reload from source. Works with both git-backed and npm installs. Use when the plugin feels stale, broken, or you just pushed changes upstream.
|
|
84
|
+
|
|
80
85
|
<details>
|
|
81
86
|
<summary><b>What happens on your next session</b></summary>
|
|
82
87
|
|
|
83
|
-
1. **Config hook** — BootstrapPlugin registers auto-config:
|
|
88
|
+
1. **Config hook** — BootstrapPlugin registers auto-config: 25 subagents, 27 commands, 10 skill dirs.
|
|
84
89
|
2. **Chat transform hook** — bootstrap content is injected into the first user message:
|
|
85
90
|
- ★ **Constitution** (`soul.md`) — 11 immutable principles
|
|
86
91
|
- ★ **Runtime** (`RUNTIME.md`) — gather → delegate → verify → compress
|
|
@@ -97,171 +102,272 @@ The LLM reads rules on demand via the injected paths. Memory directories auto-cr
|
|
|
97
102
|
|
|
98
103
|
---
|
|
99
104
|
|
|
100
|
-
##
|
|
105
|
+
## Context Pruner (OHC)
|
|
106
|
+
|
|
107
|
+
### Required: disable OpenCode's built-in compaction
|
|
108
|
+
|
|
109
|
+
Add to your `opencode.json` to prevent double pruning:
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"compaction": {
|
|
114
|
+
"auto": false
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
See [OpenCode compaction docs](https://opencode.ai/docs/config/#compaction).
|
|
120
|
+
|
|
121
|
+
### Configure OHC
|
|
122
|
+
|
|
123
|
+
Config lives at `~/.config/opencode/ohc.json` — auto-generated with defaults on first load if missing:
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"enabled": true,
|
|
128
|
+
"max": 200000,
|
|
129
|
+
"min": 50000
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
| Field | Default | Job |
|
|
134
|
+
|-------|---------|-----|
|
|
135
|
+
| `enabled` | `true` | Master switch |
|
|
136
|
+
| `max` | `200000` | Advisory prune threshold (soft — agent can override) |
|
|
137
|
+
| `min` | `50000` | Advisory token floor (soft — agent can override via `targetTokens`) |
|
|
138
|
+
|
|
139
|
+
Values are **soft defaults** — the agent has full control. When the user asks "compress to X", pass `targetTokens` to the `compress` tool.
|
|
140
|
+
|
|
141
|
+
System prompt is injected with your budget and floor. As context grows, progressive nudges appear at 70%, 85%, and 95% urging proactive compression. Use `/ohc compress [focus]` or call the `compress` tool to free space on demand.
|
|
142
|
+
|
|
143
|
+
**Commands:**
|
|
144
|
+
- `/ohc status` — show current context usage
|
|
145
|
+
- `/ohc compress [targetTokens] [focus]` — queue compression with optional numeric target
|
|
146
|
+
|
|
147
|
+
**Compress tool:** LLM-available. Call `compress` with a technical summary and optional `targetTokens` (lower = more aggressive). Token counts are rough estimates — the tool reports message count removed, not token savings.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## The Seven Plugins
|
|
152
|
+
|
|
153
|
+
### BootstrapPlugin
|
|
154
|
+
_Registers agents, commands, skills at config hook; injects constitution + router + runtime into every session._
|
|
155
|
+
- **Hooks:** `config`, `chat.transform`
|
|
156
|
+
- Registers 25 subagents, 27 commands, 10 skill paths
|
|
157
|
+
|
|
158
|
+
### MemoryToolsPlugin
|
|
159
|
+
_Provides 6 native memory tools — no MCP server, no network, no sidecars._
|
|
160
|
+
- Registers `add_memory`, `fetch_memory`, `list_memory`, `latest_memory`, `search_memory`, `archive_memory`
|
|
101
161
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
162
|
+
### CuratorPlugin
|
|
163
|
+
_Snapshots state, logs mistakes, records decisions — the agent's durable memory layer._
|
|
164
|
+
- **Hooks:** `session.idle`, `.error`, `.compacted`, `.compacting`, `permission.replied`
|
|
165
|
+
- Writes checkpoints, logs mistakes with root cause + prevention, records audits, injects state into compaction
|
|
166
|
+
|
|
167
|
+
### AutorecallPlugin
|
|
168
|
+
_Loads prior session memory into recall cache at startup._
|
|
169
|
+
- **Hooks:** `session.created`
|
|
170
|
+
- Builds recall cache from disk, aggregates active state for compaction injection
|
|
171
|
+
|
|
172
|
+
### SkillBuilderPlugin
|
|
173
|
+
_Auto-detects complex sessions and creates skill-candidate backlogs._
|
|
174
|
+
- **Hooks:** `session.created`, `session.idle`, `tool.execute.after`
|
|
175
|
+
- Tracks tool call count and subagent spawns per session; flags sessions exceeding threshold (8+ tool calls or 2+ subagent spawns)
|
|
176
|
+
|
|
177
|
+
### OhcPlugin
|
|
178
|
+
_Silent config-driven context pruner. No tool calls, no chat output, no toasts._
|
|
179
|
+
- **Hooks:** `config`, `experimental.chat.system.transform`, `.messages.transform`, `command.execute.before`, `tool.compress`
|
|
180
|
+
- Injects context budget via system prompt; progressive nudges at 70%/85%/95%; silent reaper enforces hard limit; `/ohc` command + `compress` tool for on-demand pruning
|
|
181
|
+
|
|
182
|
+
### UpdaterPlugin
|
|
183
|
+
_Force-update / repair command for OpenHermes itself._
|
|
184
|
+
- **Hooks:** `command.execute.before`
|
|
185
|
+
- Registers `/update-me` — detects install method (git or npm), clears stale cache, tells user to restart. Safe to run anytime.
|
|
109
186
|
|
|
110
187
|
---
|
|
111
188
|
|
|
112
189
|
## Memory Architecture
|
|
113
190
|
|
|
114
|
-
Nine
|
|
191
|
+
Nine schema-validated classes across two dimensions — what the record is and where it lives.
|
|
115
192
|
|
|
116
|
-
|
|
117
|
-
|-------|--------|---------|
|
|
118
|
-
| `checkpoint` | JSON | Pre-compaction snapshots: mission, current state, next actions, blockers |
|
|
119
|
-
| `constraint` | JSON | Hard limits, env realities, safety rules — enforced by precedence engine |
|
|
120
|
-
| `decision` | JSON | Durable project choices — shapes all future behavior |
|
|
121
|
-
| `instinct` | JSON | Reusable trigger→action patterns with success/failure tracking |
|
|
122
|
-
| `backlog` | JSON | Evidence-backed self-improvement items with acceptance criteria |
|
|
123
|
-
| `mistake` | JSONL | Failure registry: type, root cause, fix, prevention rule, strike count |
|
|
124
|
-
| `audit` | JSON | Structured quality and integrity evaluations with health scores |
|
|
125
|
-
| `verification_receipt` | JSON | Cached verification results keyed by artifact fingerprint |
|
|
126
|
-
| `recall` | JSON | Session-start cache aggregating active state for compaction injection |
|
|
193
|
+
### Classes
|
|
127
194
|
|
|
128
|
-
|
|
195
|
+
| Class | Format | Layer | Purpose |
|
|
196
|
+
|-------|--------|-------|---------|
|
|
197
|
+
| `checkpoint` | JSON | 🧠 State | Pre-compaction snapshots: mission, state, next actions, blockers |
|
|
198
|
+
| `constraint` | JSON | 🧠 State | Hard limits, env realities, safety rules |
|
|
199
|
+
| `decision` | JSON | 🧠 State | Durable project choices shaping all future behavior |
|
|
200
|
+
| `instinct` | JSON | 📈 Learning | Reusable trigger→action patterns with hit tracking |
|
|
201
|
+
| `backlog` | JSON | 📈 Learning | Evidence-backed self-improvement items with acceptance criteria |
|
|
202
|
+
| `mistake` | JSONL | 📈 Learning | Failure registry: type, root cause, fix, prevention, strike count |
|
|
203
|
+
| `audit` | JSON | ✅ Integrity | Structured quality evaluations with health scores |
|
|
204
|
+
| `verification_receipt` | JSON | ✅ Integrity | Cached verification results keyed by artifact fingerprint |
|
|
205
|
+
| `recall` | JSON | ✅ Integrity | Session-start cache for compaction buffer injection |
|
|
206
|
+
|
|
207
|
+
### Storage
|
|
129
208
|
|
|
130
209
|
| What | Where |
|
|
131
|
-
|
|
132
|
-
|
|
|
210
|
+
|------|-------|
|
|
211
|
+
| OHC config | `~/.config/opencode/ohc.json` |
|
|
133
212
|
| Durable memory + runtime state | `~/.local/share/opencode/openhermes/` |
|
|
134
213
|
| Derived recall cache | `~/.cache/opencode/openhermes/recall/` |
|
|
135
214
|
|
|
136
|
-
|
|
215
|
+
### Hardening
|
|
216
|
+
|
|
217
|
+
Every record is scrubbed before persistence: `sanitizeRecord()` strips proto-poison (`__proto__`, `constructor`, `prototype`), `redactSensitiveText()` strips bearer tokens / API keys / passwords, `truncateText()` caps field sizes. Schema validation runs before every write.
|
|
137
218
|
|
|
138
219
|
---
|
|
139
220
|
|
|
140
221
|
## Session Lifecycle
|
|
141
222
|
|
|
223
|
+
A session runs through three phases. Six plugins coordinate across 20+ OpenCode hooks — no polling, no cron, no sidecars.
|
|
224
|
+
|
|
225
|
+
**▶️ Warmup — one-shot, session start**
|
|
142
226
|
```
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
session.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
│ CuratorPlugin logs mistake (type, root cause, fix, prevention, strike)
|
|
168
|
-
│ Updates loop-state with error status
|
|
169
|
-
▼
|
|
170
|
-
permission.replied
|
|
171
|
-
│ CuratorPlugin writes audit record for every permission decision
|
|
227
|
+
config hook BootstrapPlugin registers harness/skills/, skills auto-discover
|
|
228
|
+
session.created BootstrapPlugin injects constitution ▸ router ▸ runtime
|
|
229
|
+
AutorecallPlugin loads disk memory → writes recall cache
|
|
230
|
+
SkillBuilderPlugin resets counters
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**⚙️ Execution — per tool call, per subagent spawn**
|
|
234
|
+
```
|
|
235
|
+
tool.execute.* SkillBuilderPlugin counts calls + spawns
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**⏹️ Cooldown — auto-triggered by OpenCode lifecycle**
|
|
239
|
+
```
|
|
240
|
+
session.idle CuratorPlugin: checkpoint snapshot + verification receipt
|
|
241
|
+
SkillBuilderPlugin: complexity check → backlog candidate
|
|
242
|
+
|
|
243
|
+
session.compacting CuratorPlugin: force-writes pre-compaction checkpoint
|
|
244
|
+
Injects harness state + recall context → compaction buffer
|
|
245
|
+
|
|
246
|
+
session.compacted CuratorPlugin: updates loop-state to "compacted"
|
|
247
|
+
|
|
248
|
+
session.error CuratorPlugin: logs mistake (type, root cause, fix, prevention)
|
|
249
|
+
|
|
250
|
+
permission.replied CuratorPlugin: writes audit record for every permission decision
|
|
172
251
|
```
|
|
173
252
|
|
|
174
253
|
---
|
|
175
254
|
|
|
176
255
|
## Verification Discipline
|
|
177
256
|
|
|
178
|
-
|
|
257
|
+
One core habit — **verify before claiming success.**
|
|
179
258
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
259
|
+
| Rule | Why |
|
|
260
|
+
|------|-----|
|
|
261
|
+
| 🕵️ Read before editing | Don't fix what you haven't seen |
|
|
262
|
+
| 🧪 Run before announcing | Don't claim what you haven't tested |
|
|
263
|
+
| 🧬 Cache by fingerprint | Same file, same receipt — skip re-verify |
|
|
264
|
+
| 🔄 Re-verify on change | Stale receipt is worse than no receipt |
|
|
265
|
+
| 🚩 Flag contradictions | Silence is consent to bugs |
|
|
185
266
|
|
|
186
|
-
|
|
267
|
+
Verification receipts are a first-class memory type — keyed by artifact identity + fingerprint (path, mtime, hash). When the artifact is unchanged, the cached receipt suffices. When the artifact changes, re-verify. This is not an afterthought — it's the difference between "I think it works" and "I know it works."
|
|
187
268
|
|
|
188
269
|
---
|
|
189
270
|
|
|
190
271
|
## Bundled Harness
|
|
191
272
|
|
|
192
|
-
The full
|
|
273
|
+
The full operational doctrine ships inside the package. Six directories, zero dependencies outside Node.js.
|
|
193
274
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
```
|
|
275
|
+
| Directory | What it contains | Why it matters |
|
|
276
|
+
|-----------|-----------------|----------------|
|
|
277
|
+
| `constitution/` | `soul.md` — 11 immutable principles | Your agent's personality, frozen |
|
|
278
|
+
| `instructions/` | Runtime workflow + coding conventions | The playbook every session runs on |
|
|
279
|
+
| `rules/` | 16 files: retrieval, verification, audit, self-heal, delegation, ... | The legal framework — no ambiguity |
|
|
280
|
+
| `skills/` | 10 procedural SKILL.md files | Domain expertise discovered automatically |
|
|
281
|
+
| `prompts/` | 25 subagent prompt templates | Language specialists, docs lookup, loop drivers — all on tap |
|
|
282
|
+
| `commands/` | 26 slash command templates | From `/verify` to `/review-go` — full toolbelt |
|
|
203
283
|
|
|
204
|
-
|
|
284
|
+
OpenHermes is not a runtime shim. The doctrine ships with the package — every subagent and every command follows the same constitution, rules, and conventions.
|
|
205
285
|
|
|
206
286
|
---
|
|
207
287
|
|
|
208
288
|
## Self-Healing Escalation
|
|
209
289
|
|
|
210
|
-
|
|
290
|
+
A mistake is not a failure — it's a signal. OpenHermes escalates through four tiers before it ever reaches you.
|
|
291
|
+
|
|
292
|
+
```
|
|
293
|
+
T0 ── Any mistake
|
|
294
|
+
Observe → log mistake record → smallest safe correction → verify
|
|
211
295
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
| **T0** | Any mistake | Observe → log mistake record → smallest safe correction → verify |
|
|
215
|
-
| **T1** | Same mistake repeats within 7 days | Add prevention rule → targeted verification |
|
|
216
|
-
| **T2** | Prevention failed / systemic issue | Delegate to specialist → audit → backlog item |
|
|
217
|
-
| **T3** | Cascading failures | Constrained safe mode: narrow claims, preserve receipts, produce handoff |
|
|
296
|
+
T1 ── Same mistake repeats within 7 days
|
|
297
|
+
Add prevention rule → targeted verification
|
|
218
298
|
|
|
219
|
-
|
|
299
|
+
T2 ── Prevention failed / systemic issue
|
|
300
|
+
Delegate to specialist → deep audit → backlog item
|
|
301
|
+
|
|
302
|
+
T3 ── Cascading failures
|
|
303
|
+
Constrained safe mode: narrow claims, preserve receipts, produce handoff
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
No self-termination. No grandstanding. Narrow, log, recover, improve. The agent gets better — you don't have to teach it twice.
|
|
220
307
|
|
|
221
308
|
---
|
|
222
309
|
|
|
223
310
|
## Environment Variables
|
|
224
311
|
|
|
312
|
+
Two knobs. That's it.
|
|
313
|
+
|
|
225
314
|
| Variable | Default | Effect |
|
|
226
315
|
|----------|---------|--------|
|
|
227
|
-
| `OPENCODE_ALLOW_PROJECT_HARNESS` | `false` |
|
|
228
|
-
| `OPENCODE_CURATOR_LOGS` | `false` |
|
|
316
|
+
| `OPENCODE_ALLOW_PROJECT_HARNESS` | `false` | Enable project-local harness at `.opencode/openhermes/` |
|
|
317
|
+
| `OPENCODE_CURATOR_LOGS` | `false` | Pipe curator diagnostics to stderr for debugging |
|
|
229
318
|
|
|
230
319
|
---
|
|
231
320
|
|
|
232
321
|
## Architecture
|
|
233
322
|
|
|
323
|
+
Three layers. All ES modules. One runtime dependency.
|
|
324
|
+
|
|
234
325
|
```
|
|
235
326
|
openhermes/
|
|
236
|
-
|
|
237
|
-
├──
|
|
238
|
-
├──
|
|
239
|
-
├──
|
|
240
|
-
├──
|
|
241
|
-
├──
|
|
242
|
-
│
|
|
243
|
-
|
|
244
|
-
│
|
|
245
|
-
├──
|
|
246
|
-
├──
|
|
247
|
-
|
|
327
|
+
│
|
|
328
|
+
├── ⚡ index.mjs # Plugin exports (all 5)
|
|
329
|
+
├── ⚡ bootstrap.mjs # Config hook + chat.transform
|
|
330
|
+
├── ⚡ autorecall.mjs # Memory → recall cache
|
|
331
|
+
├── ⚡ curator.mjs # Lifecycle hooks engine
|
|
332
|
+
├── ⚡ skill-builder.mjs # Complexity detection
|
|
333
|
+
│
|
|
334
|
+
├── ⚡ lib/
|
|
335
|
+
│ ├── memory-tools-plugin.mjs # 5 hm_* tools
|
|
336
|
+
│ ├── hardening.mjs # sanitize, redact, atomic write
|
|
337
|
+
│ ├── paths.mjs # storage root resolver
|
|
338
|
+
│ ├── schema-validator.mjs # Draft-07 validation
|
|
339
|
+
│ └── ohc/ # context pruner
|
|
340
|
+
│
|
|
341
|
+
├── ⚡ schemas/ # 9 Draft-07 memory schemas
|
|
342
|
+
│
|
|
343
|
+
├── 📦 harness/
|
|
344
|
+
│ ├── constitution/ # soul.md — 11 principles
|
|
345
|
+
│ ├── instructions/ # runtime + conventions
|
|
346
|
+
│ ├── rules/ # 16 files
|
|
347
|
+
│ ├── skills/ # 10 procedural skills
|
|
348
|
+
│ ├── prompts/ # 25 subagent templates
|
|
349
|
+
│ └── commands/ # 26 slash command templates
|
|
350
|
+
│
|
|
351
|
+
└── 📦 package.json # one dependency: @opencode-ai/plugin
|
|
248
352
|
```
|
|
249
353
|
|
|
250
|
-
**
|
|
354
|
+
**Dependency footprint:** `@opencode-ai/plugin` only. No postinstall scripts. No native compilation. No Docker. No Python. Your entire agent OS in a single `npm install`.
|
|
251
355
|
|
|
252
356
|
---
|
|
253
357
|
|
|
254
358
|
## Why OpenHermes ≠ Hermes Agent
|
|
255
359
|
|
|
360
|
+
Same messenger emoji. Entirely different mediums.
|
|
361
|
+
|
|
256
362
|
| | Hermes Agent | OpenHermes |
|
|
257
|
-
|
|
258
|
-
|
|
|
259
|
-
|
|
|
260
|
-
|
|
|
261
|
-
|
|
|
262
|
-
|
|
|
263
|
-
|
|
|
264
|
-
|
|
|
363
|
+
|-|------------|------------|
|
|
364
|
+
| Platform | Standalone agent — TUI + gateway + cron | OpenCode-native plugin — lives *inside* your editor |
|
|
365
|
+
| Installation | Python 3.11 + uv + 30+ deps — 5-15 min | `npm i` — 3 seconds |
|
|
366
|
+
| Infrastructure | Long-running gateway, cron daemon, 20 platform adapters, 7 terminal backends, SQLite+FTS5 | Zero sidecars — everything is a plugin hook |
|
|
367
|
+
| Memory | MEMORY.md + USER.md files + optional Honcho | 9-class schema-validated memory with in-process tools |
|
|
368
|
+
| Skills | agentskills.io standard, auto-creation + self-improvement | SKILL.md progressive disclosure, auto-detected |
|
|
369
|
+
| Context | Context files + FTS5 search + LLM summarization | Harness injection at startup, recall cache at compaction |
|
|
370
|
+
| Philosophy | "The self-improving agent" — feature-rich, platform-expansive | "The constitutional router" — discipline-first, precision-only |
|
|
265
371
|
|
|
266
372
|
Both are ☤ messengers. Different mediums.
|
|
267
373
|
|
|
@@ -278,5 +384,5 @@ Problems, ideas, improvements? [Open an issue](https://github.com/nathwn12/openh
|
|
|
278
384
|
MIT — see [LICENSE](LICENSE).
|
|
279
385
|
|
|
280
386
|
<p align="center">
|
|
281
|
-
<sub><b>☤</b> Built with discipline. Inspired by <a href="https://github.com/NousResearch/hermes-agent">Hermes Agent</a>. Built for <a href="https://opencode.ai">OpenCode</a>.</sub>
|
|
387
|
+
<sub><b>☤</b> Built with discipline. Inspired by <a href="https://github.com/NousResearch/hermes-agent">Hermes Agent</a>, <a href="https://github.com/everything-claude-code/ecc">Everything Claude Code</a>, and <a href="https://github.com/Opencode-DCP/opencode-dynamic-context-pruning">Dynamic Context Pruning</a>. Built for <a href="https://opencode.ai">OpenCode</a>.</sub>
|
|
282
388
|
</p>
|
package/autorecall.mjs
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
import path from "node:path"
|
|
2
2
|
import os from "node:os"
|
|
3
3
|
import fs from "node:fs"
|
|
4
|
-
import { atomicWriteJson, fingerprintEnvironment, isTruthy, sanitizeRecord, truncateText } from "./lib/hardening.mjs"
|
|
4
|
+
import { atomicWriteJson, fingerprintEnvironment, isTruthy, readJson, readJsonl, sanitizeRecord, truncateText } from "./lib/hardening.mjs"
|
|
5
5
|
import { getDataRoot, getCacheRoot, getMemoryRoot, getRecallRoot, getRuntimeRoot } from "./lib/paths.mjs"
|
|
6
6
|
|
|
7
7
|
const OLD_BASE = path.join(os.homedir(), ".config", "opencode", "openhermes")
|
|
8
8
|
|
|
9
|
-
function readJson(fp, fallback) {
|
|
10
|
-
try { return JSON.parse(fs.readFileSync(fp, "utf8")) } catch { return fallback }
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function readJsonl(fp) {
|
|
14
|
-
try {
|
|
15
|
-
return fs.readFileSync(fp, "utf8").trim().split("\n").filter(Boolean).map(l => JSON.parse(l))
|
|
16
|
-
} catch { return [] }
|
|
17
|
-
}
|
|
18
|
-
|
|
19
9
|
function loadMemoryRecord(root, className, entry) {
|
|
20
10
|
const recordPath = path.join(root, "memory", className, `${entry.id}.json`)
|
|
21
11
|
const record = readJson(recordPath, null)
|
|
@@ -64,7 +54,7 @@ function formatBacklogNudge(candidates) {
|
|
|
64
54
|
`Top candidates:`,
|
|
65
55
|
top,
|
|
66
56
|
`Trigger: /learn to create skills from these sessions.`,
|
|
67
|
-
`If none are skill-worthy, close them via
|
|
57
|
+
`If none are skill-worthy, close them via add_memory with status:"closed".`
|
|
68
58
|
].join("\n")
|
|
69
59
|
}
|
|
70
60
|
|