diff --git a/crates/goose/src/agents/prompt_manager.rs b/crates/goose/src/agents/prompt_manager.rs index 1a257ab892..f464af7df9 100644 --- a/crates/goose/src/agents/prompt_manager.rs +++ b/crates/goose/src/agents/prompt_manager.rs @@ -9,6 +9,7 @@ use crate::{config::Config, prompt_template}; pub struct PromptManager { system_prompt_override: Option, system_prompt_extras: Vec, + current_date_timestamp: String, } impl Default for PromptManager { @@ -22,6 +23,8 @@ impl PromptManager { PromptManager { system_prompt_override: None, system_prompt_extras: Vec::new(), + // Use the fixed current date time so that prompt cache can be used. + current_date_timestamp: Utc::now().format("%Y-%m-%d %H:%M:%S").to_string(), } } @@ -79,8 +82,10 @@ impl PromptManager { context.insert("extensions", serde_json::to_value(extensions_info).unwrap()); - let current_date_time = Utc::now().format("%Y-%m-%d %H:%M:%S").to_string(); - context.insert("current_date_time", Value::String(current_date_time)); + context.insert( + "current_date_time", + Value::String(self.current_date_timestamp.clone()), + ); // Add the suggestion about disabling extensions if flag is true context.insert(