agentleFS
nickjvandykenickjvandyke/opencode.nvim/AGENTS.md

opencode.nvim

AGENTS.md3.9k starsChanged 6 months agoMITView on GitHub

A Neovim Lua plugin that bridges Neovim and the opencode CLI (external binary). It discovers or starts an opencode server, communicates via REST + SSE, and provides UI for prompting, context injection, session management, and edit review.

Trending

Quiet since September.thin dataabout the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 4 mentionsMar 2026: 1 mentionApr 2026: 1 mentionMay 2026: 0 mentionsJun 2026: 1 mentionJul 2026: 1 mentionAug 2026: 1 mentionSep 2026: 2 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the nickjvandyke/opencode.nvim repository that our weekly crawl found: only 11 in all, so this is a hint, not a trend. There is no adoption data for this file yet.

Who's talking about nickjvandyke/opencode.nvim

The biggest 5 of 11 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 11

Talked about on GitHub and Bluesky (11 times).

On GitHub · 10

5 more on GitHub
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

The file

We split this AGENTS.md into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No hard Lua dependencies beyond Neovim itself

    line 25
  2. Distinctive:

    No test framework — no tests directory, no test runner config

    line 48

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

opencode.nvim — agent guide

What it is

A Neovim Lua plugin that bridges Neovim and the opencode CLI (external binary). It discovers or starts an opencode server, communicates via REST + SSE, and provides UI for prompting, context injection, session management, and edit review.

Entrypoints

  • Public API: lua/opencode.lua — exports ask(), select(), prompt(), command(), operator(), format(), statusline
  • Config: vim.g.opencode_opts global (not a setup() call); merged with defaults from lua/opencode/config.lua
  • Plugin files: plugin/highlights.lua sets highlight groups; plugin/events/ registers four autocmd groups (OpencodeReload, OpencodeStatus, OpencodePermissions, OpencodeEdits) that listen for OpencodeEvent:* User events to reload edited buffers, update statusline, display permission requests, and diff edit proposals

Config quirks

  • Config is passed via vim.g.opencode_opts for simpler UX and faster startup (see lua/opencode/config.lua:6)
  • snacks.nvim nested opts go under ask.snacks / select.snacks, then get merged into the passed options at usage time (lua/opencode/ui/ask/init.lua, lua/opencode/ui/select.lua)
  • vim.o.autoread is automatically set to true when events.reload.enabled = true (the default) unless the user has explicitly configured it
  • Neovim doesn't support mixed integer/string keys in vim.g, which affects some snacks.input options; workaround: modify require("opencode.config").opts directly

Dependencies

  • Required: opencode CLI, curl
  • Auto-discovery: reads OpenCode's background service registration (service.json) from its state directory (unless server.url is set)
  • Optional: snacks.nvim (enhances ask() with snacks.input, select() with snacks.picker), blink.cmp (completion plugin with LSP source)
  • No hard Lua dependencies beyond Neovim itself

Verification commands

# Type-check (requires neovim + lua-language-server + cloned snacks/blink)
lua-language-server --configpath .luarc.ci.json --check=.

# Format check
stylua --check .

# Format in place
stylua .

CI

  • .github/workflows/lua-ls.yml: type-check on push/PR to main
  • .github/workflows/stylua.yml: format check on push/PR to main
  • .github/workflows/release-please.yml: automated releases via release-please (non-fork, main branch only)

Testing

  • No test framework — no tests directory, no test runner config
  • Manual verification: :checkhealth opencode

Formatting (StyLua)

  • column_width = 120, indent_width = 2, spaces, double quotes, no call parentheses
  • File: .stylua.toml

Type-checking (LuaLS)

  • Config: .luarc.ci.json
  • Runtime: LuaJIT
  • Library paths: /opt/nvim/share/nvim/runtime/lua, cloned snacks.nvim and blink.cmp

Architecture notes

  • Async: custom Promise implementation in lua/opencode/promise/init.lua (fork of promise.nvim)
  • Server discovery flow (lua/opencode/server/discovery/init.lua): connected server → configured URL → OpenCode background service registration (service.json, URL + password) → auto-start + poll (5s timeout)
  • OpenCode v2 API (lua/opencode/server/init.lua): the HTTP API lives under /api/* and requires HTTP basic auth. The password comes from the service registration or opts.server.password. Requests carry x-opencode-directory: <nvim cwd>; the daemon is shared across projects, so /api/session is scoped with a directory query. Prompts and commands target the most recently updated root session for Neovim's directory (Server:resolve_session()), resolved per call and never cached. OpenCode v2 has no TUI-driving or prompt-append API.
  • Discovery vs connection: server.connect (default true) controls whether the discovered server is automatically subscribed to via SSE. When false, the server is found but not connected.
  • Context system (lua/opencode/context/init.lua): captures buffer/win/cursor/selection before UI opens, renders placeholders (@this, @buffer, etc.) in prompts
  • Events: SSE subscribed on connect() (/api/event), dispatched as OpencodeEvent:<type> User autocmds. OpenCode v2 events are shaped { id, type, data }.
  • Edit review: opens diff in new tab via :diffpatch, keymaps da/dr to accept/reject, dp/do for per-hunk
  • Ask completion: in-process LSP server (lua/opencode/ui/ask/cmp.lua) providing context placeholder + agent completions
  • Integration policy: code that bridges another tool to opencode.nvim (e.g. picker send, terminal toggle) belongs in README examples. Code that enhances opencode.nvim's own UI (ask/select with snacks input/picker) stays in the plugin.
  • Operator: operator() sets operatorfunc, uses g@ for range + dot-repeat support

Project vision

See CONTRIBUTING.md for project guidelines, priorities, and maintenance philosophy. When in doubt, follow the patterns already in the codebase.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.