Skip to content

About

Structured code review feedback from Neovim to AI coding agents via tmux

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

agent-review.nvim

Structured code review feedback from Neovim to AI coding agents.

Review diffs, annotate lines with feedback, and send it all to your AI agent's tmux pane in one keystroke. Built for workflows where you and an AI agent iterate on code together.

How it works

  1. Open a diff — toggle Diffview or pick from multiple dirty repos in a workspace
  2. Annotate — select lines or hunks and write feedback in a floating scratch buffer
  3. Send — annotations are serialized (JSON or Markdown) and delivered to the agent's tmux pane

The agent receives a structured file with your feedback — file paths, line numbers, selected code, and your comments — so it knows exactly what to fix.

Requirements

  • Neovim >= 0.9
  • tmux (agent must be running in a tmux pane)

Optional dependencies

Plugin What it enables
diffview.nvim Diff review UI, multi-repo picker
gitsigns.nvim Hunk annotation (annotate_hunk)

Without these, visual selection annotation and manual send still work on any buffer.

Installation

lazy.nvim
{
  'colewhitley/agent-review.nvim',
  dependencies = {
    'lewis6991/gitsigns.nvim',  -- optional: hunk annotation
    'sindrets/diffview.nvim',   -- optional: diff UI + multi-repo
  },
  config = function()
    require('agent-review').setup()
  end,
}

After installing, run :checkhealth agent-review to verify your setup.

Default keymaps

All keymaps are configurable. Set any keymap to false to disable it.

Annotation

Key Mode Action
<leader>aa Visual Annotate selected lines
<leader>ah Normal Annotate current git hunk (requires gitsigns)
<leader>as Normal Send all annotations to agent pane
<leader>al Normal List annotations (select to delete)
<leader>ac Normal Clear all annotations
<leader>ap Normal Register agent pane (pick from tmux panes)

Diffview

Key Mode Action
<leader>ad Normal Toggle Diffview open/close
<leader>gd Normal Pick a dirty repo and open Diffview
<leader>gn Normal Close current diff, open next dirty repo
<leader>gq Normal Close diff and clear the repo queue

Configuration

These are the defaults. You only need to include values you want to change.

require('agent-review').setup({
  -- Transport: how annotations reach the agent
  transport = 'auto',                -- 'auto' or 'tmux'
  auto_detect_agent = true,          -- find the agent pane automatically
  agent_patterns = {                 -- process names to match when auto-detecting
    'claude', 'codex', 'gemini', 'node',
  },

  -- Display
  extmark_hl = 'DiagnosticInfo',     -- highlight group for annotation markers

  -- Float
  float_max_lines = 15,              -- max height of the annotation input float

  -- Serialization
  format = 'json',                   -- 'json' or 'markdown'
  send_threshold = 500,              -- byte threshold; above this, write to file
  feedback_dir = '/tmp',             -- where feedback files are written

  -- Keymaps (set to false to disable any)
  keymaps = {
    annotate = '<leader>aa',
    annotate_hunk = '<leader>ah',
    send = '<leader>as',
    list = '<leader>al',
    clear = '<leader>ac',
    register_pane = '<leader>ap',
    diff_open = '<leader>ad',
    diff_pick = '<leader>gd',
    diff_next = '<leader>gn',
    diff_quit = '<leader>gq',
  },
})

Multi-repo workspaces

When you work in a directory containing multiple git repos (e.g. a monorepo with src/PackageA/ and src/PackageB/), the multi-repo picker helps you review them one at a time.

<leader>gd scans for sub-repos with uncommitted changes, shows a picker with file counts, and queues the rest. <leader>gn cycles to the next dirty repo. Repos that become clean between picks are skipped automatically.

The scanner checks three levels deep: the current directory, its children, and grandchildren. This handles common layouts like:

workspace/
  src/
    PackageA/   (.git, 3 files changed)
    PackageB/   (.git, 1 file changed)
    PackageC/   (.git, clean -- hidden from picker)

How send works

When you press the send key:

  1. Annotations are serialized to JSON or Markdown
  2. If the payload is large (or always for tmux), it's written to a file in feedback_dir
  3. A trigger message is sent to the agent's tmux pane:
    Read the code review feedback in /tmp/agent-feedback-1714500000.json and address each item.
    
  4. The agent reads the file and gets structured feedback with file paths, line ranges, code context, and your comments

JSON format example

[
  {
    "file": "src/parser.lua",
    "start_line": 42,
    "end_line": 48,
    "content": "local function parse(input)\n  ...\nend",
    "comment": "This doesn't handle empty input. Add a nil check."
  }
]

Agent pane detection

The plugin finds your agent automatically by scanning tmux panes for processes matching agent_patterns. If exactly one match is found, it's used. If multiple match (e.g. two Claude sessions), you'll need to pick one manually with <leader>ap.

You can also set auto_detect_agent = false and always register manually.

Health check

Run :checkhealth agent-review to verify:

  • tmux is detected and executable
  • Optional dependencies (gitsigns, diffview) are available
  • Agent pane registration status

Development

Run tests:

make test                          # all tests
make test-file FILE=tests/store_spec.lua  # single file

Format and lint:

make format   # stylua
make lint     # luacheck

License

MIT

About

Structured code review feedback from Neovim to AI coding agents via tmux

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages