rewind-mcp

rewind-mcp

Enables developers to recover their working context after interruptions by analyzing git state, file activity, editor state, and shell history.

Category
Visit Server

README

Rewind - Context Switching Recovery Agent

Rewind — an MCP server that reconstructs your working context after interruptions aka Context Switch.

Developers get interrupted constantly. Meetings, Slack messages, code reviews, lunch breaks. Every time you come back, you spend 10-20 minutes reloading your mental state: "What was I doing? Which files were open? What's left to finish?"

Rewind solves this. It's an MCP server that analyzes your git state, recently modified files, editor state, and shell history. When you return and ask "where was I?", it reconstructs your exact working context — what you were editing, what problem you were solving, and what you need to do next.

Tools

Tool Description
where_was_i The main recovery tool. Analyzes your project and generates a full context recovery report with what you were working on, what's in progress, and suggested next steps.
take_snapshot Saves a point-in-time snapshot of your working context. Use before stepping away so where_was_i can compare states.
recent_activity Shows a chronological timeline of recent commits, file changes, and shell commands.
get_context_status Shows tracked directories, snapshot counts, and storage info.
diff_snapshots Compares a previous snapshot against current state to show exactly what changed.

What It Collects

Git State — current branch, uncommitted changes (staged/unstaged), recent commits, stashes, merge/rebase/cherry-pick state, diff summary.

File Activity — recently modified files with timestamps, file sizes, and detected languages. Respects configurable include/exclude patterns.

Editor State — detects VS Code, Cursor, JetBrains IDEs, and Vim. Reads workspace metadata to find open projects and files.

Shell History — parses zsh, bash, and fish history. Filters noise commands (ls, cd, etc.) and deduplicates.

Setup

Install from npm

npm install -g rewind-mcp

With Claude Code

claude mcp add rewind -- npx rewind-mcp

Or if installed globally:

claude mcp add rewind -- rewind-mcp

With Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "rewind": {
      "command": "npx",
      "args": ["rewind-mcp"]
    }
  }
}

Build from Source

git clone <repo-url>
cd context-switch
npm install
npm run build

Then add locally:

claude mcp add rewind node /absolute/path/to/dist/index.js

Usage

Once configured, just ask Claude:

  • "Where was I?" — triggers where_was_i on your current project
  • "Take a snapshot before my meeting" — triggers take_snapshot
  • "What did I do this morning?" — triggers recent_activity with appropriate time range
  • "What changed since my last snapshot?" — triggers diff_snapshots

Example Recovery Report

# Context Recovery Report

You've been away for 2 hours, 15m. You were working on: Feature: user authentication.
Branch: `feat/user-auth`. 3 uncommitted changes.

## What You Were Working On

● **Feature: user authentication** (high confidence)
  - On branch `feat/user-auth`
● **Latest commit: "add JWT token validation middleware"** (high confidence)
  - Commit `a1b2c3d`: add JWT token validation middleware (4 files)

## In Progress

🔴 2 files staged, 1 unstaged — mid-commit
   - `src/middleware/auth.ts`
   - `src/routes/login.ts`
   - `tests/auth.test.ts`
🟡 3 uncommitted changes
⚪ On feature branch `feat/user-auth`

## Suggested Next Steps

1. **Review staged changes and complete the commit**
   _You have a partially staged commit — you were likely mid-commit when interrupted_
2. **Run tests — you were recently editing test files**
   _Modified: tests/auth.test.ts_
3. **Continue: Feature: user authentication**
   _Active feature branch `feat/user-auth`_

## Recent Activity Timeline

📝 `02:15 PM` [a1b2c3d] add JWT token validation middleware (4 files)
📄 `02:30 PM` src/middleware/auth.ts (TypeScript)
📄 `02:28 PM` tests/auth.test.ts (TypeScript)
📝 `01:45 PM` [d4e5f6g] scaffold auth module structure (6 files)
⌨️ `02:25 PM` npm test -- --watch

How It Works

Signal Collection

All four collectors run in parallel for speed. Each collects an independent slice of context:

  1. Git Collector — Shells out to git to read branch, status (porcelain format), log, stash list, and detects merge/rebase/cherry-pick state by inspecting .git/ internals.

  2. File Collector — Walks the project directory tree, respects configurable include/exclude patterns, and finds files modified within the configured time window (default: 2 hours).

  3. Editor Collector — Reads VS Code/Cursor workspace storage metadata, JetBrains .idea/workspace.xml, and checks for Vim swap files. Also checks running processes.

  4. Shell Collector — Parses ~/.zsh_history, ~/.bash_history, or fish history. Handles timestamped formats (zsh extended history) and filters noise.

Recovery Engine

The recovery engine synthesizes collected signals into a structured report:

  • Branch name parsing — Extracts work context from feat/, fix/, ticket patterns (PROJ-123), and camelCase/kebab-case branch names.
  • Commit theme detection — Groups recent commits by conventional commit prefix to identify dominant work type.
  • In-progress detection — Identifies partial staging (interrupted commit), merge conflicts, stashed work, and feature branches.
  • Next step suggestion — Prioritizes by urgency: merge conflicts > partial commits > uncommitted changes > branch work > stash reminders.

Snapshot Comparison

When take_snapshot is used before an interruption, where_was_i compares the previous snapshot with current state to show:

  • How long you were away
  • New commits since the snapshot
  • Files that changed or were resolved
  • Stash changes

Configuration

Configuration is stored at ~/.rewind/config.json. Defaults work out of the box:

{
  "snapshotIntervalMs": 300000,
  "maxSnapshots": 200,
  "retentionHours": 72,
  "recentFileMinutes": 120,
  "gitCommitDepth": 15,
  "shellHistoryLines": 30,
  "filePatterns": {
    "include": ["**/*.ts", "**/*.js", "**/*.py", "..."],
    "exclude": ["**/node_modules/**", "**/dist/**", "..."]
  }
}

Architecture

src/
├── index.ts                # Entry point — starts MCP server over stdio
├── server.ts               # MCP server with tool definitions
├── types.ts                # TypeScript type definitions
├── config/
│   └── index.ts            # Configuration management + app paths
├── collectors/
│   ├── index.ts            # Orchestrator — runs all collectors in parallel
│   ├── git.ts              # Git state collector
│   ├── files.ts            # File activity collector
│   ├── editor.ts           # Editor state collector
│   └── shell.ts            # Shell history collector
├── recovery/
│   └── engine.ts           # Recovery engine + report formatter
└── storage/
    └── store.ts            # Snapshot persistence + retention

Privacy

All data stays local. Snapshots are stored in ~/.rewind/snapshots/ and never leave your machine. No network calls, no telemetry, no cloud storage.

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured