From 8c67630bbd28bdb18786216b82ae0e2d36f9d623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=BD=AE?= Date: Wed, 31 Dec 2025 21:00:49 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor(deep-agent):=20cu?= =?UTF-8?q?stomize=20agent=20memory=20middleware=20path=20display?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Override AgentMemoryMiddleware to simplify agent directory display. The CustomAgentMemoryMiddleware shows "." instead of full path. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- agent/deep_assistant.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/agent/deep_assistant.py b/agent/deep_assistant.py index 75ca1bd..fd79b6f 100644 --- a/agent/deep_assistant.py +++ b/agent/deep_assistant.py @@ -169,6 +169,7 @@ async def init_agent(config: AgentConfig): system_prompt=system_prompt, tools=mcp_tools, auto_approve=True, + enable_memory=False, workspace_root=workspace_root ) else: @@ -215,6 +216,21 @@ async def init_agent(config: AgentConfig): logger.info(f"create {config.robot_type} elapsed: {time.time() - create_start:.3f}s") return agent, checkpointer +class CustomAgentMemoryMiddleware(AgentMemoryMiddleware): + def __init__( + self, + *, + settings, + assistant_id: str, + system_prompt_template: str | None = None, + ) -> None: + super().__init__( + settings=settings, + assistant_id=assistant_id, + system_prompt_template=system_prompt_template + ) + self.agent_dir_display = f"." + class CustomSkillsMiddleware(SkillsMiddleware): def __init__( self, @@ -319,7 +335,7 @@ def create_custom_cli_agent( # Add memory middleware if enable_memory: agent_middleware.append( - AgentMemoryMiddleware(settings=settings, assistant_id=assistant_id) + CustomAgentMemoryMiddleware(settings=settings, assistant_id=assistant_id) ) # Add skills middleware