Skip to content

#1 Persistent memory for AI coding agents based on real-world benchmarks

fix(hermes): seed AGENTMEMORY_URL default at import (closes #520) (#643)

Rohit Ghumared38a1c6950c1
diff --git a/integrations/hermes/__init__.py b/integrations/hermes/__init__.py
index a93026c0..2933632d 100644
--- a/integrations/hermes/__init__.py
+++ b/integrations/hermes/__init__.py
@@ -90,6 +90,11 @@ def _preload_agentmemory_dotenv() -> None:
os.environ.setdefault(key, value)
except (OSError, UnicodeDecodeError):
continue
+ # Guarantee AGENTMEMORY_URL is set so `hermes memory status` never
+ # reports it as Missing when a user runs agentmemory at the default
+ # localhost:3111 (or via systemd with the URL line commented out in
+ # ~/.agentmemory/.env because it matches the default). #520.
+ os.environ.setdefault("AGENTMEMORY_URL", DEFAULT_BASE_URL)
_preload_agentmemory_dotenv()
diff --git a/test/hermes-plugin.test.ts b/test/hermes-plugin.test.ts
index f13f06f3..70ea8544 100644
--- a/test/hermes-plugin.test.ts
+++ b/test/hermes-plugin.test.ts
@@ -61,4 +61,11 @@ describe("Hermes plugin manifest", () => {
expect([...declaredHooks].sort()).toEqual([...implementedHooks].sort());
expect(declaredHooks).toEqual(expectedHermesHooks);
});
+
+ it("preloads AGENTMEMORY_URL default at import time (#520)", () => {
+ const source = readFileSync("integrations/hermes/__init__.py", "utf8");
+ expect(source).toMatch(
+ /os\.environ\.setdefault\(\s*["']AGENTMEMORY_URL["']\s*,\s*DEFAULT_BASE_URL\s*\)/,
+ );
+ });
});