ThoughtDAG — Claude Code MCP server: what it does, how to install
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.
claude mcp add thoughtdag -- npx -y thoughtdagWhat ThoughtDAG 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.
What it helps with
- 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 for the agent
- 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
How to install ThoughtDAG
Platform CLI
claude mcp add thoughtdag -- npx -y thoughtdagPlatform CLI
codex mcp add cli -- npx -y thoughtdagConfig file
{
"mcpServers": {
"cli": {
"command": "npx",
"args": [
"-y",
"thoughtdag"
]
}
}
}Config file
{
"servers": {
"cli": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"thoughtdag"
]
}
}
}Platform CLI
gemini mcp add cli npx -y thoughtdagStep by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about ThoughtDAG
How to install ThoughtDAG in Claude Code?
Run claude mcp add thoughtdag -- npx -y thoughtdag in your terminal. The host environment must have Node.js 20 or newer installed.
What does ThoughtDAG do?
It indexes local agent session transcripts by the files they touched. The server provides tools to find past turns, review edits, and inspect user prompts.
Can ThoughtDAG modify existing conversation files?
No, all four provided tools are read-only. ThoughtDAG never edits original logs and keeps its internal cache inside ~/.thoughtdag.