Skip to content

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

refactor(prompts): flatten render_helpers module into prompts

Steven Enamakeld45c0458bf85
diff --git a/crates/openhuman-core/src/agent/prompts/builder.rs b/crates/openhuman-core/src/agent/prompts/builder.rs
index a365cd44c0..37d8bcdff0 100644
--- a/crates/openhuman-core/src/agent/prompts/builder.rs
+++ b/crates/openhuman-core/src/agent/prompts/builder.rs
@@ -51,8 +51,8 @@ impl TieredPrompt {
}
}
-use super::render_helpers::sync_workspace_file;
use super::sections::*;
+use super::sync_workspace_file;
use super::types::*;
use anyhow::Result;
use std::path::Path;
diff --git a/crates/openhuman-core/src/agent/prompts/render_helpers.rs b/crates/openhuman-core/src/agent/prompts/render_helpers.rs
deleted file mode 100644
index 5f0b76779a..0000000000
--- a/crates/openhuman-core/src/agent/prompts/render_helpers.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-//! Free `render_*` functions, sub-agent prompt renderer, and workspace-file
-//! I/O helpers.
-//!
-//! The `render_*` family provides a functional interface over the section
-//! structs in [`super::sections`] — `agents/<id>/prompt.rs` builders call
-//! these to assemble their own final system prompt without needing the full
-//! [`super::builder::SystemPromptBuilder`] machinery.
-//!
-//! Split by responsibility:
-//! - [`section_renderers`] — the `render_*` wrappers, per-turn datetime stamp,
-//! and ambient-environment composer.
-//! - [`subagent`] — the narrow KV-cache-stable sub-agent prompt renderer.
-//! - [`workspace_files`] — workspace-file seeding and prompt injection.
-
-mod section_renderers;
-mod subagent;
-mod workspace_files;
-
-pub use section_renderers::{
- current_datetime_line, render_ambient_environment, render_datetime, render_identity,
- render_runtime, render_safety, render_tools, render_user_identity, render_workspace,
- turn_preamble,
-};
-pub(crate) use subagent::harness_json_tool_prompt;
-pub use subagent::{render_subagent_system_prompt, render_subagent_system_prompt_with_format};
-pub(crate) use workspace_files::write_agents_md_blocks;
-pub use workspace_files::{
- default_workspace_file_content, inject_inline_content, inject_workspace_file,
- inject_workspace_file_capped, sync_workspace_file,
-};
diff --git a/crates/openhuman-core/src/agent/prompts/sections.rs b/crates/openhuman-core/src/agent/prompts/sections.rs
index 951c622405..3367d90b71 100644
--- a/crates/openhuman-core/src/agent/prompts/sections.rs
+++ b/crates/openhuman-core/src/agent/prompts/sections.rs
@@ -5,13 +5,13 @@
//! [`super::render_helpers`] for workspace-file injection and
//! sub-agent plumbing.
-use super::render_helpers::{inject_workspace_file, sync_workspace_file};
use super::types::*;
+use super::{inject_workspace_file, sync_workspace_file};
use anyhow::Result;
use std::fmt::Write;
use tinytools::ToolSpec;
-use tinytools_agent::dialect::render_pformat_catalogue;
use tinytools_agent::dialect::ToolCallFormat;
+use tinytools_agent::dialect::render_pformat_catalogue;
// ─────────────────────────────────────────────────────────────────────────────
// Special sections (archetype, dynamic)
@@ -227,7 +227,7 @@ impl PromptSection for AgentsInstructionsSection {
fn build(&self, ctx: &PromptContext<'_>) -> Result<String> {
let mut out = String::new();
- super::render_helpers::write_agents_md_blocks(
+ super::write_agents_md_blocks(
&mut out,
ctx.agents_md_global.as_deref(),
ctx.agents_md_local.as_deref(),
@@ -458,7 +458,7 @@ impl PromptSection for DateTimeSection {
fn build(&self, ctx: &PromptContext<'_>) -> Result<String> {
// No concrete timestamp here. The live "now" is injected per turn
- // on the user message via `render_helpers::current_datetime_line`
+ // on the user message via `current_datetime_line`
// (the main session loop and the sub-agent runner both do this), so
// it stays fresh across a long-lived session instead of freezing
// into the cached system-prompt prefix and going stale (#3602).
diff --git a/crates/openhuman-core/src/agent/subagent_host/tool_prep.rs b/crates/openhuman-core/src/agent/subagent_host/tool_prep.rs
index 8010ea2212..9b50b11831 100644
--- a/crates/openhuman-core/src/agent/subagent_host/tool_prep.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/tool_prep.rs
@@ -38,9 +38,7 @@ pub(crate) fn subagent_prompt_protocol(
// The native request carries its own structured catalogue; retain
// only the dialect guidance in the text prompt.
ToolCallFormat::Native => NativeDialect.prompt_instructions(&[]),
- ToolCallFormat::Json => {
- crate::agent::prompts::render_helpers::harness_json_tool_prompt(tools)
- }
+ ToolCallFormat::Json => crate::agent::prompts::harness_json_tool_prompt(tools),
ToolCallFormat::Python => CodeDialect::instructions(CodeStyle::Python),
ToolCallFormat::TypeScript => CodeDialect::instructions(CodeStyle::TypeScript),
};