Skip to main content
Glama
Agent Memory Bridge

Agent Memory Bridge

by zzhang82

The loop

One process stores a decision. A second process, on the same AMB home, recalls the claim and the reason. The recording is that local stdio proof. It is not a filmed coding-agent session, and it is not an adoption measurement.

The source is examples/demo/first-win-demo.cast. The block below is an abridged transcript of that cast. Regenerating it runs the two processes, then writes generated playback: the header time and the line delays are fixed, not a measurement of the run. Command: python ./scripts/build_first_win_cast.py. Rendering a GIF needs agg; this repository does not include that GIF.

# Session A: store one explicit decision
namespace: project:checkout-app
claim: Merge pull requests only after CI is green on the target branch.
reason: Broken main blocked two releases this month.
stored: true

# Session B: a second stdio process, same home, recall at start
query: What is required before we merge a pull request?
claim: Merge pull requests only after CI is green on the target branch.
reason: Broken main blocked two releases this month.
same_record: true
fresh_process: true

Related MCP server: memento

Recall at the start

Connecting the server is not enough. The next session has to recall on purpose. This page does not claim that connecting MCP, or leaving a skill where it can be found, makes that happen by itself. There is no automatic learning.

Put this rule where the next session will actually follow it:

Before changing code, recall this project's Agent Memory Bridge decisions and their reasons.
Use the namespace from `project resolve`. Call the public `recall` tool.
Store a decision only after it is confirmed. Do not treat chat history as already stored.

Install, then bind the project

AMB requires Python 3.11+ and Git.

Current package/source version: 0.39.1.

python3 -m venv .amb-venv
.amb-venv/bin/python -m pip install agent-memory-bridge==0.39.1
.amb-venv/bin/python -m agent_mem_bridge project init . --yes
.amb-venv/bin/python -m agent_mem_bridge doctor

In later commands, <venv-python> means .amb-venv/bin/python on Linux and macOS. project init detects the Git repository and proposes a namespace such as project:my-app; it accepts --yes for non-interactive runs and --dry-run to preview without writing. It does not learn decisions from the tree. After that, project resolve . returns the namespace.

Run <venv-python> -m agent_mem_bridge with one persistent AGENT_MEMORY_BRIDGE_HOME. Configure a client with connect <client> --yes (and triggers install <client> --yes), or write the command shape by hand from Integrations. Connection is real when the client lists store and recall.

Store one confirmed decision with store:

record_type: decision
claim: Merge pull requests only after CI is green on the target branch.
reason: Broken main blocked two releases this month.

Free-form kind="memory" notes still recall, while explore and inspect list records that declare record_type: decision or record_type: constraint. In the next session, use the startup rule above and ask for that decision.

What you can do with AMB

  1. Decisions and Rules: Teach one confirmed project decision and its reason so the next session recalls why the code is written that way instead of guessing from chat history.

  2. Replacing Outdated Decisions: When a decision changes, replace the older record cleanly so outdated rules stop surfacing by default while remaining in change history.

  3. Agent Handoffs and Claim Timeouts: Post a short-lived handoff item that one worker claims with a timeout so parallel agents do not step on the same task.

  4. Tracked Work Runs and Proof Receipts: Record multi-step run progress, verified outcomes, and tamper-evident receipts showing which memories surfaced.

  5. Connected Clients and Trigger Reminders: Configure Claude Code, Cursor, Codex, Cline, and VS Code with a three-tier connection check (config_valid, server_spawn_verified, and host_cli_verified / host_reload_required), and install per-client reminders for the six workflow trigger moments.

Reading the Python source or raw MCP JSON? See the Plain-Words to Code Glossary for the exact code and wire names (namespace, supersedes, signal, lease_seconds, episode, attestation).

Connect a supported client in one command and run the three-tier connection check:

<venv-python> -m agent_mem_bridge connect claude-code --yes
<venv-python> -m agent_mem_bridge connect cursor --yes
<venv-python> -m agent_mem_bridge connect codex --yes
<venv-python> -m agent_mem_bridge connect cline --config-path ~/.cline/data/settings/cline_mcp_settings.json --yes
<venv-python> -m agent_mem_bridge connect vscode --yes
<venv-python> -m agent_mem_bridge connect cursor --check

connect writes .mcp.json (Claude Code project scope, or VS Code Copilot project format), .cursor/mcp.json, .codex/config.toml, .vscode/mcp.json, or Cline settings (cline_mcp_settings.json). Point a client at a remote HTTP authority with connect <client> --url <url> --token-file <path> --scope user. Project-scope token writes require --allow-project-token, and that config file must stay gitignored and must not be committed.

