Skip to content

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

refactor(prompts): move prompt composition into the prompts module

Steven Enamakelc89f0e0d4894
diff --git a/crates/openhuman-core/src/agent/prompts/mod.rs b/crates/openhuman-core/src/agent/prompts/mod.rs
index 21040828e6..392e541509 100644
--- a/crates/openhuman-core/src/agent/prompts/mod.rs
+++ b/crates/openhuman-core/src/agent/prompts/mod.rs
@@ -1,6 +1,4 @@
-//! Bundled prompt assets and system-prompt rendering pipeline. See
-//! [`README.md`](README.md) for the section/builder model and the
-//! `agent::prompts`.
+//! Bundled prompt assets and OpenHuman-specific agent prompt adapters.
pub mod types;
pub use types::*;
@@ -8,12 +6,10 @@ pub use types::*;
pub mod agents_md;
pub use agents_md::{load_agents_md, load_agents_md_layers, AgentsMdContent, AGENTS_MD_FILENAME};
-pub mod builder;
-pub use builder::{SystemPromptBuilder, TieredPrompt, GLOBAL_STYLE_SUFFIX};
+pub use crate::prompts::composition::{SystemPromptBuilder, TieredPrompt, GLOBAL_STYLE_SUFFIX};
#[path = "render_helpers/subagent.rs"]
mod subagent;
-pub(crate) use subagent::harness_json_tool_prompt;
pub use subagent::{render_subagent_system_prompt, render_subagent_system_prompt_with_format};
#[cfg(test)]
diff --git a/crates/openhuman-core/src/agent/prompts/types.rs b/crates/openhuman-core/src/agent/prompts/types.rs
index 18d1283351..fc6ac61dc9 100644
--- a/crates/openhuman-core/src/agent/prompts/types.rs
+++ b/crates/openhuman-core/src/agent/prompts/types.rs
@@ -1,12 +1,7 @@
//! Data types shared across the prompt-plumbing pipeline.
//!
-//! Everything in this file is pure data (structs, enums, traits,
-//! constants). The rendering logic — section implementations,
-//! `SystemPromptBuilder`, `render_subagent_system_prompt` — lives in
-//! the sibling `mod.rs` so type edits don't pull in the whole 2 000-line
-//! renderer.
+//! Data shared by OpenHuman's agent prompt adapters.
-use anyhow::Result;
use std::path::Path;
use tinyskills::Skill as Workflow;
use tinytools::Tool;
diff --git a/crates/openhuman-core/src/prompts/composition.rs b/crates/openhuman-core/src/prompts/composition.rs
index cda71aadb5..964353d470 100644
--- a/crates/openhuman-core/src/prompts/composition.rs
+++ b/crates/openhuman-core/src/prompts/composition.rs
@@ -1,12 +1,10 @@
//! OpenHuman's product-specific system-prompt selection and additions.
use crate::agent::prompts::types::{
- PromptContext, PromptTier, TieredPromptPart, PROMPT_TIER_CONTEXT_MARKER,
- PROMPT_TIER_VOLATILE_MARKER,
+ PromptContext, PromptTier, TieredPromptPart,
};
use crate::prompts::sections::*;
use anyhow::{Result, anyhow};
-use std::ops::Deref;
use std::path::Path;
use tinyagents_harness::prompt::{DynamicPromptSection, PromptComposer};
@@ -140,16 +138,6 @@ impl TieredPrompt {
}
}
-impl Deref for TieredPrompt {
- type Target = tinyagents_harness::prompt::TieredPrompt;
-
- fn deref(&self) -> &Self::Target {
- // The compatibility view owns the same fields, but keeping this impl
- // absent would make the host's historical field access ambiguous.
- unreachable!("TieredPrompt field access uses the compatibility fields")
- }
-}
-
/// Selects OpenHuman-owned prompt content, then delegates tier assembly to
/// TinyAgents' `PromptComposer`.
#[derive(Clone)]
@@ -245,6 +233,3 @@ impl SystemPromptBuilder {
}
}
-fn _dynamic_markers_are_owner_constants() -> (&'static str, &'static str) {
- (PROMPT_TIER_CONTEXT_MARKER, PROMPT_TIER_VOLATILE_MARKER)
-}
diff --git a/crates/openhuman-core/src/prompts/mod.rs b/crates/openhuman-core/src/prompts/mod.rs
index e3bd43462e..ecf18de178 100644
--- a/crates/openhuman-core/src/prompts/mod.rs
+++ b/crates/openhuman-core/src/prompts/mod.rs
@@ -1,6 +1,8 @@
//! Prompt product copy and rendering helpers used by agent and channel prompts.
pub mod sections;
+pub mod composition;
+pub use composition::{SystemPromptBuilder, TieredPrompt, GLOBAL_STYLE_SUFFIX};
#[path = "section_renderers.rs"]
mod section_renderers;