rewind-mcp
Enables developers to recover their working context after interruptions by analyzing git state, file activity, editor state, and shell history.
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_ion your current project - "Take a snapshot before my meeting" — triggers
take_snapshot - "What did I do this morning?" — triggers
recent_activitywith 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:
-
Git Collector — Shells out to
gitto 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.
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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。