simple-pi-memory
v0.1.1
Published
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.
Downloads
305
Maintainers
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-memoryOr load a local checkout for development:
pi --no-extensions -e ./index.tsTools
| Tool | What it does |
|------|-------------|
| memory_add | Add one memory as a single line. Refuses on an exact duplicate or when the file is at the character cap. |
| memory_remove | Remove one memory by its exact line text. Returns "not found" if no line matches exactly. |
| memory_load | Read 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.