Install per-client trigger reminders and inspect the honest 6×5 client support matrix (native_hook, deferred_hook, trust_gated_hook, instruction_rule):

<venv-python> -m agent_mem_bridge triggers matrix
<venv-python> -m agent_mem_bridge triggers install claude-code --yes
<venv-python> -m agent_mem_bridge triggers install cursor --yes
<venv-python> -m agent_mem_bridge triggers test claude-code

triggers install writes .claude/settings.json, .cursor/hooks.json, .codex/hooks.json, AGENTS.md, .github/hooks/amb-triggers.json, .github/copilot-instructions.md, .clinerules/amb-triggers.md, and .cline/rules/amb-triggers.md. New untracked project files from connect or triggers install mark the Git worktree dirty. explore and inspect report dirty_worktree until those files are committed or gitignored.

If an existing bridge lives at ~/.codex/mem-bridge, v0.36+ does not open it automatically. Set AGENT_MEMORY_BRIDGE_HOME to that directory, or copy it to ~/.local/share/agent-memory-bridge. The configuration guide has the cutover.

The companion skills are optional help for discovery and everyday use. They do not replace the startup rule above; see trigger moments and hook recipes for additional background. Install them from Agent-Memory-Skills:

npx skills add zzhang82/Agent-Memory-Skills --skill amb
npx skills add zzhang82/Agent-Memory-Skills --skill amb-connect

For a source checkout, install with <venv-python> -m pip install -e . instead of the pinned package.

Human-first Explore answers “What does AMB currently know?” Inspect answers “Why did this information surface?” Both are local and read-only. They are not the success check.

<venv-python> -m agent_mem_bridge explore --namespace project:my-app
<venv-python> -m agent_mem_bridge inspect \
  --namespace project:my-app \
  --query "What is required before we merge a pull request?"

Code tells AMB what the repository contains. A confirmed decision tells it why. Derived repository facts come from a clean Git commit. If HEAD moves or the worktree is dirty, refresh on purpose:

<venv-python> -m agent_mem_bridge bootstrap-repo . --namespace project:my-app

Refreshing repository facts leaves stored decisions unchanged. Explore is CLI-only. It is not an extra MCP tool.

doctor and verify check server prerequisites. They do not prove that a client loaded its MCP config. first-run is optional guided help, not the first-win path. Historical Codex observations from the v0.35 line are in First-win acceptance.

How a decision stays traceable

The useful part is not remembering more. It is knowing where a decision came from, whether it is still current, and how it changed.

Memory concern

AMB approach

Current repository truth

Derived from a clean repository state and refreshed explicitly

Human decisions and constraints

Stored explicitly as governed durable memory

Changed knowledge

Revised or superseded instead of silently overwritten

Why context surfaced

Inspectable through local derived views and evidence paths

Cross-session reuse

Shared through the same configured local AMB home

Privacy

Local-first; no hosted memory service is required

Code tells the next session what exists. AMB retains the confirmed reasons the code does not explain.

What AMB is — and is not

AMB is a governed local project-memory layer for coding agents. Durable knowledge, derived repository facts, provenance, and corrections stay distinguishable.

It is not a transcript archive, a promise that an agent will remember everything, or a system that silently converts every conversation into durable truth. There is no automatic learning.

Memory hygiene: Structure over prose

Do not treat memory as a prompt trash can for linter errors, directory conventions, or syntax dos and don'ts. If an agent makes the same mechanical mistake twice, harden the repository environment with linter rules, type guards, or pre-commit checks. Reserve AMB durable memory for the reasons that code cannot convey: architectural decisions, domain invariants, and third-party library gotchas. See the Memory Hygiene Guide for the 3-question ingestion filter.

Want the details?

Read

For

Glossary

Plain-words feature names mapped to exact code, JSON, and MCP wire terms

First-win demo

The local two-process recording, and the older coordination demo

First-win acceptance

Historical Codex observation from the v0.35 line

Architecture

System shape and data flow

Authority model

Durable authority, derived views, correction, and audit rules

Knowledge Explorer

Human-first read-only project view

Memory Hygiene

Anti-pollution rules and the structure-over-prose boundary

Production Status

Current implementation facts, evidence, and known limits

Integrations

Generic stdio MCP installer contract

Install for Agents

Full install-to-first-success workflow

Configuration

Complete configuration reference

Examples

Sanitized demos and artifacts

Technical model

Internally, AMB keeps code facts read from Git (derived_repository) separate from human-confirmed decisions (governed_durable_memory) so one cannot silently become the other. See the Plain-Words to Code Glossary for the exact code and wire terms. For maintainers and reviewers, the current authority flow is:

flowchart LR
    A[Decisions & Rules / WHY] --> C[Current-Version Recall]
    B[Code Facts / WHAT] --> D[Context Compiler]
    S[Runtime State] --> D
    C --> E[Task Memory]
    E --> D
    D --> F[In-Memory Context]
    F --> G[Context Proof Receipt]
    G --> H[Tracked Work Runs]
    H --> I[Verification Receipt]
    I --> J[Verified Outcome]

SQLite/WAL rows are durable authority. Repository snapshots, FTS rows, embedding sidecars, compiled context, reports, and Explorer views are derived. Context bodies are rendered in process and are not durably persisted by the compiler.

Optional HTTP gateway & deployment

AMB runs as a local-first stdio process by default, with an optional official Streamable HTTP transport and Optional HTTP gateway:

  • Local stdio: no authentication or gateway configuration; it runs as before for individual agents.

  • Optional HTTP gateway: per-client Bearer tokens, 4 roles (admin, writer, reader, orchestrator), namespace limits (project:*, domain:*), and structured JSONL audit lines.

  • Audit kept out of SQLite: audit lines go to stdout, stderr or a file, not the database.

For remote server, NAS, or container setup, see Remote Deployment.

Trust and privacy

AMB is local-first. It does not require a hosted memory service. It separates durable memory from coordination Signals and mutable Dynamic State, keeps provenance visible, and rejects raw transcripts, hidden reasoning, and inline artifact bodies from the durable episode path.

Read the Trust Boundary, Authority Contract, and Closed-Loop Episode Authority for the exact boundaries.

MCP Tools

AMB exposes 17 public MCP tools:

  • store, recall, browse, and stats

  • forget, feedback, promote, annotate, revise, and export

  • begin_run, record_run_event, get_run, and complete_run

  • claim_signal, extend_signal_lease, and ack_signal

The public tool surface stays small. Setup, Project Init, Explore, Inspect, context assembly, and review reports remain CLI or internal derived workflows rather than becoming more MCP tools.

The local protocol cache contract is 300000/public for discovery and 0/private for the tool list; see MCP Compatibility for details.

Current maturity

Current package/source version is 0.39.1. Schema remains v12 and the public MCP surface remains exactly 17 tools. There is no automatic learning and no MCP tool #18. project init is the preferred first-project path. Default Explore is a Human-first view over existing repository-derived context and governed project knowledge. Current evidence and non-claims live in Production Status; published artifacts live in GitHub Releases.

Contributing

Read CONTRIBUTING.md for development and public-surface expectations, and SECURITY.md for vulnerability reporting.

Licensed under MIT.

Available Tools

17 tools
ack_signalA

Acknowledge one claimed or pending signal so downstream polling can stop treating it as active work.

Inputs: id (required), consumer. Returns: object

annotateA

Explicitly enrich one durable memory without pretending the write was a new fact.

Use this after store reports duplicate_with_new_metadata. The original content remains unchanged; title/tag changes and additional provenance are written to an auditable annotation record.

Inputs: id (required), tags, actor, title, +1 more. Returns: object

begin_runA

Start one explicit, stateless run and return server-minted run/work-item IDs.

The bridge does not retain an implicit current run. Callers must pass the returned handles to later event, read, and completion calls. Idempotent retries return the same handles and reject conflicting payloads.

Inputs: goal (required), workspace_key (required), idempotency_key (required), budget, +14 more. Returns: object

browseA

Browse recent items when you do not yet know what to search for.

Use this tool to inspect a namespace by filters alone. It is useful when you want to see recent memory, scan a domain bucket, or confirm that signals are flowing before writing a more specific recall query.

Inputs: namespace (required), kind, limit, domain, +1 more. Returns: object

claim_signalA

Claim one signal with a short lease for lightweight work coordination.

Use this when a worker should take ownership of a pending signal before it acts. If signal_id is omitted, the bridge claims the next eligible signal in the namespace that matches the optional filters, with a small fairness bias inside the oldest pending window so one polling consumer does not keep winning by accident.

Inputs: consumer (required), namespace (required), tags_any, signal_id, +2 more. Returns: object

complete_runA

Append or correct a run outcome without changing memory ranking or policy.

On new runs, verified_success requires a matching current server-minted governed receipt. Outcome corrections form an append-only supersession chain.

Inputs: run_id (required), outcome (required), workspace_key (required), evaluator_type (required), +13 more. Returns: object

exportA

Export bridge content into a readable or portable format.

Use this tool when you want to inspect a namespace outside the MCP client, create a human-readable snapshot, or move memory into another system without opening the database directly.

Inputs: namespace (required), kind, limit, query, +3 more. Returns: object

extend_signal_leaseA

Extend the active lease on one claimed signal.

