Use agent-specific memory plugin config
Retrieve the memory plugin config per-agent in get_agent_memory_subdir, returning "default" if no config is found. Use agent.context for project name lookup when project isolation is enabled. Also invert delegation so get_context_memory_subdir obtains the agent from the context and calls get_agent_memory_subdir, ensuring memory subdir resolution uses agent-specific settings and has a safe fallback.
frdel committed
Feb 21, 2026 at 18:06 UTC
a63b844f01b20ce20eb4056f320a91c9dca3c979
1 file changed
+9
-6
plugins/memory/helpers/memory.py
+9
-6
@@ -515,16 +515,14 @@ def get_memory_subdir_abs(agent: Agent) -> str:
515
516
517
def get_agent_memory_subdir(agent: Agent) -> str:
518
- # if project is active, use project memory subdir
519
- return get_context_memory_subdir(agent.context)
518
+ config = plugins.get_plugin_config("memory", agent)
519
521
-
522
-def get_context_memory_subdir(context: AgentContext) -> str:
523
- config = plugins.get_plugin_config("memory")
520
+ if not config:
521
+ return "default"
522
523
# Check if project isolation is enabled and we are in a project
524
if config.get("project_memory_isolation", True):
527
- project_name = projects.get_context_project_name(context)
525
+ project_name = projects.get_context_project_name(agent.context)
526
if project_name:
527
return "projects/" + project_name
528
@@ -532,6 +530,11 @@ def get_context_memory_subdir(context: AgentContext) -> str:
530
return config.get("agent_memory_subdir", "") or "default"
531
532
533
+def get_context_memory_subdir(context: AgentContext) -> str:
534
+ agent = context.get_agent()
535
+ return get_agent_memory_subdir(agent)
536
+
537
+
538
def get_existing_memory_subdirs() -> list[str]:
539
try:
540
from python.helpers.projects import (