Stop Claude from fabricating names. Restore deleted sessions. Search every past conversation.
Built by HTE Switzerland — a digital solutions partner shipping production AI infrastructure, full-stack development, and cloud-grade engineering.
Every Claude API call costs tokens. Every fabricated name (a made-up env var, a wrong field on a Prisma model, a typo of a route, a fictional GraphQL field) ends in a rewrite — and a second API call to fix the first one. claude-dejavu catches those fabrications BEFORE they hit disk.
Twelve languages, eight grounding domains: symbols (Python, TypeScript, TSX, JavaScript, Go, Rust, Java, Ruby, Bash, PHP, C#, Kotlin), HTTP routes, frontend pages, env vars (with an SDK convention catalog covering LaunchDarkly / AWS / Stripe / Sentry / Redis / Postgres / Next / Datadog / OpenAI / Anthropic / Supabase / …), DB schema (Prisma / Drizzle / TypeORM / SQL migrations), GraphQL (SDL + inline gql), feature flags (LaunchDarkly / Unleash / GrowthBook / flags.json), plus an LSP wire-protocol passthrough for type-check ground truth.
89.3% measured reduction in hallucinated identifiers. On a 400-trial controlled benchmark against claude-sonnet-4-6 (51.5% → 5.5%, McNemar exact p=9.6e-27, 95% CI 82.7–95.1%), claude-dejavu's grounding cuts fabricated names by 89.3%. In additional tests with v0.5.0a's 14-strategy deterministic rewriter cascade (n=200, same prompts and scoring), we've measured up to 99% reduction (51.5% → 0.5%) — that's the upper bound seen so far, not a stability guarantee. Treat 89.3% as the rigorous headline. See docs/REWRITER.md for the rewriter architecture and docs/benchmarks/ for both reports.
Plus session recovery. Claude Code stores every conversation in ~/.claude/projects/<encoded>/<uuid>.jsonl. Those files can be deleted, truncated, or otherwise lost — by Claude, by a stray git clean, by manual cleanup. claude-dejavu mirrors them so deletion never costs you the conversation. Semantic search across every past chat means "have we discussed X before?" now has an answer.
Both ship as a Claude Code plugin AND a standalone CLI:
Every Claude Code Stop event mirrors the live .jsonl to an off-tree location. When a session disappears from ~/.claude/projects/, the next time Claude Code runs you see this:
⚠ claude-dejavu: 3 session(s) missing from
~/.claude/projects/. Runclaude-dejavu restore --listto see all.
Then one command brings them back, byte-perfect, with a runnable claude --resume command:
$ claude-dejavu restore --list
Restorable sessions (3):
deleted aaaaaaaa-1111-0000-0000-000000000001 myproject 2026-04-15 124.7 MB
deleted aaaaaaaa-2222-0000-0000-000000000002 myproject 2026-04-08 25.3 MB
deleted aaaaaaaa-3333-0000-0000-000000000003 other-app 2026-04-02 0.9 MB
$ claude-dejavu restore --all
✓ aaaaaaaa-1111-… (124.7 MB) → ~/.claude/projects/-home-…/aaaaaaaa-1111-….jsonl
resume: cd ~/projects/myproject && claude --resume aaaaaaaa-1111-…
✓ aaaaaaaa-2222-… ( 25.3 MB)
✓ aaaaaaaa-3333-… ( 0.9 MB)
Restored 3/3 session(s).Hybrid BM25 + vector search across every turn of every past session. By default returns ~80-token gists; expand specific turns on demand to keep token cost low.
$ claude-dejavu search "auth refresh token rotation"
scope=ws:my-stack hits=2
[1] turn=1842 score=0.84 myproject/aaaaaaaa-1111 2026-04-15
Refresh-token rotation: store hash, single-use, 5min grace window for clock skew…
[2] turn=2104 score=0.61 backend/bbbbbbbb-2222 2026-04-12
JWT exp 15m + refresh 30d, rotation on every use, revocation list in Redis…Claude can call this automatically through the bundled MCP server, so when you ask "have we discussed auth?" mid-session, it grounds itself in your actual past conversations instead of inventing context.
$ claude-dejavu errors --tool=Bash --limit=5 # all Bash failures across sessions
$ claude-dejavu files src/auth/ # which sessions touched this dir
$ claude-dejavu sessions --scope=global # everything you've ever worked onPostgres schema captures sessions, turns, tool_calls, file_touches. Trigram + full-text indexes for instant "what did Claude run last week?" queries.
When a Claude Code session ends, claude-dejavu auto-summarizes it into structured
fields (request / investigated / learned / completed / next_steps) using claude -p
(no API key needed — inherits your existing Claude Code auth) and extracts typed
observations (bugfix / decision / discovery / feature / change / refactor / question).
When you start a fresh conversation in the same project, claude-dejavu injects a token-disciplined preamble:
[claude-dejavu — context from prior sessions on this project]
last request: refactor the auth refresh-token rotation
completed: JWT exp 15m + refresh 30d, rotation on every use, revocation list in Redis
next steps: wire the revocation list to the gateway middleware
recent observations:
[decision] adopt 5-min grace window for clock skew
[bugfix] refresh token leaked in error logs (sanitizer added)
LLM provider cascade: claude -p → Anthropic SDK → Gemini → OpenRouter → Ollama →
rule-based fallback. Whichever you have configured wins; degrades gracefully.
| Plugin | Storage | Granularity | Search | Session summaries | Restore deleted? | License |
|---|---|---|---|---|---|---|
claude-mem |
SQLite | LLM summaries | vector (chroma) | ✓ | ✗ | AGPL-3.0 |
claude-recall-plugin |
files | mid-session context | n/a | ✗ | ✗ | MIT |
claude-historian |
files | session metadata | basic | ✗ | ✗ | varies |
claude-archivist |
sqlite | session metadata | search | partial | partial | varies |
claude-dejavu |
PG + Weaviate | raw turns + summaries | hybrid BM25+vector + PG-FTS | ✓ (v0.2) | ✓ | FSL-1.1-ALv2 |
claude-dejavu now ships claude-mem's three killer features under a fair-source license — LLM session summaries, typed observations, SessionStart context injection (v0.2) — plus its own unique deletion-recovery + lossless-audit features.
For corporate teams whose legal policy forbids AGPL-3.0's copyleft contagion, dejavu's FSL is the clean answer: internal use is unrestricted, no source-disclosure obligation, and each version converts to Apache 2.0 two years after release. Commercial license available for use cases that fall outside FSL's Permitted Purpose — see COMMERCIAL.md.
See docs/VS_CLAUDE_MEM.md for measured latency, recall, and response richness numbers from a head-to-head benchmark.
claude-dejavu auto-provisions Postgres + Weaviate via Docker. Install it first, then everything below is automatic.
| OS | Install command |
|---|---|
| macOS | brew install --cask docker then launch Docker Desktop |
| Windows | winget install Docker.DockerDesktop then launch Docker Desktop |
| Linux | curl -fsSL https://get.docker.com | sudo sh && sudo usermod -aG docker $USER |
(If you already have your own Postgres + Weaviate running, the plugin will detect them on common ports — Docker is only required for the bundled stack.)
/plugin marketplace add HthSolid/claude-dejavu
/plugin install claude-dejavu
That's it. The plugin's Setup hook fires automatically on install and
runs the installer end-to-end — auto-provisions Postgres + Weaviate via
Docker, applies the schema, creates a per-user database, bootstraps a
Python venv with all dependencies, and wires the MCP server.
First-install takes 1-5 minutes while Docker pulls the Weaviate + transformers images. Subsequent sessions are instant.
If anything goes wrong (Docker not running, port conflict, etc.), the SessionStart hook reads the install marker and tells Claude in chat exactly what to fix — no terminal output to dig through. Plus you can always run:
/dejavu-doctor # diagnose every layer + see one-shot fix instructions
/dejavu-config list # see all settings + current values
Updates flow through the marketplace — the SessionStart hook checks
git ls-remote for new tags and prints a one-line notice when a newer
version is available; claude plugin update claude-dejavu applies it
(Setup hook re-runs to pick up any new dependencies).
For CI environments, dev forks, or distros without the claude CLI:
git clone https://github.com/HthSolid/claude-dejavu
cd claude-dejavu
python3 scripts/install.py --register-mcp--register-mcp writes a manual claude-dejavu entry to
~/.claude/settings.json so Claude Code can find the MCP server without
the plugin path. Don't use --register-mcp if you've already installed
via the marketplace — it'll create a duplicate registration. The
standalone installer also detects existing marketplace installs and skips
its own MCP registration in that case.
See docs/INSTALL.md for the complete platform-by-platform guide. Covers macOS, Linux (Ubuntu / Fedora / Arch), Windows native, and Windows + WSL2. Assumes zero prior Docker / Postgres knowledge.
- Verifies Docker is installed AND running — three-state probe (absent / daemon-down / ok). If Docker Desktop is installed but not started, you'll see "Launch Docker Desktop" in the Claude chat, not a buried terminal error.
- Detects Postgres + Weaviate on common ports, with shape verification
(a SearXNG on port 8889 won't pose as Weaviate). If nothing is found,
auto-provisions them via the bundled
docker-compose.minimal.yml. - Creates a per-Linux-user database
claude_dejavu_$USER(use--sharedfor trusted teams). - Bootstraps a Python venv and installs
psycopg2-binary,mcp,tree-sitter==0.21.3, andtree-sitter-languages==1.10.2. - Normalizes
.mcp.json+hooks/hooks.jsonto the OS-correct python command (python3on Linux/macOS,pythonon Windows). - Symlinks the
claude-dejavuCLI into~/.local/bin/(or%LOCALAPPDATA%\Microsoft\WindowsApps\claude-dejavu.baton Windows). - No systemd, no launchd, no Task Scheduler — snapshots are Stop-hook-driven.
The installer is cross-platform: Linux, macOS, Windows (native + WSL). All hooks, the MCP server, and the CLI are pure Python.
Search + recovery
| Command | What it does |
|---|---|
/dejavu-search <query> |
Hybrid (BM25 + vector) search across past sessions — gist-first response shape (v0.8.6) |
/dejavu-resume <hint> |
Find the best matching past session + ready-to-run resume command |
/dejavu-sessions |
List recent sessions in current scope |
/dejavu-restore |
List/restore deleted sessions from off-tree backup |
/dejavu-repair |
Detect + reconstruct corrupt / truncated session JSONLs from the dejavu DB (v0.7.1) |
/dejavu-scan-corruption |
Detect zeroed / partial-zero / shrunk files across known projects (v0.7.2) |
/dejavu-recover-file |
Reconstruct a corrupted file from a file-history snapshot + Edit replay (v0.7.2) |
Backup + rescue
| Command | What it does |
|---|---|
/dejavu-session-copy |
Restic-backed session-copy: take, list, diff, restore, prune, migrate-from-rsync, reclaim-legacy (v0.8.0 + v0.8.3) |
/dejavu-rescue |
Recover records from a corrupted Weaviate shard via the pure-stdlib Go segment reader (v0.8.2) |
/dejavu-pg-rescue |
Postgres corruption rescue toolkit: scan, patch-toast, reset-flags, rebuild-table, reindex (v0.8.3) |
/dejavu-weaviate-rescue |
Weaviate rescue toolkit: scan, quarantine-segment, redo-class (v0.8.3) |
Grounding + introspection
| Command | What it does |
|---|---|
/dejavu-symbols <name> |
Resolve a code symbol against the project's index |
/dejavu-lint <file> |
Lint a proposed edit, flag fabricated names + typos |
/dejavu-reindex |
(Re)build the symbol + doc + route indexes for the current project |
/dejavu-docs <query> |
Heading-anchored .md chunk search across the repo's docs (v0.7.0) |
/dejavu-outcomes |
Inspect the correction_outcomes log |
/dejavu-doctor |
Diagnose install + runtime health (--deep for full PG + WV scan, v0.8.3) |
/dejavu-config |
Read/change settings (lint mode, scope defaults, …) |
Context economy (v0.8.4 → v0.8.6)
| Command | What it does |
|---|---|
/dejavu-what-shipped |
Print the last N CHANGELOG release headlines for a repo (v0.8.4) |
/dejavu-memory |
record-version for the cross-project release digest; backfill-gists to populate compressed gists (v0.8.4 + v0.8.6) |
/dejavu-jit-recall-preview |
Preview what the opt-in JIT recall hook would inject for a given prompt (v0.8.5) |
/dejavu-expand |
Fetch the full content of one or more turns by id — companion to the gist-first search shape (v0.8.6) |
Install or runtime trouble? See docs/TROUBLESHOOTING.md for common errors (Docker not running, port conflicts, stale install cache, Windows-specific notes) and how to fix each one. Always start with
/dejavu-doctor— it auto-diagnoses and prints copy-pasteable fix commands for every failed check.
Installed automatically by scripts/install.py into the dejavu-owned
venv: psycopg2-binary, mcp, tree-sitter, tree-sitter-languages,
pyyaml.
Starting in v0.8.6 (Context Economy phase 3) claude-dejavu can
use the dejavu_bridge Python wheel — a pre-compiled Rust binary
that ships six retrieval primitives (gist compression, token-budget
retrieval, semantic cache lookup, RRF fusion, ingest gate, topic
re-rank). The wheel is a performance addon, not a core feature.
| Mode | dejavu_bridge present? | What's different |
|---|---|---|
| Optimized | yes | Compressed gists (less disk + faster recall), ML-tuned thresholds, Rust-speed (10-30× sub-ms wins on hot paths) |
| Standard | no | Pure-Python implementation of the same six primitives via code/dejavu_bridge_stub.py. All MCP tools, recall, ranking, and bench numbers are unchanged. Storage uses more disk (gists = raw content), some hot paths run a few ms slower. |
Both modes ship every MCP tool, the full search surface, vector indexes, learned ranker, etc. The bench corpus has been running at 8/8 across all three dejavu tools throughout development in standard mode. Switching to optimized mode is purely a "make it faster / smaller" move, not a "unlock features" one.
Install path. By default the installer attempts to fetch the
binary wheel from the public release artifacts of the claude-dejavu
repo. Override via DEJAVU_BRIDGE_INDEX_URL for a local mirror,
your own build, or a custom CDN:
# example: install from a local artifact directory
export DEJAVU_BRIDGE_INDEX_URL=file:///path/to/wheels/
python3 scripts/install.py --autoIf the wheel can't be fetched, install proceeds in standard mode
— the in-tree stub takes over automatically. SessionStart announces
the active mode in stderr; check with claude-dejavu doctor.
┌──────────────────────────────────┐
Claude Code ─► │ Stop hook (pure Python) │
.jsonl write │ │
│ • mirror to off-tree dir │ ← always (free safety net)
│ • incremental ingest │ ← async (PG + Weaviate)
│ • restic snapshot (scheduled) │ ← content-addressed dedup, v0.8.0+
│ • deletion-detection │ ← warn user via systemMessage
└────────────┬─────────────────────┘
│
┌───────────────────────┴────────────────────────┐
│ │
┌────▼──────────┐ Postgres Weaviate
│ sessions │ • per-user isolation • caller-supplied 1024-dim
│ turns │ • trigram + BM25 + FTS │ (cloud embed; vectorizer:none)
│ turns.gist │ • workspaces table • multi-tenant per Linux user
│ tool_calls │ • code symbols • BM25 keyword + vector ANN
│ file_touches │
│ symbols │
└───────────────┘
│
▼
┌──────────────────────────────────────────┐
│ CLI + MCP server + UserPromptSubmit hook │
│ BM25 + RRF fusion + token-budget greedy │
│ scope = workspace ⊇ project │
│ gist-first response (--full for raw) │
└──────────────────────────────────────────┘
Backup layer (since v0.8.0):
• restic repo at $DATA_ROOT/restic-repo/ (content-addressed; ~5-10 GB for 90 days
vs the 500 GB the old rsync chain ate)
• session-copy take/restore/check/prune (CLI)
• optional --include=pg+weaviate (v0.8.3) (pg_dump + Weaviate volume tar)
• optional reclaim-legacy (v0.8.3) (drop the migrate-from-rsync .deleteme tree)
$XDG_DATA_HOME/claude-dejavu/ # Linux: ~/.local/share/claude-dejavu/
# macOS: ~/Library/Application Support/claude-dejavu/
# Windows: %LOCALAPPDATA%\claude-dejavu\
├── chat-logs/<encoded-project>/<uuid>.jsonl # off-tree mirror, 1 file per session
├── snapshots/<timestamp>/ # 5-min hardlink snapshots (rsync --link-dest)
│ └── latest -> 20260427-230945
├── config.env
├── ingest.log
└── venv/
Postgres lives in your existing instance (or the bundled Docker compose if you don't have one).
Designed for privacy by default without you having to think about it:
- Multi-user: separate Postgres database + Weaviate tenant per Linux/macOS/Windows user. No cross-user reads. Override with
--sharedonly for trusted teams. - Cross-repo: default scope is the workspace containing the current repo (or just the repo if no workspace defined). A contractor on multiple unrelated client projects never sees data leak between them by accident.
- Token discipline: search returns ~80-token gists by default. Claude expands specific turns on demand. Saves 10–20× tokens vs. dumping full content.
- Off-tree by default: nothing critical lives inside your project repo.
git clean -xfdcannot delete it.
Pick a model based on your machine. Real CPU benchmarks on a 4,548-turn corpus:
| Tier | Default model | Short p50 | Recall@5 | MRR |
|---|---|---|---|---|
| light (<8 GB RAM) | MiniLM-L6-v2 (384-dim) | 43 ms | 0.56 | 0.52 |
| normal English | bge-small-en-v1.5 (384-dim) | 138 ms | 0.78 | 0.60 |
| multilingual light | multilingual-e5-small (384-dim) | 72 ms | 0.67 | 0.53 |
| best-recall (CPU) | nomic-embed-text-v1.5 (768-dim) | 300 ms | 0.89 | 0.67 |
| strong (GPU) | multilingual-e5-large-instruct (1024-dim) | varies | — | — |
scripts/install.py detects RAM/GPU/Docker and picks a sensible default. Override with --model=<choice>. See docs/MODEL_BENCHMARK.md for methodology.
# Recovery (the headline feature)
claude-dejavu restore --list # show what's restorable
claude-dejavu restore <uuid> [...] # restore specific session(s)
claude-dejavu restore --all # restore everything missing
claude-dejavu restore --since 7d # only recent
# Search & navigate
claude-dejavu search "<query>" [--scope=...] # hybrid search
claude-dejavu expand <turn_id> [...] # full content of specific turns
claude-dejavu resume "<hint>" # find best session + resume command
claude-dejavu sessions # list recent sessions
claude-dejavu errors [--tool=X] # tool failures
claude-dejavu files <path-substring> # which sessions touched these
# Workspaces (named groups for shared recall across tightly-coupled repos)
claude-dejavu workspace list
claude-dejavu workspace create my-stack --projects=repo1,repo2,repo3
claude-dejavu workspace add my-stack repo4
# Hallucination grounding (v0.5.0a — see docs/REWRITER.md)
claude-dejavu env propose <NAME> [--package=<sdk>] [--apply]
# declare a new env var (after dejavu sees an SDK convention
# the project hasn't declared yet)
claude-dejavu fabrications [--status=open] # list names the rewriter has flagged; mark each
# as declared / blacklisted after triage
claude-dejavu fabrications --mark NAME DOMAIN STATUS
claude-dejavu generate runtime-trap [--language=ts|python]
# emit a typed env accessor that throws on undeclared keys
# Diagnostics
claude-dejavu doctor # checks PG/Weaviate/index/error-log status
claude-dejavu logs [--component=...] [--with-traceback]
# plugin-internal error log (rotates at 5 MB)For users who want extra defense beyond mirror-based recovery:
Append-only allows Claude to keep writing new turns but rejects truncation/deletion at the kernel level. claude-dejavu documents this — it doesn't apply it by default (needs admin privileges).
Issues and PRs welcome. Run the smoke test before opening a PR:
PG_HOST=localhost PG_PORT=5432 WV_URL=http://localhost:8080 \
python3 tests/smoke.pyCI runs the same suite on Linux × Python 3.10/3.11/3.12 plus best-effort macOS / Windows jobs.
claude-dejavu builds on excellent open-source work:
- PostgreSQL (PostgreSQL License) — the structured audit store
- Weaviate (BSD-3-Clause) — the vector store with hybrid search
- Anthropic MCP SDK (MIT) — the in-session protocol
- psycopg2-binary (LGPL with linking exception) — Postgres client
- sentence-transformers (Apache-2.0) — used in the benchmark harness
- HuggingFace embedding models — see docs/MODEL_BENCHMARK.md for the list and their respective licenses
"Claude Code" and "Claude" are trademarks of Anthropic, PBC. claude-dejavu is an independent third-party plugin and is not affiliated with or endorsed by Anthropic.
In 2014, Tesla took down the wall of patents in their Palo Alto lobby. Elon Musk wrote: "They have been removed, in the spirit of the open source movement, for the advancement of electric vehicle technology."
claude-dejavu is in that spirit — for the advancement of AI that doesn't hallucinate. Knowledge that took years to gather, I'm releasing to the world. The next decade of software depends on this problem getting solved, and locking the answer just slows everyone down.
I have plenty more projects like this in the drawer. With a little funding, they'll all see daylight too.
claude-dejavu is built by HTE Switzerland.
We're not an outsourcing shop — we're the engineering team founders call when something has to actually work. If you have a startup, no CTO, and a roadmap that needs serious engineering, that's our wheelhouse. Reach out at info@hendrikthurau.enterprises or hendrikthurau.enterprises. The plugin you're reading is what that quality looks like.
claude-dejavu is fair-source under FSL-1.1-ALv2 — fully functional, free for any Permitted Purpose, forever. If you want to help fund the next ten projects:
- GitHub Sponsors — one-off or monthly, native to where the code is
- Or just star the repo + tell a founder who needs this
A future Pro tier (editor extensions, CI integration, hallucination dashboard, custom grounding domains for your DSL) will fund the next phases. The core stays free under FSL, fully functional, with each version automatically converting to Apache 2.0 two years after release.
claude-dejavu is licensed under the Functional Source License, Version 1.1, ALv2 Future License (FSL-1.1-ALv2).
Free, no questions asked, for:
- Individual developers, freelancers, students
- Internal corporate use (any company size — on your codebase, in your CI, on your developer machines)
- Open-source projects
- Non-commercial research and teaching
- Professional services delivered to a licensee using claude-dejavu under the same terms
Each version automatically becomes Apache 2.0 two years after release.
A commercial license is required if you want to:
- Bundle claude-dejavu into a commercial product or service you sell
- Host it as a managed service for third parties
- Build a product that competes with our commercial offering
If any of that applies — or if your legal team simply prefers a traditional commercial license — we're easy to work with. We don't expect Fortune 500s to use our work for free while we get nothing, and we don't expect indie devs to pay. Drop a line: dejavu@hendrikthurau.enterprises. See COMMERCIAL.md for details.
