The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(agent): fleet-wide prompt invariants over every built-in agent
M3gA-Mind8116e5ee00e7
diff --git a/crates/openhuman-core/src/agent/harness/session/turn_checkpoint.rs b/crates/openhuman-core/src/agent/harness/session/turn_checkpoint.rsindex c844f69fe1..c149ea3e82 100644--- a/crates/openhuman-core/src/agent/harness/session/turn_checkpoint.rs+++ b/crates/openhuman-core/src/agent/harness/session/turn_checkpoint.rs@@ -311,7 +311,7 @@ pub(super) fn final_answer_instruction(stop_reason: Option<&str>, records: &str)/// see the conversation, so it cannot copy the pattern of the turn's own tool-call/// preambles, which is what wrote the intent-only reply in the first place. The/// three rules are shapes of reply, not particular tools or tasks.-pub(super) fn close_verification_prompt(user_request: &str, records: &str, reply: &str) -> String {+pub(crate) fn close_verification_prompt(user_request: &str, records: &str, reply: &str) -> String {format!("You are checking a reply before it is shown to a user. Below are the user's request, the \records of the tool calls made while handling it, and the reply.\n\n\diff --git a/crates/openhuman-core/src/agent/registry/agents/archivist/prompt.rs b/crates/openhuman-core/src/agent/registry/agents/archivist/prompt.rsindex 8e8e96e972..97df792f4e 100644--- a/crates/openhuman-core/src/agent/registry/agents/archivist/prompt.rs+++ b/crates/openhuman-core/src/agent/registry/agents/archivist/prompt.rs@@ -37,7 +37,3 @@ pub fn build(ctx: &PromptContext<'_>) -> Result<String> {Ok(out)}--#[cfg(test)]-#[path = "prompt_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/agent/registry/agents/archivist/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/archivist/prompt_tests.rsdeleted file mode 100644index 41f72e542c..0000000000--- a/crates/openhuman-core/src/agent/registry/agents/archivist/prompt_tests.rs+++ /dev/null@@ -1,32 +0,0 @@-use super::*;-use crate::agent::context::prompt::{LearnedContextData, ToolCallFormat};-use std::collections::HashSet;--#[test]-fn build_returns_nonempty_body() {- let visible: HashSet<String> = HashSet::new();- let ctx = PromptContext {- workspace_dir: std::path::Path::new("."),- model_name: "test",- agent_id: "archivist",- tools: &[],- workflows: &[],- dispatcher_instructions: "",- learned: LearnedContextData::default(),- visible_tool_names: &visible,- tool_call_format: ToolCallFormat::PFormat,- connected_integrations: &[],- connected_identities_md: String::new(),- include_profile: false,- include_memory_md: false,- curated_snapshot: None,- user_identity: None,- personality_soul_md: None,- personality_memory_md: None,- personality_roster: vec![],- agents_md_global: None,- agents_md_local: None,- };- let body = build(&ctx).unwrap();- assert!(!body.is_empty());-}diff --git a/crates/openhuman-core/src/agent/registry/agents/code_executor/prompt.rs b/crates/openhuman-core/src/agent/registry/agents/code_executor/prompt.rsindex 8a9f278f5d..7a7ee6528e 100644--- a/crates/openhuman-core/src/agent/registry/agents/code_executor/prompt.rs+++ b/crates/openhuman-core/src/agent/registry/agents/code_executor/prompt.rs@@ -41,7 +41,3 @@ pub fn build(ctx: &PromptContext<'_>) -> Result<String> {Ok(out)}--#[cfg(test)]-#[path = "prompt_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/agent/registry/agents/code_executor/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/code_executor/prompt_tests.rsdeleted file mode 100644index 81f39aca30..0000000000--- a/crates/openhuman-core/src/agent/registry/agents/code_executor/prompt_tests.rs+++ /dev/null@@ -1,32 +0,0 @@-use super::*;-use crate::agent::context::prompt::{LearnedContextData, ToolCallFormat};-use std::collections::HashSet;--#[test]-fn build_returns_nonempty_body() {- let visible: HashSet<String> = HashSet::new();- let ctx = PromptContext {- workspace_dir: std::path::Path::new("."),- model_name: "test",- agent_id: "code_executor",- tools: &[],- workflows: &[],- dispatcher_instructions: "",- learned: LearnedContextData::default(),- visible_tool_names: &visible,- tool_call_format: ToolCallFormat::PFormat,- connected_integrations: &[],- connected_identities_md: String::new(),- include_profile: false,- include_memory_md: false,- curated_snapshot: None,- user_identity: None,- personality_soul_md: None,- personality_memory_md: None,- personality_roster: vec![],- agents_md_global: None,- agents_md_local: None,- };- let body = build(&ctx).unwrap();- assert!(!body.is_empty());-}diff --git a/crates/openhuman-core/src/agent/registry/agents/context_scout/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/context_scout/prompt_tests.rsindex ab869d0cd0..94add5321b 100644--- a/crates/openhuman-core/src/agent/registry/agents/context_scout/prompt_tests.rs+++ b/crates/openhuman-core/src/agent/registry/agents/context_scout/prompt_tests.rs@@ -30,12 +30,6 @@ fn test_ctx() -> PromptContext<'static> {}}-#[test]-fn build_returns_nonempty_body() {- let body = build(&test_ctx()).unwrap();- assert!(!body.is_empty());-}-#[test]fn body_describes_the_context_bundle_contract() {let body = build(&test_ctx()).unwrap();diff --git a/crates/openhuman-core/src/agent/registry/agents/critic/prompt.rs b/crates/openhuman-core/src/agent/registry/agents/critic/prompt.rsindex 45ca5fddd7..73321bb013 100644--- a/crates/openhuman-core/src/agent/registry/agents/critic/prompt.rs+++ b/crates/openhuman-core/src/agent/registry/agents/critic/prompt.rs@@ -36,7 +36,3 @@ pub fn build(ctx: &PromptContext<'_>) -> Result<String> {Ok(out)}--#[cfg(test)]-#[path = "prompt_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/agent/registry/agents/critic/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/critic/prompt_tests.rsdeleted file mode 100644index 9d079cdebc..0000000000--- a/crates/openhuman-core/src/agent/registry/agents/critic/prompt_tests.rs+++ /dev/null@@ -1,32 +0,0 @@-use super::*;-use crate::agent::context::prompt::{LearnedContextData, ToolCallFormat};-use std::collections::HashSet;--#[test]-fn build_returns_nonempty_body() {- let visible: HashSet<String> = HashSet::new();- let ctx = PromptContext {- workspace_dir: std::path::Path::new("."),- model_name: "test",- agent_id: "critic",- tools: &[],- workflows: &[],- dispatcher_instructions: "",- learned: LearnedContextData::default(),- visible_tool_names: &visible,- tool_call_format: ToolCallFormat::PFormat,- connected_integrations: &[],- connected_identities_md: String::new(),- include_profile: false,- include_memory_md: false,- curated_snapshot: None,- user_identity: None,- personality_soul_md: None,- personality_memory_md: None,- personality_roster: vec![],- agents_md_global: None,- agents_md_local: None,- };- let body = build(&ctx).unwrap();- assert!(!body.is_empty());-}diff --git a/crates/openhuman-core/src/agent/registry/agents/crypto_agent/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/crypto_agent/prompt_tests.rsindex d5a26eca00..d956b4072b 100644--- a/crates/openhuman-core/src/agent/registry/agents/crypto_agent/prompt_tests.rs+++ b/crates/openhuman-core/src/agent/registry/agents/crypto_agent/prompt_tests.rs@@ -32,7 +32,6 @@ fn empty_ctx() -> PromptContext<'static> {#[test]fn build_returns_nonempty_body() {let body = build(&empty_ctx()).unwrap();- assert!(!body.is_empty());assert!(body.contains("Crypto Agent"));}diff --git a/crates/openhuman-core/src/agent/registry/agents/fleet_prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/fleet_prompt_tests.rsnew file mode 100644index 0000000000..6094d75a70--- /dev/null+++ b/crates/openhuman-core/src/agent/registry/agents/fleet_prompt_tests.rs@@ -0,0 +1,295 @@+//! Invariants every built-in agent's rendered prompt must hold.+//!+//! The per-agent `prompt_tests.rs` files pin what one prompt says. These pin+//! what every prompt must never get wrong, over every definition+//! [`load_builtins`] returns, so an agent added tomorrow is covered without+//! anyone writing a test for it.++use super::load_builtins;+use crate::agent::context::prompt::{LearnedContextData, PromptContext, ToolCallFormat};+use crate::agent::harness::definition::{AgentDefinition, PromptSource, ToolScope};+use std::collections::{BTreeSet, HashSet};+use std::sync::Arc;++/// Throwaway workspace: building a prompt can seed identity files into+/// whatever directory it is handed. Leaked so the borrow outlives the context.+fn scratch_workspace() -> &'static std::path::Path {+ use std::sync::OnceLock;+ static DIR: OnceLock<std::path::PathBuf> = OnceLock::new();+ DIR.get_or_init(|| {+ let dir = tempfile::TempDir::new().expect("temp workspace");+ let path = dir.path().to_path_buf();+ std::mem::forget(dir);+ path+ })+ .as_path()+}++/// Render `def`'s prompt through its own `PromptSource`, with no tools,+/// connections or user: what is left is what the agent was written to say.+fn render(def: &AgentDefinition) -> String {+ let PromptSource::Dynamic(build) = &def.system_prompt else {+ panic!("built-in `{}` must carry a dynamic prompt", def.id);+ };+ let visible = HashSet::new();+ let ctx = PromptContext {+ workspace_dir: scratch_workspace(),+ model_name: "test",+ agent_id: &def.id,+ tools: &[],+ workflows: &[],+ dispatcher_instructions: "",+ learned: LearnedContextData::default(),+ visible_tool_names: &visible,+ tool_call_format: ToolCallFormat::PFormat,+ connected_integrations: &[],+ connected_identities_md: String::new(),+ include_profile: false,+ include_memory_md: false,+ curated_snapshot: None,+ user_identity: None,+ personality_soul_md: None,+ personality_memory_md: None,+ personality_roster: vec![],+ agents_md_global: None,+ agents_md_local: None,+ };+ build(&ctx).unwrap_or_else(|e| panic!("`{}` prompt failed to build: {e}", def.id))+}++/// Every tool name the process can register, plus every packed name (some of+/// which are synthesised hand-offs that no registry lists).+///+/// A name outside this set is not checked. Tools a test config does not+/// register (a disabled browser, say) therefore go unexamined — the invariant+/// can miss, but it cannot misfire.+fn tool_universe() -> BTreeSet<String> {+ let tmp = tempfile::TempDir::new().expect("temp dir");+ let config = crate::config::Config {+ workspace_dir: tmp.path().join("workspace"),+ action_dir: tmp.path().join("workspace"),+ config_path: tmp.path().join("config.toml"),+ ..crate::config::Config::default()+ };+ let tools = crate::tools::all_tools(+ Arc::new(config.clone()),+ &Arc::new(crate::security::SecurityPolicy::default()),+ crate::security::AuditLogger::disabled(),+ &crate::config::BrowserConfig::default(),+ &crate::config::HttpRequestConfig::default(),+ tmp.path(),+ &std::collections::HashMap::new(),+ &config,+ );+ tools+ .iter()+ .map(|t| t.name().to_string())+ .chain(+ crate::tools::toolpacks::all_packed_tool_names()+ .into_iter()+ .map(str::to_string),+ )+ .collect()+}++/// Is `tool` on `def`'s belt at all (every tool, for a wildcard)?+fn on_belt(def: &AgentDefinition, tool: &str) -> bool {+ match &def.tools {+ ToolScope::Wildcard => true,+ ToolScope::Named(names) => names.iter().chain(&def.extra_tools).any(|n| n == tool),+ }+}++/// Can `def` call `tool`? Its belt, less what it disallows and what the pack+/// table withholds from it — plus `use_skill`, which the harness advertises+/// whenever the pack table withheld something (`strip_packed_from_visible`).+fn can_call(def: &AgentDefinition, tool: &str, universe: &BTreeSet<String>) -> bool {+ use crate::tools::toolpacks::ops::is_withheld_from;+ if tool == crate::tools::toolpacks::USE_SKILL {+ return universe+ .iter()+ .any(|n| on_belt(def, n) && is_withheld_from(&def.id, n));+ }+ on_belt(def, tool)+ && !def.disallowed_tools.iter().any(|n| n == tool)+ && !is_withheld_from(&def.id, tool)+}++/// Names from `not_callable` that `text` presents as directly callable.+///+/// Three exemptions, and all are about telling a *route* from a *call*:+///+/// * The generated `## Capabilities not in your tool list` block names withheld+/// tools on purpose — that block is the route, and it is the one sanctioned+/// place to write one. It is removed wholesale before scanning.+/// * A pack **id** may be backticked anywhere, since naming the skill is how a+/// route reads in prose. Two pack ids (`composio`, `goals`) are also tool+/// names inside their own pack, so a bare substring check cannot tell the+/// two apart; routes are always spelled ``skill `<id>` ``, so removing that+/// exact form is what makes the remaining occurrences calls.+/// * A full route — ``skill `<id>`, tool `<name>` ``, the exact spelling the+/// generated block emits — may name the tool it routes to, but only in that+/// form and only under the pack that owns it. A packed name backticked on its+/// own is still a call.+pub(super) fn names_presented_as_callable<'a>(+ text: &str,+ not_callable: impl IntoIterator<Item = &'a str>,+) -> Vec<&'a str> {+ let packed = crate::tools::toolpacks::all_packed_tool_names();+ const HEADING: &str = "## Capabilities not in your tool list";+ let mut prose = match text.find(HEADING) {+ Some(start) => {+ // Search for the next heading strictly after this one's own text+ // (`start + HEADING.len()`, not `start + 1`) — both indices land on+ // an ASCII byte, so this can never split a multi-byte UTF-8+ // character or run past `text.len()`.+ let search_from = start + HEADING.len();+ let end = text[search_from..]+ .find("\n## ")+ .map(|i| search_from + i)+ .unwrap_or(text.len());+ format!("{}{}", &text[..start], &text[end..])+ }+ None => text.to_string(),+ };+ for pack in crate::tools::toolpacks::PACKS {+ for name in pack.tools {+ prose = prose.replace(&format!("skill `{}`, tool `{name}`", pack.id), "");+ }+ }+ for name in &packed {+ prose = prose.replace(&format!("skill `{name}`"), "");+ }+ not_callable+ .into_iter()+ .filter(|name| prose.contains(&format!("`{name}`")))+ .collect()+}++/// Hits [`every_prompt_names_only_tools_its_agent_can_call`] tolerates, as+/// `(agent, tool, why)`; agent `*` matches any agent.+///+/// A ratchet, not an allowlist: an entry that no longer fires fails the test+/// too, so fixing a prompt forces deleting its row. Two kinds of row:+///+/// * **Real** — the prompt teaches a call the agent cannot make. Each is a+/// defect waiting on a prompt or belt fix; none may be added.+/// * **Collision** — the backticked word is also a tool name but is used as+/// something else (a node kind, an argument, an example). No fix is owed.+const KNOWN_UNCALLABLE: &[(&str, &str, &str)] = &[+ // Real.+ ("*", "shell", "shared `## Workspace` section says \"that is where `shell` runs\" to every agent (`prompts/sections.rs` WorkspaceSection)"),+ ("planner", "memory_recall", "told to search memory; not on its belt"),+ ("profile_memory_agent", "memory_recall", "told to read state first; belt has memory_store but no recall"),+ ("trigger_reactor", "memory_recall", "told to recall prior context; not on its belt"),+ ("trigger_reactor", "memory_forget", "not on its belt"),+ ("code_executor", "composio_execute", "a \"hard rule\" routes GitHub ops through a tool not on its belt"),+ ("morning_briefing", "composio_list_connections", "withheld by the `composio` pack"),+ ("morning_briefing", "composio_list_tools", "withheld by the `composio` pack"),+ ("morning_briefing", "composio_execute", "withheld by the `composio` pack"),+ ("context_scout", "list_workflows", "on its belt but withheld by the `workflows` pack"),+ ("skill_executor", "describe_workflow", "step 1 of its procedure; on its belt but withheld by the `workflows` pack"),+ // Collision.+ ("context_scout", "run_workflow", "names the orchestrator's call, not its own"),+ ("scheduler_agent", "schedule", "the `schedule` argument of `cron_add`"),+ ("summarizer", "file_read", "an example of a payload's source tool"),+ ("workflow_builder", "http_request", "a flow node kind"),+ ("workflow_builder", "schedule", "a flow trigger field"),+ ("workflow_builder", "flow_memory_recall", "node-contract note on what a memory node shares"),+ ("workflow_builder", "flow_memory_remember", "node-contract note on what a memory node shares"),+ ("flow_discovery", "http_request", "a flow node kind"),+ ("flow_discovery", "schedule", "a flow trigger field"),+];++/// A prompt must never teach a call the agent cannot make.+///+/// The static markdown once named fifteen tools and ten of them were packed,+/// so the prompt taught a call the model could not make: it emits the name,+/// the harness answers "unknown tool", and the iteration is spent. This is+/// that rule over every built-in, against each one's own callable surface.+#[test]+fn every_prompt_names_only_tools_its_agent_can_call() {+ let universe = tool_universe();+ let known = |agent: &str, tool: &str| {+ KNOWN_UNCALLABLE+ .iter()+ .any(|(a, t, _)| (*a == "*" || *a == agent) && *t == tool)+ };+ let mut fired = HashSet::new();+ let mut violations = Vec::new();+ for def in load_builtins().expect("built-ins load") {+ let not_callable = universe+ .iter()+ .map(String::as_str)+ .filter(|name| !can_call(&def, name, &universe));+ for tool in names_presented_as_callable(&render(&def), not_callable) {+ if known(&def.id, tool) {+ fired.insert((def.id.clone(), tool));+ } else {+ violations.push(format!("{}: `{tool}`", def.id));+ }+ }+ }+ assert!(+ violations.is_empty(),+ "prompts name tools their agent cannot call — take them off the prompt, put \+ them on the belt, or route them through `use_skill`:\n{}",+ violations.join("\n")+ );+ let stale: Vec<_> = KNOWN_UNCALLABLE+ .iter()+ .filter(|(a, t, _)| {+ !fired+ .iter()+ .any(|(fa, ft)| (*a == "*" || a == fa) && t == ft)+ })+ .collect();+ assert!(+ stale.is_empty(),+ "fixed — delete these rows from KNOWN_UNCALLABLE: {stale:?}"+ );+}++/// Agents whose prompt defers to the rendered tool list instead of naming a+/// tool; [`every_prompt_names_at_least_one_tool_it_can_call`] skips them.+const NAMES_NO_TOOL: &[&str] = &["critic", "archivist", "skill_setup"];++/// An agent with a belt must be told about at least one tool on it.+///+/// Catches a belt narrowed out from under its prompt, which otherwise reads+/// as an improvement: the tool bytes fall and nothing else moves.+#[test]+fn every_prompt_names_at_least_one_tool_it_can_call() {+ let universe = tool_universe();+ let silent: Vec<String> = load_builtins()+ .expect("built-ins load")+ .iter()+ .filter(|def| !matches!(&def.tools, ToolScope::Named(n) if n.is_empty()))+ .filter(|def| {+ let prompt = render(def);+ !universe+ .iter()+ .any(|name| can_call(def, name, &universe) && prompt.contains(&format!("`{name}`")))+ })+ .map(|def| def.id.clone())+ .collect();+ assert_eq!(+ silent, NAMES_NO_TOOL,+ "agents that carry tools but whose prompt names none of them"+ );+}++/// The close-verification rubric is also the tier-2 eval's judge; if its rules+/// are reworded, that judge silently grades against a different standard.+#[test]+fn close_verification_rubric_keeps_its_three_rules() {+ let rubric =+ crate::agent::harness::session::turn_checkpoint::close_verification_prompt("", "", "");+ for stem in [+ "1. The reply only says what the assistant will do",+ "2. The reply states something the tool records contradict",+ "3. The request was not completed, a failed record gives the reason",+ ] {+ assert!(rubric.contains(stem), "rubric lost rule `{stem}`");+ }+}diff --git a/crates/openhuman-core/src/agent/registry/agents/flow_memory_agent/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/flow_memory_agent/prompt_tests.rsindex e97326c720..0c5f2107a6 100644--- a/crates/openhuman-core/src/agent/registry/agents/flow_memory_agent/prompt_tests.rs+++ b/crates/openhuman-core/src/agent/registry/agents/flow_memory_agent/prompt_tests.rs@@ -30,12 +30,6 @@ fn test_ctx() -> PromptContext<'static> {}}-#[test]-fn build_returns_nonempty_body() {- let body = build(&test_ctx()).unwrap();- assert!(!body.is_empty());-}-#[test]fn body_describes_the_read_only_contract() {let body = build(&test_ctx()).unwrap();diff --git a/crates/openhuman-core/src/agent/registry/agents/help/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/help/prompt_tests.rsindex 9c096cdbac..5070215871 100644--- a/crates/openhuman-core/src/agent/registry/agents/help/prompt_tests.rs+++ b/crates/openhuman-core/src/agent/registry/agents/help/prompt_tests.rs@@ -28,6 +28,5 @@ fn build_returns_nonempty_body() {agents_md_local: None,};let body = build(&ctx).unwrap();- assert!(!body.is_empty());assert!(body.contains("Help Agent"));}diff --git a/crates/openhuman-core/src/agent/registry/agents/integrations_agent/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/integrations_agent/prompt_tests.rsindex aef0afa70e..f4f6cd2c90 100644--- a/crates/openhuman-core/src/agent/registry/agents/integrations_agent/prompt_tests.rs+++ b/crates/openhuman-core/src/agent/registry/agents/integrations_agent/prompt_tests.rs@@ -34,7 +34,6 @@ fn ctx_with<'a>(integrations: &'a [ConnectedIntegration]) -> PromptContext<'a> {#[test]fn build_returns_nonempty_body() {let body = build(&ctx_with(&[])).unwrap();- assert!(!body.is_empty());assert!(!body.contains("## Connected Integrations"));assert!(!body.contains("## Available Skills"));}diff --git a/crates/openhuman-core/src/agent/registry/agents/mcp_agent/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/mcp_agent/prompt_tests.rsindex a2664f343d..15ef567984 100644--- a/crates/openhuman-core/src/agent/registry/agents/mcp_agent/prompt_tests.rs+++ b/crates/openhuman-core/src/agent/registry/agents/mcp_agent/prompt_tests.rs@@ -32,7 +32,6 @@ fn empty_ctx() -> PromptContext<'static> {#[test]fn build_returns_nonempty_body() {let body = build(&empty_ctx()).unwrap();- assert!(!body.is_empty());assert!(body.contains("MCP Agent"));}diff --git a/crates/openhuman-core/src/agent/registry/agents/mcp_setup/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/mcp_setup/prompt_tests.rsindex 5da49683fb..8cab7e1231 100644--- a/crates/openhuman-core/src/agent/registry/agents/mcp_setup/prompt_tests.rs+++ b/crates/openhuman-core/src/agent/registry/agents/mcp_setup/prompt_tests.rs@@ -32,7 +32,6 @@ fn empty_ctx() -> PromptContext<'static> {#[test]fn build_returns_nonempty_body() {let body = build(&empty_ctx()).unwrap();- assert!(!body.is_empty());assert!(body.contains("MCP Setup Agent"));}diff --git a/crates/openhuman-core/src/agent/registry/agents/mod.rs b/crates/openhuman-core/src/agent/registry/agents/mod.rsindex c5605647a3..78d9de70d9 100644--- a/crates/openhuman-core/src/agent/registry/agents/mod.rs+++ b/crates/openhuman-core/src/agent/registry/agents/mod.rs@@ -28,6 +28,10 @@mod loader;+#[cfg(test)]+#[path = "fleet_prompt_tests.rs"]+mod fleet_prompt_tests;+pub mod archivist;pub mod code_executor;pub mod context_scout;diff --git a/crates/openhuman-core/src/agent/registry/agents/morning_briefing/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/morning_briefing/prompt_tests.rsindex f81c97e3a7..dc30afbf4b 100644--- a/crates/openhuman-core/src/agent/registry/agents/morning_briefing/prompt_tests.rs+++ b/crates/openhuman-core/src/agent/registry/agents/morning_briefing/prompt_tests.rs@@ -32,12 +32,6 @@ fn ctx_with_identity(identity: Option<UserIdentity>) -> PromptContext<'static> {}}-#[test]-fn build_returns_nonempty_body() {- let body = build(&ctx_with_identity(None)).unwrap();- assert!(!body.is_empty());-}-#[test]fn build_includes_runtime_and_datetime_sections() {// Issue #926 + #3602: the morning briefing must carry the `## Runtime`diff --git a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests.rsindex b8acbbdbb5..73af0581d7 100644--- a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests.rs+++ b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt_tests.rs@@ -151,7 +151,6 @@ fn ctx_with<'a>(integrations: &'a [ConnectedIntegration]) -> PromptContext<'a> {#[test]fn build_returns_nonempty_body() {let body = build(&ctx_with(&[])).unwrap();- assert!(!body.is_empty());assert!(!body.contains("## Connected Integrations"));// No live connections in unit context → the MCP block is omitted too.assert!(!body.contains("## Connected MCP Servers"));@@ -624,52 +623,13 @@ fn the_rendered_prompt_never_names_a_withheld_tool() {);}-/// Withheld tool names that `text` presents as directly callable.-///-/// Three exemptions, and all are about telling a *route* from a *call*:-///-/// * The generated `## Capabilities not in your tool list` block names withheld-/// tools on purpose — that block is the route, and it is the one sanctioned-/// place to write one. It is removed wholesale before scanning.-/// * A pack **id** may be backticked anywhere, since naming the skill is how a-/// route reads in prose. Two pack ids (`composio`, `goals`) are also tool-/// names inside their own pack, so a bare substring check cannot tell the-/// two apart; routes are always spelled ``skill `<id>` ``, so removing that-/// exact form is what makes the remaining occurrences calls.-/// * A full route — ``skill `<id>`, tool `<name>` ``, the exact spelling the-/// generated block emits — may name the tool it routes to, but only in that-/// form and only under the pack that owns it. A packed name backticked on its-/// own is still a call.+/// Packed tool names `text` presents as directly callable — the shared helper+/// scoped to the orchestrator, which owns no pack and so has every one withheld.fn withheld_names_presented_as_callable(text: &str) -> Vec<&'static str> {- let packed = crate::tools::toolpacks::all_packed_tool_names();- const HEADING: &str = "## Capabilities not in your tool list";- let mut prose = match text.find(HEADING) {- Some(start) => {- // Search for the next heading strictly after this one's own text- // (`start + HEADING.len()`, not `start + 1`) — both indices land on- // an ASCII byte, so this can never split a multi-byte UTF-8- // character or run past `text.len()`.- let search_from = start + HEADING.len();- let end = text[search_from..]- .find("\n## ")- .map(|i| search_from + i)- .unwrap_or(text.len());- format!("{}{}", &text[..start], &text[end..])- }- None => text.to_string(),- };- for pack in crate::tools::toolpacks::PACKS {- for name in pack.tools {- prose = prose.replace(&format!("skill `{}`, tool `{name}`", pack.id), "");- }- }- for name in &packed {- prose = prose.replace(&format!("skill `{name}`"), "");- }- packed- .into_iter()- .filter(|name| prose.contains(&format!("`{name}`")))- .collect()+ crate::agent::registry::agents::fleet_prompt_tests::names_presented_as_callable(+ text,+ crate::tools::toolpacks::all_packed_tool_names(),+ )}#[path = "prompt_tests_session_routing_tests.rs"]diff --git a/crates/openhuman-core/src/agent/registry/agents/planner/prompt.rs b/crates/openhuman-core/src/agent/registry/agents/planner/prompt.rsindex 6a158e278d..35aeb21cd1 100644--- a/crates/openhuman-core/src/agent/registry/agents/planner/prompt.rs+++ b/crates/openhuman-core/src/agent/registry/agents/planner/prompt.rs@@ -43,7 +43,3 @@ pub fn build(ctx: &PromptContext<'_>) -> Result<String> {Ok(out)}--#[cfg(test)]-#[path = "prompt_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/agent/registry/agents/planner/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/planner/prompt_tests.rsdeleted file mode 100644index 2acd046e23..0000000000--- a/crates/openhuman-core/src/agent/registry/agents/planner/prompt_tests.rs+++ /dev/null@@ -1,32 +0,0 @@-use super::*;-use crate::agent::context::prompt::{LearnedContextData, ToolCallFormat};-use std::collections::HashSet;--#[test]-fn build_returns_nonempty_body() {- let visible: HashSet<String> = HashSet::new();- let ctx = PromptContext {- workspace_dir: std::path::Path::new("."),- model_name: "test",- agent_id: "planner",- tools: &[],- workflows: &[],- dispatcher_instructions: "",- learned: LearnedContextData::default(),- visible_tool_names: &visible,- tool_call_format: ToolCallFormat::PFormat,- connected_integrations: &[],- connected_identities_md: String::new(),- include_profile: false,- include_memory_md: false,- curated_snapshot: None,- user_identity: None,- personality_soul_md: None,- personality_memory_md: None,- personality_roster: vec![],- agents_md_global: None,- agents_md_local: None,- };- let body = build(&ctx).unwrap();- assert!(!body.is_empty());-}diff --git a/crates/openhuman-core/src/agent/registry/agents/researcher/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/researcher/prompt_tests.rsindex 9a12bcf122..9c1c9be3a1 100644--- a/crates/openhuman-core/src/agent/registry/agents/researcher/prompt_tests.rs+++ b/crates/openhuman-core/src/agent/registry/agents/researcher/prompt_tests.rs@@ -28,7 +28,6 @@ fn build_returns_nonempty_body() {agents_md_local: None,};let body = build(&ctx).unwrap();- assert!(!body.is_empty());assert!(!body.contains("file_read") && !body.contains("file_write"),"researcher must not advertise workspace tools outside its search+fetch allowlist"diff --git a/crates/openhuman-core/src/agent/registry/agents/skill_creator/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/skill_creator/prompt_tests.rsindex 049ec31df2..cbbca51839 100644--- a/crates/openhuman-core/src/agent/registry/agents/skill_creator/prompt_tests.rs+++ b/crates/openhuman-core/src/agent/registry/agents/skill_creator/prompt_tests.rs@@ -28,6 +28,5 @@ fn build_returns_nonempty_body() {agents_md_local: None,};let body = build(&ctx).unwrap();- assert!(!body.is_empty());assert!(body.contains("Do not assume QuickJS exists."));}diff --git a/crates/openhuman-core/src/agent/registry/agents/summarizer/prompt.rs b/crates/openhuman-core/src/agent/registry/agents/summarizer/prompt.rsindex 127f0b881c..415702c1fd 100644--- a/crates/openhuman-core/src/agent/registry/agents/summarizer/prompt.rs+++ b/crates/openhuman-core/src/agent/registry/agents/summarizer/prompt.rs@@ -53,7 +53,3 @@ pub fn build(ctx: &PromptContext<'_>) -> Result<String> {Ok(out)}--#[cfg(test)]-#[path = "prompt_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/agent/registry/agents/summarizer/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/summarizer/prompt_tests.rsdeleted file mode 100644index 11e49c22ac..0000000000--- a/crates/openhuman-core/src/agent/registry/agents/summarizer/prompt_tests.rs+++ /dev/null@@ -1,32 +0,0 @@-use super::*;-use crate::agent::context::prompt::{LearnedContextData, ToolCallFormat};-use std::collections::HashSet;--#[test]-fn build_returns_nonempty_body() {- let visible: HashSet<String> = HashSet::new();- let ctx = PromptContext {- workspace_dir: std::path::Path::new("."),- model_name: "test",- agent_id: "summarizer",- tools: &[],- workflows: &[],- dispatcher_instructions: "",- learned: LearnedContextData::default(),- visible_tool_names: &visible,- tool_call_format: ToolCallFormat::PFormat,- connected_integrations: &[],- connected_identities_md: String::new(),- include_profile: false,- include_memory_md: false,- curated_snapshot: None,- user_identity: None,- personality_soul_md: None,- personality_memory_md: None,- personality_roster: vec![],- agents_md_global: None,- agents_md_local: None,- };- let body = build(&ctx).unwrap();- assert!(!body.is_empty());-}diff --git a/crates/openhuman-core/src/agent/registry/agents/tool_maker/prompt.rs b/crates/openhuman-core/src/agent/registry/agents/tool_maker/prompt.rsindex 375d5d4248..8497db8935 100644--- a/crates/openhuman-core/src/agent/registry/agents/tool_maker/prompt.rs+++ b/crates/openhuman-core/src/agent/registry/agents/tool_maker/prompt.rs@@ -41,7 +41,3 @@ pub fn build(ctx: &PromptContext<'_>) -> Result<String> {Ok(out)}--#[cfg(test)]-#[path = "prompt_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/agent/registry/agents/tool_maker/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/tool_maker/prompt_tests.rsdeleted file mode 100644index d02effb733..0000000000--- a/crates/openhuman-core/src/agent/registry/agents/tool_maker/prompt_tests.rs+++ /dev/null@@ -1,32 +0,0 @@-use super::*;-use crate::agent::context::prompt::{LearnedContextData, ToolCallFormat};-use std::collections::HashSet;--#[test]-fn build_returns_nonempty_body() {- let visible: HashSet<String> = HashSet::new();- let ctx = PromptContext {- workspace_dir: std::path::Path::new("."),- model_name: "test",- agent_id: "tool_maker",- tools: &[],- workflows: &[],- dispatcher_instructions: "",- learned: LearnedContextData::default(),- visible_tool_names: &visible,- tool_call_format: ToolCallFormat::PFormat,- connected_integrations: &[],- connected_identities_md: String::new(),- include_profile: false,- include_memory_md: false,- curated_snapshot: None,- user_identity: None,- personality_soul_md: None,- personality_memory_md: None,- personality_roster: vec![],- agents_md_global: None,- agents_md_local: None,- };- let body = build(&ctx).unwrap();- assert!(!body.is_empty());-}diff --git a/crates/openhuman-core/src/agent/registry/agents/tools_agent/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/tools_agent/prompt_tests.rsindex 8913730895..f9e225cdd7 100644--- a/crates/openhuman-core/src/agent/registry/agents/tools_agent/prompt_tests.rs+++ b/crates/openhuman-core/src/agent/registry/agents/tools_agent/prompt_tests.rs@@ -28,6 +28,5 @@ fn build_returns_nonempty_body() {agents_md_local: None,};let body = build(&ctx).unwrap();- assert!(!body.is_empty());assert!(body.contains("Tools Agent"));}diff --git a/crates/openhuman-core/src/agent/registry/agents/trigger_reactor/prompt.rs b/crates/openhuman-core/src/agent/registry/agents/trigger_reactor/prompt.rsindex c4f92e6359..d268ff4125 100644--- a/crates/openhuman-core/src/agent/registry/agents/trigger_reactor/prompt.rs+++ b/crates/openhuman-core/src/agent/registry/agents/trigger_reactor/prompt.rs@@ -37,7 +37,3 @@ pub fn build(ctx: &PromptContext<'_>) -> Result<String> {Ok(out)}--#[cfg(test)]-#[path = "prompt_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/agent/registry/agents/trigger_reactor/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/trigger_reactor/prompt_tests.rsdeleted file mode 100644index c15da02f2a..0000000000--- a/crates/openhuman-core/src/agent/registry/agents/trigger_reactor/prompt_tests.rs+++ /dev/null@@ -1,32 +0,0 @@-use super::*;-use crate::agent::context::prompt::{LearnedContextData, ToolCallFormat};-use std::collections::HashSet;--#[test]-fn build_returns_nonempty_body() {- let visible: HashSet<String> = HashSet::new();- let ctx = PromptContext {- workspace_dir: std::path::Path::new("."),- model_name: "test",- agent_id: "trigger_reactor",- tools: &[],- workflows: &[],- dispatcher_instructions: "",- learned: LearnedContextData::default(),- visible_tool_names: &visible,- tool_call_format: ToolCallFormat::PFormat,- connected_integrations: &[],- connected_identities_md: String::new(),- include_profile: false,- include_memory_md: false,- curated_snapshot: None,- user_identity: None,- personality_soul_md: None,- personality_memory_md: None,- personality_roster: vec![],- agents_md_global: None,- agents_md_local: None,- };- let body = build(&ctx).unwrap();- assert!(!body.is_empty());-}diff --git a/crates/openhuman-core/src/agent/registry/agents/trigger_triage/prompt.rs b/crates/openhuman-core/src/agent/registry/agents/trigger_triage/prompt.rsindex a36093caf7..36d4511256 100644--- a/crates/openhuman-core/src/agent/registry/agents/trigger_triage/prompt.rs+++ b/crates/openhuman-core/src/agent/registry/agents/trigger_triage/prompt.rs@@ -37,7 +37,3 @@ pub fn build(ctx: &PromptContext<'_>) -> Result<String> {Ok(out)}--#[cfg(test)]-#[path = "prompt_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/agent/registry/agents/trigger_triage/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/trigger_triage/prompt_tests.rsdeleted file mode 100644index 5025fe1ec6..0000000000--- a/crates/openhuman-core/src/agent/registry/agents/trigger_triage/prompt_tests.rs+++ /dev/null@@ -1,32 +0,0 @@-use super::*;-use crate::agent::context::prompt::{LearnedContextData, ToolCallFormat};-use std::collections::HashSet;--#[test]-fn build_returns_nonempty_body() {- let visible: HashSet<String> = HashSet::new();- let ctx = PromptContext {- workspace_dir: std::path::Path::new("."),- model_name: "test",- agent_id: "trigger_triage",- tools: &[],- workflows: &[],- dispatcher_instructions: "",- learned: LearnedContextData::default(),- visible_tool_names: &visible,- tool_call_format: ToolCallFormat::PFormat,- connected_integrations: &[],- connected_identities_md: String::new(),- include_profile: false,- include_memory_md: false,- curated_snapshot: None,- user_identity: None,- personality_soul_md: None,- personality_memory_md: None,- personality_roster: vec![],- agents_md_global: None,- agents_md_local: None,- };- let body = build(&ctx).unwrap();- assert!(!body.is_empty());-}diff --git a/crates/openhuman-core/src/agent/registry/agents/vision_agent/prompt.rs b/crates/openhuman-core/src/agent/registry/agents/vision_agent/prompt.rsindex 45c3678e98..5c8eb52613 100644--- a/crates/openhuman-core/src/agent/registry/agents/vision_agent/prompt.rs+++ b/crates/openhuman-core/src/agent/registry/agents/vision_agent/prompt.rs@@ -36,7 +36,3 @@ pub fn build(ctx: &PromptContext<'_>) -> Result<String> {Ok(out)}--#[cfg(test)]-#[path = "prompt_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/agent/registry/agents/vision_agent/prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/vision_agent/prompt_tests.rsdeleted file mode 100644index c4b8764412..0000000000--- a/crates/openhuman-core/src/agent/registry/agents/vision_agent/prompt_tests.rs+++ /dev/null@@ -1,32 +0,0 @@-use super::*;-use crate::agent::context::prompt::{LearnedContextData, ToolCallFormat};-use std::collections::HashSet;--#[test]-fn build_returns_nonempty_body() {- let visible: HashSet<String> = HashSet::new();- let ctx = PromptContext {- workspace_dir: std::path::Path::new("."),- model_name: "vision-v1",- agent_id: "vision_agent",- tools: &[],- workflows: &[],- dispatcher_instructions: "",- learned: LearnedContextData::default(),- visible_tool_names: &visible,- tool_call_format: ToolCallFormat::PFormat,- connected_integrations: &[],- connected_identities_md: String::new(),- include_profile: false,- include_memory_md: false,- curated_snapshot: None,- user_identity: None,- personality_soul_md: None,- personality_memory_md: None,- personality_roster: vec![],- agents_md_global: None,- agents_md_local: None,- };- let body = build(&ctx).unwrap();- assert!(!body.is_empty());-}diff --git a/crates/openhuman-core/src/flows/agents/flow_discovery/prompt_tests.rs b/crates/openhuman-core/src/flows/agents/flow_discovery/prompt_tests.rsindex 75f2e85e21..acba1c3afa 100644--- a/crates/openhuman-core/src/flows/agents/flow_discovery/prompt_tests.rs+++ b/crates/openhuman-core/src/flows/agents/flow_discovery/prompt_tests.rs@@ -29,12 +29,6 @@ fn ctx() -> PromptContext<'static> {}}-#[test]-fn build_returns_nonempty_body() {- let body = build(&ctx()).unwrap();- assert!(!body.is_empty());-}-#[test]fn prompt_teaches_the_read_only_emit_invariant() {let body = build(&ctx()).unwrap();diff --git a/crates/openhuman-core/src/flows/agents/workflow_builder/prompt.rs b/crates/openhuman-core/src/flows/agents/workflow_builder/prompt.rsindex de815523e9..66e1d1f45f 100644--- a/crates/openhuman-core/src/flows/agents/workflow_builder/prompt.rs+++ b/crates/openhuman-core/src/flows/agents/workflow_builder/prompt.rs@@ -39,7 +39,3 @@ pub fn build(ctx: &PromptContext<'_>) -> Result<String> {Ok(out)}--#[cfg(test)]-#[path = "prompt_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/flows/agents/workflow_builder/prompt_tests.rs b/crates/openhuman-core/src/flows/agents/workflow_builder/prompt_tests.rsdeleted file mode 100644index d7a1d6d086..0000000000--- a/crates/openhuman-core/src/flows/agents/workflow_builder/prompt_tests.rs+++ /dev/null@@ -1,50 +0,0 @@-use super::*;-use crate::agent::context::prompt::{LearnedContextData, ToolCallFormat};-use std::collections::HashSet;--fn ctx() -> PromptContext<'static> {- static VISIBLE: std::sync::OnceLock<HashSet<String>> = std::sync::OnceLock::new();- let visible = VISIBLE.get_or_init(HashSet::new);- PromptContext {- workspace_dir: std::path::Path::new("."),- model_name: "test",- agent_id: "workflow_builder",- tools: &[],- workflows: &[],- dispatcher_instructions: "",- learned: LearnedContextData::default(),- visible_tool_names: visible,- tool_call_format: ToolCallFormat::PFormat,- connected_integrations: &[],- connected_identities_md: String::new(),- include_profile: false,- include_memory_md: false,- curated_snapshot: None,- user_identity: None,- personality_soul_md: None,- personality_memory_md: None,- personality_roster: vec![],- agents_md_global: None,- agents_md_local: None,- }-}--#[test]-fn build_returns_nonempty_body() {- let body = build(&ctx()).unwrap();- assert!(!body.is_empty());-}--// A test asserting `body.to_lowercase().contains("propose")` used to live-// here. It was near-tautological: "propose"/"proposal"/"propose_workflow"-// appear dozens of times throughout the archetype regardless of whether-// the propose-only invariant is actually taught correctly, so the-// assertion could not fail in any way that mattered (P-m5). The real-// invariant — every authoring turn is propose-only, persistence gated-// behind the user's explicit ask — is pinned with specific, falsifiable-// substrings in `builder_prompt.rs`: `create_prompt_frames_propose_only`,-// `build_is_propose_only_and_injects_flow_id_as_context` (the #4596-// regression guard), and the `standing_prompt_*` tests that assert exact-// phrases like "Do NOT save_workflow" and "Do not save, enable, or run-// anything". Removed rather than strengthened to avoid duplicating that-// coverage here.