pi-memd
Project-level session memory for the pi coding agent — a single MEMD.md file per project
Package details
Install pi-memd from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-memd- Package
pi-memd- Version
0.1.1- Published
- May 5, 2026
- Downloads
- not available
- Author
- whonixnetworks
- License
- MIT
- Types
- extension
- Size
- 118.8 KB
- Dependencies
- 2 dependencies · 0 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-memd
Project-level session memory for the pi coding agent — a single MEMD.md file per project.
Why
Every other pi memory extension either uses SQLite (unreadable outside the tool), spawns LLM calls on session shutdown (slow), or scatters memory across dozens of files. pi-memd is different:
- One file —
MEMD.mdat project root. Human-readable. Git-ignorable. - Zero dependencies — No SQLite, no vector DB, no git dependency. Pure TypeScript + Node fs.
- Zero LLM calls — No consolidation step. No reflection model. All operations are deterministic file I/O.
- Fast — Read on session start, cached in memory. Tools do append-only writes.
- Smart clean — Built-in dedup, stale detection, and size management via
memd_clean.
MEMD.md Structure
# Project Memory
## Decisions
- 2025-05-05: Using FastAPI for the API layer — simpler than Flask for async
- 2025-05-04: Chose PostgreSQL over MongoDB — relational data model fits better
## Active Context
- Docker stack uses Cloudflare Tunnel for public access
- All services on `labnet` Docker network
## Bugs & Fixes
- 2025-05-03: Immich container OOM — increased memory limit to 4G
## Changelog
- 2025-05-05: Added health endpoint to FastAPI service
## Patterns
- Always use `labnet` Docker network for new services
- Conventional commits for all repos
Sections auto-date entries for Decisions, Bugs & Fixes, and Changelog. Active Context and Patterns are undated.
Install
pi install npm:pi-memd
Or add to ~/.pi/agent/settings.json:
{
"packages": ["npm:pi-memd"]
}
Or project-local in .pi/settings.json:
{
"packages": ["npm:pi-memd"]
}
Tools
| Tool | Description |
|---|---|
memd_write |
Append entries or overwrite sections in MEMD.md |
memd_read |
Read entire MEMD.md or a specific section |
memd_search |
Search entries by keyword (case-insensitive) |
memd_clean |
Remove duplicates and stale entries (supports dry run) |
Commands
| Command | Description |
|---|---|
/memd |
Show MEMD.md statistics |
/memd-clean |
Interactive clean with confirmation |
/memd-init |
Create MEMD.md and add to .gitignore |
Configuration
In ~/.pi/agent/settings.json or .pi/settings.json:
{
"memd": {
"enabled": true,
"maxSizeKb": 8,
"maxAgeDays": 90,
"sections": ["Decisions", "Active Context", "Bugs & Fixes", "Changelog", "Patterns"],
"autoInit": true,
"injectContext": true
}
}
| Setting | Default | Description |
|---|---|---|
enabled |
true |
Enable/disable MEMD |
maxSizeKb |
8 |
Max MEMD.md size in KB before lightweight injection |
maxAgeDays |
90 |
Days before Changelog/Bugs entries are stale |
sections |
5 defaults | Section names in order |
autoInit |
true |
Auto-create MEMD.md on first session |
injectContext |
true |
Inject MEMD.md content into system prompt |
How It Works
- Session start — Reads MEMD.md, auto-creates if missing, adds to .gitignore if in git repo
- Every agent turn — Injects MEMD.md content into system prompt as
<memd>XML block - Agent writes — Uses
memd_writetool to append entries when the user says "remember this" or the agent identifies something worth persisting - Clean — Periodically run
memd_cleanor/memd-cleanto remove duplicates and stale entries
vs Other Memory Extensions
| Feature | pi-memd | @samfp/pi-memory | pi-self-learning | jo-inc/pi-mem |
|---|---|---|---|---|
| Storage | Single MEMD.md | SQLite DB | Multi .md + git | Multi .md files |
| Per-project | Yes | Global or project | Project-local | Global |
| LLM calls | None | Yes (consolidation) | Yes (reflection) | Yes (dashboard) |
| Human-readable | Yes | No (DB) | Yes | Yes |
| Size management | Built-in clean | Manual | Manual | Manual |
| .gitignore auto | Yes | N/A | No | No |
| Zero-dep | Yes (fs only) | better-sqlite3 | None | None |
License
MIT