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
Who's talking about nickjvandyke/opencode.nvim
- anomalyco/opencode“`opencode` process orphans when its parent exits”GitHub · Feb 10, 2026 · 7 reactions
- @nickjvandyke.bsky.social“Added a Motivation section to github.com/nickjvandyke... tl;dr: AI works best as a pair programmer. Nobody …”Bluesky · Jun 24, 2026 · 2 likes
- yindia/dotfiles“build(deps): Bump the submodules group with 6 updates”GitHub · Sep 18, 2026
- yindia/dotfiles“build(deps): Bump the submodules group with 8 updates”GitHub · Sep 16, 2026
- yindia/dotfiles“build(deps): Bump the submodules group with 6 updates”GitHub · Aug 24, 2026
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
- Feb 10, 2026`opencode` process orphans when its parent exits — anomalyco/opencode7 reactions · 3 comments
- Sep 18, 2026build(deps): Bump the submodules group with 6 updates — yindia/dotfiles0 reactions
- Sep 16, 2026build(deps): Bump the submodules group with 8 updates — yindia/dotfiles0 reactions
- Aug 24, 2026build(deps): Bump the submodules group with 6 updates — yindia/dotfiles0 reactions
- Jul 28, 2026fix(opencode-nvim): Update api call for toggle function in opencode — AstroNvim/astrocommunity0 reactions · 1 comment
5 more on GitHub
- Apr 30, 2026Expose Editor State via IPC for External CLI Agents — warpdotdev/warp0 reactions · 2 comments
- Mar 30, 2026Upstream modules not found: module "opencode.cli.server" not found — e-cal/opencode-tmux.nvim0 reactions
- Feb 17, 2026Could this work with a prompt from a TUI like Opencode? — xb-bx/editable-term.nvim0 reactions · 2 comments
- Feb 11, 2026[FEATURE]: VSCode extension can connect to any opencodes running in CWD — anomalyco/opencode0 reactions · 2 comments
- Feb 7, 2026Add `nickjvandyke/opencode.nvim` — rockerBOO/awesome-neovim0 reactions · 2 comments
On Bluesky · 1
- Jun 24, 2026Added a Motivation section to github.com/nickjvandyke... tl;dr: AI works best as a pair programmer. Nobody wants to learn yet another… — @nickjvandyke.bsky.social2 likes and reposts
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
- Distinctive: line 25
No hard Lua dependencies beyond Neovim itself
- Distinctive: line 48
No test framework — no tests directory, no test runner config
≈ “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.
Files
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— exportsask(),select(),prompt(),command(),operator(),format(),statusline - Config:
vim.g.opencode_optsglobal (not asetup()call); merged with defaults fromlua/opencode/config.lua - Plugin files:
plugin/highlights.luasets highlight groups;plugin/events/registers four autocmd groups (OpencodeReload,OpencodeStatus,OpencodePermissions,OpencodeEdits) that listen forOpencodeEvent:*User events to reload edited buffers, update statusline, display permission requests, and diff edit proposals
Config quirks
- Config is passed via
vim.g.opencode_optsfor simpler UX and faster startup (seelua/opencode/config.lua:6) snacks.nvimnested opts go underask.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.autoreadis automatically set totruewhenevents.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 somesnacks.inputoptions; workaround: modifyrequire("opencode.config").optsdirectly
Dependencies
- Required:
opencodeCLI,curl - Auto-discovery: reads OpenCode's background service registration (
service.json) from its state directory (unlessserver.urlis set) - Optional:
snacks.nvim(enhancesask()withsnacks.input,select()withsnacks.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, clonedsnacks.nvimandblink.cmp
Architecture notes
- Async: custom Promise implementation in
lua/opencode/promise/init.lua(fork ofpromise.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 oropts.server.password. Requests carryx-opencode-directory: <nvim cwd>; the daemon is shared across projects, so/api/sessionis scoped with adirectoryquery. 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 asOpencodeEvent:<type>User autocmds. OpenCode v2 events are shaped{ id, type, data }. - Edit review: opens diff in new tab via
:diffpatch, keymapsda/drto accept/reject,dp/dofor 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()setsoperatorfunc, usesg@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.
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
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.

