Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix(memory): repair Dream follow-up paths and move GitStore to utils
Xubin Ren7e0c19679735
diff --git a/nanobot/agent/memory.py b/nanobot/agent/memory.pyindex ab7691e86..e2bb9e176 100644--- a/nanobot/agent/memory.py+++ b/nanobot/agent/memory.py@@ -15,7 +15,7 @@ from nanobot.utils.helpers import ensure_dir, estimate_message_tokens, estimate_from nanobot.agent.runner import AgentRunSpec, AgentRunnerfrom nanobot.agent.tools.registry import ToolRegistry-from nanobot.agent.git_store import GitStore+from nanobot.utils.git_store import GitStoreif TYPE_CHECKING:from nanobot.providers.base import LLMProvider@@ -569,6 +569,7 @@ class Dream:# Git auto-commit (only when there are actual changes)if changelog and self.store.git.is_initialized():+ ts = batch[-1]["timestamp"]sha = self.store.git.auto_commit(f"dream: {ts}, {len(changelog)} change(s)")if sha:logger.info("Dream commit: {}", sha)diff --git a/nanobot/command/builtin.py b/nanobot/command/builtin.pyindex e961d22b0..206420145 100644--- a/nanobot/command/builtin.py+++ b/nanobot/command/builtin.py@@ -136,7 +136,8 @@ async def cmd_dream_log(ctx: CommandContext) -> OutboundMessage:content = commit.format(diff)else:# Default: show the latest commit's diff- result = git.show_commit_diff(git.log(max_entries=1)[0].sha) if git.log(max_entries=1) else None+ commits = git.log(max_entries=1)+ result = git.show_commit_diff(commits[0].sha) if commits else Noneif result:commit, diff = resultcontent = commit.format(diff)diff --git a/nanobot/agent/git_store.py b/nanobot/utils/git_store.pysimilarity index 100%rename from nanobot/agent/git_store.pyrename to nanobot/utils/git_store.pydiff --git a/nanobot/utils/helpers.py b/nanobot/utils/helpers.pyindex 93f8ce272..d82037c00 100644--- a/nanobot/utils/helpers.py+++ b/nanobot/utils/helpers.py@@ -457,7 +457,7 @@ def sync_workspace_templates(workspace: Path, silent: bool = False) -> list[str]# Initialize git for memory version controltry:- from nanobot.agent.git_store import GitStore+ from nanobot.utils.git_store import GitStoregs = GitStore(workspace, tracked_files=["SOUL.md", "USER.md", "memory/MEMORY.md",])diff --git a/tests/agent/test_git_store.py b/tests/agent/test_git_store.pyindex 569bf34ab..285e7803b 100644--- a/tests/agent/test_git_store.py+++ b/tests/agent/test_git_store.py@@ -3,7 +3,7 @@import pytestfrom pathlib import Path-from nanobot.agent.git_store import GitStore, CommitInfo+from nanobot.utils.git_store import GitStore, CommitInfoTRACKED = ["SOUL.md", "USER.md", "memory/MEMORY.md"]@@ -181,7 +181,7 @@ class TestShowCommitDiff:class TestCommitInfoFormat:def test_format_with_diff(self):- from nanobot.agent.git_store import CommitInfo+ from nanobot.utils.git_store import CommitInfoc = CommitInfo(sha="abcd1234", message="test commit\nsecond line", timestamp="2026-04-02 12:00")result = c.format(diff="some diff")assert "test commit" in result@@ -189,7 +189,7 @@ class TestCommitInfoFormat:assert "some diff" in resultdef test_format_without_diff(self):- from nanobot.agent.git_store import CommitInfo+ from nanobot.utils.git_store import CommitInfoc = CommitInfo(sha="abcd1234", message="test", timestamp="2026-04-02 12:00")result = c.format()assert "(no file changes)" in result