Install
Install with PiG
pig install npm:@yylan/pi-memoryInstall with Pi
pi install npm:@yylan/pi-memoryPackages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.
Pi manifest JSON
The pi field of package.json.
{
"extensions": [
"./extensions/index.ts"
]
}README
Written by the package's publisher, shown as published in version 1.0.1 (README.md). PiG does not review it.
🧠 @yylan/pi-memory
High-performance long-term memory system for pi coding agent.
Built with dual-process architecture for maximum performance — SQLite FTS5 for BM25 search + local ONNX embeddings for vector search.
Features
- 4-Tier Memory: Working → Episodic → Semantic → Procedural
- Hybrid Search: BM25 (FTS5) + Vector embeddings (384-dim) with RRF fusion
- Auto-Capture: Automatically records tool calls and results
- Smart Injection: Relevant memories are injected into system prompt before each turn
- Privacy: API keys, tokens, and secrets are automatically redacted
- Fast: <1ms BM25 search, ~5ms vector search, <20ms total memory injection
🔧 Installation
pi install npm:@yylan/pi-memory
Then reload pi (/reload) or restart.
Note: On first load, pi will automatically install dependencies (
better-sqlite3,@xenova/transformers). This may take a moment.
🔑 Configuration
| Env Variable | Default | Description |
|---|---|---|
PI_MEMORY_DIR | ~/.pi-memory | Database storage directory |
PI_MEMORY_TOKEN_BUDGET | 2000 | Max tokens for memory injection |
PI_MEMORY_AUTO_CAPTURE | true | Enable automatic tool capture |
PI_MEMORY_EMBEDDINGS | true | Enable local ONNX embeddings |
📋 Tools
| Tool | Description |
|---|---|
memory_search | Search long-term memory with hybrid BM25+vector |
memory_save | Save durable facts, conventions, preferences |
memory_consolidate | Run consolidation pipeline manually |
memory_status | Check health, stats, embedding availability |
📋 Commands
/memory status — Show memory system stats
/memory search <q> — Search memories
/memory consolidate — Run consolidation now
🏗️ Architecture
┌─────────────────────────────────────────────┐
│ pi Extension (jiti runtime) │
│ - Event handlers, Custom tools, IPC client │
└──────────────────┬──────────────────────────┘
│ IPC (<0.1ms)
┌──────────────────▼──────────────────────────┐
│ Memory Server (standalone Node.js process) │
│ - better-sqlite3 + FTS5 (BM25 full-text) │
│ - @xenova/transformers (local embeddings) │
│ - RRF hybrid search (BM25 + Vector) │
│ - 4-tier memory pipeline │
└─────────────────────────────────────────────┘
🔄 Memory Lifecycle
Working (raw observations)
→ Episodic (session summaries)
→ Semantic (extracted facts, patterns)
→ Procedural (workflows, conventions)