An MCP-native memory layer for coding agents that turns coding sessions into reusable engineering memory.
Built for Codex-first workflows.
Agent Memory Bridge captures what chat history usually loses:
- durable decisions
- known fixes
- cross-session handoffs
- reusable gotchas
- compact domain knowledge
The core idea is simple: keep the memory layer small, reliable, and inspectable. Let higher-level orchestration sit on top.
The system reshapes session output into durable memory:
- sessions become reusable
learn - repeated failures become
gotcha - clusters of lessons become compact
domain-note
Most agent memory systems drift into one of three patterns:
- memory trapped inside one app or one model
- heavier hosted infrastructure before retrieval basics are proven
- transcript dumping instead of reusable operational knowledge
Agent Memory Bridge takes a narrower path:
- MCP-native from day one
- local-first runtime
- SQLite + FTS5 instead of heavier infrastructure
- automatic promotion from session traces into reusable memory
At its core, it is a memory shaping pipeline:
session -> summary -> learn -> gotcha -> domain-note
Agent Memory Bridge is intentionally narrow.
If you want a broader memory platform with SDKs, dashboards, connectors, and multi-surface application support, projects like OpenMemory or Mem0 are closer to that shape.
This project is different on purpose:
- It is built for coding-agent workflows, not generic note storage.
- It keeps the MCP surface intentionally small:
storeandrecall. - It promotes raw session output into compact machine-readable memory instead of treating summaries as the final artifact.
- It is local-first and inspectable by default.
For a longer positioning note, see docs/COMPARISON.md.
The runtime has four main pieces:
- MCP server
- exposes
storeandrecall
- exposes
- watcher
- observes Codex rollout files
- writes
session-seen,checkpoint, andcloseout
- reflex
- promotes summaries into
learn,gotcha, andsignal
- promotes summaries into
- consolidation
- synthesizes recurring
learnandgotcharecords into domain notes
- synthesizes recurring
This keeps the system understandable:
- raw sessions are not final memory
- summaries are not final memory
- durable memory is machine-first
- synthesis happens after promotion
Requirements:
- Python 3.11+
- Codex with MCP enabled
- SQLite with FTS5 support
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -e .[dev]Copy config.example.toml to:
$CODEX_HOME/mem-bridge/config.toml
Recommended setup:
- keep the live SQLite database local on each machine
- keep shared profile or source vaults on NAS or shared storage if needed
- move to a hosted backend later if you want true multi-machine live writes
Add this to $CODEX_HOME/config.toml:
[mcp_servers.agentMemoryBridge]
command = "D:\\path\\to\\agent-memory-bridge\\.venv\\Scripts\\python.exe"
args = ["-m", "agent_mem_bridge"]
cwd = "D:\\path\\to\\agent-memory-bridge"
[mcp_servers.agentMemoryBridge.env]
CODEX_HOME = "%USERPROFILE%\\.codex"
AGENT_MEMORY_BRIDGE_HOME = "%USERPROFILE%\\.codex\\mem-bridge"
AGENT_MEMORY_BRIDGE_CONFIG = "%USERPROFILE%\\.codex\\mem-bridge\\config.toml"Start the MCP server:
.\.venv\Scripts\python.exe -m agent_mem_bridgeRun the background bridge service:
.\.venv\Scripts\python.exe .\scripts\run_mem_bridge_service.pyRun one cycle only:
$env:AGENT_MEMORY_BRIDGE_RUN_ONCE = "1"
.\.venv\Scripts\python.exe .\scripts\run_mem_bridge_service.pyOptional startup install:
.\scripts\install_startup_watcher.ps1docker build -t agent-memory-bridge:local .
docker --context desktop-linux run --rm -i agent-memory-bridge:localThe container entrypoint starts the stdio MCP server with python -m agent_mem_bridge.
The MCP surface is intentionally small:
storerecall
Common store fields:
namespacecontentkindtagssession_idactortitlecorrelation_idsource_app
Common recall fields:
namespacequerykindtags_anysession_idactorcorrelation_idsincelimit
project:<workspace>globaldomain:<name>- imported profile namespaces when a team wants them
The framework is profile-agnostic. A specific operator profile can be layered on top, but the bridge itself is not tied to one persona or one protocol.
The intended layering is:
- system-level operator profile
- system-level memory substrate:
agentMemoryBridge - project-local overrides: AGENTS.md
The startup protocol is documented in docs/STARTUP-PROTOCOL.md.
In short:
- recall global operating memory
- recall relevant specialization memory
- if a workspace exists, recall
project:<workspace> - for issue-like work, check local memory and gotchas before external search
- inspect live code before trusting recalled implementation details
Run tests:
.\.venv\Scripts\python.exe -m pytestRun the stdio smoke test:
.\.venv\Scripts\python.exe .\scripts\verify_stdio.pyRun the benchmark:
.\.venv\Scripts\python.exe .\scripts\run_benchmark.pyRun the bridge health check:
.\.venv\Scripts\python.exe .\scripts\run_healthcheck.py --report-path .\examples\healthcheck-report.jsonForce a checkpoint from the latest rollout:
.\.venv\Scripts\python.exe .\scripts\sync_now.pyThe repo is intentionally small:
src/agent_mem_bridge/ canonical implementation
scripts/ operational entrypoints
tests/ verification
docs/ design and roadmap
examples/ sanitized demo artifacts
The files that matter most:
- src/agent_mem_bridge/server.py
- src/agent_mem_bridge/storage.py
- src/agent_mem_bridge/watcher.py
- src/agent_mem_bridge/reflex.py
- src/agent_mem_bridge/consolidation.py
- src/agent_mem_bridge/service.py
The bridge exposes only store and recall. This keeps the contract stable and easy to integrate.
The live DB stays local by default because SQLite on shared network storage is a reliability trap.
Agents are the primary readers, so memory favors:
- compact fields
- stable tags
- low token cost
over polished prose.
The system tries to move upward:
summarylearngotchadomain-note
instead of treating raw summaries as the final artifact.
The current foundation is working:
- MCP autoload works in Codex
- project and session sync work
- recall-first workflows work
- reflex promotion works
- first-pass domain consolidation works
Reality check and roadmap:
The framework can host imported operator profiles, but the framework itself stays profile-agnostic.
- README.zh-CN.md
- CONTRIBUTING.md
- AGENTS.md
- docs/COMPARISON.md
- docs/STARTUP-PROTOCOL.md
- docs/MEMORY-TAXONOMY.md
- docs/PROMOTION-RULES.md
- docs/MODEL-ROUTING.md
- docs/ROADMAP.md
MIT. See LICENSE.