SuperAPI AI Directory

memory-arbiter-mcp

Local memory middleware: targeted retrieval instead of full-memory loading, rule-based conflict arbitration and one SQLite store shared across coding agents.

Open website

About this tool

Purpose

Memory Arbiter is a shared memory middleware layer for AI coding tools. Each coding Agent (such as Claude Code, Cursor, Codex, ZCode) typically takes its own notes without knowing about the others, leading to duplicated facts, mutual contradictions, and silent obsolescence. Memory Arbiter replaces this scattered state with a local SQLite fact store: all Agents read the same verified facts, and a decision made in Claude today is still available in Cursor tomorrow.

Main Capabilities

  • Targeted retrieval: Lexical and sentence-level evidence channels search in parallel and are fused by ranking; the official claim is a self-recall of 65/65 in the release exam. Candidates below the threshold do not appear on the results page, and each hit carries a source offset, so the exact original text can be extracted with read span=[start,end].
  • Conflict arbitration: Candidate pairs are handled by a self-trained local mDeBERTa three-way classifier (no prompt engineering, no picking a winner). Only high-confidence conflicts notify the user; gray areas are shown as low-priority references, and the rest enter scheduled scanning. Candidate pairs pass through a deterministic funnel (sentence pre-filtering → memory screening → cosine band → rule evidence) before entering judgment. The judge never picks a winner and never edits memories; findings are kept in an auditable conflicts lifecycle (open → applying → resolved), handled by the Agent under explicit authorization (judge → apply_conflict_action → resolve_conflict, using CAS to pin revisions).
  • Data ownership and security: The full original text is stored in a single SQLite file on the user's machine, every write carries provenance, every edit carries version history, and normal / protected / locked trust levels plus a user_confirmed tag are provided. By default it does not actively communicate externally; the only optional call is the PyPI update check (the browser console connects to the LLM endpoint configured by the user).
  • Knowledge base curation and workbench: The local browser console can select which memories count as knowledge (kb_member is an independently governed bit that Agents cannot delete by rewriting tags), browse by workspace → tag and provide rendered Markdown and a relationship graph; the workbench with its own LLM supports six one-click learning modesActions: summarize / outline / quiz / Feynman / quiz-me / timeline, output is written back as memory through the standard pipeline.
  • Trust and isolation: every write carries provenance, version history is append-only; workspace isolation is divided into none / weak / strict, under strict new workspaces remain in a pending-confirmation state, and the retained default pool is invisible within the project scope. Workspaces listed in recall_blacklist.jsonl next to the database are excluded from unscoped retrieval, and mema doctor reports the effective list.

How to use

Installation

