Skip to main content

deja

CI PyPI Python License: MIT MCP

Semantic search over your AI coding agent session history. Ask questions about past conversations by meaning, not just keywords.

deja is an MCP server that indexes JSONL sessions from supported AI coding agents and provides hybrid search (vector + full-text) directly from Claude Code.

Supported sources

Source Path Status
Claude Code ~/.claude/projects/*/*.jsonl Supported
Codex CLI ~/.codex/sessions/YYYY/MM/DD/*.jsonl Supported (v0.4+)
Cursor / Gemini / OpenCode — Planned (#8)

How it works

~/.claude/projects/*/        deja index         index.db
     *.jsonl           ──────────────►    (SQLite + vec + FTS5)
                        embeddings
                                           │
                                           │  deja serve (MCP stdio)
                                           ▼
                                      Claude Code
                                    "search past sessions"
  1. Index — parses JSONL session files, extracts conversation turns, embeds with multilingual-e5-small, stores in SQLite
  2. Serve — MCP server opens the index and answers search queries via stdio transport

Search combines vector KNN (semantic similarity) and FTS5 (keyword matching) via Reciprocal Rank Fusion.

Install

pip install dejasearch

Or from source:

git clone https://github.com/CynepMyx/deja.git
cd deja
pip install -e .

First run downloads the embedding model (~117 MB).

Usage

Build the index

deja index                       # incremental, all sources
deja index --reindex             # full rebuild
deja index --source claude-code  # only Claude Code sessions
deja index --source codex        # only Codex CLI sessions

Scans every supported source by default. Filter with --source.

Add to Claude Code

Add to ~/.claude.json under mcpServers:

"deja": {
    "type": "stdio",
    "command": "/path/to/deja/.venv/Scripts/deja.exe",
    "args": ["serve"],
    "env": {
        "PYTHONUNBUFFERED": "1"
    }
}

Restart Claude Code — deja will appear as a connected MCP server.

MCP Tools

Tool Description
search Hybrid semantic + keyword search across all sessions
get_context Get a chunk with surrounding turns (±window)
get_session_chunks Get indexed chunks for a session (not raw messages)

search parameters:

  • query (string) — what to search for
  • limit (int, default 10) — max results
  • project (string, optional) — filter by project
  • source (string, optional) — filter by source: claude-code, codex
  • date_from / date_to (string, optional) — ISO date range

Auto-indexing (optional)

Index automatically when a Claude Code session ends. Add a Stop hook to ~/.claude/settings.json:

"hooks": {
    "Stop": [
        {
            "matcher": "",
            "hooks": [
                {
                    "type": "command",
                    "command": "/path/to/deja/.venv/bin/deja index"
                }
            ]
        }
    ]
}

On Windows with Git Bash, wrap in a shell script:

#!/bin/bash
DEJA="/path/to/deja/.venv/Scripts/deja.exe"
[ -f "$DEJA" ] && "$DEJA" index >/dev/null 2>&1 &
"command": "bash /path/to/deja-index.sh"

PID lock prevents concurrent indexers — safe with multiple sessions.

Stack

  • fastembed — ONNX embeddings (intfloat/multilingual-e5-small, 384-dim)
  • sqlite-vec — vector KNN search in SQLite
  • SQLite FTS5 — full-text keyword search
  • FastMCP — MCP server framework

Performance

Metric Value
Incremental index < 30 sec
Search latency (warm) < 500 ms
First search (cold start) < 5 sec
RAM (search) ~150 MB
RAM (indexing) ~300 MB

Development

pip install -e ".[dev]"
pytest

License

MIT

Metadata

Release files for dejasearch 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dejasearch 0.6.0
File Size Uploaded
dejasearch-0.6.0.tar.gz 81.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dejasearch 0.6.0
File Interpreter ABI Platform
dejasearch-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 112.0 kB

Release files / dejasearch-0.6.0.tar.gz

Download URL dejasearch-0.6.0.tar.gz
Size 81.6 kB
Tags Source
SHA-256 checksum
How to use checksums
75e7a7de2e02c52384d8abb6b7b7aa35c9c9811231deacc163c8e404c5691f48
BLAKE2b-256 checksum
How to use checksums
df1cc4a299dbf82eb1623fd26cdfa7a67f16bac7fda84b5205491733be7901aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.

Transparency log

Release files / dejasearch-0.6.0-py3-none-any.whl

Download URL dejasearch-0.6.0-py3-none-any.whl
Size 30.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c687b1502985830db07720002db8cd1f06f5583a0d51a51f1faf86c7d42536d3
BLAKE2b-256 checksum
How to use checksums
c498c668e87f80cceb4812ba4dd174ad20d2243b794746968a9d6bf1cfeb1561
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page