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 <noreply@anthropic.com>
This commit is contained in:
5
bot.py
5
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."
|
||||
)},
|
||||
|
||||
Reference in New Issue
Block a user