dejafix
by racstan
README.md
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/racstan/dejafix/main/docs/brand/logo-dark.png">
<img src="https://raw.githubusercontent.com/racstan/dejafix/main/docs/brand/logo.png" alt="dejafix" width="300">
</picture>
</p>
<p align="center"><b>Déjà fix: "we've seen this error before."</b><br>
A team-owned runbook of known problems and their fixes, looked up by error text, for AI coding agents and the people who work with them.</p>
<p align="center"><b>Free for personal use.</b> Using it in a business, or selling, hosting or building a product on it, needs a license from the author, which may come with a fee that we agree on together: <a href="https://github.com/racstan/dejafix/issues/new?template=commercial_license.yml">ask for one</a>.</p>
<p align="center">
<img src="https://raw.githubusercontent.com/racstan/dejafix/main/docs/media/demo.gif" alt="Pasting a port-in-use error into the dashboard finds the team's fix; then a person approves a fix an agent proposed" width="900">
<br><sub>Paste an error, get the team's fix, approve what agents found. (<a href="https://github.com/racstan/dejafix/blob/main/docs/media/demo.mp4">MP4</a>)</sub>
</p>
1. **Your AI gets stuck on the same problems again and again:** a port already in use, an expired token giving a 401, a database that isn't running, a shell quoting error.
2. **Every new session works the fix out from scratch,** spending your time and tokens on a problem someone already solved last week.
3. **Nobody writes the fix down,** or it ends up in one person's notes where no agent ever finds it.
**dejafix keeps the fix the first time it's found, and hands it to every agent and every person after that.** Agents look up errors and propose the fixes they confirm, people review them in a web dashboard, and the runbook lives in your repo as plain Markdown, reviewed and kept in git like code.
It works with any app that supports [MCP](https://modelcontextprotocol.io): Claude Code, Cursor, VS Code with Copilot, Codex, Windsurf and others. It also has a CLI for people and scripts.
## Why dejafix
- **Local-first.** No hosted service, no account, no network calls, no telemetry. The dashboard listens on `localhost` only.
- **Team-owned.** One Markdown file per problem in `.dejafix/` in your repo. Fixes go through review, then through your normal pull requests.
- **Reviewed by a person.** What an agent proposes waits in the review queue. Lookups return only approved fixes unless you ask for more.
- **Safe to save.** Before anything is written, tokens, keys, passwords, emails and connection strings are redacted. If something looks like a secret it can't classify, it refuses to save and says why.
- **No duplicates.** A new fix that matches an existing one is caught, so you merge instead of piling up copies.
- **A proper dashboard.** Review, search, edit, merge and retire fixes in a page that updates live.
## Quick start
```bash
npx dejafix init # creates .dejafix/ and prints the MCP config for your AI tool
npx dejafix dashboard # opens the dashboard at http://localhost:4660
```
`init` lists what it will change and asks once (`--yes` skips the question). Add `--hook` to let Claude Code look up failed shell commands by itself, and `--global` to set up a runbook in `~/.dejafix` that all your projects share.
### Connect your AI tool
**Claude Code**
```bash
claude mcp add dejafix -- npx -y dejafix
```
or in `.mcp.json` at the root of your project:
```json
{
"mcpServers": {
"dejafix": { "command": "npx", "args": ["-y", "dejafix"] }
}
}
```
**Cursor**: `.cursor/mcp.json`
```json
{
"mcpServers": {
"dejafix": { "command": "npx", "args": ["-y", "dejafix"] }
}
}
```
**VS Code**: `.vscode/mcp.json`
```json
{
"servers": {
"dejafix": { "type": "stdio", "command": "npx", "args": ["-y", "dejafix"] }
}
}
```
On Windows, use `"command": "cmd"` with `"args": ["/c", "npx", "-y", "dejafix"]` (and `claude mcp add dejafix -- cmd /c npx -y dejafix`). `dejafix init` prints the right one for your computer.
## How it works
```
agent hits an error ──► lookup ──► known fix? ──yes──► tries it ──► record_use
│
no
▼
works it out ──► propose_fix ──► review queue ──► a person approves
│
every agent and person after that ◄───┘
```
The MCP server gives agents three tools, with one-line descriptions to keep their context small:
| Tool | What it does |
| --- | --- |
| `lookup` | Takes an error message or raw error output and returns the best matching approved fixes. The error is normalized first (paths, ports, timestamps and ids are stripped), then matched against each fix's symptoms and title. |
| `propose_fix` | Records a fix the agent has just confirmed, as *proposed*, for a person to review. Similar existing fixes are returned instead of saving a duplicate. |
| `record_use` | Marks that a fix worked again (or didn't). It feeds the use count and the dashboard. |
With `dejafix init --hook`, Claude Code runs a lookup itself whenever a Bash command fails, and shows any match to the agent before it starts digging.
**Here is the whole loop with real MCP calls.** The agent's build fails and `lookup` knows nothing, so it works the fix out and calls `propose_fix`. The fix appears in the open dashboard at once; a person approves it, and the next lookup for that error returns it.

<sub>Also as [MP4](https://github.com/racstan/dejafix/blob/main/docs/media/agent-flow.mp4). More in [docs/tools.md](https://github.com/racstan/dejafix/blob/main/docs/tools.md).</sub>
## The dashboard
`npx dejafix dashboard` opens it in your browser. It updates by itself when files change, and switches between the project runbook, the global one or both.
**One dashboard for all your projects.** Every project where you run `dejafix init` (or where your AI app uses dejafix) joins the list, and the one dashboard at http://localhost:4660 shows them all: switch from the sidebar or the top bar, or see every project at a glance on **All projects**. Running `npx dejafix dashboard` in another project opens it in the dashboard that is already running, instead of starting a second one.

<sub>All projects, then billing-api, then docs-site from the top-bar picker; `[` folds the sidebar; the theme button goes dark.</sub>
| | |
| --- | --- |
|  |  |
| **Home.** How many fixes are approved, waiting or stale, the most-used fixes, recent lookups and the problems seen most often this week. | **Review queue.** Every fix an agent proposed, with the error, the cause and the fix. Approve, Edit or Reject: this is the dashboard's main job. |
|  |  |
| **Search.** Paste any error output and see the matches ranked, exactly as an agent would see them. | **Entry.** View and edit a fix, its use history, and similar entries to merge. |
**Reviewing** takes a click (or a key): approve a fix, or merge a near-duplicate into the entry it repeats.

| | |
| --- | --- |
|  |  |
| **Add a fix** by hand, and edit any fix in place ([see it](https://raw.githubusercontent.com/racstan/dejafix/main/docs/media/add-edit.gif)). | **Stale** fixes: unused for 90 days, or found on a tool version that has since changed. |
|  |  |
| **Light and dark**, following your system or your choice. | **Fold the sidebar** with ☰ or `[` for more room. |
On a phone the sidebar becomes a drawer:

See [docs/dashboard.md](https://github.com/racstan/dejafix/blob/main/docs/dashboard.md).
## The CLI
```
dejafix run the MCP server on stdio (what your AI tool starts)
dejafix init [folder] set up .dejafix/ and print MCP config [--global] [--hook] [--yes]
dejafix dashboard open the web dashboard [--port n] [--no-open] [--global]
dejafix lookup "<error>" find known fixes (or pipe output in) [--all] [--json]
dejafix add add a fix (asks questions with no flags)
dejafix review approve or reject proposed fixes [--list]
dejafix list list fixes [--status s] [--global] [--json]
dejafix stats counts, top problems, lookups [--json]
```
Pipe output straight in: `npm run dev 2>&1 | npx dejafix lookup`. `lookup` exits with 0 when something matched and 2 when nothing did, so scripts can use it. More in [docs/cli.md](https://github.com/racstan/dejafix/blob/main/docs/cli.md).

| | |
| --- | --- |
|  |  |
| **`init`** sets up the runbook and prints your MCP config. | **`add`** asks for each part when run without flags. |
|  |  |
| **`review`** goes through proposed fixes: approve, reject, skip. | **`stats`** shows the most-used fixes and what had no answer. |
## An entry
Each fix is one Markdown file, `.dejafix/<id>.md`. Edit it by hand, review it in a pull request, or use the dashboard.
```markdown
---
id: port-already-in-use
title: Port already in use
status: approved
symptoms:
- "EADDRINUSE: address already in use"
- "/Port \\d+ is (already )?in use/i"
tags:
- tool:node
found_by: agent:claude-code
created: 2026-12-04T10:37:24.455Z
last_used: 2026-12-05T08:12:03.120Z
use_count: 7
---
## Cause
A dev server from an earlier session is still running and holds the port.
## Fix
Find and stop the process that holds the port:
- macOS / Linux: `lsof -ti tcp:3000 | xargs kill`
- Windows (PowerShell): `Stop-Process -Id (Get-NetTCPConnection -LocalPort 3000).OwningProcess`
Or start on another port: `PORT=3001 npm run dev`.
## Notes
Happens most after a session was stopped mid-run.
```
- **symptoms**: error text as it appears, or a `/regex/flags` pattern. Paths, ports, timestamps and ids are ignored when matching, so `:::3000` and `127.0.0.1:5173` both match.
- **tags**: free words; by convention `os:windows`, `tool:npm`, `service:postgres`.
- **status**: `proposed` (waiting for review), `approved` (returned by lookup) or `retired` (kept for history).
- **found_by**: `agent:<name>` or `person:<name>`. **use_count** and **last_used** are kept up to date by `record_use`.
- Usage logs live in `.dejafix/log/`, which git ignores.
The project runbook is `.dejafix/` at the root of your repo. The optional global runbook, `~/.dejafix` (or `$DEJAFIX_HOME`), holds fixes for your machine that every project shares. Lookups search both.
## Safety
- **Redaction before every save**, from an agent, the dashboard or the CLI: private keys, cloud and API keys (AWS, GitHub, GitLab, Slack, Stripe, OpenAI, Anthropic, Google, npm), JWTs, `Bearer`/`Basic` credentials, `password=`/`token:`/`api_key` assignments, credentials in connection strings (the host is kept) and email addresses. Anything that still looks like a secret makes it refuse to save, and say where.
- **Duplicates** are caught on save: you get the similar fixes and can merge, or save anyway.
- **Local only**: the dashboard binds `127.0.0.1`, checks the Host header, and accepts changes only from its own page (a per-run token). No telemetry and no network calls.
## Docs
- [Getting started](https://github.com/racstan/dejafix/blob/main/docs/getting-started.md)
- [The dashboard](https://github.com/racstan/dejafix/blob/main/docs/dashboard.md)
- [The CLI](https://github.com/racstan/dejafix/blob/main/docs/cli.md)
- [MCP tools](https://github.com/racstan/dejafix/blob/main/docs/tools.md)
- [Entry format](https://github.com/racstan/dejafix/blob/main/docs/entry-format.md)
- [Architecture](https://github.com/racstan/dejafix/blob/main/docs/architecture.md)
## Contributing
Bug reports, ideas and pull requests are welcome: see [CONTRIBUTING.md](https://github.com/racstan/dejafix/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/racstan/dejafix/blob/main/CODE_OF_CONDUCT.md). Report security problems privately, as [SECURITY.md](https://github.com/racstan/dejafix/blob/main/SECURITY.md) explains. What changed in each release is in the [changelog](https://github.com/racstan/dejafix/blob/main/CHANGELOG.md).
## Later
- Import from and export to [Progressor](https://github.com/racstan/progressor-mcp), so a Progressor project can show its dejafix entries.
- Share a global runbook across a team through a git repo.
## License
Copyright (C) 2026 Rachit Asthana
dejafix is licensed under the [PolyForm Noncommercial License 1.0.0](https://github.com/racstan/dejafix/blob/main/LICENSE.md).
- **Free, no need to ask:** personal use with no commercial application (your own projects, study, research, hobbies), and use by charities, schools, public research bodies and government institutions. You may use, change and share it for these.
- **Needs a commercial license from the author:** any other use. That includes using it in or for a company, for paid client work, and selling it, hosting it for others, or building a product or service on it, changed or not. A commercial license may come with a fee, which we work out together when you ask. **[Ask for a commercial license](https://github.com/racstan/dejafix/issues/new?template=commercial_license.yml).**
Without that license, commercial use is not allowed. See [LICENSE.md](https://github.com/racstan/dejafix/blob/main/LICENSE.md) for the full terms.
If dejafix saves you time, you can [buy me a coffee](https://buymeacoffee.com/rachitasthana).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues