cogmem 3.6.3 → 3.6.5

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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.6.5
4
+
5
+ - 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.
6
+ - Made default `cogmem memory candidates --json` return grouped ordinary, `needs_confirmation`, and deferred queues with actionable `nextActions`, while explicit `--status` still lists one queue.
7
+ - Fixed `cogmem memory list --since/--until/--order` so raw-ledger inspection can resume from global sequence cursors instead of silently ignoring the filters.
8
+ - 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.
9
+ - 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.
10
+ - 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.
11
+ - 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`.
12
+ - 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.
13
+ - 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.
14
+
15
+ ## 3.6.4
16
+
17
+ - 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`.
18
+ - 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.
19
+ - 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.
20
+ - Standardized MCP guidance on `cogmem mcp` for new Hermes/OpenClaw host configs while keeping `cogmem-mcp` as a compatibility bin for existing configs.
21
+
3
22
  ## 3.6.3
4
23
 
5
24
  - 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.3`
14
+ Current version: `3.6.5`
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 globally:
170
+ Install into an agent workspace with npm:
162
171
 
163
172
  ```bash
164
- curl -fsSL https://raw.githubusercontent.com/liuqin164/cogmem/main/install.sh | bash
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.3 schema set with one command:
232
+ Upgrade a 3.5.2 database, a 3.6.0 database, or a pre-release schema-25 test database into the 3.6.5 schema set with one command:
210
233
 
211
234
  ```bash
212
235
  cogmem migrate --yes --backup --json
@@ -237,12 +260,17 @@ 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 tick --project my-agent --mode auto --json
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
- 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`:
246
274
 
247
275
  ```bash
248
276
  cogmem dream tick --project my-agent --mode auto --max-episodes 10 --json
@@ -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 and later skip import batch sealing for empty episode boundaries and skip 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
 
@@ -259,13 +287,17 @@ Episode surgery is available through `cogmem episode split|merge|move-event|recl
259
287
  Inspect queue state:
260
288
 
261
289
  ```bash
290
+ cogmem memory plan --project my-agent --json
262
291
  cogmem memory status --project my-agent --json
292
+ cogmem memory candidates --project my-agent --json
263
293
  cogmem memory candidates --project my-agent --status candidate --json
264
294
  cogmem memory govern --project my-agent --json
265
295
  cogmem memory candidates --project my-agent --status needs_confirmation --json
266
296
  cogmem memory review --project my-agent --id <candidate-id> --action approve --actor <operator> --reason "confirmed" --confirmation-event <user-event-id> --json
267
297
  ```
268
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
+
269
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.
270
302
 
271
303
  ## Memory Atlas: let an agent see what it remembers
@@ -286,6 +318,8 @@ Atlas filtering is not limited to entity + time + action. The query compiler com
286
318
 
287
319
  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.
288
320
 
321
+ In 3.6.5, Atlas search and explore evidence also carries `sourceLocator.command` and `sourceLocator.contextCommand`. 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.
322
+
289
323
  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.
290
324
 
291
325
  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.
@@ -323,7 +357,7 @@ Operational cost classes:
323
357
 
324
358
  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.
325
359
 
326
- `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.
360
+ `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. In 3.6.5 it scans by Raw Ledger cursor rather than only the latest page. Use `--since <globalSeq>` to resume from a known ledger sequence.
327
361
 
328
362
  `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.
329
363
 
@@ -346,6 +380,8 @@ cogmem strategy outcomes --project hermes --json
346
380
 
347
381
  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.
348
382
 
383
+ `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`.
384
+
349
385
  `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.
350
386
 
351
387
  ```bash
@@ -431,9 +467,9 @@ From the OpenClaw workspace:
431
467
 
432
468
  ```bash
433
469
  cd ~/.openclaw/workspace
434
- cogmem init --agent openclaw --scope project
470
+ npm install cogmem@latest --save
471
+ ./node_modules/.bin/cogmem connect openclaw --workspace . --auto --force
435
472
  cogmem doctor
