{"slug": "sidekick-keep-using-neovim-while-a-dozen-agents-rewrite-your-code", "title": "Sidekick: keep using neovim while a dozen agents rewrite your code", "summary": "Sidekick, a new open-source tool, acts as a conduit between Neovim and AI coding agents like Claude Code and Codex, blocking edits to files with unsaved changes to prevent data loss. The tool also auto-refreshes Neovim buffers when AI agents modify open files and can inject visual selections from Neovim into AI prompts. Sidekick aims to protect developers' flow states by ensuring AI agents wait while they are actively editing, without requiring confirmation prompts or policy files.", "body_md": "**Protects your unsaved Neovim work from Claude Code, Codex, opencode, pi, and Crush.**\n\n*A conduit between Neovim and your AI agents — so they wait when you're typing.*\n\n*Skip to 1:20 to see a block. The same recording is bundled in the binary — run sidekick demo after install to play it back offline.*\n\nI do less and less coding by hand. The part I still do, I do very deliberately — pop open a new pane, open Neovim, start editing. It's a flow state I have to push myself into. The catch: Neovim is the only thing in the system that knows I'm typing. When the agent in the next pane decides the file I'm in needs editing, the buffer reloads, my work gone. So I decided to do something about it.\n\n**Sidekick is the conduit between the editor and the agents.** When you have unsaved changes in a buffer, the agents wait — the edit is denied, your buffer is untouched. Save the file and the next attempt proceeds. No flags, no confirmation prompts, no policy file. The 99% of edits that don't conflict with you go through untouched.\n\nThe other direction works too: when the AI modifies a file you have open, Sidekick refreshes the buffer in every Neovim instance, cursor position preserved.\n\n- The AI waits on a file while you're editing it. You'll see this in Neovim:\n`Edit blocked — file has unsaved changes`\n\n. - A file the AI edits while you have it open is auto-reloaded — no\n`:e!`\n\ndance. - A current or recent visual selection in Neovim can be added to your next Claude Code, Codex, opencode, or pi prompt as context. Select code, type the prompt, hit enter.\n\nEverything else stays the same. You keep using `nvim`\n\nlike normal.\n\nThe one-liner installs the binary with Cargo, registers Claude Code edit/refresh hooks, and adds the shell alias. Pipe through `less`\n\nfirst if you want to read it.\n\n```\ncurl -sSL https://raw.githubusercontent.com/NishantJoshi00/sidekick/main/scripts/install.sh | bash\n```\n\nThen restart your shell, or source the rc file the installer updated, and verify with `sidekick doctor`\n\n:\n\n```\n  sidekick doctor\n\n  ✓ sidekick v0.6.0 on PATH\n      ~/.cargo/bin/sidekick\n  ✓ NVIM v0.10.0 on PATH\n  · AI harnesses: Claude Code, Codex\n  ✓ Claude Code hook registered\n  ✓ Codex plugin installed\n  ✓ nvim alias: nvim → sidekick neovim (zsh)\n  · no Neovim opened here\n  · last activity: never\n```\n\nIf a row fails, `sidekick doctor --fix`\n\noffers consent-gated repairs for the Claude Code hook, Codex plugin, opencode plugin, pi extension, and `nvim`\n\nalias. It shows the diff before writing anything.\n\nThe installer covers protection and buffer refresh for Claude Code. For Claude Code prompt-context injection, install the Claude Code plugin or add the `UserPromptSubmit`\n\nhook shown below.\n\nFor Codex, run `sidekick init`\n\nor `sidekick doctor --fix`\n\nafter installing the binary. Sidekick installs the Codex plugin into your personal Codex marketplace, enables `plugin_hooks`\n\n, and enables `sidekick@personal`\n\n.\n\n**Manual install (cargo + Claude Code plugin)**\n\n```\n# 1. Install the binary\ncargo install sidekick\n\n# 2. Inside Claude Code, register the hooks bundled in this repo\n/plugin marketplace add NishantJoshi00/claude-plugins\n/plugin install sidekick@nishant-plugins\n\n# 3. Add the shell alias to ~/.zshrc or ~/.bashrc\nalias nvim='sidekick neovim'\n```\n\nDon't have Rust? `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`\n\n.\n\n**Manual Claude Code hook configuration (no plugin)**\n\nAdd to `~/.claude/settings.json`\n\n:\n\n```\n{\n  \"hooks\": {\n    \"PreToolUse\": [\n      { \"matcher\": \"MultiEdit|Edit|Write\", \"hooks\": [{ \"type\": \"command\", \"command\": \"sidekick hook\" }] }\n    ],\n    \"PostToolUse\": [\n      { \"matcher\": \"MultiEdit|Edit|Write\", \"hooks\": [{ \"type\": \"command\", \"command\": \"sidekick hook\" }] }\n    ],\n    \"UserPromptSubmit\": [\n      { \"matcher\": \"\", \"hooks\": [{ \"type\": \"command\", \"command\": \"sidekick hook\" }] }\n    ]\n  }\n}\n```\n\nThe `UserPromptSubmit`\n\nentry is optional. It is the one that adds your Neovim visual selection to Claude's prompt context.\n\n`sidekick doctor`\n\nprints this matrix per harness; here it is in one place. A\n`✓`\n\nis a feature sidekick exercises fully through that harness's hook\nsurface; a `—`\n\nis an upstream gap (the harness doesn't expose the hook event\nsidekick would need).\n\n| Harness | Edit deny | Buffer refresh | Selection injection |\n|---|---|---|---|\n| Claude Code | ✓ | ✓ | ✓ |\n| Codex | ✓ | ✓ | ✓ |\n| opencode | ✓ | ✓ | ✓ |\n| pi | ✓ | ✓ | ✓ |\n| Crush | ✓ | — | — |\n\n**Use with Codex**\n\nCodex uses plugin-bundled hooks. After installing the `sidekick`\n\nbinary, let Sidekick wire the plugin and config:\n\n```\nsidekick init\n```\n\nor:\n\n```\nsidekick doctor --fix\n```\n\nThe repair writes the plugin to `~/plugins/sidekick`\n\n, registers it in `~/.agents/plugins/marketplace.json`\n\n, enables `[features].plugin_hooks = true`\n\n, and enables `[plugins.\"sidekick@personal\"].enabled = true`\n\nin `~/.codex/config.toml`\n\n.\n\nCodex may ask you to review and trust the new hook before it runs. Run `sidekick doctor`\n\nto confirm. See [ plugins/codex/](/NishantJoshi00/sidekick/blob/main/plugins/codex) for details.\n\n**Use with opencode**\n\nopencode uses a plugin system instead of CLI hooks. After installing the `sidekick`\n\nbinary, drop the plugin into your global opencode config:\n\n```\nmkdir -p ~/.config/opencode/plugin\ncurl -sSL https://raw.githubusercontent.com/NishantJoshi00/sidekick/main/plugins/opencode/sidekick.ts \\\n  -o ~/.config/opencode/plugin/sidekick.ts\n```\n\nopencode loads it at startup. If `sidekick`\n\nis not on `PATH`\n\n, the plugin no-ops rather than blocking opencode.\n\nFor a per-project install, use `<project>/.opencode/plugin/sidekick.ts`\n\n. Run `sidekick doctor`\n\nto confirm. See [ plugins/opencode/](/NishantJoshi00/sidekick/blob/main/plugins/opencode) for details.\n\n**Use with pi**\n\npi uses a TypeScript extension system instead of CLI hooks. After installing the `sidekick`\n\nbinary, drop the extension into your global pi config:\n\n```\nmkdir -p ~/.pi/agent/extensions\ncurl -sSL https://raw.githubusercontent.com/NishantJoshi00/sidekick/main/plugins/pi/sidekick.ts \\\n  -o ~/.pi/agent/extensions/sidekick.ts\n```\n\npi loads it at startup. If `sidekick`\n\nis not on `PATH`\n\n, the extension no-ops rather than blocking pi.\n\nFor a per-project install, use `<project>/.pi/extensions/sidekick.ts`\n\n. Run `sidekick doctor`\n\nto confirm. See [ plugins/pi/](/NishantJoshi00/sidekick/blob/main/plugins/pi) for details.\n\n**Use with Crush**\n\nCrush registers hooks directly in `crush.json`\n\n— no plugin file to bundle. After installing the `sidekick`\n\nbinary, let Sidekick merge the hook into your global Crush config:\n\n```\nsidekick init\n```\n\nor:\n\n```\nsidekick doctor --fix\n```\n\nThe repair merges a `PreToolUse`\n\nhook against `^(edit|write|multiedit)$`\n\ninto `~/.config/crush/crush.json`\n\n, preserving every other key.\n\nCrush only emits `PreToolUse`\n\n, so the buffer-protect path is covered but two pieces of the sidekick contract are intentionally absent: there is no post-edit buffer refresh, and no visual-selection injection on prompt submit. Both are upstream limitations, not sidekick configuration.\n\nRun `sidekick doctor`\n\nto confirm. See [ plugins/crush/](/NishantJoshi00/sidekick/blob/main/plugins/crush) for details.\n\nJust use `nvim`\n\n. The shell alias routes through sidekick so the hook can find your editor.\n\n```\nnvim src/main.rs\n```\n\nIf you do not want the alias, run `sidekick neovim <args>`\n\ndirectly. You won't notice anything different until Claude Code, Codex, opencode, or pi tries to overwrite unsaved work, at which point sidekick denies the edit and tells the agent why.\n\n| Command | What it does |\n|---|---|\n`sidekick neovim <args>` |\nLaunches Neovim with a per-directory socket the hook can find. Aliased as `nvim` . |\n`sidekick hook` |\nReads hook JSON on stdin and decides allow/deny, refreshes buffers, and returns visual-selection context. You don't run this directly — Claude Code and Codex do, and the opencode/pi bridges pipe to it. |\n`sidekick doctor [--fix] [--no-color]` |\nChecks your install: binary on PATH, nvim on PATH, AI harnesses present, hooks/plugins registered, alias active, sockets open in this directory, last hook decision. `--fix` offers consent-gated repairs where possible. |\n`sidekick demo` |\nPlays the demo cast inline in a ratatui frame. Useful for showing a coworker. |\n`sidekick stats [--range week|month|year|all] [--no-color]` |\nLocal activity dashboard built from append-only JSONL events: launches, allows, blocks, refreshes, and top files. Nothing leaves your machine. |\n\n`sidekick neovim`\n\nlaunches`nvim --listen /tmp/<blake3(cwd)>-<pid>.sock`\n\n. The socket path is deterministic per canonical working directory and unique per process, so the hook can find every Neovim instance opened from the same project.- Claude Code and Codex call\n`sidekick hook`\n\nbefore file edits. The opencode and pi bridges do the equivalent for their`edit`\n\nand`write`\n\ntools. The hook globs`/tmp/<blake3(cwd)>-*.sock`\n\n, connects to reachable instances over msgpack-rpc with a short timeout, and asks whether each target is active with unsaved changes. If yes, the edit is denied; otherwise it is allowed. If no Neovim socket is found, sidekick degrades to allow. - After an edit lands, the hook tells every reachable Neovim instance with the file open to reload it. Cursor positions and visible windows are preserved.\n- On prompt submission, if Neovim has a live visual selection or recent visual marks, sidekick returns fenced context blocks like\n`[Selected from path:start-end]`\n\n. Claude Code and Codex receive them as additional context; opencode and pi append them to the submitted prompt text. - Decisions, refreshes, Neovim launches, and stats views are appended locally to\n`sidekick/events.jsonl`\n\nunder your OS data directory. Writes are best-effort and analytics never block the hook path.\n\nNo daemons, no background service. Just one CLI, Neovim RPC sockets in `/tmp`\n\n, and optional per-tool bridge files.\n\nNeovim with RPC + Lua support, a Unix-like system, and at least one supported AI harness: Claude Code, Codex, opencode, or pi. Rust/Cargo is required for `cargo install`\n\nor building from source; the install script also needs `python3`\n\nor `python`\n\nto merge Claude Code settings.\n\nSidekick is Phase 1 — Neovim plus Claude Code, Codex, opencode, pi, and Crush. The longer arc is a small protocol any editor can expose and any AI tool can query before writing: *is this file being edited by a human right now?* [PHILOSOPHY.md](/NishantJoshi00/sidekick/blob/main/PHILOSOPHY.md) has the roadmap (Helix, Zed, VS Code; Aider, Goose, Continue) and the extension points.\n\nIssues and PRs welcome. If you want to add a new editor or AI tool, the `Action`\n\ntrait in `src/action.rs`\n\nis the contract — [PHILOSOPHY.md](/NishantJoshi00/sidekick/blob/main/PHILOSOPHY.md) covers the architecture.", "url": "https://wpnews.pro/news/sidekick-keep-using-neovim-while-a-dozen-agents-rewrite-your-code", "canonical_source": "https://github.com/NishantJoshi00/sidekick", "published_at": "2026-05-27 12:08:39+00:00", "updated_at": "2026-05-27 12:18:35.590891+00:00", "lang": "en", "topics": ["ai-tools", "ai-agents", "ai-products"], "entities": ["Neovim", "Claude Code", "Codex", "opencode", "Crush"], "alternates": {"html": "https://wpnews.pro/news/sidekick-keep-using-neovim-while-a-dozen-agents-rewrite-your-code", "markdown": "https://wpnews.pro/news/sidekick-keep-using-neovim-while-a-dozen-agents-rewrite-your-code.md", "text": "https://wpnews.pro/news/sidekick-keep-using-neovim-while-a-dozen-agents-rewrite-your-code.txt", "jsonld": "https://wpnews.pro/news/sidekick-keep-using-neovim-while-a-dozen-agents-rewrite-your-code.jsonld"}}