zamansheikh

Memory Lean — AI skill for Claude Code

AI community

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/.md next 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