@xdarkicex/openclaw-memory-libravdb 1.9.10-beta.22 → 1.9.10-beta.24

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/dist/index.js CHANGED
@@ -30853,6 +30853,13 @@ var MEMORY_PROMPT_HEADER = [
30853
30853
  "answer from memory until you have called it. Once you have results,",
30854
30854
  "use them \u2014 do not re-call in the same turn.",
30855
30855
  "",
30856
+ "### Identity / People Lookup (OVERRIDES memory_search)",
30857
+ "When asked about a specific person ('who is X', 'what do you know",
30858
+ "about X', 'tell me about X'): call `get_user_card` or `list_user_cards`",
30859
+ "FIRST. User cards are the canonical identity record written by you.",
30860
+ "Only use `memory_search` AFTER the card if the card lacks detail.",
30861
+ "Do NOT call memory_search first for people questions.",
30862
+ "",
30856
30863
  `Conversations are captured automatically. Never say "I'll remember`,
30857
30864
  `that," "I've saved this," "noted," or similar \u2014 these phrases suggest`,
30858
30865
  "manual effort where none exists. Just act on the request.",
@@ -30863,6 +30870,19 @@ function buildToolGuidance(availableTools) {
30863
30870
  return [];
30864
30871
  }
30865
30872
  const lines = [];
30873
+ const hasGetCard = availableTools.has("get_user_card");
30874
+ const hasListCards = availableTools.has("list_user_cards");
30875
+ if (hasGetCard || hasListCards) {
30876
+ lines.push(
30877
+ "**Identity/People questions \u2014 ALWAYS use user cards first:**",
30878
+ hasGetCard ? "- `get_user_card(user_id)` \u2014 primary lookup for a specific person." : "",
30879
+ hasListCards ? "- `list_user_cards()` \u2014 list everyone you have cards for, or when unsure who has cards." : "",
30880
+ "User cards are the canonical identity record. Call these FIRST before memory_search for any",
30881
+ "person question like 'who is X', 'what do you know about X', 'tell me about X'.",
30882
+ "Only use memory_search to supplement details the card doesn't cover.",
30883
+ ""
30884
+ );
30885
+ }
30866
30886
  lines.push(
30867
30887
  "Call `memory_search` once per user question for prior turns, remembered",
30868
30888
  "facts, earliest interactions, and channel history. Do not answer memory",
@@ -31314,12 +31334,12 @@ function createUpdateUserCardTool(getClient, logger = console) {
31314
31334
  description: "Write what you've learned about a speaker. Prose format \u2014 write like you're describing a friend. Include identity, values, history, communication style, triggers, and what matters to them. This is the canonical record of who they are. If something changes, update it. Merge with previous understanding, don't replace entirely unless the user explicitly contradicts the record.",
31315
31335
  parameters: UPDATE_USER_CARD_SCHEMA,
31316
31336
  execute: async (_toolCallId, rawParams) => {
31317
- const params = asParams(rawParams);
31318
- const userId = readStr(params, "user_id");
31319
- const card = readStr(params, "card");
31320
- if (!userId) throw new Error("update_user_card requires user_id");
31321
- if (!card) throw new Error("update_user_card requires card");
31322
31337
  try {
31338
+ const params = asParams(rawParams);
31339
+ const userId = readStr(params, "user_id");
31340
+ const card = readStr(params, "card");
31341
+ if (!userId) return jsonResult({ ok: false, error: "update_user_card requires user_id" });
31342
+ if (!card) return jsonResult({ ok: false, error: "update_user_card requires card" });
31323
31343
  const client = await getClient();
31324
31344
  const resp = await client.upsertUserCard({
31325
31345
  userId,
@@ -31340,10 +31360,10 @@ function createGetUserCardTool(getClient, logger = console) {
31340
31360
  description: "PRIMARY identity lookup. Call this FIRST whenever someone asks about a person ('who is X', 'tell me about X', 'what do you know about X'). Returns the full prose identity card with metadata. Only use memory_search AFTER get_user_card if the card lacks detail.",
31341
31361
  parameters: GET_USER_CARD_SCHEMA,
31342
31362
  execute: async (_toolCallId, rawParams) => {
31343
- const params = asParams(rawParams);
31344
- const userId = readStr(params, "user_id");
31345
- if (!userId) throw new Error("get_user_card requires user_id");
31346
31363
  try {
31364
+ const params = asParams(rawParams);
31365
+ const userId = readStr(params, "user_id");
31366
+ if (!userId) return jsonResult({ card: null, error: "get_user_card requires user_id" });
31347
31367
  const client = await getClient();
31348
31368
  const resp = await client.getUserCard({ userId });
31349
31369
  return jsonResult({
@@ -7,6 +7,13 @@ const MEMORY_PROMPT_HEADER = [
7
7
  "answer from memory until you have called it. Once you have results,",
8
8
  "use them — do not re-call in the same turn.",
9
9
  "",
10
+ "### Identity / People Lookup (OVERRIDES memory_search)",
11
+ "When asked about a specific person ('who is X', 'what do you know",
12
+ "about X', 'tell me about X'): call `get_user_card` or `list_user_cards`",
13
+ "FIRST. User cards are the canonical identity record written by you.",
14
+ "Only use `memory_search` AFTER the card if the card lacks detail.",
15
+ "Do NOT call memory_search first for people questions.",
16
+ "",
10
17
  "Conversations are captured automatically. Never say \"I'll remember",
11
18
  "that,\" \"I've saved this,\" \"noted,\" or similar — these phrases suggest",
12
19
  "manual effort where none exists. Just act on the request.",
@@ -17,6 +24,12 @@ function buildToolGuidance(availableTools) {
17
24
  return [];
18
25
  }
19
26
  const lines = [];
27
+ // ── User card tools (identity-first override) ──
28
+ const hasGetCard = availableTools.has("get_user_card");
29
+ const hasListCards = availableTools.has("list_user_cards");
30
+ if (hasGetCard || hasListCards) {
31
+ lines.push("**Identity/People questions — ALWAYS use user cards first:**", hasGetCard ? "- `get_user_card(user_id)` — primary lookup for a specific person." : "", hasListCards ? "- `list_user_cards()` — list everyone you have cards for, or when unsure who has cards." : "", "User cards are the canonical identity record. Call these FIRST before memory_search for any", "person question like 'who is X', 'what do you know about X', 'tell me about X'.", "Only use memory_search to supplement details the card doesn't cover.", "");
32
+ }
20
33
  lines.push("Call `memory_search` once per user question for prior turns, remembered", "facts, earliest interactions, and channel history. Do not answer memory", "questions from prior transcript claims — perform a search every time.", "After receiving results, use them directly; do not re-call in the same turn.", ...(availableTools.has("memory_get")
21
34
  ? ["After a `memory_search` hit, call `memory_get` when exact wording or more context is needed."]
22
35
  : []), "");
@@ -460,14 +460,14 @@ export function createUpdateUserCardTool(getClient, logger = console) {
460
460
  "Merge with previous understanding, don't replace entirely unless the user explicitly contradicts the record.",
461
461
  parameters: UPDATE_USER_CARD_SCHEMA,
462
462
  execute: async (_toolCallId, rawParams) => {
463
- const params = asParams(rawParams);
464
- const userId = readStr(params, "user_id");
465
- const card = readStr(params, "card");
466
- if (!userId)
467
- throw new Error("update_user_card requires user_id");
468
- if (!card)
469
- throw new Error("update_user_card requires card");
470
463
  try {
464
+ const params = asParams(rawParams);
465
+ const userId = readStr(params, "user_id");
466
+ const card = readStr(params, "card");
467
+ if (!userId)
468
+ return jsonResult({ ok: false, error: "update_user_card requires user_id" });
469
+ if (!card)
470
+ return jsonResult({ ok: false, error: "update_user_card requires card" });
471
471
  const client = await getClient();
472
472
  const resp = await client.upsertUserCard({
473
473
  userId,
@@ -492,11 +492,11 @@ export function createGetUserCardTool(getClient, logger = console) {
492
492
  "Only use memory_search AFTER get_user_card if the card lacks detail.",
493
493
  parameters: GET_USER_CARD_SCHEMA,
494
494
  execute: async (_toolCallId, rawParams) => {
495
- const params = asParams(rawParams);
496
- const userId = readStr(params, "user_id");
497
- if (!userId)
498
- throw new Error("get_user_card requires user_id");
499
495
  try {
496
+ const params = asParams(rawParams);
497
+ const userId = readStr(params, "user_id");
498
+ if (!userId)
499
+ return jsonResult({ card: null, error: "get_user_card requires user_id" });
500
500
  const client = await getClient();
501
501
  const resp = await client.getUserCard({ userId });
502
502
  return jsonResult({
@@ -2,7 +2,7 @@
2
2
  "id": "libravdb-memory",
3
3
  "name": "LibraVDB Memory",
4
4
  "description": "Cognitive memory engine — causal graph reasoning, predictive context, identity tracking, and hybrid vector recall with back-door adjustment scoring",
5
- "version": "1.9.10-beta.22",
5
+ "version": "1.9.10-beta.24",
6
6
  "kind": [
7
7
  "memory",
8
8
  "context-engine"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xdarkicex/openclaw-memory-libravdb",
3
- "version": "1.9.10-beta.22",
3
+ "version": "1.9.10-beta.24",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",