Everything you need to use memgit — installation, commands, IDE integrations, and the TOON format spec.
Get memgit running in under 30 seconds:
What this does: memgit creates a content-addressed object store for your AI assistant's memory files (CLAUDE.md, .cursorrules, etc.). Instead of loading all memories every session, your AI loads only the top-8 relevant ones via BM25 — saving 95% of tokens.
The primary distribution — works on macOS, Linux, and Windows.
The npm package memgit-mcp is the MCP server for Node.js-based AI tool configs. You don't install it globally — just reference it via npx in your MCP config:
Package on npm: npmjs.com/package/memgit-mcp
Uses a custom tap hosted at github.com/code4161/homebrew-tap:
Install from the VS Code Marketplace: code416-memgit.memgit. The extension shows your memgit log in the Activity Bar and runs memgit commit on file save.
winget support is planned for a future release (requires a standalone Windows executable). Use pip in the meantime.
Not yet published to the Chocolatey community feed — use pip on Windows for now. Once it lands it will be installable as:
Initialize a memgit store. With no argument it auto-picks the best location (Claude Code, Cursor, or Windsurf store paths, else ~/.memgit-store). Import existing memories afterwards with memgit import claude-code.
Add or update a mnemonic: a kebab-case slug plus the fact itself, with optional type, why/when context, tags, and priority.
Create a checkpoint of the current memory state. memgit sync can also pull from Claude Code memory files and auto-checkpoint in one step.
Show the checkpoint history. Each entry shows a short SHA, message, timestamp, and memory delta.
Show what changed between two checkpoints. Uses git-compatible short SHA refs.
BM25 relevance search across all memories. Returns ranked results with token count estimate.
Revert to a previous checkpoint. Creates a new commit for traceability — history is never lost.
Show token usage comparison between loading all memories vs. memgit's BM25 top-N approach.
Manage memory threads. Threads let you maintain separate memory contexts (e.g. per project or per client).
Register memgit with an installed AI tool by writing the MCP server entry into that tool's config.
memgit integrates via the MCP (Model Context Protocol) stdio server. Run:
This registers the memgit MCP server in ~/.claude/settings.json — Claude Code then searches and saves memories through the 5 MCP tools.
Registers the memgit MCP server in ~/.cursor/mcp.json:
Install the VS Code extension and configure the path to your memgit repository:
Then add to settings.json:
Registers the memgit MCP server in ~/.windsurf/mcp.json.
Use Gemini function calling against the HTTP server with the tool definitions in llm-tool-definitions.json from the memgit repo.
Any LLM that supports HTTP function calling can use the memgit HTTP server (port 7474 by default):
The OpenAPI spec is at openapi.json in the memgit repo root. Use it to configure ChatGPT Custom Actions or any OpenAPI-compatible client.
memgit organizes memories into six types:
feedback (fb)Rules and preferences about how the AI should behave — avoid X, prefer Y approach.
user (us)Facts about you — your role, expertise level, and preferences.
project (pj)Project context — decisions, deadlines, architecture choices.
reference (rf)Pointers to external systems — Linear projects, Grafana dashboards, API endpoints.
convention (cn)Code style, naming, and architecture rules.
lesson (lx)Lessons learned and post-mortems — ‘we got burned by X’.
TOON (Thought Object Observation Notation) is memgit's storage format — line-oriented, human-readable, and diff-friendly. It is modestly leaner than equivalent markdown (~5–10% with a real tokenizer); the big token savings comes from BM25 top-k retrieval, not the format.
A memory in TOON format looks like:
Each line is a sigil-prefixed field: the header carries type, slug, timestamp, and priority; # lines carry tags; KEY:value lines carry the rule and its context. No quoting or escaping needed — every field diffs cleanly under git.
You can import existing memories: memgit import claude-code ~/.claude/projects/ or memgit import file memories.md
memgit ships a Model Context Protocol (MCP) stdio server with 5 tools:
search_memoriesBM25 search — returns top-N relevant memories as TOONget_memoryFetch a specific memory by sluglist_memoriesList all memories with metadatasave_memoryUpsert a memory and auto-commitget_checkpoint_logRetrieve the last N commit messagesThe MCP config written by memgit setup tells Claude Code to call search_memories at context-load time, injecting only the relevant 640 tokens instead of your full memory file.
For ChatGPT, Gemini, or any HTTP-capable LLM:
/memoriesList all memories/memories/:slugFetch one memory by slug/memories/searchBM25 search with query body/memoriesCreate or update a memory/logGet checkpoint history/statsToken usage statsFull OpenAPI 3.1 spec: openapi.json in the memgit GitHub repo.