Persistent memory for
Pi coding agent
Pi loses context when sessions end or conversations get compacted. db0 gives it a memory that persists across sessions — preferences, project patterns, and solutions carry over automatically.
Install
npx @db0-ai/pi init
Creates the extension at
~/.pi/agent/extensions/db0/. No other configuration needed.The problem
Preferences don't stick
You tell Pi to use bun, prefer single quotes, or write functional style. Next session, it forgets.
Compaction destroys context
Long conversations get compacted. The detailed patterns and decisions you discussed get summarized away.
Solutions don't transfer
You fix a CORS issue in one project. Pi doesn't know about it when you hit the same problem elsewhere.
How it works
The extension registers tools and lifecycle hooks with Pi. Memory extraction is automatic — the agent doesn't need to be told to remember.
Tools
db0_memory_write
Store a fact with scope and tags
db0_memory_search
Search memories by query
db0_memory_list
List memories by scope
Lifecycle hooks
before_agent_start
Packs relevant memories into context
turn_end
Extracts facts from assistant responses
session_start
Creates fresh harness, memories carry over
session_shutdown
Runs reconciliation, closes cleanly
What gets remembered
With the coding-assistant profile (default), the extension captures:
Tool and language preferences
"use bun", "single quotes", "functional style" — stated once, remembered across all sessions.
Project patterns
Architecture decisions, naming conventions, and coding standards specific to your codebase.
Solutions to past problems
CORS fixes, build configurations, API quirks — stored and recalled when you hit similar issues.
Corrections and feedback
When you correct Pi, the correction supersedes the old behavior. It doesn't repeat the same mistake.
Configuration
| Option | Default | Description |
|---|---|---|
| dbPath | ~/.pi/agent/db0.sqlite | Storage path. Use a PostgreSQL URL for cross-device sync. |
| profile | coding-assistant | Memory profile. Controls extraction rules and scope weights. |
| tokenBudget | 1500 | Max tokens for memory injection into context. |
Uninstall
Remove extension and database
npx @db0-ai/pi uninstall
Remove extension, keep memories
npx @db0-ai/pi uninstall --keep-data
One command.
Pi remembers.
$ npx @db0-ai/pi init