From 05b77a5fedee52d96d81ce2f24f6f6386a24b373 Mon Sep 17 00:00:00 2001 From: cthomas Date: Thu, 5 Feb 2026 19:22:45 -0800 Subject: [PATCH] fix(core): update memfs client to use memory/ directory (#9322) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #9309 changed the block storage from blocks/ to memory/ directory. Update memfs_client.py and memfs_client_base.py to match. 🐾 Generated with [Letta Code](https://letta.com) Co-authored-by: Letta --- letta/server/rest_api/routers/v1/git_http.py | 2 +- letta/services/memory_repo/memfs_client_base.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/letta/server/rest_api/routers/v1/git_http.py b/letta/server/rest_api/routers/v1/git_http.py index ab4e5b0b..835621d3 100644 --- a/letta/server/rest_api/routers/v1/git_http.py +++ b/letta/server/rest_api/routers/v1/git_http.py @@ -507,7 +507,7 @@ async def _sync_after_push(actor_id: str, agent_id: str) -> None: # Detach blocks that were removed in git. # # We treat git as the source of truth for which blocks are attached to - # this agent. If a blocks/*.md file disappears from HEAD, detach the + # this agent. If a memory/*.md file disappears from HEAD, detach the # corresponding block from the agent in Postgres. try: existing_blocks = await _server_instance.agent_manager.list_agent_blocks_async( diff --git a/letta/services/memory_repo/memfs_client_base.py b/letta/services/memory_repo/memfs_client_base.py index ff6341ad..bf1ca887 100644 --- a/letta/services/memory_repo/memfs_client_base.py +++ b/letta/services/memory_repo/memfs_client_base.py @@ -26,7 +26,7 @@ from letta.utils import enforce_types logger = get_logger(__name__) # File paths within the memory repository -BLOCKS_DIR = "blocks" +MEMORY_DIR = "memory" METADATA_FILE = "metadata/blocks.json" # Default local storage path @@ -89,7 +89,7 @@ class MemfsClient: metadata = {"blocks": {}} for block in initial_blocks: - file_path = f"{BLOCKS_DIR}/{block.label}.md" + file_path = f"{MEMORY_DIR}/{block.label}.md" initial_files[file_path] = block.value or "" metadata["blocks"][block.label] = { "description": block.description, @@ -149,8 +149,8 @@ class MemfsClient: # Convert block files to PydanticBlock blocks = [] for file_path, content in files.items(): - if file_path.startswith(f"{BLOCKS_DIR}/") and file_path.endswith(".md"): - label = file_path[len(f"{BLOCKS_DIR}/") : -3] + if file_path.startswith(f"{MEMORY_DIR}/") and file_path.endswith(".md"): + label = file_path[len(f"{MEMORY_DIR}/") : -3] block_meta = metadata.get(label, {}) # Generate deterministic UUID-style ID from agent_id + label @@ -237,7 +237,7 @@ class MemfsClient: await self._ensure_repo_exists(agent_id, actor) - file_path = f"{BLOCKS_DIR}/{label}.md" + file_path = f"{MEMORY_DIR}/{label}.md" commit_message = message or f"Update {label}" return await self.git.commit( @@ -299,7 +299,7 @@ class MemfsClient: # Prepare changes changes = [ FileChange( - path=f"{BLOCKS_DIR}/{block.label}.md", + path=f"{MEMORY_DIR}/{block.label}.md", content=block.value, change_type="add", ), @@ -368,7 +368,7 @@ class MemfsClient: # Prepare changes changes = [ FileChange( - path=f"{BLOCKS_DIR}/{label}.md", + path=f"{MEMORY_DIR}/{label}.md", content=None, change_type="delete", ),