Agents & MCP

what each agent gets, and what it does with it

deja runs an MCP server (deja mcp, stdio) that exposes your indexed history to any MCP-capable agent. deja install wires it into the agents it detects.

Tools

One tool, deja, with a mode argument — six capabilities behind one entry so an agent's tool list stays short. The six names below are still callable as tools of their own for clients wired before the change; context was recall_context.

ModeWhat it does
recallSearch past sessions across every agent and return dense matches under ~4 KB. Fires on phrases like "didn't we fix this before".
contextReturn a full markdown digest of the single best-matching session — the problem, decision and outcome.
blameGiven a file path, the prior sessions that discussed it, most specific first. git blame for the conversations behind the code.
fixGiven a failing error, the command this machine ran after that same error before, when it did not come back. Matched on the error itself, not its words — evidence, not a guaranteed fix.
howHow this machine actually runs a thing — the real command with the real flags, from what agents ran before. Call before inventing a build, test or deploy invocation that a guess would get wrong on this setup.
rememberStore a durable decision so a future session can recall it. Redacted and indexed like any other source.

Auto-recall

deja install --auto wires recall into the moments an agent works, not only when it thinks to ask. Where a harness supports each hook, memory arrives on its own at four points:

  • At session start — relevant project memory before you type, ranked by the files your repo is touching, and led by the decisions you promoted accepted for this project, so the agent follows what was settled instead of re-deciding it. Read-only, capped at 2 KB, framed as untrusted historical data so it never acts as an instruction.
  • On each prompt — deja searches your history for what the prompt is actually about, and when it matches work already answered says so out loud: deja-vu: you have been here. Wired wherever the harness hands a hook the prompt: Claude Code, Codex, Cursor, Gemini CLI, Qwen, Kimi, Cline, OpenClaw, pi, omp, DeepSeek Harness, Grok Build, and Goose under deja goose. The rest get the session-start half only, which is memory chosen before you typed.
  • Before an edit or a command — a PreToolUse hook names that exact file's or command's prior decision, the fix that held or the invocation that worked, so the agent acts on what was settled rather than re-deriving it. Wired for Claude Code, Codex and Grok Build.
  • When a command fails — a PostToolUse hook reads the error and, if this machine has run something after that same error before without it coming back, says what that was. Measured over eighteen opportunities, an agent asked for that pair by tool exactly zero times: it does not occur to a model to check. Delivered at the failure it lands every time. A remedy that itself exited non-zero is not offered.
  • Before a context compaction (Claude Code) — the transcript is captured into the index first, and the next session start re-anchors the model in what it just lost.

Session-start auto-recall is wired across every harness that exposes a start hook — Claude Code, Codex, Cursor, Gemini CLI, opencode, Qwen, Kimi, Cline, Antigravity, OpenClaw, omp, DeepSeek Harness, Goose and Hermes among them; the harness matrix is the source of truth. Where only MCP is available, recall is still one tool call away.

The same injection carries what this machine keeps failing on: an error that hit three or more separate sessions — a binary that is not installed, a Python module that was never added — counted from the transcripts themselves. Agents rediscover those one failed command at a time, so the block says the count and what to do instead. It is served once per session, appears at session start where a hook is wired and on the first recall where only MCP is, and stays silent until something has failed in three separate sessions.

Windows

On Windows, stdio MCP clients spawn through cmd /c deja mcp. deja install writes that form automatically.

Seeing it work

Memory that lands silently builds no habit, so the hooks talk — once, when it matters. The session-start receipt names how many sessions were recalled and the day's tally; a per-prompt match on already-solved work announces deja-vu: you have been here — "<that session>" (3w ago), at most once in twenty minutes and counted per session rather than per machine, so a second agent opened alongside the first still hears it; and deja log --last replays the exact digest an agent received. Asking the same thing again inside the hour is met with silence rather than the next session down the list — the answer is still on your screen.