Skip to content

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

refactor(config): remove unused learning and prompt modules

Steven Enamakel32912b5f56ab
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
index b052dfef3b..02f34553bc 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
@@ -5,8 +5,6 @@
//! prefix reconciliation, tool snapshots, resume and persistence remain inside
//! the runtime session.
-mod prompt;
-
use std::sync::Arc;
use anyhow::Result;
@@ -318,82 +316,6 @@ impl OpenHumanTurnPrelude {
.build_system_prompt_tiered(&context)
}
- async fn fetch_learned_context(&self) -> crate::agent::prompts::LearnedContextData {
- if !self.learning_enabled && !self.explicit_preferences_enabled {
- return Default::default();
- }
- if !self.learning_enabled && self.explicit_preferences_enabled {
- return crate::agent::prompts::LearnedContextData {
- user_profile: crate::memory::preferences::load_general_preferences_on(
- &self.memory,
- crate::memory::preferences::STANDING_PREFS_LIMIT,
- )
- .await,
- ..Default::default()
- };
- }
- use crate::memory::MemoryCategory;
- let observations = self
- .memory
- .list(
- Some("learning_observations"),
- Some(&MemoryCategory::Custom("learning_observations".into())),
- None,
- )
- .await
- .unwrap_or_default();
- let patterns = self
- .memory
- .list(
- Some("learning_patterns"),
- Some(&MemoryCategory::Custom("learning_patterns".into())),
- None,
- )
- .await
- .unwrap_or_default();
- let reflections = self
- .memory
- .list(
- Some(crate::agent::learning::reflection::REFLECTIONS_NAMESPACE),
- Some(&MemoryCategory::Custom(
- crate::agent::learning::reflection::REFLECTIONS_NAMESPACE.into(),
- )),
- None,
- )
- .await
- .unwrap_or_default();
- let limits = self.config.resolved_memory_limits();
- crate::agent::prompts::LearnedContextData {
- observations: observations
- .iter()
- .rev()
- .take(5)
- .map(|entry| sanitize_prelude_entry(&entry.content))
- .collect(),
- patterns: patterns
- .iter()
- .take(3)
- .map(|entry| sanitize_prelude_entry(&entry.content))
- .collect(),
- user_profile: crate::memory::preferences::load_general_preferences_on(
- &self.memory,
- crate::memory::preferences::STANDING_PREFS_LIMIT,
- )
- .await,
- reflections: reflections
- .iter()
- .rev()
- .take(10)
- .map(|entry| sanitize_prelude_entry(&entry.content))
- .collect(),
- tree_root_summaries: collect_prelude_tree_roots(
- limits.per_namespace_max_chars,
- limits.total_tree_max_chars,
- )
- .await,
- }
- }
-
#[cfg(test)]
fn synthesized_tool_names_for_test(&self) -> std::collections::HashSet<String> {
self.tool_surface
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/prompt.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/prompt.rs
deleted file mode 100644
index a12402f137..0000000000
--- a/crates/openhuman-core/src/agent/session_host/runtime_session/prompt.rs
+++ /dev/null
@@ -1,85 +0,0 @@
-use super::*;
-
-impl OpenHumanTurnPrelude {
- pub(super) fn build_system_prompt_tiered(
- &self,
- learned: crate::agent::prompts::LearnedContextData,
- ) -> Result<crate::agent::prompts::TieredPrompt> {
- use crate::agent::prompts::{tool_call_format_from_dialect, PromptContext, PromptTool};
- let surface = self
- .tool_surface
- .lock()
- .unwrap_or_else(std::sync::PoisonError::into_inner);
- let specs = surface
- .visible_tool_specs
- .iter()
- .filter(|spec| {
- self.thread_id.is_some()
- || !crate::agent::tinyagents::harness_tool_registration::is_thread_goal_tool(
- &spec.name,
- )
- })
- .map(|spec| spec.as_ref().clone())
- .collect::<Vec<_>>();
- let instructions = self.tool_dispatcher.prompt_instructions(&specs);
- let tool_refs = surface
- .tools
- .iter()
- .chain(surface.synthesized_tools.iter())
- .filter(|tool| {
- self.thread_id.is_some()
- || !crate::agent::tinyagents::harness_tool_registration::is_thread_goal_tool(
- tool.name(),
- )
- })
- .map(|tool| tool.as_ref())
- .collect::<Vec<_>>();
- let mut prompt_tools = PromptTool::from_tool_refs(tool_refs.iter().copied());
- let mut visible_tool_names = surface.tool_policy_session.visible_tool_names_for_prompt();
- if self.thread_id.is_none() {
- visible_tool_names.retain(|name| {
- !crate::agent::tinyagents::harness_tool_registration::is_thread_goal_tool(name)
- });
- }
- crate::agent::prompts::swap_deferred_for_discovery_bridge(
- &mut prompt_tools,
- &mut visible_tool_names,
- &surface.deferred_tool_names,
- );
- let agents_md = if self.config.agents_md_enabled {
- crate::agent::prompts::load_agents_md_layers(&self.workspace_dir, &self.action_dir)
- } else {
- Default::default()
- };
- let mutable = self
- .mutable
- .lock()
- .unwrap_or_else(std::sync::PoisonError::into_inner);
- let context = PromptContext {
- workspace_dir: &self.workspace_dir,
- model_name: &self.model_name,
- agent_id: &self.agent_definition_name,
- tools: &prompt_tools,
- workflows: &mutable.workflows,
- dispatcher_instructions: &instructions,
- learned,
- visible_tool_names: &visible_tool_names,
- tool_call_format: tool_call_format_from_dialect(
- self.tool_dispatcher.tool_call_format(),
- ),
- connected_integrations: &mutable.connected_integrations,
- connected_identities_md: crate::agent::prompts::render_connected_identities(),
- include_profile: !self.omit_profile,
- include_memory_md: !self.omit_memory_md,
- curated_snapshot: None,
- user_identity: crate::security::credentials::identity::peek_credential_user_identity(),
- personality_roster: vec![],
- agents_md_global: agents_md.global,
- agents_md_local: agents_md.local,
- };
- self.context
- .lock()
- .unwrap_or_else(std::sync::PoisonError::into_inner)
- .build_system_prompt_tiered(&context)
- }
-}
diff --git a/crates/openhuman-core/src/config/mod.rs b/crates/openhuman-core/src/config/mod.rs
index 668bd6dfa5..4422ca89bd 100644
--- a/crates/openhuman-core/src/config/mod.rs
+++ b/crates/openhuman-core/src/config/mod.rs
@@ -46,25 +46,22 @@ pub use schema::{
CurlConfig, DashboardConfig, DecisionModel, DelegateAgentConfig, DiagramViewerConfig,
DictationActivationMode, DictationConfig, DiscordConfig, DockerRuntimeConfig, EmailConfig,
EmbeddingRouteConfig, GitbooksConfig, HttpHeader, HttpRequestConfig, IMessageConfig,
- IntegrationToggle, IntegrationsConfig, LarkConfig, LearningConfig, LegacySearchInputs,
- LinqConfig, LlmBackend, LocalAiConfig, MatrixConfig, McpAuthConfig, McpClientConfig,
- McpClientIdentityConfig, McpServerConfig, McpToolExposure, MemoryConfig, MemoryTreeConfig,
- ModelRouteConfig, MultimodalConfig, MultimodalFileConfig, ObservabilityConfig,
- OrchestratorModelConfig, PrivacyConfig, PrivacyMode, ProxyConfig, ProxyScope, ReflectionSource,
- ReliabilityConfig, ResourceLimitsConfig, RuntimeConfig, RuntimePoolConfig,
- RuntimePoolLangConfig, SandboxBackend, SandboxConfig, SchedulerConfig, SchedulerGateConfig,
- SchedulerGateMode, SearchConfig, SearchEngineCredentials, SearchPresentation,
- SearchProviderSettings, SearchRoute, SearxngConfig, SecretsConfig, SecurityConfig, ShellConfig,
- SlackConfig, StorageConfig, StorageProviderConfig, StorageProviderSection, StreamMode,
- SttEngine, TeamModelConfig, TelegramConfig, TokenjuiceConfig, UpdateConfig,
- UpdateRestartStrategy, VoiceActivationMode, VoiceServerConfig, WebSearchConfig, WebhookConfig,
- YuanbaoConfig, DEFAULT_CLOUD_LLM_MODEL, DEFAULT_MEMORY_SYNC_INTERVAL_SECS, DEFAULT_MODEL,
+ IntegrationToggle, IntegrationsConfig, LarkConfig, LegacySearchInputs, LinqConfig,
+ LocalAiConfig, MatrixConfig, McpAuthConfig, McpClientConfig, McpClientIdentityConfig,
+ McpServerConfig, McpToolExposure, MemoryConfig, ModelRouteConfig, MultimodalConfig,
+ MultimodalFileConfig, ObservabilityConfig, OrchestratorModelConfig, PrivacyConfig, PrivacyMode,
+ ProxyConfig, ProxyScope, ReliabilityConfig, ResourceLimitsConfig, RuntimeConfig,
+ RuntimePoolConfig, RuntimePoolLangConfig, SandboxBackend, SandboxConfig, SchedulerConfig,
+ SchedulerGateConfig, SchedulerGateMode, SearchConfig, SearchEngineCredentials,
+ SearchPresentation, SearchProviderSettings, SearchRoute, SearxngConfig, SecretsConfig,
+ SecurityConfig, ShellConfig, SlackConfig, StreamMode, SttEngine, TeamModelConfig,
+ TelegramConfig, TokenjuiceConfig, UpdateConfig, UpdateRestartStrategy, VoiceActivationMode,
+ VoiceServerConfig, WebSearchConfig, WebhookConfig, YuanbaoConfig, DEFAULT_MODEL,
LEGACY_TIER_MODELS, MANAGED_MULTIMODAL_MODELS, MANAGED_SEARCH_PROVIDERS,
- MEMORY_SYNC_INTERVAL_PRESETS_SECS, MODEL_IMAGE_GENERATION_AGENT, MODEL_MANAGED_DEFAULT,
- MODEL_MEDIA_UNDERSTANDING, MODEL_VIDEO_GENERATION_AGENT, SEARCH_ENGINE_BRAVE,
- SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_PARALLEL,
- SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS, SEARCH_ROLES, SEARCH_ROLE_ANSWER,
- SEARCH_ROLE_CONTENTS, SEARCH_ROLE_SEARCH,
+ MODEL_IMAGE_GENERATION_AGENT, MODEL_MANAGED_DEFAULT, MODEL_MEDIA_UNDERSTANDING,
+ MODEL_VIDEO_GENERATION_AGENT, SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA,
+ SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_PARALLEL, SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY,
+ SEARCH_PROVIDERS, SEARCH_ROLES, SEARCH_ROLE_ANSWER, SEARCH_ROLE_CONTENTS, SEARCH_ROLE_SEARCH,
};
// Kept as a separate re-export (issue #4117) so the large alphabetized group
// above stays byte-identical and rustfmt-stable.