Skip to content

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

Merge remote-tracking branch 'origin/main' into feat/memory-tool-evidence-recall

sanil-2377384c6267c0
diff --cc crates/openhuman-core/src/memory/tools.rs
index 0fabea82a6,e9d1530cea..bf2f00f139
--- a/crates/openhuman-core/src/memory/tools.rs
+++ b/crates/openhuman-core/src/memory/tools.rs
@@@ -222,27 -223,14 +227,32 @@@ fn parse<T: serde::de::DeserializeOwned
serde_json::from_value(args.clone()).map_err(|error| format!("invalid arguments: {error}"))
}
+/// The turns a read inside a thread leaves out: the whole calling thread,
+/// whose turns the agent's prompt already holds.
+fn calling_thread(facts: &CallFacts) -> Option<ThreadWindow> {
+ facts.thread_id.as_deref().map(ThreadWindow::whole)
+}
+
+/// What `recall` shows the model: the evidence to answer from and how many
+/// items it holds (their ids are kept as the turn's citations), or a note
+/// when nothing was recalled. The citations' snippets repeat the evidence,
+/// so they are left out.
+fn evidence_json(view: &RecallView) -> Value {
+ if view.answer.trim().is_empty() {
+ json!({ "evidence": "", "note": "Nothing relevant is stored in memory." })
+ } else {
+ json!({ "evidence": view.answer, "items": view.citations.len() })
+ }
+}
+
/// Runs one action. Errors become a model-visible tool error, never a hard
/// failure, so the model can adapt (memory off, unsupported mode, …).
- pub async fn run_action(config: &Config, args: &Value, facts: &CallFacts) -> ToolResult {
+ pub async fn run_action(
+ ctx: &DispatchCtx,
+ config: &Config,
+ args: &Value,
+ facts: &CallFacts,
+ ) -> ToolResult {
let action = arg_str(args, "action").unwrap_or_default();
tracing::debug!(action = %action, "[memory:tool] dispatch");
let result: Result<Value, String> = match action.as_str() {