436
- cogmem connect openclaw --workspace . --auto --force
437
473
  ```
438
474
 
439
475
  Import existing OpenClaw memory:
@@ -472,7 +508,9 @@ By default, `selective_compile` uses user text as the durable compile signal, ex
472
508
  After updates or config drift:
473
509
 
474
510
  ```bash
475
- cogmem doctor --fix --agent openclaw --workspace .
511
+ cogmem update --yes
512
+ cogmem doctor --fix --agent openclaw --workspace . --plugin-only
513
+ openclaw gateway restart
476
514
  ```
477
515
 
478
516
  ## Hermes
@@ -482,8 +520,8 @@ Hermes integration is MCP-based in this release. cogmem does not claim to be a n
482
520
  Install the skill and patch Hermes MCP config:
483
521
 
484
522
  ```bash
485
- cogmem init --agent hermes
486
- cogmem connect hermes --workspace /path/to/hermes/workspace --auto --force
523
+ npm install cogmem@latest --save
524
+ ./node_modules/.bin/cogmem connect hermes --workspace /path/to/hermes/workspace --auto --force
487
525
  ```
488
526
 
489
527
  This installs the agent-facing skill bundle at:
@@ -501,6 +539,8 @@ With `--auto`, it adds or updates a `cogmem` MCP server entry in:
501
539
  ~/.hermes/config.yaml
502
540
  ```
503
541
 
542
+ 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.
543
+
504
544
  Then reload MCP inside Hermes:
505
545
 
506
546
  ```text
@@ -592,6 +632,7 @@ Useful intents:
592
632
  ```bash
593
633
  cogmem memory recall --query "上个会话我们聊了什么" --intent previous_session_summary --project openclaw --agent openclaw --json
594
634
  cogmem memory recall --query "我当时关于记忆黑盒的原话是什么" --intent forensic_quote --project openclaw --agent openclaw --json
635
+ cogmem memory recall --query "几个月前我们是不是讨论过 Cogmem 的记忆黑盒" --intent historical_discussion --project openclaw --agent openclaw --json
595
636
  ```
596
637
 
597
638
  Recall results include:
@@ -617,6 +658,15 @@ cogmem memory show --event <eventId> --before 2 --after 2 --json
617
658
 
618
659
  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.
619
660
 
661
+ For ledger audits or resumable import/binding checks, use global sequence cursors:
662
+
663
+ ```bash
664
+ cogmem memory list --project openclaw --since <global-seq> --order asc --json
665
+ cogmem memory list --project openclaw --since <global-seq> --until <global-seq> --order asc --json
666
+ ```
667
+
668
+ Each listed event includes a `sourceLocator` with a `memory show` command. Use it before saying an event ID or exact source is unavailable.
669
+
620
670
  ## TypeScript API
621
671
 
622
672
  ```ts
@@ -688,7 +738,7 @@ For Hermes after an update, reload the MCP server or restart the agent host. If
688
738
  cogmem connect hermes --workspace /path/to/hermes/workspace --auto --force
689
739
  ```
690
740
 
691
- This also updates existing Hermes `cogmem-mcp` blocks with missing strategy, episode, Dream, memory-map, maintenance, and prospective tools.
741
+ 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
742
 
693
743
  ## Documentation
694
744
 
@@ -710,6 +760,7 @@ Installed OpenClaw and Hermes skills include their own `references/operations.md
710
760
  cogmem init
711
761
  cogmem doctor
712
762
  cogmem connect openclaw|hermes
763
+ cogmem mcp
713
764
  cogmem update
714
765
  cogmem memory recall|search|show|dream|govern|candidates|review|status|map|tick|bind
715
766
  cogmem memory graph|graph-search|graph-explore|graph-node|graph-neighbors|graph-path|graph-timeline
@@ -739,7 +790,7 @@ npm pack --dry-run --json
739
790
  npm publish --dry-run --access public
740
791
  ```
741
792
 
742
- Create a GitHub Release from the matching version tag, for example `v3.6.3`. 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`.
793
+ Create a GitHub Release from the matching version tag, for example `v3.6.5`. 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
794
 
744
795
  Publish manually only for emergency fallback:
745
796
 
@@ -1,11 +1,11 @@
1
- # cogmem 3.6.3 Release Checklist
1
+ # cogmem 3.6.5 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.3`.
8
+ - `package.json` version is `3.6.5`.
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,11 @@ 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 explain the 3.6.5 agent operations protocol: `memory plan` for next actions, default grouped `memory candidates --json`, `memory list --since/--until/--order`, historical-discussion recall intent, Atlas evidence `sourceLocator`, and cursor-based `memory bind`.
65
+ - `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.
66
+ - README and skills document `cogmem mcp` as the preferred MCP server command for new configs while preserving `cogmem-mcp` as a compatibility bin.
59
67
  - 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
68
  - README and skills explain user-shaped topic operations, user-explicit versus model-candidate authority, alias collision review, operation rollback, and project isolation.
61
69
  - 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 +93,7 @@ npm publish --dry-run --access public
85
93
 
86
94
  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
95
 
88
- After verification, create a GitHub Release from the matching version tag, for example `v3.6.3`. The release workflow publishes through npm Trusted Publishing when the release is published. It must not publish on tag push alone.
96
+ After verification, create a GitHub Release from the matching version tag, for example `v3.6.5`. The release workflow publishes through npm Trusted Publishing when the release is published. It must not publish on tag push alone.
89
97
 
90
98
  Emergency manual fallback:
91
99
 
@@ -61,6 +61,7 @@ export interface AgentRecallSourceAnchor {
61
61
  }
62
62
  export interface AgentRecallSourceContextEvent {
63
63
  eventId: string;
64
+ globalSeq?: number;
64
65
  label: string;
65
66
  role?: MemoryEvent['role'];
66
67
  rawEventType?: MemoryEvent['rawEventType'];
@@ -89,7 +90,10 @@ export interface AgentRecallSourceContext {
89
90
  window: SourceContextWindowMetadata;
90
91
  locator: {
91
92
  eventId: string;
93
+ globalSeq?: number;
94
+ projectId?: string;
92
95
  command: string;
96
+ contextCommand?: string;
93
97
  threadId?: string;
94
98
  sessionId?: string;
95
99
  localDate?: string;
@@ -172,7 +176,7 @@ export interface AgentRecallResult {
172
176
  export interface AgentRecallDecisionTrace {
173
177
  version: 'agent_recall_decision.v1';
174
178
  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';
179
+ 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
180
  candidateCounts: {
177
181
  graph: number;
178
182
  navigation: number;
@@ -242,6 +246,7 @@ export declare class KernelAgentMemoryBackend {
242
246
  recallPack(query: AgentRecallQuery): AgentRecallPackResult;
243
247
  private recallPreviousSession;
244
248
  private recallForensicQuote;
249
+ private recallHistoricalDiscussion;
245
250
  private recallForensicAnchor;
246
251
  private searchRawEventsByQueryPlan;
247
252
  private rawLedgerFallbackItemsForQuery;
@@ -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,46 @@ 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 graphItems = allowsGraph ? this.memoryBindingGraphItemsForQuery(query, queryPlan, limit) : [];
502
+ const rawItems = allowsRawSource ? this.rawLedgerFallbackItemsForQuery(queryPlan, query, Math.max(limit * 2, 10)) : [];
503
+ const retrievalLimit = Math.max(limit * 4, 24);
504
+ const compiledItems = allowsCompiled
505
+ ? this.filterAgentEvidence(this.kernel.navigateMemory(queryPlan.primarySearchText, {
506
+ projectId: query.projectId,
507
+ limit: retrievalLimit,
508
+ startTime: query.startTime,
509
+ endTime: query.endTime,
510
+ }).rawEvidence, query.agentId, query.collection, query.excludeSessionId)
511
+ .slice(0, limit)
512
+ .map((neuron) => this.toAgentRecallItem(neuron))
513
+ : [];
514
+ const items = this.mergeRecallItems(rawItems, this.mergeRecallItems(graphItems, compiledItems, limit), limit);
515
+ const selectedLane = rawItems.length > 0
516
+ ? 'raw_ledger'
517
+ : graphItems.length > 0
518
+ ? 'graph'
519
+ : compiledItems.length > 0
520
+ ? 'compiled'
521
+ : 'none';
522
+ return {
523
+ recallMode: rawItems.length > 0 ? 'raw_ledger_fallback' : 'brain_recall_fallback',
524
+ items,
525
+ fallbackUsed: true,
526
+ queryPlan,
527
+ decisionTrace: recallDecisionTrace(selectedLane, 'historical_discussion', {
528
+ graph: graphItems.length,
529
+ navigation: compiledItems.length,
530
+ scopedNavigation: compiledItems.length,
531
+ brainFallback: 0,
532
+ rawLedger: rawItems.length,
533
+ }, items.length),
534
+ };
535
+ }
493
536
  recallForensicAnchor(query, limit) {
494
537
  if (!query.anchorEventId)
495
538
  return [];
@@ -928,7 +971,10 @@ export class KernelAgentMemoryBackend {
928
971
  window: normalized.window,
929
972
  locator: {
930
973
  eventId: event.eventId,
931
- command: `cogmem memory show --event ${event.eventId} --before 2 --after 2`,
974
+ globalSeq: event.globalSeq,
975
+ projectId: event.projectId,
976
+ command: `cogmem memory show --event ${cliArg(event.eventId)}${event.projectId ? ` --project ${cliArg(event.projectId)}` : ''} --before 2 --after 2 --json`,
977
+ contextCommand: `cogmem memory show --event ${cliArg(event.eventId)}${event.projectId ? ` --project ${cliArg(event.projectId)}` : ''} --before 3 --after 3 --json`,
932
978
  threadId: event.threadId,
933
979
  sessionId: event.sessionId,
934
980
  localDate: event.localDate,
@@ -939,6 +985,7 @@ export class KernelAgentMemoryBackend {
939
985
  const text = this.eventText(event);
940
986
  return {
941
987
  eventId: event.eventId,
988
+ globalSeq: event.globalSeq,
942
989
  label: memoryEventLabel(event),
943
990
  role: event.role,
944
991
  rawEventType: event.rawEventType,
@@ -1270,3 +1317,6 @@ function uniqueNonEmpty(values) {
1270
1317
  function laneAllowed(policy, lane) {
1271
1318
  return !policy || policy.allowedLanes.includes(lane);
1272
1319
  }
1320
+ function cliArg(value) {
1321
+ return /^[A-Za-z0-9._:/=@+-]+$/u.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
1322
+ }
@@ -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;
@@ -99,6 +99,9 @@ export function inferAgentRecallIntent(query) {
99
99
  if (/原话|怎么说的|完整对话|上一句|下一句|exact quote|verbatim/.test(text)) {
100
100
  return 'forensic_quote';
101
101
  }
102
+ if (/记得.{0,12}(聊过|讨论过|说过)|还记得|之前.{0,12}(聊过|讨论过|说过)|以前.{0,12}(聊过|讨论过|说过)|(过去|几个月前|半年前|上个月|前几天|昨天|上次|上个).{0,20}(聊过|讨论过|说过)|当时.{0,12}(聊|说|问)|那次.{0,12}(聊|说|问)|有没有.{0,12}(记录|聊过|讨论过)|have we discussed|did we talk about|previously discussed/.test(text)) {
103
+ return 'historical_discussion';
104
+ }
102
105
  return 'memory_recall';
103
106
  }
104
107
  export function extractRecallKeywords(text) {
@@ -168,10 +171,19 @@ function buildSemanticCuePhrases(keywords, query, anchorText) {
168
171
  const hasBlackBox = merged.includes('黑盒') || /黑盒|black\s*box/iu.test(text);
169
172
  if (hasMemory && hasBlackBox) {
170
173
  out.push('记忆 黑盒');
174
+ out.push('记忆黑盒');
175
+ out.push('CogMem Memory Context');
176
+ out.push('Memory Context');
177
+ out.push('上下文注入');
178
+ out.push('sourceContext 原文下钻');
171
179
  out.push('存档 黑盒');
172
180
  out.push('对话 存档 黑盒');
173
181
  out.push('上下文 黑盒');
174
182
  out.push('黑盒');
183
+ if (/graph|图|卡死|database locked|zombie|锁/iu.test(text)) {
184
+ out.push('memory graph 黑盒');
185
+ out.push('database locked zombie');
186
+ }
175
187
  }
176
188
  else if (hasBlackBox) {
177
189
  out.push('黑盒');
@@ -16,6 +16,7 @@ export declare class MemoryAtlasService {
16
16
  maxHops?: number;
17
17
  }): MemoryAtlasPathResult;
18
18
  timeline(query: string, options: MemoryAtlasQueryOptions): MemoryAtlasTimelineResult;
19
+ private attachEvidence;
19
20
  private evidence;
20
21
  private edgesFor;
21
22
  private safeEdges;
@@ -15,7 +15,8 @@ export class MemoryAtlasService {
15
15
  search(query, options) {
16
16
  const projectId = requiredProject(options.projectId);
17
17
  const nodes = this.store.search(boundedQuery(query), projectId, boundedLimit(options.limit));
18
- return slice(projectId, nodes, this.edgesFor(nodes, projectId), query);
18
+ const withEvidence = this.attachEvidence(nodes, projectId, options);
19
+ return slice(projectId, withEvidence, this.edgesFor(withEvidence, projectId), query);
19
20
  }
20
21
  explore(query, options) {
21
22
  const projectId = requiredProject(options.projectId);
@@ -32,8 +33,9 @@ export class MemoryAtlasService {
32
33
  from: compiled.range?.from, to: compiled.range?.to, limit });
33
34
  nodes = uniqueNodes([...actions.map((action) => this.store.getNode(action.id, projectId)).filter((node) => Boolean(node)), ...nodes]).slice(0, limit);
34
35
  }
35
- const edges = this.edgesFor(nodes, projectId);
36
- const result = slice(projectId, nodes, edges, query);
36
+ const nodesWithEvidence = this.attachEvidence(nodes, projectId, options);
37
+ const edges = this.edgesFor(nodesWithEvidence, projectId);
38
+ const result = slice(projectId, nodesWithEvidence, edges, query);
37
39
  result.facets = { time: compiled.range, target: target.labels.join(', ') || compiled.target, memoryKinds: compiled.memoryKinds, keywords: compiled.keywords };
38
40
  const hasFacet = Boolean(compiled.range || compiled.target || compiled.memoryKinds.length || compiled.tokens.length);
39
41
  result.coldMemoryResurrected = hasFacet && nodes.some((node) => node.activation <= 0.1);
@@ -155,14 +157,28 @@ export class MemoryAtlasService {
155
157
  return { version: 'memory_atlas.v1', projectId, query, range: compiled.range,
156
158
  temporalResurrection: Boolean(compiled.range && [...nodes, ...actions].length), nodes, actions, warnings: [] };
157
159
  }
160
+ attachEvidence(nodes, projectId, options) {
161
+ return nodes.map((node) => {
162
+ const evidence = this.evidence(node.id, projectId, options.evidenceLimit, options.includeEvidence);
163
+ const evidenceTotal = this.store.evidenceTotal(node.id, projectId);
164
+ return { ...node, evidenceCount: evidenceTotal, evidenceTotal, evidenceReturned: evidence.length, evidence };
165
+ });
166
+ }
158
167
  evidence(nodeId, projectId, requested, includeExcerpt) {
159
168
  const limit = Math.max(1, Math.min(requested ?? 2, 10));
160
169
  return this.store.evidenceIds(nodeId, projectId, limit).flatMap((eventId) => {
161
170
  const event = this.eventStore.getEvent(eventId);
162
171
  if (!event || event.projectId !== projectId)
163
172
  return [];
164
- return [{ eventId, drilldown: `cogmem memory show --event ${eventId} --project ${projectId} --json`,
165
- excerpt: includeExcerpt ? eventTextForMemory(event).slice(0, 500) : undefined }];
173
+ const sourceLocator = atlasSourceLocator(event, projectId);
174
+ return [{
175
+ eventId,
176
+ globalSeq: event.globalSeq,
177
+ projectId,
178
+ drilldown: sourceLocator.command,
179
+ sourceLocator,
180
+ excerpt: includeExcerpt ? eventTextForMemory(event).slice(0, 500) : undefined,
181
+ }];
166
182
  });
167
183
  }
168
184
  edgesFor(nodes, projectId) {
@@ -214,3 +230,21 @@ function chunked(values, size) {
214
230
  return chunks;
215
231
  }
216
232
  function slice(projectId, nodes, edges, query) { return { version: 'memory_atlas.v1', projectId, query, nodes, edges, nextActions: nodes.slice(0, 5).map((node) => ({ label: `Inspect ${node.label}`, tool: 'cogmem_graph_node', args: { id: node.id, projectId } })), warnings: [] }; }
233
+ function atlasSourceLocator(event, projectId) {
234
+ const project = projectId || event.projectId;
235
+ const projectArg = project ? ` --project ${cliArg(project)}` : '';
236
+ const base = `cogmem memory show --event ${cliArg(event.eventId)}${projectArg}`;
237
+ return {
238
+ eventId: event.eventId,
239
+ globalSeq: event.globalSeq,
240
+ projectId: project,
241
+ threadId: event.threadId,
242
+ sessionId: event.sessionId,
243
+ localDate: event.localDate,
244
+ command: `${base} --before 2 --after 2 --json`,
245
+ contextCommand: `${base} --before 3 --after 3 --json`,
246
+ };
247
+ }
248
+ function cliArg(value) {
249
+ return /^[A-Za-z0-9._:/=@+-]+$/u.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
250
+ }
@@ -1,7 +1,19 @@
1
1
  export type MemoryAtlasNodeType = 'project' | 'topic' | 'entity' | 'cluster' | 'episode' | 'belief' | 'action' | 'time' | 'event';
2
2
  export interface MemoryAtlasEvidence {
3
3
  eventId: string;
4
+ globalSeq?: number;
5
+ projectId?: string;
4
6
  drilldown: string;
7
+ sourceLocator?: {
8
+ eventId: string;
9
+ globalSeq?: number;
10
+ projectId?: string;
11
+ threadId?: string;
12
+ sessionId?: string;
13
+ localDate?: string;
14
+ command: string;
15
+ contextCommand: string;
16
+ };
5
17
  excerpt?: string;
6
18
  }
7
19
  export interface MemoryAtlasNode {
@@ -24,6 +36,8 @@ export interface MemoryAtlasNode {
24
36
  evidenceTotal: number;
25
37
  /** Number of evidence records returned in this response. */
26
38
  evidenceReturned?: number;
39
+ /** Bounded first-hop raw evidence locators for agent-facing graph search/explore responses. */
40
+ evidence?: MemoryAtlasEvidence[];
27
41
  }
28
42
  export interface MemoryAtlasEdge {
29
43
  source: string;