# How It Works

> Explain how claude-dejavu detects antipatterns and learns rules. Use when the user asks "how does dejavu work?" or "what is this thing doing?".

- **Type:** Skill
- **Install:** `agentstack add skill-cmg8431-claude-dejavu-how-it-works`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [cmg8431](https://agentstack.voostack.com/s/cmg8431)
- **Installs:** 0
- **Category:** [Databases](https://agentstack.voostack.com/c/databases)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [cmg8431](https://github.com/cmg8431)
- **Source:** https://github.com/cmg8431/claude-dejavu/tree/main/plugin/skills/how-it-works
- **Website:** https://www.npmjs.com/package/claude-dejavu

## Install

```sh
agentstack add skill-cmg8431-claude-dejavu-how-it-works
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# How claude-dejavu works

Explain the following to the user:

## What it does

claude-dejavu watches your Claude Code sessions for repeated mistakes. When it detects a pattern — like the same error happening across sessions, or code being reverted back and forth — it creates a rule and patches your CLAUDE.md so Claude doesn't make that mistake again.

## The 3-step loop

```
[Session Logs]          [Pattern Detection]        [Rule Suggestion]
tool usage data  ──▶  antipattern detectors  ──▶  CLAUDE.md patch
     ▲                                                  │
     │               [Effectiveness Tracking]            │
     └──────  rule fire counting  ◀─────────────────────┘
```

## 3 Detectors (v0)

1. **Revert Cycle** — Claude edits a file, then someone reverts it, then Claude edits it again. Sign that Claude isn't checking existing logic before changing things.

2. **Repeated Error** — The same error message keeps appearing across sessions (e.g., "command not found: npm" in a pnpm project). Claude keeps falling into the same trap.

3. **Silent Fix** — Claude finishes work, then the user quietly edits the same file without saying anything. The user is correcting Claude's output through action, not words. This is the killer feature that differentiates dejavu from other tools.

## Where data lives

- Rules database: `~/.local/share/claude-dejavu/dejavu.db` (SQLite)
- Session buffers: `~/.local/share/claude-dejavu/buffers/` (temporary)
- Output: `CLAUDE.md` in your project root

## Rule format in CLAUDE.md

```md

- This project uses pnpm, not npm. Run pnpm install not npm install.
  ↳ Learned from 4 repeated errors across 3 sessions.
```

The HTML comments are metadata that Claude ignores but dejavu reads/writes for tracking.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [cmg8431](https://github.com/cmg8431)
- **Source:** [cmg8431/claude-dejavu](https://github.com/cmg8431/claude-dejavu)
- **License:** MIT
- **Homepage:** https://www.npmjs.com/package/claude-dejavu

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-cmg8431-claude-dejavu-how-it-works
- Seller: https://agentstack.voostack.com/s/cmg8431
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
