Agent Memory

Модуль 13 · Урок 13.11

Урок 13.11. Deja-vu: retroactive local memory для истории coding agents

На этой странице
  1. План лекции
  2. Цель лекции
  3. Ожидаемый результат
  4. Короткая карточка инструмента
  5. Почему retroactive memory важна
  6. Базовая mental model
  7. Search без обязательных embeddings
  8. MCP recall
  9. Not just talk: files, commands, spans
  10. Promote and lifecycle state
  11. Trust scopes
  12. Forgetting and tombstones
  13. Redaction
  14. Sync without cloud
  15. Optional semantic recall
  16. Friction memory
  17. Типы памяти из курса
  18. Мини-кейс: повторный JWT bug
  19. Мини-кейс: file blame before editing
  20. Сравнение с MemSearch
  21. Сравнение с memU
  22. Риски и ограничения
  23. Как тестировать Deja-vu
  24. Практический rollout
  25. Антипаттерны
  26. Чек-лист выбора Deja-vu
  27. Финальный взгляд на модуль 13
  28. Источники
  29. Краткое резюме
  30. Вопросы для самопроверки
  31. Что дальше

План лекции

Сначала мы разберем Deja-vu как необычный memory tool: он не начинает с пустого storage и не требует, чтобы вы заранее включили запись. Он индексирует session logs, которые coding agents уже писали на диск, и превращает прошлую работу в searchable local memory.

Затем рассмотрим architecture: zero-dependency binary, local index, MCP recall, harness integrations, lexical search, optional semantic layer, promoted notes, trust scopes, sync and redaction. В конце сравним Deja-vu с MemSearch and memU, обсудим сценарии, где retroactive memory особенно полезна, и проведем финальный conceptual wrap-up модуля 13.

Цель лекции

Понять Deja-vu как local-first retroactive memory layer: инструмент, который извлекает полезный context из уже существующих histories coding agents and returns it через CLI, MCP and auto-recall.

Ожидаемый результат

После лекции читатель понимает:

  • чем retroactive indexing отличается от forward-only memory;
  • почему Deja-vu делает ставку на lexical/local search без обязательных embeddings;
  • как MCP recall помогает agents use past sessions;
  • зачем нужны promoted notes, lifecycle state and trust scopes;
  • как Deja-vu handles privacy, redaction, sync and forgetting;
  • когда Deja-vu лучше MemSearch or wiki-style tools.

Короткая карточка инструмента

Поле Значение
Repository https://github.com/vshulcz/deja-vu
Docs https://vshulcz.github.io/deja-vu
Stars snapshot GitHub page показывает публичный проект; forks snapshot около 39 на 2026-08-08
Primary language Go
License MIT
Category Retroactive local memory for coding agents
Core idea Index local session histories agents already wrote
Integration CLI, MCP, plugins/hooks across many coding harnesses
Default retrieval Lexical/local search, no LLM, no embeddings required

Deja-vu формулирует себя коротко: "Your agents already solved this. deja finds it." Это хорошая фраза для понимания продукта. В отличие от систем, которые начинают хранить память только after installation, Deja-vu retroactively indexes existing agent histories.

Почему retroactive memory важна

Большинство memory layers включается с момента установки:

text
install memory -> future sessions become searchable

Deja-vu делает другой ход:

text
install memory -> past local session logs become searchable

Это практично для coding agents. У пользователя уже могут быть месяцы Claude Code, Codex, OpenCode, Cursor, Gemini CLI or other agent sessions. Там лежит:

  • debugging history;
  • architecture decisions;
  • failed attempts;
  • commands that worked;
  • files touched;
  • migration context;
  • project-specific traps;
  • reverted decisions.

Если memory tool ignores that history, it starts poor. Deja-vu starts full.

Базовая mental model

flowchart TD H1[Claude Code logs] --> IDX[Index builder] H2[Codex logs] --> IDX H3[OpenCode logs] --> IDX H4[Other harness logs] --> IDX IDX --> RED[Redaction] RED --> DB[(Local index)] Q[CLI query or MCP recall] --> DB DB --> HIT[Ranked session hits] HIT --> CTX[Compact context digest] CTX --> AG[Agent]

