cogmem 3.6.4 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/MEMORY_ATLAS.md +47 -10
  3. package/README.md +36 -13
  4. package/RELEASE_CHECKLIST.md +7 -4
  5. package/dist/agent/AgentMemoryBackend.d.ts +19 -2
  6. package/dist/agent/AgentMemoryBackend.js +134 -3
  7. package/dist/agent/AgentRecallQueryCompiler.d.ts +1 -1
  8. package/dist/agent/AgentRecallQueryCompiler.js +12 -0
  9. package/dist/atlas/EpisodeTitleGenerator.d.ts +31 -0
  10. package/dist/atlas/EpisodeTitleGenerator.js +152 -0
  11. package/dist/atlas/FacetQueryPlanner.d.ts +31 -0
  12. package/dist/atlas/FacetQueryPlanner.js +188 -0
  13. package/dist/atlas/GraphCurator.d.ts +27 -0
  14. package/dist/atlas/GraphCurator.js +397 -0
  15. package/dist/atlas/MemoryAtlasIndexer.d.ts +3 -0
  16. package/dist/atlas/MemoryAtlasIndexer.js +19 -6
  17. package/dist/atlas/MemoryAtlasService.d.ts +5 -1
  18. package/dist/atlas/MemoryAtlasService.js +165 -12
  19. package/dist/atlas/MemoryAtlasTypes.d.ts +89 -11
  20. package/dist/bin/connect.js +85 -13
  21. package/dist/bin/memory.js +221 -18
  22. package/dist/factory.d.ts +2 -0
  23. package/dist/factory.js +36 -18
  24. package/dist/host/openclaw/AutoMemoryPluginInstaller.js +83 -10
  25. package/dist/mcp/server.js +1 -1
  26. package/dist/store/EventStore.d.ts +6 -0
  27. package/dist/store/EventStore.js +28 -2
  28. package/dist/store/MemoryAtlasStore.d.ts +10 -1
  29. package/dist/store/MemoryAtlasStore.js +228 -14
  30. package/dist/types/index.d.ts +3 -0
  31. package/examples/hermes-backend/AGENTS.md +11 -5
  32. package/examples/hermes-backend/README.md +5 -3
  33. package/examples/hermes-backend/SKILL.md +28 -5
  34. package/examples/hermes-backend/references/operations.md +16 -6
  35. package/examples/openclaw-backend/AGENTS.md +9 -3
  36. package/examples/openclaw-backend/README.md +9 -3
  37. package/examples/openclaw-backend/SKILL.md +23 -10
  38. package/examples/openclaw-backend/references/operations.md +21 -8
  39. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.7.0
4
+
5
+ - Upgraded Memory Atlas into a multi-dimensional navigation graph: canonical episodes and raw events exist once, while time, topic, issue, entity, session/thread, memory-kind, and action-kind facets connect to them with typed edges.
6
+ - Added deterministic episode title and one-line summary generation for Atlas cards, preserving the original long summary in metadata and marking low-confidence titles for review.
7
+ - Added facet query planning for day/month/year, topic, issue, and entity cues, including strict facet intersection, canonicalId dedupe, matched facet/path explanations, and explicit relaxation traces.
8
+ - Added agent-facing Atlas `cards[]` on graph search/explore with `displayTitle`, `oneLineSummary`, `canonicalId`, `matchedFacets`, `matchedPaths`, `relatedButNotSelected`, and source drill-down locators.
9
+ - Extended Atlas cards to timeline results and CLI recall JSON, shared relaxation behavior across graph search/explore/timeline, and made broad “记忆黑盒” recall select the initial Memory Context/sourceContext discussion while listing later graph/runtime and Atlas readability issues as related side context.
10
+ - Renamed the live Atlas projection to `memory_atlas.v2` with 3.7 schema metadata while still consuming legacy `memory_atlas.v1` dirty triggers, so upgraded 3.6.5 databases rebuild the multi-facet projection instead of trusting stale clean state.
11
+ - Integrated facet graph cards into `historical_discussion` recall so OpenClaw/Hermes agents can explain selected memories while still grounding answers in Raw Ledger source locators.
12
+ - Updated OpenClaw plugin 0.7.0 and its generated bridge to preserve strict facet matches through Context Cortex planning and to include selected cards, matched facets/paths, related-but-not-selected side context, and relaxation traces in both volatile recall and Atlas context blocks.
13
+ - Updated README, Memory Atlas docs, OpenClaw/Hermes skills, AGENTS runbooks, and operations references with npm-first install/update flow and the 3.7.0 multi-facet Atlas command playbook.
14
+
15
+ ## 3.6.5
16
+
17
+ - Added `cogmem memory plan` as a read-only agent operations summary with queue state, blocking/non-blocking next actions, Dream backlog hints, and vector fallback state.
18
+ - Made default `cogmem memory candidates --json` return grouped ordinary, `needs_confirmation`, and deferred queues with actionable `nextActions`, while explicit `--status` still lists one queue.
19
+ - Fixed `cogmem memory list --since/--until/--order` so raw-ledger inspection can resume from global sequence cursors instead of silently ignoring the filters.
20
+ - Added `sourceLocator` drill-down commands to raw ledger list rows and Atlas search/explore evidence so agents can move from summaries to exact `memory show` context before quoting or claiming absence.
21
+ - Added a `historical_discussion` recall intent for “did we discuss this before?” questions, with raw-ledger-first routing and expanded cues for Cogmem/OpenClaw memory-black-box discussions.
22
+ - Changed Memory Binding backfill to scan raw events by cursor across the historical ledger rather than only the latest page, so old imported high-value user events can be bound after upgrade.
23
+ - Changed `cogmem connect ... --json` to expose structured `nextSteps` and keep unsafe operator/host actions such as interactive init and host restart out of agent-safe `nextCommands`.
24
+ - Fixed `cogmem memory plan` so Raw Ledger dream coverage lag is reported as non-blocking `raw_dream_ledger_lag` with `resolvableByDreamTick:false` instead of misleading agents into looping `dream tick` when no sealed episode backlog exists.
25
+ - Updated the auto-installed OpenClaw/Hermes skills and operations handbooks with the full npm install, update, migration, import, `memory plan`, historical recall, source drill-down, governance, and maintenance command playbook.
26
+
3
27
  ## 3.6.4
