loading…
Search for a command to run...
loading…
Enables developers to recover their working context after interruptions by analyzing git state, file activity, editor state, and shell history.
Enables developers to recover their working context after interruptions by analyzing git state, file activity, editor state, and shell history.
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.
| 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. |
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.
npm install -g rewind-mcp
claude mcp add rewind -- npx rewind-mcp
Or if installed globally:
claude mcp add rewind -- rewind-mcp
Add to your claude_desktop_config.json:
{
"mcpServers": {
"rewind": {
"command": "npx",
"args": ["rewind-mcp"]
}
}
}
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
Once configured, just ask Claude:
where_was_i on your current projecttake_snapshotrecent_activity with appropriate time rangediff_snapshots# 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
All four collectors run in parallel for speed. Each collects an independent slice of context:
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.
File Collector — Walks the project directory tree, respects configurable include/exclude patterns, and finds files modified within the configured time window (default: 2 hours).
Editor Collector — Reads VS Code/Cursor workspace storage metadata, JetBrains .idea/workspace.xml, and checks for Vim swap files. Also checks running processes.
Shell Collector — Parses ~/.zsh_history, ~/.bash_history, or fish history. Handles timestamped formats (zsh extended history) and filters noise.
The recovery engine synthesizes collected signals into a structured report:
feat/, fix/, ticket patterns (PROJ-123), and camelCase/kebab-case branch names.When take_snapshot is used before an interruption, where_was_i compares the previous snapshot with current state to show:
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/**", "..."]
}
}
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
All data stays local. Snapshots are stored in ~/.rewind/snapshots/ and never leave your machine. No network calls, no telemetry, no cloud storage.
MIT
Run in your terminal:
claude mcp add rewind-mcp -- npx Security
Low riskAutomated heuristic from public metadata — not a security guarantee.