Memory Lean — AI skill for Claude Code
A token-lean MCP memory server for AI coding agents: a knowledge graph your agent can search without reading the whole thing.
How to install Memory Lean
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open zamansheikh/memory-lean and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Memory Lean does
A token-lean MCP memory server for AI coding agents: a knowledge graph your agent can search without reading the whole thing. Drop-in replacement for the reference memory server.
Alternatives in AI
- Wiki Graph — Build the LLM Wiki knowledge graph 2.3k ★
- Syrtis — AI token usage & quota monitor for the macOS menu bar — native Swift, Liquid Glass, 3D contribution graph 368 ★
- TokenBar — AI token usage & quota monitor for the macOS menu bar — native Swift, Liquid Glass, 3D contribution graph 299 ★
README
memory-lean
A memory server for AI coding agents that doesn't burn your context window.
It is a drop-in replacement for the reference MCP memory server ([`@modelcontextprotocol/server-memory`](https://github.com/modelcontextprotocol/servers/tree/main/src/memory)): same `memory.jsonl` file, same nine tool names. The difference is what the tools send back. The reference server answers a search with every matching entity in full, as pretty-printed JSON. This one answers with a short ranked list of names and the matching lines, and the agent opens only the entities it needs.
One file, no dependencies, Node 18+.
Why
A knowledge graph is only useful if the agent can afford to look at it. On a real graph (229 entities, 349 relations, 1,119 observations), measured as characters ÷ 4:
| Call | Reference server | memory-lean | |
|---|---|---|---|
read_graph |
~75,000 tokens | ~1,900 tokens | 40× smaller |
search_nodes (average of 8 everyday queries) |
~19,400 tokens | ~590 tokens | 33× smaller |
A search for a common word ("deploy", 57 matches) drops from ~32,500 tokens to ~860. A narrow search that matches two entities saves much less (~990 → ~650), because there was little to trim.
The graph also stays small on its own:
- An observation longer than 300 characters is rejected, with a message telling the agent to split it or put the detail in the repo.
- An entity keeps at most 15 observations. Past that, the oldest dated ones move
to
archive/.mdnext to the graph file. Nothing is deleted; undated observations (the identity facts) always stay. - A copy of the graph is saved to
backups/once a day, keeping the last 7.
Install
git clone https://github.com/zamansheikh/memory-lean.git
No `npm install` is needed.
Claude Code
claude mcp add --scope user memory \
--env MEMORY_FILE_PATH="$HOME/.claude/memory-graph/memory.jsonl" \
-- node /absolute/path/to/memory-lean/server/memory-lean.mjs
Related Skills
Semble Rs
Fast, AI-agent-native code search in Rust — hybrid BM25 + semantic, Tree-sitter AST chunking, dependency & imp
Lean Agent Skills
⚡ Cut AI coding agent token usage without losing quality — curated Agent Skills for Claude Code, Codex, Antigr
Ast Outline
ast-outline lets AI coding agents pull exactly the code context they need — a repo skeleton, a file outline, o
Graph Hub
Local-first code intelligence for AI agents. Transform your codebase into a queryable knowledge graph. 85% tok
Engraph
Local knowledge graph for AI agents. Hybrid search + MCP server for Obsidian vaults.
Meowary
AI-powered work journal template for software developers. PARA structure, Bullet Journal daily rhythm, Zettelk
Related Agents
Lean Coder
Token-efficient coding agent for any project. Use for edits, refactors and bug fixes (multi-file or unfamiliar
Canon Architect
Orchestrates Canon automatically — detects ecosystem, closes the knowledge graph, compiles context, runs creat
Token Auditor
Scans ui/src/ for hardcoded visual values, duplicate components, and shadcn replacement candidates; produces d