agentleFS
olimorrisolimorris/codecompanion.nvim/AGENTS.md

codecompanion.nvim

AGENTS.md6.9k starsChanged 3 months agoApache-2.0View on GitHub

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. The full style guide, with worked examples: Core: lua/codecompanion/

Trending

More talk lately.about the whole repository

Dec 2025: 1 mentionJan 2026: 1 mentionFeb 2026: 4 mentionsMar 2026: 1 mentionApr 2026: 1 mentionMay 2026: 3 mentionsJun 2026: 2 mentionsJul 2026: 1 mentionAug 2026: 0 mentionsSep 2026: 3 mentionsOct 2026: 1 mentionNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the olimorris/codecompanion.nvim repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about olimorris/codecompanion.nvim

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

See all 44

Talked about on GitHub, Bluesky and Hacker News (44 times).

On GitHub · 30

25 more on GitHub

On Bluesky · 12

7 more on Bluesky
  • 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.

  • In this repositoryOne other file it gives its agents.

The file

Show its rules and text

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

17 rules. About 0 are common, 11 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Plain language: avoid jargon shortcuts in code, comments, commit messages, and chat.

    line 21
  2. Very specific:

    Comments earn their place: don't restate what a readable line of code already says.

    line 22
  3. Distinctive:

    Functions: keep under 50 lines

    line 28
  4. Distinctive:

    Globals: avoid; use module-local state

    line 29
  5. Distinctive:

    Code blocks: use four backticks with language spec unless in a markdown file

    line 30
  6. Distinctive:

    Don't over-explore the codebase with excessive grep/read calls.

    line 46
  7. Distinctive:

    When the user asks to fix tests, fix the tests - not the source code - unless explicitly asked otherwise.

    line 47
  8. Very specific:

    If you're working with directories or files, utilise the functions in codecompanion/utils/files.lua ensuring you join paths with …

    line 48
  9. Very specific:

    When running make test_file tests, do not append | tail -12 or similar to filter the output.

    line 55
  10. Very specific:

    Test the behaviour, not the obvious.

    line 57
  11. Distinctive:

    Do what has been asked; nothing more, nothing less.

    line 62
  12. Distinctive:

    NEVER create files unless absolutely necessary

    line 63
  13. Distinctive:

    ALWAYS prefer editing existing files

    line 64
  14. Distinctive:

    NEVER proactively create documentation files

    line 65
  15. Very specific:

    ALWAYS keep memory in the current working directory and memories/ folder

    line 66
  16. Very specific:

    After ANY correction from the user: update the PERSONAL.md with the pattern

    line 73
  17. Distinctive:

    Write rules that prevent the same mistake from happening again

    line 74

≈ “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

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. Read VOICE.md before editing anything in doc/

Code conventions

The full style guide, with worked examples:

@STYLE.md

  • 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: take an opts table, not a list of positional args - a new parameter then costs one edit instead of every call site. Default to opts alone. A leading positional is earned, not assumed: it must be the single subject the function acts on and stable enough that it will never be replaced or joined by a sibling (Chat:add_message(data, opts), markdown.form_codeblock(content, opts)). If you're weighing whether an argument qualifies, it doesn't. Normalise it on the first line with opts = opts or {} and annotate the shape inline: ---@param opts? { auto_submit?: boolean }
  • 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

Architecture

Core: lua/codecompanion/

  • Interactions (interactions/): chat/, inline/, cmd.lua, init.lua (workflows)
  • Adapters (adapters/): http/ (Anthropic, OpenAI, Copilot, Ollama, Gemini, etc.), acp/ (Claude Code, Codex, etc.)
  • Tools (interactions/chat/tools/builtin/): ask_questions, run_command, read_file, create_file, delete_file, insert_edit_into_file/, grep_search, file_search, web_search, fetch_webpage, memory, get_changed_files, get_diagnostics, cmd_tool (factory for custom command tools)
  • Slash Commands (interactions/chat/slash_commands/builtin/): /buffer, /command, /compact, /fetch, /file, /help, /image, /mcp, /mode, /now, /rules, /symbols
  • Editor Context (interactions/chat/editor_context/): buffer, buffers, diagnostics, diff, messages, quickfix, selection, terminal, viewport
  • Config: config.lua - tool groups (agent, files), adapter defaults, all settings
  • Entry point: plugin/codecompanion.lua → lua/codecompanion/init.lua

General rules

  • Don't over-explore the codebase with excessive grep/read calls. If you haven't converged on an approach after 3-4 searches, pause and share what you've found so far rather than continuing to search.
  • When the user asks to fix tests, fix the tests - not the source code - unless explicitly asked otherwise.
  • If you're working with directories or files, utilise the functions in codecompanion/utils/files.lua ensuring you join paths with vim.fs.joinpath
  • Never read adapter.schema.model.default directly - it holds a function on Ollama and any openai_compatible adapter. adapter_utils.model(adapter) gives the model as a string without ever calling that function; adapter_utils.resolve_model(adapter) calls it for the places that need the value and can afford the HTTP round-trip it may cost. Both return string|nil
  • To change an adapter's model, adapters.set_model({ adapter = adapter, model = "gpt-4o" }), or adapters.resolve(name, { model = "gpt-4o" }) when starting from an adapter name. Don't assign the schema yourself

Testing

  • make test_file FILE= takes a single file (tests/interactions/code_review/test_ui.lua), never a directory. Run one file per invocation
  • When running make test_file tests, do not append | tail -12 or similar to filter the output. This prevents the user's rules governing what can be auto-accepted, from applying
  • Chat buffer cursor position, scrolling and folds are verified by hand in real use. Don't add test cases for them, even alongside a fix. Ask first
  • Test the behaviour, not the obvious. A case that only proves a guard clause returns false, or that a value passes through a shared utility unchanged, earns nothing - cut it and keep the cases where the outcome could genuinely go either way
  • Name a case for the behaviour it pins down, and lean on contrast so a pair reads as a pair: DOES NOT truncate a tool that is INSIDE the limit / truncates a tool that is OUTSIDE the limit

Important instructions

  • Do what has been asked; nothing more, nothing less.
  • NEVER create files unless absolutely necessary
  • ALWAYS prefer editing existing files
  • NEVER proactively create documentation files
  • ALWAYS keep memory in the current working directory and memories/ folder

Self-improvement loop

The user may have shared a PERSONAL.md file with specific instructions for how they like to work. If so, follow these instructions carefully:

  • Review the PERSONAL.md at the start of every session
  • After ANY correction from the user: update the PERSONAL.md with the pattern
  • Write rules that prevent the same mistake from happening again

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.