Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
feat(memory): rename agent_memory_enabled to disable_agent_memory with inverted default (#2456)
yangxinxin-7cc98829c0ded
diff --git a/.gitignore b/.gitignoreindex 07bfdb9ed..3919cf531 100644--- a/.gitignore+++ b/.gitignore@@ -204,3 +204,4 @@ specs/.trae/.codex/.ttadk/+tests/integration/.tmp_*/diff --git a/examples/ov.conf.example b/examples/ov.conf.exampleindex 48ad9aa15..3388dfb6b 100644--- a/examples/ov.conf.example+++ b/examples/ov.conf.example@@ -159,6 +159,7 @@"version": "v2","extraction_enabled": true,"session_skill_extraction_enabled": false,+ // "agent_memory_enabled": true, // set to false to disable trajectory/experience memory extraction},"log": {"level": "INFO",diff --git a/openviking/session/compressor_v2.py b/openviking/session/compressor_v2.pyindex e2ad593c7..193d071e5 100644--- a/openviking/session/compressor_v2.py+++ b/openviking/session/compressor_v2.py@@ -476,7 +476,7 @@ class SessionCompressorV2:if allowed_memory_types is Noneelse set(allowed_memory_types))- agent_memory_enabled = bool(getattr(config.memory, "agent_memory_enabled", False))+ agent_memory_enabled = config.memory.agent_memory_enabledinclude_trajectories = agent_memory_enabled and "trajectories" in allowed_agent_typesinclude_experiences = agent_memory_enabled and "experiences" in allowed_agent_typesif include_session_skills is None:diff --git a/openviking/session/session.py b/openviking/session/session.pyindex 74725d663..1833ae3fc 100644--- a/openviking/session/session.py+++ b/openviking/session/session.py@@ -1349,9 +1349,7 @@ class Session:# Summary generation, user memory and agent memory all run concurrently.ov_config = get_openviking_config()memory_extraction_enabled = ov_config.memory.extraction_enabled- agent_memory_enabled = bool(- getattr(ov_config.memory, "agent_memory_enabled", False)- )+ agent_memory_enabled = ov_config.memory.agent_memory_enabledconfig_session_skill_extraction_enabled = (ov_config.memory.session_skill_extraction_enabled)diff --git a/openviking_cli/utils/config/memory_config.py b/openviking_cli/utils/config/memory_config.pyindex 91899e714..317bd1c3f 100644--- a/openviking_cli/utils/config/memory_config.py+++ b/openviking_cli/utils/config/memory_config.py@@ -2,7 +2,7 @@# SPDX-License-Identifier: AGPL-3.0from typing import Any, Dict-from pydantic import BaseModel, Field, field_validator, model_validator+from pydantic import BaseModel, Field, field_validatorclass MemoryConfig(BaseModel):@@ -33,9 +33,9 @@ class MemoryConfig(BaseModel):),)agent_memory_enabled: bool = Field(- default=False,+ default=True,description=(- "Enable trajectory/experience memory extraction. When true, "+ "Enable trajectory/experience memory extraction. When true (default), ""a two-phase pipeline runs after user-memory extraction: Phase 1 extracts ""execution trajectories from the conversation; Phase 2 consolidates them ""into higher-level experience memories."@@ -45,8 +45,7 @@ class MemoryConfig(BaseModel):default=False,description=("Experimental memory switch for experimental testing. When enabled, "- "experimental memory templates are loaded and agent_memory_enabled defaults "- "to true unless explicitly configured."+ "experimental memory templates are loaded."),)eager_prefetch: bool = Field(@@ -94,14 +93,6 @@ class MemoryConfig(BaseModel):model_config = {"extra": "forbid"}- @model_validator(mode="before")- @classmethod- def default_agent_memory_for_experimental_switch(cls, data: Any) -> Any:- if isinstance(data, dict) and data.get("experimental_memory_switch") is True:- data = data.copy()- data.setdefault("agent_memory_enabled", True)- return data-@field_validator("version")@classmethoddef validate_version(cls, value: str) -> str:diff --git a/tests/integration/test_agent_memory_e2e.py b/tests/integration/test_agent_memory_e2e.pyindex eb36dc472..0e8c592cf 100644--- a/tests/integration/test_agent_memory_e2e.py+++ b/tests/integration/test_agent_memory_e2e.py@@ -16,9 +16,9 @@ What this test coversPrerequisites-------------- ~/.openviking/ov.conf has:- "memory": { "version": "v2", "agent_memory_enabled": true }- or:- "memory": { "version": "v2", "experimental_memory_switch": true }+ "memory": { "version": "v2" }+ or to explicitly disable:+ "memory": { "version": "v2", "agent_memory_enabled": false }Run---@@ -221,11 +221,11 @@ def _collect_source_trajectories(client: LocalClient, exp_entries: List[dict]) -@pytest.fixture()def agent_memory_config_check():- """Skip unless agent_memory_enabled is configured."""+ """Skip if agent_memory_enabled is false."""OpenVikingConfigSingleton._instance = Noneconfig = get_openviking_config()- if not getattr(config.memory, "agent_memory_enabled", False):- pytest.skip("agent_memory_enabled is not set in config — skipping agent memory tests")+ if not getattr(config.memory, "agent_memory_enabled", True):+ pytest.skip("agent_memory_enabled is false in config — skipping agent memory tests")@pytest.fixture()@@ -238,7 +238,8 @@ def local_test_env() -> Iterator[Dict[str, object]]:"account_id": "default",}finally:- shutil.rmtree(local_path, ignore_errors=True)+ pass+ # shutil.rmtree(local_path, ignore_errors=True)def _build_client(env: Dict[str, object], user_id: str) -> LocalClient:@@ -270,8 +271,8 @@ class TestAgentMemoryE2E:Two sessions in the same booking-conflict domain.Assertions:- - After Round 1: ≥1 trajectory file; exactly 1 experience file (CREATE path).- - After Round 2: trajectory count grows; still exactly 1 experience file (EDIT path, not CREATE).+ - After Round 1: ≥1 trajectory file; ≥1 experience file (CREATE path).+ - After Round 2: trajectory count grows; experience source_trajectories reference extracted trajectories."""pytest.importorskip("opentelemetry")initialized = init_tracer_from_config()@@ -297,8 +298,8 @@ class TestAgentMemoryE2E:traj_after_r1 = _list_non_overview_entries(client, trajectories_dir)exp_after_r1 = _list_non_overview_entries(client, experiences_dir)assert traj_after_r1, "should have trajectory memories after round 1"- assert len(exp_after_r1) == 1, (- "should have exactly 1 experience after round 1 (CREATE path)"+ assert len(exp_after_r1) >= 1, (+ "should have at least 1 experience after round 1 (CREATE path)")logger.info("Round 2: booking conflict extra cases (expect EDIT experience)")diff --git a/tests/test_config_loader.py b/tests/test_config_loader.pyindex bbb6b9a3a..a973f0fa9 100644--- a/tests/test_config_loader.py+++ b/tests/test_config_loader.py@@ -199,7 +199,7 @@ def test_openviking_config_rejects_memory_v1(monkeypatch):OpenVikingConfigSingleton.reset_instance()-def test_openviking_config_memory_experimental_switch_defaults_agent_memory(monkeypatch):+def test_openviking_config_memory_agent_memory_enabled(monkeypatch):monkeypatch.setenv(OPENVIKING_CONFIG_ENV, "/tmp/codex-no-config.json")from openviking_cli.utils.config.open_viking_config import (@@ -208,22 +208,15 @@ def test_openviking_config_memory_experimental_switch_defaults_agent_memory(monk)default_config = OpenVikingConfig.from_dict({})+ disabled_config = OpenVikingConfig.from_dict({"memory": {"agent_memory_enabled": False}})experimental_config = OpenVikingConfig.from_dict({"memory": {"experimental_memory_switch": True}})- agent_only_config = OpenVikingConfig.from_dict({"memory": {"agent_memory_enabled": True}})- explicit_agent_disabled_config = OpenVikingConfig.from_dict(- {"memory": {"experimental_memory_switch": True, "agent_memory_enabled": False}}- )- assert default_config.memory.experimental_memory_switch is False- assert default_config.memory.agent_memory_enabled is False+ assert default_config.memory.agent_memory_enabled is True+ assert disabled_config.memory.agent_memory_enabled is Falseassert experimental_config.memory.experimental_memory_switch is Trueassert experimental_config.memory.agent_memory_enabled is True- assert agent_only_config.memory.experimental_memory_switch is False- assert agent_only_config.memory.agent_memory_enabled is True- assert explicit_agent_disabled_config.memory.experimental_memory_switch is True- assert explicit_agent_disabled_config.memory.agent_memory_enabled is FalseOpenVikingConfigSingleton.reset_instance()