ai-memory-hub
v0.1.0
Published
Cross-IDE persistent AI memory: captures sessions from Claude Code, Codex, opencode and Antigravity into a unified store synced via git (GitHub/GitLab), with an MCP recall server so any IDE can resume where another left off.
Downloads
35
Maintainers
Readme
ai-memory-hub
One memory for all your AI IDEs. Preserves your Claude Code, Codex CLI, opencode and Antigravity chats/work in a unified local store — synced to a git repo of your choice (GitHub/GitLab) — so you can pick up where you left off in any IDE, on any machine.
Claude Code ─┐
Codex CLI ──┤ capture adapters ~/.ai-memory (git repo) recall MCP server
opencode ──┼──(hooks/watchers)────► projects/<key>/sessions ──► any IDE can call
Antigravity ─┘ projects/<key>/CONTEXT.md recall_context()
│ search_memory() ...
▼
GitHub / GitLab (private repo)Why
Every AI IDE saves its history in its own private format in its own folder. Switch from Claude Code to Codex (or move to a new laptop) and your project context is stranded. ai-memory-hub continuously imports every session into one open, normalized store and exposes it back to all IDEs via MCP.
Quick start
npx ai-memory-hub init # detects installed IDEs, wires up MCP + hooks
ai-memory capture # imports existing session history
ai-memory status # see what was captured per projectThen restart your IDEs. A new ai-memory MCP server appears with these tools:
| Tool | What it does |
|---|---|
| recall_context(project?) | Rolling digest of recent sessions for a project — the "resume where I left off" tool |
| search_memory(query) | Full-text search across all captured sessions |
| list_sessions(project?) | Browse captured sessions |
| get_session(id) | Read one full normalized transcript |
No MCP support? Just run ai-memory resume in a project folder and paste the digest.
Knowledge base in your project repo (graphify)
The store in ~/.ai-memory is personal. To make project knowledge travel with the repo itself, graphify writes a knowledge base into each project folder:
ai-memory graphify purvanshbhatt-AIRS # one project
ai-memory graphify --all # every captured projectThis creates <project>/.ai-memory/:
| File | Contents |
|---|---|
| INDEX.md | Human-readable knowledge base: session timeline, most-discussed files, key decisions, topics |
| graph.json | Machine-readable knowledge graph — nodes (sessions, files, decisions, topics) + weighted edges |
| GRAPH.md | Rendered Mermaid dependency/topic graph (viewable directly on GitHub/GitLab) |
Commit and push as usual — anyone who clones or pulls the repo gets the full AI work history. With graphifyInRepo: true in ~/.ai-memory/config.json (set by default via init --graphify-in-repo), every capture regenerates it automatically.
Sync across machines (GitHub/GitLab)
# create an empty PRIVATE repo on GitHub/GitLab first, then:
ai-memory sync --remote [email protected]:you/ai-memory.gitCaptures auto-commit; pushes happen automatically when a remote is set. On another machine, install and git clone the same repo into ~/.ai-memory.
Commands
| Command | Purpose |
|---|---|
| init | Detect IDEs, create store, register MCP servers + SessionEnd hook |
| capture [--source ...] [--force] | Incremental import of new/changed sessions |
| watch | Long-running watcher that captures as you work |
| status | Projects, session counts, CONTEXT.md presence |
| search <query> | Search everything |
| resume [project] | Print the context digest |
| graphify [project] --all | Write the knowledge base into project repos |
| sync [--remote url] | Commit/push/pull the store |
| serve | Run the recall MCP server (stdio) |
How capture works per IDE
- Claude Code — reads
~/.claude/projects/**/*.jsonl; aSessionEndhook triggers incremental capture after each session. - Codex CLI — walks
~/.codex/sessions/**/*.jsonl, parsessession_meta+response_itemrecords. - opencode — copies
~/.local/share/opencode/opencode.db(WAL-safe) and readssession/message/parttables. - Antigravity — reads
~/.gemini/antigravity/conversations/*.dband extracts readable text via a generic protobuf wire-format walk (no proto definitions needed), plus capturesbrain/**/*.mdknowledge artifacts verbatim.
All adapters are read-only toward the IDEs' own storage, idempotent, and track file mtimes so repeated captures are cheap.
Storage format
~/.ai-memory/
├── config.json # remote URL, flags
├── state.json # incremental-capture tracking (not synced)
└── projects/<project-key>/
├── CONTEXT.md # auto-generated rolling digest
├── sessions/<ide>-<id>.json # normalized sessions
└── artifacts/… # e.g. Antigravity brain notesA normalized session:
{
"id": "…", "ide": "claude-code",
"projectId": "you-your-repo", "projectPath": "P:/projects/foo",
"title": "Fix login bug", "startedAt": "…", "updatedAt": "…",
"messages": [{ "role": "user", "content": "…", "ts": "…" }]
}Project keys prefer the git remote slug (owner-repo) so the same repo maps to one bucket on every machine.
Privacy
Sessions can contain secrets. Options:
--redactflag oninitenables pattern-based redaction (API keys, tokens, private key blocks) before writing.- Use a private repository.
state.json/config.jsonare gitignored automatically.
Limitations (v1)
- Antigravity payloads are protobuf without public schemas — extraction is best-effort text recovery plus its markdown
brain/artifacts (which are high-signal). - Antigravity messages are stored as extracted strings without role labels.
- Codex/opencode/Antigravity rely on the watcher (
ai-memory watch) or manualcaptureunless their native schedulers fire; Claude Code has a true SessionEnd hook.
Development
npm install
npm run build
npm test # vitest unit tests with fixtures
AIMH_HOME=/tmp/test-store node dist/cli.js capture # try against your real data safelyMIT license.