4
28
 
5
29
  - 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`.
package/MEMORY_ATLAS.md CHANGED
@@ -1,4 +1,4 @@
1
- # Memory Atlas v1
1
+ # Memory Atlas v2
2
2
 
3
3
  Memory Atlas lets an agent inspect what Cogmem remembers before it chooses a precise recall or Raw Ledger drilldown. It is a rebuildable navigation projection, not a new source of truth.
4
4
 
@@ -6,19 +6,30 @@ Memory Atlas lets an agent inspect what Cogmem remembers before it chooses a pre
6
6
 
7
7
  Atlas projects existing project-scoped records into these node kinds:
8
8
 
9
- - `project`, `topic`, `entity`, `cluster`, `episode`, `belief`, `action`, and `time`.
10
- - Raw `event` nodes appear only for explicit evidence navigation.
9
+ - Canonical content nodes: `episode`, `raw_event`, `cluster`, `belief`, `action`, `decision`, and `correction`.
10
+ - Facet nodes: `time`, `topic`, `issue`, `entity`, `session`, `thread`, `memoryKind`, and `actionKind`.
11
11
  - Action frames are extracted deterministically from raw user evidence and link actor, target, action kind, time, topic, project, and evidence.
12
12
 
13
- Existing memory edges remain canonical. Atlas adds derived navigation edges such as `TARGETS`, `OCCURRED_IN`, and evidence drilldowns without changing the underlying belief or binding graph.
13
+ Existing memory edges remain canonical. Atlas adds derived navigation edges such as `OCCURRED_ON`, `OCCURRED_IN`, `ABOUT_TOPIC`, `PART_OF_ISSUE`, `INVOLVES_ENTITY`, `IN_SESSION`, `IN_THREAD`, and `HAS_EVIDENCE` without changing the underlying belief or binding graph. The 3.7.0 offline curator automatically proposes only bounded `SAME_ISSUE`, `FOLLOWS_UP`, and weak `RELATED_TO` episode relations; stronger relations such as `REFINES`, `CORRECTS`, `CONTRADICTS`, and `SUPERSEDES` remain reserved for explicit evidence-bearing governance/binding flows.
14
+
15
+ This is not a copied tree. One episode exists once as `episode:<id>`. A day, topic, issue, entity, session, memory kind, or action kind is only a facet entrance:
16
+
17
+ ```text
18
+ time:2026-06-06 ───────┐
19
+ topic:.../memory-blackbox ─┼──> episode:<id>
20
+ issue:memory-context-blackbox ─┘
21
+ episode:<id> ──HAS_EVIDENCE──> raw_event:<eventId>
22
+ ```
23
+
24
+ Search and explore output dedupe by `canonicalId`. When a canonical episode is reached through several facet paths, the result appears once with all `matchedFacets` and `matchedPaths`.
14
25
 
15
26
  ## Agent workflow
16
27
 
17
28
  1. Use `graph_overview` when the user asks what is remembered.
18
- 2. Use `graph_explore` for broad history, project-state, or relationship questions.
19
- 3. Use `graph_search` when a topic/entity/cluster is already known.
29
+ 2. Use `graph_explore` for broad history, project-state, relationship, or multi-facet questions.
30
+ 3. Use `graph_search` when a topic/entity/cluster is already known and no expansion is needed.
20
31
  4. Use `graph_node`, `graph_neighbors`, `graph_path`, or `graph_timeline` to narrow the graph. Timeline applies the available facets to any timestamped Atlas nodes; action frames are an optional richer result, not a requirement.
21
- 5. Use returned `eventId` values and `cogmem memory show` before quoting exact source text.
32
+ 5. Use returned `sourceLocator.command` or event IDs with `cogmem memory show` before quoting exact source text.
22
33
  6. Use normal `cogmem_recall` for a direct factual memory question.
23
34
 
24
35
  Atlas summaries are `hint_only_not_evidence` in effect. Project scope, raw evidence ownership, and governance still decide what may be claimed as durable memory.
@@ -27,16 +38,41 @@ Atlas summaries are `hint_only_not_evidence` in effect. Project scope, raw evide
27
38
 
28
39
  Activation controls default visibility, not existence. Maintenance decays Atlas activation deterministically; an explicit `cogmem_graph_touch` raises nodes that the agent actually used. Read-only overview/search/explore calls do not change ranking. A query can still surface a cold node when its available facets match.
29
40
 
30
- Facets include project, time, topic, person/object, event, decision, correction, goal, preference, plan, action, and ordinary keywords. The engine combines the facets actually present in the message, similar to filtering multiple columns in a table. It does not require the fixed combination entity + time + action.
41
+ Facets include project, day/month/year, topic, issue, entity/person/project, session/thread, memory kind, action kind, and ordinary keywords. The engine combines the facets actually present in the message, similar to filtering multiple columns in a table. It does not require the fixed combination entity + time + action.
31
42
 
32
43
  For example, all of these can revive cold memory:
33
44
 
45
+ - `6月6号聊过什么`
46
+ - `6月6号关于记忆黑盒聊过什么`
47
+ - `记忆黑盒后来有没有继续讨论`
48
+ - `memory graph 卡死的问题修了吗`
34
49
  - `2025 Hermes 的决策`
35
50
  - `在留更新里被纠正过的计划`
36
51
  - `去年 OpenClaw 失败的配置事件`
37
52
  - `餐车 POS 项目中关于库存的偏好`
38
53
 
39
- Exact constraints may bypass the visibility floor. They never bypass `projectId`, evidence validation, or traversal limits.
54
+ Exact constraints may bypass the visibility floor. They never bypass `projectId`, evidence validation, or traversal limits. If strict intersection is empty, Atlas may relax day to parent month or issue to parent topic, but JSON must include `relaxationTrace`; it must not silently substitute a nearby memory.
55
+
56
+ `graph-search` and `graph-explore` include agent-facing `cards` when canonical episodes match:
57
+
58
+ ```json
59
+ {
60
+ "canonicalId": "episode:episode-xxx",
61
+ "displayTitle": "CogMem Memory Context 黑盒与原文下钻",
62
+ "oneLineSummary": "用户指出注入的 CogMem Memory Context 像黑盒,需要能从摘要下钻到原始对话。",
63
+ "matchedFacets": [
64
+ { "type": "time", "value": "2026-06-06" },
65
+ { "type": "topic", "value": "PROJECT/Cogmem/memory-blackbox" }
66
+ ],
67
+ "matchedPaths": [],
68
+ "relatedButNotSelected": [],
69
+ "sourceLocator": {
70
+ "command": "cogmem memory show --event evt-... --before 2 --after 2 --json"
71
+ }
72
+ }
73
+ ```
74
+
75
+ Agents should prefer `cards` over raw node labels for historical discussion because cards preserve the canonical episode, match reason, and drilldown command.
40
76
 
41
77
  ## Bounds
42
78
 
@@ -58,6 +94,7 @@ BrainEval release fixtures fail closed on Atlas project isolation, node/hop boun
58
94
  cogmem memory graph --project <id> --json
59
95
  cogmem memory graph-search --project <id> --query <query> --json
60
96
  cogmem memory graph-explore --project <id> --query <query> --json
97
+ cogmem memory graph-explore --project openclaw --query "6月6号关于记忆黑盒聊过什么" --json
61
98
  cogmem memory graph-node --project <id> --id <node-id> --json
62
99
  cogmem memory graph-neighbors --project <id> --id <node-id> --hops 1 --json
63
100
  cogmem memory graph-path --project <id> --from <node-id> --to <node-id> --json
@@ -98,4 +135,4 @@ Upgrade an existing 3.5.2 database with:
98
135
  cogmem migrate --yes --backup --json
99
136
  ```
