Skip to content

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

refactor(session_host): move pack stripping into memory prompt helper

Steven Enamakelf8da7889c5e2
diff --git a/crates/openhuman-core/src/agent/session_host/builder/factory.rs b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
index bbb3e65d0a..0841ec5e06 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/factory.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
@@ -784,20 +784,11 @@ impl OpenHumanSessionHost {
// Memory prompt sections — the read side (#566) and the write side
// (#6048); both gates live in `helpers::add_memory_prompt_sections`.
- // Gated on the set the model will actually see: packs are stripped
- // from `visible` later in the build, and gating on the pre-strip set
- // told the orchestrator to call `save_preference` while the pack held
- // it off the wire.
- let visible_after_packs = {
- let mut after = visible.clone();
- crate::tools::toolpacks::strip_packed_from_visible(&mut after, agent_id);
- after
- };
prompt_builder = super::helpers::add_memory_prompt_sections(
prompt_builder,
&tools,
&delegation_tools,
- &visible_after_packs,
+ &visible,
agent_id,
);
diff --git a/crates/openhuman-core/src/agent/session_host/builder/helpers.rs b/crates/openhuman-core/src/agent/session_host/builder/helpers.rs
index 06096c7129..2344eaf5f6 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/helpers.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/helpers.rs
@@ -115,6 +115,15 @@ pub(super) fn add_memory_prompt_sections(
MEMORY_STORE_TOOL, MEMORY_WRITE_DELEGATE_TOOL, SAVE_PREFERENCE_TOOL,
};
let mut prompt_builder = prompt_builder;
+ // Gate on the set the model will actually see: packs are stripped from
+ // `visible` later in the build, and gating on the pre-strip set told the
+ // orchestrator to call `save_preference` while the pack held it off the
+ // wire.
+ let visible = &{
+ let mut after = visible.clone();
+ crate::tools::toolpacks::strip_packed_from_visible(&mut after, agent_id);
+ after
+ };
if any_tool_offered(&MEMORY_READ_TOOLS, tools, delegation_tools, visible) {
prompt_builder = prompt_builder.add_section(Box::new(MemoryAccessSection));
log::debug!("[memory_access] prompt section registered");