Skip to content

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

fix(memory): canonicalize entity URI casing (#4070)

stometaverse84467b1be8c4
diff --git a/openviking/prompts/templates/memory/entities.yaml b/openviking/prompts/templates/memory/entities.yaml
index 30ce9e009..dca91da49 100644
--- a/openviking/prompts/templates/memory/entities.yaml
+++ b/openviking/prompts/templates/memory/entities.yaml
@@ -4,7 +4,7 @@ description: |
works, media, products, animals/pets, programs, activities, and concepts the
user mentions. Store what the entity is and its durable relations.
directory: "viking://user/{{ user_space }}/memories/entities"
-filename_template: "{{ category }}/{{ name }}.md"
+filename_template: "{{ category|lower }}/{{ name|lower }}.md"
enabled: true
embedding_template: |-
{{ category }}
@@ -57,4 +57,4 @@ fields:
Keep it readable: usually 6-14 bullets total / about 1200 chars. When updating,
merge and deduplicate; preserve existing atomic facts unless contradicted.
- merge_op: patch
\ No newline at end of file
+ merge_op: patch
diff --git a/openviking/prompts/templates/memory/experimental_memory/entities.yaml b/openviking/prompts/templates/memory/experimental_memory/entities.yaml
index 7e7872403..cf99e06e9 100644
--- a/openviking/prompts/templates/memory/experimental_memory/entities.yaml
+++ b/openviking/prompts/templates/memory/experimental_memory/entities.yaml
@@ -4,7 +4,7 @@ description: |
Each page represents an article with relative path links to events.
Entity should be rich and distributed - avoid putting all info in one entity.
directory: "viking://user/{{ user_space }}/memories/entities"
-filename_template: "{{ category }}/{{ name }}.md"
+filename_template: "{{ category|lower }}/{{ name|lower }}.md"
enabled: true
overview_template: |-
@@ -56,4 +56,4 @@ fields:
- User mentioned that his work efficiency has declined noticeably since Q4
- User mentioned that other colleagues in the same group have stable output, while his state has fluctuated significantly
- Concerns/Risks: Team output pace may be affected; needs to be reviewed with the latest performance data
- merge_op: patch
\ No newline at end of file
+ merge_op: patch
diff --git a/tests/session/memory/test_entities_template.py b/tests/session/memory/test_entities_template.py
new file mode 100644
index 000000000..b098d3190
--- /dev/null
+++ b/tests/session/memory/test_entities_template.py
@@ -0,0 +1,25 @@
+# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
+# SPDX-License-Identifier: AGPL-3.0
+
+from pathlib import Path
+
+import pytest
+import yaml
+from jinja2 import Template
+
+
+ "schema_path",
+ [
+ "openviking/prompts/templates/memory/entities.yaml",
+ "openviking/prompts/templates/memory/experimental_memory/entities.yaml",
+ ],
+)
+def test_entity_filename_is_case_insensitive(schema_path):
+ schema = yaml.safe_load(Path(schema_path).read_text(encoding="utf-8"))
+ template = Template(schema["filename_template"])
+
+ lower_path = template.render(category="concept", name="smart")
+ upper_path = template.render(category="CONCEPT", name="SMART")
+
+ assert lower_path == upper_path == "concept/smart.md"