codecompanion.nvim AGENTS.md

Repository instructions for CodeCompanion.nvim, a Neovim plugin that lets developers use language models and coding agents inside Neovim.

In plain words
What is it for?
Use them when changing Lua code, commands, documentation, architecture, formatting, or tests in CodeCompanion.nvim.
Why use it?
They document the code style, project structure, commands, and testing expectations, helping changes fit the plugin and get checked correctly.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/olimorris/codecompanion.nvim/agents-md
Clone the repo
git clone --depth 1 https://github.com/olimorris/codecompanion.nvim

Made for: Codex, OpenCode.

Per session 1,229 This file is loaded in full into every session.
When invoked 1,229 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01229 $0.01229
Opus 5 $0.00615 $0.00615
Sonnet 5 $0.00246 $0.00246
Haiku 4.5 $0.00123 $0.00123

Measured 3d ago against content hash 8f7058fa710c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

codecompanion.nvim AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 67 lines

How it starts

The opening of the file, as written. The whole thing — 67 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CodeCompanion.nvim

This is a Neovim plugin written in Lua, which allows developers to code with LLMs and agents from within Neovim. Tests use Mini.Test with child processes. Always run the full test suite after changes and ensure all tests pass before considering work complete.

Commands

  • make format — StyLua (120 cols, 2 spaces). Run before committing.
  • make test — full test suite (Mini.Test)
  • make test_file FILE=path — targeted tests
  • make docs — regenerate vimdoc. Run this after changing any docs pages

Code conventions

  • Naming: snake_case for files/functions, PascalCase for classes, underscore prefix for private functions
  • Explicit names: pattern not pat, should_include not include_ok
  • Readable code: names, variables, and control flow should read like clean English. Avoid generic names like ctx — use domain-specific names (permission, request, source)
  • Plain language: avoid jargon shortcuts in code, comments, commit messages, and chat. Don't say "no-op" — say what the code actually does ("returns unchanged", "does nothing", "skipped because already edited")
  • Comments earn their place: don't restate what a readable line of code already says. If a guard like if type(x) ~= "number" then return end is self-evident, a comment explaining it is noise. Comment the why that isn't in the code (e.g. -- NOTE: Not handling token tables yet), not the what
  • Don't narrate every change: the maintainer is an expert who knows this codebase. Do NOT add a comment to explain routine code (-- Clear the modified flag, -- Loop over the messages, -- Return early). Default to no comment. Reserve comments for genuinely non-obvious why — a subtle API quirk, a workaround, an ordering constraint — the kind of thing that would trip up even a reader who knows the codebase
  • Function params: prefer a single table argument over positional args
  • Error handling: pcall + log:error(), return nil on failure
  • Type annotations: LuaCATS for public APIs. Keep doc blocks concise — one description line, params should be self-explanatory without inline comments
  • Function descriptions: exactly one line. No multi-paragraph rationale, no usage examples, no "why we cache this" essays — that belongs in commit messages or a single inline -- comment at the relevant line. If you can't summarise the function in one line, the function is doing too much
  • Functions: keep under 50 lines
  • Globals: avoid; use module-local state
  • Code blocks: use four backticks with language spec unless in a markdown file

Read the full file on GitHub · 67 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 67 lines · 1,229 tokens per session scan A 8f7058fa710c

Subscribe to this mod's changes

codecompanion.nvim AGENTS.md is an instructions file published in the GitHub repository olimorris/codecompanion.nvim (6,829 stars, last pushed yesterday), licensed Apache-2.0. It adds 1,229 tokens to every session, about $0.0061 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.