@ramarivera/pi-supermemory
Pi coding-agent extension that recalls and captures session memory through Supermemory.
Package details
Install @ramarivera/pi-supermemory from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@ramarivera/pi-supermemory- Package
@ramarivera/pi-supermemory- Version
0.4.4- Published
- May 30, 2026
- Downloads
- 344/mo · 20/wk
- Author
- ramarivera
- License
- MIT
- Types
- extension
- Size
- 54.1 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./src/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-supermemory
Pi coding-agent extension that recalls and captures development memory through Supermemory.
The extension uses Supermemory's v4 API directly. Pi does not expose MCP servers natively, so this package complements the toolbox mcporter MCP bridge instead of replacing it.
Configuration
Set an API key in the Pi runtime environment:
SUPERMEMORY_API_KEY=...
By default, the extension uses a generic Supermemory container:
PI_SUPERMEMORY_CONTAINER_TAG=pi-supermemory
Set PI_SUPERMEMORY_CONTAINER_TAG to your own shared memory container if you want Pi to write into the same namespace as your other agents.
Supported environment variables:
SUPERMEMORY_API_KEY,SUPERMEMORY_CC_API_KEY, orSUPERMEMORY_OPENCLAW_API_KEYPI_SUPERMEMORY_CONFIGPI_SUPERMEMORY_CONTAINER_TAGorSUPERMEMORY_CONTAINER_TAGPI_SUPERMEMORY_ENABLEDSUPERMEMORY_API_BASE_URLPI_SUPERMEMORY_MAX_RECALLPI_SUPERMEMORY_AUTO_RECALLPI_SUPERMEMORY_AUTO_CAPTUREPI_SUPERMEMORY_CAPTURE_MODE(signalby default, orallfor legacy every-turn capture)
Env vars always win over file-based configuration.
Policy files
The extension discovers and merges config files from the current working directory all the way up to ~. At each directory level it checks (in order of specificity):
.pi/supermemory.json
.pi/pi-supermemory.json
.pi/agent/pi-supermemory.json
Child directories override parent directories. Within the same directory, agent/pi-supermemory.json wins over pi-supermemory.json, which wins over supermemory.json.
Use PI_SUPERMEMORY_CONFIG to point at a single explicit file instead of hierarchical discovery.
Example
{
"default": {
"enabled": true,
"containerTag": "pi-supermemory",
"captureMode": "signal"
},
"directories": {
"/workspace/app": {
"containerTag": "app-memory"
}
},
"models": {
"local/no-memory-model": {
"enabled": false
},
"openai-codex/gpt-5.5": {
"containerTag": "codex-memory"
}
},
"rules": [
{
"path": "/workspace/app",
"modelPattern": "openai-codex/.*",
"containerTag": "app-codex-memory",
"permissions": "read-only"
}
]
}
Override precedence
default -> longest matching directory -> matching model -> matching rule
Model overrides win over directory overrides. Rules win over everything (they combine path + model pattern). Env vars win over all file-based config.
Rules
Rules are the most specific override. Each rule has:
path— directory scope (applies to this directory and all subdirectories unless overridden)modelPattern— optional regex matched against<provider>/<model>identifierscontainerTag,enabled,maxRecall, etc. — same fields as other overridespermissions—"read-only","write-only", or"read-write"(default)
When permissions is set, it controls whether the extension can search (read) and/or save (write) memories:
read-only— search works, save is blockedwrite-only— save works, search is blockedread-write— both work (default)
If a subfolder defines its own rule, it overrides the parent rule.
Behavior
- Injects relevant Supermemory search results into Pi context before the model runs (if
autoRecallis enabled and read is permitted). - Captures completed user/assistant turns back to the same Supermemory container (if
autoCaptureis enabled and write is permitted). - Uses
captureMode: "signal"by default to reduce Supermemory UI clutter: explicit memory requests, durable preferences/decisions, and completed implementation summaries are captured, while low-signal command chatter is skipped. - Skips assistant thinking blocks and strips injected Supermemory context before saving, so recalled memories do not recursively re-enter storage.
- Set
captureMode: "all"to restore legacy every-turn capture for a project, model, or rule. - Splits oversized direct-memory writes into ordered chunks under Supermemory's per-memory content limit.
- Reports auto-capture save failures as concise warnings instead of surfacing extension stack traces.
- Registers tools:
supermemory_searchsupermemory_savesupermemory_save_filesupermemory_status
- Registers command:
/supermemory status/supermemory search <query>/supermemory save <content>/supermemory save-file <path> [containerTag]
Local development
npm install
npm test
npm run typecheck
The repo includes .pi/extensions/pi-supermemory/index.ts so Pi's DefaultResourceLoader can discover the extension locally.