В этой схеме Deja-vu не просит agent write new memory in special format. Он использует footprints, которые agents already produce.

Search без обязательных embeddings

README Deja-vu подчеркивает: no LLM, no embeddings, no API key are required for main retrieval. Это design trade-off.

Плюсы:

  • работает локально;
  • быстро стартует;
  • не требует model download;
  • не отправляет данные внешним провайдерам;
  • проще debug;
  • хорошо ищет exact terms, commands, file paths, errors.

Минусы:

  • pure lexical search хуже на paraphrases;
  • semantic similarity requires optional embedding sidecar;
  • качество зависит от богатства session logs;
  • нужно аккуратно rank time/project/file signals.

Для coding memory lexical search often goes surprisingly far, because many useful queries contain exact artifacts: file names, error messages, commands, APIs, symbols.

MCP recall

Deja-vu serves memory back to agents over MCP. Это значит, что agent может сам вызвать recall tool:

text
have we dealt with jwt refresh rotation before? check your memory

Or with auto-recall, relevant memory can land at session start. Это меняет interaction:

  • user не обязан помнить exact past session;
  • agent can ask memory before re-debugging;
  • context flows across harnesses;
  • solved work can be reused.
sequenceDiagram participant User participant Agent participant Deja as Deja-vu MCP participant Index User->>Agent: Было ли у нас это с JWT rotation? Agent->>Deja: recall query Deja->>Index: search local histories Index-->>Deja: session hits and digest Deja-->>Agent: compact memory Agent-->>User: We fixed it before, here is what worked

Not just talk: files, commands, spans

Один из сильных points README: Deja-vu indexes not just talk, but files each turn opened, commands that ran, and exact spans an edit replaced.

Это критично для coding agents. Summaries often preserve decisions but lose:

  • exact command;
  • file touched;
  • old code span;
  • failed command output;
  • path-specific context;
  • which session changed what.

Deja-vu commands like blame, files, restore are built around this operational memory.

Promote and lifecycle state

Deja-vu supports promoted notes:

  • accepted;
  • rejected;
  • superseded;
  • stale.

This is subtle and important. Memory should not only say "we decided X." It should say:

text
We tried X, rejected it, and why.

Without lifecycle state, agents repeat discarded ideas. With lifecycle state, memory becomes institutional knowledge.

stateDiagram-v2 [*] --> RawSession RawSession --> Promoted Promoted --> Accepted Promoted --> Rejected Accepted --> Superseded Accepted --> Stale Rejected --> Accepted

The latest mark wins, but notes preserve the reason and date. This pattern is useful far beyond Deja-vu.

Trust scopes

Deja-vu includes policy controls for what memory activates where: search, MCP, auto; local, imported, per-peer. Receipts and logs name the rule.

Это отвечает на важный вопрос:

text
Which memory is allowed to influence this agent in this project?

Cross-agent memory can be dangerous if imported work context influences personal project or vice versa. Trust scopes make memory activation explicit.

Forgetting and tombstones

Privacy section describes deja forget: matching sessions are removed from rebuilt index, and exact session tombstones prevent later indexing from resurrecting them. --unforget can lift tombstone.

This is better than "delete from index once" because source transcripts may still exist on disk. Without tombstones, rebuild would bring them back.

Agent memory deletion must think in two layers:

  • source history still exists;
  • derived index should exclude forgotten sessions.

Tombstones encode the user's intent across rebuilds.

Redaction

Deja-vu strips API keys, JWTs and private keys at index time, according to README. It also has stats for redaction.

Redaction is mandatory for local history indexing. Agent logs often contain:

  • pasted tokens;
  • stack traces with secrets;
  • env var dumps;
  • config snippets;
  • URLs with credentials;
  • private repo names.

No memory tool should ingest histories without a redaction story.

Sync without cloud

