@zhafron/pi-memory

Memory management extension for pi coding agent

Package details

extension

Install @zhafron/pi-memory from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@zhafron/pi-memory
Package
@zhafron/pi-memory
Version
1.0.2
Published
Feb 18, 2026
Downloads
607/mo · 337/wk
Author
zhafron
License
MIT
Types
extension
Size
25.2 KB
Dependencies
1 dependency · 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-memory

Memory management extension for pi coding agent.

Features

  • Long-term Memory: Store crucial facts, decisions, and preferences in MEMORY.md
  • Identity Management: Define AI persona in IDENTITY.md
  • User Profile: Store user context in USER.md
  • Daily Logging: Track day-to-day activities in daily/YYYY-MM-DD.md
  • Auto Context Injection: MEMORY.md, IDENTITY.md, USER.md automatically injected into system prompt
  • First Run Setup: Interactive bootstrap process for new installations
  • Cross-platform: Works on Windows, macOS, and Linux

Installation

pi install git:github.com/tickernelz/pi-memory

Or via npm:

pi install npm:@zhafron/pi-memory

Configuration

Add to ~/.pi/agent/settings.json:

{
  "pi-memory": {
    "memoryDir": "~/.pi/agent/memory",
    "dashboard": false
  }
}
Setting Type Default Description
memoryDir string ~/.pi/agent/memory Memory directory location
dashboard boolean false Enable dashboard widget

Memory Files

File Purpose
MEMORY.md Long-term memory (crucial facts, decisions, preferences)
IDENTITY.md AI identity (name, persona, behavioral rules)
USER.md User profile (name, preferences, context)
daily/YYYY-MM-DD.md Daily logs (day-to-day activities)
BOOTSTRAP.md First run setup instructions (deleted after setup)

Tools

memory

Unified memory management tool.

Actions:

Action Description Parameters
read Read memory file target: memory, identity, user, daily
write Write to memory file target: memory, identity, user, daily; content; mode: append/overwrite
search Search memory files query, max_results (optional)
list List all files -

Targets:

Target File Purpose
memory MEMORY.md Long-term memory (crucial facts, decisions, preferences)
identity IDENTITY.md AI identity (name, persona, behavioral rules)
user USER.md User profile (name, preferences, context)
daily daily/YYYY-MM-DD.md Daily logs (day-to-day activities)

Examples:

# Read memory files
memory --action read --target memory
memory --action read --target identity
memory --action read --target user
memory --action read --target daily --date 2026-02-18

# Write to memory files
memory --action write --target memory --content "Remember to use PostgreSQL for all projects"
memory --action write --target identity --content "- **Name**: Jarvis" --mode overwrite
memory --action write --target user --content "- **Location**: New York (EST)"
memory --action write --target daily --content "Fixed critical bug in auth module"

# Search and list
memory --action search --query "PostgreSQL"
memory --action list

First Run Flow

  1. Extension detects no MEMORY.md exists
  2. Creates BOOTSTRAP.md with setup instructions
  3. AI reads BOOTSTRAP.md and asks user questions interactively
  4. AI writes to MEMORY.md, IDENTITY.md, USER.md
  5. AI deletes BOOTSTRAP.md manually
  6. Setup complete

Context Injection

The following files are automatically injected into the system prompt at session start:

  • MEMORY.md — Long-term memory
  • IDENTITY.md — AI identity
  • USER.md — User profile

Daily logs are not auto-injected and must be accessed via the memory tool.

License

MIT