Use this when a worker still owns a signal but needs more time before another consumer can reclaim it. Expired leases cannot be extended; those signals must be reclaimed instead. Hard signal expiry still takes precedence over lease renewal.

Inputs: id (required), consumer (required), lease_seconds (required). Returns: object

feedbackA

Record structured retrieval feedback for one recalled memory result.

Evidence is append-only/shadow-only. Provenance is caller-declared and not authenticated. This tool does not mutate memory records, recall results, or ranking behavior.

Inputs: memory_id (required), namespace (required), result_rank (required), recall_receipt (required), +5 more. Returns: object

forgetA

Delete one stored entry by id.

Use this tool to remove a bad memory, an accidental write, or a signal that should no longer exist. The response tells you whether anything was deleted and returns the removed item metadata when a match is found.

Inputs: id (required). Returns: object

get_runA

Read current run/work-item projections plus append-only events for reconnect or compaction recovery.

Inputs: run_id (required), workspace_key (required), event_limit, since_sequence. Returns: object

promoteA

Manually promote one stored memory to a stronger durable record type.

Use this tool when you know a record should be treated as a learn, gotcha, or domain note even if the reflex layer has not promoted it yet. Promotion keeps the same id and updates the stored title, tags, and structured content in place.

Inputs: id (required), to_kind (required). Returns: object

recallA

Recall matching entries or poll for new signals from the bridge.

Use this tool to search durable memory, filter by metadata, or poll for fresh coordination signals. For issue-like work, prefer project and domain recall before external search. For workflow polling, pass since, an empty query, and kind="signal".

Empty-query Signal recall returns a next_since cursor for the next polling cycle; other recall modes return next_since=null. The cursor tracks later insertions, not status changes to older Signals.

Inputs: namespace (required), kind, actor, limit, +7 more. Returns: object

record_run_eventA

Append one structured event to a run's durable authority ledger.

Sequence allocation, event persistence, child work-item creation, and projection updates occur in one transaction. This tool never sets an implicit current run.

Inputs: run_id (required), summary (required), event_type (required), workspace_key (required), +16 more. Returns: object

reviseA

Create a new durable memory that explicitly supersedes an older record.

The predecessor remains available for audit. The bridge adds an exact supersedes edge and records the revision receipt instead of silently mutating content in place.

Inputs: id (required), replacement_content (required), tags, actor, +3 more. Returns: object

statsA

Return a quick health summary for one namespace.

Use this tool when you want to inspect what is in the bridge without opening SQLite directly. It returns total item count, a kind breakdown, top domains, and the oldest and newest entry timestamps for the namespace.

Inputs: namespace (required). Returns: object

storeA

Store one entry in the bridge for later retrieval or coordination.

Use this tool when you want to persist a compact memory record or write a signal that another workflow can poll later. Write durable knowledge as kind="memory" and transient coordination events as kind="signal".

Returns the stored entry identifier, timestamp, and duplicate information. Repeated memory writes may deduplicate; signal writes are intended to remain append-like.

Inputs: content (required), namespace (required), kind, tags, +12 more. Returns: object

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 17 tools

    Disambiguation4/5

    Most tools have clearly distinct purposes, with a few pairs like recall/browse and promote/annotate/revise that could be initially confused but are well-delineated by descriptions. Overall, an agent can reliably select the right tool for memory, signal, or run operations.

    Naming Consistency3/5

    The majority of tool names follow an imperative verb or verb_noun pattern (store, recall, begin_run, ack_signal), but a few nouns like 'feedback' and 'stats' break the convention. This mixed style is still readable but not fully consistent.

    Tool Count3/5

    At 17 tools, the set is on the heavier side, though the complex domain of memory plus run/signal coordination justifies most entries. It sits at the boundary where agents might find the surface area slightly overwhelming.

    Completeness4/5

    The tools cover the full memory lifecycle (create, read, update, delete) and provide robust run and signal workflows. Minor gaps exist, such as no direct get-memory-by-id or list-runs operation, but existing tools accommodate these needs reasonably well.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Provides a persistent, local-first memory for coding agents over MCP, enabling automatic recall and recording of past work, failures, and decisions to reduce repetition and token usage.
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Provides persistent memory for AI coding agents via MCP, enabling agents to store and semantically recall facts, events, and lessons across sessions, all running locally without cloud dependencies.
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Local-first memory daemon for AI coding agents that captures session transcripts, distills typed memories (decisions, facts, lessons, commands, todos), and serves them via hybrid search through MCP tools.
      148 npm
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Local-first persistent memory for coding agents and MCP clients. It keeps important project context across sessions and reduces wasted tokens by retrieving only relevant memories instead of replaying unnecessary history.
      8
      1
      MIT