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 or Chocolatey in the meantime.
Package submitted and pending Chocolatey moderation (1–3 days). Will be installable as:
Initialize a memgit repository in the current directory. Automatically scans for and imports existing AI memory files.
Stage a memory for the next commit. Accepts a file path or a TOON-formatted string.
Create a checkpoint with all staged memories. This is called automatically by the IDE hooks.
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. Writes the MCP server config, adds the Stop hook, and creates the initial commit.
memgit integrates via the MCP (Model Context Protocol) stdio server. Run:
This registers memgit-mcp in ~/.claude/settings.json and installs a Stop hook that auto-commits on session end.
memgit writes the top-8 relevant memories into your .cursorrules file before each session.
Install the VS Code extension and configure the path to your memgit repository:
Then add to settings.json:
Writes relevant memories into .windsurfrules at session start.
Populates GEMINI.md and tools.json with the top-8 memories.
Any LLM that supports HTTP function calling can use the memgit HTTP server (FastAPI, port 8765 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 five types:
feedbackRules and preferences about how the AI should behave — avoid X, prefer Y approach.
userFacts about you — your role, expertise level, and preferences.
projectProject context — decisions, deadlines, architecture choices.
referencePointers to external systems — Linear projects, Grafana dashboards, API endpoints.
otherCatch-all for miscellaneous context.
TOON (Token-Optimised Object Notation) is memgit's storage format — 40% more token-efficient than JSON, human-readable, and diff-friendly.
A memory in TOON format looks like:
Compared to JSON, TOON avoids quote-heavy key-value pairs and uses YAML-style frontmatter for metadata. The body is plain text — no escaping needed.
You can import existing markdown files: memgit import --format=markdown 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.