Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pi-mempalace

pi-mempalace

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.

What it does

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.

Install

Prerequisites:

pip install mempalace

Install the Pi package:

pi install git:github.com/ahmadaccino/pi-mempalace

Initialize your palace:

mempalace init ~/your-project
mempalace mine ~/your-project

That's it. Restart Pi (or /reload) and you'll see 🏛️ in the status bar.

Quick Start

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.

Mining your data

# 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 myapp

Searching

Pi 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-migration

How it works

The Palace

MemPalace 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

Memory Stack

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.

Knowledge Graph

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.

Commands

Command Description
/mempalace Show palace status

Architecture

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).

Requirements

Why not MCP?

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.

Contributing

PRs welcome! Some ideas:

  • Auto-save hook: save session memories on /compact or session end
  • Custom TUI renderer for search results
  • /mempalace-mine command with interactive wing/room picker
  • Diary agent support for specialist agents

License

MIT

About

persistent local memory for pi agent

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages