- TypeScript 84%
- JavaScript 15%
- Shell 1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| examples | ||
| src | ||
| test | ||
| .gitignore | ||
| install.sh | ||
| LICENSE | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.build.json | ||
| tsconfig.json | ||
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 +SessionStarthook + tool allow rule - Factory Droid (
droid) — MCP +SessionStarthook - 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
mcpServersJSON 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.typefrontmatter preservation (includingoriginSessionId), and surgicalMEMORY.mdupdates that keep your custom sections intact. - 6 dedicated MCP tools:
memory_list,memory_read,memory_write,memory_search,memory_delete, and read-onlymemory_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
.mdfiles to~/.local/state/claude-memory-bridge/backups/<slug>/<timestamp>/before every--apply(keeps last 10 per project;restorealso takes apre-restoresnapshot). - Read-only codebase: passes per-session
--settingstoagydenyingwrite_file(*)andcommand(*). In--dry-run,memory_writeandmemory_deleteare also denied. - Hard single-project lock: sets
CLAUDE_MEMORY_LOCK_PROJECT_SLUGso 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.mdfile),--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.allowadd"mcp(claude-memory/*)"
- Factory Droid:
~/.factory/mcp.json→mcpServers["claude-memory"] = { "command": "node", "args": ["/ABS/PATH/dist/mcp.js"] }~/.factory/settings.json→hooks.SessionStartadd{ "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.