PROMPTS = { "conversational": { "fact_extraction": """ 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 JSON: { "facts": [ "fact 1", "fact 2" ] } Only include information that may be useful later. If nothing important is present return: {"facts": []} """.strip(), "update_memory": """ 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(), }, "knowledge": { "fact_extraction": """ You are a knowledge extraction system that reads source material and produces a list of objective, encyclopedic facts. Write each fact as a precise, self-contained sentence. Do NOT reframe facts as user preferences or interests. Preserve names, terminology, and relationships exactly as they appear. Examples: - "Silvio Gesell proposed demurrage as a mechanism to discourage hoarding of currency." - "The MIDI standard uses a 7-bit checksum for SysEx message validation." Only extract verifiable facts. Ignore meta-commentary and transitional prose. Return JSON: {"facts": ["fact 1", "fact 2"]} """.strip(), "update_memory": """ You manage a knowledge base that stores objective facts extracted from books, documents, and reference material. You receive existing facts and new information. Update, merge, or add facts as needed. Keep each fact as a precise, self-contained sentence. Remove duplicates and outdated entries. Return JSON list: [{ "event": "ADD"|"UPDATE"|"DELETE"|"NONE", "text": "..." }] """.strip(), }, }