cogmem 3.6.3 → 3.6.4
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/CHANGELOG.md +7 -0
- package/README.md +42 -11
- package/RELEASE_CHECKLIST.md +10 -4
- package/dist/bin/connect.js +39 -27
- package/dist/bin/import-support.d.ts +1 -0
- package/dist/bin/import-support.js +15 -2
- package/dist/bin/mcp.js +2 -1
- package/dist/episode/EpisodeStore.d.ts +7 -0
- package/dist/episode/EpisodeStore.js +75 -6
- package/dist/factory.js +3 -1
- package/examples/hermes-backend/AGENTS.md +27 -13
- package/examples/hermes-backend/README.md +21 -11
- package/examples/hermes-backend/SKILL.md +49 -20
- package/examples/hermes-backend/references/operations.md +40 -11
- package/examples/openclaw-backend/AGENTS.md +27 -6
- package/examples/openclaw-backend/README.md +21 -11
- package/examples/openclaw-backend/SKILL.md +52 -14
- package/examples/openclaw-backend/references/operations.md +40 -10
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.6.4
|
|
4
|
+
|
|
5
|
+
- Fixed OpenClaw/Hermes imports so empty imported episode boundaries are not batch-sealed into Dream work, and mature empty soft seals no longer abort `dream tick`.
|
|
6
|
+
- Added Dream queue cleanup for legacy empty episode jobs so one bad upgraded/imported episode is marked skipped and does not consume maintenance batch slots.
|
|
7
|
+
- Updated OpenClaw and Hermes auto-installed skills, runbooks, and README examples to prefer npm workspace-local installs, reserve `cogmem init` for interactive operator setup, and document the full import -> dream -> candidate governance -> `needs_confirmation` review flow.
|
|
8
|
+
- Standardized MCP guidance on `cogmem mcp` for new Hermes/OpenClaw host configs while keeping `cogmem-mcp` as a compatibility bin for existing configs.
|
|
9
|
+
|
|
3
10
|
## 3.6.3
|
|
4
11
|
|
|
5
12
|
- Added a GitHub Release `published` workflow for npm Trusted Publishing with OIDC provenance, full tests, build, version-tag validation, and package dry-run verification before `npm publish`.
|
package/README.md
CHANGED
|
@@ -11,15 +11,24 @@ It is not a knowledge-base app, a note-taking app, a vector RAG wrapper, an Obsi
|
|
|
11
11
|
|
|
12
12
|
## Status
|
|
13
13
|
|
|
14
|
-
Current version: `3.6.
|
|
14
|
+
Current version: `3.6.4`
|
|
15
15
|
|
|
16
16
|
Distribution: npm registry. GitHub remains the source mirror and hosts this installer, but package install and upgrade resolve `cogmem` from npm by default.
|
|
17
17
|
|
|
18
|
+
Default workspace install:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install cogmem@latest --save
|
|
22
|
+
./node_modules/.bin/cogmem doctor
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
One-line installer for machines that need Bun bootstrapping:
|
|
26
|
+
|
|
18
27
|
```bash
|
|
19
28
|
curl -fsSL https://raw.githubusercontent.com/liuqin164/cogmem/main/install.sh | bash
|
|
20
29
|
```
|
|
21
30
|
|
|
22
|
-
The installer:
|
|
31
|
+
The one-line installer:
|
|
23
32
|
|
|
24
33
|
1. Ensures Bun is available.
|
|
25
34
|
2. Installs `cogmem@latest` from the npm registry into `~/.cogmem/pkg`.
|
|
@@ -158,10 +167,11 @@ High-dimensional vectors grow quickly. Prefer `raw_then_dream` or `selective_com
|
|
|
158
167
|
|
|
159
168
|
## Quick Start
|
|
160
169
|
|
|
161
|
-
Install
|
|
170
|
+
Install into an agent workspace with npm:
|
|
162
171
|
|
|
163
172
|
```bash
|
|
164
|
-
|
|
173
|
+
npm install cogmem@latest --save
|
|
174
|
+
./node_modules/.bin/cogmem doctor
|
|
165
175
|
```
|
|
166
176
|
|
|
167
177
|
Or install into an existing Bun workspace:
|
|
@@ -185,6 +195,19 @@ npm install -g cogmem@latest
|
|
|
185
195
|
cogmem init
|
|
186
196
|
```
|
|
187
197
|
|
|
198
|
+
Or use the one-line installer for machines that do not already have Bun:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
curl -fsSL https://raw.githubusercontent.com/liuqin164/cogmem/main/install.sh | bash
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
For agent-run installs, skip the interactive wizard and connect the host explicitly:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
COGMEM_SKIP_INIT=1 curl -fsSL https://raw.githubusercontent.com/liuqin164/cogmem/main/install.sh | bash
|
|
208
|
+
cogmem doctor
|
|
209
|
+
```
|
|
210
|
+
|
|
188
211
|
Validate configuration:
|
|
189
212
|
|
|
190
213
|
```bash
|
|
@@ -206,7 +229,7 @@ cogmem migrate --dry-run --json
|
|
|
206
229
|
|
|
207
230
|
For a manual migration, run `cogmem migrate --yes --backup`. The migration runner adopts the existing `_meta.schema_version`, applies only later idempotent migrations, preserves Raw Ledger rows, and creates a timestamped, transaction-consistent standalone database backup before changing an on-disk database. The backup includes committed SQLite WAL pages instead of copying only the main database file.
|
|
208
231
|
|
|
209
|
-
Upgrade a 3.5.2 database, a 3.6.0 database, or a pre-release schema-25 test database into the 3.6.
|
|
232
|
+
Upgrade a 3.5.2 database, a 3.6.0 database, or a pre-release schema-25 test database into the 3.6.4 schema set with one command:
|
|
210
233
|
|
|
211
234
|
```bash
|
|
212
235
|
cogmem migrate --yes --backup --json
|
|
@@ -237,9 +260,14 @@ cogmem repair project-scope --from "" --to openclaw --apply --json
|
|
|
237
260
|
Inspect and conditionally process sealed conversation episodes:
|
|
238
261
|
|
|
239
262
|
```bash
|
|
263
|
+
cogmem memory status --project my-agent --json
|
|
240
264
|
cogmem episode status --project my-agent --json
|
|
241
|
-
cogmem dream
|
|
265
|
+
cogmem dream status --project my-agent --json
|
|
266
|
+
cogmem dream tick --project my-agent --mode auto --max-episodes 20 --json
|
|
267
|
+
cogmem memory candidates --project my-agent --status candidate --json
|
|
242
268
|
cogmem memory govern --project my-agent --json
|
|
269
|
+
cogmem memory candidates --project my-agent --status needs_confirmation --json
|
|
270
|
+
cogmem memory review --project my-agent --id <candidate-id> --action approve --actor <operator> --reason "confirmed" --confirmation-event <user-event-id> --json
|
|
243
271
|
```
|
|
244
272
|
|
|
245
273
|
For a host timer, call `dream tick`; the timer only wakes the scheduler. An empty backlog performs no Dream work:
|
|
@@ -250,7 +278,7 @@ cogmem dream tick --project my-agent --mode auto --max-episodes 10 --json
|
|
|
250
278
|
|
|
251
279
|
Raw events are always written first. `KernelAgentMemoryBackend` and OpenClaw plugin 0.6.3 assemble live turns automatically. The foreground hook uses deterministic rules and previous assistant/user context; background import and repair paths may use the advisory hybrid classifier. Advisory output is allow-listed and cannot directly mutate durable memory. Unknown turns now fail closed as ambiguous. Continuation requires explicit continuation language or project/topic/entity/semantic overlap; Cogmem does not route domains with an expanding hard-coded keyword dictionary.
|
|
252
280
|
|
|
253
|
-
Hookless MCP agents can call `cogmem_episode_append` or bounded `cogmem_episode_import`. Existing OpenClaw/Hermes import commands use stable content identities and the same episode schema. Low-confidence imported groups soft-seal for review unless an operator explicitly forces sealing. Episode semantic summaries and closure receipts are control hints, never durable evidence; every Dream candidate must cite a non-empty subset of the episode's raw event IDs and still pass CPU governance.
|
|
281
|
+
Hookless MCP agents can call `cogmem_episode_append` or bounded `cogmem_episode_import`. Existing OpenClaw/Hermes import commands use stable content identities and the same episode schema. Low-confidence imported groups soft-seal for review unless an operator explicitly forces sealing. Cogmem 3.6.4 skips import batch sealing for empty episode boundaries and skips legacy empty Dream jobs so one bad imported episode cannot block the queue. Episode semantic summaries and closure receipts are control hints, never durable evidence; every Dream candidate must cite a non-empty subset of the episode's raw event IDs and still pass CPU governance.
|
|
254
282
|
|
|
255
283
|
User-shaped topic state is project-scoped. Explicit user operations become active and auditable; model-proposed topics, aliases, and relations remain candidates. Use MCP `cogmem_topic_list` to inspect nodes, `cogmem_topic_operate` to create, rename, alias, move, merge, split, or relate topics, and `cogmem_topic_rollback` to reverse an audited operation. Alias collisions fail closed as `needs_review`; applications can also call `TopicGovernance.rollback()` through the public API.
|
|
256
284
|
|
|
@@ -482,8 +510,8 @@ Hermes integration is MCP-based in this release. cogmem does not claim to be a n
|
|
|
482
510
|
Install the skill and patch Hermes MCP config:
|
|
483
511
|
|
|
484
512
|
```bash
|
|
485
|
-
cogmem
|
|
486
|
-
cogmem connect hermes --workspace /path/to/hermes/workspace --auto --force
|
|
513
|
+
npm install cogmem@latest --save
|
|
514
|
+
./node_modules/.bin/cogmem connect hermes --workspace /path/to/hermes/workspace --auto --force
|
|
487
515
|
```
|
|
488
516
|
|
|
489
517
|
This installs the agent-facing skill bundle at:
|
|
@@ -501,6 +529,8 @@ With `--auto`, it adds or updates a `cogmem` MCP server entry in:
|
|
|
501
529
|
~/.hermes/config.yaml
|
|
502
530
|
```
|
|
503
531
|
|
|
532
|
+
New Hermes configs start the server with `cogmem mcp`. Existing `cogmem-mcp` entries remain supported and are updated in place for tool allow-list changes.
|
|
533
|
+
|
|
504
534
|
Then reload MCP inside Hermes:
|
|
505
535
|
|
|
506
536
|
```text
|
|
@@ -688,7 +718,7 @@ For Hermes after an update, reload the MCP server or restart the agent host. If
|
|
|
688
718
|
cogmem connect hermes --workspace /path/to/hermes/workspace --auto --force
|
|
689
719
|
```
|
|
690
720
|
|
|
691
|
-
This also updates existing Hermes
|
|
721
|
+
This also updates existing Hermes MCP blocks with missing strategy, episode, Dream, memory-map, maintenance, and prospective tools. New configs use `cogmem mcp`; `cogmem-mcp` remains a compatibility bin.
|
|
692
722
|
|
|
693
723
|
## Documentation
|
|
694
724
|
|
|
@@ -710,6 +740,7 @@ Installed OpenClaw and Hermes skills include their own `references/operations.md
|
|
|
710
740
|
cogmem init
|
|
711
741
|
cogmem doctor
|
|
712
742
|
cogmem connect openclaw|hermes
|
|
743
|
+
cogmem mcp
|
|
713
744
|
cogmem update
|
|
714
745
|
cogmem memory recall|search|show|dream|govern|candidates|review|status|map|tick|bind
|
|
715
746
|
cogmem memory graph|graph-search|graph-explore|graph-node|graph-neighbors|graph-path|graph-timeline
|
|
@@ -739,7 +770,7 @@ npm pack --dry-run --json
|
|
|
739
770
|
npm publish --dry-run --access public
|
|
740
771
|
```
|
|
741
772
|
|
|
742
|
-
Create a GitHub Release from the matching version tag, for example `v3.6.
|
|
773
|
+
Create a GitHub Release from the matching version tag, for example `v3.6.4`. The `.github/workflows/publish.yml` workflow publishes to npm only when the release is published, not when a tag is pushed. The npm Trusted Publisher entry must match repository `liuqin164/cogmem`, workflow file `publish.yml`, and environment `npm publish`.
|
|
743
774
|
|
|
744
775
|
Publish manually only for emergency fallback:
|
|
745
776
|
|
package/RELEASE_CHECKLIST.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# cogmem 3.6.
|
|
1
|
+
# cogmem 3.6.4 Release Checklist
|
|
2
2
|
|
|
3
3
|
This release is distributed through the npm registry. GitHub remains the source and review mirror.
|
|
4
4
|
|
|
5
5
|
## Required Metadata
|
|
6
6
|
|
|
7
7
|
- `package.json` name is `cogmem`.
|
|
8
|
-
- `package.json` version is `3.6.
|
|
8
|
+
- `package.json` version is `3.6.4`.
|
|
9
9
|
- `package.json` has `publishConfig.access = public`.
|
|
10
10
|
- Public export `.` points to `dist/public.js` and `dist/public.d.ts`.
|
|
11
11
|
- Internal subpath `./internal` exists only as an explicit advanced subpath.
|
|
@@ -19,12 +19,13 @@ This release is distributed through the npm registry. GitHub remains the source
|
|
|
19
19
|
- `cogmem doctor`
|
|
20
20
|
- `cogmem connect`
|
|
21
21
|
- `cogmem update`
|
|
22
|
+
- `cogmem mcp`
|
|
22
23
|
- `cogmem openclaw diagnose`
|
|
23
24
|
- `cogmem-compact`
|
|
24
25
|
- `cogmem memory`
|
|
25
26
|
- `cogmem repair`
|
|
26
27
|
- `cogmem explain-recall`
|
|
27
|
-
- `cogmem-mcp`
|
|
28
|
+
- `cogmem-mcp` compatibility bin for existing host configs
|
|
28
29
|
- `cogmem import-openclaw`
|
|
29
30
|
- `cogmem import-hermes`
|
|
30
31
|
- `cogmem normalize-transcript`
|
|
@@ -43,6 +44,8 @@ MCP `tools/list` includes strategy, episode append/import/status/seal/repair, to
|
|
|
43
44
|
## Required Documentation
|
|
44
45
|
|
|
45
46
|
- README explains the vision, architecture, limits, and one-line install command.
|
|
47
|
+
- README and skills document npm as the default install path: workspace-local `npm install cogmem@latest --save` for OpenClaw/Hermes projects, global npm only when the operator wants one shared CLI, and the one-line installer as compatibility.
|
|
48
|
+
- README and skills state that `cogmem init` is an interactive operator wizard and must not be scripted by an unattended agent; agents should use resolved `cogmem` commands, `cogmem doctor`, and `cogmem connect <agent>`.
|
|
46
49
|
- README says this is a single-agent memory kernel, not an agent team shared brain.
|
|
47
50
|
- README distinguishes embedding models from Dream Curator memory-model LLMs.
|
|
48
51
|
- README and integration docs explain labeled `sourceContext`, strict before/after window metadata, `charRange` / `sourceRange`, and OpenClaw `sourceWindow` / `sourceTruncation` injection.
|
|
@@ -56,6 +59,9 @@ MCP `tools/list` includes strategy, episode append/import/status/seal/repair, to
|
|
|
56
59
|
- README and skills explain that Prospective Memory is confirmed-only state with no task execution capability, and how to use BrainEval as a release gate.
|
|
57
60
|
- README and skills explain Strategy Cortex templates, no-instruction-authority lifecycle, one-retry replanning, strategy-conditioned retrieval, offline-only rollout comparison, and read-only MemoryUseJudge telemetry.
|
|
58
61
|
- README and skills explain Raw Ledger-first episode assembly, soft/hard sealing, explicit conditional Dream ticks, raw-event evidence grounding, repair/retry, and hookless Hermes MCP/import usage.
|
|
62
|
+
- README and skills give the full post-import maintenance sequence: status, episode status, Dream status, bounded Dream tick, candidate listing, govern candidate, needs-confirmation listing, explicit review, and recall verification.
|
|
63
|
+
- README and skills explain that 3.6.4 skips empty imported episode boundaries and legacy empty Dream jobs instead of letting them abort `dream tick`.
|
|
64
|
+
- README and skills document `cogmem mcp` as the preferred MCP server command for new configs while preserving `cogmem-mcp` as a compatibility bin.
|
|
59
65
|
- README and skills explain CPU foreground versus hybrid background classification, contextual short replies, registry-aware topic boundaries, safe reopen, semantic-summary non-evidence status, per-job Dream modes/failures, stable import identity, and schema migration 24.
|
|
60
66
|
- README and skills explain user-shaped topic operations, user-explicit versus model-candidate authority, alias collision review, operation rollback, and project isolation.
|
|
61
67
|
- README, `MEMORY_ATLAS.md`, and skills distinguish the system anatomy map from the content Atlas; explain graph overview/search/explore/node/neighbors/path/timeline, generic multi-facet cold-memory resurrection, activation visibility, source drill-down, and project isolation.
|
|
@@ -85,7 +91,7 @@ npm publish --dry-run --access public
|
|
|
85
91
|
|
|
86
92
|
The pack dry-run must include built public API files, CLI files, examples, docs, and `install.sh`. It must not include local databases or machine-specific files.
|
|
87
93
|
|
|
88
|
-
After verification, create a GitHub Release from the matching version tag, for example `v3.6.
|
|
94
|
+
After verification, create a GitHub Release from the matching version tag, for example `v3.6.4`. The release workflow publishes through npm Trusted Publishing when the release is published. It must not publish on tag push alone.
|
|
89
95
|
|
|
90
96
|
Emergency manual fallback:
|
|
91
97
|
|
package/dist/bin/connect.js
CHANGED
|
@@ -92,19 +92,18 @@ function defaultSkillPath(agent, workspaceRoot) {
|
|
|
92
92
|
function nextCommands(agent) {
|
|
93
93
|
if (agent === 'openclaw') {
|
|
94
94
|
return [
|
|
95
|
-
'./node_modules/.bin/cogmem
|
|
96
|
-
'./node_modules/.bin/cogmem
|
|
97
|
-
'./node_modules/.bin/cogmem
|
|
98
|
-
'./node_modules/.bin/cogmem
|
|
99
|
-
'./node_modules/.bin/cogmem
|
|
95
|
+
'./node_modules/.bin/cogmem doctor',
|
|
96
|
+
'./node_modules/.bin/cogmem openclaw diagnose --workspace . --json',
|
|
97
|
+
'./node_modules/.bin/cogmem import-openclaw --workspace . --project openclaw --dry-run',
|
|
98
|
+
'./node_modules/.bin/cogmem import-openclaw --workspace . --project openclaw',
|
|
99
|
+
'./node_modules/.bin/cogmem memory status --project openclaw --json',
|
|
100
100
|
];
|
|
101
101
|
}
|
|
102
102
|
return [
|
|
103
|
-
'./node_modules/.bin/cogmem
|
|
104
|
-
'./node_modules/.bin/cogmem-
|
|
105
|
-
'./node_modules/.bin/cogmem-
|
|
106
|
-
'./node_modules/.bin/cogmem
|
|
107
|
-
'./node_modules/.bin/cogmem-import-hermes --workspace . --project hermes',
|
|
103
|
+
'./node_modules/.bin/cogmem doctor',
|
|
104
|
+
'./node_modules/.bin/cogmem import-hermes --workspace . --project hermes --dry-run',
|
|
105
|
+
'./node_modules/.bin/cogmem import-hermes --workspace . --project hermes',
|
|
106
|
+
'./node_modules/.bin/cogmem memory status --project hermes --json',
|
|
108
107
|
];
|
|
109
108
|
}
|
|
110
109
|
function usage() {
|
|
@@ -138,33 +137,45 @@ function hostConfigSnippet(agent, workspaceRoot, auto) {
|
|
|
138
137
|
'// Add host config only after installing a real OpenClaw plugin wrapper with a valid manifest/schema.',
|
|
139
138
|
].join('\n');
|
|
140
139
|
}
|
|
141
|
-
const
|
|
140
|
+
const mcpServer = resolveCogmemMcpServer(workspaceRoot);
|
|
142
141
|
return [
|
|
143
142
|
'mcp_servers:',
|
|
144
143
|
' cogmem:',
|
|
145
|
-
` command: "${
|
|
146
|
-
|
|
144
|
+
` command: "${mcpServer.command}"`,
|
|
145
|
+
` args: ${JSON.stringify(mcpServer.args)}`,
|
|
147
146
|
' enabled: true',
|
|
148
147
|
' tools:',
|
|
149
148
|
' include:',
|
|
150
149
|
...HERMES_COGMEM_TOOLS.map((tool) => ` - ${tool}`),
|
|
151
150
|
].join('\n');
|
|
152
151
|
}
|
|
153
|
-
function
|
|
152
|
+
function resolveCogmemMcpServer(workspaceRoot) {
|
|
154
153
|
if (process.env.COGMEM_MCP_BIN)
|
|
155
|
-
return process.env.COGMEM_MCP_BIN;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
154
|
+
return { command: process.env.COGMEM_MCP_BIN, args: [] };
|
|
155
|
+
if (process.env.COGMEM_BIN)
|
|
156
|
+
return { command: process.env.COGMEM_BIN, args: ['mcp'] };
|
|
157
|
+
const workspaceCli = join(workspaceRoot, 'node_modules', '.bin', 'cogmem');
|
|
158
|
+
if (existsSync(workspaceCli))
|
|
159
|
+
return { command: workspaceCli, args: ['mcp'] };
|
|
159
160
|
const pathValue = process.env.PATH || '';
|
|
161
|
+
for (const segment of pathValue.split(':')) {
|
|
162
|
+
if (!segment)
|
|
163
|
+
continue;
|
|
164
|
+
const candidate = join(segment, 'cogmem');
|
|
165
|
+
if (existsSync(candidate))
|
|
166
|
+
return { command: candidate, args: ['mcp'] };
|
|
167
|
+
}
|
|
168
|
+
const workspaceMcp = join(workspaceRoot, 'node_modules', '.bin', 'cogmem-mcp');
|
|
169
|
+
if (existsSync(workspaceMcp))
|
|
170
|
+
return { command: workspaceMcp, args: [] };
|
|
160
171
|
for (const segment of pathValue.split(':')) {
|
|
161
172
|
if (!segment)
|
|
162
173
|
continue;
|
|
163
174
|
const candidate = join(segment, 'cogmem-mcp');
|
|
164
175
|
if (existsSync(candidate))
|
|
165
|
-
return candidate;
|
|
176
|
+
return { command: candidate, args: [] };
|
|
166
177
|
}
|
|
167
|
-
return 'cogmem
|
|
178
|
+
return { command: 'cogmem', args: ['mcp'] };
|
|
168
179
|
}
|
|
169
180
|
function installSkill(args) {
|
|
170
181
|
if (!args.agent)
|
|
@@ -237,9 +248,9 @@ function defaultHermesConfigPath(env = process.env) {
|
|
|
237
248
|
}
|
|
238
249
|
function installHermesMcpConfig(input) {
|
|
239
250
|
const configPath = resolve(input.configPath || defaultHermesConfigPath());
|
|
240
|
-
const
|
|
251
|
+
const server = resolveCogmemMcpServer(resolve(input.workspaceRoot));
|
|
241
252
|
const original = existsSync(configPath) ? readFileSync(configPath, 'utf8') : '';
|
|
242
|
-
const patched = patchHermesMcpConfig(original,
|
|
253
|
+
const patched = patchHermesMcpConfig(original, server.command, server.args);
|
|
243
254
|
const changed = patched !== original;
|
|
244
255
|
let backupPath;
|
|
245
256
|
if (!input.dryRun && (changed || input.force)) {
|
|
@@ -253,21 +264,22 @@ function installHermesMcpConfig(input) {
|
|
|
253
264
|
return {
|
|
254
265
|
enabled: true,
|
|
255
266
|
configPath,
|
|
256
|
-
serverCommand,
|
|
267
|
+
serverCommand: server.command,
|
|
268
|
+
serverArgs: server.args,
|
|
257
269
|
dryRun: input.dryRun,
|
|
258
270
|
configUpdated: changed || input.force,
|
|
259
271
|
backupPath,
|
|
260
272
|
};
|
|
261
273
|
}
|
|
262
|
-
function patchHermesMcpConfig(original, serverCommand) {
|
|
263
|
-
if (/^\s+cogmem\s*:/m.test(original)
|
|
274
|
+
function patchHermesMcpConfig(original, serverCommand, serverArgs) {
|
|
275
|
+
if (/^\s+cogmem\s*:/m.test(original)) {
|
|
264
276
|
return patchExistingHermesCogmemConfig(original);
|
|
265
277
|
}
|
|
266
278
|
const lines = original.replace(/\r\n/g, '\n').split('\n');
|
|
267
279
|
const serverBlock = [
|
|
268
280
|
' cogmem:',
|
|
269
281
|
` command: "${serverCommand}"`,
|
|
270
|
-
|
|
282
|
+
` args: ${JSON.stringify(serverArgs)}`,
|
|
271
283
|
' enabled: true',
|
|
272
284
|
' tools:',
|
|
273
285
|
' include:',
|
|
@@ -366,7 +378,7 @@ function printHuman(result) {
|
|
|
366
378
|
console.log('');
|
|
367
379
|
console.log('Hermes MCP integration:');
|
|
368
380
|
console.log(` config: ${result.hermesMcp.configPath}`);
|
|
369
|
-
console.log(` command: ${result.hermesMcp.serverCommand}
|
|
381
|
+
console.log(` command: ${result.hermesMcp.serverCommand} ${result.hermesMcp.serverArgs.join(' ')}`.trimEnd());
|
|
370
382
|
if (result.hermesMcp.backupPath)
|
|
371
383
|
console.log(` backup: ${result.hermesMcp.backupPath}`);
|
|
372
384
|
console.log(' reload: /reload-mcp');
|
|
@@ -152,6 +152,7 @@ function previewSources(input) {
|
|
|
152
152
|
recordsIngested: 0,
|
|
153
153
|
skippedRecords: 0,
|
|
154
154
|
rawRecordsAnchored: 0,
|
|
155
|
+
emptyEpisodesSkipped: 0,
|
|
155
156
|
reindexRaw: false,
|
|
156
157
|
processedSourceIds: [],
|
|
157
158
|
diagnostics,
|
|
@@ -161,6 +162,7 @@ function previewSources(input) {
|
|
|
161
162
|
async function importSources(input) {
|
|
162
163
|
const opened = openKernel(input.args, input.workspaceRoot);
|
|
163
164
|
const importedEpisodeIds = new Set();
|
|
165
|
+
let emptyEpisodesSkipped = 0;
|
|
164
166
|
const processor = new InstalledBatchProcessor({
|
|
165
167
|
cursorStore: opened.kernel.cursorStore,
|
|
166
168
|
ingestBatch: async (items) => {
|
|
@@ -190,7 +192,7 @@ async function importSources(input) {
|
|
|
190
192
|
for (const episodeId of importedEpisodeIds) {
|
|
191
193
|
const episode = opened.kernel.getEpisode(episodeId);
|
|
192
194
|
if (episode?.status !== 'sealed') {
|
|
193
|
-
opened.kernel
|
|
195
|
+
emptyEpisodesSkipped += sealImportedEpisodeIfReady(opened.kernel, episodeId, `${input.agent}_import_batch_boundary`) ? 0 : 1;
|
|
194
196
|
}
|
|
195
197
|
}
|
|
196
198
|
return {
|
|
@@ -207,6 +209,7 @@ async function importSources(input) {
|
|
|
207
209
|
recordsIngested: summary.recordsIngested,
|
|
208
210
|
skippedRecords: summary.skippedRecords,
|
|
209
211
|
rawRecordsAnchored: summary.recordsIngested,
|
|
212
|
+
emptyEpisodesSkipped,
|
|
210
213
|
reindexRaw: false,
|
|
211
214
|
processedSourceIds: summary.processedSourceIds,
|
|
212
215
|
diagnostics: summary.adapterDiagnostics,
|
|
@@ -238,6 +241,7 @@ async function reindexRawSources(input) {
|
|
|
238
241
|
let rawRecordsAnchored = 0;
|
|
239
242
|
let skippedRecords = 0;
|
|
240
243
|
const importedEpisodeIds = new Set();
|
|
244
|
+
let emptyEpisodesSkipped = 0;
|
|
241
245
|
try {
|
|
242
246
|
for (const source of input.sources) {
|
|
243
247
|
const adapter = adapters.get(source.adapterKind);
|
|
@@ -279,7 +283,7 @@ async function reindexRawSources(input) {
|
|
|
279
283
|
for (const episodeId of importedEpisodeIds) {
|
|
280
284
|
const episode = opened.kernel.getEpisode(episodeId);
|
|
281
285
|
if (episode?.status !== 'sealed') {
|
|
282
|
-
opened.kernel
|
|
286
|
+
emptyEpisodesSkipped += sealImportedEpisodeIfReady(opened.kernel, episodeId, `${input.agent}_reindex_batch_boundary`) ? 0 : 1;
|
|
283
287
|
}
|
|
284
288
|
}
|
|
285
289
|
return {
|
|
@@ -297,6 +301,7 @@ async function reindexRawSources(input) {
|
|
|
297
301
|
recordsIngested: rawRecordsAnchored,
|
|
298
302
|
skippedRecords,
|
|
299
303
|
rawRecordsAnchored,
|
|
304
|
+
emptyEpisodesSkipped,
|
|
300
305
|
processedSourceIds,
|
|
301
306
|
diagnostics,
|
|
302
307
|
sourceResults,
|
|
@@ -307,6 +312,12 @@ async function reindexRawSources(input) {
|
|
|
307
312
|
opened.kernel.close();
|
|
308
313
|
}
|
|
309
314
|
}
|
|
315
|
+
function sealImportedEpisodeIfReady(kernel, episodeId, reason) {
|
|
316
|
+
if (kernel.listEpisodeEventLinks(episodeId).length === 0)
|
|
317
|
+
return false;
|
|
318
|
+
kernel.sealImportedEpisode(episodeId, { reason });
|
|
319
|
+
return true;
|
|
320
|
+
}
|
|
310
321
|
async function recordRawImportedEvidence(kernel, projectId, envelope) {
|
|
311
322
|
const sourceRef = envelope.ingestInput.sourceRefs?.[0];
|
|
312
323
|
const record = envelope.record;
|
|
@@ -483,6 +494,8 @@ function printHumanSummary(result) {
|
|
|
483
494
|
console.log(`records ${action}: ${result.dryRun ? result.recordsWouldIngest : result.recordsIngested}`);
|
|
484
495
|
if (result.rawRecordsAnchored !== undefined)
|
|
485
496
|
console.log(`raw ledger anchors: ${result.rawRecordsAnchored}`);
|
|
497
|
+
if (result.emptyEpisodesSkipped)
|
|
498
|
+
console.log(`empty episodes skipped: ${result.emptyEpisodesSkipped}`);
|
|
486
499
|
console.log(`records skipped: ${result.skippedRecords}`);
|
|
487
500
|
if (result.diagnostics.length > 0) {
|
|
488
501
|
console.log('diagnostics:');
|
package/dist/bin/mcp.js
CHANGED
|
@@ -29,7 +29,8 @@ function stringArg(values, key) {
|
|
|
29
29
|
}
|
|
30
30
|
function usage() {
|
|
31
31
|
return [
|
|
32
|
-
'Usage: cogmem
|
|
32
|
+
'Usage: cogmem mcp [--db <memory.db>|--config <config.toml>] [--cwd <dir>]',
|
|
33
|
+
' cogmem-mcp [--db <memory.db>|--config <config.toml>] [--cwd <dir>]',
|
|
33
34
|
'',
|
|
34
35
|
'Starts a stdio MCP server exposing recall, strategy, episode append/import/status/seal, conditional dream tick/status, memory map, maintenance, and prospective-memory tools.',
|
|
35
36
|
].join('\n');
|
|
@@ -54,6 +54,7 @@ export declare class EpisodeStore {
|
|
|
54
54
|
}): EpisodeEventLink;
|
|
55
55
|
getEventLink(eventId: string): EpisodeEventLink | undefined;
|
|
56
56
|
listEventLinks(episodeId: string): EpisodeEventLink[];
|
|
57
|
+
isEpisodeEmpty(episodeId: string): boolean;
|
|
57
58
|
addCrossReference(input: {
|
|
58
59
|
projectId: string;
|
|
59
60
|
episodeId: string;
|
|
@@ -120,6 +121,10 @@ export declare class EpisodeStore {
|
|
|
120
121
|
maxAttempts: number;
|
|
121
122
|
runId?: string;
|
|
122
123
|
}): ClaimedEpisodeDreamJob[];
|
|
124
|
+
skipEmptyDreamJobs(input: {
|
|
125
|
+
projectId?: string;
|
|
126
|
+
now?: number;
|
|
127
|
+
}): number;
|
|
123
128
|
completeDreamJob(episodeId: string, leaseId: string, candidateIds: string[], now: number): void;
|
|
124
129
|
failDreamJob(episodeId: string, leaseId: string, error: string, input: {
|
|
125
130
|
now: number;
|
|
@@ -128,6 +133,8 @@ export declare class EpisodeStore {
|
|
|
128
133
|
retryAfter?: number;
|
|
129
134
|
}): void;
|
|
130
135
|
retryFailed(projectId?: string): number;
|
|
136
|
+
private markEmptyEpisodeDreamSkipped;
|
|
137
|
+
private markEmptyEpisodeDreamSkippedMany;
|
|
131
138
|
getDreamStatus(projectId?: string): EpisodeDreamStatus;
|
|
132
139
|
countUnassignedRawEvents(projectId?: string): number;
|
|
133
140
|
markEventDisposition(input: {
|
|
@@ -142,6 +142,12 @@ export class EpisodeStore {
|
|
|
142
142
|
SELECT * FROM memory_episode_events WHERE episode_id = ? ORDER BY position
|
|
143
143
|
`).all(episodeId).map(mapEventLink);
|
|
144
144
|
}
|
|
145
|
+
isEpisodeEmpty(episodeId) {
|
|
146
|
+
const episode = this.getEpisode(episodeId);
|
|
147
|
+
if (!episode)
|
|
148
|
+
throw new Error(`episode_not_found:${episodeId}`);
|
|
149
|
+
return this.listEventLinks(episodeId).length === 0;
|
|
150
|
+
}
|
|
145
151
|
addCrossReference(input) {
|
|
146
152
|
const episode = this.getEpisode(input.episodeId);
|
|
147
153
|
if (!episode)
|
|
@@ -334,9 +340,18 @@ export class EpisodeStore {
|
|
|
334
340
|
const now = input.now ?? Date.now();
|
|
335
341
|
const episodes = this.listEpisodes({ projectId: input.projectId, statuses: ['soft_sealed'], limit: 1000 })
|
|
336
342
|
.filter((episode) => (episode.sealedAt || episode.updatedAt) <= input.sealedBefore);
|
|
337
|
-
|
|
343
|
+
let sealed = 0;
|
|
344
|
+
for (const episode of episodes) {
|
|
345
|
+
if (this.isEpisodeEmpty(episode.episodeId)) {
|
|
346
|
+
if (episode.dreamError !== 'episode_empty_soft_seal_not_promoted') {
|
|
347
|
+
this.markEmptyEpisodeDreamSkipped(episode.episodeId, now, 'episode_empty_soft_seal_not_promoted');
|
|
348
|
+
}
|
|
349
|
+
continue;
|
|
350
|
+
}
|
|
338
351
|
this.sealEpisode(episode.episodeId, { mode: 'hard', reason: 'soft_seal_stabilized', now });
|
|
339
|
-
|
|
352
|
+
sealed += 1;
|
|
353
|
+
}
|
|
354
|
+
return sealed;
|
|
340
355
|
}
|
|
341
356
|
claimDreamJobs(input) {
|
|
342
357
|
this.db.prepare(`
|
|
@@ -372,15 +387,21 @@ export class EpisodeStore {
|
|
|
372
387
|
UPDATE memory_episodes SET dream_status = 'queued', dream_error = NULL
|
|
373
388
|
WHERE episode_id IN (SELECT episode_id FROM episode_dream_jobs WHERE state = 'retry_scheduled' AND updated_at = ?)
|
|
374
389
|
`).run(input.now);
|
|
375
|
-
|
|
390
|
+
this.skipEmptyDreamJobs({ projectId: input.projectId, now: input.now });
|
|
391
|
+
const where = [`(j.state = 'pending' OR (j.state = 'retry_scheduled' AND j.attempts < ?))`];
|
|
376
392
|
const params = [input.maxAttempts];
|
|
377
393
|
if (input.projectId) {
|
|
378
|
-
where.push('project_id = ?');
|
|
394
|
+
where.push('j.project_id = ?');
|
|
379
395
|
params.push(input.projectId);
|
|
380
396
|
}
|
|
381
397
|
const rows = this.db.prepare(`
|
|
382
|
-
SELECT episode_id, project_id, mode_hint, attempts, created_at
|
|
383
|
-
|
|
398
|
+
SELECT j.episode_id, j.project_id, j.mode_hint, j.attempts, j.created_at
|
|
399
|
+
FROM episode_dream_jobs j
|
|
400
|
+
JOIN memory_episodes e ON e.episode_id = j.episode_id
|
|
401
|
+
WHERE ${where.join(' AND ')}
|
|
402
|
+
AND e.event_count > 0
|
|
403
|
+
AND EXISTS (SELECT 1 FROM memory_episode_events ee WHERE ee.episode_id = j.episode_id)
|
|
404
|
+
ORDER BY j.priority DESC, j.created_at LIMIT ?
|
|
384
405
|
`).all(...params, Math.max(1, Math.min(Math.trunc(input.limit), 100)));
|
|
385
406
|
const claimed = [];
|
|
386
407
|
for (const row of rows) {
|
|
@@ -403,6 +424,32 @@ export class EpisodeStore {
|
|
|
403
424
|
}
|
|
404
425
|
return claimed;
|
|
405
426
|
}
|
|
427
|
+
skipEmptyDreamJobs(input) {
|
|
428
|
+
const now = input.now ?? Date.now();
|
|
429
|
+
const params = [];
|
|
430
|
+
const where = [
|
|
431
|
+
`j.state IN ('pending', 'failed_retryable', 'retry_scheduled')`,
|
|
432
|
+
`(COALESCE(e.event_count, 0) = 0 OR NOT EXISTS (
|
|
433
|
+
SELECT 1 FROM memory_episode_events ee WHERE ee.episode_id = j.episode_id
|
|
434
|
+
))`,
|
|
435
|
+
];
|
|
436
|
+
if (input.projectId) {
|
|
437
|
+
where.push(`j.project_id = ?`);
|
|
438
|
+
params.push(input.projectId);
|
|
439
|
+
}
|
|
440
|
+
const rows = this.db.prepare(`
|
|
441
|
+
SELECT j.episode_id FROM episode_dream_jobs j
|
|
442
|
+
LEFT JOIN memory_episodes e ON e.episode_id = j.episode_id
|
|
443
|
+
WHERE ${where.join(' AND ')}
|
|
444
|
+
ORDER BY j.updated_at DESC
|
|
445
|
+
LIMIT 1000
|
|
446
|
+
`).all(...params);
|
|
447
|
+
const episodeIds = rows.map((row) => row.episode_id);
|
|
448
|
+
if (!episodeIds.length)
|
|
449
|
+
return 0;
|
|
450
|
+
this.markEmptyEpisodeDreamSkippedMany(episodeIds, now, 'episode_empty_skipped_no_raw_evidence');
|
|
451
|
+
return episodeIds.length;
|
|
452
|
+
}
|
|
406
453
|
completeDreamJob(episodeId, leaseId, candidateIds, now) {
|
|
407
454
|
const result = this.db.prepare(`
|
|
408
455
|
UPDATE episode_dream_jobs SET state = 'processed', candidate_ids_json = ?, lease_id = NULL,
|
|
@@ -441,6 +488,28 @@ export class EpisodeStore {
|
|
|
441
488
|
}
|
|
442
489
|
return Number(result.changes || 0);
|
|
443
490
|
}
|
|
491
|
+
markEmptyEpisodeDreamSkipped(episodeId, now, reason) {
|
|
492
|
+
this.markEmptyEpisodeDreamSkippedMany([episodeId], now, reason);
|
|
493
|
+
}
|
|
494
|
+
markEmptyEpisodeDreamSkippedMany(episodeIds, now, reason) {
|
|
495
|
+
if (!episodeIds.length)
|
|
496
|
+
return;
|
|
497
|
+
const placeholders = episodeIds.map(() => '?').join(', ');
|
|
498
|
+
this.db.transaction(() => {
|
|
499
|
+
this.db.prepare(`
|
|
500
|
+
UPDATE episode_dream_jobs SET state = 'skipped', lease_id = NULL, lease_until = NULL,
|
|
501
|
+
retry_after = NULL, failure_category = 'episode_empty', last_error = ?, candidate_ids_json = '[]',
|
|
502
|
+
updated_at = ?
|
|
503
|
+
WHERE episode_id IN (${placeholders})
|
|
504
|
+
AND state IN ('pending', 'processing', 'failed_retryable', 'retry_scheduled')
|
|
505
|
+
`).run(reason, now, ...episodeIds);
|
|
506
|
+
this.db.prepare(`
|
|
507
|
+
UPDATE memory_episodes SET dream_status = 'failed', dream_error = ?, last_dream_run_id = NULL,
|
|
508
|
+
dream_candidate_count = 0, updated_at = ?
|
|
509
|
+
WHERE episode_id IN (${placeholders})
|
|
510
|
+
`).run(reason, now, ...episodeIds);
|
|
511
|
+
})();
|
|
512
|
+
}
|
|
444
513
|
getDreamStatus(projectId) {
|
|
445
514
|
const rows = (projectId
|
|
446
515
|
? this.db.prepare(`SELECT state, COUNT(*) AS count FROM episode_dream_jobs WHERE project_id = ? GROUP BY state`).all(projectId)
|
package/dist/factory.js
CHANGED
|
@@ -83,7 +83,7 @@ import { SqliteVecStore } from './store/SqliteVecStore.js';
|
|
|
83
83
|
import { VectorStore } from './store/VectorStore.js';
|
|
84
84
|
import { config } from './utils/Config.js';
|
|
85
85
|
import { KernelRunningError, SnapshotExporter, SnapshotImporter, } from './snapshot/index.js';
|
|
86
|
-
const CORE_VERSION = '3.6.
|
|
86
|
+
const CORE_VERSION = '3.6.4';
|
|
87
87
|
const LATEST_SCHEMA_VERSION = 27;
|
|
88
88
|
export class MemoryKernel {
|
|
89
89
|
options;
|
|
@@ -983,6 +983,8 @@ export class MemoryKernel {
|
|
|
983
983
|
}
|
|
984
984
|
sealImportedEpisode(episodeId, input) {
|
|
985
985
|
const links = this.episodeStore.listEventLinks(episodeId);
|
|
986
|
+
if (!links.length)
|
|
987
|
+
throw new Error(`episode_empty:${episodeId}`);
|
|
986
988
|
const averageConfidence = links.length
|
|
987
989
|
? links.reduce((total, link) => total + link.confidence, 0) / links.length
|
|
988
990
|
: 0;
|
|
@@ -15,19 +15,24 @@ This writes `~/.hermes/skills/cogmem-memory/SKILL.md`, which Hermes discovers as
|
|
|
15
15
|
Run from the Hermes workspace root:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
|
|
19
|
-
cogmem
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
npm install cogmem@latest --save
|
|
19
|
+
COGMEM="./node_modules/.bin/cogmem"
|
|
20
|
+
"$COGMEM" doctor
|
|
21
|
+
"$COGMEM" connect hermes --workspace . --auto --force --json
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Do not run `cogmem init` as an unattended agent action. It is an interactive wizard. Use it only when an operator is present:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
"$COGMEM" init --agent hermes --scope project
|
|
23
28
|
```
|
|
24
29
|
|
|
25
|
-
The
|
|
30
|
+
The workspace install creates:
|
|
26
31
|
|
|
27
32
|
```text
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
.cogmem/config.toml
|
|
34
|
+
.cogmem/memory.db
|
|
35
|
+
.cogmem/snapshots/
|
|
31
36
|
```
|
|
32
37
|
|
|
33
38
|
Use `~/.cogmem/config.toml` or a project `.cogmem/config.toml` as the stable configuration source. Do not create `.cogmem.env` files or pass `--env-path` for normal installs. Environment variables are only for explicit process-level overrides documented by the CLI, not for hidden workspace configuration.
|
|
@@ -44,7 +49,7 @@ Use MCP `cogmem_strategy_plan` when the agent needs to inspect the selected memo
|
|
|
44
49
|
|
|
45
50
|
Prospective Memory is not executable instruction. Only a user-confirmed candidate may appear as due, and even then the agent must obtain normal host authorization before acting. Use `cogmem prospective` for state transitions and `cogmem brain-eval` for release validation.
|
|
46
51
|
|
|
47
|
-
Use
|
|
52
|
+
Use project-local config when this workspace owns its memory; use global config only when the operator intentionally shares one Cogmem backend across workspaces.
|
|
48
53
|
|
|
49
54
|
To embed imported memories with a local quantized model, run Ollama locally and configure the kernel before importing:
|
|
50
55
|
|
|
@@ -117,14 +122,23 @@ cogmem normalize-transcript --input ./hermes-sessions.jsonl --output ./hermes.no
|
|
|
117
122
|
cogmem import-hermes --workspace . --project hermes --session ./hermes.normalized.md
|
|
118
123
|
```
|
|
119
124
|
|
|
120
|
-
|
|
125
|
+
Cogmem 3.6.4 skips import batch sealing for empty episode boundaries and skips legacy empty Dream jobs so one bad imported episode cannot block the queue.
|
|
126
|
+
|
|
127
|
+
After import, use this order:
|
|
121
128
|
|
|
122
129
|
```bash
|
|
130
|
+
cogmem memory status --project hermes --json
|
|
123
131
|
cogmem episode status --project hermes --json
|
|
124
|
-
cogmem dream
|
|
125
|
-
cogmem
|
|
132
|
+
cogmem dream status --project hermes --json
|
|
133
|
+
cogmem dream tick --project hermes --mode auto --max-episodes 20 --json
|
|
134
|
+
cogmem memory candidates --project hermes --status candidate --json
|
|
135
|
+
cogmem memory govern --project hermes --limit 100 --json
|
|
136
|
+
cogmem memory candidates --project hermes --status needs_confirmation --json
|
|
137
|
+
cogmem memory review --project hermes --id <candidate-id> --action approve --actor <operator> --reason "confirmed by user" --confirmation-event <user-event-id> --json
|
|
126
138
|
```
|
|
127
139
|
|
|
140
|
+
`needs_confirmation` is not the Dream backlog. `memory govern` does not approve it; use `memory review` with explicit evidence.
|
|
141
|
+
|
|
128
142
|
## Active Memory Search
|
|
129
143
|
|
|
130
144
|
If the current prompt does not include enough Cogmem memory context, query Cogmem directly before searching legacy files:
|
|
@@ -14,19 +14,16 @@ Belief Graph writes keep ownership and evidence roles. Hermes may record assista
|
|
|
14
14
|
## Install
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
|
|
18
|
-
cogmem
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
cogmem connect hermes --workspace .
|
|
17
|
+
npm install cogmem@latest --save
|
|
18
|
+
COGMEM="./node_modules/.bin/cogmem"
|
|
19
|
+
"$COGMEM" doctor
|
|
20
|
+
"$COGMEM" connect hermes --workspace . --auto --force --json
|
|
22
21
|
```
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
Use `cogmem init` only as an interactive operator wizard, not as an unattended agent install step:
|
|
25
24
|
|
|
26
25
|
```bash
|
|
27
|
-
|
|
28
|
-
cogmem init --yes --agent hermes
|
|
29
|
-
cogmem connect hermes --workspace . --auto --force
|
|
26
|
+
"$COGMEM" init --agent hermes --scope project
|
|
30
27
|
```
|
|
31
28
|
|
|
32
29
|
Hermes integration is currently a skill plus MCP bridge. It does not replace a native Hermes memory provider and it does not patch Hermes runtime internals.
|
|
@@ -75,6 +72,19 @@ Import:
|
|
|
75
72
|
cogmem import-hermes --workspace . --project hermes
|
|
76
73
|
```
|
|
77
74
|
|
|
75
|
+
After import:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
cogmem memory status --project hermes --json
|
|
79
|
+
cogmem episode status --project hermes --json
|
|
80
|
+
cogmem dream status --project hermes --json
|
|
81
|
+
cogmem dream tick --project hermes --mode auto --max-episodes 20 --json
|
|
82
|
+
cogmem memory candidates --project hermes --status candidate --json
|
|
83
|
+
cogmem memory govern --project hermes --limit 100 --json
|
|
84
|
+
cogmem memory candidates --project hermes --status needs_confirmation --json
|
|
85
|
+
cogmem memory review --project hermes --id <candidate-id> --action approve --actor <operator> --reason "confirmed by user" --confirmation-event <user-event-id> --json
|
|
86
|
+
```
|
|
87
|
+
|
|
78
88
|
If Hermes stores memory somewhere else:
|
|
79
89
|
|
|
80
90
|
```bash
|
|
@@ -97,7 +107,7 @@ Dream stores explicit user clarification as organizational correction evidence r
|
|
|
97
107
|
|
|
98
108
|
After upgrades, reload MCP. Rerun `cogmem connect hermes --workspace . --auto --force` when MCP wiring, allow-listed tools, or the installed skill bundle changed.
|
|
99
109
|
|
|
100
|
-
Cogmem 3.6.
|
|
110
|
+
Cogmem 3.6.4 exposes seven read-only/idempotent Memory Atlas query tools plus explicit `cogmem_graph_touch`, installs from npm by default, and prevents empty imported episodes from blocking Dream. Use explore for broad memory inventory/history, search and node for a known concept, path/neighbors for relations, timeline for ordered reconstruction, and normal recall for a direct fact. Query facets combine the user's actual project, time, topic, entity/target, memory-kind, action, and keyword conditions like table filters, so cold memory can be revived without requiring an entity-time-action tuple. Touch only nodes actually used, and follow returned event IDs to raw evidence before quoting exact wording.
|
|
101
111
|
|
|
102
112
|
## Runtime
|
|
103
113
|
|
|
@@ -155,7 +165,7 @@ cogmem memory map --project hermes --json
|
|
|
155
165
|
cogmem memory tick --project hermes --json
|
|
156
166
|
cogmem memory bind --project hermes --json
|
|
157
167
|
cogmem episode status --project hermes --json
|
|
158
|
-
cogmem dream tick --project hermes --mode auto --json
|
|
168
|
+
cogmem dream tick --project hermes --mode auto --max-episodes 20 --json
|
|
159
169
|
```
|
|
160
170
|
|
|
161
171
|
`memory map` includes Memory Binding and Graph Recall counters. Bindings attach valuable user raw events to stable topic/entity paths, fuse same-claim evidence into claim-key clusters, and create graph anchors for raw-ledger drill-down; they are not verified long-term facts. If `memory tick` suggests `bind_raw_events`, run `memory bind` to backfill imported Hermes raw user events into the binding graph.
|
|
@@ -31,35 +31,56 @@ cogmem prospective due --project <projectId>
|
|
|
31
31
|
|
|
32
32
|
## Install
|
|
33
33
|
|
|
34
|
-
Run from the Hermes workspace root:
|
|
34
|
+
Run from the Hermes workspace root. Prefer a workspace-local npm dependency so Hermes and Cogmem upgrade together:
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
|
|
38
|
-
cogmem
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
npm install cogmem@latest --save
|
|
38
|
+
COGMEM="./node_modules/.bin/cogmem"
|
|
39
|
+
"$COGMEM" doctor
|
|
40
|
+
"$COGMEM" connect hermes --workspace . --auto --force --json
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
If the workspace already has Cogmem installed locally, keep using the local binary. If there is no local binary but a global install exists, use global. If neither exists, install first:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
if [ -x ./node_modules/.bin/cogmem ]; then
|
|
47
|
+
COGMEM="./node_modules/.bin/cogmem"
|
|
48
|
+
elif command -v cogmem >/dev/null 2>&1; then
|
|
49
|
+
COGMEM="cogmem"
|
|
50
|
+
else
|
|
51
|
+
npm install cogmem@latest --save
|
|
52
|
+
COGMEM="./node_modules/.bin/cogmem"
|
|
53
|
+
fi
|
|
41
54
|
```
|
|
42
55
|
|
|
43
|
-
|
|
56
|
+
Global npm is also supported when the operator wants one CLI for every workspace:
|
|
44
57
|
|
|
45
58
|
```bash
|
|
46
59
|
npm install -g cogmem@latest
|
|
47
|
-
cogmem
|
|
48
|
-
|
|
60
|
+
COGMEM="cogmem"
|
|
61
|
+
"$COGMEM" connect hermes --workspace . --auto --force --json
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The one-line installer remains available for machines that do not already have Bun. Use `COGMEM_SKIP_INIT=1` for agent-run installs so the installer does not start the interactive wizard:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
COGMEM_SKIP_INIT=1 curl -fsSL https://raw.githubusercontent.com/liuqin164/cogmem/main/install.sh | bash
|
|
68
|
+
COGMEM="cogmem"
|
|
69
|
+
"$COGMEM" connect hermes --workspace . --auto --force --json
|
|
49
70
|
```
|
|
50
71
|
|
|
51
|
-
Use
|
|
72
|
+
Do not run `cogmem init` as an unattended agent action. `cogmem init` is an interactive configuration wizard. Use it only when an operator is present or explicitly asks for a guided setup:
|
|
52
73
|
|
|
53
74
|
```bash
|
|
54
|
-
|
|
75
|
+
"$COGMEM" init --agent hermes --scope project
|
|
55
76
|
```
|
|
56
77
|
|
|
57
|
-
|
|
78
|
+
Hermes workspaces should normally use project-local config when the workspace owns its memory:
|
|
58
79
|
|
|
59
80
|
```text
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
81
|
+
.cogmem/config.toml
|
|
82
|
+
.cogmem/memory.db
|
|
83
|
+
.cogmem/snapshots/
|
|
63
84
|
```
|
|
64
85
|
|
|
65
86
|
To embed imported memories with a local quantized model, run Ollama locally and configure the kernel before importing:
|
|
@@ -159,12 +180,20 @@ cogmem import-hermes --workspace . --project hermes --session ./hermes.normalize
|
|
|
159
180
|
|
|
160
181
|
The importer is idempotent. Re-running it skips records already imported into the same memory database.
|
|
161
182
|
|
|
162
|
-
|
|
183
|
+
Cogmem 3.6.4 skips import batch sealing for empty episode boundaries and Dream skips legacy empty episode jobs instead of blocking the whole queue. If `episode status` shows `dreamError` beginning with `episode_empty`, inspect the source events and use episode repair instead of editing SQLite rows.
|
|
184
|
+
|
|
185
|
+
Run the maintenance loop under host supervision after import and during normal use. `needs_confirmation` is a human review queue, not the Dream backlog, and `memory govern` promotes only ordinary `candidate` rows:
|
|
163
186
|
|
|
164
187
|
```bash
|
|
188
|
+
cogmem memory status --project hermes --json
|
|
165
189
|
cogmem episode status --project hermes --json
|
|
166
|
-
cogmem dream
|
|
167
|
-
cogmem
|
|
190
|
+
cogmem dream status --project hermes --json
|
|
191
|
+
cogmem dream tick --project hermes --mode auto --max-episodes 20 --json
|
|
192
|
+
cogmem memory candidates --project hermes --status candidate --json
|
|
193
|
+
cogmem memory govern --project hermes --limit 100 --json
|
|
194
|
+
cogmem memory candidates --project hermes --status needs_confirmation --json
|
|
195
|
+
cogmem memory review --project hermes --id <candidate-id> --action approve --actor <operator> --reason "confirmed by user" --confirmation-event <distinct-user-event-id> --json
|
|
196
|
+
cogmem memory recall --query "<verification question>" --project hermes --agent hermes --json
|
|
168
197
|
```
|
|
169
198
|
|
|
170
199
|
A host timer may run this bounded tick periodically. The tick exits after inspecting the backlog and performs no work when no sealed episode is ready.
|
|
@@ -304,8 +333,8 @@ Do not edit `~/.hermes/config.yaml` to point `memory.provider` at `cogmem` until
|
|
|
304
333
|
```yaml
|
|
305
334
|
mcp_servers:
|
|
306
335
|
cogmem:
|
|
307
|
-
command: "/resolved/path/to/cogmem
|
|
308
|
-
args: []
|
|
336
|
+
command: "/resolved/path/to/cogmem"
|
|
337
|
+
args: ["mcp"]
|
|
309
338
|
enabled: true
|
|
310
339
|
tools:
|
|
311
340
|
include:
|
|
@@ -337,7 +366,7 @@ mcp_servers:
|
|
|
337
366
|
- cogmem_prospective
|
|
338
367
|
```
|
|
339
368
|
|
|
340
|
-
The command path is resolved by `cogmem connect hermes`: it uses `
|
|
369
|
+
The command path is resolved by `cogmem connect hermes`: it uses `COGMEM_BIN` when explicitly set, then a workspace-local `node_modules/.bin/cogmem`, then global `cogmem`, and passes `mcp` as the first argument. `COGMEM_MCP_BIN` and `cogmem-mcp` remain compatibility paths for existing host configs.
|
|
341
370
|
|
|
342
371
|
When Hermes calls `cogmem_recall`, it should pass `projectId: "hermes"` and may omit `agentId`; the MCP bridge infers `agentId` from `projectId`. The returned `items` use the same shape as `cogmem memory recall --project hermes --agent hermes --json`, including `raw_ledger` items, labeled `sourceContext` events, `sourceContext.window`, and `sourceContext.locator.command` when vectors are empty or compiled evidence misses.
|
|
343
372
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Cogmem 3.6.
|
|
1
|
+
# Cogmem 3.6.4 Operations Reference for Hermes
|
|
2
2
|
|
|
3
3
|
Read this file when installing, upgrading, importing, repairing, or operating Cogmem. `SKILL.md` contains the decision rules; this file records the operational commands.
|
|
4
4
|
|
|
@@ -21,22 +21,35 @@ Read this file when installing, upgrading, importing, repairing, or operating Co
|
|
|
21
21
|
|
|
22
22
|
## Install, connect, and reload
|
|
23
23
|
|
|
24
|
+
Recommended workspace-local npm install:
|
|
25
|
+
|
|
24
26
|
```bash
|
|
25
|
-
|
|
26
|
-
cogmem
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
npm install cogmem@latest --save
|
|
28
|
+
COGMEM="./node_modules/.bin/cogmem"
|
|
29
|
+
"$COGMEM" doctor
|
|
30
|
+
"$COGMEM" connect hermes --workspace . --auto --force --json
|
|
29
31
|
```
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
Use this resolver in agent-run scripts:
|
|
32
34
|
|
|
33
35
|
```bash
|
|
34
|
-
|
|
35
|
-
cogmem
|
|
36
|
-
|
|
36
|
+
if [ -x ./node_modules/.bin/cogmem ]; then
|
|
37
|
+
COGMEM="./node_modules/.bin/cogmem"
|
|
38
|
+
elif command -v cogmem >/dev/null 2>&1; then
|
|
39
|
+
COGMEM="cogmem"
|
|
40
|
+
else
|
|
41
|
+
npm install cogmem@latest --save
|
|
42
|
+
COGMEM="./node_modules/.bin/cogmem"
|
|
43
|
+
fi
|
|
37
44
|
```
|
|
38
45
|
|
|
39
|
-
|
|
46
|
+
Use `npm install -g cogmem@latest` only when the operator wants a global CLI. The one-line installer is still supported with `COGMEM_SKIP_INIT=1`, but do not run `cogmem init` unattended. `cogmem init` is an interactive wizard; run it only with an operator present:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
"$COGMEM" init --agent hermes --scope project
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Then run `/reload-mcp` inside Hermes. `connect --auto` installs this skill bundle and updates the Hermes MCP allow-list; it does not claim a native `memory.provider` integration. New configs start the bridge as `cogmem mcp`; `cogmem-mcp` remains a compatibility bin for older host configs.
|
|
40
53
|
|
|
41
54
|
## Upgrade and migrate
|
|
42
55
|
|
|
@@ -61,7 +74,7 @@ cogmem doctor
|
|
|
61
74
|
cogmem connect hermes --workspace . --auto --force --json
|
|
62
75
|
```
|
|
63
76
|
|
|
64
|
-
The backed-up command upgrades 3.5.2 schema 24, an existing 3.6.0 schema-26 database, or a pre-release schema-25 test database to the 3.6.
|
|
77
|
+
The backed-up command upgrades 3.5.2 schema 24, an existing 3.6.0 schema-26 database, or a pre-release schema-25 test database to the 3.6.4 schema-27 state in one run and preserves Raw Ledger evidence. `--dry-run` is read-only and does not create `_schema_migrations`. Reload MCP after reconnecting.
|
|
65
78
|
|
|
66
79
|
## Import Hermes memory
|
|
67
80
|
|
|
@@ -98,6 +111,22 @@ cogmem episode import --project hermes --session import-2026 --source-agent herm
|
|
|
98
111
|
|
|
99
112
|
Use stable `externalMessageId` values for MCP append/import. If an MCP batch warns `auto_identity_not_safe_across_split_batches`, assign IDs before splitting or retrying.
|
|
100
113
|
|
|
114
|
+
After import, verify semantic maintenance in this exact order:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
cogmem memory status --project hermes --json
|
|
118
|
+
cogmem episode status --project hermes --json
|
|
119
|
+
cogmem dream status --project hermes --json
|
|
120
|
+
cogmem dream tick --project hermes --mode auto --max-episodes 20 --json
|
|
121
|
+
cogmem memory candidates --project hermes --status candidate --json
|
|
122
|
+
cogmem memory govern --project hermes --limit 100 --json
|
|
123
|
+
cogmem memory candidates --project hermes --status needs_confirmation --json
|
|
124
|
+
cogmem memory review --project hermes --id <candidate-id> --action approve --actor <operator> --reason "confirmed by user" --confirmation-event <distinct-user-event-id> --json
|
|
125
|
+
cogmem memory recall --query "<verification question>" --project hermes --agent hermes --json
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
`needs_confirmation` is not a Dream backlog. `memory govern` does not approve it. Use `memory review` with explicit evidence. Cogmem 3.6.4 skips import batch sealing for empty episode boundaries and marks legacy empty Dream jobs as skipped so one bad imported episode cannot block the queue. If `episode status` reports `episode_empty_*`, inspect the episode and repair boundaries with the audited episode repair commands.
|
|
129
|
+
|
|
101
130
|
## Inspect, recall, and drill down
|
|
102
131
|
|
|
103
132
|
```bash
|
|
@@ -15,12 +15,17 @@ This writes `<workspace>/skills/cogmem-memory/SKILL.md`, which OpenClaw discover
|
|
|
15
15
|
Run from the OpenClaw workspace root:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
|
|
19
|
-
cogmem
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
npm install cogmem@latest --save
|
|
19
|
+
COGMEM="./node_modules/.bin/cogmem"
|
|
20
|
+
"$COGMEM" doctor
|
|
21
|
+
"$COGMEM" connect openclaw --workspace . --auto --force --json
|
|
22
|
+
"$COGMEM" openclaw diagnose --workspace . --json
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Do not run `cogmem init` as an unattended agent action. It is an interactive wizard. Use it only when an operator is present:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
"$COGMEM" init --agent openclaw --scope project
|
|
24
29
|
```
|
|
25
30
|
|
|
26
31
|
The OpenClaw workspace install creates:
|
|
@@ -92,6 +97,22 @@ cogmem import-openclaw --workspace . --project openclaw --json
|
|
|
92
97
|
```
|
|
93
98
|
|
|
94
99
|
Real non-JSON imports print source-level and embedding+ingest progress to stderr. Use `--json --progress` to keep JSON on stdout while streaming progress to stderr, or `--no-progress` when a wrapper needs quiet stderr.
|
|
100
|
+
Cogmem 3.6.4 skips import batch sealing for empty episode boundaries and skips legacy empty Dream jobs so one bad imported episode cannot block the queue.
|
|
101
|
+
|
|
102
|
+
After import, use this order:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
cogmem memory status --project openclaw --json
|
|
106
|
+
cogmem episode status --project openclaw --json
|
|
107
|
+
cogmem dream status --project openclaw --json
|
|
108
|
+
cogmem dream tick --project openclaw --mode auto --max-episodes 20 --json
|
|
109
|
+
cogmem memory candidates --project openclaw --status candidate --json
|
|
110
|
+
cogmem memory govern --project openclaw --limit 100 --json
|
|
111
|
+
cogmem memory candidates --project openclaw --status needs_confirmation --json
|
|
112
|
+
cogmem memory review --project openclaw --id <candidate-id> --action approve --actor <operator> --reason "confirmed by user" --confirmation-event <user-event-id> --json
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`needs_confirmation` is not the Dream backlog. `memory govern` does not approve it; use `memory review` with explicit evidence.
|
|
95
116
|
|
|
96
117
|
Import scope:
|
|
97
118
|
|
|
@@ -9,19 +9,16 @@ Belief Graph writes keep ownership and evidence roles. OpenClaw may record assis
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
|
|
13
|
-
cogmem
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
cogmem connect openclaw --workspace . --auto --force
|
|
12
|
+
npm install cogmem@latest --save
|
|
13
|
+
COGMEM="./node_modules/.bin/cogmem"
|
|
14
|
+
"$COGMEM" doctor
|
|
15
|
+
"$COGMEM" connect openclaw --workspace . --auto --force --json
|
|
17
16
|
```
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
Use `cogmem init` only as an interactive operator wizard, not as an unattended agent install step:
|
|
20
19
|
|
|
21
20
|
```bash
|
|
22
|
-
|
|
23
|
-
cogmem init --yes --agent openclaw --scope project
|
|
24
|
-
cogmem connect openclaw --workspace . --auto --force
|
|
21
|
+
"$COGMEM" init --agent openclaw --scope project
|
|
25
22
|
```
|
|
26
23
|
|
|
27
24
|
## Local Quantized Embeddings
|
|
@@ -61,7 +58,7 @@ Then run:
|
|
|
61
58
|
|
|
62
59
|
```bash
|
|
63
60
|
cogmem episode status --project openclaw --json
|
|
64
|
-
cogmem dream tick --project openclaw --mode auto --json
|
|
61
|
+
cogmem dream tick --project openclaw --mode auto --max-episodes 20 --json
|
|
65
62
|
cogmem memory govern --project openclaw --json
|
|
66
63
|
cogmem memory candidates --project openclaw --status candidate --json
|
|
67
64
|
```
|
|
@@ -86,7 +83,7 @@ cogmem memory tick --project openclaw --json
|
|
|
86
83
|
cogmem memory bind --project openclaw --json
|
|
87
84
|
```
|
|
88
85
|
|
|
89
|
-
Cogmem 3.6.
|
|
86
|
+
Cogmem 3.6.4 keeps the 3.6.x Memory Atlas and OpenClaw reliability work, makes npm the default install and update channel, and prevents empty imported episodes from blocking Dream. The auto plugin uses one shared bridge/kernel lifecycle for graph exploration, evidence-bearing node/timeline drill-down, and recall, so OpenClaw does not need MCP for broad inventory/history questions. Atlas combines the query's actual project, time, topic, entity/target, memory-kind, action, and keyword conditions like table filters; no fixed entity-time-action tuple is required.
|
|
90
87
|
|
|
91
88
|
```bash
|
|
92
89
|
cogmem memory graph-explore --project openclaw --query "去年与 Hermes 有关的决定" --json
|
|
@@ -126,6 +123,19 @@ Import:
|
|
|
126
123
|
cogmem import-openclaw --workspace . --project openclaw
|
|
127
124
|
```
|
|
128
125
|
|
|
126
|
+
After import:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
cogmem memory status --project openclaw --json
|
|
130
|
+
cogmem episode status --project openclaw --json
|
|
131
|
+
cogmem dream status --project openclaw --json
|
|
132
|
+
cogmem dream tick --project openclaw --mode auto --max-episodes 20 --json
|
|
133
|
+
cogmem memory candidates --project openclaw --status candidate --json
|
|
134
|
+
cogmem memory govern --project openclaw --limit 100 --json
|
|
135
|
+
cogmem memory candidates --project openclaw --status needs_confirmation --json
|
|
136
|
+
cogmem memory review --project openclaw --id <candidate-id> --action approve --actor <operator> --reason "confirmed by user" --confirmation-event <user-event-id> --json
|
|
137
|
+
```
|
|
138
|
+
|
|
129
139
|
Single source files and batches can be imported explicitly:
|
|
130
140
|
|
|
131
141
|
```bash
|
|
@@ -31,30 +31,51 @@ cogmem prospective due --project <projectId>
|
|
|
31
31
|
|
|
32
32
|
## Install
|
|
33
33
|
|
|
34
|
-
Run from the OpenClaw workspace root:
|
|
34
|
+
Run from the OpenClaw workspace root. Prefer a workspace-local npm dependency so OpenClaw and Cogmem upgrade together:
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
|
|
38
|
-
cogmem
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
npm install cogmem@latest --save
|
|
38
|
+
COGMEM="./node_modules/.bin/cogmem"
|
|
39
|
+
"$COGMEM" doctor
|
|
40
|
+
"$COGMEM" connect openclaw --workspace . --auto --force --json
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
If the workspace already has Cogmem installed locally, keep using the local binary. If there is no local binary but a global install exists, use global. If neither exists, install first:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
if [ -x ./node_modules/.bin/cogmem ]; then
|
|
47
|
+
COGMEM="./node_modules/.bin/cogmem"
|
|
48
|
+
elif command -v cogmem >/dev/null 2>&1; then
|
|
49
|
+
COGMEM="cogmem"
|
|
50
|
+
else
|
|
51
|
+
npm install cogmem@latest --save
|
|
52
|
+
COGMEM="./node_modules/.bin/cogmem"
|
|
53
|
+
fi
|
|
41
54
|
```
|
|
42
55
|
|
|
43
|
-
|
|
56
|
+
Global npm is also supported when the operator wants one CLI for every workspace:
|
|
44
57
|
|
|
45
58
|
```bash
|
|
46
59
|
npm install -g cogmem@latest
|
|
47
|
-
cogmem
|
|
48
|
-
|
|
60
|
+
COGMEM="cogmem"
|
|
61
|
+
"$COGMEM" connect openclaw --workspace . --auto --force --json
|
|
49
62
|
```
|
|
50
63
|
|
|
51
|
-
|
|
64
|
+
The one-line installer remains available for machines that do not already have Bun. Use `COGMEM_SKIP_INIT=1` for agent-run installs so the installer does not start the interactive wizard:
|
|
52
65
|
|
|
53
66
|
```bash
|
|
54
|
-
|
|
67
|
+
COGMEM_SKIP_INIT=1 curl -fsSL https://raw.githubusercontent.com/liuqin164/cogmem/main/install.sh | bash
|
|
68
|
+
COGMEM="cogmem"
|
|
69
|
+
"$COGMEM" connect openclaw --workspace . --auto --force --json
|
|
55
70
|
```
|
|
56
71
|
|
|
57
|
-
|
|
72
|
+
Do not run `cogmem init` as an unattended agent action. `cogmem init` is an interactive configuration wizard. Use it only when an operator is present or explicitly asks for a guided setup:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
"$COGMEM" init --agent openclaw --scope project
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
OpenClaw workspaces should normally use project-local kernel config and storage:
|
|
58
79
|
|
|
59
80
|
```text
|
|
60
81
|
.cogmem/config.toml
|
|
@@ -155,6 +176,21 @@ cogmem import-openclaw --workspace . --project openclaw --json
|
|
|
155
176
|
|
|
156
177
|
The importer is idempotent. Re-running it skips records already imported into the same memory database.
|
|
157
178
|
Real non-JSON imports print source-level and embedding+ingest progress to stderr. Use `--json --progress` to keep JSON on stdout while streaming progress to stderr, or `--no-progress` when a wrapper needs quiet stderr.
|
|
179
|
+
Cogmem 3.6.4 skips import batch sealing for empty episode boundaries and Dream skips legacy empty episode jobs instead of blocking the whole queue. If `episode status` shows `dreamError` beginning with `episode_empty`, inspect the source events and use episode repair instead of editing SQLite rows.
|
|
180
|
+
|
|
181
|
+
After import, run the maintenance loop in this order. `needs_confirmation` is a human review queue, not the Dream backlog, and `memory govern` promotes only ordinary `candidate` rows:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
cogmem memory status --project openclaw --json
|
|
185
|
+
cogmem episode status --project openclaw --json
|
|
186
|
+
cogmem dream status --project openclaw --json
|
|
187
|
+
cogmem dream tick --project openclaw --mode auto --max-episodes 20 --json
|
|
188
|
+
cogmem memory candidates --project openclaw --status candidate --json
|
|
189
|
+
cogmem memory govern --project openclaw --limit 100 --json
|
|
190
|
+
cogmem memory candidates --project openclaw --status needs_confirmation --json
|
|
191
|
+
cogmem memory review --project openclaw --id <candidate-id> --action approve --actor <operator> --reason "confirmed by user" --confirmation-event <distinct-user-event-id> --json
|
|
192
|
+
cogmem memory recall --query "<verification question>" --project openclaw --agent openclaw --json
|
|
193
|
+
```
|
|
158
194
|
|
|
159
195
|
Imported sources:
|
|
160
196
|
|
|
@@ -359,7 +395,7 @@ Run curation manually or from a host-owned schedule:
|
|
|
359
395
|
|
|
360
396
|
```bash
|
|
361
397
|
cogmem episode status --project openclaw --json
|
|
362
|
-
cogmem dream tick --project openclaw --mode auto --json
|
|
398
|
+
cogmem dream tick --project openclaw --mode auto --max-episodes 20 --json
|
|
363
399
|
cogmem memory govern --project openclaw --json
|
|
364
400
|
cogmem memory candidates --project openclaw --status candidate --json
|
|
365
401
|
```
|
|
@@ -395,7 +431,7 @@ Explicit user clarification may create an organizational `correction` record. Do
|
|
|
395
431
|
|
|
396
432
|
OpenClaw session exports may place the body below an empty `user:` or `assistant:` header and may repeat an assistant block exactly. Import accepts that layout, collapses only adjacent exact export duplicates, and uses the `# Session: ... UTC` heading as the chronological timestamp base. Do not rewrite the file solely to make it importable.
|
|
397
433
|
|
|
398
|
-
If rejected provider diagnostics mention invalid memory-model output but later curation works, seal or repair the affected episode, run `cogmem dream tick --project openclaw --mode auto --json`, then run `cogmem memory govern --project openclaw --json`; recovered provider runs mark older provider diagnostics as `superseded`.
|
|
434
|
+
If rejected provider diagnostics mention invalid memory-model output but later curation works, seal or repair the affected episode, run `cogmem dream tick --project openclaw --mode auto --max-episodes 20 --json`, then run `cogmem memory govern --project openclaw --json`; recovered provider runs mark older provider diagnostics as `superseded`.
|
|
399
435
|
|
|
400
436
|
After package updates or config drift, repair the host wiring:
|
|
401
437
|
|
|
@@ -441,9 +477,11 @@ openclaw gateway restart
|
|
|
441
477
|
If the OpenClaw environment exposes an MCP client, use the core MCP bridge instead of writing a native plugin first:
|
|
442
478
|
|
|
443
479
|
```bash
|
|
444
|
-
cogmem
|
|
480
|
+
cogmem mcp
|
|
445
481
|
```
|
|
446
482
|
|
|
483
|
+
`cogmem-mcp` remains a compatibility bin for older host configs.
|
|
484
|
+
|
|
447
485
|
Expose these tools to the agent:
|
|
448
486
|
|
|
449
487
|
- `cogmem_remember_turn`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Cogmem 3.6.
|
|
1
|
+
# Cogmem 3.6.4 Operations Reference for OpenClaw
|
|
2
2
|
|
|
3
3
|
Read this file when installing, upgrading, importing, repairing, or operating Cogmem. `SKILL.md` contains the decision rules; this file is the command reference.
|
|
4
4
|
|
|
@@ -26,19 +26,32 @@ Read this file when installing, upgrading, importing, repairing, or operating Co
|
|
|
26
26
|
|
|
27
27
|
## Install and connect
|
|
28
28
|
|
|
29
|
+
Recommended workspace-local npm install:
|
|
30
|
+
|
|
29
31
|
```bash
|
|
30
|
-
|
|
31
|
-
cogmem
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
npm install cogmem@latest --save
|
|
33
|
+
COGMEM="./node_modules/.bin/cogmem"
|
|
34
|
+
"$COGMEM" doctor
|
|
35
|
+
"$COGMEM" connect openclaw --workspace . --auto --force --json
|
|
34
36
|
```
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
Use this resolver in agent-run scripts:
|
|
37
39
|
|
|
38
40
|
```bash
|
|
39
|
-
|
|
40
|
-
cogmem
|
|
41
|
-
|
|
41
|
+
if [ -x ./node_modules/.bin/cogmem ]; then
|
|
42
|
+
COGMEM="./node_modules/.bin/cogmem"
|
|
43
|
+
elif command -v cogmem >/dev/null 2>&1; then
|
|
44
|
+
COGMEM="cogmem"
|
|
45
|
+
else
|
|
46
|
+
npm install cogmem@latest --save
|
|
47
|
+
COGMEM="./node_modules/.bin/cogmem"
|
|
48
|
+
fi
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Use `npm install -g cogmem@latest` only when the operator wants a global CLI. The one-line installer is still supported with `COGMEM_SKIP_INIT=1`, but do not run `cogmem init` unattended. `cogmem init` is an interactive wizard; run it only with an operator present:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
"$COGMEM" init --agent openclaw --scope project
|
|
42
55
|
```
|
|
43
56
|
|
|
44
57
|
Restart the OpenClaw Gateway after plugin or config changes. `connect --auto` installs the direct OpenClaw hook bridge; OpenClaw does not need MCP for automatic recall, recording, or Atlas navigation.
|
|
@@ -70,7 +83,7 @@ openclaw gateway restart
|
|
|
70
83
|
cogmem openclaw diagnose --workspace . --json
|
|
71
84
|
```
|
|
72
85
|
|
|
73
|
-
The second command upgrades 3.5.2 schema 24, an existing 3.6.0 schema-26 database, or a pre-release schema-25 test database to the 3.6.
|
|
86
|
+
The second command upgrades 3.5.2 schema 24, an existing 3.6.0 schema-26 database, or a pre-release schema-25 test database to the 3.6.4 schema-27 state in one run. It preserves Raw Ledger evidence. Keep the returned `backupPath` until verification passes. `--dry-run` is read-only and does not create `_schema_migrations`.
|
|
74
87
|
|
|
75
88
|
After upgrading the package/database, refresh OpenClaw's generated plugin files. `doctor --plugin-only` avoids opening the Cogmem kernel, so it can repair stale `extensions/cogmem-auto-memory/index.js` and `bridge.mjs` even when an old drainer has SQLite busy. Use `connect --auto --force` when intentionally reinstalling the full integration and patching OpenClaw config:
|
|
76
89
|
|
|
@@ -121,6 +134,22 @@ cogmem import-openclaw --workspace . --project openclaw --dry-run --json
|
|
|
121
134
|
cogmem import-openclaw --workspace . --project openclaw --json
|
|
122
135
|
```
|
|
123
136
|
|
|
137
|
+
After import, verify semantic maintenance in this exact order:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
cogmem memory status --project openclaw --json
|
|
141
|
+
cogmem episode status --project openclaw --json
|
|
142
|
+
cogmem dream status --project openclaw --json
|
|
143
|
+
cogmem dream tick --project openclaw --mode auto --max-episodes 20 --json
|
|
144
|
+
cogmem memory candidates --project openclaw --status candidate --json
|
|
145
|
+
cogmem memory govern --project openclaw --limit 100 --json
|
|
146
|
+
cogmem memory candidates --project openclaw --status needs_confirmation --json
|
|
147
|
+
cogmem memory review --project openclaw --id <candidate-id> --action approve --actor <operator> --reason "confirmed by user" --confirmation-event <distinct-user-event-id> --json
|
|
148
|
+
cogmem memory recall --query "<verification question>" --project openclaw --agent openclaw --json
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`needs_confirmation` is not a Dream backlog. `memory govern` does not approve it. Use `memory review` with explicit evidence. Cogmem 3.6.4 skips import batch sealing for empty episode boundaries and marks legacy empty Dream jobs as skipped so one bad imported episode cannot block the queue. If `episode status` reports `episode_empty_*`, inspect the episode and repair boundaries with the audited episode repair commands.
|
|
152
|
+
|
|
124
153
|
Pass explicit sources when discovery is not enough:
|
|
125
154
|
|
|
126
155
|
```bash
|
|
@@ -266,6 +295,7 @@ cogmem prospective confirm --project openclaw --id <candidate-id> --evidence <us
|
|
|
266
295
|
## MCP and direct-plugin choice
|
|
267
296
|
|
|
268
297
|
- OpenClaw automatic hooks use the direct bridge installed by `connect --auto`.
|
|
298
|
+
- Start the MCP bridge with `cogmem mcp`; `cogmem-mcp` remains a compatibility bin for older host configs.
|
|
269
299
|
- Use MCP tools when an agent host supports MCP and needs explicit graph/review operations.
|
|
270
300
|
- Broad inventory/history: `cogmem_graph_explore`.
|
|
271
301
|
- Known node: `cogmem_graph_search`, then `cogmem_graph_node`.
|