100
137
 
101
- Migration 0025 creates and backfills the disposable projection. Migration 0026 adds exact memory-kind metadata, projection health, and candidate-review audit state. Migration 0027 corrects 3.6.0-upgraded databases by marking Atlas projections dirty until the real action/time rebuild runs. A 3.5.2 schema-24 database, an existing 3.6.0 schema-26 database, or a pre-release schema-25 test database reaches the 3.6.1 schema-27 state with the same command. `cogmem memory tick` refreshes only dirty projects, records rebuild errors, prunes old access telemetry, and decays navigation activation without starting a daemon.
138
+ Migration 0025 creates and backfills the disposable projection. Migration 0026 adds exact memory-kind metadata, projection health, and candidate-review audit state. Migration 0027 corrects 3.6.0-upgraded databases by marking Atlas projections dirty until the real action/time rebuild runs. Cogmem 3.7.0 keeps the projection-first schema and adds facet nodes, canonical cards, issue hints, and episode relation edges during Atlas rebuild/maintenance. `cogmem memory tick` refreshes only dirty projects, records rebuild errors, prunes old access telemetry, and decays navigation activation without starting a daemon.
package/README.md CHANGED
@@ -11,7 +11,7 @@ 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.4`
14
+ Current version: `3.7.0`
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
 
@@ -89,7 +89,7 @@ Memory Binding
89
89
  CPU-canonicalized raw-event bindings to stable entity/topic paths, claim-key clusters, and activation-aware graph edges for source-anchored organization before fact promotion.
90
90
 
91
91
  Memory Atlas
92
- A bounded, project-scoped content map over topics, entities, clusters, episodes, beliefs, actions, time, and their source-anchored relations. Agents use it to inventory, filter, navigate, and then drill down to Raw Ledger evidence.
92
+ A bounded, project-scoped, multi-dimensional memory navigation graph. Canonical episodes and raw evidence exist once; time, topic, issue, entity, session, memory-kind, and action-kind facets connect to them with typed edges. Agents use it to intersect facets, dedupe by canonicalId, explain why a memory matched, and then drill down to Raw Ledger evidence.
93
93
 
94
94
  User-Shaped Topic Ontology
95
95
  A stable memory-class skeleton plus project-scoped topic names, aliases, parent paths, relations, and reversible audit operations learned from explicit user language.
@@ -229,7 +229,7 @@ cogmem migrate --dry-run --json
229
229
 
230
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.
231
231
 
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:
232
+ Upgrade a 3.5.2 database, a 3.6.x database, or a pre-release schema-25 test database into the current 3.7.0 schema and projection set with one command:
233
233
 
234
234
  ```bash
235
235
  cogmem migrate --yes --backup --json
@@ -270,15 +270,15 @@ cogmem memory candidates --project my-agent --status needs_confirmation --json
270
270
  cogmem memory review --project my-agent --id <candidate-id> --action approve --actor <operator> --reason "confirmed" --confirmation-event <user-event-id> --json
271
271
  ```
272
272
 
273
- For a host timer, call `dream tick`; the timer only wakes the scheduler. An empty backlog performs no Dream work:
273
+ For a host timer, call `dream tick`; the timer only wakes the sealed-episode scheduler. An empty episode backlog performs no Dream work, and `undreamedRawCount` by itself is not a reason to loop `dream tick`:
274
274
 
275
275
  ```bash
276
276
  cogmem dream tick --project my-agent --mode auto --max-episodes 10 --json
277
277
  ```
278
278
 
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.
279
+ Raw events are always written first. `KernelAgentMemoryBackend` and OpenClaw plugin 0.7.0 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.
280
280
 
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.
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 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.
282
282
 
283
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.
284
284
 
@@ -287,33 +287,42 @@ Episode surgery is available through `cogmem episode split|merge|move-event|recl
287
287
  Inspect queue state:
288
288
 
289
289
  ```bash
290
+ cogmem memory plan --project my-agent --json
290
291
  cogmem memory status --project my-agent --json
292
+ cogmem memory candidates --project my-agent --json
291
293
  cogmem memory candidates --project my-agent --status candidate --json
292
294
  cogmem memory govern --project my-agent --json
293
295
  cogmem memory candidates --project my-agent --status needs_confirmation --json
294
296
  cogmem memory review --project my-agent --id <candidate-id> --action approve --actor <operator> --reason "confirmed" --confirmation-event <user-event-id> --json
295
297
  ```
296
298
 
299
+ `memory plan` is the read-only agent operations summary. It returns queue counts, Dream backlog, vector fallback state, blocking actions, and safe next commands. Only run `dream_tick` when it appears in `nextActions`; `nonBlocking[].type === "raw_dream_ledger_lag"` reports Raw Ledger coverage lag with `resolvableByDreamTick: false`, so inspect sources or episode/import boundaries instead of retrying `dream tick`. Default `memory candidates --json` groups ordinary, `needs_confirmation`, and deferred work in one payload; pass `--status candidate` or `--status needs_confirmation` only when the user asks for one queue.
300
+
297
301
  `memory govern` intentionally promotes only `candidate`. With `--status needs_confirmation` it lists the review queue and prints the `memory review` command instead of silently promoting the wrong status. Review actions are approve, reject, defer, supersede, and correction relink; every action stores operator identity, reason, and evidence requirements in an immutable audit row. `defer` keeps the candidate in `needs_confirmation` and records `reviewAfter` plus a status reason.
298
302
 
299
303
  ## Memory Atlas: let an agent see what it remembers
300
304
 
301
305
  `cogmem memory map` remains the system anatomy map. Memory Atlas is the content map. It does not replace recall or create a second fact store; it projects existing topics, entities, clusters, episodes, beliefs, action frames, time buckets, bindings, and evidence into a bounded navigation surface.
302
306
 
307
+ In 3.7.0, Atlas is a multi-dimensional navigation graph rather than a folder tree. A remembered episode has one canonical node such as `episode:<id>`. Time, topic, issue, entity, session/thread, memory-kind, and action-kind nodes are facet entrances connected to that canonical episode with typed edges. Results dedupe by `canonicalId` and explain `matchedFacets` plus `matchedPaths`.
308
+
303
309
  ```bash
304
310
  cogmem memory graph --project my-agent --json
305
311
  cogmem memory graph-search --project my-agent --query "Hermes" --json
306
312
  cogmem memory graph-explore --project my-agent --query "去年我让你对 Hermes 做过什么" --json
313
+ cogmem memory graph-explore --project openclaw --query "6月6号关于记忆黑盒聊过什么" --json
307
314
  cogmem memory graph-node --project my-agent --id "entity:<id>" --json
308
315
  cogmem memory graph-neighbors --project my-agent --id "entity:<id>" --hops 2 --json
309
316
  cogmem memory graph-path --project my-agent --from "entity:<id>" --to "action:<id>" --json
310
317
  cogmem memory graph-timeline --project my-agent --query "2025 Hermes 的决策和修复" --json
311
318
  ```
312
319
 
313
- Atlas filtering is not limited to entity + time + action. The query compiler combines whichever facets are actually present, such as project, time range, topic, person/object, event, decision, correction, goal, preference, plan, action, and ordinary keywords. Exact multi-facet matches may surface cold nodes even when their activation has decayed. Project scope and raw evidence validation are never bypassed.
320
+ Atlas filtering is not limited to entity + time + action. The facet planner combines whichever facets are actually present, such as project, day/month/year, topic, issue, entity/person/project, session/thread, memory kind, action kind, and ordinary keywords. Strict multi-facet matches may surface cold nodes even when their activation has decayed. If strict intersection is empty, JSON includes `relaxationTrace` instead of silently pretending an exact match existed. Project scope and raw evidence validation are never bypassed.
314
321
 
315
322
  Defaults are 8 nodes, one hop, and two evidence IDs per node. Hard limits are 30 nodes, two hops, ten evidence IDs, six path hops, and 2,000 visited nodes. Raw excerpts are omitted unless `--include-evidence` or `includeEvidence: true` is explicit. `evidenceTotal` reports all known evidence while `evidenceReturned` reports the bounded payload. Every returned evidence item carries an `eventId` and a `cogmem memory show` drilldown command.
316
323
 
324
+ Atlas search and explore return agent-facing `cards` for canonical episodes. Each card includes `canonicalId`, `displayTitle`, `oneLineSummary`, `matchedFacets`, `matchedPaths`, `relatedButNotSelected`, and `sourceLocator.command` / `sourceLocator.contextCommand` when evidence is available. Agents should run that locator before quoting exact wording, before claiming a historical topic is absent, or when a graph summary looks relevant but underspecified.
325
+
317
326
  Atlas reads do not brighten everything they display. MCP graph queries are read-only/idempotent; call `cogmem_graph_touch` only after the agent actually uses selected nodes. Maintenance decays activation, refreshes dirty projections only, and prunes old access telemetry.
318
327
 
319
328
  Agents should use Atlas for broad inventory, history, and relationship questions; use normal recall for a direct fact. See [MEMORY_ATLAS.md](./MEMORY_ATLAS.md) for the complete CLI, MCP, OpenClaw, activation, and provenance contract.
@@ -351,7 +360,7 @@ Operational cost classes:
351
360
 
