@unblocklabs/unblock-memory 0.10.2 → 0.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,8 +8,9 @@ keyword or vector similarity.
8
8
 
9
9
  ## Quick start
10
10
 
11
- **Requirements:** Node.js 22+, OpenClaw 2026.8.1-beta.3 or later, and a
12
- [TypeSafe](https://docs.typesafe.ai) API key. Search uses TypeSafe to rank results.
11
+ **Requirements:** Node.js 22+ and OpenClaw 2026.8.1-beta.3 or later.
12
+ A [TypeSafe](https://docs.typesafe.ai) API key enables usefulness ranking; without
13
+ it, explicit search returns labeled local search leads.
13
14
 
14
15
  1. Install once per OpenClaw host, not once per agent:
15
16
 
@@ -17,7 +18,7 @@ keyword or vector similarity.
17
18
  openclaw plugins install npm:@unblocklabs/unblock-memory
18
19
  ```
19
20
 
20
- 2. Save your TypeSafe key in a private file (`chmod 600`), for example
21
+ 2. For usefulness ranking, save your TypeSafe key in a private file (`chmod 600`), for example
21
22
  `~/.openclaw/secrets/unblock-memory-typesafe.env`:
22
23
 
23
24
  ```dotenv
@@ -88,13 +89,15 @@ come back with their source location.
88
89
 
89
90
  The agent then calls `memory_get` with that `path` to read the surrounding
90
91
  context, attribution and dates. Search defaults to 5 results with a usefulness
91
- score of at least 0.7. See [search and read](docs/retrieval.md#search-and-read)
92
- for every parameter.
92
+ score of at least 0.7 when TypeSafe is available. If ranking is unavailable,
93
+ search returns unjudged local leads with a warning; the usefulness threshold
94
+ is not applied. Automatic Memory Whisperer hints still require TypeSafe.
95
+ See [search and read](docs/retrieval.md#search-and-read) for every parameter.
93
96
 
94
97
  **What leaves your machine:** indexing, embeddings, storage and `memory_get` run
95
98
  locally. `memory_search` sends the search question and candidate passages, with
96
- their paths and dates, to TypeSafe for scoring. Optional TypeSafe features send
97
- only what their own settings approve; see
99
+ their paths and dates, to TypeSafe for scoring when available. Optional TypeSafe
100
+ features send only what their own settings approve; see
98
101
  [TypeSafe data scope](docs/configuration.md#typesafe-data-scope).
99
102
 
100
103
  **On by default:** search and read over the `memory` corpus, and a
@@ -208,7 +208,7 @@ function resolveCorpora(value) {
208
208
  !chatTypes.every((chatType) => CHAT_TYPES.includes(chatType))) {
209
209
  throw new Error(`unblock-memory corpus sessions chatTypes must contain channel, group, or direct`);
210
210
  }
211
- const syncIntervalMinutes = corpus.syncIntervalMinutes ?? 60;
211
+ const syncIntervalMinutes = corpus.syncIntervalMinutes ?? 5;
212
212
  if (typeof syncIntervalMinutes !== "number" || !Number.isInteger(syncIntervalMinutes) ||
213
213
  syncIntervalMinutes < 0 || syncIntervalMinutes > 1440) {
214
214
  throw new Error("unblock-memory corpus sessions syncIntervalMinutes must be an integer between 0 and 1440");
@@ -102,9 +102,10 @@ export declare class WhispererDiagnostics {
102
102
  failed?: number | undefined;
103
103
  empty?: number | undefined;
104
104
  timed_out?: number | undefined;
105
+ degraded?: number | undefined;
105
106
  };
106
107
  slowestRecent: {
107
- outcome: "cancelled" | "ok" | "partial" | "skipped" | "failed" | "empty" | "timed_out";
108
+ outcome: "cancelled" | "ok" | "partial" | "skipped" | "failed" | "empty" | "timed_out" | "degraded";
108
109
  setupMs?: number | undefined;
109
110
  queueWaitMs?: number | undefined;
110
111
  metadataMs?: number | undefined;
@@ -133,6 +134,10 @@ export declare class WhispererDiagnostics {
133
134
  eligible?: number | undefined;
134
135
  results?: number | undefined;
135
136
  contextChars?: number | undefined;
137
+ requestsSucceeded?: number | undefined;
138
+ requestsFailed?: number | undefined;
139
+ fallbackKeyUnavailable?: number | undefined;
140
+ fallbackAllJudgmentsFailed?: number | undefined;
136
141
  }[];
137
142
  measurements: {
138
143
  [k: string]: {
@@ -4,7 +4,7 @@ export class WhispererDiagnostics {
4
4
  static shared() {
5
5
  const scope = globalThis;
6
6
  // Bump the version whenever the shape changes so an older loaded copy is never reused.
7
- const symbol = Symbol.for("unblock-memory.whisperer-diagnostics.v2");
7
+ const symbol = Symbol.for("unblock-memory.whisperer-diagnostics.v3");
8
8
  return (scope[symbol] ??= new WhispererDiagnostics());
9
9
  }
10
10
  #agents = new Map();
@@ -22,7 +22,6 @@ type InsideOutEvent = {
22
22
  __openclaw?: {
23
23
  senderId?: string;
24
24
  senderIsOwner?: boolean;
25
- upstreamUserText?: string;
26
25
  senderIdentity?: {
27
26
  id?: string;
28
27
  senderKind?: string;
@@ -96,7 +96,13 @@ function* interactions(source, budget, cached, after) {
96
96
  history = [];
97
97
  thread = String(nextThread);
98
98
  }
99
- text = conversationUserText(meta?.upstreamUserText ?? text, meta?.senderId)?.text ?? text;
99
+ // Replay metadata can contain the decorated model prompt, not the human reply.
100
+ const visible = conversationUserText(text, meta?.senderId);
101
+ if (!visible) {
102
+ history = [];
103
+ continue;
104
+ }
105
+ text = visible.text;
100
106
  }
101
107
  if (!text)
102
108
  continue;
@@ -61,9 +61,10 @@ export declare class QmdMemoryManager implements MemorySearchManagerContract {
61
61
  failed?: number | undefined;
62
62
  empty?: number | undefined;
63
63
  timed_out?: number | undefined;
64
+ degraded?: number | undefined;
64
65
  };
65
66
  slowestRecent: {
66
- outcome: "cancelled" | "ok" | "partial" | "skipped" | "failed" | "empty" | "timed_out";
67
+ outcome: "cancelled" | "ok" | "partial" | "skipped" | "failed" | "empty" | "timed_out" | "degraded";
67
68
  setupMs?: number | undefined;
68
69
  queueWaitMs?: number | undefined;
69
70
  metadataMs?: number | undefined;
@@ -92,6 +93,10 @@ export declare class QmdMemoryManager implements MemorySearchManagerContract {
92
93
  eligible?: number | undefined;
93
94
  results?: number | undefined;
94
95
  contextChars?: number | undefined;
96
+ requestsSucceeded?: number | undefined;
97
+ requestsFailed?: number | undefined;
98
+ fallbackKeyUnavailable?: number | undefined;
99
+ fallbackAllJudgmentsFailed?: number | undefined;
95
100
  }[];
96
101
  measurements: {
97
102
  [k: string]: {
@@ -13,12 +13,18 @@ export type MemorySearchObservation = RetrievalTimings & {
13
13
  requestsSucceeded: number;
14
14
  requestsFailed: number;
15
15
  };
16
+ export type MemoryRanking = {
17
+ rankingMode: "typesafe_usefulness" | "retrieval";
18
+ fallbackReason?: "key_unavailable" | "all_judgments_failed";
19
+ };
16
20
  /** Both entry points use the same complete passages and independent usefulness judgments. */
17
21
  export declare function searchMemory(manager: MemoryCandidateManager, queries: QueryPair, options: CorpusSearchOptions & {
18
- apiKey: string;
22
+ apiKey?: string;
19
23
  timeoutMs: number;
20
24
  conversation: QueryConversation;
21
25
  asOf?: string;
26
+ /** Only explicit, agent-requested search opts in. Automatic injection stays strict. */
27
+ allowRetrievalFallback?: boolean;
22
28
  minUsefulness?: number;
23
29
  excludedPassages?: ReadonlyMap<string, number>;
24
30
  onCandidates?: (observation: MemorySearchObservation) => void;
@@ -27,6 +33,6 @@ export declare function searchMemory(manager: MemoryCandidateManager, queries: Q
27
33
  elapsedMs: number;
28
34
  error?: unknown;
29
35
  }) => void;
30
- }): Promise<MemorySearchObservation & {
36
+ }): Promise<MemorySearchObservation & MemoryRanking & {
31
37
  results: CorpusMemorySearchResult[];
32
38
  }>;
@@ -46,6 +46,20 @@ export async function searchMemory(manager, queries, options) {
46
46
  }
47
47
  observation.eligible = candidates.length;
48
48
  options.onCandidates?.(observation);
49
+ const fallback = (reason) => ({
50
+ ...timings, ...observation, rankingMode: "retrieval", fallbackReason: reason,
51
+ // Discovery is a lexical-first union, not a ranking. Stable reciprocal-rank
52
+ // ordering lets strong vector-only hits compete before maxResults truncation.
53
+ // These original lane scores are not fused ranks or usefulness probabilities.
54
+ results: [...candidates].sort((a, b) => b.score - a.score).slice(0, options.maxResults ?? 5),
55
+ });
56
+ if (!options.apiKey) {
57
+ signal?.throwIfAborted();
58
+ if (options.allowRetrievalFallback)
59
+ return fallback("key_unavailable");
60
+ return { ...timings, ...observation, rankingMode: "typesafe_usefulness", results: [] };
61
+ }
62
+ const apiKey = options.apiKey;
49
63
  const endJudge = startTiming("judgeMs", timings, signal);
50
64
  let judged;
51
65
  try {
@@ -56,7 +70,7 @@ export async function searchMemory(manager, queries, options) {
56
70
  excerpt: hit.snippet, corpus: hit.corpus, sourcePath: hit.path,
57
71
  dates: [...new Set(hit.sessionMessages?.flatMap(message => message.timestamp ? [message.timestamp] : [])
58
72
  ?? (hit.messageTimestamp ? [hit.messageTimestamp] : []))],
59
- }, asOf), options);
73
+ }, asOf), { ...options, apiKey });
60
74
  signal?.throwIfAborted();
61
75
  observation.requestsSucceeded++;
62
76
  options.onJudgment?.({ candidateIndex, elapsedMs: performance.now() - requestStarted });
@@ -78,6 +92,8 @@ export async function searchMemory(manager, queries, options) {
78
92
  }
79
93
  signal?.throwIfAborted();
80
94
  observation.judgeMs = timings.judgeMs ?? 0;
81
- return { ...timings, ...observation, results: judged.filter(hit => hit.score >= (options.minUsefulness ?? 0.7))
95
+ if (options.allowRetrievalFallback && candidates.length && !observation.requestsSucceeded)
96
+ return fallback("all_judgments_failed");
97
+ return { ...timings, ...observation, rankingMode: "typesafe_usefulness", results: judged.filter(hit => hit.score >= (options.minUsefulness ?? 0.7))
82
98
  .sort((a, b) => b.score - a.score).slice(0, options.maxResults ?? 5) };
83
99
  }
@@ -48,7 +48,7 @@ const searchParameters = Type.Object({
48
48
  conversationId: Type.Optional(Type.String({ pattern: "\\S" })),
49
49
  }, { additionalProperties: false, description: "Restricts session documents only; selected file corpora remain eligible. Not an audience access control." })),
50
50
  maxResults: Type.Optional(Type.Integer({ minimum: 1, maximum: 20, description: "Maximum hits; default 5." })),
51
- minUsefulness: Type.Optional(Type.Number({ minimum: 0, maximum: 1, description: "Minimum TypeSafe usefulness probability; default 0.7. Not confidence in factual truth." })),
51
+ minUsefulness: Type.Optional(Type.Number({ minimum: 0, maximum: 1, description: "Minimum TypeSafe usefulness probability; default 0.7. Not confidence in factual truth. Not applied to unjudged retrieval fallback." })),
52
52
  }, { additionalProperties: false });
53
53
  const getParameters = Type.Object({
54
54
  path: Type.String({ pattern: "\\S" }),
@@ -66,7 +66,7 @@ function createSearchTool(runtime, ctx, typesafe, diagnostics) {
66
66
  return {
67
67
  name: "memory_search",
68
68
  label: "Memory Search",
69
- description: "Search this agent's configured memory corpora with BM25 and vector queries, then TypeSafe usefulness ranking. Supply keywords in bm25Query and the information needed in vectorQuery; no query generation or recall gate runs. Queries and candidate passages are sent to TypeSafe. Skills are excluded. Session snippets are message arrays; file snippets are strings. Inspect source context with memory_get. Empty results or errors do not prove absence of a fact.",
69
+ description: "Search this agent's configured memory corpora with BM25 and vector queries, then TypeSafe usefulness ranking. If TypeSafe is unavailable, returns retrieval-ranked leads with a warning; retrieval scores are not usefulness probabilities and minUsefulness is not applied. Supply keywords in bm25Query and the information needed in vectorQuery; no query generation or recall gate runs. Queries and candidate passages are sent to TypeSafe when available. Skills are excluded. Session snippets are message arrays; file snippets are strings. Inspect source context with memory_get. Empty results or errors do not prove absence of a fact.",
70
70
  parameters: searchParameters,
71
71
  async execute(_toolCallId, params, signal) {
72
72
  const started = performance.now();
@@ -78,11 +78,12 @@ function createSearchTool(runtime, ctx, typesafe, diagnostics) {
78
78
  // Reject oversized explicit inputs before credential resolution or any service call.
79
79
  prepareQueryConversation([], queries.lex);
80
80
  const { conversation } = prepareQueryConversation([], queries.vec);
81
- const apiKey = await resolveTypeSafeApiKey(typesafe);
82
- if (!apiKey) {
83
- measurement.outcome = "skipped";
84
- return jsonResult({ results: [], error: "TypeSafe API key not configured or TypeSafe disabled" });
81
+ let apiKey;
82
+ try {
83
+ apiKey = await resolveTypeSafeApiKey(typesafe);
85
84
  }
85
+ catch { /* Explicit search can still return local evidence; never expose credential errors. */ }
86
+ signal?.throwIfAborted();
86
87
  const { manager, error } = await runtime.getMemorySearchManager(active);
87
88
  measurement.setupMs = performance.now() - started;
88
89
  if (!manager)
@@ -92,27 +93,33 @@ function createSearchTool(runtime, ctx, typesafe, diagnostics) {
92
93
  sessionFilter,
93
94
  maxResults,
94
95
  minUsefulness,
95
- apiKey, timeoutMs: typesafe.timeoutMs, conversation,
96
+ apiKey, timeoutMs: typesafe.timeoutMs, conversation, allowRetrievalFallback: true,
96
97
  signal, timings: measurement,
97
98
  requestContext: active.requestContext,
98
99
  onCandidates: ({ retrievalMs, candidates, eligible }) => {
99
100
  Object.assign(measurement, { retrievalMs, candidates, eligible });
100
101
  },
101
102
  });
102
- measurement.judgeMs = search.judgeMs;
103
+ measurement.requestsSucceeded = search.requestsSucceeded;
104
+ measurement.requestsFailed = search.requestsFailed;
105
+ measurement.fallbackKeyUnavailable = Number(search.fallbackReason === "key_unavailable");
106
+ measurement.fallbackAllJudgmentsFailed = Number(search.fallbackReason === "all_judgments_failed");
103
107
  measurement.results = search.results.length;
104
108
  measurement.contextChars = search.results.reduce((sum, hit) => sum + hit.snippet.length, 0);
105
- if (search.eligible && !search.requestsSucceeded)
106
- return jsonResult({ results: [], error: "All memory usefulness judgments failed" });
107
- measurement.outcome = search.requestsFailed ? "partial" : search.results.length ? "ok" : "empty";
109
+ measurement.outcome = search.rankingMode === "retrieval" ? "degraded" : search.requestsFailed ? "partial" : search.results.length ? "ok" : "empty";
108
110
  // Compact only the public tool response; internal ranking and consumers keep
109
111
  // full-precision scores and the host's source/citation compatibility fields.
110
112
  const payload = {
111
- ...(search.requestsFailed ? { warning: `${search.requestsFailed} candidate usefulness judgments failed; results are partial` } : {}),
112
- results: search.results.map(({ source: _source, citation: _citation, session, sessionMessages, ...result }) => ({
113
+ rankingMode: search.rankingMode,
114
+ scoreMeaning: search.rankingMode === "retrieval" ? "retrieval_rank" : "usefulness_probability",
115
+ minUsefulnessApplied: search.rankingMode !== "retrieval",
116
+ ...(search.fallbackReason ? { fallbackReason: search.fallbackReason,
117
+ warning: "TypeSafe usefulness ranking unavailable; returning unjudged retrieval-ranked leads. Scores are retrieval ranks, not usefulness probabilities; minUsefulness was not applied. Verify evidence with memory_get." }
118
+ : search.requestsFailed ? { warning: `${search.requestsFailed} candidate usefulness judgments failed; results are partial` } : {}),
119
+ results: search.results.map(({ source: _source, citation: _citation, vectorScore: _vectorScore, textScore: _textScore, session, sessionMessages, ...result }) => ({
113
120
  ...result,
114
121
  snippet: result.corpus === "sessions" ? sessionMessages ?? [{ body: result.snippet, partial: true }] : result.snippet,
115
- score: Number(result.score.toFixed(2)),
122
+ score: search.rankingMode === "retrieval" ? result.score : Number(result.score.toFixed(2)),
116
123
  ...(session ? { session: { ...session, startedAt: new Date(session.startedAt).toISOString() } } : {}),
117
124
  })),
118
125
  };
@@ -1,7 +1,7 @@
1
1
  import { type RetrievalTimings } from "./retrieval-timing.js";
2
2
  type RetrievalOperation = "vector" | "memoryWhisperer" | "memorySearch";
3
- type RetrievalOutcome = "ok" | "partial" | "empty" | "failed" | "cancelled" | "timed_out" | "skipped";
4
- declare const fields: readonly ["elapsedMs", "retrievalMs", "judgeMs", "gateMs", "generationMs", "setupMs", "queueWaitMs", "metadataMs", "storeSetupMs", "bm25Ms", "vectorMs", "vectorIndexCheckMs", "vectorScopeMs", "embeddingMs", "vectorScanMs", "hydrationMs", "vectorMappingMs", "vectorOtherMs", "passageMs", "candidatePrepMs", "retrievalOtherMs", "otherMs", "metadataReloads", "vectorScanAttempts", "candidates", "eligible", "results", "contextChars"];
3
+ type RetrievalOutcome = "ok" | "partial" | "empty" | "failed" | "cancelled" | "timed_out" | "skipped" | "degraded";
4
+ declare const fields: readonly ["elapsedMs", "retrievalMs", "judgeMs", "gateMs", "generationMs", "setupMs", "queueWaitMs", "metadataMs", "storeSetupMs", "bm25Ms", "vectorMs", "vectorIndexCheckMs", "vectorScopeMs", "embeddingMs", "vectorScanMs", "hydrationMs", "vectorMappingMs", "vectorOtherMs", "passageMs", "candidatePrepMs", "retrievalOtherMs", "otherMs", "metadataReloads", "vectorScanAttempts", "candidates", "eligible", "results", "contextChars", "requestsSucceeded", "requestsFailed", "fallbackKeyUnavailable", "fallbackAllJudgmentsFailed"];
5
5
  type Field = typeof fields[number];
6
6
  export type RetrievalObservation = {
7
7
  outcome: RetrievalOutcome;
@@ -24,6 +24,7 @@ export declare class RetrievalTelemetry {
24
24
  failed?: number | undefined;
25
25
  empty?: number | undefined;
26
26
  timed_out?: number | undefined;
27
+ degraded?: number | undefined;
27
28
  };
28
29
  slowestRecent: {
29
30
  outcome: RetrievalOutcome;
@@ -55,6 +56,10 @@ export declare class RetrievalTelemetry {
55
56
  eligible?: number | undefined;
56
57
  results?: number | undefined;
57
58
  contextChars?: number | undefined;
59
+ requestsSucceeded?: number | undefined;
60
+ requestsFailed?: number | undefined;
61
+ fallbackKeyUnavailable?: number | undefined;
62
+ fallbackAllJudgmentsFailed?: number | undefined;
58
63
  }[];
59
64
  measurements: {
60
65
  [k: string]: {
@@ -1,8 +1,9 @@
1
1
  import { timingFields } from "./retrieval-timing.js";
2
2
  const fields = ["elapsedMs", "retrievalMs", "judgeMs", "gateMs", "generationMs", ...timingFields,
3
- "metadataReloads", "vectorScanAttempts", "candidates", "eligible", "results", "contextChars"];
3
+ "metadataReloads", "vectorScanAttempts", "candidates", "eligible", "results", "contextChars",
4
+ "requestsSucceeded", "requestsFailed", "fallbackKeyUnavailable", "fallbackAllJudgmentsFailed"];
4
5
  const recentLimit = 256;
5
- const outcomes = ["ok", "partial", "empty", "failed", "cancelled", "timed_out", "skipped"];
6
+ const outcomes = ["ok", "partial", "empty", "failed", "cancelled", "timed_out", "skipped", "degraded"];
6
7
  const boundedAdd = (left, right) => Math.min(Number.MAX_SAFE_INTEGER, left + right);
7
8
  /** Only fixed operation/outcome names and nonnegative numbers enter this store. */
8
9
  export class RetrievalTelemetry {
@@ -11,7 +11,7 @@ settings; a rotated credential file is reread without a restart.
11
11
 
12
12
  | Feature | Required settings/dependencies | TypeSafe disabled / no key | Provider or unreadable-key failure |
13
13
  | --- | --- | --- | --- |
14
- | `memory_search` | Installed/enabled memory slot; configured corpora; TypeSafe key | Explicit unavailable error | Successful judged siblings returned with a partial warning; total failure is an error; no vector fallback |
14
+ | `memory_search` | Installed/enabled memory slot; configured corpora | Local retrieval-ranked leads with degraded warning | Successful judged siblings returned with a partial warning; total judging failure or unreadable key uses local retrieval fallback |
15
15
  | `memory_get` | Installed/enabled memory slot; configured corpora | Unchanged local indexed reads | Unchanged; its own indexing errors still matter |
16
16
  | Skill Whisperer | `skillWhisperer.enabled`, skills corpus, host hooks | Best local vector candidate meeting `minScore` | Exclude failed candidates; successful siblings may qualify; no vector fallback |
17
17
  | Memory Whisperer | `memoryWhisperer.enabled`, explicit approved corpora, host hooks | No hints | Exclude failed candidates; recall/deadline failures still suppress the turn |
@@ -107,7 +107,7 @@ Use the README's host wrapper and [host controls](#host-controls) separately.
107
107
  {
108
108
  "corpora": [
109
109
  { "name": "memory", "kind": "files", "paths": ["MEMORY.md", "USER.md", "memory/**/*.md"] },
110
- { "name": "sessions", "kind": "sessions", "chatTypes": ["channel", "group", "direct"], "syncIntervalMinutes": 60 }
110
+ { "name": "sessions", "kind": "sessions", "chatTypes": ["channel", "group", "direct"], "syncIntervalMinutes": 5 }
111
111
  ]
112
112
  }
113
113
  ```
@@ -208,7 +208,7 @@ contract; these tables explain their effects.
208
208
  | `corpora[].paths` | Required for files/skills | Nonempty exact-file/directory/glob list; workspace-relative, absolute or `~/`; directory means recursive Markdown; does not grant host write trust |
209
209
  | `corpora[sessions].chatTypes` | `['channel','group']` | Nonempty subset of channel/group/direct; DMs require `direct` |
210
210
  | `corpora[sessions].maxExpandedTokens` | `500` | 1–10,000; internal host vector retrieval expands a full turn/message when it fits. Public search and Whisperer share the fixed 1,200-character complete-passage renderer with training. |
211
- | `corpora[sessions].syncIntervalMinutes` | `60` | 0–1,440; zero manual-only; first scheduled sync after one interval; requires running Gateway |
211
+ | `corpora[sessions].syncIntervalMinutes` | `5` | 0–1,440; zero manual-only; first scheduled sync after one interval; requires running Gateway |
212
212
  | `keepEmbeddingModelWarm` | `true` | Retain embedding model/context after first use; false allows five-minute idle disposal |
213
213
  | `analysis.executable` | Unset | Optional absolute local worker path; enables ability to recluster, not automatic scheduling |
214
214
 
@@ -573,8 +573,12 @@ expressed emotion, not intensity; several emotions can be present, and they need
573
573
  not sum to one. High sadness need not mean the agent caused it.
574
574
 
575
575
  Each request contains chronological visible `history` and a separate `target`
576
- human reply. Six Noul questions judge only `target.text`, using history to interpret
577
- tone and speaker attribution. Short yes/no criteria define each emotion; subtle
576
+ human reply. Both use visible message content, never storage-only
577
+ `__openclaw.upstreamUserText` replay prompts. Recognized transport envelopes are
578
+ unwrapped; ambiguous envelopes are excluded and break the history chain.
579
+ Existing grades remain cached; this does not automatically regrade historical
580
+ successes or retry oversized failures. Six Noul questions judge only `target.text`,
581
+ using history to interpret tone and speaker attribution. Short yes/no criteria define each emotion; subtle
578
582
  emotion counts without requiring explicit emotion words. Raw tool-result messages
579
583
  and tool-call blocks never enter either field; visible assistant text explaining a
580
584
  tool's findings remains conversation text. The rubric is `emotion-presence-v2`.
package/docs/retrieval.md CHANGED
@@ -21,8 +21,16 @@ Example tool input (the `memory` corpus exists by default):
21
21
  ```
22
22
 
23
23
  Results use compact JSON and carry `path`, `startLine`, `endLine`, `snippet`,
24
- `corpus`, and a usefulness `score` rounded to hundredths. Ranking and threshold
25
- filtering still use full precision. The constant `source` and top-level `provider`
24
+ `corpus`, and a `score`. With `rankingMode: "typesafe_usefulness"`, this is a
25
+ usefulness probability rounded to hundredths; ranking and threshold filtering
26
+ still use full precision. With `rankingMode: "retrieval"`, the original QMD
27
+ per-lane reciprocal-rank score is preserved without rounding, then sorted highest
28
+ first (discovery order breaks ties); this is not a probability or fused RRF score.
29
+ Discovery is a lexical-first union, so sorting prevents vector-only top matches
30
+ from being buried below the lexical lane before `maxResults` truncation. A hit
31
+ found in both lanes retains its first-discovered score; lane scores are not summed.
32
+ `scoreMeaning` and `minUsefulnessApplied` identify the score contract explicitly.
33
+ The constant `source` and top-level `provider`
26
34
  fields are omitted; `path` plus line numbers replace the redundant `citation`.
27
35
  Session hits also carry session metadata and, when available,
28
36
  `messageTimestamp`: the original timestamp text (including timezone) of the message
@@ -66,17 +74,36 @@ Search snippets are leads. Inspect attribution, qualifications, dates and adjace
66
74
  context before relying on a factual claim. An old plan is not proof it happened,
67
75
  and memory does not grant permission to act. No results may mean the wrong corpus,
68
76
  a high threshold, an unsynced session or an unavailable index—not absence of the fact.
69
- Search requires enabled TypeSafe and a configured key. It sends the semantic
70
- query, candidate excerpts, dates, corpus and source paths to TypeSafe. Missing
71
- credentials and total judging failure include an `error` alongside empty `results`;
72
- partial judging failure includes a `warning` and only successfully judged results.
77
+ When enabled and configured, TypeSafe receives the semantic query, candidate
78
+ excerpts, dates, corpus and source paths. If disabled, missing/unreadable credentials,
79
+ or **all** eligible usefulness requests fail (including billing HTTP 402, timeouts,
80
+ network or invalid responses), explicit search returns local retrieval-ranked leads.
81
+ The response includes `rankingMode: "retrieval"`, `scoreMeaning: "retrieval_rank"`,
82
+ `minUsefulnessApplied: false`, `fallbackReason` (`key_unavailable` or
83
+ `all_judgments_failed`), and a degraded warning. The requested `minUsefulness` is
84
+ not applied to unjudged scores. Corpus/session restrictions, complete passage
85
+ limits, deduplication, original source links, cancellation and `maxResults` remain
86
+ in force. Read sources with `memory_get` before drawing conclusions.
87
+
88
+ Partial judging failure returns **only** successfully judged results with a
89
+ warning; retrieval scores are never mixed with usefulness probabilities. Valid
90
+ judgments below `minUsefulness` still return no results, not fallback evidence.
91
+ An empty eligible set is an ordinary empty search when judging is available.
92
+ Automatic Memory Whisperer/People review policies remain strict: this fallback
93
+ is opt-in only for explicit `memory_search`, not automatic context injection.
73
94
  Oversized queries are rejected before credentials, retrieval or provider calls.
74
95
  Search initialization errors include an `error` alongside empty `results`;
75
96
  other failures may surface as tool errors. Investigate them instead of reporting
76
97
  “nothing is remembered.”
77
98
  `memory_diagnostics` exposes content-free manual-search measurements under
78
99
  `whisperers.telemetry.operations.memorySearch`: end-to-end latency, retrieval and
79
- judging time, candidate/result counts and outcomes (including partial failures).
100
+ judging time, candidate/result counts and outcomes (including `partial` and
101
+ `degraded`). `requestsSucceeded`/`requestsFailed` count individual usefulness
102
+ requests; `fallbackKeyUnavailable` and `fallbackAllJudgmentsFailed` count fallback
103
+ calls by cause. These are numeric, content-free measurements; disabled and missing
104
+ or unreadable keys intentionally share one reason without recording file paths.
105
+ Capture baseline and follow-up snapshots for weekly evaluation; counters reset on
106
+ process recreation and recent percentiles retain only 256 calls.
80
107
  These counters are separate from automatic `memoryWhisperer` and internal `vector`
81
108
  retrieval; no query or evidence text is recorded.
82
109
 
@@ -191,12 +218,12 @@ metadata. The projected file modification time matches the session
191
218
  start time for meaningful chronological cluster reads. Session results include
192
219
  provider, chat type, conversation identity, and start time as an ISO 8601 timestamp. They
193
220
  participate in the same search and clustering index as file memory. The plugin
194
- automatically checks each configured agent's sessions every 60 minutes while
221
+ automatically checks each configured agent's sessions every 5 minutes while
195
222
  the Gateway runs. Set `syncIntervalMinutes` on the `sessions` corpus to an integer
196
223
  from `1` to `1440`, or `0` for manual-only syncing. For example:
197
224
 
198
225
  ```json
199
- { "name": "sessions", "kind": "sessions", "syncIntervalMinutes": 60 }
226
+ { "name": "sessions", "kind": "sessions", "syncIntervalMinutes": 5 }
200
227
  ```
201
228
 
202
229
  The first refresh runs after one interval, not during startup. Restart the
@@ -214,7 +241,7 @@ are remembered. Index changes, missing projections, changed projection settings,
214
241
  QMD upgrades and incomplete runs invalidate the skip checkpoint; `force: true`
215
242
  bypasses both gates. `memory_sync_status` reports `lastCheckedAt`, `lastIndexedAt`
216
243
  and `skipReason` (`no_changes` or `no_indexable_changes`) separately. Existing
217
- explicit intervals remain unchanged on upgrade; set them to `60` for hourly checks.
244
+ explicit intervals remain unchanged on upgrade; set them to `5` for five-minute checks.
218
245
 
219
246
  Indexes live at `~/.openclaw/agents/<agentId>/unblock-memory/index.sqlite` (or the
220
247
  equivalent configured OpenClaw state directory). Durable agent-supplied event
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "unblock-memory",
3
3
  "name": "Unblock Memory",
4
- "version": "0.10.2",
4
+ "version": "0.10.4",
5
5
  "description": "Indexes, retrieves, and analyzes configured workspace memory with existing QMD vectors.",
6
6
  "kind": "memory",
7
7
  "activation": { "onStartup": true },
@@ -220,7 +220,7 @@
220
220
  "type": "integer",
221
221
  "minimum": 0,
222
222
  "maximum": 1440,
223
- "default": 60,
223
+ "default": 5,
224
224
  "description": "Check for session changes every N minutes while the Gateway runs; unchanged sessions skip indexing. 0 disables automatic sync. First check is after one interval."
225
225
  },
226
226
  "chatTypes": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unblocklabs/unblock-memory",
3
- "version": "0.10.2",
3
+ "version": "0.10.4",
4
4
  "description": "Workspace-native memory for OpenClaw, powered by QMD",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@huggingface/tokenizers": "0.2.0",
51
- "@unblocklabs/qmd": "3.0.0",
51
+ "@unblocklabs/qmd": "3.0.2",
52
52
  "chokidar": "5.0.0",
53
53
  "js-tiktoken": "1.0.21",
54
54
  "picomatch": "^4.0.5",
@@ -96,5 +96,9 @@
96
96
  "publishToClawHub": false,
97
97
  "publishToNpm": true
98
98
  }
99
+ },
100
+ "overrides": {
101
+ "@modelcontextprotocol/sdk": "1.32.0",
102
+ "hono": "4.13.11"
99
103
  }
100
104
  }