pi-diet-memory0.1.3
Explicit lightweight persistent memory for Pi with no automatic context injection.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
pi-diet-memory
One of my diet context engineering and workflow extensions. Explore the complete collection: https://www.npmjs.com/~probabilityengineer
Explicit lightweight persistent memory for Pi with no automatic context injection.
pi-diet-memory gives Pi agents a small, inspectable memory store for durable user preferences, project conventions, and lessons learned. Memories are saved only when explicitly requested or proposed for user approval. The extension avoids transcript scraping, vector databases, background consolidation, and automatic prompt injection, keeping prompt overhead low while still letting agents search memory when relevant.
How to use it
Repository visibility
list, search, and candidate review default to global memories plus memories
for the current repository. The /memory, /memory-search, and /memory-review
commands use the same visibility rules. Filtering happens before search and limits.
Use scope: "global" for only global records, or scope: "project" for only
current-project records. allProjects: true explicitly includes other projects
(and still respects an explicit scope).
Project identity is the real, symlink-resolved Git root, including worktrees. Outside Git repositories it is the exact real working directory: child directories are separate identities, and moving or copying directories does not transfer their memories automatically. Project creation requires an existing directory.
Existing records are never rewritten during retrieval. Existing absolute legacy
subdirectory paths are associated with their current Git root when resolvable;
missing paths, relative paths, and records without project associations are hidden
by default and remain inspectable with allProjects: true. A reused path or a
changed Git boundary cannot be distinguished from its historical owner using the
legacy path-only format; review such records explicitly after filesystem changes.
Changing global scope to project assigns the current identity; changing project scope to global removes the association. Other updates preserve the association. No memories are automatically injected into context.
Use pi-diet-memory for durable context that should survive sessions:
- user preferences
- workflow habits
- recurring corrections
- stable project conventions
- lessons learned
Do not use it for:
- secrets
- temporary task state
- raw transcripts
- one-off command output
- facts that are better stored in repo docs
Commands
Show saved memories:
/memory
Search approved memories:
/memory-search jj workflow
Save an explicit memory:
/memory-remember I prefer concise recommendations first, then caveats.
Review proposed memories:
/memory-review
Tool
One compact tool:
memory— list, search, review, remember, propose, approve, update, and forget memories.
Save an explicit user-requested memory
Use remember only when the user asks to remember something.
{ "action": "remember", "text": "User prefers compact action-enum tools for small Pi extensions.", "kind": "preference", "tags": "pi,extensions,tools", "pinned": true }
Propose an inferred memory
Use propose when the agent notices a durable preference, but the user did not explicitly ask to save it.
{ "action": "propose", "text": "User prefers positive guidance phrased as desired behavior rather than negative bans.", "kind": "preference", "evidence": "User requested this style while discussing AGENTS.md guidance.", "tags": "guidance,style" }
Review pending candidates
{ "action": "review" }
Approve a candidate
{ "action": "approve", "id": "cand_..." }
Search approved memories
{ "action": "search", "query": "positive guidance" }
Update a memory
{ "action": "update", "id": "mem_...", "text": "User prefers concise positive guidance phrased as desired behavior rather than negative bans.", "pinned": true }
Forget a memory
{ "action": "forget", "id": "mem_..." }
Memory kinds
Use one of:
preference— user style or workflow preferenceproject— stable project conventionlesson— correction or mistake to avoidreference— useful durable fact or link
Scopes
Default is global:
{ "scope": "global" }
Use project scope for repo-specific memory:
{ "scope": "project" }
Storage
JSON Lines under:
~/.pi/agent/pi-diet-memory/
memories.jsonl
candidates.jsonl
Memories are human-readable and easy to inspect or back up.
Safety
- Memory is context, not authority; current user instructions and repo evidence win.
- Do not store secrets.
- Prefer concise, stable preferences and lessons over raw transcript snippets.
- Use
proposefor inferred memories,reviewfor pending candidates, andrememberfor explicit user requests.
Install
From npm:
pi install npm:pi-diet-memory
From GitHub:
pi install git:github.com/ProbabilityEngineer/pi-diet-memory
For project-local install, add -l:
pi install -l git:github.com/ProbabilityEngineer/pi-diet-memory
For local testing:
pi -e ./index.ts
Development
npm install
npm run lint