352
361
  Never overlap maintenance writers against one database. Wait for each command to exit, use returned `durationMs`, backlog, and failure details to set the next interval, and keep routine status/candidate inspection on the read-only path. A `vectors` count of zero is not by itself a failure: `memory status --json` includes `vectorState.recallAvailableWithoutVectors` and the active fallback status.
353
362
 
354
- `memory bind` backfills Memory Binding for raw user events written outside the agent turn path, including imported OpenClaw/Hermes history and adapter-written raw events. Use `--since <globalSeq>` to resume from a known ledger sequence.
363
+ `memory bind` backfills Memory Binding for raw user events written outside the agent turn path, including imported OpenClaw/Hermes history and adapter-written raw events. It scans by Raw Ledger cursor rather than only the latest page. Use `--since <globalSeq>` to resume from a known ledger sequence.
355
364
 
356
365
  `memory map` includes Memory Binding and Graph Recall counters. Bindings attach valuable user raw events to stable topic/entity paths before any fact promotion, fuse same-claim evidence into claim-key clusters, and create graph anchors for source drill-down. Correction events create explicit correction edges and review flags instead of poisoning the active cluster. Treat bindings, clusters, and graph edges as organization hints, not as verified long-term facts.
357
366
 
@@ -372,7 +381,9 @@ cogmem strategy plan --project hermes --query "我当时的原话是什么?" -
372
381
  cogmem strategy outcomes --project hermes --json
373
382
  ```
374
383
 
375
- OpenClaw plugin 0.6.3 skips Cogmem entirely for greetings, uses only session state/turn bridge for short continuations, and applies Strategy Cortex before full recall. Navigation turns use one bridge/kernel lifecycle for Atlas exploration, evidence-bearing node/timeline drill-down, and recall. The bounded volatile `<COGMEM_MEMORY_ATLAS>` block includes evidence event IDs and drill-down commands; OpenClaw does not need MCP for this path.
384
+ OpenClaw plugin 0.7.0 skips Cogmem entirely for greetings, uses only session state/turn bridge for short continuations, and applies Strategy Cortex before full recall. Navigation turns use one bridge/kernel lifecycle for Atlas exploration, evidence-bearing node/timeline drill-down, and recall. The bounded volatile `<COGMEM_MEMORY_ATLAS>` block includes selected memory cards, matched facets, matched paths, related-but-not-selected cards, evidence event IDs, and drill-down commands; OpenClaw does not need MCP for this path.
385
+
386
+ `cogmem connect openclaw --auto --force --json` and `cogmem connect hermes --auto --force --json` now return structured `nextSteps`. Only `nextSteps` with `actor: "agent"` and `safeForAutomation: true` are mirrored into `nextCommands`. Interactive setup, gateway restart, and Hermes reload remain visible as operator/host steps but are intentionally absent from `nextCommands`.
376
387
 
377
388
  `ProspectiveMemoryService` stores future intentions, commitments, reminders, open loops, and plans as candidates only. A candidate is not actionable until an explicit user event confirms it. Rejected candidates stay suppressed unless genuinely new evidence creates a new version. The service and `cogmem prospective` CLI manage state only; they expose no task or tool execution capability.
378
389
 
@@ -459,9 +470,9 @@ From the OpenClaw workspace:
459
470
 
460
471
  ```bash
461
472
  cd ~/.openclaw/workspace
462
- cogmem init --agent openclaw --scope project
473
+ npm install cogmem@latest --save
474
+ ./node_modules/.bin/cogmem connect openclaw --workspace . --auto --force
463
475
  cogmem doctor
464
- cogmem connect openclaw --workspace . --auto --force
465
476
  ```
466
477
 
467
478
  Import existing OpenClaw memory:
@@ -500,7 +511,9 @@ By default, `selective_compile` uses user text as the durable compile signal, ex
500
511
  After updates or config drift:
501
512
 
502
513
  ```bash
503
- cogmem doctor --fix --agent openclaw --workspace .
514
+ cogmem update --yes
515
+ cogmem doctor --fix --agent openclaw --workspace . --plugin-only
516
+ openclaw gateway restart
504
517
  ```
505
518
 
506
519
  ## Hermes
@@ -622,6 +635,7 @@ Useful intents:
622
635
  ```bash
623
636
  cogmem memory recall --query "上个会话我们聊了什么" --intent previous_session_summary --project openclaw --agent openclaw --json
624
637
  cogmem memory recall --query "我当时关于记忆黑盒的原话是什么" --intent forensic_quote --project openclaw --agent openclaw --json
638
+ cogmem memory recall --query "几个月前我们是不是讨论过 Cogmem 的记忆黑盒" --intent historical_discussion --project openclaw --agent openclaw --json
625
639
  ```
626
640
 
627
641
  Recall results include:
@@ -647,6 +661,15 @@ cogmem memory show --event <eventId> --before 2 --after 2 --json
647
661
 
648
662
  Raw-ledger fallback is not limited to the latest fixed event window. When Chinese FTS cannot match a cue directly, Cogmem runs a project/workspace/thread/time-scoped ledger text fallback and prefers an original user event over an assistant retelling when both match equally. Imported OpenClaw Markdown also accepts empty `user:` / `assistant:` headers whose body follows on later lines and collapses only adjacent exact duplicate exports.
649
663
 
664
+ For ledger audits or resumable import/binding checks, use global sequence cursors:
665
+
666
+ ```bash
667
+ cogmem memory list --project openclaw --since <global-seq> --order asc --json
668
+ cogmem memory list --project openclaw --since <global-seq> --until <global-seq> --order asc --json
669
+ ```
670
+
671
+ Each listed event includes a `sourceLocator` with a `memory show` command. Use it before saying an event ID or exact source is unavailable.
672
+
650
673
  ## TypeScript API
651
674
 
652
675
  ```ts
@@ -770,7 +793,7 @@ npm pack --dry-run --json
770
793
  npm publish --dry-run --access public
