mesh-mem v0.2.4
Highlights
mesh-mem gc --by-pc-idnew CLI: bulk-purge every observation saved under a givenpc_id(optionally narrowed by--session-prefix). Built for the case where a benchmark or smoke run on a peer flooded the mesh with tens of thousands of throwaway-session obs. Dry-run by default;--executerequires interactiveyes(or--yesfor CI).- CLI is now interactive-fast on populated meshes (#38): startup
rebuild_from_zenohis skipped by default, somesh-mem save / search / get-memory / delete / statusno longer pay the ~15 s zenoh scan + JSON-parse + SQLite-membership-check on every invocation against a busy peer (~117k records observed). Long-running processes (mesh-mem-mcp) keep the previous behavior. Opt back in per-invocation withmesh-mem --rebuild ...orMESH_MEM_FORCE_REBUILD=1. - Project-scoped gc is O(N) on the SQLite local index (#32-A):
gc --project ...previously took ~60 s on production data with months of test residue regardless of how few tombstones matched the project. Now uses the local index for(project, deleted_at)rows + exact-key deletes — O(N) on the project subset, not O(M) global. - SQLite WAL is bounded (#32-B): long-running
mesh-mem-mcpprocesses used to grow WAL to 130 MB (≈ same size as the main DB) because they hold the connection open and SQLite never finishes the truncate phase.LocalIndexnow issuesPRAGMA wal_checkpoint(TRUNCATE)every 256 upserts and onclose().
Added
mesh-mem gc --by-pc-id PCID [--session-prefix X] [--execute] [--yes](#45). Backed bystore.scan_obs_by_pc_id+store.execute_bulk_purge. For every matched obs the mirroredmem/tomb/...slot is also exact-key deleted, so legitimate tombstones under the samepc_idare cleaned up at O(1)/match without falling back to themem/tomb/**global sweep that--force-idperforms (the sweep stalls onGET_TIMEOUTpast 30k tombstones).
Changed
- CLI skips
rebuild_from_zenohon startup by default (#38). Resolution order for the override channel: explicit--rebuild>MESH_MEM_FORCE_REBUILD>MESH_MEM_SKIP_REBUILD> module default. Direct user intent on the typed invocation always wins over env-level config (codex review P2). - One-off migration scripts moved to
scripts/migrations/.cleanup_legacy_memory_types.py(v0.2.2 → v0.2.3 enum migration) is operator tooling that should travel with the repo for un-migrated peers but should not ship as a CLI subcommand. The ad-hocscripts/purge_observations_by_pc_id.pyis removed in favor of thegc --by-pc-idflag.
Fixed
- #44:
mesh-memCLI commands no longer hang on exit. Short-lived invocations now explicitly close the Zenoh session on exit (including on early returns / exceptions). Previously the session lingered until process teardown and made shell scripts that chain mesh-mem commands unusable on some hosts.
Performance
- Project-scoped gc on SQLite local index (#32-A). Falls through to the legacy global scan when the index is disabled (
MESH_MEM_DISABLE_INDEX=1) or the fast path raises. Always realigns the index viarebuild_from_zenohbefore the SQLite query (codex review P1) — a non-empty sidecar from earlier short-lived CLI runs may be partial. - WAL bounded checkpoint (#32-B). Explicit
PRAGMA wal_checkpoint(TRUNCATE)every 256 upserts and onclose(), no background thread.
Documentation
- README Windows quick start refreshed (#36): drop the misleading
pip install mesh-memline; pin exact zenohd zip asset names; document non-admin install path; clarify elevated PowerShell forNew-NetFirewallRule; cross-link--rebuildopt-in. - Spec.md, ADR-0006..0009 (hub-and-spoke topology / SQLite local index sidecar / project-aware O(N) gc / MCP server instructions protocol — supersedes ADR-0003 and ADR-0005), and 3-PC topology PoC report (#41–#43).
Upgrade note
Reinstall the editable venv to refresh __version__ metadata:
~/work/mesh-mem/.venv/bin/pip install -e .Then /mcp reconnect (or restart your MCP host).
If your shell scripts rely on the old "rebuild on every CLI invocation" behavior (e.g. first-time bootstrap on a populated mesh), pass --rebuild once or set MESH_MEM_FORCE_REBUILD=1 in the environment.
See CHANGELOG.md for full details.