From f06d97077c62321041d2dca764f7264fdfd97ef8 Mon Sep 17 00:00:00 2001 From: Bartosz Burda Date: Sun, 8 Feb 2026 19:06:59 +0000 Subject: [PATCH 1/2] fix: discover sphinx-build in running Python's own bin directory find_sphinx_build() now checks the parent directory of sys.executable (without resolving symlinks) as the first search step. This ensures that when the MCP server runs via pipx, it finds sphinx-build in its own venv's bin/ directory rather than failing with FileNotFoundError. Previously, sphinx-build was only found if it was in a workspace .venv or on the system PATH, which excluded pipx installs where sphinx is a dependency of the package but not exposed to the system. --- src/ai_memory_protocol/engine.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/ai_memory_protocol/engine.py b/src/ai_memory_protocol/engine.py index 9a60b53..6fb185a 100644 --- a/src/ai_memory_protocol/engine.py +++ b/src/ai_memory_protocol/engine.py @@ -180,18 +180,26 @@ def find_sphinx_build(workspace: Path) -> str: """Locate the sphinx-build executable. Search order: - 1. ``workspace/.venv/bin/sphinx-build`` - 2. Walk parent directories for ``.venv/bin/sphinx-build`` - 3. ``shutil.which("sphinx-build")`` (system PATH) + 1. Same directory as the running Python interpreter (covers pipx / venv installs) + 2. ``workspace/.venv/bin/sphinx-build`` + 3. Walk parent directories for ``.venv/bin/sphinx-build`` + 4. ``shutil.which("sphinx-build")`` (system PATH) Returns the path string, or raises ``FileNotFoundError``. """ - # 1. Workspace venv + # 1. Running Python's own environment (pipx, venv, conda, etc.) + # Use parent of sys.executable WITHOUT resolving symlinks, so that + # pipx/venv wrapper scripts point to the correct bin directory. + own_bin = Path(sys.executable).parent / "sphinx-build" + if own_bin.exists(): + return str(own_bin) + + # 2. Workspace venv candidate = workspace / ".venv" / "bin" / "sphinx-build" if candidate.exists(): return str(candidate) - # 2. Walk parent directories + # 3. Walk parent directories for parent in workspace.parents: candidate = parent / ".venv" / "bin" / "sphinx-build" if candidate.exists(): @@ -205,7 +213,7 @@ def find_sphinx_build(workspace: Path) -> str: return str(candidate) break # Only check immediate parent's siblings - # 3. System PATH + # 4. System PATH system = shutil.which("sphinx-build") if system: return system From 876d58cf73d77d9df4f6f19b9585f8c8c6f220eb Mon Sep 17 00:00:00 2001 From: Bartosz Burda Date: Sun, 8 Feb 2026 19:19:22 +0000 Subject: [PATCH 2/2] docs: split error/stuck recall triggers in When to recall table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Separate 'When stuck or debugging' into two distinct triggers: - 'Encountering an error or failure' — emphasizes checking memory as the FIRST reaction before debugging from scratch - 'Stuck after initial attempts' — broadens search to related areas when initial debugging doesn't resolve the issue --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 097c7d3..999771b 100644 --- a/README.md +++ b/README.md @@ -233,7 +233,8 @@ Only after peeking — pick the 2-3 most relevant IDs and `get` them individuall | New task or topic | `recall --tag topic: --format brief` | | Entering unfamiliar code | `recall --tag repo: --type fact --format brief` | | Before a design decision | `recall --tag topic: --type dec` | -| When stuck or debugging | `recall ` | +| Encountering an error or failure | `recall ` — FIRST reaction before debugging; check if this problem was already solved | +| Stuck after initial attempts | `recall --tag topic: --type mem,fact` — broaden search to related areas and past solutions | | Before implementing a pattern | `recall --tag intent:coding-style --type pref` | #### 2. WRITE — Record at specific trigger points