Skip to content

mesh-mem v0.2.4

Choose a tag to compare

@h-wata h-wata released this 11 May 00:32
· 112 commits to main since this release

Highlights

  • mesh-mem gc --by-pc-id new CLI: bulk-purge every observation saved under a given pc_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; --execute requires interactive yes (or --yes for CI).
  • CLI is now interactive-fast on populated meshes (#38): startup rebuild_from_zenoh is skipped by default, so mesh-mem save / search / get-memory / delete / status no 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 with mesh-mem --rebuild ... or MESH_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-mcp processes 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. LocalIndex now issues PRAGMA wal_checkpoint(TRUNCATE) every 256 upserts and on close().

Added

  • mesh-mem gc --by-pc-id PCID [--session-prefix X] [--execute] [--yes] (#45). Backed by store.scan_obs_by_pc_id + store.execute_bulk_purge. For every matched obs the mirrored mem/tomb/... slot is also exact-key deleted, so legitimate tombstones under the same pc_id are cleaned up at O(1)/match without falling back to the mem/tomb/** global sweep that --force-id performs (the sweep stalls on GET_TIMEOUT past 30k tombstones).

Changed

  • CLI skips rebuild_from_zenoh on 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-hoc scripts/purge_observations_by_pc_id.py is removed in favor of the gc --by-pc-id flag.

Fixed

  • #44: mesh-mem CLI 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 via rebuild_from_zenoh before 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 on close(), no background thread.

Documentation

  • README Windows quick start refreshed (#36): drop the misleading pip install mesh-mem line; pin exact zenohd zip asset names; document non-admin install path; clarify elevated PowerShell for New-NetFirewallRule; cross-link --rebuild opt-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.