A cue-first memory protocol for AI agents
Deja Vu is a lightweight memory protocol built around one loop:
task cue -> familiarity score -> minimal recall -> durable writeback
The protocol is packaged as three project-local assets:
- rules
- workflow
- tiny memory files
The goal is not to give every agent a heavy runtime. The goal is to give any agent a repeatable discipline for spending almost no tokens until the task proves that deeper memory is useful.
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 two project-local plain text files:
memory/summary.mdmemory/impressions.jsonl
No npm package, embeddings, vector search, or database is required.
If you want to adopt Deja Vu in a project without extra infrastructure:
- Read docs/protocol.md.
- Read docs/workflow.md.
- Read docs/impression-layer.md.
- Read docs/scripted-recall.md.
- Copy the minimum templates from docs/templates.
- Add optional decision, open-loop, 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.
- 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
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.
- Write back only durable memory:
- decisions
- architecture intent
- stable preferences
- unresolved follow-up items
- milestone summaries
- 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.
- 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