No description
  • TypeScript 84%
  • JavaScript 15%
  • Shell 1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-23 14:30:46 +03:00
examples feat: initial public release of claude-memory-bridge v0.3.0 2026-11-23 13:32:49 +03:00
src feat: interactive harness picker (agy, droid, codex, cursor, opencode, windsurf, generic MCP) and /dev/tty curl|bash support (v0.4.1) 2026-11-23 14:30:46 +03:00
test feat: interactive harness picker (agy, droid, codex, cursor, opencode, windsurf, generic MCP) and /dev/tty curl|bash support (v0.4.1) 2026-11-23 14:30:46 +03:00
.gitignore feat: initial public release of claude-memory-bridge v0.3.0 2026-11-23 13:32:49 +03:00
install.sh feat: interactive harness picker (agy, droid, codex, cursor, opencode, windsurf, generic MCP) and /dev/tty curl|bash support (v0.4.1) 2026-11-23 14:30:46 +03:00
LICENSE feat: initial public release of claude-memory-bridge v0.3.0 2026-11-23 13:32:49 +03:00
package-lock.json feat: initial public release of claude-memory-bridge v0.3.0 2026-11-23 13:32:49 +03:00
package.json feat: interactive harness picker (agy, droid, codex, cursor, opencode, windsurf, generic MCP) and /dev/tty curl|bash support (v0.4.1) 2026-11-23 14:30:46 +03:00
README.md feat: interactive harness picker (agy, droid, codex, cursor, opencode, windsurf, generic MCP) and /dev/tty curl|bash support (v0.4.1) 2026-11-23 14:30:46 +03:00
tsconfig.build.json feat: initial public release of claude-memory-bridge v0.3.0 2026-11-23 13:32:49 +03:00
tsconfig.json feat: initial public release of claude-memory-bridge v0.3.0 2026-11-23 13:32:49 +03:00

claude-memory-bridge

Share the exact same live Claude Code memory files (~/.claude/projects/<slug>/memory/) with any MCP coding harness — Antigravity CLI, Factory Droid, Codex CLI, Cursor, OpenCode, Windsurf, and any custom MCP client — plus local nightly Auto-Dream consolidation.

No database, no embeddings, no copying, no sync drift. Claude Code stays untouched.

~/.claude/projects/<slug>/memory/
├── MEMORY.md            # Live index shared across harnesses (200 lines / 25 KB cap)
└── *.md                 # Native Claude Code YAML frontmatter (user / feedback / project / reference)
        ▲
        ├── Claude Code          (native Auto Memory)
        ├── claude-memory-mcp    (stdio MCP server: works in ANY MCP harness)
        ├── claude-memory-hook   (SessionStart index injection for Antigravity CLI & Droid)
        └── claude-memory dream  (local Auto-Dream via `agy -p`, backups & restore)

Quick Install (Interactive)

Requires Node.js >= 20 and git.

curl -fsSL https://raw.githubusercontent.com/alesha-pro/claude-memory-bridge/main/install.sh | bash

The installer clones & builds into ~/.local/share/claude-memory-bridge, links ~/.local/bin/claude-memory, and launches an interactive checklist where you pick which harnesses to wire:

  • Antigravity CLI (agy) — MCP + SessionStart hook + tool allow rule
  • Factory Droid (droid) — MCP + SessionStart hook
  • Codex CLI (codex) — [mcp_servers.claude-memory] in ~/.codex/config.toml
  • Cursor — ~/.cursor/mcp.json
  • OpenCode — ~/.config/opencode/opencode.json
  • Windsurf — ~/.codeium/windsurf/mcp_config.json
  • Any other MCP client — prints ready-to-paste mcpServers JSON snippet

Then optionally installs the shared /memory-dream skill and nightly Auto-Dream schedule (macOS launchd or Linux cron, daily at 04:00). Existing configs are merged safely with .bak backups.

Non-interactive / custom flags (./install.sh or claude-memory setup):

claude-memory setup --dry-run                                 # preview without touching any file
claude-memory setup --yes --harnesses agy,codex,cursor        # pick exact harnesses non-interactively
claude-memory setup --yes --print-mcp --no-schedule           # print generic MCP JSON only
claude-memory uninstall                                       # cleanly remove all wired configs & schedule (keeps memories)

What You Get

  • 100% live Claude Code format: identical slug encoding, git repo & linked worktree resolution (--git-common-dir), metadata.type frontmatter preservation (including originSessionId), and surgical MEMORY.md updates that keep your custom sections intact.
  • 6 dedicated MCP tools: memory_list, memory_read, memory_write, memory_search, memory_delete, and read-only memory_list_projects — with cross-process locking, atomic writes, secret redaction, and [[wikilink]] resolution.
  • Opt-in cross-project search: stays strictly inside the current project by default (scope: "current"). Only searches sibling/parent projects (scope: "nearby") or all projects (scope: "all") when asked, while skipping /tmp, scratch workspaces, and excluded paths.
  • Local Auto-Dream consolidation: brings Claude Code's 4-phase background memory cleanup to any setup (including third-party gateways without Anthropic OAuth) using headless agy -p, deterministic pre-scan, automatic pre-run backups, one-command restore, and strict single-project + read-only-repo isolation.

