Skip to main content
Glama
Memory Bridge
by shuimo233

Memory Bridge

Memory Bridge is a standalone local MCP server for source evidence, decisions, and task state. It keeps original events in SQLite and builds recall from versioned records that cite those events. Codex, Claude, and other stdio MCP clients can use it without running AngelBot or configuring a model on the server. The project originated in AngelBot.

Start with what feels difficult

Tell your coding assistant what you were trying to do. For example, “I keep losing my place in settings. Can you fix it?” The assistant can inspect the project, use relevant decisions, and ask an everyday question if the answer changes the fix. “It happens when I hit Save” can be enough to try a change and check that the same setting stays visible after saving. If you already know the outcome you want, say it directly. You can also ask for a suggestion or let the assistant choose a first draft.

The Codex marketplace plugin includes the shape-coding-request skill. For a stdio client, the same workflow is available as the read-only memory_shape_request tool. If your assistant misses it, ask it to use that tool with your original description. The host model guides the conversation and uses its own project tools to implement a change. Shaping a request does not save a memory.

Related MCP server: mcp-memory

Install and connect

Use Python 3.11 or newer and uv. Run the following PowerShell commands from the cloned repository or the plugin directory of a packaged copy.

$bridge = (Resolve-Path .).Path
$bridgeUv = (Get-Command uv -CommandType Application).Source
& $bridgeUv sync --locked --project "$bridge"
& $bridgeUv run --offline --no-sync --project "$bridge" angelbot-memory-bridge check

Run the registration command for your client in a terminal. Then start a new conversation and check that memory_context is available.

codex mcp add memory-bridge -- "$bridgeUv" run --offline --no-sync --project "$bridge" angelbot-memory-bridge serve
claude mcp add --transport stdio memory-bridge -- "$bridgeUv" run --offline --no-sync --project "$bridge" angelbot-memory-bridge serve

Any stdio client can launch the same command and arguments. Use absolute paths for both the uv executable and --project when the client has a different PATH or working directory. Stdout carries MCP messages during serve.

For Claude Desktop, merge the entry below into claude_desktop_config.json and replace both example paths. Fully quit and reopen the desktop app to load the change. Claude Desktop configuration locations

{
  "mcpServers": {
    "memory-bridge": {
      "command": "C:\\Tools\\uv.exe",
      "args": [
        "run", "--offline", "--no-sync", "--project", "C:\\Tools\\memory-bridge",
        "angelbot-memory-bridge", "serve"
      ]
    }
  }
}

To install through a local Codex marketplace, run this from a repository checkout and supply a new or empty destination.

$bridgeMarketplace = Join-Path (Split-Path -Parent $PWD.Path) 'memory-bridge-marketplace'
python scripts/package_memory_bridge.py "$bridgeMarketplace"
codex plugin marketplace add "$bridgeMarketplace"
codex plugin add angelbot-memory-bridge@memory-bridge-local

First launch from the plugin can install locked dependencies. The packaged copy contains source, manifests, dependency metadata, documentation, and the license.

Storage and compatibility

The server binds one workspace at process startup. --workspace defaults to default regardless of the client's current project or directory. Give each project its own workspace name when you want separate recall. Add --db with an absolute path to use a separate SQLite file. To share records between clients, configure both clients with the same file and workspace. Workspace selection restricts MCP calls and has no effect on operating-system access to the file.

The application-data path remains %LOCALAPPDATA%/AngelBotMemoryBridge/memory.sqlite3 on Windows and ${XDG_DATA_HOME:-~/.local/share}/angelbot-memory-bridge/memory.sqlite3 otherwise. To recover records from the 0.1.0 plugin, add --workspace angelbot after serve in the client launch command or JSON argument list. If the earlier setup used a custom workspace or --db path, pass those same values. Existing events, versions, and idempotency keys remain usable. Only dedicated Memory Bridge databases are accepted.

check opens or initializes the selected database and reports the workspace revision. rebuild reconstructs the selected workspace's records and search projection from its event log. Both commands accept --db and --workspace. Keep the SQLite file private and back it up while clients are stopped. Revoked records retain their evidence and historical versions.

Use with a client

For a synthetic walkthrough, use a temporary database and set --workspace cookbook-demo.

  1. Call memory_append with kind: "user_decision", content: "Use metric units in recipes." and idempotency_key: "cookbook/units/source-v1". Save the returned event_id.

  2. Call memory_write with key: "recipe-units", kind: "decision", content: "Use metric units.", evidence_ids containing that ID, expected_version: 0, and idempotency_key: "cookbook/units/write-v1".

  3. Call memory_context with query: "recipe units". Use memory_read_event to verify the original evidence. memory_search looks up active records by keywords. memory_get reads the current record or a specified historical version.

  4. To correct a remembered decision, append the user's words with kind: "user_correction". Call memory_write with the recalled record_id, last observed expected_version, replacement content, the new event ID in evidence_ids, and a fresh idempotency key. The previous version and its source remain available. memory_revoke requires a current version, a reason, evidence, and its own idempotency key.

Every write needs a stable idempotency key. Retry the same mutation with the same key and arguments. Changed arguments under the same key return a conflict. Records can be a constraint, decision, preference, task_state, or lesson. A task-scoped record needs scope: "task" and a scope_id matching the recall task_id. Project and global records apply within the configured workspace. Expiration timestamps require a time zone.

When a user explicitly picks up an existing project or task, call memory_context with {"mode":"resume","task_id":"cookbook-demo"} using the known task ID. Omit task_id to include only project and global scopes. Resume considers applicable constraints first, then up to five current task states and five current decisions. Within each kind, matching task-scoped records come first, followed by priority and recency. This works even when the user's wording has no overlap with the saved text. A call without mode still uses keyword search. Read coverage.resume for records omitted by the selection limit or the character budget. Historical versions remain available through memory_get.

Check coverage.complete_constraints when recalling context. If it is false, page through memory_list using the returned kind, task, and revision, and check each item's status. Restart pagination when its revision guard reports a conflict. Memory responses are advisory. The client retains responsibility for permission and execution decisions.

Everyday conversation

The host decides when to call MCP tools. For a client that skips memory on a new chat, add this reminder to its project or agent instructions.

At the start of a conversation, call memory_context for this workspace. Use any returned communication preferences unless my current request says otherwise.

  • “From now on, give me the conclusion first.” Append the user's words as evidence and call memory_save_communication_preference with the preference, a stable key, the evidence ID, and an idempotency key. On a new topic, call memory_context. Its communication_preferences includes up to three applicable habits, with task-specific ones first. Constraints have first claim on the character budget. Apply the habits quietly and follow the user's current request.

  • “Just for this one, walk me through it.” Give a detailed answer for this turn. The saved preference still applies next time. If the user changes the standing preference, correct the existing record. If “change that” could refer to two decisions, ask which one.

  • “Choose the routine details yourself.” This can be a standing communication preference. For example, pick a layout for a requested draft and show it. If the user asked to send it and two recipients fit, check the conversation first and ask which recipient only if it is still unclear. The host handles any required approval.

  • “Where did we agree to send our write-up?” The client can pass up to four short alternative phrasings or keyword groups in query_variants alongside the user's query. Search runs locally on words in stored records. The default broad mode also returns partial matches. Use memory_search with match_mode: "focused" to require a whole group, then check the source before answering. An empty result can also mean the wording differs.

Local HTTP

The same server accepts serve --transport streamable-http --host 127.0.0.1 --port 8766. Set a random MEMORY_BRIDGE_TOKEN of at least 32 non-whitespace characters in the server environment. Clients send Authorization: Bearer <token> to http://127.0.0.1:8766/mcp. HTTP is loopback-only.

Verify

From the repository root, install the test dependencies once and then run the suite offline with synthetic data and isolated databases.

uv sync --locked --extra test
uv run --offline --no-sync python -m pytest tests

MIT license

Available Tools

10 tools
memory_appendC
Idempotent

Append an immutable source event (up to 64 KiB JSON), preserving its original content.

Inputs: kind (required), content (required), idempotency_key (required), source_ref. Returns: object

memory_contextA
Read-onlyIdempotent

Recall applicable constraints, communication preferences, and records for this task.

Search mode accepts alternative keyword groups for the same question. Resume mode selects current task states and decisions independent of query words and variants. Supply the known task_id to include records scoped to that task. Apply communication_preferences quietly, including how the user wants routine choices handled. Reuse them until the task or preference changes. The current request and the host's action permissions take precedence. Check coverage before describing which constraints apply. The character budget counts complete records. For a rough software wish, memory_shape_request recalls context and guides the next step.

Inputs: mode, query, task_id, max_chars, +1 more. Returns: object

memory_getA
Read-onlyIdempotent

Read a record's current state or a specific historical version, including provenance.

Inputs: record_id (required), version. Returns: object

memory_listC
Read-onlyIdempotent

Page records including inactive history with a revision guard; inspect each status.

Inputs: kind, limit, offset, task_id, +1 more. Returns: object

memory_read_eventB
Read-onlyIdempotent

Read one original evidence event from this namespace by stable ID.

Inputs: event_id (required). Returns: object

memory_revokeB
Idempotent

Revoke a record from future recall; retain its history and original evidence.

Inputs: reason (required), record_id (required), evidence_ids (required), idempotency_key (required), +1 more. Returns: object

memory_save_communication_preferenceA
Idempotent

Remember how the user explicitly wants future replies written, even on unrelated topics.

Use for lasting requests about language, tone, format or when to ask the user. A preference like "choose routine details yourself" guides conversation only. First append the user's words as evidence. Pick one stable key per habit. Task scope needs a scope_id. For a one-time request, just adapt the current reply. To change a saved habit, correct its existing record_id with memory_write.

Inputs: key (required), preference (required), evidence_ids (required), idempotency_key (required), +2 more. Returns: object

memory_shape_requestB
Read-onlyIdempotent

Help turn a rough software wish into a concrete result using existing memory.

Use the user's own words, including any latest clarification, and pass task_id when known. Provide short lookup terms for a specific topic. Otherwise a known task uses current task states and decisions; without a task, recall uses words from the wish and clarification. The result includes bounded context and guidance for the host. This tool makes no memory writes.

Inputs: wish (required), task_id, lookup_terms, clarification. Returns: object

memory_writeA
Idempotent

Create/update an evidence-backed record (up to 8 KiB JSON).

For a lasting user correction, provide the active record_id and its last observed expected_version, the revised content, and user_correction evidence. Omit key, kind, scope, scope_id, priority, and expires_at to retain those fields. If the intended record or duration is ambiguous, clarify before writing.

For key-based writes, provide key and kind. Use expected_version=0 only for a new key. Scope defaults to project and priority to 50. Task-scoped records require scope_id. Times require a timezone. For a new standing preference about how to answer, use memory_save_communication_preference.

Inputs: content (required), evidence_ids (required), idempotency_key (required), key, +7 more. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 10 tools

    Disambiguation4/5

    Most tools have clearly distinct roles: evidence append/read, record write/get/revoke, search, list, and task-context recall are separable. Some boundaries are softer between memory_search, memory_list, and memory_context, and memory_write versus memory_save_communication_preference could be confused without reading the detailed guidance.

    Naming Consistency4/5

    All tools use a consistent snake_case memory_ prefix, and most follow a predictable action-oriented pattern such as memory_get, memory_search, and memory_revoke. Minor deviations are memory_context as a noun-style name and memory_append lacking an explicit object noun.

    Tool Count5/5

    Ten tools is well within a reasonable range for a memory service and each seems to cover a distinct part of the workflow. The specialized preference and request-shaping tools earn their place by handling cases that would otherwise overload the generic write/context tools.

    Completeness5/5

    The surface covers the full memory lifecycle: append immutable evidence, read source events, create/update records, retrieve versions, search, list, revoke from recall, and recall task context. Soft deletion via memory_revoke and provenance support make it complete without obvious dead ends.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Persistent memory for AI coding agents, storing decisions, bug fixes, conventions, and discoveries in a local SQLite database and automatically recalling them when relevant. Works with Claude Code, Codex, Cursor, Gemini CLI, and other MCP-compatible agents.
      22
      4
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Gives coding assistants a local-first SQLite store for project and global lessons with evidence, immutable replacements, retrieval tracking, and agent feedback, searched by keyword out of the box or by optional local semantic search. It runs over MCP stdio with launch-bound workspace scopes and write permissions disabled by default, so assistants can save, supersede, archive, retrieve, and rate memories entirely on the local machine.
      6
      MIT
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI coding agents to read and write persistent, local-first memory through MCP, storing decisions, preferences, and error patterns per project while surfacing cross-project guidelines, with semantic search over on-disk SQLite and an optional queue for autonomous task execution.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI coding agents to read and write persistent, local-first memory over MCP, storing decisions, preferences, error patterns, research, and cross-project guidelines in SQLite with semantic search. Agents can recall relevant context before tasks and store new learnings mid-session, keeping knowledge across sessions and projects without any external API calls.
      -