Skip to content

pyrfor/memory-bridge

Repository files navigation

memory-bridge

One shared memory and one shared work journal across multiple AI agent runtimes.

When you run more than one AI coding agent — Claude Code in the terminal, an OpenClaw bot orchestrator, Grok or Antigravity as CLIs, LM Studio locally, Cursor or Copilot in your editor — each forgets what the others did. memory-bridge gives the whole fleet a single canonical memory store and a single append-only work log, so several engines behave as one agent that remembers and knows what is already in progress.

What it does

  • Shared memory sync (sync.mjs) — bidirectional sync of a canonical memory directory between runtimes. Atomic writes (temp + rename), automatic backups, coarse process-level locking, and anti-echo (a memory exported from one runtime is not re-imported as new on the next pass).
  • Append-only work journal (journal.mjs) — every runtime appends events (start / step / fail / done) to a shared journal/journal-YYYY-MM.jsonl. status shows what each task is doing right now and which ones have failed; the next agent reads it on startup to avoid redoing finished work and to surface open failures.
  • Skills manifest sync (sync-skills.mjs) — symlink a shared set of SKILL.md folders into multiple runtimes and keep one manifest in step.
  • Session capture — transcripts from Claude Code / Grok / Antigravity / Cursor / LM Studio are distilled into short summaries and appended to the shared daily log, so work done in any engine is visible to the others.

The idea that sells it: several AI engines operating as one agent, with common memory and a common journal.

Quick start

Requires Node.js >= 18 and, optionally, the sqlite3 binary for capturing Antigravity sessions.

# Memory sync: pull from / push to the canonical store, or do both
node sync.mjs pull
node sync.mjs push
node sync.mjs all

# Work journal
node journal.mjs status                                                  # what is where + open failures
node journal.mjs append --engine claude --naryad my-task \
  --phase start --status wip --action "started the task"
node journal.mjs read --naryad my-task                                   # full history of one task

Configuration

All paths and persona defaults are overridable through environment variables (see .env.example for the full list). A few important ones:

Variable Default Purpose
MEMORY_DIR ~/.claude/projects/<home-encoded>/memory (Claude Code project layout) Canonical memory directory synced by sync.mjs
JOURNAL_DIR ~/.claude/memory-bridge/journal Where journal.mjs reads/writes the work log
MEMORY_BRIDGE_AGENT_NAME / MEMORY_BRIDGE_AGENT_SLUG Agent / agent Shared persona name used in prompts, presets, rule files
MEMORY_BRIDGE_USER_NAME User Name of the user the agent serves (used in transcript labels)
MEMORY_BRIDGE_USER_CONTEXT (empty) Short context blurb injected into editor / system prompts
MEMORY_BRIDGE_FACT_PRIORITY (empty) Comma-separated memory fact stems to load first
MEMORY_BRIDGE_SQLITE /usr/bin/sqlite3 sqlite3 binary path, used to read Antigravity session DBs

Example:

cp .env.example .env
# edit .env, then:
MEMORY_DIR=~/my-shared-memory node sync.mjs all

Persona defaults are intentionally generic (Agent / User). Set MEMORY_BRIDGE_AGENT_NAME and MEMORY_BRIDGE_USER_NAME to give the fleet a shared identity — every runtime will then speak with the same voice and know the same user.

Repository layout

sync.mjs                # memory sync between runtimes (push / pull / all / cycle / capture-*)
journal.mjs             # append-only work journal (status / append / read / project / tail)
sync-skills.mjs         # skills manifest + symlink sync
journal-hook-parse.mjs  # helper: parse hook JSON into journal-hook shell env
journal-hook.sh         # shell hook feeding runtime events into the journal
repos.example.txt             # template — git repos to scan for commits
director-repos.example.json   # template — repo map for director / test gates
.env.example                  # template — all environment variables
journal/                      # journal storage (journal-YYYY-MM.jsonl + WORKLOG.md projection)

repos.txt, director-repos.json, editor-targets.json, and distill-prompt.md are intentionally not included — they point at private repositories and contain personal prompts. Copy the *.example.* templates, fill in your own paths, and they are picked up on the next run.

Hooks

Wire journal-hook.sh into your runtime's session lifecycle (e.g. Claude Code Stop / SessionEnd hooks) so failures and session boundaries are recorded even when the agent itself is killed mid-run. The hook resolves its sibling journal.mjs / journal-hook-parse.mjs relative to its own location, so it works from any install path.

License

MIT — see LICENSE. Copyright (c) 2026 Aleksandr Grebeshok. Source: https://github.com/pyrfor/memory-bridge.

About

Git-native shared memory and append-only work journal that let multiple AI agents/engines act as one

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors