[Bug] L1 extraction can attribute a third party's name to the user (no name-source rule in the prompt)

Author: Madin-H23Created Sep 17, 2026Updated Sep 18, 2026

OpenClaw Version | OpenClaw 版本

N/A — standalone gateway, OpenClaw not used

Plugin Version | 插件版本

MemoryCore @ feat/server_team (8f2dc83)

Operating System | 操作系统

Windows 11 · Node 22

System Specification | 系统配置

Describe the bug | 问题描述

The L1 extraction prompt asks the model to name the extraction subject as 用户(姓名) and to build the scene name as 我(AI)在和xxx(用户身份)做xxx, but it never constrains where the name may come from. When the L0 window contains a third party's name — e.g. the user pasted a colleague's messages verbatim (Mentor: pull the code and take a look) while the user's own name rarely appears — the model fills the name slot with that third party's name. The extracted memories and scene names then attribute the user's own actions to someone else, and previousSceneName continuity propagates the wrong name into the following batches.

Relevant prompt lines (src/core/prompts/l1-extraction.ts):

  • 命名规则:"我(AI)在和xxx(用户身份)做xxx(目标活动)"
  • 提取主体必须以"用户(姓名)"或"AI"为核心

Observed: on one day, 39 L1 records and their scene_name used a third party's name as the user (all corrected manually afterwards). L2/L3 — which receive the persona context — had the attribution right, so this is L1-specific.

To Reproduce | 复现步骤

  1. Make sure the L0 window contains a quoted message from a third party whose name reads like a plausible user name, while the actual user's name rarely appears.
  2. Run L1 extraction (any OpenAI-compatible model).
  3. Inspect the resulting L1 records / scene names: the third party's name is used as the user.

Expected behavior | 预期行为

  • A name may only be used when it comes from the user's own self-reference or an explicit address; a name that appears inside quoted/forwarded content belongs to a third party.
  • When no name can be established, write 用户 without a name (which is what the model does on most days) instead of guessing.

Additional context | 补充信息

Happy to send a PR adding that rule to the prompt (with a small regression test) if the direction sounds right. An alternative would be to pass a user-identity hint from the L3 persona into the L1 prompt.

(中文摘要)L1 提示词要求"用户(姓名)"与"我(AI)在和xxx(用户身份)做…",但未约束姓名来源:L0 中出现第三方人名(用户粘贴的他人消息)时,模型会把它当作用户;previousSceneName 连续性再把错误传播到后续批次(本机实测一天 39 条记录被误归属;L2/L3 有画像上下文反而正确)。建议加规则:姓名只来自用户自述/明确称呼,引用内容里的人名属第三方,不确定就写"用户"。

Source: TencentCloud/TencentDB-Agent-Memory