From aa175b8fb9d41b924ac1ade09d00a961104f2be1 Mon Sep 17 00:00:00 2001 From: Christian Gick Date: Thu, 5 Mar 2026 15:27:47 +0200 Subject: [PATCH] fix: Prevent memory extraction from storing document facts as user facts The memory extraction prompt was extracting facts from RAG search results (e.g., passport holder names) and storing them as if they were facts about the user. Added explicit instruction to only extract facts the user directly states about themselves. Co-Authored-By: Claude Opus 4.6 --- bot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index a45a4b2..918478d 100644 --- a/bot.py +++ b/bot.py @@ -1379,11 +1379,14 @@ class Bot: model=model, messages=[ {"role": "system", "content": ( - "You extract memorable facts about users from conversations. " + "You extract memorable facts about the USER from conversations. " "Return a JSON array of strings — each string is a concise fact worth remembering. " "Include: name, language preference, location, occupation, interests, preferences, " "family, pets, projects, important dates, or any personal detail shared. " "Do NOT include: the current question/topic, temporary info, or things the AI said. " + "Do NOT extract facts from documents or search results mentioned in the AI reply — " + "those are about OTHER people/entities, not the user. Only extract facts the user " + "directly states about themselves. " "Do NOT duplicate existing memories (rephrase or skip if already known). " "Return [] if nothing new is worth remembering." )},