
memgit
dev.memgit由 memgit.dev 發布v0.13.0更新於 Oct 24, 2026
Git for AI memory — version-controlled, searchable context that persists across sessions
概覽
本機 MCP 伺服器,為 AI 助理提供類似 git 的版本化記憶庫,可搜尋、接續工作階段並保存持久的專案脈絡。
- 可以做什麼
- 接續上次進度:取得包含近期檢查點、進行中工作與關鍵規則的工作階段摘要
- 搜尋與讀取記憶:依目前專案範圍做 BM25 檢索,並可讀取單一記憶的完整內容
- 瀏覽與稽核記憶庫:列出已存記憶並查看檢查點紀錄
- 儲存新記憶:把持久事實、慣例與經驗記錄下來供後續工作階段使用
- 依專案隔離脈絡:記憶帶有專案標籤,可明確設為全域,無法判定的寫入會被隔離
- 適用情境
- 適合希望助理跨工作階段、跨不同 AI 工具保留已學規則、慣例與專案狀態的情境,或不必重新說明就能繼續未完成的工作。也適合需要記憶歷史、差異比對與回復,而不只是一個不斷變大的說明檔案的團隊。
- 執行需求
- 以本機 stdio 程序在桌面端執行,可從 npm(memgit-mcp,經 npx)或 PyPI(memgit)安裝。未宣告驗證、API 金鑰或標頭。需在本機初始化記憶庫;可選環境變數如 MEMGIT_STORE、MEMGIT_PROJECT、MEMGIT_AUTHOR 用於調整路徑、範圍與署名。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 memgit,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
memgit — git for AI memory
Your AI assistants forget everything when the session ends. memgit fixes that.
Version-controlled, cross-AI context that persists, diffs, rolls back, and syncs like code. Switch from Claude to Cursor to ChatGPT mid-project — your context is already there.
Why not claude.md? Why not mem-search?
You've probably already tried both. Here's why they hit a ceiling:
Proof — context costs you can measure
Run this on your own store to see the actual numbers (measured where possible; estimates labeled):
Why such a big difference? claude.md loads all context every session. memgit injects a bounded resume digest plus BM25-matched recall — only what is relevant to this session, not everything you've ever recorded. The digest is measured by actually rendering it, and the store total is the real corpus size; nothing here is a simulated benchmark.
The git analogy is literal
memgit's data model maps exactly to git:
This is not metaphorical — memgit uses a content-addressed object store (SHA-256 blobs) identical to git's architecture. Every memory has a stable SHA. Identical content has identical SHAs. Old state is always recoverable.
The store IS a git repo
Every memory is a readable .toon file under memories/. Push your entire memory set to GitHub with standard git:
Teammates pull and start with your AI's learned rules from session 1:
You can grep, git blame, and git diff your memories just like code:
Install
Mac / Linux:
Mac (Homebrew):
Windows:
(The Chocolatey package is live on community.chocolatey.org; newly pushed versions can take a few days to clear moderation — pip install memgit always has the latest.)
Any AI tool config (no Python needed — npx auto-installs on first run):
Quickstart (3 minutes)
init walks you through it — no paths to hunt down. (Importing later is one command with no arguments: memgit sync auto-finds ~/.claude/projects/*/memory.)
Restart your AI tool — it now searches your memory store at the start of every session.
Adopting memgit mid-project
Memory tools have a cold-start problem: install one halfway through a project and it knows nothing — there's no initial point, and context only trickles in from future sessions. memgit solves this with a one-time seeding pass:
onboard first extracts a repo digest deterministically — git history (recent commit subjects, hot files/directories by churn, authors, branch, tags), detected stack from manifests, and the docs worth reading — using bounded, read-only probes that stay near-instant even on huge repositories. The brief then tells your AI agent exactly what to do with it: read only the listed files (no tree crawling), extract 10–20 durable facts (purpose, architecture, conventions, current state, gotchas), save each as a typed memory, and checkpoint the seed set. Paste it into a session — or don't: if the AI searches memory in a project that has none, the MCP server itself replies with the bootstrap instructions instead of a bare "no results."
Memories are project-scoped, filter-by-default (v0.7.0): each carries the workspace it belongs to, and searches, recall injections, and the resume digest (recent memories, checkpoints, depth hints) are filtered to the current project's family plus explicitly-global memories — another project's content never leaks in. Widen deliberately with memgit search --all-projects / all_projects: true (every hit then carries its project label), or hard-filter one project with --project. A memory with no project is explicitly global (applies everywhere): save one with memgit add --global or project: "". A save whose project cannot be determined is never silently global — it's quarantined under _unknown (visible in list as [?project], flagged by lint, surfaced nowhere) until you relabel it with memgit doctor --relabel.
Resume where you left off
Ask an AI "can we proceed on the pending tasks?" in a fresh session and it will guess from whatever file happens to be open. memgit resume replaces the guess with the record:
Wire it into Claude Code so memory becomes automatic — no tool call, no judgment required:
Why hooks and not just good tool descriptions? We measured it: across 166 real sessions, hook-injected context was delivered in 100% of them while voluntary memory-tool calls happened in 6%. What a hook enforces happens.
The resume digest is deliberately bounded (~350 tokens measured on a 500-memory store): rules are clipped, the critical list is capped, and full text is one get_memory call away.
Scale to 10,000+ sessions
After months of use, your checkpoint history grows. Squash compresses it, gc reclaims the disk:
The current memory state is always preserved — and squash is lossless-in-substance: every collapsed checkpoint leaves a one-line record (time, author, diff, message) in an append-only archive under .memgit/logs/archive/ that gc never touches. Benchmark on a 2,000-checkpoint store: 94% smaller (39.5 MB → 2.2 MB), fsck clean. History operations stay O(1) as the chain grows (SHA resolution and checkpoint counting measured at ~0.08 ms at 2,000 checkpoints).
Multiple agents, one memory
All writes go through a git-style store lock (0.08 ms overhead), so concurrent agents can't corrupt the store or lose each other's updates. Two patterns:
Shared thread — agents write concurrently; if one commits while another has work staged, the second commit auto-merges (three-way, against the recorded base) instead of clobbering. Set MEMGIT_AUTHOR=agent-name so each checkpoint says who did it.
Thread per agent — isolate, then integrate:
Conflicts (same memory changed on both sides) resolve to the newest version; an edit always beats a delete. Both histories are preserved.
What the AI sees
Once registered via MCP, every AI tool gets 6 tools:
The tool descriptions teach the AI judgment — "does this request depend on state you don't have in context?" — rather than keyword triggers. Measured cost of the whole tool surface: ~1,150 tokens once per session; a resume_session reply is ~335.
A save that arrives damaged is refused, not stored (v0.13.0). A model sometimes closes a value with a tag named after the field (</rule>), and the host then delivers the next parameters inside that value: why, when, tags and type_code never arrive, and the memory is stored with defaults. On one machine that was 748 of 3,025 saves. save_memory now refuses any value carrying tool-call markup, names the field and the parameters it swallowed, and the model retries in the same turn. Markup quoted on purpose inside backticks is allowed. Every successful save echoes the length of each field it stored, which fields arrived empty, and which values came from a default. Damaged memories already in a store are never served back into context: the digest, the recall hook and read results show each field cut at the damage. memgit doctor counts them, and memgit doctor --repair-markup splits them back into their fields.
Core operating guide (v0.5.0)
A project's hardest onboarding problem isn't what it does — it's how to work in it: which skill to invoke, which command to run, which tool to reach for. That lives in a CLAUDE.md or a skills folder the AI host may or may not be configured to read. memgit carries it for you.
memgit core seed distills a compact operating guide from the project's existing skills + rule files. memgit core sync writes it into every AI host's own rules surface as a dedicated, memgit-owned file — .claude/rules/memgit.md, .cursor/rules/memgit.mdc, .windsurf/rules/memgit.md, .clinerules/, .roo/rules/, .continue/rules/ — and marker-delimited blocks in the shared GEMINI.md (Gemini CLI auto-loads only that file) and Codex's AGENTS.md. It's additive only — memgit never touches your own config or content — and injected at session start, so any tool knows how to work in the project even when its native setup is missing.
And it learns: a sidecar usage ledger tracks which memories actually get recalled, and the most-used ones are auto-promoted as pointers into the guide over time (budget-capped, decaying, and always subordinate to the repo's own rules — it never restates or overrides them). Drifted? memgit core heal rebuilds it.
Since 0.8.0 it also starts itself: a project's first guide is created automatically once it holds a handful of memories, so the loop no longer waits on someone remembering to run core seed. The guide leads with what the project actually holds — "this project has N saved memories covering topics" — because a stated count of real prior work is evidence a model can act on, where an abstract instruction to check memory is something it can weigh against its own confidence and skip.
memgit Pro — one memory across every machine
The local engine, the store, the MCP server and every command below are MIT and never gated. Pro is the hosted layer for people who work on more than one machine or with a team: end-to-end-encrypted sync where the server stores ciphertext only, unlocked by one licence key.
- Buy a key at memgit.dev/#pricing — $12/month or $99/year, billed by Polar (merchant of record, taxes handled). The key arrives by email and in your Polar purchases page.
- The only bytes that leave your machine are the key and memgit's public organisation id, sent to Polar's validation endpoint. No memory content is ever sent.
- Headless hosts: set
MEMGIT_LICENSE_KEY=<key>in the MCP server's environment; it is validated with the same cache and never written to disk. - Fail-open: a key that verified in the last 14 days keeps working offline; a rejected key drops to Free with a clear message. A lapsed plan never locks your data — reads, pulls and exports keep working.
- If this store is logged in to memgit cloud,
pro activatealso upgrades that account.
Sync between machines and with a team
With autosync on, each save (including every save_memory your AI makes) starts one
background pull-then-push and returns immediately, and each session start pulls what other
machines saved. memgit cloud auto status shows the last run and why it would not run.
On a machine that runs an agent but no interactive sessions (a Mac mini, a VM), log in and link once, then keep it current under systemd or launchd:
Everything leaves the machine end-to-end encrypted; the server stores ciphertext only.
Backups that actually happen
memgit's premise is that the AI is the operator — but backup used to require a human to remember memgit git init --remote <url> and keep pushing. On this project's own store that meant 1,734 memories on one disk with no copy anywhere, five weeks in. A maintenance task that needs a human command is a task that will not happen.
Since 0.9.0 it runs itself, at the end of a session, with the safety boundary drawn at network egress rather than effort:
- Local destinations are automatic — a cloud-synced folder you already have (iCloud, Dropbox, Google Drive, OneDrive) or an external volume. memgit copies files; it opens no connection and signs up for no service. Your existing sync client does the rest.
- A git remote is pushed to only if you already configured one. memgit never invents a remote, never creates a repository, and never sends memories to a host you did not choose — memories can contain credentials, and convenience is not a reason to publish them somewhere you never picked.
The backup is a single memgit-store.tar.gz, not a directory tree: a 203 MB store is 10,295 small object files, and giving a sync client 10k files to reconcile every time is how you get a sync client that never finishes. It is staged and renamed atomically, keeping the old copy until the new one lands — an interrupted backup must never leave a corrupt file where a good one used to be.
Ranking you can prove
Retrieval quality used to be adjusted on intuition. memgit eval replaces that with a measurement, using two frozen sets mined from the store itself:
- recall — real prompts and the memories memgit actually surfaced for them. Measures stability: did a change break what used to work?
- synthetic — each memory queried by its own
why, expecting itself back, with the slug's own words stripped out of the query. Measures correctness, independently of any past ranking. (The recall set alone is circular — its answers came from the ranking under test.)
Both report hit@1, recall@3/5/10 and MRR against a pinned baseline. There is deliberately no single blended score, and no fabricated "tokens saved" number.
It earns its keep immediately. Two changes built for 0.8.0 looked obviously right and were measured wrong: a recency multiplier (cut — real-prompt hit@1 −0.020, MRR −0.018) and destructive stemming, which fixed its motivating query while costing hit@1 −0.038 overall (rebuilt as an additive field, then +0.020/+0.041/+0.019). A BM25 normalisation bug introduced in the same release was caught the same way.
Depth advertisement, trackers & supersession (v0.6.0)
Measured across 289 real sessions: injected recall reached ~59% of them, but only 6.8% ever ran an active search — the injected top-3 reads as "memory consulted", so the model never learns there's a queryable store behind it. 0.6.0 makes the passive layer advertise what the active layer knows:
- Memory index — the resume digest ends with tag→count pairs (
8a8f4ec (6) · instagram (5)) and the exact call to go deeper. Counts are truthful: superseded memories are excluded, and every advertised topic is guaranteed to return search results. - "+N more" recall hints — when the per-prompt recall block has more on-topic memories behind it, it says so, with the one call to get them.
- Context-triggered recall — a
PostToolUsehook: reading a file whose path matches a memory tag surfacesmemgit: 6 memories tagged 'x' relate to this path. Reads only a commit-time tagmap cache (never the store), capped 3/session. - Trackers (
tr) — one memory per in-flight entity (<entity>-status), updated by re-saving the same slug. They render as a status board at the top of every session: memgit is the authority for entity status; files may lag. - Supersession — a correction names what it replaces (
supersedes=[old-slug]) instead of a "CORRECTED:" prefix. Superseded memories vanish from search/recall/resume (history preserved;liststill shows them marked ⊘), so injected context is never stale.
Commands
AI tool support
What memgit reads from your environment
memgit runs inside your agent, so the honest answer to "what does this process
read from my environment?" should be checkable rather than a promise. The table
below is generated from memgit/env.py, and
tests/test_env_inventory.py walks the package on every test run and fails if
the code reads a name this list does not carry — or carries a name nothing
reads. The list cannot drift away from the code.
memgit reads these and nothing else. It writes none of them. None of them turn
network access on: the cloud endpoints are overrides for a sync you have already
opted into with memgit cloud login, and with no licence and no cloud login,
memgit talks to nothing.
How the project label is decided
Memories are project-scoped, so a wrong label files a memory where you will not find it again. The label comes from the first of these that yields one, and there is exactly one detection path shared by the MCP server, the CLI and the hooks — so a label derived at save time and one derived at recall time cannot disagree:
MEMGIT_PROJECT— a forced label, taken verbatim- the
cwda host reports in its hook payload (the real workspace, even when the process working directory is elsewhere) CLAUDE_PROJECT_DIR- the process working directory
The label keeps [A-Za-z0-9-] and turns everything else into a dash, exactly as
Claude Code names its projects/ directories — including the _ character,
which becomes a dash. Labels written before v0.12.0 kept the _; they are
folded onto the dash form when two labels are compared, so nothing written
under the old form stops resolving, and nothing stored is rewritten.
A project whose memories have split across two labels raises no error
anywhere: the save succeeds, fsck stays clean, and the only symptom is an
answer that is missing things. memgit doctor reports splits, stranded labels
and the save landing rate by default; memgit doctor --audit adds every
row. A repair heals toward the label whose directory exists, never toward
the one holding more memories.
When none of them yields a label — running from $HOME, for instance — a write
is quarantined under _unknown rather than filed globally, and
memgit doctor --relabel moves it once you say where it belongs. Folding a
free-text label onto an existing project (log-report → Downloads-log-report)
happens only when the input is a trailing segment of exactly one known label and
that label already holds memories; anything ambiguous is left alone, and every
fold is reported rather than done silently.
TOON format — compact, readable, diffable
Standard markdown memory file:
The same memory in TOON:
Measured with a real tokenizer, TOON is ~5–10% leaner than equivalent markdown — a nice bonus, not the headline. The headline saving is retrieval: memgit loads the top-8 relevant memories per query instead of everything.
At 108 memories: 12,840 tokens (dump everything) → 640 tokens (memgit BM25 top-8)
For exact token counts in memgit stats, install the optional tokenizer: pip install "memgit[tokens]".
Architecture
Contributing
See CONTRIBUTING.md.
Roadmap
- Content-addressed object store (git-identical architecture)
- TOON format (compact line-oriented memory format)
- MCP server — Claude Code, Cursor, Windsurf, Cline, Continue.dev
- HTTP server — ChatGPT Custom Actions, Gemini function calling
- BM25 relevance search (load only what matters)
-
memgit stats— measured token savings proof -
memgit squash— scale to 10k+ sessions -
memgit git push/pull— team sync via standard git - Flat
memories/directory — grep/diff/blame your memories - D3.js graph visualization of memory relationships
-
memgit resume+ SessionStart hook — sessions start with "where we left off" - Guardrail hooks — per-prompt auto-recall + end-of-session capture guard (v0.4.0)
- Core operating guide — per-project, always-on, cross-host, self-improving (v0.5.0)
-
memgit gc— space reclamation (mark-and-sweep, lossless squash archive) - Multi-agent write safety — store lock, auto-merge commits,
memgit merge - PyPI + Homebrew (tap) + npm published (v0.1.5)
- Chocolatey — live on community.chocolatey.org (
choco install memgit) - Interactive setup wizard (
memgit setup) - Smart
memgit init(auto-detects tool, no path needed) - Lossless memories — full
bodyalongside the compact rule (v0.3.0) - Project-scoped memories +
memgit onboardmid-project bootstrap (v0.3.0) - VS Code extension (v0.1.5, Marketplace: code416-memgit.memgit)
- Codex + Antigravity support — MCP registration +
AGENTS.mdcore guide (v0.8.0) -
memgit eval— measured retrieval quality, real + non-circular sets (v0.8.0) - Usage-aware ranking — the recall ledger feeds relevance, not just the guide (v0.8.0)
- Automatic core-guide bootstrap — the self-improving loop starts itself (v0.8.0)
- Automatic off-machine backup — no human command required (v0.9.0)
- JetBrains plugin (Phase 3)
- Semantic search via embeddings — gated on
memgit evalshowing a real gain (Phase 4) - Public benchmark numbers (LongMemEval, LoCoMo) (Phase 4)
- memgit.dev website (live)
- Memory compression / auto-summarization (Phase 5)
- Team access control + audit trail (Phase 5)
- Memory marketplace — share reusable context packs (Phase 6)
License
MIT — see LICENSE.
來源:README.md,提交 c096248
工具
0版本歷史
3- v0.13.0最新Oct 8, 2026
- v0.12.0Sep 20, 2026
- v0.11.0Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分