Initial commit: nvim-agentic-companion plugin

Adds a Claude Code agent and three skills for collaborating with the
user's running Neovim instance via mcp-neovim-server and the official
coder/claudecode.nvim plugin:

- agents/companion.md — the nvim companion identity, prefers runtime
  introspection over training-data guessing
- skills/editor-introspect — read-only queries against the live editor
- skills/editor-act — safe driving (open, jump, toggle, run); no buffer edits
- skills/claude-code-handoff — delegate buffer edits to the in-editor
  Claude Code session so users get a diff to accept or reject
This commit is contained in:
oleks
2026-05-21 00:22:05 +03:00
commit acf207e53b
8 changed files with 542 additions and 0 deletions
+54
View File
@@ -0,0 +1,54 @@
# nvim-agentic-companion
A Claude Code plugin that turns the user's running Neovim into a first-class collaborator.
It assumes two things are already wired up:
1. **`mcp-neovim-server`** registered as an MCP server in Claude Code, pointed at the nvim RPC socket (default `/run/user/1000/nvim.sock`). NixVim's `extraConfigLuaPre` starts the server on that socket at editor startup.
2. **`coder/claudecode.nvim`** loaded inside nvim, with `<leader>a*` keymaps wired (toggle, focus, send, accept/deny diff).
This plugin doesn't ship those — it depends on them and ties them together with one agent and three skills.
## Layout
```
nvim-agentic-companion/
├── .claude-plugin/plugin.json # manifest + userConfig (socket, config path)
├── agents/
│ └── companion.md # the nvim-companion agent identity
└── skills/
├── editor-introspect/ # read live state via mcp__neovim__*
├── editor-act/ # drive nvim safely (open, jump, toggle, run)
└── claude-code-handoff/ # delegate buffer edits to the in-editor Claude
```
## Agent
`companion` — answers questions about the *running* nvim ("what's bound to `<leader>ff`?", "is lualine actually using catppuccin-mocha?") and acts on it ("open neovim.nix at the lualine block"). It reads the declarative NixVim config as the source-of-truth for *why* things are set up the way they are, and the live editor for *what is actually loaded right now*.
## Skills
- **`editor-introspect`** — read-only queries against the live nvim (keymaps, buffers, options, diagnostics, plugins, messages, cursor, selection).
- **`editor-act`** — safe driving: open files, jump to definitions, trigger user keymaps, toggle UI. Does **not** edit buffer contents.
- **`claude-code-handoff`** — when the work is "change code in this buffer," hand it to the in-editor Claude Code session so the user gets a diff to accept or reject inline.
## Why split it three ways
The companion's three jobs have different blast radii:
- *Reads* are free; do them eagerly.
- *Edits to navigation/UI* are cheap to undo; do them when asked.
- *Edits to code* deserve a diff and human review; route them through the inner Claude that already has the right UX for that.
The skills enforce that separation so the agent doesn't drift into running `nvim_buf_set_text` directly when it should be sending to the Claude Code split.
## Configuration
| Key | Default | Purpose |
| --------------- | ------------------------------------------------------ | ----------------------------------------------------------- |
| `nvim_socket` | `/run/user/1000/nvim.sock` | Where the running nvim listens (must match the MCP server). |
| `config_path` | `/home/oleks/projects/servers/emmett/nixos/neovim.nix` | The declarative NixVim source the companion cites from. |
## License
MIT.