Skip to content

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

chore: files changed crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs,crates/openhuman

Steven Enamakel49694d638336
diff --git a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs
index 4f4cb24274..2374e23888 100644
--- a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs
@@ -152,6 +152,10 @@ pub(super) fn assemble_turn_harness(
// run's thread, so a thread-less turn (a headless `inference_agent_chat`
// without a `thread_id`) is not offered them at all (issue #6956).
has_thread: bool,
+ // This turn's memory binding (`OpenHumanRunContext::memory_turn`): the
+ // compaction summarizer recalls under it. `None` leaves compaction
+ // memory-free.
+ memory_turn: Option<Arc<crate::memory::lifecycle::hooks::MemoryTurn>>,
) -> AssembledTurnHarness {
let mut harness: AgentHarness<(), OpenHumanRunContext> = AgentHarness::new();
// Cross-route fallback ownership (issue #4249, Workstream 02.2): populate the
@@ -572,6 +576,7 @@ pub(super) fn assemble_turn_harness(
summarizer_model,
pause_at_cap && subagent_scope.is_none(),
&tool_outcome_sink,
+ memory_turn,
);
verify_before_finish::install(
&mut harness,
diff --git a/crates/openhuman-core/src/agent/tinyagents/harness_assembly_tests.rs b/crates/openhuman-core/src/agent/tinyagents/harness_assembly_tests.rs
index 657567e397..eff23fd627 100644
--- a/crates/openhuman-core/src/agent/tinyagents/harness_assembly_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/harness_assembly_tests.rs
@@ -85,6 +85,7 @@ fn registered_tool_names(has_thread: bool) -> Vec<String> {
None,
None,
has_thread,
+ None,
);
assembled.harness.tools().names()
}
diff --git a/crates/openhuman-core/src/agent/tinyagents/harness_context_ladder.rs b/crates/openhuman-core/src/agent/tinyagents/harness_context_ladder.rs
index c1dc479963..ca8d63cb9f 100644
--- a/crates/openhuman-core/src/agent/tinyagents/harness_context_ladder.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/harness_context_ladder.rs
@@ -62,6 +62,7 @@ pub(super) fn install_context_ladder(
summarizer_model: TurnChatModel,
wrap_up_at_cap: bool,
tool_outcome_sink: &ToolOutcomeSink,
+ memory_turn: Option<Arc<crate::memory::lifecycle::hooks::MemoryTurn>>,
) -> (
Option<Arc<ContextCompressionMiddleware>>,
Option<Arc<FinalCallWrapUpMiddleware>>,
@@ -109,6 +110,7 @@ pub(super) fn install_context_ladder(
context_window,
summarizer_model,
model,
+ memory_turn,
));
// Lifecycle `before_model` runs the threshold compaction; the
// model wrap runs the provider-overflow → compact → retry-once
@@ -262,6 +264,7 @@ pub(super) fn compression_middleware(
context_window: Option<u64>,
summarizer_model: TurnChatModel,
model: &str,
+ memory_turn: Option<Arc<crate::memory::lifecycle::hooks::MemoryTurn>>,
) -> ContextCompressionMiddleware {
use tinyagents_harness::summarization::{
FaultTolerantCachingSummarizer, ModelSummarizer, TaskStateSummarizer,
@@ -289,8 +292,14 @@ pub(super) fn compression_middleware(
),
&policy,
);
- ContextCompressionMiddleware::with_summarizer(policy, Box::new(summarizer))
- .with_keep_recent_tokens(keep_recent)
+ ContextCompressionMiddleware::with_summarizer(
+ policy,
+ super::memory_summarizer::MemoryRecallSummarizer::wrap(
+ Box::new(summarizer),
+ memory_turn,
+ ),
+ )
+ .with_keep_recent_tokens(keep_recent)
}
crate::config::CompactionStrategy::Summary => {
tracing::info!(model, "[context_compression] strategy=summary");
@@ -298,7 +307,13 @@ pub(super) fn compression_middleware(
Box::new(ModelSummarizer::new(summarizer_model, model)),
&policy,
);
- ContextCompressionMiddleware::with_summarizer(policy, Box::new(summarizer))
+ ContextCompressionMiddleware::with_summarizer(
+ policy,
+ super::memory_summarizer::MemoryRecallSummarizer::wrap(
+ Box::new(summarizer),
+ memory_turn,
+ ),
+ )
}
}
}
diff --git a/crates/openhuman-core/src/agent/tinyagents/mod.rs b/crates/openhuman-core/src/agent/tinyagents/mod.rs
index 0eb70c5a40..1ae706040c 100644
--- a/crates/openhuman-core/src/agent/tinyagents/mod.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/mod.rs
@@ -26,6 +26,7 @@ mod embeddings;
mod harness_assembly;
mod harness_context_ladder;
pub(crate) mod harness_tool_registration;
+mod memory_summarizer;
pub mod host;
pub(crate) mod hosted_error;
pub(crate) mod journal;
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs
index 20303a0fa4..dfa6b3c9e5 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs
@@ -294,6 +294,7 @@ async fn run_turn_via_tinyagents_inner(
max_output_tokens,
),
has_thread,
+ run_context.memory_turn.clone(),
);
// Fail-closed registry validation gate (issue #4249, Workstream 10 — registry).