@taylorsatula/pi-durable-memory

Embedding-searched long-term memory for pi, with a surface/checkpoint attention-sink loop

Packages

Package details

extension

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

$ pi install npm:@taylorsatula/pi-durable-memory
Package
@taylorsatula/pi-durable-memory
Version
0.5.0
Published
Nov 13, 2026
Downloads
973/mo · 238/wk
Author
taylorsatula
License
MIT
Types
extension
Size
99.1 KB
Dependencies
0 dependencies · 3 peers
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-durable-memory

Long-term memory for pi, retrieved by embedding similarity. It stores short notes from past sessions and surfaces the relevant ones when you start new work.

Memories are stored unencrypted by default; AES-256-GCM encryption is one menu choice away. Embeddings are never encrypted, because encrypted content cannot be searched.

Install

pi install npm:@taylorsatula/pi-durable-memory

No configuration. The store is created on first use in ~/.pi/agent/durable-memory/, which follows PI_CODING_AGENT_DIR if you have set it.

How it works

The extension adds one tool, durable_memory, and one command, /durable-memory.

  • surface looks up memories related to a query and returns the best matches.
  • checkpoint returns a reminder to store what you learned and rate what you saw.
  • create, edit, delete manage memories.
  • helpful rates memories so more useful ones rank higher.

Memories live in memory.db, outside the package directory, so they survive pi update.

Settings

Run /durable-memory with no arguments for an interactive menu. You can configure the embedding endpoint, model, auth key, database location, and whether the local store is encrypted. Settings are saved to ~/.pi/agent/durable-memory/config.json. /durable-memory status prints the same information without a menu.

Environment variables override settings when present:

Variable Purpose
DURABLE_MEMORY_EMBED_URL Embedding endpoint URL
DURABLE_MEMORY_EMBED_MODEL Embedding model name
DURABLE_MEMORY_EMBED_KEY Auth key
DURABLE_MEMORY_DIR Database directory
DURABLE_MEMORY_GLOBAL_DIR Read-only shared store, merged into surface

Shared stores

A second, read-only store can be mounted next to your own — a team corpus everyone searches while each person still writes privately to their local store. Mounting one, seeding it, and what happens when its vectors were built with a different embedding model are covered in docs/global-store.md.

Refining an existing store

Rows written before the current create directive follow older rules, and they retrieve worse for it: several mechanisms in one row, an opening that is not a path or a proper name, a quantifier where an enumeration belongs, no staleness check. While a store holds such rows, surface ends with a byline naming the count and pointing at the runbook, and /durable-memory carries a row for it.

The pass is run by an agent, not by hand: it reads the whole store, classifies every row, and rewrites it behind a coverage gate that rejects any edit dropping a path, a commit sha, a version, or a measured number. Ask your agent to run a refinement pass; the procedure and the two scripts it drives are in docs/refinement-pass.md.

Verification

The probe and the retrieval benchmark live in the repository, not in the published package:

git clone https://github.com/taylorsatula/pi-durable-memory
cd pi-durable-memory
node bench/probe.mjs   # functional witness: every code path, end to end
node bench/run.mjs     # retrieval benchmark behind the cosine floor and K

Both need an embedding credential (DURABLE_MEMORY_EMBED_KEY, the apiKey in ~/.pi/agent/durable-memory/config.json, or a lunaroute entry in ~/.pi/agent/auth.json) and run against a scratch store, never your own. npm publish runs the probe first.

Known limits

  • No decay: old memories stay until deleted or down-rated.
  • Embeddings are stored in cleartext.
  • Search scans all memories in memory; fine up to a few thousand.
  • Memories are global, not scoped per project.
  • A shared store is read-only: it can be searched, never written or re-embedded from here.