|
@@ -47,20 +47,79 @@ PROMPTS = {
|
|
|
# Used by /memories — conversational, user-centric recall for OpenClaw.
|
|
# Used by /memories — conversational, user-centric recall for OpenClaw.
|
|
|
"conversational": {
|
|
"conversational": {
|
|
|
"fact_extraction": """
|
|
"fact_extraction": """
|
|
|
-You are a personal memory assistant. Extract concise, standalone facts about
|
|
|
|
|
-the user from the conversation below. Write each fact as a single sentence
|
|
|
|
|
-starting with "User" — for example:
|
|
|
|
|
- - "User is interested in generative music."
|
|
|
|
|
- - "User is familiar with Python async patterns."
|
|
|
|
|
- - "User prefers dark mode interfaces."
|
|
|
|
|
-Only extract facts that are clearly stated or strongly implied. Ignore filler,
|
|
|
|
|
-greetings, and opinions the user is uncertain about.
|
|
|
|
|
|
|
+You are an intelligent system that extracts useful long-term memory
|
|
|
|
|
+from a conversation.
|
|
|
|
|
+
|
|
|
|
|
+Your goal is to identify information that could help future interactions.
|
|
|
|
|
+
|
|
|
|
|
+Extract facts that describe:
|
|
|
|
|
+
|
|
|
|
|
+1. User preferences
|
|
|
|
|
+2. Important decisions
|
|
|
|
|
+3. Ongoing projects
|
|
|
|
|
+4. Tools or technologies being used
|
|
|
|
|
+5. Goals or plans
|
|
|
|
|
+6. Constraints or requirements
|
|
|
|
|
+7. Discoveries or conclusions
|
|
|
|
|
+8. Important context about tasks
|
|
|
|
|
+
|
|
|
|
|
+Ignore:
|
|
|
|
|
+- greetings
|
|
|
|
|
+- casual conversation
|
|
|
|
|
+- general world knowledge
|
|
|
|
|
+- temporary statements
|
|
|
|
|
+
|
|
|
|
|
+Return the result in JSON format:
|
|
|
|
|
+
|
|
|
|
|
+{
|
|
|
|
|
+ "facts": [
|
|
|
|
|
+ "fact 1",
|
|
|
|
|
+ "fact 2"
|
|
|
|
|
+ ]
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+Only include information that may be useful later.
|
|
|
|
|
+If nothing important is present return:
|
|
|
|
|
+
|
|
|
|
|
+{"facts": []}
|
|
|
|
|
+
|
|
|
""".strip(),
|
|
""".strip(),
|
|
|
"update_memory": """
|
|
"update_memory": """
|
|
|
-You manage a long-term memory database for a personal AI assistant.
|
|
|
|
|
-You receive existing memories and new information. Update, merge, or add
|
|
|
|
|
-memories as needed. Keep each memory as a single concise sentence starting
|
|
|
|
|
-with "User". Remove duplicates and outdated facts.
|
|
|
|
|
|
|
+
|
|
|
|
|
+You manage a long-term memory database.
|
|
|
|
|
+
|
|
|
|
|
+You receive:
|
|
|
|
|
+1. existing stored memories
|
|
|
|
|
+2. new extracted facts
|
|
|
|
|
+
|
|
|
|
|
+For each fact decide whether to:
|
|
|
|
|
+
|
|
|
|
|
+ADD
|
|
|
|
|
+Create a new memory if it contains useful new information.
|
|
|
|
|
+
|
|
|
|
|
+UPDATE
|
|
|
|
|
+Modify an existing memory if the new fact refines or corrects it.
|
|
|
|
|
+
|
|
|
|
|
+DELETE
|
|
|
|
|
+Remove a memory if it is clearly outdated or incorrect.
|
|
|
|
|
+
|
|
|
|
|
+NONE
|
|
|
|
|
+Ignore the fact if it is redundant or trivial.
|
|
|
|
|
+
|
|
|
|
|
+Guidelines:
|
|
|
|
|
+
|
|
|
|
|
+- Prefer updating over adding duplicates
|
|
|
|
|
+- Keep memories concise
|
|
|
|
|
+- Avoid storing repeated information
|
|
|
|
|
+- Preserve important context
|
|
|
|
|
+
|
|
|
|
|
+Return JSON list:
|
|
|
|
|
+
|
|
|
|
|
+[
|
|
|
|
|
+ { "event": "ADD", "text": "..." },
|
|
|
|
|
+ { "event": "UPDATE", "id": "...", "text": "..." }
|
|
|
|
|
+]
|
|
|
|
|
+
|
|
|
""".strip(),
|
|
""".strip(),
|
|
|
},
|
|
},
|
|
|
|
|
|