User configurable templates (#6420)

Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
Douwe Osinga
2026-01-20 17:15:52 -05:00
committed by GitHub
parent 5a04ee8700
commit 2f083b827a
23 changed files with 1052 additions and 307 deletions
+1 -1
View File
@@ -848,7 +848,7 @@ impl ExtensionManager {
let mut context: HashMap<&str, Value> = HashMap::new();
context.insert("tools", serde_json::to_value(tools_info).unwrap());
prompt_template::render_global_file("plan.md", &context).expect("Prompt should render")
prompt_template::render_template("plan.md", &context).expect("Prompt should render")
}
/// Find and return a reference to the appropriate client for a tool call
+3 -3
View File
@@ -161,9 +161,9 @@ impl<'a> SystemPromptBuilder<'a, PromptManager> {
let base_prompt = if let Some(override_prompt) = &self.manager.system_prompt_override {
let sanitized_override_prompt = sanitize_unicode_tags(override_prompt);
prompt_template::render_inline_once(&sanitized_override_prompt, &context)
prompt_template::render_string(&sanitized_override_prompt, &context)
} else {
prompt_template::render_global_file("system.md", &context)
prompt_template::render_template("system.md", &context)
}
.unwrap_or_else(|_| {
"You are a general-purpose AI agent called goose, created by Block".to_string()
@@ -245,7 +245,7 @@ impl PromptManager {
pub async fn get_recipe_prompt(&self) -> String {
let context: HashMap<&str, Value> = HashMap::new();
prompt_template::render_global_file("recipe.md", &context)
prompt_template::render_template("recipe.md", &context)
.unwrap_or_else(|_| "The recipe prompt is busted. Tell the user.".to_string())
}
}
+2 -2
View File
@@ -1,7 +1,7 @@
use crate::{
agents::{subagent_task_config::TaskConfig, Agent, AgentConfig, AgentEvent, SessionConfig},
conversation::{message::Message, Conversation},
prompt_template::render_global_file,
prompt_template::render_template,
recipe::Recipe,
};
use anyhow::{anyhow, Result};
@@ -148,7 +148,7 @@ fn get_agent_messages(
.await;
let tools = agent.list_tools(&session_id, None).await;
let subagent_prompt = render_global_file(
let subagent_prompt = render_template(
"subagent_system.md",
&SubagentPromptContext {
max_turns: task_config