simple-pi-memory

内容来源:README.md(说明文档) · 原始地址 · 查看安装指南

原始内容

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

Tools

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.
  • Concurrent writes from multiple pi sessions are not guarded.

License

MIT.