diff --git a/src/agent/context.rs b/src/agent/context.rs index 2b8bf34..2e54391 100644 --- a/src/agent/context.rs +++ b/src/agent/context.rs @@ -764,7 +764,7 @@ impl ContextState { pub fn conversation(&self) -> &[AstNode] { &self.conversation } pub fn conversation_mut(&mut self) -> &mut Vec { &mut self.conversation } - fn sections(&self) -> [&Vec; 4] { + pub fn sections(&self) -> [&Vec; 4] { [&self.system, &self.identity, &self.journal, &self.conversation] } } diff --git a/src/mind/unconscious.rs b/src/mind/unconscious.rs index a137fe0..0f87b17 100644 --- a/src/mind/unconscious.rs +++ b/src/mind/unconscious.rs @@ -309,14 +309,11 @@ pub async fn save_agent_log(name: &str, agent: &std::sync::Arc = Vec::new(); + for section in ctx.sections() { + context.extend(section); + } + if let Ok(json) = serde_json::to_string_pretty(&context) { let _ = std::fs::write(&path, json); } }