You can have a coding Agent with terminal permissions execute the following; the Agent will treat the README as the source of truth, choose a uvx / core / vec / semantic-local option from the environment, and stop to wait for user input when it cannot safely infer. The sign of a successful installation is that mema doctor has been run and reports all warnings. Manual installation is performed step by step, then wire up the MCP client by referring to examples/*.mcp.json, and start the server with mema.

First-use notes

  • Identity is explicit: set client and agent_id in config.json; there are no built-in defaults, and the server will refuse to start if either is empty.
  • remember requires a workspace: first call memory_review(view="workspaces") to list existing buckets, then pass one in; 'default' is the global pool.
  • Every call returns {ok, mode, warnings, degraded, data}; matters requiring user attention appear as notices or data.action_required. Any Agent can be asked to view the packaging rules: memory(action="help", data={"topic":"agent_onboarding"}).

Daily loop

The four calls form the daily loop: remember records reusable facts, find is for recall, read is for precise lookup, update is used when a new source replaces an old fact (never keep a second live copy of the same fact source). find is the index page (metadata + content_chars + outline with source offsets); batch_find merges 8 queries into one round trip; read span=[start,end] for precise citation; empty recall will state so truthfully rather than stuffing in the most recent memories.

Configuration

Configuration is purely file-based, located at ~/.config/memory-arbiter/config.json; the full configuration surface is 28 keys, the template is in examples/memory-arbiter.config.example.json, and per-key documentation and the migration table are in docs/INTEGRATION.md. Keys important on day one: embedding.model_path (pointing to a local GGUF model is the only intent that enables evidence recall), semantic_conflict.mdeberta_ckpt (pointing to an adjudicator checkpoint enables write-time arbitration), mcp.transport (stdio by default, or streamable-http for a shared local server). There are six startup context environment variables (MEMORY_ARBITER_CONFIG / DB_PATH / BACKUP_JSONL / MCP_TRANSPORT / CLIENT / AGENT_ID); the config file takes precedence; other MEMORY_ARBITER_* exports will warn "no longer read".

HTTP mode

stdio (default) requires no background process. To share one server across multiple clients: set mcp.transport to "streamable-http", keep the process alive (there is a launchd template in the examples; mema has no built-in daemon), and have clients point tomoving copies). find is the index page (metadata + content_chars + outline with source offsets); batch_find merges 8 queries into one round trip; read span=[start,end] for precise citation; empty recall will state so truthfully rather than stuffing in the most recent memories.

Configuration

Configuration is purely file-based, located at ~/.config/memory-arbiter/config.json; the full configuration surface is 28 keys, the template is in examples/memory-arbiter.config.example.json, and per-key documentation and the migration table are in docs/INTEGRATION.md. Keys important on day one: embedding.model_path (pointing to a local GGUF model is the only intent that enables evidence recall), semantic_conflict.mdeberta_ckpt (pointing to an adjudicator checkpoint enables write-time arbitration), mcp.transport (stdio by default, or streamable-http for a shared local server). There are six startup context environment variables (MEMORY_ARBITER_CONFIG / DB_PATH / BACKUP_JSONL / MCP_TRANSPORT / CLIENT / AGENT_ID); the config file takes precedence; other MEMORY_ARBITER_* exports will warn "no longer read".

HTTP mode

stdio (default) requires no background process. To share one server across multiple clients: set mcp.transport to "streamable-http", keep the process alive (there is a launchd template in the examples; mema has no built-in daemon), and have clients point to http://127.0.0.1:8000/mcp,使用示例文件中的固定 X-Mema-Client / X-Mema-Agent-Id headers. Loopback addresses only; the headers are for provenance identification, not authentication. Claude Desktop / Claude Code connect via a single-entry mcp-remote bridge.

Conflict adjudication model (mDeBERTa, optional)

One-time manual installation: pip install memory-arbiter-mcp[mdeberta]; download mdeberta-v58_ep3_fp16.pt (the approximately 531MB fp16 checkpoint is not published on PyPI) from the mini-clash release artifacts, along with the mdeberta-base tokenizer directory (already included in the offline installer from memarbiter.cn, so this step can be skipped); point semantic_conflict.mdeberta_ckpt at it; it is automatically enabled and preloaded at startup, and mema doctor verifies the digest and label contract.

Upgrading from an older database

Databases older than the schema generation workspace_state_v1 are rejected at startup; you need to run the parallel mema upgrade (preview with --dry-run; the source database is not deleted). For the full operating guide (WAL-safe backups, migration and what is intentionally discarded, post-upgrade scan epoch), see docs/UPGRADE.md (Chinese version docs/UPGRADE.zh-CN.md).

Applicable scenarios

  • Teams or individuals with multiple coding Agents working in parallel that need to share the same set of facts and decision records.
  • Development scenarios with high data locality requirements that do not want memories uploaded to the cloud.
  • Knowledge work that needs to maintain provenance, version history, and trust levels for facts to prevent confirmed content from being silently rewritten.
  • Users who need to curate a local knowledge base and use their own LLM for learning operations such as summarization, outlining, and quizzes.

Limitations and cautions

  • No embedding configured: without sqlite-vec / an embedding model, lexical recall and governance remain available, but the evidence index is unavailable.
  • No adjudicator configured: arbitration is paused on write, and scheduled scans still return deterministic candidates.
  • SQLite unavailable: writes fall back to append-only JSONL envelopes; workspace decision state requires the database.
  • Identity must explicitly set client and agent_id, otherwise the server refuses to start.
  • remember must specify a workspace; you need to list existing buckets first.
  • HTTP mode is limited to loopback addresses; the headers are not an authentication mechanism.
  • The mDeBERTa checkpoint (approximately 531MB fp16) is not published with the PyPI package and must be downloaded manually or obtained via the offline installer.
  • Benchmark data: officially, on LoCoMo-Refined (all 1,382 questions, official judge Qwen3-14B), the full Mem0 pipeline scores 48.91% under the same plain-text setting (re-scored by the benchmark authors), and bare mema matches it with no LLM in the write path; with writer-agent, mema's plain-text score ranks second only to MemoraX on the leaderboard. The internal release exam includes 42 recall queries (five categories: paraphrase / lookup / legal / far / keyword), 108 conflict pairs (four label categories, of which 36 are true conflicts), and four groups of similarity label groups. The above is officially provided material; for more details and reproduction methods, see evals/locomo/RESULTS.md and eval/runner.py --suite all.
  • Specific information such as some pricing and platform support scope is not yet provided.