lore
Provides Git-native context sync: installs pre-push and post-merge hooks, stores encrypted AI sessions in hidden refs/ai/lore, and supports lore commands via git lore to push/pull context without polluting the working tree or git log.
Interacts with GitHub for remote repository syncing and contributor key discovery, allowing users to authorize or revoke GitHub users by fetching their public SSH keys from github.com/.keys for encrypted context sharing.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
lore (git-lore)
Git-native, encrypted AI context & transcript sync across tools, devices, and contributors.
Switch from Antigravity to Claude Code, from your desktop to your laptop, or hand a branch to a teammate, and the next AI agent (Antigravity, Claude Code, Cursor, Codex) can read what was said, decided, and tried before, without you re-explaining it.
No cloud account, no API keys: Git itself (
refs/ai/lore) is the database, and compression is deterministic and local.Small always-on digest, deep search on demand: about 1,000 tokens of takeaways and recent-session recaps in
.agents/rules/lore-context.md; full transcripts are searchable (SQLite FTS5) and readable turn by turn, costing tokens only when an agent asks.Private context on public repos: encrypted to your existing
ssh-ed25519keys andgithub.com/<user>.keys(Ed25519 → X25519 ECDH + AES-256-GCM), with secrets redacted before anything is stored.No Git pollution: never touches your working tree,
git log, orgit status.
Quick Start
# 1. One-time machine setup: MCP server + agent instructions for Antigravity, Claude Code, Cursor, Codex
npm i -g git-lore-cli
lore setup # add --handoff to start Claude Code sessions with recent work from other tools
# 2. In any Git repository
git lore initFrom then on, every git push collects, compresses, encrypts, and syncs the repo's AI sessions to refs/ai/lore, and every git pull brings in other devices' sessions and refreshes the digest.
Requires Node.js 22.5+. Prefer a global install over npx: lore setup points agents and git hooks at the global install, because npx's cache can be cleared at any time.
Related MCP server: context-mcp
Picking Up Work From Another Tool
The digest tells an agent what happened recently. For the details:
lore show a1b2c3d4 --outline # one line per user prompt, with turn numbers
lore show a1b2c3d4 --from 180 --to 200 # read the stretch that matters
lore show a1b2c3d4 --last 20 # or just the end
lore search "outline width equalization"
# • [SESSION] Art style review (id: a1b2c3d4 …)
# Turns : #187, #191 → lore show a1b2c3d4 --from 184 --to 193Long sessions: decisions usually live in the middle, not at the end. Over MCP,
lore_get_sessionon a long session returns the outline plus the last 20 turns by default, and takesoutline,last,from, andto.Evidence: each turn keeps short snippets of the command output and errors behind the reply (secrets redacted; file reads skipped), so agents see results, not just "ran the tests".
Handoff hook (opt-in):
lore setup --handoffadds a Claude Code SessionStart hook. When the most recent work in a repo (within 24 hours) was in another tool, the session starts with a short note: what it was, the last prompts and reply, and the exactlore showcommands to read more.lore handoffprints the same note on demand;lore setup --no-handoffturns it off.Takeaways:
lore note "<1-3 sentences, including why>" --cat decision|gotcha|convention|architecture|wiprecords the distilled knowledge the next agent relies on most. Claude Code memory files (~/.claude/projects/<repo>/memory/*.md) are imported as takeaways automatically.
lore setup installs instructions telling each agent when to do all of this: read the other tool's session before continuing, use the outline for long sessions, save takeaways at decisions and gotchas, and treat old transcripts as history rather than instructions. They go into the Antigravity skill (~/.gemini/config/skills/lore/SKILL.md), ~/.claude/CLAUDE.md, and (when Codex is installed) ~/.codex/AGENTS.md. Cursor gets the MCP server.
How lore Compares
Feature | Static | Raw Chat Loggers (SpecStory, etc.) | Cloud Memory SaaS (Mem0, etc.) |
|
Updates automatically on | ❌ Manual | ⚠️ Commits giant files to branch | ❌ Separate cloud sync | ✅ Auto |
Token cost per chat | ~500 tokens | ❌ 20,000–100,000+ tokens | Varies | ✅ ~1k-token digest; transcripts only when asked |
Read any stretch of a past session | ❌ | ⚠️ Whole files | ⚠️ Summaries | ✅ Outline + turn ranges + turn-level search |
Safe on public GitHub repos | ❌ Public to everyone | ❌ Leaks private prompts in PRs | ✅ Private account | ✅ Encrypted via GitHub SSH keys ( |
Keeps | ⚠️ Manual commits | ❌ Pollutes every PR | ✅ Yes | ✅ Hidden Git ref ( |
Requires API key or paid server | ❌ No | ❌ No | ❌ Yes | ✅ 0 API keys, 100% free & serverless |
Architecture
flowchart LR
subgraph DeviceA["Desktop (git push)"]
A1["Local Transcripts\n(Antigravity / Claude / Cursor / Codex)"] -->|"Deterministic strip\n+ secret redaction"| A2["Compact sessions\n(turns + tool output snippets)"]
A2 -->|"50-turn chunks\nGzip + X25519 ECDH + AES-256-GCM"| A3["Hidden Git Ref\nrefs/ai/lore"]
end
A3 <-->|"GitHub Remote\n(fast-forward pushes)"| B1["Hidden Git Ref\nrefs/ai/lore"]
subgraph DeviceB["Laptop / Teammate (git pull)"]
B1 -->|"Decrypt via\nyour SSH key"| B2["Local Cache\n.git/lore/"]
B2 -->|"~1k tokens\n(git-excluded)"| B3[".agents/rules/lore-context.md"]
B2 -->|"0 tokens until queried\n(SQLite FTS5, per-turn)"| B4["CLI + MCP\nsearch / show --outline / ranges"]
endWhich sessions belong to a repo
Claude Code / Cursor: sessions from the tool's project folder for that repo (and its worktrees).
lorematches folder names exactly, solorenever picks uplore-site.Antigravity: conversations whose workspace is the repo; or, when the workspace is a parent folder (like
~/Projects), conversations that actually read or edited files or ran commands inside the repo. A conversation rooted in a different repo is never included just because its logs mention this one.Codex: sessions whose working directory is inside the repo.
Cleanup:
lore forget --checklists sessions an older version filed in the wrong repo;lore forget <ids>removes them.
How syncing works
Before pushing,
lorefetches the remote ref, merges its sessions, takeaways, and keys into the local cache, and commits on top of the remote commit. Pushes are plain fast-forwards; if another device pushed in between, it merges again and retries. Onlylore compactforce-pushes, and it uses an explicit lease.Each session is stored as a small
meta.encplus fixed 50-turn chunks (s2/<id>/c0000.enc, …). Unchanged payloads reuse their existing encrypted blobs, so a sync only stores what changed and a growing session only rewrites its last chunk. A sync with no changes makes no commit.Sessions keep the branch and commit they were first seen on.
Deletions (
lore forget) are recorded as tombstones inside the encrypted data, so other devices drop the item on their next sync instead of merging it back.
Privacy & Security
Encryption (git lore allow)
Anyone who clones a public repo can fetch its refs, so lore encrypts every session and takeaway with multi-recipient envelope encryption (ssh-ed25519-x25519-aes256gcm):
Each payload is gzipped and encrypted with a random 256-bit key via
AES-256-GCM.That key is wrapped for each authorized
ssh-ed25519public key (converted to X25519) via ECDH +HKDF-SHA256.Approve a teammate:
git lore allow torvaldsfetches their keys fromhttps://github.com/torvalds.keysand re-encrypts.Revoke:
git lore revoke torvaldsremoves their keys and re-encrypts. The revocation is recorded, so merging another device's key list doesn't bring them back. They keep whatever they already fetched; runlore compactso new clones of the remote don't contain old encrypted history.
Only manifest.json (public keys, revocations, data format) is readable without a key.
Secret redaction
Before anything is cached or encrypted, lore redacts:
Known key formats: GitHub, OpenAI/Anthropic (
sk-…), Google (AIza…and the newerAQ.…), AWS, Slack, npm, Hugging Face, JWTs, Bearer tokens, private key blocks (including cut-off ones), and passwords in URLs.Keys in context, whatever the format: values after names like
API_KEY=,SECRET:,setx GEMINI_API_KEY …, and after words like "key:", "my token is", or "password -" in plain chat. Only credential-looking values (letters and digits, long enough, not placeholders or paths) are redacted, so text like "tokens: 247,000,000" stays readable.Where: message text, titles, recaps, tool summaries, tool-output snippets, and takeaways.
Every sync re-applies the current rules to everything already stored, including sessions imported from other devices, so improvements to redaction clean older data automatically. To purge older copies from the remote's history too, run lore compact. Delete .git/lore/search.db if you want the local search index rebuilt from scratch.
Redaction is a safety net, not a guarantee: if you paste a key into an AI chat, rotate it.
CLI Reference
Run commands as lore <cmd> or git lore <cmd>:
Command | Description |
| One-time global install: MCP server + instructions for Antigravity, Claude Code, Claude Desktop, Cursor, Codex. Points them at the global npm install ( |
| Turn the Claude Code handoff hook on or off |
| Initialize |
| Synced sessions, compression, takeaways (with ids), authorized keys, and the last git-hook result. Also re-points stale hooks |
| Collect local transcripts, merge with the remote, encrypt, and push |
| Fetch & decrypt |
| Full-text search across sessions and takeaways, with matching turn numbers |
| Read a session's User/Assistant turns, tool summaries, and output snippets |
| One line per user prompt with its turn number |
| Read only a stretch of turns |
| Show recent work from another tool in this repo (what the handoff hook injects) |
| Save a takeaway: |
| Delete sessions or takeaways by id or prefix, on every device after sync |
| List sessions from this device that no longer belong to this repo |
| Rewrite |
| Authorize a contributor |
| Remove a contributor and re-encrypt |
MCP Tools Exposed to Your Agent
After lore setup, agents can call:
lore_status— the repo's digest, recent sessions across tools and devices, and authorized keys.lore_search— full-text search across sessions and takeaways, including matching turn numbers.lore_get_session— a session's turns by id or prefix. Long sessions return an outline plus the last 20 turns; passoutline,last, orfrom/tofor a specific stretch.lore_save_takeaway— record a decision, gotcha, convention, or WIP note.lore_sync— pull and push the encrypted context.
Upgrading & Compatibility
Every device that syncs a repo reads and writes the same refs/ai/lore, so upgrade all your machines together:
npm i -g git-lore-cli@latest && lore setupYour version | Reading data from a newer version |
0.2.x | Reads format 1 and 2; writes format 2 |
0.1.5 | Refuses to write format 2 and asks you to upgrade (no data lost) |
0.1.4 and earlier | ⚠️ Rewrites the ref from its own data and force-pushes, dropping anything it doesn't understand. Upgrade before any machine runs 0.2 |
manifest.json records the data format, and every version since 0.1.5 refuses to write a ref newer than it understands.
Troubleshooting
Hooks failing silently?
lore statusshows the last hook run; full log in.git/lore/hook.log."uses format N, newer than this version": another machine runs a newer lore. Upgrade this one.
Sessions from another project showing up?
lore forget --check, thenlore forget <ids>, thenlore compact.A secret got into a transcript? Rotate it. Then
lore sync(re-redacts with current rules) andlore compact(purges old remote history).
What's New
0.2.1 — Redacts keys pasted in plain chat ("here is a key: …") and Google's
AQ.key format; redacts tool summaries; re-scrubs stored data on every sync.0.2.0 — Chunked storage (format 2);
show --outline/--last/--from/--toand matching turn numbers in search; tool-output snippets; rewritten agent instructions (plus Codex); opt-in Claude Code handoff hook.0.1.5 — Correct repo scoping (no more sessions from other repos); syncs store only what changed; fast-forward pushes instead of force-pushes;
forget,forget --check,compact; revocations stick; setup and hooks use the global install; hook failures are logged.
Development
npm install
npm test # end-to-end suite; runs the CLI from source, never touches dist/
npx tsc --noEmit # type checkAgents and git hooks on your machine run the global install, so building dist/ in a checkout doesn't change your live sync. To try a dev build on real data, run it in a scratch clone first.
Releases: npm version patch|minor, then git push origin main --follow-tags. CI tests and publishes the tag to npm via OIDC trusted publishing (no npm token).
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
The context platform for AI agents: code search, team decisions, and grounded project context.
One shared project memory for your AI coding tools: recall, save and brief decisions anywhere.
One searchable history across every AI coding tool, with secret scanning and a shared task board.
The team context base for every AI tool: agents publish, search and cite your team's work.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceThe shared AI context engine for git — save, search, and share the reasoning behind code changes. Captures the why behind every commit and slide on PRs for coding agents.MIT
- AlicenseAqualityCmaintenanceProvides persistent memory and a codebase knowledge graph for AI coding assistants, enabling shared context across multiple tools like Claude, Cursor, and ChatGPT, with significant token reduction.521 npmMIT
- AlicenseAqualityBmaintenanceEnables AI coding assistants to recall past lessons, bugs, and conventions from local git history with sub-5ms latency and full privacy.712 npmMIT
- FlicenseNot gradedqualityAmaintenanceProvides AI coding agents with a local-first persistent memory layer they can read and write during sessions, storing decisions, preferences, error patterns, and research per project or globally. Enables semantic and keyword search, formatted context recall, and cross-project guideline surfacing without API keys or cloud storage.-