smart-fork
Smart Fork Detection - MCP server for Claude Code that enables semantic search of past session transcripts and intelligent session forking. Find and resume relevant conversations instantly with AI-powered search, clustering, and session management.
claude mcp add --transport stdio recursive-vibe-smart-fork python -m smart_fork.server \ --env PYTHONPATH="/path/to/smart-fork/src"
How to use
Smart Fork is an MCP server for Claude Code that maintains a searchable vector index of your past Claude Code sessions and enables smart session forking. It exposes a fork-detect tool that Claude Code can invoke to semantically search your session history and surface the most relevant previous conversations to resume work with full context. With this server running, you can describe your task in Claude Code and rely on the system to locate and fork from the most relevant prior session, helping you overcome context limits and accelerate re-use of prior work.
During use, you’ll interact with the fork-detect capability through Claude Code. The tool performs semantic search across your session history, returns a curated list of top matches, and enables you to fork from one of those sessions. You can then copy the generated command and run it locally to continue from that session with preserved context. The server also supports features like background indexing, project-scoped search, and fork history tracking to streamline your workflow.
How to install
Prerequisites:
- Python 3.10 or higher
- Claude Code with MCP support
- Virtual environment support (recommended)
- Git for cloning the repository
Install from Source:
- Clone the repository:
git clone https://github.com/recursive-vibe/smart-fork.git
cd smart-fork
- Create and activate a virtual environment:
python -m venv venv
# macOS/Linux
source venv/bin/activate
# Windows
venv\Scripts\activate
- Install in editable mode:
pip install -e .
- Verify installation (optional):
python -c "import smart_fork; print(smart_fork.__version__)"
- Configure Claude Code MCP:
- Edit your Claude Code MCP configuration file (e.g., ~/.claude/mcp_servers.json) to add the Smart Fork server with the appropriate command and environment. Example provided in the project README:
{
"mcpServers": {
"smart-fork": {
"command": "/path/to/smart-fork/venv/bin/python",
"args": ["-m", "smart_fork.server"],
"cwd": "/path/to/smart-fork/src",
"env": {
"PYTHONPATH": "/path/to/smart-fork/src"
}
}
}
}
- Restart Claude Code (or reload the MCP configuration) to load the MCP server.
Additional notes
Tips and notes:
- The server relies on a vector database for indexing sessions; ensure you have enough RAM for indexing large session histories.
- If you’re running from source, keep the virtual environment activated when starting Claude Code so the MCP server is available.
- Environment variables such as PYTHONPATH may need to be adjusted to point to your local source tree (replace /path/to/smart-fork with your actual path).
- The initial indexing may take time depending on the number of existing sessions. Use the recommended batch-mode option for large datasets if provided by the tool.
- If you encounter timeouts processing large sessions, consider adjusting timeout handling in your configuration (not shown in this README) and ensure sessions with parseable messages are prioritized.
- The MCP tooling is designed to work with Claude Code and VS Code integration (beta); you can also use the provided CLI tool to perform manual searches and forks.
Related MCP Servers
chunkhound
Local first codebase intelligence
readwise-vector-db
Turn your Readwise library into a blazing-fast, self-hosted semantic search engine – complete with nightly syncs, vector search API, Prometheus metrics, and a streaming MCP server for LLM clients.
GraphMemory-IDE
AI-assisted development MCP providing long-term, on-device "AI memory" for IDEs. Powered by Kuzu GraphDB and exposed via MCP server
Youtube
YouTube MCP Server is an AI-powered solution designed to revolutionize your YouTube experience. It empowers users to search for YouTube videos, retrieve detailed transcripts, and perform semantic searches over video content—all without relying on the official API. By integrating with a vector database, this server streamlines content discovery.
voice-status-report
A Model Context Protocol (MCP) server that provides voice status updates using OpenAI's text-to-speech API.
mcp-streamable-http
mcp-streamable-http-server provides a comprehensive development template for building StreamableHttp services with flexible authentication, dynamic service registration, customizable middleware, and easy tool configuration via YAML.