Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(prompt): key the memory-access rule on the delegate too

Shanu708404e29120
diff --git a/src/openhuman/agent/learning/prompt_sections.rs b/src/openhuman/agent/learning/prompt_sections.rs
index b559824761..9c6aa17d44 100644
--- a/src/openhuman/agent/learning/prompt_sections.rs
+++ b/src/openhuman/agent/learning/prompt_sections.rs
@@ -200,7 +200,19 @@ impl PromptSection for MemoryWriteSection {
}
/// The retrieval tools [`MemoryAccessSection`] is keyed on.
-pub const MEMORY_READ_TOOLS: [&str; 2] = ["memory_recall", "memory_search"];
+///
+/// `retrieve_memory` is the **delegate** to the memory sub-agent, synthesised
+/// from `delegate_name` in `memory/agent/agent/agent.toml`, and it belongs here
+/// for the same reason the two direct tools do: the section is a rule about
+/// what the model must do before claiming something is not stored, and an agent
+/// holding the delegate can retrieve. Keying only on the direct names meant an
+/// orchestrator whose memory arrives by delegation — which is how the
+/// orchestrator is configured — got the tool and no rule about using it. That
+/// is the shape of the bug #6040 and #6048 were both filed for.
+///
+/// [`any_tool_offered`] already receives the delegation tools separately, so
+/// this needed no new plumbing; the list was simply the wrong list.
+pub const MEMORY_READ_TOOLS: [&str; 3] = ["memory_recall", "memory_search", "retrieve_memory"];
/// The tool a preference is written through.
pub const SAVE_PREFERENCE_TOOL: &str = "save_preference";
diff --git a/src/openhuman/memory/guard/test_support_part_02.rs b/src/openhuman/memory/guard/test_support_part_02.rs
index 8d67770a18..15b902f797 100644
--- a/src/openhuman/memory/guard/test_support_part_02.rs
+++ b/src/openhuman/memory/guard/test_support_part_02.rs
@@ -731,25 +731,3 @@ impl MemoryEventIngest for RecordingProvider {
Ok(IngestOutcome::default())
}
}
-
-#[async_trait]
-impl MemoryAnswer for RecordingProvider {
- async fn answer(
- &self,
- _request: crate::openhuman::memory::api::provider::operations::AnswerRequest,
- ) -> Result<crate::openhuman::memory::api::provider::operations::AnswerResponse, MemoryError>
- {
- self.record(Call {
- method: "answer.answer".into(),
- content: None,
- taint: None,
- scoped: None,
- });
- Ok(crate::openhuman::memory::api::provider::operations::AnswerResponse {
- answer: String::new(),
- model: None,
- citations: Vec::new(),
- steps: Vec::new(),
- })
- }
-}
diff --git a/src/openhuman/memory/guard/test_support_part_03.rs b/src/openhuman/memory/guard/test_support_part_03.rs
index 3c14e179c0..c6ca15b23f 100644
--- a/src/openhuman/memory/guard/test_support_part_03.rs
+++ b/src/openhuman/memory/guard/test_support_part_03.rs
@@ -131,3 +131,29 @@ pub fn namespace_hit(
taint: MemoryTaint::default(),
}
}
+
+// Moved from part 02 for the same reason the inherent impl above moved: that
+// file reached the 750-line ceiling when the episodic family grew
+// `segments_pending_summary` (#6186). `MemoryAnswer` is the tail block and is
+// self-contained, so it relocates without splitting a trait impl across files.
+#[async_trait]
+impl MemoryAnswer for RecordingProvider {
+ async fn answer(
+ &self,
+ _request: crate::openhuman::memory::api::provider::operations::AnswerRequest,
+ ) -> Result<crate::openhuman::memory::api::provider::operations::AnswerResponse, MemoryError>
+ {
+ self.record(Call {
+ method: "answer.answer".into(),
+ content: None,
+ taint: None,
+ scoped: None,
+ });
+ Ok(crate::openhuman::memory::api::provider::operations::AnswerResponse {
+ answer: String::new(),
+ model: None,
+ citations: Vec::new(),
+ steps: Vec::new(),
+ })
+ }
+}