Persistent AI memory for Pi coding agent, powered by MemPalace. 100% local, zero API calls, zero cost.
Every conversation you have with an AI disappears when the session ends. Six months of decisions, debugging sessions, architecture debates — gone. pi-mempalace fixes that.
Gives Pi 8 native tools + a skill for persistent memory across sessions:
| Tool | What |
|---|---|
mempalace_search |
Semantic search across all memories with wing/room filters |
mempalace_status |
Palace overview — wings, rooms, memory counts |
mempalace_wakeup |
Load identity + critical facts (~170 tokens) |
mempalace_mine |
Ingest project files or conversation exports |
mempalace_add |
Store a new memory with metadata |
mempalace_kg_query |
Query knowledge graph for entity relationships |
mempalace_kg_timeline |
Chronological entity timeline |
mempalace_compress |
AAAK dialect compression for token efficiency |
Plus a bundled skill that teaches Pi when and how to use these tools automatically — ask about past decisions and it searches, make a breakthrough and it offers to save it.
Prerequisites:
pip install mempalaceInstall the Pi package:
pi install git:github.com/ahmadaccino/pi-mempalaceInitialize your palace:
mempalace init ~/your-project
mempalace mine ~/your-projectThat's it. Restart Pi (or /reload) and you'll see 🏛️ in the status bar.
Once installed, just talk to Pi naturally:
You: "What did we decide about the auth system last month?"
Pi calls
mempalace_search→ finds the verbatim conversation → answers with full context.
You: "Remember that we're switching from REST to GraphQL for the new API."
Pi calls
mempalace_add→ stores the decision with wing/room metadata.
You: "Mine my Claude exports into memory."
Pi calls
mempalace_mine→ ingests conversation files into the palace.
# Mine project files (code, docs, notes)
mempalace mine ~/projects/myapp
# Mine conversation exports (Claude, ChatGPT, Slack)
mempalace mine ~/chats/ --mode convos
# Mine with auto-classification (decisions, milestones, problems)
mempalace mine ~/chats/ --mode convos --extract general
# Tag with a wing
mempalace mine ~/projects/myapp --wing myappPi does this automatically, but you can also search directly:
mempalace search "why did we switch to GraphQL"
mempalace search "database decision" --wing orion
mempalace search "auth approach" --room auth-migrationMemPalace organizes memories into a navigable structure inspired by the ancient method of loci:
WING: Person/Project
├── ROOM: topic-a
│ ├── Closet (summary)
│ └── Drawer (verbatim original)
├── ROOM: topic-b
│ ├── Closet
│ └── Drawer
└── HALL: facts | events | discoveries | preferences | advice
- Wings — people or projects. Each gets its own wing.
- Rooms — specific topics within a wing (auth, billing, deploy, etc.)
- Halls — memory types connecting rooms (facts, events, discoveries, preferences, advice)
- Tunnels — cross-wing connections when the same topic appears in different wings
- Closets — summaries pointing to original content
- Drawers — the original verbatim files, never summarized
| Layer | What | Size | When |
|---|---|---|---|
| L0 | Identity | ~50 tokens | Always loaded |
| L1 | Critical facts | ~120 tokens | Always loaded |
| L2 | Room recall | On demand | Topic comes up |
| L3 | Deep search | On demand | Explicitly asked |
mempalace_wakeup loads L0 + L1 (~170 tokens). Searches fire only when needed.
Temporal entity-relationship triples stored in SQLite:
Kai → works_on → Orion (since 2025-06-01)
Maya → completed → auth-migration (2026-02-01)
Query with time filtering, get timelines, track how relationships change over time.
| Command | Description |
|---|---|
/mempalace |
Show palace status |
This extension wraps MemPalace's CLI and Python API as native Pi tools. No MCP server needed — tools are registered directly via Pi's extension API.
Pi ←→ pi-mempalace extension ←→ mempalace CLI / Python API ←→ ChromaDB + SQLite
(all local)
The extension auto-discovers the mempalace binary from PATH and common pip install locations (macOS, Linux).
- Pi coding agent v0.37+
- Python 3.9+
mempalace(install)
Pi doesn't use MCP by design. Instead, pi-mempalace registers tools directly via the extension API — tighter integration, custom rendering, lifecycle hooks, status bar, and a bundled skill that teaches the agent when to use memory automatically. One pi install and it works.
PRs welcome! Some ideas:
- Auto-save hook: save session memories on
/compactor session end - Custom TUI renderer for search results
-
/mempalace-minecommand with interactive wing/room picker - Diary agent support for specialist agents
MIT
