Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vemory

Local semantic code search for Neovim. Index your codebase once, search by meaning instead of exact text. 100% offline, no API keys, no cloud.

Ask "where is the auth logic" and get results even if no file contains that exact phrase.

How it works

vemory runs a native C++ daemon that:

  1. Scans your project (respects .gitignore)
  2. Chunks code into functions, classes, and structs using tree-sitter
  3. Embeds each chunk with a local ONNX model (all-MiniLM-L6-v2, 384-dim)
  4. Stores embeddings in SQLite with sqlite-vec for vector search and FTS5 for keyword search
  5. Searches using hybrid Reciprocal Rank Fusion (vector + keyword combined)

Everything stays on your machine. The index persists in .vemory.db and only re-indexes changed files.

Supported languages

C/C++, Go, Python, JavaScript, TypeScript, TSX, Rust, Lua

Requirements

  • Neovim 0.9+
  • CMake 3.20+
  • C++20 compiler (GCC 11+ or Clang 14+)
  • OpenSSL (dev headers)
  • Git

Install

lazy.nvim

{
  "amanyd/vemory",
  build = "cmake -S . -B build -DCMAKE_BUILD_TYPE=Release && cmake --build build -j$(nproc)",
  config = function()
    require("vemory").setup({ auto_start = true })
  end,
}

Manual

git clone https://github.com/amanyd/vemory.git
cd vemory
git submodule update --init  # pulls vcpkg
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=external/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)

Then add to your Neovim config:

vim.opt.rtp:append("/path/to/vemory")
require("vemory").setup({ auto_start = true })

Usage

:VemoryIndex              " index (or re-index) the project
:VemorySearch auth logic  " semantic search
:VemorySearch             " interactive prompt
:VemoryStats              " show index stats
:VemoryStop               " stop the daemon

Search results appear in the quickfix list. Jump between them with :cnext / :cprev.

CodeCompanion integration

vemory plugs into CodeCompanion.nvim to give your LLM automatic codebase context. When you open a chat, relevant code snippets are injected as context so the AI actually knows your project.

Setup

Add vemory as a CodeCompanion extension in your config:

-- lazy.nvim example
{
  "olimorris/codecompanion.nvim",
  dependencies = {
    "amanyd/vemory",
  },
  config = function()
    require("vemory.codecompanion").setup({
      auto_index = true,     -- index on startup
      auto_context = true,   -- inject context into every new chat
    })

    require("codecompanion").setup({
      -- your codecompanion config here
    })
  end,
}

What this gives you

  • Auto-context injection -- when you open a CodeCompanion chat, vemory searches the index using your current buffer as a query and silently injects the most relevant code snippets as a system message. The AI sees your codebase without you doing anything.

  • /codebase slash command -- type /codebase in a CodeCompanion chat to manually search. It prompts for a query, runs semantic search, and adds the results to the conversation.

  • Manual injection -- call :VemoryDebugCC to check integration status, or use require("vemory.codecompanion").inject_context("your query") from Lua.

Lua API

local vemory = require("vemory")

vemory.setup({ auto_start = true })

vemory.index(function(res)
  print(res.message)  -- "indexed_42_chunks_10_files"
end)

vemory.search("database connection pool", { limit = 5 }, function(res)
  for _, r in ipairs(res.results) do
    print(r.path, r.start_line, r.score, r.signature)
  end
end)

vemory.stats(function(res)
  print(res.files, res.chunks)
end)

vemory.stop()

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages