# ThoughtDAG

Searches local AI conversation logs by file path or phrase to recall past turns. Helpful when you need to know why an agent changed a specific file.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 693
- Author: chenxiachan
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/chenxiachan/thoughtdag/tree/HEAD/cli
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/mcp/thoughtdag

## What it does

The server indexes local agent sessions from Claude Code, Codex, DeepSeek Harness, and Pi. It tracks which files were read, edited, or created during each turn. Instead of guessing from unstructured text, it pulls facts directly from recorded tool calls.

All four MCP tools operate strictly in read-only mode: `why_check`, `why_file`, `find`, and `recall_turn`. ThoughtDAG leaves source session files untouched and writes its search cache to `~/.thoughtdag`. Running it requires Node.js 20 or newer. A cloud instance cannot read local session logs on your laptop, so run the stdio server directly inside the target repository.

## Requirements
- Needs: Node.js (commands run via npx)

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add thoughtdag -- npx -y thoughtdag
```

### Codex

**Platform CLI**
```bash
codex mcp add cli -- npx -y thoughtdag
```

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "cli": {
            "command": "npx",
            "args": [
                "-y",
                "thoughtdag"
            ]
        }
    }
}
```

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "cli": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "thoughtdag"
            ]
        }
    }
}
```

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add cli npx -y thoughtdag
```

## When to use it
- find previous AI chat turns that edited a specific file
- check conversation history before modifying existing code
- locate exact phrases across past assistant discussions
- inspect tool call inputs and explanations for earlier edits

## Example prompts
- Run why_file on src/lib/api.ts to see which assistant turns modified it
- Check if there is session history for package.json using why_check
- Search past turns for "database connection pool" with the find tool

## Similar
- [REA](https://affpapa.org/en/nevibecode/mcp/rea.md) — MCP server · ★ 386989
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33918
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81115
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119160
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47392
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43872

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
