simple-pi-memory

extensionmaintained

A minimal one-file memory extension for pi: one memory file loaded into the system prompt every turn, with add/remove/load tools and a /memory-char-cap command.

by · v0.1.1 · published 4w ago

$ pi install npm:simple-pi-memory
downloads/mo
379
stars
0
last push
4w ago
open issues
0

Signals

license: MITtestspi manifest: missinginstall size: —deps: 0peer deps: 0

Download trend

379 downloads · last 12 weeks (weekly)

README

simple-pi-memory

A minimal memory extension for pi. One file, one memory per line, loaded into the system prompt every turn.

How it works

Memories are stored as plain text in ~/.pi/simple-memory/memory.md, one per line with a [YYYY-MM-DD] date prefix. The file is read and injected into the system prompt on every turn through the before_agent_start hook. The full file is always injected and never truncated. The character cap is enforced on write, not on read.

pi rebuilds the system prompt each turn, so memory must be re-injected each turn to stay available. Loading once at session start would drop it after the first turn.

Install

pi install npm:simple-pi-memory

Or load a local checkout for development:

pi --no-extensions -e ./index.ts

Tools

ToolWhat it does
memory_addAdd one memory as a single line. Refuses on an exact duplicate or when the file is at the character cap.
memory_removeRemove one memory by its exact line text. Returns "not found" if no line matches exactly.
memory_loadRead the full memory file and show the current size and cap.

Command

/memory-char-cap [n]

No argument shows the current cap. An integer from 1 to 30000 sets it. Values outside that range are rejected. Lowering the cap below the current file size is refused; edit the memory file by hand first.

Config

~/.pi/simple-memory/config.json stores the cap:

{ "charCap": 5000 }

Default 5000. Range 1 to 30000.

Notes

  • The memory file is ~/.pi/simple-memory/memory.md. Editing it by hand is supported; changes appear on the next turn.
  • If another memory extension is installed (such as pi-memory), both will inject into the system prompt. Run one at a time.
  • Concurrent writes from multiple pi sessions are not guarded.

License

MIT.