@unblocklabs/unblock-memory 0.6.0 → 0.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 (37) hide show
  1. package/README.md +3 -0
  2. package/dist/src/config.d.ts +2 -0
  3. package/dist/src/config.js +4 -1
  4. package/dist/src/contracts.d.ts +5 -0
  5. package/dist/src/extraction-chunk.d.ts +29 -0
  6. package/dist/src/extraction-chunk.js +130 -0
  7. package/dist/src/extraction-config.d.ts +13 -0
  8. package/dist/src/extraction-config.js +39 -0
  9. package/dist/src/extraction-index.d.ts +9 -0
  10. package/dist/src/extraction-index.js +44 -0
  11. package/dist/src/extraction-model.d.ts +58 -0
  12. package/dist/src/extraction-model.js +140 -0
  13. package/dist/src/extraction-runtime.d.ts +4 -0
  14. package/dist/src/extraction-runtime.js +121 -0
  15. package/dist/src/extraction-source.d.ts +26 -0
  16. package/dist/src/extraction-source.js +66 -0
  17. package/dist/src/extraction-store.d.ts +52 -0
  18. package/dist/src/extraction-store.js +138 -0
  19. package/dist/src/extraction-worker.d.ts +51 -0
  20. package/dist/src/extraction-worker.js +128 -0
  21. package/dist/src/inside-out-runtime.js +11 -1
  22. package/dist/src/inside-out-sources.d.ts +2 -0
  23. package/dist/src/inside-out.d.ts +14 -0
  24. package/dist/src/inside-out.js +89 -11
  25. package/dist/src/manager.d.ts +3 -0
  26. package/dist/src/manager.js +72 -12
  27. package/dist/src/plugin.js +6 -1
  28. package/dist/src/response-judge.d.ts +1 -1
  29. package/dist/src/response-stages.d.ts +4 -4
  30. package/dist/src/runtime.d.ts +2 -0
  31. package/dist/src/runtime.js +3 -0
  32. package/dist/src/session-projector.d.ts +10 -0
  33. package/dist/src/session-projector.js +1 -1
  34. package/docs/configuration.md +28 -2
  35. package/docs/extraction.md +124 -0
  36. package/openclaw.plugin.json +16 -2
  37. package/package.json +4 -2