MCP Tools

Tool Scope Purpose
memory_list Current (or project_slug read-only) List project memories and MEMORY.md size stats
memory_read Current (or project_slug read-only) Read full markdown body, metadata, and resolved [[wikilinks]]
memory_write Current project only Create/update .md atomically, redact secrets, update MEMORY.md
memory_delete Current project only Delete .md and remove its MEMORY.md entry
memory_search current (default), nearby, all, or project_slug Local Unicode-aware (EN/RU) ranked search with snippets
memory_list_projects Read-only List projects with non-empty memory (filters temp/excluded)

Auto-Dream (Nightly Consolidation)

Over dozens of sessions, MEMORY.md accumulates duplicates, expired notes, short dates (07.11), and broken [[wikilinks]]. claude-memory dream runs a conservative 4-phase consolidation cycle via headless agy -p (default model: gemini-4-hydrogen-high).

# Preview only (default — strictly read-only, zero file edits)
claude-memory dream /path/to/project --dry-run --with-sessions

# Apply changes (creates an automatic backup first)
claude-memory dream /path/to/project --apply --with-sessions

# Check or roll back backups at any time
claude-memory backups /path/to/project
claude-memory restore latest /path/to/project

Safety & Scheduling Defaults

  • Pre-run backup: snapshots all .md files to ~/.local/state/claude-memory-bridge/backups/<slug>/<timestamp>/ before every --apply (keeps last 10 per project; restore also takes a pre-restore snapshot).
  • Read-only codebase: passes per-session --settings to agy denying write_file(*) and command(*). In --dry-run, memory_write and memory_delete are also denied.
  • Hard single-project lock: sets CLAUDE_MEMORY_LOCK_PROJECT_SLUG so the MCP server physically blocks cross-project access during a dream cycle.
  • Fast on 100+ file banks: runs a ~10 ms deterministic pre-scan (broken [[wikilinks]], unindexed/dangling entries, overlap clusters, short/relative dates) before invoking the model.
  • Smart gates (for --all): --min-hours 24, --min-sessions 3 (or ≥1 modified .md file), --active-within-days 14, --max-projects 3, and --with-sessions (compact ≤16 KB digest of recent user messages from .jsonl).
  • Logs & state: ~/.local/state/claude-memory-bridge/ (dream.log, dream-state.json, launchd.*.log / cron.log).

Optional Config & Manual Setup

Create ~/.config/claude-memory-bridge/config.json to isolate benchmark/private directories or group related projects for scope: "nearby":

{
  "exclude": ["models-benchmarks"],
  "groups": [
    ["~/dev/backend", "~/dev/frontend"]
  ]
}
Manual configuration snippets (if you prefer wiring files yourself)
  • Antigravity CLI:
    • ~/.gemini/config/mcp_config.json → mcpServers["claude-memory"] = { "command": "node", "args": ["/ABS/PATH/dist/mcp.js"] }
    • ~/.gemini/config/hooks.json → "claude-memory": { "SessionStart": [{ "type": "command", "command": "node /ABS/PATH/dist/hook.js --harness antigravity", "timeout": 10 }] }
    • ~/.gemini/antigravity-cli/settings.json → permissions.allow add "mcp(claude-memory/*)"
  • Factory Droid:
    • ~/.factory/mcp.json → mcpServers["claude-memory"] = { "command": "node", "args": ["/ABS/PATH/dist/mcp.js"] }
    • ~/.factory/settings.json → hooks.SessionStart add { "hooks": [{ "type": "command", "command": "node /ABS/PATH/dist/hook.js --harness droid", "timeout": 10 }] }
  • Templates: examples/launchd-nightly-dream.plist, examples/memory-dream/SKILL.md.

CLI commands:

claude-memory setup [--yes] [--dry-run] [--hour 4] [--no-schedule]
claude-memory uninstall [--dry-run]
claude-memory status [path]
claude-memory projects [--filter <text>] [--include-temp]
claude-memory list [path] [--project-slug <slug>]
claude-memory search "<query>" [path] [--scope current|nearby|all] [--project-slug <slug>]
claude-memory dream [path] [--dry-run|--apply] [--with-sessions] [--model <id>] [--force] [--all]
claude-memory backups [path]
claude-memory restore <backup-id|latest> [path]
claude-memory test-hook --harness <antigravity|droid> [path]

Environment variables: CLAUDE_PROJECTS_DIR, CLAUDE_MEMORY_DEFAULT_CWD, CLAUDE_MEMORY_CONFIG, CLAUDE_MEMORY_STATE_DIR, CLAUDE_MEMORY_EXCLUDE, CLAUDE_MEMORY_LOCK_PROJECT_SLUG, CLAUDE_MEMORY_INSTALL_DIR.

License

MIT — see LICENSE.