01 Install
Mempalace requires Python 3.10 or higher. Install via pip:
pip install mempalace
Verify the install:
mempalace --version
Mempalace installs ChromaDB for vector storage and SQLite for the knowledge graph. No external services are started. Everything stays local.
- Python 3.10+
- ~500MB disk space (ChromaDB models)
- No external APIs required for core functionality
02 Initialize your world
The init command walks you through setting up your world - the people you work with and the projects you work on. This context shapes how Mempalace organizes everything it mines.
mempalace init ~/projects/myapp
During init, Mempalace asks:
- Who do you work with? (Creates person wings)
- What are your main projects? (Creates project wings)
- What are your key goals? (Anchors the L0 identity layer)
The result is a ~/.mempalace/config.json file and the palace directory structure. You can edit this file manually at any time.
# View your palace config cat ~/.mempalace/config.json
03 Mine your data
Mining ingests your data into the palace. Three modes handle different data types:
Projects mode
Code, docs, notes - any directory of text files.
mempalace mine ~/projects/myapp
Conversations mode
Chat exports from Claude, ChatGPT, Slack, or plain text transcripts.
mempalace mine ~/chats/ --mode convos
Supported formats:
- Claude Code JSONL exports
- Claude.ai JSON exports
- ChatGPT JSON exports (from data export)
- Slack JSON workspace exports
- Plain text transcripts
General mode
Auto-classifies content into five memory types: decisions, preferences, milestones, problems, and emotional context.
mempalace mine ~/chats/ --mode convos --extract general
Check status
mempalace status
04 Search your palace
Search uses semantic vector search via ChromaDB plus palace structure filtering. Results are ranked by relevance and palace location.
# Basic search mempalace search "why did we switch to GraphQL" # Search within a specific wing mempalace search "auth decision" --wing projects # Search with room filter mempalace search "naming convention" --room architecture # Return top 10 results mempalace search "postgres config" --top 10
Results include verbatim context, not summaries. What you stored is what you get back.
05 MCP integration with Claude
Model Context Protocol lets Claude call Mempalace tools automatically. Once connected, you never need to run mempalace search manually - Claude does it for you when it needs context.
Connect Mempalace to Claude
claude mcp add mempalace -- python -m mempalace.mcp_server
Or configure manually in Claude's MCP config
{
"mcpServers": {
"mempalace": {
"command": "python",
"args": ["-m", "mempalace.mcp_server"]
}
}
}
Available MCP tools (19 total)
mempalace_search- Semantic search across all wingsmempalace_kg_query- Entity relationship queriesmempalace_wake_up- Load full palace contextmempalace_diary- Write to agent journalmempalace_compress- Compress context to AAAK- ...and 14 more. See the MCP server source for the full list.
Ask Claude: "What did we decide about auth last month?" - Claude calls mempalace_search automatically and answers with your own verbatim context.
06 Local models (Llama, Mistral, etc.)
Local models don't typically support MCP yet. Two approaches work well:
Wake-up context (recommended)
Generate a compressed context file and paste it into your model's system prompt:
mempalace wake-up > context.txt # Paste context.txt into your local model's system prompt
Bash injection
For scripted pipelines, inject search results directly:
CONTEXT=$(mempalace search "your question here") echo "Context: $CONTEXT\n\nQuestion: your question" | ollama run llama3
07 Git hooks for automatic mining
Set up git hooks to automatically mine your project on commit or push. Two hooks are included:
Pre-compact hook (save before Claude compacts)
cp hooks/mempal_precompact_hook.sh ~/.claude/hooks/pre_compact chmod +x ~/.claude/hooks/pre_compact
Post-save hook (mine after session save)
cp hooks/mempal_save_hook.sh ~/.claude/hooks/post_tool_use chmod +x ~/.claude/hooks/post_tool_use
With these in place, your palace stays up to date automatically as you work. No manual mining required after setup.
08 AAAK compression
AAAK is a lossless shorthand dialect designed for AI context windows. It achieves 30x compression while preserving all semantic content.
Teach your AI to read AAAK
The MCP server does this automatically. For manual use:
# Compress a large context file mempalace compress context.txt --output compressed.aaak # Decompress back to plain text mempalace decompress compressed.aaak
How AAAK works
- Entity codes: People and projects get 2-4 character codes (e.g.,
JDfor John Doe) - Emotion markers: Sentiment encoded in single characters
- Relationship shorthand: Structured grammar for entity relationships
- Universal decoder: Any text model can read it after a 120-token bootstrap
A typical 6-month conversation archive compresses from ~180,000 tokens to ~6,000 tokens in AAAK - within the context window of most models, including local ones.
FAQ
Does Mempalace work with ChatGPT? +
Yes. ChatGPT does not support MCP yet, so use the wake-up context approach: run mempalace wake-up and paste the output into your system prompt or first message. The AAAK-compressed context works fine with GPT-4 and GPT-4o.
Where does Mempalace store data? +
Everything goes to ~/.mempalace/. The ChromaDB palace (vector store) is in ~/.mempalace/palace/. The knowledge graph SQLite database is at ~/.mempalace/kg.db. No data leaves your machine.
How do I back up my palace? +
Back up the entire ~/.mempalace/ directory. You can also export your palace to a portable format:
mempalace export --output palace_backup.zip
Can I use Mempalace with Cursor or Windsurf? +
Yes. Both Cursor and Windsurf support MCP. Add the Mempalace MCP server the same way as Claude. Once connected, the IDE's AI assistant can call Mempalace tools automatically during your coding sessions.
How is this different from RAG? +
Standard RAG uses flat vector search - chunk, embed, retrieve. Mempalace adds palace structure on top: wings, halls, rooms, and tunnel connections between related content. That structure is why recall goes from ~62% (pure RAG) to 96.6% (palace RAG). The knowledge graph layer adds temporal entity relationships that flat vector search cannot express.
Is Mempalace safe to use at work? +
Yes. No data leaves your machine. You choose which directories to mine - you can exclude anything sensitive. The MCP server runs locally and only responds to tools from your local Claude or IDE instance. There is no telemetry. Review the source code in the our codebase to verify.
Ready to get started?
Create a free account to access the demo dashboard, or go straight to the GitHub repo and start using Mempalace locally.