@@ -0,0 +1,124 @@
1
+ # Session memory extraction
2
+
3
+ Opt-in lasting-fact extraction: **Luna proposes facts → code checks exact quotes →
4
+ Jev checks support and retention → SQLite stores accepted facts → optional QMD search.**
5
+ It is independent of Inside Out: emotion scores do not select or strengthen memories.
6
+ It never writes `MEMORY.md`, daily Markdown, or people dossiers.
7
+
8
+ ## Enable in shadow mode first
9
+
10
+ Merge this fragment under `plugins.entries.unblock-memory.config`, preserving
11
+ existing corpora and settings. Extraction chat types must be explicitly approved
12
+ and be a subset of the configured sessions corpus. This is channel agnostic.
13
+
14
+ ```json
15
+ {
16
+ "corpora": [
17
+ { "name": "memory", "kind": "files", "paths": ["MEMORY.md", "USER.md", "memory/**/*.md"] },
18
+ { "name": "sessions", "kind": "sessions", "chatTypes": ["channel", "group"] }
19
+ ],
20
+ "extraction": {
21
+ "enabled": true,
22
+ "publish": false,
23
+ "chatTypes": ["channel", "group"],
24
+ "intervalMinutes": 60,
25
+ "historyMessages": 6,
26
+ "maxBatches": 5,
27
+ "minSupport": 0.90,
28
+ "minRetention": 0.90,
29
+ "minReplacement": 0.90
30
+ }
31
+ }
32
+ ```
33
+
34
+ Configure [TypeSafe credentials](configuration.md#typesafe-and-whisperers).
35
+ Manual runs use the same Gateway-owned worker as scheduled runs; the Gateway must
36
+ be running and the CLI caller needs `operator.admin`. Reports can be read offline.
37
+ Requires host visible-transcript delta reads and working isolated LLM completion
38
+ (validated on OpenClaw 2026.9.2 with Codex 0.159.2). The native harness must be
39
+ installed through OpenClaw, not merely added to `plugins.load.paths`. Grant this
40
+ host policy **alongside `config`** in the plugin entry:
41
+
42
+ ```json
43
+ {
44
+ "llm": {
45
+ "allowAgentIdOverride": true,
46
+ "allowModelOverride": true,
47
+ "allowedModels": ["openai/gpt-5.6-luna"],
48
+ "allowedCompletionModels": ["openai/gpt-5.6-luna"]
49
+ }
50
+ }
51
+ ```
52
+
53
+ Luna uses the host's configured agent runtime and credentials, with zero tools and
54
+ no alternate-model/provider fallback. Missing TypeSafe credentials prevent source
55
+ scans and model calls. Enabling approves sending selected conversation text to
56
+ Luna and Jev; tool calls/results and hidden thinking are removed first.
57
+
58
+ ## Run, backfill, inspect
59
+
60
+ ```sh
61
+ openclaw memory-extract run --agent main --since 2026-09-01 --session SESSION_ID
62
+ openclaw memory-extract report --agent main
63
+ openclaw memory-extract run --agent main --since 2026-09-01
64
+ ```
65
+
66
+ Without `--since`, the first enabled run establishes a live start time; historical
67
+ messages require an explicit backfill. Runs process at most `maxBatches` session
68
+ chunks; repeat the same command to continue. The approved backfill boundary and
69
+ cursors persist across restarts and scheduled runs. An earlier `--since` replays
70
+ history without deleting retained facts. Unchanged reruns make no model calls;
71
+ new messages resume from each session's cursor. Failed chunks do not advance it.
72
+
73
+ ## Retention and thresholds
74
+
75
+ Retain explicit identities, relationships, ongoing responsibilities, stable
76
+ preferences, enduring project purposes, and adopted standing rules. Omit guesses,
77
+ hypotheticals, one-off tasks, temporary status, release/incident details, generic
78
+ technical knowledge, and credentials. The original transcripts remain searchable.
79
+
80
+ A blue guess followed by a human correction to red retains only the red preference.
81
+ Each proposal needs exact supporting quotes and new-message evidence. Jev checks
82
+ support and retention independently in one request; replacements also require an
83
+ explicit update to the same fact. All applicable thresholds must pass, and support
84
+ must select `supported`, even if its threshold is lowered.
85
+
86
+ The three thresholds accept 0–1 and default to 0.90. Lowering retention changes
87
+ certainty about category membership, not the categories themselves. Agents can
88
+ edit configuration when instructed, then reload/restart the Gateway; they must
89
+ not silently lower thresholds. Decisions store their probabilities and thresholds
90
+ for inspection. Changing thresholds affects future processing, not existing records;
91
+ rejected proposals are not kept for automatic regrading.
92
+
93
+ ## Storage, search, and limits
94
+
95
+ Three tables in the existing agent `unblock-memory.sqlite` store worker state,
96
+ session checkpoints, and versioned facts/evidence/judgments. Facts and checkpoints
97
+ commit together. Deduplication/corrections are per session, not cross-session;
98
+ older evidence cannot overwrite a newer observation. Source resets/deletions
99
+ withdraw affected facts when the worker next checks them. Reports include accepted
100
+ facts, judgments, checkpoints, and source/proposal/validation/commit failure stages
101
+ without leaking provider errors or source text into error messages.
102
+
103
+ `publish: false` stores accepted facts for evaluation only. `publish: true` indexes
104
+ them in the existing QMD `index.sqlite`; `memory_search` includes them by default,
105
+ or use `corpora: ["extracted"]`. `memory_get` checks the current active revision.
106
+ No automatic whisperer/dossier changes are introduced. Published facts can be
107
+ retrieved across this agent's audiences; this is **not per-person access control**.
108
+ Do not approve private conversations for a shared agent unless sharing is intended.
109
+
110
+ The Gateway owns the scheduler; no cron/launchd job is added. Interval 0 means
111
+ manual-only; the maximum is 1,440 minutes (daily). Defaults are disabled, unpublished,
112
+ no approved chat types, hourly, six overlap messages, and five chunks per run.
113
+
114
+ Chunks target 24k input tokens and cap at 28k, including Luna instructions, prior
115
+ facts and overlap, leaving room for Jev's 32k state-plus-longest-question limit.
116
+ `o200k_base` is a budgeting proxy, not an exact Jev/host token count. Quotes are
117
+ limited to 512 characters each. Up to six overlap messages fit within 8k tokens by
118
+ default. Oversized messages split losslessly with resumable offsets and original
119
+ message-ID citations. A session above 100 retained facts or 40k characters of prior
120
+ facts pauses rather than silently dropping comparison context. The output limit
121
+ is advisory on some host runtimes; malformed/truncated JSON is retried, never saved.
122
+
123
+ This is a conservative v1, not a calibrated guarantee of memory recall or truth.
124
+ Start with a single-session shadow run and inspect the retained facts before publishing.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "unblock-memory",
3
3
  "name": "Unblock Memory",
4
- "version": "0.6.0",
4
+ "version": "0.7.0",
5
5
  "description": "Indexes, retrieves, and analyzes configured workspace memory with existing QMD vectors.",
6
6
  "kind": "memory",
7
7
  "activation": { "onStartup": true },
@@ -116,7 +116,21 @@
116
116
  "enabled": { "type": "boolean", "default": false },
117
117
  "intervalMinutes": { "type": "integer", "minimum": 0, "maximum": 10080, "default": 1440 },
118
118
  "maxInteractions": { "type": "integer", "minimum": 1, "maximum": 10000, "default": 100 },
119
- "maxContextTokens": { "type": "integer", "minimum": 256, "maximum": 24000, "default": 12000 }
119
+ "maxContextTokens": { "type": "integer", "minimum": 256, "maximum": 30000, "default": 30000 }
120
+ }
121
+ },
122
+ "extraction": {
123
+ "type": "object", "additionalProperties": false,
124
+ "properties": {
125
+ "enabled": { "type": "boolean", "default": false },
126
+ "publish": { "type": "boolean", "default": false },
127
+ "intervalMinutes": { "type": "integer", "minimum": 0, "maximum": 1440, "default": 60 },
128
+ "chatTypes": { "type": "array", "items": { "enum": ["direct", "channel", "group"] }, "default": [] },
129
+ "historyMessages": { "type": "integer", "minimum": 0, "maximum": 20, "default": 6 },
130
+ "maxBatches": { "type": "integer", "minimum": 1, "maximum": 50, "default": 5 },
131
+ "minSupport": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.9 },
132
+ "minRetention": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.9 },
133
+ "minReplacement": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.9 }
120
134
  }
121
135
  },
122
136
  "responseAudit": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unblocklabs/unblock-memory",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Workspace-native memory for OpenClaw, powered by QMD",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -30,6 +30,7 @@
30
30
  "docs/peoplesql.md",
31
31
  "docs/response-audit.md",
32
32
  "docs/memory-training.md",
33
+ "docs/extraction.md",
33
34
  "openclaw.plugin.json"
34
35
  ],
35
36
  "scripts": {
@@ -45,8 +46,9 @@
45
46
  },
46
47
  "dependencies": {
47
48
  "@huggingface/tokenizers": "0.2.0",
48
- "@unblocklabs/qmd": "https://github.com/unblocklabs-ai/qmd/releases/download/v2.10.2/unblocklabs-qmd-2.10.2.tgz",
49
+ "@unblocklabs/qmd": "https://github.com/unblocklabs-ai/qmd/releases/download/v2.10.3/unblocklabs-qmd-2.10.3.tgz",
49
50
  "chokidar": "5.0.0",
51
+ "js-tiktoken": "1.0.21",
50
52
  "picomatch": "^4.0.5",
51
53
  "typebox": "1.3.6"
52
54
  },