Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix(hermes-plugin): stop list recall from repeating the session-start profile (#6397)

t0sakie63eb0d84d24
diff --git a/examples/hermes-plugin/__init__.py b/examples/hermes-plugin/__init__.py
index 3407799a2..587239295 100644
--- a/examples/hermes-plugin/__init__.py
+++ b/examples/hermes-plugin/__init__.py
@@ -2570,6 +2570,9 @@ class OpenVikingMemoryProvider(MemoryProvider):
uri = str(item.get("uri") or "").strip()
if not uri or uri in seen_uri or cls._clamp_score(item.get("score")) < score_threshold:
continue
+ # The session-start block already carries the profile; context mode drops it server-side.
+ if uri.rstrip("/").endswith("/memories/profile.md"):
+ continue
abstract = " ".join(cls._recall_abstract(item).lower().split())
if abstract and "/events/" not in uri.lower() and "/cases/" not in uri.lower():
key = f"abstract:{str(item.get('category') or '').strip().lower() or 'unknown'}:{abstract}"
diff --git a/examples/hermes-plugin/plugin.yaml b/examples/hermes-plugin/plugin.yaml
index 3848ec53d..2bf1f90b4 100644
--- a/examples/hermes-plugin/plugin.yaml
+++ b/examples/hermes-plugin/plugin.yaml
@@ -1,5 +1,5 @@
name: openviking
-version: 2.1.2
+version: 2.1.3
description: "Long-term memory for Hermes with automatic capture, recall and tools to search and manage knowledge."
pip_dependencies:
- httpx
diff --git a/examples/hermes-plugin/pyproject.toml b/examples/hermes-plugin/pyproject.toml
index 78c03924a..15b4f58c1 100644
--- a/examples/hermes-plugin/pyproject.toml
+++ b/examples/hermes-plugin/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "hermes-plugin-openviking"
-version = "2.1.2"
+version = "2.1.3"
description = "Hermes Agent memory provider plugin: openviking"
requires-python = ">=3.11"
license = { text = "MIT" }
diff --git a/examples/hermes-plugin/tests/test_gateway_recall.py b/examples/hermes-plugin/tests/test_gateway_recall.py
index 243edb321..7232a1f3b 100644
--- a/examples/hermes-plugin/tests/test_gateway_recall.py
+++ b/examples/hermes-plugin/tests/test_gateway_recall.py
@@ -38,6 +38,7 @@ class GatewayBackend:
self.reject_session_search = False
self.unconfirmed_context = False
self.reject_identity = False
+ self.profile = None
self.upload_started = None
self.release_upload = None
@@ -89,6 +90,8 @@ class GatewayBackend:
]
)
docs = [("common", "viking://user/tenant/memories/preferences/common.md")]
+ if self.profile:
+ docs += [("profile", "viking://user/tenant/memories/profile.md")]
docs += [
(name, f"viking://user/tenant/peers/telegram.{name}/memories/preferences/fact.md")
for name in ("alice", "bob", "assistant")
@@ -119,7 +122,9 @@ class GatewayBackend:
elif path == "/api/v1/fs/ls":
result = []
elif path.startswith("/api/v1/content/"):
- return httpx.Response(404)
+ if not (self.profile and request.url.params.get("uri", "").endswith("/memories/profile.md")):
+ return httpx.Response(404)
+ result = self.profile
return httpx.Response(200, json={"status": "ok", "result": result})
@@ -230,6 +235,23 @@ def test_gateway_capture_commit_and_sender_scoped_recall(
manager.shutdown_all()
+def test_first_turn_list_recall_does_not_repeat_profile(external_provider, monkeypatch):
+ home, provider, _, manager, backend = initialize(external_provider, monkeypatch, scope=None)
+ monkeypatch.setenv("OPENVIKING_RECALL_PREFER_ABSTRACT", "false") # default: full L2 reads
+ backend.profile = "PROFILE_BODY Alice drinks oolong."
+ profile_uri = "viking://user/tenant/memories/profile.md"
+ try:
+ with profile_scope(home):
+ first = provider.prefetch("Remember my drink preference", session_id="shared-group")
+ later = provider.prefetch("Remember my drink preference", session_id="shared-group")
+ assert f'<user-profile uri="{profile_uri}">' in first
+ assert first.count("PROFILE_BODY") == first.count(profile_uri) == 1
+ assert "common" in first and "common" in later
+ assert profile_uri not in later
+ finally:
+ manager.shutdown_all()
+
+
@pytest.mark.parametrize("batch_failures,structured", [(1, True), (4, True), (0, False)])
def test_delayed_capture_keeps_author_through_fallback(
external_provider, monkeypatch, batch_failures, structured