Adding memory to Amp

a plugin API modelled on pi's, and one file is the whole install

Amp keeps its threads on the server and a copy under ~/.local/share/amp/threads, and can continue one with amp threads continue. A new thread 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 it already has

No hooks, but a plugin API — acknowledged in Amp's own docs as inspired by pi's — and plugins under ~/.config/amp/plugins/*.ts are auto-discovered, so installing is one file and no settings edit. Amp also takes MCP servers, under amp.mcpServers in its settings file.

Adding recall

deja install amp-auto

That writes both halves. 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 the plugin, which does not wait to be asked:

  • agent.start — fires with the prompt in hand and its return value is appended to the user message, so the first turn of a thread carries a digest of what this project's recent sessions settled, and later turns carry recall for the question actually asked. This is both halves of what Claude Code splits across SessionStart and UserPromptSubmit.
  • tool.result — a command has just failed, and this machine has fixed that same error before. The handler is handed the output the model is about to read and hands back a replacement, so the repair arrives beside the error in the same turn rather than a turn later. The status stays an error: a repair that reported success would be a lie about the command.
  • session.start and the command palette — while a first index is still building, that is said once rather than looking like memory that does not work, and deja: search past sessions is there for searching by hand.

Guidance goes to ~/.agents/skills/deja-history/SKILL.md, the shared skills directory Amp reads — amp skill list shows it beside Amp's built-in skills.

tool.call runs before a command does, but its answer can only allow, reject, modify the arguments or synthesize a result — none of them add context — so the pre-tool line other harnesses get has nowhere to go in Amp. Amp also has no compaction event, so the list of blocks a thread has already been shown is not cleared when its context is.

What arrives

On each prompt, the history it is actually about, when there is any; silence is the common case. Measured on the stand: 43 ms and 556 bytes for the session digest, 21 ms and 286 bytes for the repair after a failed command, nothing when there is nothing to say — what memory costs has the wider comparison.

The part that is not about Amp

The index covers every agent's transcripts on the machine — twenty-five of them, each in its own format — so a fix found in Claude Code answers a question asked in Amp, 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 Amp thread format