Deja-vu can sync memory between machines via shared folder or SSH. It is append-only and idempotent.

This is a local-first alternative to hosted memory:

text
laptop A -> export/sync -> laptop B

But sync creates policy questions:

  • should work memory move to personal laptop?
  • what about imported sessions?
  • are tombstones synced?
  • how are trust scopes preserved?
  • is shared folder encrypted?

Local-first does not remove governance. It makes the user/operator responsible for it.

Optional semantic recall

Deja-vu supports optional semantic layer with local Ollama, LM Studio or OpenAI-compatible embedding endpoint. Without it, lexical search remains default.

This layered design is pragmatic:

  • default works with no model;
  • semantic is opt-in;
  • redacted indexed text is embedded;
  • vector sidecar sits beside index;
  • lexical continues if semantic runtime is unavailable.

For many coding histories, start lexical. Add semantic only when paraphrase misses matter.

Friction memory

One especially useful feature is deja friction: it identifies errors that hit three or more sessions, like missing tools, uninstalled modules or unavailable commands.

This is a form of environment memory. It answers:

text
What does this machine keep failing on?

That is not user preference, not world knowledge, not graph facts. It is recurring operational pain. Feeding it to an agent once per session can prevent repeated wasted tool calls.

Типы памяти из курса

Тип памяти Как Deja-vu его закрывает
Episodic memory Existing session histories and transcripts.
Semantic memory Promoted notes and durable remember entries.
Procedural memory Repeated commands, decisions, friction, workflows.
Reflection memory Promote, lifecycle state, rejected/superseded notes.
Shared memory Cross-harness recall, sync between machines.
World memory / RAG Not primary, but local histories act as project-specific knowledge.

Deja-vu особенно силен в episodic operational memory for coding agents.

Мини-кейс: повторный JWT bug

Пользователь спрашивает:

text
Мы уже решали проблему с jwt refresh rotation?

Deja-vu может вернуть:

  • session from three weeks ago;
  • project name;
  • exact error summary;
  • file touched;
  • command that confirmed fix;
  • note that one approach was rejected.

Agent avoids re-debugging and starts from known result.

Мини-кейс: file blame before editing

Перед изменением файла agent вызывает:

text
deja blame src/auth/session.ts

Он получает sessions that touched the file and decisions made. Это снижает риск переписать участок, не понимая previous context.

Для coding agents this is memory as situational awareness.

Сравнение с MemSearch

Критерий MemSearch Deja-vu
Main source Markdown journals and memory files Existing local session logs
Default search Hybrid search with Milvus Lexical/local search, optional semantic sidecar
Forward capture Strong plugin capture Yes, but key value is retroactive history
Index backend Milvus/Milvus Lite/Zilliz Cloud Local index in zero-dependency binary
Procedural layer Skills from Memory Promote, friction, commands, file spans
Best for Searchable Markdown memory across coding agents Instantly using months of existing agent histories

MemSearch is more like memory file search infrastructure. Deja-vu is more like "search the work your agents already did".

Сравнение с memU

memU distills reusable skills from session history. Deja-vu retrieves and annotates actual past sessions.

Если вам нужно "learn a reusable workflow", memU ближе. Если нужно "find the exact session where we solved this", Deja-vu ближе.

They can complement each other:

flowchart LR DV[Deja-vu finds exact past sessions] --> LES[Human or agent promotes lessons] LES --> MU[memU stores reusable skills] MU --> FUT[Future agent behavior]

Риски и ограничения

Первый риск - source log diversity. Different harnesses store different details; quality varies.

Второй риск - lexical blind spots. Without semantic layer, paraphrased questions may miss.

Третий риск - local privacy. Everything is local, but local logs can be sensitive and must be protected.

Четвертый риск - auto-recall noise. Injecting irrelevant past context can distract the agent.

Пятый риск - stale decisions. Promoted lifecycle helps, but only if users/agents mark changes.

Как тестировать Deja-vu

