Skip to content

fix: isolate bm-local runs from the operator's personal Basic Memory config#14

Merged
groksrc merged 1 commit into
mainfrom
fix/isolate-bm-config
Jun 11, 2026
Merged

fix: isolate bm-local runs from the operator's personal Basic Memory config#14
groksrc merged 1 commit into
mainfrom
fix/isolate-bm-config

Conversation

@groksrc

@groksrc groksrc commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary

The bm-local provider runs basic-memory CLI commands and the warm MCP stdio server with the operator's own Basic Memory config (~/.config/basic-memory or equivalent). Two failure modes observed while running fresh benchmarks on a machine with a cloud-mode setup:

  1. Cloud routing kills the provider. With a cloud-mode config, search_notes resolves workspaces through cloud.basicmemory.com; an expired JWT turns every query into 401 Unauthorized and bm-local errors out of the run.
  2. BM sync mutates the benchmark repo. A configured project with an empty path resolves to the process cwd, so the spawned MCP server synced the benchmark repo itself and injected Basic Memory frontmatter (title/type/permalink) into README.md, AGENTS.md, docs/benchmarks.md, and dataset READMEs.

Changes

  • Build an isolated environment in ingest(): BASIC_MEMORY_CONFIG_DIR=benchmarks/bm-home/ (gitignored), which scopes config, project registry, SQLite index, and fastembed cache to a benchmark-owned directory — the exact isolation hook BM provides for per-process state
  • Pass that env through run_command (new optional env param) for all bm CLI calls
  • Pass it explicitly to StdioServerParameters — the MCP SDK only forwards a small safelisted environment to stdio servers by default, so setting vars in the parent process is not enough

Fairness / reproducibility impact

Strictly improves reproducibility: runs no longer depend on (or mutate) whatever Basic Memory state the operator happens to have. No change to query handling, scoring, or provider configuration. First run on a fresh bm-home downloads the embedding model into the isolated cache once.

Validation

  • uv run ruff check . and uv run pytest tests pass
  • Full LoCoMo run (1,986 queries) on a cloud-mode machine completed with bm-local state ok (previously errored with the JWT failure), and the repo's markdown files stayed clean

🤖 Generated with Claude Code

…config

The bm-local provider inherited the operator's Basic Memory config for
both CLI calls and the warm MCP stdio server. With a cloud-mode config
this routes search_notes through cloud.basicmemory.com (401 on expired
JWT kills the provider), and a project with an empty path resolves to
the benchmark cwd, so BM's sync injects frontmatter into the repo's
own markdown files.

Set BASIC_MEMORY_CONFIG_DIR to a benchmark-owned directory
(benchmarks/bm-home/, gitignored) for every bm subprocess and the MCP
stdio session. The MCP SDK only passes a safelisted default
environment to stdio servers, so the env is threaded through
StdioServerParameters explicitly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Drew Cain <groksrc@gmail.com>
@groksrc groksrc merged commit 540091e into main Jun 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant