Pi extension injecting ai-memory boot context into every pi session's system prompt at the first agent turn.
┌─────────────┐ execFile (turn 0) ┌──────────────┐
│ pi (TUI) │ ────────────────────► │ ai-memory │
│ + ext │ ◄──────────────────── │ boot --quiet │
└─────────────┘ boot context └──────────────┘
Store/recall stay on the ai-memory CLI (usage guidance is injected into each session's system prompt); this extension only handles session boot injection.
pi install git:github.com/junkfactory/pi-memoryRequires the ai-memory CLI on PATH. Missing binary or empty DB → nothing is injected (fail soft).
- Injects
ai-memory boot --quietoutput into the system prompt under# ai-memory booton every agent turn where the block is absent. Pi resets extension system-prompt changes at the start of each turn and compaction never re-firessession_start, so one-shot-per-session injection silently disappears from turn 1 onward — re-injecting keeps the block present across turns, after compaction, and picks up memory state changes mid-session. - Skips injection when the block is already present (guards against
ai-memory wrapdouble-injection and avoids duplicating the persisted override from the previous turn). - A
# Memory usagesection (recall/store discipline; the agent-facing contract for the CLI) follows the boot facts — this package owns that guidance, so project AGENTS.md files don't have to. - A failed or empty boot retries on the next turn (transient failures self-heal).
npm install
npx vitest run # tests (execFile mocked)
pi -e ./ # try without installing