Sidekick: Your AI Assistant Should Be a Sidekick, Not the Pilot
Ever had Claude Code overwrite your unsaved work mid-refactor?
Sidekick keeps you in control while AI assists. No plugins. No deep integrations. Just clean boundaries between you and your AI tools.
Skip to 1:20 to see the real power
The Problem
You're 30 minutes into a complex refactor. Multiple files open. Unsaved changes everywhere.
You ask Claude Code to "add error handling to utils.py"
Claude Code obliterates your unsaved work.
Your changes are gone. Sound familiar?
Sidekick prevents this. Every. Single. Time.
What It Does
- Neovim Protection: Prevents Claude Code from modifying files you're actively editing in Neovim with unsaved changes
- Smart Neovim Launcher: Opens Neovim instances with per-directory socket paths for seamless integration
Sidekick acts as a safety layer, blocking Claude Code's file modifications when they would overwrite your unsaved work.
Installation
One-Line Install (Automatic Setup)
|
This script will:
- ✓ Check dependencies (Rust, Python)
- ✓ Install Sidekick
- ✓ Configure Claude Code hooks
- ✓ Add shell alias automatically
Quick Install
Don't have Rust? Install it first:
|
Alternative: Install from source
Manual Setup
Note: If you used the one-line installer above, you can skip this section!
1. Shell Alias (Recommended)
Add this to your shell configuration (~/.bashrc, ~/.zshrc, etc.):
Now every time you run nvim, you'll automatically get the Claude Code integration without thinking about it.
2. Configure Claude Code Hooks
Add to your Claude Code configuration (~/.claude/settings.json or .claude/settings.json):
That's it! Now when Claude Code attempts to edit a file:
- Allowed: File not open in Neovim, or open in background buffer
- Allowed: File open but no unsaved changes
- Blocked: File is in current buffer with unsaved changes
- Auto-refresh: Neovim buffers are automatically reloaded after Claude Code modifies files
Usage
Just use Neovim like you always do:
That's it. Seriously.
Because of the shell alias, nvim now launches with Sidekick integration automatically. You won't notice anything different—until Claude Code tries to overwrite your unsaved work, and Sidekick quietly blocks it. Work the way you want. Sidekick stays out of your way.
How It Works
-
Socket Path: Both the
neovimlauncher andhookhandler compute the same socket path usingblake3(cwd), ensuring they connect to the same Neovim instance -
Hook Interception: When Claude Code calls Edit/Write tools, Sidekick intercepts the call via stdin/stdout JSON protocol
-
Buffer Check: Connects to Neovim via RPC to check if the target file:
- Is the current buffer (visible to user)
- Has unsaved changes (
modifiedflag)
-
Decision: Returns
AlloworDenypermission to Claude Code, with a message displayed in Neovim when blocked
Requirements
- Rust 2024 edition
- Neovim with RPC support
- Unix-like system (uses Unix sockets)
Example Workflow
# Terminal 1: Launch Neovim with integration
# Make some edits in Neovim, don't save yet
# Terminal 2: Use Claude Code in the same directory
# Result: Claude Code is blocked from modifying main.rs
# You see a message in Neovim: "Claude Code blocked: File src/main.rs has unsaved changes"
# Save your changes, then Claude Code can proceed
Built with Love For
Neovim Community
For creating the most extensible, keyboard-driven editor that makes coding feel like a superpower. Your commitment to backwards compatibility, clean architecture, and RPC-first design made this integration possible.
Claude Code Community
For pushing the boundaries of AI-assisted development with a tool that actually understands context and respects developer workflows. The hook system is a brilliant design choice that enables tools like this to exist.
This project exists because both communities care deeply about craft, extensibility, and putting developers first.
Contributing
Issues and pull requests welcome! If you're using this with other editors (Emacs, VS Code with Neovim plugin, Helix), contributions to support them would be amazing.