Skip to content

trailmem 0.1.12 — cwd isolation (complete)

Choose a tag to compare

@amitnexTech amitnexTech released this 01 Aug 16:49
· 2 commits to main since this release

Completes the -P anti-shadow fix that 0.1.11 only half-shipped. First PyPI release since 0.1.9 — it also carries the 0.1.10 Kiro hook fix.

The bug

Every host launches the server as <python> -u -m trailmem.mcp_server and every hook as <python> -m trailmem hook .... python -m puts the launching process cwd at sys.path[0], so any agent whose workspace was a checkout of this project imported the working tree instead of the installed package — silently running uncommitted code. Because content_hash covers absolute paths, memories written that way never deduped against the installed copy. Live-hit: every registered host on the maintainer machine had been running the source tree, not 0.1.9, for days.

The fix

  • New trailmem/hosts/_util.py helpers: safe_path_flag() returns -P on Python 3.11+ and -I on 3.10 (where -P does not exist and would abort startup); hook_python() applies the same flag to every hook command line.
  • integrate.mcp_command() now returns [flag, "-u", "-m", "trailmem.mcp_server"].
  • All four hook-emitting hosts (claude, codex, kiro, antigravity) build command lines via hook_python() instead of hardcoding sys.executable.
  • test_phase0 asserts the exact arg list, safe_path_flag(), and that hook_python() ends with the flag — the flag cannot silently regress.

Upgrading

uv tool install --force trailmem

Then re-run trailmem integrate in a real terminal and restart your agents, so the registered command lines pick up the flag.

Docs updated: README, docs/cli.md, docs/mcp.md, docs/host-integration.md. All 10 tests pass.