Skip to content

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

feat(orchestrator): include specialist descriptions in withheld roster

Steven Enamakel82366df16e63
diff --git a/crates/openhuman-core/src/agent_registry/agents/orchestrator/prompt.rs b/crates/openhuman-core/src/agent_registry/agents/orchestrator/prompt.rs
index 96dc461d58..95eef83121 100644
--- a/crates/openhuman-core/src/agent_registry/agents/orchestrator/prompt.rs
+++ b/crates/openhuman-core/src/agent_registry/agents/orchestrator/prompt.rs
@@ -165,7 +165,7 @@ fn render_withheld_specialists(ctx: &PromptContext<'_>) -> String {
return String::new();
};
- let mut rows: Vec<(String, &'static str)> = Vec::new();
+ let mut rows: Vec<(String, &'static str, String)> = Vec::new();
for entry in &definition.subagents {
// `Skills(_)` expands to searchable integration actions, not a
// delegate tool; the `## Connected Integrations` block covers them.
@@ -192,7 +192,7 @@ fn render_withheld_specialists(ctx: &PromptContext<'_>) -> String {
// belt never listed it, so there is no route to describe.
continue;
};
- rows.push((tool_name, pack.id));
+ rows.push((tool_name, pack.id, target.when_to_use.clone()));
}
if rows.is_empty() {
@@ -209,17 +209,26 @@ fn render_withheld_specialists(ctx: &PromptContext<'_>) -> String {
"[orchestrator-prompt] rendering withheld-specialist routing"
);
- // One line per pack, tools named without their blurbs: `use_skill`'s own
- // description already carries a one-line summary of every pack, and the
- // full `when_to_use` arrives with the schema once the pack is loaded.
- let mut by_pack: std::collections::BTreeMap<&'static str, Vec<String>> =
+ // Keep the live specialist roster in the prompt even when the tool schema
+ // is packed away. Escape registry text before placing it into prompt markup.
+ let mut by_pack: std::collections::BTreeMap<&'static str, Vec<(String, String)>> =
std::collections::BTreeMap::new();
- for (tool, pack) in rows {
- by_pack.entry(pack).or_default().push(tool);
+ for (tool, pack, description) in rows {
+ by_pack
+ .entry(pack)
+ .or_default()
+ .push((tool, prompt_safe(&description)));
}
let entries: Vec<String> = by_pack
.into_iter()
- .map(|(pack, tools)| format!("`{pack}` ({})", tools.join(", ")))
+ .map(|(pack, tools)| {
+ let roster = tools
+ .into_iter()
+ .map(|(tool, description)| format!("`{tool}`: {description}"))
+ .collect::<Vec<_>>()
+ .join(", ");
+ format!("`{pack}` ({roster})")
+ })
.collect();
format!(
"## Capabilities not in your tool list\n\nVia `use_skill`: {}.",
@@ -227,6 +236,17 @@ fn render_withheld_specialists(ctx: &PromptContext<'_>) -> String {
)
}
+fn prompt_safe(value: &str) -> String {
+ value
+ .chars()
+ .map(|ch| match ch {
+ '`' => "'".to_string(),
+ ch if ch.is_control() => format!("\\u{{{:x}}}", ch as u32),
+ ch => ch.to_string(),
+ })
+ .collect()
+}
+
/// How this session can reach `specialist` right now, as the call to name.
///
/// The hand-off tool in backticks when it is on the belt; the `use_skill` form