771
794
  ```
772
795
 
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`.
796
+ Create a GitHub Release from the matching version tag, for example `v3.7.0`. 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`.
774
797
 
775
798
  Publish manually only for emergency fallback:
776
799
 
@@ -1,11 +1,11 @@
1
- # cogmem 3.6.4 Release Checklist
1
+ # cogmem 3.7.0 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.4`.
8
+ - `package.json` version is `3.7.0`.
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.
@@ -60,7 +60,10 @@ MCP `tools/list` includes strategy, episode append/import/status/seal/repair, to
60
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.
61
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
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`.
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 explain the 3.7.0 agent operations protocol: `memory plan` for next actions, default grouped `memory candidates --json`, `memory list --since/--until/--order`, historical-discussion recall intent, Atlas canonical cards, `matchedFacets`, `relatedButNotSelected`, `relaxationTrace`, Atlas evidence `sourceLocator`, and cursor-based `memory bind`.
65
+ - README, `MEMORY_ATLAS.md`, and installed skills explain the multi-dimensional Atlas model: a canonical episode/raw event exists once, facet nodes connect through typed edges, query results intersect facets, and display/injection dedupes by `canonicalId`.
66
+ - `connect openclaw|hermes --json` documents structured `nextSteps`; `nextCommands` must contain only agent-safe, non-interactive commands and must not include `cogmem init`, `cogmem-init`, gateway restart, or Hermes reload.
64
67
  - README and skills document `cogmem mcp` as the preferred MCP server command for new configs while preserving `cogmem-mcp` as a compatibility bin.
65
68
  - 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.
66
69
  - README and skills explain user-shaped topic operations, user-explicit versus model-candidate authority, alias collision review, operation rollback, and project isolation.
@@ -91,7 +94,7 @@ npm publish --dry-run --access public
91
94
 
92
95
  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.
93
96
 
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.
97
+ After verification, create a GitHub Release from the matching version tag, for example `v3.7.0`. The release workflow publishes through npm Trusted Publishing when the release is published. It must not publish on tag push alone.
95
98
 
96
99
  Emergency manual fallback:
97
100
 
@@ -1,4 +1,5 @@
1
1
  import type { MemoryKernel, MemoryKernelNavigationResult } from '../factory.js';
2
+ import type { MemoryAtlasCard, MemoryAtlasRelatedCard, MemoryAtlasRelaxationStep } from '../atlas/MemoryAtlasTypes.js';
2
3
  import { type MemoryEventCharRange, type MemoryEventSourceRange, type SourceContextWindowMetadata } from '../recall/SourceContextMetadata.js';
3
4
  import type { BeliefRecord, MemoryEvent } from '../types/index.js';
4
5
  import type { StrategyRetrievalPolicy } from '../strategy/StrategyCapsule.js';
@@ -61,6 +62,7 @@ export interface AgentRecallSourceAnchor {
61
62
  }
62
63
  export interface AgentRecallSourceContextEvent {
63
64
  eventId: string;
65
+ globalSeq?: number;
64
66
  label: string;
65
67
  role?: MemoryEvent['role'];
66
68
  rawEventType?: MemoryEvent['rawEventType'];
@@ -89,7 +91,10 @@ export interface AgentRecallSourceContext {
89
91
  window: SourceContextWindowMetadata;
90
92
  locator: {
91
93
  eventId: string;
94
+ globalSeq?: number;
95
+ projectId?: string;
92
96
  command: string;
97
+ contextCommand?: string;
93
98
  threadId?: string;
94
99
  sessionId?: string;
95
100
  localDate?: string;
@@ -148,6 +153,10 @@ export interface AgentRecallItem {
148
153
  text: string;
149
154
  projectId?: string;
150
155
  topicPath?: string;
156
+ canonicalId?: string;
157
+ displayTitle?: string;
158
+ matchedFacets?: MemoryAtlasCard['matchedFacets'];
159
+ matchedPaths?: MemoryAtlasCard['matchedPaths'];
151
160
  tags: string[];
152
161
  source?: string;
153
162
  sourceType?: 'compiled_memory' | 'imported_summary' | 'raw_ledger' | 'raw_ledger_session';
@@ -166,13 +175,16 @@ export interface AgentRecallResult {
166
175
  runtime?: NonNullable<MemoryKernelNavigationResult['navigation']>['runtime'];
167
176
  fallbackUsed: boolean;
168
177
  queryPlan?: AgentRecallQueryPlan;
178
+ atlasCards?: MemoryAtlasCard[];
179
+ relatedButNotSelected?: MemoryAtlasRelatedCard[];
180
+ relaxationTrace?: MemoryAtlasRelaxationStep[];
169
181
  /** Present on all kernel-produced results. Optional for source compatibility with external result mocks. */
170
182
  decisionTrace?: AgentRecallDecisionTrace;
171
183
  }
172
184
  export interface AgentRecallDecisionTrace {
173
185
  version: 'agent_recall_decision.v1';
174
- selectedLane: 'graph' | 'compiled' | 'brain_fallback' | 'raw_ledger' | 'mixed' | 'none';
175
- reason: 'previous_session' | 'forensic_quote' | 'graph_selected' | 'raw_cue_match_preferred' | 'compiled_cue_match' | 'brain_fallback_selected' | 'raw_ledger_only' | 'no_recall_evidence';
186
+ selectedLane: 'facet_graph_raw_ledger' | 'graph' | 'compiled' | 'brain_fallback' | 'raw_ledger' | 'mixed' | 'none';
187
+ reason: 'previous_session' | 'forensic_quote' | 'historical_discussion' | 'graph_selected' | 'raw_cue_match_preferred' | 'compiled_cue_match' | 'brain_fallback_selected' | 'raw_ledger_only' | 'no_recall_evidence';
176
188
  candidateCounts: {
177
189
  graph: number;
178
190
  navigation: number;
@@ -242,6 +254,9 @@ export declare class KernelAgentMemoryBackend {
242
254
  recallPack(query: AgentRecallQuery): AgentRecallPackResult;
243
255
  private recallPreviousSession;
244
256
  private recallForensicQuote;
257
+ private recallHistoricalDiscussion;
258
+ private facetGraphItemsForQuery;
259
+ private toAgentRecallItemFromAtlasCard;
245
260
  private recallForensicAnchor;
246
261
  private searchRawEventsByQueryPlan;
247
262
  private rawLedgerFallbackItemsForQuery;
@@ -252,6 +267,8 @@ export declare class KernelAgentMemoryBackend {
252
267
  private recallCueTerms;
253
268
  private itemSearchableText;
254
269
  private mergeRecallItems;
270
+ private mergeHistoricalRecallItems;
271
+ private compiledItemsForHistoricalQuery;
255
272
  private dedupeRawEventsByTurnPreferUser;
256
273
  private expandRawSearchTexts;
257
274
  private findPreviousSessionId;
@@ -254,6 +254,9 @@ export class KernelAgentMemoryBackend {
254
254
  if (query.intent === 'forensic_quote') {
255
255
  return this.recallForensicQuote(query, queryPlan);
256
256
  }
257
+ if (queryPlan.intent === 'historical_discussion') {
258
+ return this.recallHistoricalDiscussion(query, queryPlan);
259
+ }
257
260
  const limit = query.limit ?? 5;
258
261
  const allowsGraph = laneAllowed(query.retrievalPolicy, 'graph');
259
262
  const allowsCompiled = laneAllowed(query.retrievalPolicy, 'compiled');
@@ -490,6 +493,87 @@ export class KernelAgentMemoryBackend {
490
493
  }, items.length),
491
494
  };
492
495
  }
496
+ recallHistoricalDiscussion(query, queryPlan) {
497
+ const limit = query.limit ?? 5;
498
+ const allowsGraph = laneAllowed(query.retrievalPolicy, 'graph');
499
+ const allowsCompiled = laneAllowed(query.retrievalPolicy, 'compiled');
500
+ const allowsRawSource = laneAllowed(query.retrievalPolicy, 'raw_source');
501
+ const facetResult = allowsGraph ? this.facetGraphItemsForQuery(query, limit) : { items: [], cards: [], relatedButNotSelected: [], relaxationTrace: [] };
502
+ const facetItems = allowsRawSource ? facetResult.items : [];
503
+ const graphItems = allowsGraph ? this.memoryBindingGraphItemsForQuery(query, queryPlan, limit) : [];
504
+ const rawItems = allowsRawSource ? this.rawLedgerFallbackItemsForQuery(queryPlan, query, Math.max(limit * 2, 10)) : [];
505
+ const compiledItems = allowsCompiled
506
+ ? this.compiledItemsForHistoricalQuery(queryPlan, query, limit)
507
+ : [];
508
+ const items = this.mergeHistoricalRecallItems(facetItems, rawItems, graphItems, compiledItems, limit);
509
+ const selectedLane = facetItems.length > 0
510
+ ? 'facet_graph_raw_ledger'
511
+ : rawItems.length > 0
512
+ ? 'raw_ledger'
513
+ : graphItems.length > 0
514
+ ? 'graph'
515
+ : compiledItems.length > 0
516
+ ? 'compiled'
517
+ : 'none';
518
+ return {
519
+ recallMode: facetItems.length > 0 || rawItems.length > 0 ? 'raw_ledger_fallback' : 'brain_recall_fallback',
520
+ items,
521
+ fallbackUsed: true,
522
+ queryPlan,
523
+ atlasCards: facetResult.cards,
524
+ relatedButNotSelected: facetResult.relatedButNotSelected,
525
+ relaxationTrace: facetResult.relaxationTrace,
526
+ decisionTrace: recallDecisionTrace(selectedLane, 'historical_discussion', {
527
+ graph: graphItems.length + facetItems.length,
528
+ navigation: compiledItems.length,
529
+ scopedNavigation: compiledItems.length,
530
+ brainFallback: 0,
531
+ rawLedger: rawItems.length + facetItems.length,
532
+ }, items.length),
533
+ };
534
+ }
535
+ facetGraphItemsForQuery(query, limit) {
536
+ try {
537
+ const atlas = this.kernel.graphExplore(query.query, {
538
+ projectId: query.projectId,
539
+ limit,
540
+ includeEvidence: true,
541
+ evidenceLimit: 2,
542
+ refresh: true,
543
+ staleOk: true,
544
+ });
545
+ const cards = (atlas.cards ?? []).slice(0, limit);
546
+ const items = cards.map((card) => this.toAgentRecallItemFromAtlasCard(card, query)).filter((item) => Boolean(item));
547
+ const relatedButNotSelected = cards.flatMap((card) => card.relatedButNotSelected ?? []).slice(0, 8);
548
+ return { items, cards, relatedButNotSelected, relaxationTrace: atlas.relaxationTrace ?? [] };
549
+ }
550
+ catch {
551
+ return { items: [], cards: [], relatedButNotSelected: [], relaxationTrace: [] };
552
+ }
553
+ }
554
+ toAgentRecallItemFromAtlasCard(card, query) {
555
+ const eventId = card.sourceLocator?.eventId ?? card.evidenceEventIds[0];
556
+ const sourceContext = eventId ? this.toAgentSourceContext(eventId) : undefined;
557
+ const anchorEvent = sourceContext?.event;
558
+ return {
559
+ id: `facet:${card.canonicalId}`,
560
+ text: [card.displayTitle, card.oneLineSummary].filter(Boolean).join(': '),
561
+ projectId: query.projectId,
562
+ topicPath: card.parentTopics[0],
563
+ canonicalId: card.canonicalId,
564
+ displayTitle: card.displayTitle,
565
+ matchedFacets: card.matchedFacets,
566
+ matchedPaths: card.matchedPaths,
567
+ tags: ['facet_graph', card.eventKind, card.issueType].filter((tag) => Boolean(tag)),
568
+ source: 'memory_atlas',
569
+ sourceType: 'raw_ledger',
570
+ sourceAnchor: anchorEvent ? this.toAgentSourceAnchorFromContextEvent(anchorEvent) : eventId ? { eventId } : undefined,
571
+ sourceContext,
572
+ confidence: Math.min(1, 0.7 + card.matchedFacets.length * 0.08),
573
+ whyMatched: card.whyMatched,
574
+ canAnswerExactQuote: Boolean(sourceContext),
575
+ };
576
+ }
493
577
  recallForensicAnchor(query, limit) {
494
578
  if (!query.anchorEventId)
495
579
  return [];
@@ -655,15 +739,55 @@ export class KernelAgentMemoryBackend {
655
739
  const out = [];
656
740
  const seen = new Set();
657
741
  for (const item of [...primary, ...secondary]) {
658
- if (seen.has(item.id))
742
+ const keys = [item.canonicalId, item.sourceAnchor?.eventId, item.id].filter((value) => Boolean(value));
743
+ if (keys.some((key) => seen.has(key)))
659
744
  continue;
660
- seen.add(item.id);
745
+ for (const key of keys)
746
+ seen.add(key);
661
747
  out.push(item);
662
748
  if (out.length >= limit)
663
749
  break;
664
750
  }
665
751
  return out;
666
752
  }
753
+ mergeHistoricalRecallItems(facetItems, rawItems, graphItems, compiledItems, limit) {
754
+ const merged = this.mergeRecallItems(facetItems, this.mergeRecallItems(rawItems, this.mergeRecallItems(graphItems, compiledItems, limit), limit), limit);
755
+ if (merged.some((item) => item.sourceType === 'imported_summary'))
756
+ return merged;
757
+ const importedSupport = compiledItems.find((item) => item.sourceType === 'imported_summary');
758
+ if (!importedSupport)
759
+ return merged;
760
+ const withoutDuplicate = merged.filter((item) => item.id !== importedSupport.id && item.sourceAnchor?.eventId !== importedSupport.sourceAnchor?.eventId);
761
+ if (withoutDuplicate.length < limit)
762
+ return [...withoutDuplicate, importedSupport];
763
+ return [...withoutDuplicate.slice(0, Math.max(0, limit - 1)), importedSupport];
764
+ }
765
+ compiledItemsForHistoricalQuery(queryPlan, query, limit) {
766
+ const retrievalLimit = Math.max(limit * 4, 24);
767
+ const out = [];
768
+ const seen = new Set();
769
+ for (const searchText of uniqueNonEmpty([queryPlan.primarySearchText, ...queryPlan.searchTexts, queryPlan.originalQuery])) {
770
+ const rawEvidence = this.kernel.navigateMemory(searchText, {
771
+ projectId: query.projectId,
772
+ limit: retrievalLimit,
773
+ startTime: query.startTime,
774
+ endTime: query.endTime,
775
+ }).rawEvidence;
776
+ const items = this.filterAgentEvidence(rawEvidence, query.agentId, query.collection, query.excludeSessionId)
777
+ .map((neuron) => this.toAgentRecallItem(neuron));
778
+ for (const item of items) {
779
+ const key = item.id || item.sourceAnchor?.eventId;
780
+ if (key && seen.has(key))
781
+ continue;
782
+ if (key)
783
+ seen.add(key);
784
+ out.push(item);
785
+ if (out.length >= limit)
786
+ return out;
787
+ }
788
+ }
789
+ return out;
790
+ }
667
791
  dedupeRawEventsByTurnPreferUser(events) {
668
792
  const byTurn = new Map();
669
793
  for (const event of events) {
@@ -928,7 +1052,10 @@ export class KernelAgentMemoryBackend {
928
1052
  window: normalized.window,
929
1053
  locator: {
930
1054
  eventId: event.eventId,
931
- command: `cogmem memory show --event ${event.eventId} --before 2 --after 2`,
1055
+ globalSeq: event.globalSeq,
1056
+ projectId: event.projectId,
1057
+ command: `cogmem memory show --event ${cliArg(event.eventId)}${event.projectId ? ` --project ${cliArg(event.projectId)}` : ''} --before 2 --after 2 --json`,
1058
+ contextCommand: `cogmem memory show --event ${cliArg(event.eventId)}${event.projectId ? ` --project ${cliArg(event.projectId)}` : ''} --before 3 --after 3 --json`,
932
1059
  threadId: event.threadId,
933
1060
  sessionId: event.sessionId,
934
1061
  localDate: event.localDate,
@@ -939,6 +1066,7 @@ export class KernelAgentMemoryBackend {
939
1066
  const text = this.eventText(event);
940
1067
  return {
941
1068
  eventId: event.eventId,
1069
+ globalSeq: event.globalSeq,
942
1070
  label: memoryEventLabel(event),
943
1071
  role: event.role,
944
1072
  rawEventType: event.rawEventType,
@@ -1270,3 +1398,6 @@ function uniqueNonEmpty(values) {
1270
1398
  function laneAllowed(policy, lane) {
1271
1399
  return !policy || policy.allowedLanes.includes(lane);
1272
1400
  }
1401
+ function cliArg(value) {
1402
+ return /^[A-Za-z0-9._:/=@+-]+$/u.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
1403
+ }
@@ -1,4 +1,4 @@
1
- export type AgentRecallIntent = 'memory_recall' | 'previous_session_summary' | 'forensic_quote';
1
+ export type AgentRecallIntent = 'memory_recall' | 'previous_session_summary' | 'forensic_quote' | 'historical_discussion';
2
2
  export interface AgentRecallQueryCompileInput {
3
3
  query: string;
4
4
  intent?: AgentRecallIntent;