refactor(agents): move memory middleware into main_agent (owner)

memory (builder) + memory_injection (impl) lived in shared/middleware/ but are
consumed only by main_agent (no subagent, no shared plumbing). Colocate with
their owner using the folder-per-middleware shape:

  shared/middleware/memory.py            -> main_agent/middleware/memory/builder.py
  shared/middleware/memory_injection.py  -> main_agent/middleware/memory/middleware.py
This commit is contained in:
CREDO23 2026-06-05 14:06:54 +02:00
parent 1a52166145
commit 6b1da64182
4 changed files with 9 additions and 2 deletions

View file

@ -0,0 +1,5 @@
"""User/team memory injection middleware (main-agent only)."""
from .builder import build_memory_mw
__all__ = ["build_memory_mw"]

View file

@ -4,7 +4,7 @@ from __future__ import annotations
from app.db import ChatVisibility
from .memory_injection import MemoryInjectionMiddleware
from .middleware import MemoryInjectionMiddleware
def build_memory_mw(

View file

@ -20,6 +20,9 @@ from langchain_core.language_models import BaseChatModel
from langchain_core.tools import BaseTool
from langgraph.types import Checkpointer
from app.agents.chat.multi_agent_chat.main_agent.middleware.memory import (
build_memory_mw,
)
from app.agents.chat.multi_agent_chat.shared.feature_flags import AgentFeatureFlags
from app.agents.chat.multi_agent_chat.shared.filesystem_selection import FilesystemMode
from app.agents.chat.multi_agent_chat.shared.middleware.anthropic_cache import (
@ -31,7 +34,6 @@ from app.agents.chat.multi_agent_chat.shared.middleware.compaction import (
from app.agents.chat.multi_agent_chat.shared.middleware.kb_context_projection import (
build_kb_context_projection_mw,
)
from app.agents.chat.multi_agent_chat.shared.middleware.memory import build_memory_mw
from app.agents.chat.multi_agent_chat.shared.middleware.patch_tool_calls import (
build_patch_tool_calls_mw,
)