Get the FREE Ultimate OpenClaw Setup Guide →

codecompanion-history.nvim

A history management extension for codecompanion AI chat plugin that enables saving, browsing and restoring chat sessions.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio ravitemer-codecompanion-history.nvim node path/to/server.js

How to use

CodeCompanion History is an extension for Neovim that saves, browses, and restores chat sessions within CodeCompanion. It provides features like automatic session saving, manual saves via a keybind, smart title generation, project-aware filtering, and a memory system that can index and search chat summaries with VectorCode when available. The extension supports multiple picker interfaces for browsing chats and summaries, and it can restore chats with their full context, tools, and references intact. To use it, install CodeCompanion alongside this history extension and enable the history extension in your CodeCompanion setup. Once enabled, you can save chats automatically or manually, browse saved chats with the selected picker, and restore a chat along with its full history, prompts, tool outputs, and references. The Summary system allows you to generate and browse summaries for individual chats, and the Memory tool provides vector-based search when VectorCode is installed.

How to install

Prerequisites:\n- Neovim >= 0.8.0\n- Lua support in Neovim (default)\n- CodeCompanion.nvim installed and configured\n- Optional: VectorCode CLI for the @memory tool, and optional pickers like snacks.nvim, telescope.nvim, or fzf-lua for enhanced browsing.\n\nInstallation steps:\n1) Install the history extension alongside CodeCompanion via your plugin manager. For lazy.nvim, add:\nlua\n{\n "olimorris/codecompanion.nvim",\n dependencies = {\n -- other plugins\n "ravitemer/codecompanion-history.nvim"\n }\n}\n}\n\n2) Configure the extension in your Neovim configuration to enable history features and customize options. Example:\nlua\nrequire("codecompanion").setup({\n extensions = {\n history = {\n enabled = true,\n opts = {\n keymap = "gh",\n save_chat_keymap = "sc",\n auto_save = true,\n expiration_days = 0,\n picker = "telescope",\n chat_filter = nil,\n picker_keymaps = {\n rename = { n = "r", i = "<M-r>" },\n delete = { n = "d", i = "<M-d>" },\n duplicate = { n = "<C-y>", i = "<C-y>" },\n },\n auto_generate_title = true,\n dir_to_save = vim.fn.stdpath("data") .. "/codecompanion-history",\n enable_logging = false,\n summary = {\n create_summary_keymap = "gcs",\n browse_summaries_keymap = "gbs",\n generation_opts = {\n adapter = nil,\n model = nil,\n context_size = 90000,\n include_references = true,\n include_tool_outputs = true,\n system_prompts = true\n }\n }\n }\n }\n }\n})\n\n3) Restart Neovim and verify that the history extension is loaded and enabled. You can then start saving chats automatically or manually and browse them using the configured keymaps.

Additional notes

Tips and troubleshooting:\n- If chats are not appearing, verify that dir_to_save exists and is writable (default is vim.fn.stdpath("data") .. "/codecompanion-history").\n- Ensure your picker (telescope, snacks, fzf-lua) is installed if you want enhanced browsing; otherwise the default picker will be used.\n- The system may report compatibility notes when CodeCompanion updates; if you encounter issues, check the project's issues page for compatibility notes and updates.\n- The memory feature relies on VectorCode; install VectorCode CLI to enable indexing and search; ensure it is accessible in your PATH.\n- Automatic expiration of chats is configurable; set expiration_days to 0 to disable automatic deletion.\n- If you customize title generation, you can adjust the adapter/model and refresh behavior via title_generation_opts.

Related MCP Servers

Sponsor this space

Reach thousands of developers