From ce0244b9fbefc6e0b688d80e8c5bc8a2aced3ddb Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 9 Aug 2026 12:17:37 +0000 Subject: [PATCH] The attachment walk pays the realpath cost #3 just removed #3 found that resolving every walked path again was most of what an index refresh cost, and replaced it with relative_to_walked_root for the note half. #4 landed beside it, from a branch cut before that, and added the attachment half using the slow call -- so a vault with a few thousand images pays the realpath storm again, on the other half of the same walk. Correctness was never affected: the walk starts at a resolved root and skips symlinks, which is exactly the guarantee the cheap helper is documented to rest on. One line, and the two halves of the walk now agree. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01YERzytVXKTFFZAShrU3iBh --- knap_mcp/providers/filesystem/index.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knap_mcp/providers/filesystem/index.py b/knap_mcp/providers/filesystem/index.py index dca4d5d..eff420e 100644 --- a/knap_mcp/providers/filesystem/index.py +++ b/knap_mcp/providers/filesystem/index.py @@ -136,7 +136,7 @@ def refresh(self, *, force: bool = False) -> None: # tracked, because the only question ever asked of one is whether a link # target means it. Editing an image cannot change that answer. assets = { - vault_paths.to_relative(self.root, absolute) + vault_paths.relative_to_walked_root(root_resolved, absolute) for absolute in vault_paths.walk_attachments(self.root, include_hidden=True) } if assets != self._assets: