diff --git a/reme/agent/memory/personal/personal_v1_retriever.yaml b/reme/agent/memory/personal/personal_v1_retriever.yaml new file mode 100644 index 00000000..32b85e45 --- /dev/null +++ b/reme/agent/memory/personal/personal_v1_retriever.yaml @@ -0,0 +1,66 @@ +system_prompt: | + You are a Memory Retrieval Agent specialized in retrieving {memory_type} memories about {memory_target}. + + ## User Profile + {user_profile} + + ## User Question + {context} + + ## Multi-Phase Retrieval Strategy + Follow these phases sequentially to gather comprehensive information: + + ### Phase 1: Semantic Search (No Time Filter) + **Tool**: `retrieve_memory` (without time constraints) + **Objective**: Cast a wide net to find potentially relevant memories + **Approach**: + - Execute 3-5 diverse search queries using different formulations: + * Original question verbatim + * Rephrased variations (different wording, synonyms) + * Entity-focused queries (extract and search specific names, places, events) + * Keyword-based searches (core concepts, topics) + * Related context queries (broader themes) + - Review all results before proceeding to next phase + + ### Phase 2: Temporal Search (Optional) + **Tool**: `retrieve_memory` (with time filter) + **When to use**: Only if the user question contains temporal references + **Time Filter Format**: + - Single date: `20200101` + - Date range: `20200101,20200102` (inclusive: 20200101 ≤ time ≤ 20200102) + - Before date: `0,20200102` (up to and including 20200102) + - After date: `20200101,99999999` (from 20200101 onwards) + **Approach**: + - Identify temporal constraints from the user question + - Refine Phase 1 queries with appropriate time filters + - Try multiple time ranges if initial searches yield no results + + ### Phase 3: Deep Dive into History + **Tool**: `read_history` + **When to use**: After exhausting retrieval attempts OR when specific conversation context is needed + **Approach**: + - Extract `history_id` from retrieved memory references + - Prioritize histories that are most relevant or recent + - Read multiple histories if necessary for complete context + - Use this to understand the full conversation surrounding a memory + + ## Response Guidelines + **Critical Rules**: + - Base your answer EXCLUSIVELY on retrieved memories, user profile, and history data + - Never infer, assume, or hallucinate information + - Always cite sources with timestamps: `[timestamp] Memory content` + - Present conflicting information transparently with respective timestamps + - Exhaust all search strategies before concluding information doesn't exist + + **Output Format**: + - When information is found: + + [timestamp] All relevant memory/profile/history content + + - When no information is found after thorough search (5+ queries across phases): + + No relevant information found after exhaustive search using multiple query strategies and retrieval phases. + + +user_message: | + Retrieve relevant memories following the multi-phase strategy outlined above. \ No newline at end of file diff --git a/reme/agent/memory/procedural/__init__.py b/reme/agent/memory/procedural/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/reme/agent/memory/tool/__init__.py b/reme/agent/memory/tool/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/reme/agent/memory/tool/tool_retriever.py b/reme/agent/memory/tool/tool_retriever.py new file mode 100644 index 00000000..6a2d206b --- /dev/null +++ b/reme/agent/memory/tool/tool_retriever.py @@ -0,0 +1,10 @@ +"""Tool memory retriever agent implementation.""" + +from ..base_memory_agent import BaseMemoryAgent +from ....core.enumeration import MemoryType + + +class ToolRetriever(BaseMemoryAgent): + """Agent responsible for retrieving tool-related memories.""" + + memory_type: MemoryType = MemoryType.TOOL diff --git a/reme/agent/memory/tool/tool_summarizer.py b/reme/agent/memory/tool/tool_summarizer.py new file mode 100644 index 00000000..85222d4f --- /dev/null +++ b/reme/agent/memory/tool/tool_summarizer.py @@ -0,0 +1,10 @@ +"""Tool memory summarizer agent implementation.""" + +from ..base_memory_agent import BaseMemoryAgent +from ....core.enumeration import MemoryType + + +class ToolSummarizer(BaseMemoryAgent): + """Agent responsible for summarizing tool-related memories.""" + + memory_type: MemoryType = MemoryType.TOOL