Skip to content

Your lightweight open-source personal agent.

fix(memory): prevent potential loss of compressed session history

Lingao Meng31c154a7b8f7
diff --git a/nanobot/agent/context.py b/nanobot/agent/context.py
index 1f4064851..1b8cae050 100644
--- a/nanobot/agent/context.py
+++ b/nanobot/agent/context.py
@@ -48,6 +48,10 @@ class ContextBuilder:
if skills_summary:
parts.append(render_template("agent/skills_section.md", skills_summary=skills_summary))
+ entries = self.memory.read_unprocessed_history(since_cursor=self.memory.get_last_dream_cursor())
+ if entries:
+ parts.append("# Recent History\n\n" + "\n".join(f"- {entry['content']}" for entry in entries))
+
return "\n\n---\n\n".join(parts)
def _get_identity(self) -> str: