Skip to main content
Glama
README.md
# VibeDoctor 🩺 v2.0

**Your Claude Code CLI Development Companion** - An MCP server that intelligently reverts [Claude Code CLI](https://www.anthropic.com/claude-code) changes by analyzing conversation JSONL files. Automatically finds active sessions and reverts file modifications using structured patch data.

## ✨ Features

- 🎯 **Auto Session Detection**: Automatically finds your active Claude Code session by analyzing your message
- πŸ”„ **Smart Revert Logic**: Intelligently reverts both additions and deletions
- πŸ“ **Session Integration**: Works directly with your Claude Code CLI sessions
- 🏷️ **Sequential Operations**: Handles multiple revert commands with perfect state tracking  
- πŸ”’ **Flexible Count**: Revert last 1, 2, 3... up to 10 changes in one command
- πŸ“ **Correct Working Directory**: Uses the exact working directory from your Claude Code session
- πŸ”’ **Precise Reverts**: Accurately identifies and reverts specific changes
- ⚑ **Claude Code CLI Integration**: Works exclusively with Claude Code CLI sessions

## πŸš€ Installation

### Via npm (Recommended)
```bash
npm install -g vibedoctor
```

### Manual Installation
```bash
git clone https://github.com/pathakmukul/vibe-doctor.git
cd vibe-doctor
npm install
npm link
```

## βš™οΈ Setup

### 1. Add to Claude Code CLI
Add VibeDoctor to your Claude Code CLI using the built-in MCP management:

```bash
claude mcp add-json "vibedoctor" '{"command":"vibedoctor","args":[]}'
```

### 2. Alternative: Manual Configuration
If you prefer manual configuration, you can also add it to other MCP-compatible clients:

```json
{
  "mcpServers": {
    "vibedoctor": {
      "command": "vibedoctor",
      "args": []
    }
  }
}
```

## 🎯 Usage

### Natural Language Commands (Recommended)
```
revert last 2 changes
undo the last 3 operations  
revert last change
fix my last mistake
undo that last update
revert the most recent 4 changes
```

### Explicit VibeDoctor Calls
```
use VibeDoctor to revert last 2
VibeDoctor revert 3 operations
vibedoctor undo last change
call VibeDoctor to fix last 5 changes
run VibeDoctor revert last operation
use vibedoctor to undo last 3 updates
```

## πŸ”§ How It Works

VibeDoctor intelligently analyzes your Claude Code CLI session to identify and revert recent changes. Simply ask it to revert your last changes, and it handles the rest automatically.

## πŸ“‹ Supported Operations

- βœ… **Pure Additions** (only `+` lines) β†’ Deletes added content
- βœ… **Pure Deletions** (only `-` lines) β†’ Restores removed content  
- βœ… **Mixed Changes** (both `+` and `-`) β†’ Deletes additions AND restores deletions
- βœ… **Sequential Reverts** β†’ "revert 2 more" works correctly with state tracking

## 🎨 Example Workflow

```bash
# 1. Install VibeDoctor in Claude Code CLI
$ claude mcp add-json "vibedoctor" '{"command":"vibedoctor","args":[]}'

# 2. Make changes with Claude Code CLI
> add emoji to each section @index.html

# 3. Claude Code makes changes
⏺ Update(index.html) - adds emojis

# 4. Revert if needed
> revert last change

# 5. Works! Emojis are removed
βœ… Successfully reverted last 1 changes. [VIBEDOCTOR CHANGES: 1]
Session: d9e3caf1-0ca2-490d-b914-012e952193fe
Working Directory: /Users/username/projects/myproject
```

## πŸ” Advanced Features

### State Tracking
VibeDoctor automatically tracks what's been reverted:
```
> revert last 2      # Reverts operations 1-2
> revert 2 more      # Reverts operations 3-4 (not 1-2 again!)
```

### Conversation History Integration
Seamlessly integrates with your session history for accurate tracking.

## πŸ› Troubleshooting

### "Could not find Claude Code session"
- Make sure you're running this from the same Claude Code CLI session where you made changes
- Verify your message contains the keywords you're trying to revert

### "No changes found to revert"
- Ensure Claude Code CLI has made file modifications in this session
- Verify you haven't already reverted all available changes

### "File not found" 
- The working directory from Claude Code CLI session may differ from current directory
- Files may have been moved or deleted since the changes were made

### "Line out of range"
- Files may have been modified outside Claude Code CLI between changes and revert
- Manual review may be needed for complex changes

## πŸ—οΈ Technical Details

- **Platform**: Node.js 18+ 
- **Protocol**: Model Context Protocol (MCP)
- **Dependencies**: `@modelcontextprotocol/sdk`
- **Processing**: Pure JavaScript with shell command integration

## πŸ“„ License

MIT License - See [LICENSE](LICENSE) file for details.

## 🀝 Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes  
4. Add tests if applicable
5. Submit a pull request

## πŸ“ Note

VibeDoctor is designed specifically for Claude Code CLI and will not work with other Claude interfaces (web, desktop app, etc.).

## πŸ™‹ Support

- **GitHub Issues**: [Report bugs or request features](https://github.com/pathakmukul/vibe-doctor/issues)
- **GitHub Discussions**: [Ask questions or share tips](https://github.com/pathakmukul/vibe-doctor/discussions)

---

**VibeDoctor** - *Keeping your code healthy, one revert at a time* 🩺✨ 

TDQS

B3.4/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool exposed, there is no possibility of confusion or misselection. The single tool's purposeβ€”reverting the last N changes from a Claude Code sessionβ€”is clearly stated and unmistakable.

Naming Consistency5/5

The lone tool follows a clean snake_case verb_noun convention (revert_last_changes). There is no competing convention to create inconsistency, and the name is descriptive and predictable.

Tool Count3/5

A single tool is thin for the apparent domain; there is no way to list revertable changes, preview a revert, or redo. The narrow scope (undo recent edits) makes one tool defensible, but the surface feels minimal rather than well-scoped.

Completeness2/5

The tool can only perform a blind revert of the last N changes; there is no dry-run/preview, no listing of what is revertable, no redo, and no session-selection option. These are significant gaps that could cause an agent to revert the wrong changes with no way to inspect state first.

Maintenance

ActivityInactive
ResponsivenessNo recent community issues