Pi Plugin
Persistent memory for Pi, the terminal-based coding agent. Automatically recalls context before agent turns and captures conversations as episode memories.
Installation
Section titled “Installation”pi install npm:@momomemory/pi-momoOr add to ~/.pi/settings.json:
{ "packages": ["npm:@momomemory/pi-momo"]}Configuration
Section titled “Configuration”Config Precedence
Section titled “Config Precedence”- Environment variables (
MOMO_PI_*) - Project config (
.momo.jsoncin current directory) - Global Pi config (
~/.pi/momo.jsonc) - Defaults
Environment Variables
Section titled “Environment Variables”| Variable | Default | Description |
|---|---|---|
MOMO_PI_BASE_URL | http://localhost:3000 | Momo server URL |
MOMO_PI_API_KEY | — | API key (optional) |
MOMO_PI_CONTAINER_TAG | pi_{hostname} | Memory namespace |
MOMO_PI_AUTO_RECALL | true | Inject memories before agent turns |
MOMO_PI_AUTO_CAPTURE | true | Store conversation turns |
MOMO_PI_MAX_RECALL_RESULTS | 10 | Max memories per injection (1-20) |
MOMO_PI_PROFILE_FREQUENCY | 50 | Full profile every N turns (1-500) |
MOMO_PI_DEBUG | false | Verbose logging |
Generic MOMO_* variables are not used by the Pi plugin config loader. Use the MOMO_PI_* prefix.
Global Config File
Section titled “Global Config File”Create ~/.pi/momo.jsonc:
{ "pi": { "baseUrl": "http://localhost:3000", "apiKey": "your-api-key", "containerTag": "pi_global", "autoRecall": true, "autoCapture": true, "maxRecallResults": 10, "profileFrequency": 50, "debug": false }}Project-Local Config
Section titled “Project-Local Config”Create .momo.jsonc in your project directory:
{ "pi": { "baseUrl": "http://localhost:3000", "apiKey": "project-api-key", "containerTag": "pi_myproject" }}Note: Project-local config uses a nested pi key. Only .momo.jsonc (with leading dot) is loaded for project config.
The global config file also uses the nested pi key.
Features
Section titled “Features”Auto-Recall
Section titled “Auto-Recall”Before each agent turn, the plugin:
- Fetches your profile (static facts + recent signals)
- Searches for memories relevant to the current prompt
- Injects a
<momo-context>block with:- Long-term profile facts
- Recent signals
- Relevant memory matches with similarity scores
Full profile is injected every profileFrequency turns; only search results on other turns.
Auto-Capture
Section titled “Auto-Capture”After each successful agent turn, the plugin:
- Collects the user/assistant message pair
- Strips previously injected context blocks
- Ingests the conversation as an episode memory
AI Tools
Section titled “AI Tools”| Tool | Description | Example |
|---|---|---|
momo_search | Search memories by query | Search for my project preferences |
momo_store | Store an explicit memory | Remember that I prefer TypeScript |
momo_forget | Delete a memory by ID or query | Forget the memory about X |
momo_profile | View your memory profile | Show me my profile |
Slash Commands
Section titled “Slash Commands”| Command | Description | Example |
|---|---|---|
/remember | Persist an explicit memory | /remember I prefer dark mode |
/recall | Find memories by query | /recall project preferences |
/momo-profile | Show your memory profile | /momo-profile |
/momo-debug | Show effective configuration | /momo-debug |
The /momo-debug command displays the current effective configuration values, with the API key redacted for security.
Container Tags
Section titled “Container Tags”Memories are isolated by container tag (default: pi_{hostname}). This prevents different projects or users from mixing memories.
Customize via:
MOMO_PI_CONTAINER_TAGenvironment variablecontainerTagin config file
Tags are sanitized: spaces and special characters become underscores.
Troubleshooting
Section titled “Troubleshooting”Plugin not loading:
- Check
~/.pi/settings.jsonhas the package listed - Run
pi doctorto verify extension loading - Check Pi logs for errors
Configuration issues:
- Run
/momo-debugto see the effective config values - Verify you’re using
.momo.jsonc(with dot) for project config - Check that
MOMO_PI_*env vars are set correctly
No memories recalling:
- Verify the Momo server is running and accessible
- Add some memories with
/rememberfirst - Check
autoRecallis enabled in/momo-debugoutput
Env vars not working:
- Use
MOMO_PI_*variable names only - Export variables in your shell profile or before running
pi - Restart Pi after changing env vars
Requirements
Section titled “Requirements”- Pi 0.50.0+
- Momo server running and accessible