Stop re-explaining your repo to every new coding-agent chat.
Deja Vu is an ultra-light, protocol-first memory system for Codex, Claude Code, Cursor, Windsurf, and other coding agents. Add three repo-local files so a new agent session can scan tiny cues, recall only relevant project memory, and write back durable context.
It does not require a database, vector store, embedding model, hosted memory service, daemon, or npm package.
problem: every new agent session forgets why the project works the way it does
result: the agent scans tiny repo-local cues, recalls only relevant memory, and writes back durable context
Start by copying or creating only three files:
AGENTS.mdmemory/summary.mdmemory/impressions.jsonl
Then tell the next coding-agent chat:
Follow the Deja Vu rules in AGENTS.md. Before substantial work, scan memory/impressions.jsonl, load memory/summary.md only for weak matches, and load at most one to three detailed records for strong matches.
That is the base product. Add scripts, feedback, decisions, open loops, or the optional TypeScript engine only when the project grows enough to justify them.
Post-task writeback should stay just as small:
Decision made -> memory/decisions/ + memory/impressions.jsonl
Unresolved follow-up -> memory/open-loops/ + memory/impressions.jsonl
Project-level truth changed -> memory/summary.md + memory/impressions.jsonl
One-off low-value trace -> memory/events/ or skip
Recall was missed, irrelevant, helpful, or overloaded -> memory/recall-feedback.jsonl
If the outcome is not durable enough to help a future agent, do not write it into memory.
Use Deja Vu if your team keeps repeating:
- "We already decided this."
- "The agent forgot the architecture again."
- "Do not load the whole repo history into context."
- "We want memory in git, not in a vendor service."
Most agent memory tools start by storing more text. Deja Vu starts by asking a cheaper question: does this task feel familiar enough to justify loading memory at all?
The core loop is intentionally small:
task cue -> familiarity score -> minimal recall -> durable writeback
It is packaged as three project-local assets:
- rules
- workflow
- tiny memory files
No server. No hidden state. No required npm package. No memory platform. The base protocol works with Markdown and JSONL files that live beside the code.
If you found this on npm: the package is only the optional TypeScript engine and CLI tooling. The main product is the repo-local memory protocol you can copy into any project.
Use Deja Vu when you want:
- project memory that survives a new chat or agent session
- low-token recall before planning, coding, or answering
- observable recall budget and recall outcome feedback
- durable decisions, preferences, open loops, and architecture intent in plain files
- optional CLI or TypeScript helpers only when the project outgrows the file-first protocol
Deja Vu defines a shared memory behavior for agents working inside one project.
It answers:
- what should count as durable memory
- when an agent should recall existing memory
- how memory should be stored in ordinary project files
- when memory should be updated, compacted, or retired
The minimum viable setup uses three project-local plain text files:
AGENTS.mdmemory/summary.mdmemory/impressions.jsonl
Add one optional feedback ledger when recall results should change future behavior:
memory/recall-feedback.jsonl
No npm package, embeddings, vector search, or database is required.
If you want to adopt Deja Vu in a project without extra infrastructure:
- Copy docs/templates/AGENTS.template.md into your project rules file.
- Copy docs/templates/memory/summary.md.
- Copy docs/templates/memory/impressions.jsonl.
- Ask the next agent session to follow the rules before substantial work.
- Read docs/protocol.md only when you need the full normative behavior.
- Add optional decision, open-loop, feedback, event, and context records only when the project needs them.
Recommended first files:
- docs/templates/AGENTS.template.md
- docs/templates/memory/summary.md
- docs/templates/memory/impressions.jsonl
- docs/templates/memory/decisions/decision-template.md
- docs/templates/memory/open-loops/open-loop-template.md
Deja Vu follows a cue-first lifecycle:
- Scan a tiny impression index before substantial planning, coding, or answering.
- Load no memory when the scan finds no familiarity.
- Load the project summary when the scan finds weak familiarity.
- Load one to three detailed records only when the scan finds strong familiarity or the task requires depth.
- Write back only durable outcomes that should change a future agent's behavior.
- Record whether recall was helpful, irrelevant, missed, or overloaded when that feedback should tune future memory.
- Compact or supersede memories when detail becomes repetitive or stale.
This keeps memory project-local, readable, and easy to maintain across new conversations.
memory/
summary.md
impressions.jsonl
recall-feedback.jsonl
decisions/
open-loops/
events/
context/
index.md
The canonical layout and field rules are specified in docs/storage-markdown.md.
- Use a single-project scope only in MVP:
project:<project-id>. - Recall before substantial work, but follow a strict recall budget.
- Prefer scripted impression scans first; open summary or detailed records only when needed.
- Keep impression cues sparse, specific, and linted so the first recall step stays cheap.
- Write back only durable memory:
- decisions
- architecture intent
- stable preferences
- unresolved follow-up items
- milestone summaries
- Route writeback by artifact:
- decisions ->
memory/decisions/plusmemory/impressions.jsonl - follow-ups ->
memory/open-loops/plusmemory/impressions.jsonl - project-level truth ->
memory/summary.mdplusmemory/impressions.jsonl - cheap trace ->
memory/events/or skip - recall quality ->
memory/recall-feedback.jsonl
- decisions ->
- Default recall budget:
- impression scan: always allowed
- summary: at most one file
- detail: one to three records
- full memory tree: forbidden unless explicitly requested
- Never store:
- raw secrets or credentials
- full turn-by-turn transcripts
- low-signal chatter
- disposable exploration noise
Most agent memory systems fail in one of two ways:
- they remember too little because nothing is written down in a reusable shape
- they remember too much because every conversation turn is treated like durable knowledge
Deja Vu stays closer to first principles:
- memory should be explicit
- memory should be scoped
- memory should be cheap to inspect
- memory should be easy to revise
- memory behavior should survive a new conversation window
This repository still includes the existing TypeScript semantic recall engine.
Use it when you want:
- stronger familiarity scoring
- threshold-gated summary and chunk loading
- embedding and vector ranking
- an engine-backed implementation of the Deja Vu protocol
Do not treat the engine as the product center. It is an optional acceleration layer.
Start here if you want that path:
npm install @focaxisdev/deja-vuThe npm package provides the optional TypeScript engine. It is not required for base protocol adoption.
const engine = new SemanticRecallEngine(config);
await engine.addMemory(input);
await engine.scanImpressions(query);
await engine.recall(query);
await engine.getSummary(id);
await engine.getChunks(id);
await engine.updateMemory(id, input);
await engine.deleteMemory(id);The public TypeScript exports remain intact for hosts that want semantic recall.
scanImpressions() performs token-only familiarity scanning and does not load summaries or chunks.
The default engine helpers preserve low-token recall quality by generating decision/rationale/trigger summaries and by chunking Markdown or paragraph boundaries before falling back to character splits.
- Protocol-first example: examples/protocol-project
- Engine example:
npm run example:basic - Engine example:
npm run example:agent-pm - Engine example:
npm run example:chat-memory - Engine example:
npm run example:task-assistant
deja-vu/
docs/
protocol.md
workflow.md
storage-markdown.md
templates/
engine/
examples/
protocol-project/
basic/
agent-pm/
chat-memory/
task-assistant/
src/
tests/
npm install
npm run build
npm run test:src
npm run lint:memory
npm run report:feedback