From 31e0b72b4f9d2f9dab69352cfcf4dcc0e6afd302 Mon Sep 17 00:00:00 2001 From: Wendy Tang Date: Fri, 31 Jan 2025 09:17:16 -0800 Subject: [PATCH] fix: explicitly add remember_memory tool in the instructions/system prompt (#965) --- crates/goose-mcp/src/memory/mod.rs | 9 +++++++++ crates/goose/src/truncate.rs | 2 ++ 2 files changed, 11 insertions(+) diff --git a/crates/goose-mcp/src/memory/mod.rs b/crates/goose-mcp/src/memory/mod.rs index 1de33605..2c7a6f3f 100644 --- a/crates/goose-mcp/src/memory/mod.rs +++ b/crates/goose-mcp/src/memory/mod.rs @@ -100,6 +100,13 @@ impl MemoryRouter { 2. Search memories by content or specific tags to find relevant information. 3. List all available memory categories for easy navigation. 4. Remove entire categories of memories when they are no longer needed. + When to call memory tools: + - These are examples where the assistant should proactively call the memory tool because the user is providing recurring preferences, project details, or workflow habits that they may expect to be remembered. + - Preferred Development Tools & Conventions + - User-specific data (e.g., name, preferences) + - Project-related configurations + - Workflow descriptions + - Other critical settings Interaction Protocol: When important information is identified, such as: - User-specific data (e.g., name, preferences) @@ -115,6 +122,8 @@ impl MemoryRouter { - Confirm the desired storage location: - Local storage (.goose/memory) for project-specific details. - Global storage (~/.config/goose/memory) for user-wide data. + - Use the remember_memory tool to store the information. + - `remember_memory(category, data, tags, is_global)` Example Interaction for Storing Information: User: "For this project, we use black for code formatting" Assistant: "You've mentioned a development preference. Would you like to remember this for future conversations? diff --git a/crates/goose/src/truncate.rs b/crates/goose/src/truncate.rs index 47e01a12..a63c35a5 100644 --- a/crates/goose/src/truncate.rs +++ b/crates/goose/src/truncate.rs @@ -23,6 +23,8 @@ pub trait TruncationStrategy { /// Strategy to truncate messages by removing the oldest first pub struct OldestFirstTruncation; +/// Strategy to truncate messages explicitly +pub struct ExplicitTruncation; impl TruncationStrategy for OldestFirstTruncation { fn determine_indices_to_remove(