Тест Что проверяет
History discovery Finds real local harness logs.
Cold index Builds index from pre-install sessions.
Recall precision Known past issue appears as top hit.
File blame Sessions touching a file are ranked correctly.
Redaction Secrets are stripped from index and shared digests.
Forget tombstone Forgotten session does not reappear after rebuild.
MCP wiring Agent can call recall tool.
Auto-recall Session start receives relevant context without spam.
Sync Export/import/SSH transfer is idempotent.
Semantic optional Lexical still works when embedding runtime unavailable.

Самый важный test: ask about a real issue you know happened. If Deja-vu cannot recover it, inspect source discovery and indexing first.

Практический rollout

Start with read-only search:

  1. Install Deja-vu.
  2. Let it build index from existing histories.
  3. Run a few manual queries.
  4. Check doctor.
  5. Test redaction and forget.
  6. Wire MCP recall.
  7. Enable auto-recall only after confidence.

Do not enable all hooks before understanding what memory will be injected.

Антипаттерны

Первый антипаттерн - думать, что local means harmless. Sensitive data still exists and needs protection.

Второй антипаттерн - auto-inject too much. Recall should help, not drown current task.

Третий антипаттерн - never promote or mark lifecycle. Raw sessions are useful, but durable knowledge needs curation.

Четвертый антипаттерн - deleting from index without tombstones. Rebuild will resurrect forgotten sessions.

Чек-лист выбора Deja-vu

Deja-vu стоит рассмотреть, если:

  • you already have months of coding-agent history;
  • need fully local memory;
  • exact search over commands/files/errors matters;
  • you use several coding harnesses;
  • MCP recall is useful;
  • you want no required LLM, embeddings, API key or vector DB;
  • retroactive value matters more than elaborate profile modeling.

Если нужна product personalization API, choose Supermemory/Mem0. Если нужна graph-governed enterprise context, Semantica/Cognee. Если нужна skill wiki, memU.

Финальный взгляд на модуль 13

Модуль 13 показал, что open-source agent memory is not one category. Инструменты различаются по тому, что они считают главным объектом памяти:

Tool class Main memory object
Graph-first platforms Entities, relationships, provenance.
Context APIs User profiles, memories, documents.
Agent-native memory Actions, sessions, process state.
Wiki/Markdown memory Readable files, skills, notes.
Peer-centric systems People, agents, groups, representations.
Learning-loop engines Strategies from traces.
Retroactive local search Existing histories and operational evidence.

Это главный вывод: выбирайте memory tool by failure mode. Если агент забывает preferences - нужен profile memory. Если теряется project archaeology - нужен history search. Если повторяются ошибки - нужен learning loop. Если нужен audit - нужен graph/provenance layer.

Источники

  • GitHub repository: https://github.com/vshulcz/deja-vu
  • README: https://github.com/vshulcz/deja-vu/blob/main/README.md
  • Documentation: https://vshulcz.github.io/deja-vu/
  • Getting started: https://vshulcz.github.io/deja-vu/guide/getting-started.html

Краткое резюме

Deja-vu показывает retroactive local memory: агентам не нужно начинать с пустого состояния, если на машине уже есть session logs. Инструмент превращает историю работы в local searchable memory and exposes it through CLI, MCP and auto-recall.

Главная идея: иногда лучшая память - это не новая база, а умный доступ к тому, что already happened.

Вопросы для самопроверки

  1. Чем retroactive memory отличается от forward-only memory?
  2. Почему lexical search может быть сильным for coding agents?
  3. Что дает MCP recall?
  4. Зачем нужны promoted notes and lifecycle state?
  5. Почему tombstones важны for forgetting?
  6. Чем friction memory отличается от user preference memory?
  7. Когда Deja-vu лучше MemSearch?
  8. Какой главный критерий выбора memory tool после модуля 13?

Что дальше

После этого модуля у читателя есть карта open-source ecosystem. Следующий шаг в практической работе - выбрать один failure mode своего агента, подобрать memory pattern and провести маленький evaluation before adopting a framework broadly.

Обновлено 08.08.2026