Skip to main content
hook CX Codex

deja-vu · hashgraph-online — Claude Code hook: match prompts against session history

deja-vu pulls earlier coding sessions from disk into context at session start and before each terminal command.

MIT ★ 1,596 updated 2026-10-29

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/settings.json
Open on GitHub

What deja-vu does

The deja-vu hooks bundle looks through coding sessions already stored on disk, pulling from Codex, Claude Code, Cursor, opencode, and nineteen other tools, including records written before the plugin was added. The lookup runs locally; no model is called during the search.

Five events trigger it. SessionStart loads relevant context from earlier sessions, UserPromptSubmit checks the new request against that history, PreToolUse runs a check before Bash and apply_patch calls, PreCompact writes the current session to memory before context gets compacted, and SessionEnd marks a session as closed. Each one calls ${PLUGIN_ROOT}/hooks/deja.sh with its own timeout, between 10 and 30 seconds.

The hooks are wired through a project's .claude/settings.json file. Without an entry there, Claude Code never fires these events and the history lookup stays off.

What it helps with

  • load prior work on a codebase back into context at session start
  • match a new prompt against earlier coding sessions
  • check history before running a shell command
  • write the current session to memory before compaction
  • mark a session as finished on exit

Example prompts for the agent

  • Check if we already touched this module in an earlier session
  • Look through past sessions before running this command
  • Save this session to memory before the context gets compacted

How to install deja-vu

Manually: put the files in place

.claude/settings.json

The hooks block: event (PreToolUse, PostToolUse, Stop…) → command. Personal ones go to ~/.claude/settings.json

Step by step, with commands for each platform: Claude Code hooks: what they are, where to configure them, how to block a risky command

Questions about deja-vu

How do I install deja-vu in Claude Code?

Add the hook entries to a project's .claude/settings.json file, wiring handlers for the SessionStart, UserPromptSubmit, PreToolUse, PreCompact, and SessionEnd events.

What does deja-vu do?

It searches coding sessions already sitting on disk, including ones from Codex, Cursor, and opencode, and surfaces matches before commands run and when a session starts.

Does the search need a model call?

No, lookups run against a local index with no model involved.

Source text

hooks.json · MIT
Hooks bundle shipped with the deja-vu plugin for Claude Code.

Search the coding sessions already on your disk — Codex, Claude Code, Cursor, opencode and nineteen more — including work from before it was installed, indexed locally with no model in the loop.

Triggers on: PreToolUse, UserPromptSubmit, SessionStart, SessionEnd, PreCompact.

```json
{
  "hooks": {
    "SessionStart": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "${PLUGIN_ROOT}/hooks/deja.sh hook-context",
            "timeout": 10,
            "statusMessage": "Recalling past sessions…"
          }
        ]
      }
    ],
    "UserPromptSubmit": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "${PLUGIN_ROOT}/hooks/deja.sh hook-prompt",
            "timeout": 10,
            "statusMessage": "Searching past sessions…"
          }
        ]
      }
    ],
    "PreToolUse": [
      {
        "matcher": "Bash|apply_patch",
        "hooks": [
          {
            "type": "command",
            "command": "${PLUGIN_ROOT}/hooks/deja.sh hook-tool",
            "timeout": 10,
            "statusMessage": "Checking relevant history…"
          }
        ]
      }
    ],
    "PreCompact": [
      {
        "matcher": "manual|auto",
        "hooks": [
          {
            "type": "command",
            "command": "${PLUGIN_ROOT}/hooks/deja.sh hook-precompact",
            "timeout": 30,
            "statusMessage": "Saving this session to memory…"
          }
        ]
      }
    ],
    "SessionEnd": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "${PLUGIN_ROOT}/hooks/deja.sh hook-session-end",
            "timeout": 10,
            "statusMessage": "Marking this session as ended…"
          }
        ]
      }
    ]
  }
}

```

© vshulcz · MIT · hashgraph-online/awesome-codex-plugins

Similar hooks

All hooks for Agent setup: memory, context, orchestration →

deja-vu by other authors comes first.

From the same set391

The whole set →
legends-seo-dungeon The legends-seo-dungeon hook frames local SEO audits as 16-bit dungeon battles. It runs after Claude Code edits or writes a file. CX Codex ★ 1,596repo stars dataproduct-builder-dbt dataproduct-builder-dbt runs data contract linting right after file edits in dbt projects. Helps maintain ODCS, ODPS, and OpenLineage standards across your data product builds. CX Codex ★ 1,596repo stars codex-seo This hook runs a schema check when Claude Code edits or writes a file. It ships with codex-seo, a plugin bundle for SEO workflows. CX Codex ★ 1,596repo stars carsxe carsxe is a Claude Code hook that loads the CarsXE API key at session start. The API provides vehicle data such as VIN details, market value, history, and OBD codes. CX Codex ★ 1,596repo stars wtfm wtfm generates illustrated end-user help articles from codebase files and renders screenshots locally from the actual interface code. CX Codex ★ 1,596repo stars vibestretch vibestretch is a Claude Code hook that prints a stretch or eye-rest prompt and plays a soft chime after the agent has kept you waiting. It runs on prompt submission, tool use, and agent stop. CX Codex ★ 1,596repo stars tree-ring-memory tree-ring-memory is a Claude Code hook that loads saved context when a session starts and checks memory when it ends. It also runs at subagent start and stop. CX Codex ★ 1,596repo stars tailtest tailtest detects files modified during an agent turn and triggers automated test writing and execution. Works across 8 languages with zero config. CX Codex ★ 1,596repo stars

More in the catalog

Project sponsors

Companies that keep this analytics open