Adding memory to pi and omp

no hooks, an extension API — and one file is the whole install

pi writes a JSONL log per session under ~/.pi/agent/sessions and can resume one; omp (Oh My Pi) is the same lineage and keeps the same shape under ~/.omp. A new session in either reads nothing from the others, and nothing from the Claude Code or Codex session on the same machine where the problem was already solved. This page is about adding that.

What they already have

Neither has hooks. Both have an extension API, and extensions under the agent's extensions/ directory are auto-discovered — so installing is one file and no settings edit, and removing it is deleting the file.

Adding recall

deja install pi-auto
deja install omp-auto

Each writes the MCP server, so the model can call the deja tool itself — search past sessions, read one in full, see a file's history, ask what fixed an error, ask how a command is really run here, store a decision — and one extension:

  • pi~/.pi/agent/extensions/deja.ts, answering before_agent_start. It fires after you submit a prompt, carries the prompt text, and can return a message that is stored in the session and sent to the model — both halves of what Claude Code splits across SessionStart and UserPromptSubmit, in one event. pi also has a real channel to you, ctx.ui.notify, so the recall line and the "index still building" note go there rather than into the prompt.
  • omp — a module under the active agent's extensions/, registering a handler on the context event. A handler returning { messages } replaces what goes to the provider, which is the only seam that reaches the model before it answers. Which event, and that a returned list is honoured at all, came from running a probe against omp 17.4.1: input never fires in print mode, before_agent_start carries the prompt but not the context, and a marker prepended in context came back out of the model.

What arrives

On each prompt, the history it is actually about, when there is any; silence is the common case. An injection is capped at about 1.5 KB per prompt and 4 KB per tool call — what memory costs has the measured comparison.

The part that is not about pi

The index covers every agent's transcripts on the machine — twenty-two of them, each in its own format — so a fix found in Claude Code answers a question asked in pi, including sessions from before any of this was installed. A transcript a client later deletes stays searchable; only deja forget drops one on purpose. Nothing here writes memories, so there is nothing to hallucinate into your history; indexing and search are local, and credentials are stripped as the index is built (privacy).

Getting started · Switching between agents · The pi session format · omp