Tools
Tools: How I Built MemCP: Giving Claude a Real Memory
2026-02-11
0 views
admin
What I built ## Never lose context again ## Two types of storage ## Knowledge that connects itself ## Search that improves as you go ## Navigation tools for large files ## Smart cleanup ## Quick install ## What difference does it make? ## Real workflow example ## Why it matters for solo devs ## Try it As a solo developer working on his next idea, Claude has been my pair programming partner for months now, and honestly, it's been incredible, except for one problem that kept driving me crazy: Every time I hit /compact, Claude forgets everything we just worked on. All those architecture decisions we debated? Gone. That bug fix we finally figured out? Vanished. Client preferences I mentioned three times? Claude asks again. It's like Groundhog Day, except I'm the one who has to repeat myself. Until one evening, when I closed my laptop in frustration and made myself some coffee and decided to dig deeper in the topic. After hours of reading, I found two papers that completely changed my life: Recursive Language Models from MIT and MAGMA about multi-graph memory architecture. That's when it clicked. I could build a memory system that works the way I actually think. MemCP is an MCP server that plugs into Claude Code. Here's what makes it different: MemCP watches for /compact commands. When you hit it, Claude gets blocked with "save your work first" until it actually saves insights and context. No more silent memory wipes. There's also gentle reminders every 10 turns if Claude hasn't saved anything yet. Memory is for insights like decisions, facts, preferences, findings. Small pieces of knowledge that matter. Contexts are for big stuff such as entire files, docs, logs. These stay on disk. Claude can inspect metadata (file type, size, tokens) without loading anything. Then peek at specific sections, grep for patterns, or chunk into navigable pieces. Every time Claude saves an insight, MemCP automatically builds connections: So when you ask "why did we make that choice?", it doesn't just keyword search, it follows the cause-and-effect chain. Start with basic install? Keyword search works fine. Add one package? You get ranked search. Add another? Typo tolerance. Add embeddings? Searches understand meaning, not just words. The system automatically uses the best method available. No config needed. Say you have a 50,000-line codebase file. Instead of dumping it into context: You control what enters your context window. After 30 days, unused stuff gets compressed and archived automatically. Important things (marked critical, accessed frequently, tagged "keep") stay active. If you need archived content later, it restores instantly. Two minutes. Restart Claude Code. Done. I ran benchmarks comparing normal usage vs. MemCP: Loading 500 insights normally costs 9,380 tokens. With MemCP? 462 tokens. That's 20x less. Analyzing a massive 50K token document? Normally costs 50,460 tokens (eats your whole context). With MemCP? 231 tokens because you're just peeking at metadata and specific chunks. That's 218x less. But the real killer stat: after /compact, normal mode loses almost everything. MemCP keeps 100% of your stored knowledge. Claude instantly recalls the decision, sees it was tagged critical, knows it's about auth and Redis. Working with large files: You navigate the file like a filesystem, not cramming it into context. When you're building alone, you can't afford to waste time re-explaining yesterday's decisions. MemCP gave me: The three weeks I spent building this paid back in productivity within the first month. MemCP is open source (MIT): 21 tools. Zero mandatory dependencies. Works out of the box. If you've ever hit /compact and felt that sinking feeling watching your context disappear, give it a try. Stars and feedback appreciated. If this helped, drop a heart below! PS: Yes, Claude helped me build its own memory system. Meta, I know. Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse COMMAND_BLOCK:
pip install memcp
bash <(curl -s https://raw.githubusercontent.com/maydali28/memcp/main/scripts/install.sh) Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
pip install memcp
bash <(curl -s https://raw.githubusercontent.com/maydali28/memcp/main/scripts/install.sh) COMMAND_BLOCK:
pip install memcp
bash <(curl -s https://raw.githubusercontent.com/maydali28/memcp/main/scripts/install.sh) CODE_BLOCK:
memcp_remember("User sessions expire after 1 hour, use Redis for storage", category="decision", importance="critical", tags="auth,redis") Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
memcp_remember("User sessions expire after 1 hour, use Redis for storage", category="decision", importance="critical", tags="auth,redis") CODE_BLOCK:
memcp_remember("User sessions expire after 1 hour, use Redis for storage", category="decision", importance="critical", tags="auth,redis") CODE_BLOCK:
memcp_recall(query="how long do sessions last?") Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
memcp_recall(query="how long do sessions last?") CODE_BLOCK:
memcp_recall(query="how long do sessions last?") CODE_BLOCK:
memcp_load_context("api-routes", file_path="src/api/routes.py")
memcp_inspect_context("api-routes") // Shows: python file, 2400 lines, ~15K tokens
memcp_filter_context("api-routes", pattern="def\\s+\\w+") // Just function names
memcp_chunk_context("api-routes", strategy="lines", chunk_size=100) // 24 chunks
memcp_peek_chunk("api-routes", 5) // Read chunk 5 only Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
memcp_load_context("api-routes", file_path="src/api/routes.py")
memcp_inspect_context("api-routes") // Shows: python file, 2400 lines, ~15K tokens
memcp_filter_context("api-routes", pattern="def\\s+\\w+") // Just function names
memcp_chunk_context("api-routes", strategy="lines", chunk_size=100) // 24 chunks
memcp_peek_chunk("api-routes", 5) // Read chunk 5 only CODE_BLOCK:
memcp_load_context("api-routes", file_path="src/api/routes.py")
memcp_inspect_context("api-routes") // Shows: python file, 2400 lines, ~15K tokens
memcp_filter_context("api-routes", pattern="def\\s+\\w+") // Just function names
memcp_chunk_context("api-routes", strategy="lines", chunk_size=100) // 24 chunks
memcp_peek_chunk("api-routes", 5) // Read chunk 5 only - Links to similar ideas
- Links to things from the same work session
- Links cause-and-effect (it detects "because" and "therefore" in text)
- Links things mentioning the same files or modules - Inspect it first (see type, size, preview and costs zero tokens)
- Chunk it into sections
- Peek at just section 5
- Filter for only function definitions - No more context anxiety
- Sessions that build on previous work automatically
- Ability to work with huge files without thinking about token limits
- Decisions from last month still accessible today - GitHub: memcp
- PyPi: claude-memory-mcp
- RLM paper: RLM paper
- MAGMA paper: MAGMA paper
how-totutorialguidedev.toaiserverbashpythongitgithub