# Hermes An [ACP (Agent Client Protocol)](https://agentclientprotocol.com) client designed for integration with Neovim. ## πŸ“‹ Overview Hermes is a messaging layer for Neovim. It has no built-in UI, instead it provides APIs and hooks for building your own workflow while routing client-agent communication. Hermes focuses on: - APIs for making requests to AI Assistants (prompt, connect, authenticate, etc) - Hooks into requests from AI assistants that require responses (permission requests, access requests, etc) - Autocommands for updates on communication between the user (client) and assistant (agent) ## ✨ Features - [x] Full implementation of ACP Client (Built on the official [Rust ACP Sdk](https://github.com/agentclientprotocol/rust-sdk)) - [x] Support for all registered ACP Agents ([Full list here](https://agentclientprotocol.com/get-started/agents)) - [x] Configurable capabilities (filesystem, terminal, etc) - [x] Autocommands for messages/notifications - [x] Communication over Stdio, TCP, Socket, and HTTP protocols - [x] Neovim 0.12 progress integration via `nvim_echo` with `kind="progress"` - [x] Luarocks integration - [x] NixOS intgration ### βš™οΈ Requirements - Neovim 0.11 or later ### πŸ’» Supported Platforms Binaries are available for: - **Linux:** x86_64, aarch64 (arm64) - **macOS:** x86_64, arm64 - **Windows:** x86_64 > [!NOTE] > Hermes will automatically detect and download a pre-built binary for supported platforms. > > You can disable this if you would prefer to [build from source](#-building-from-source) > ```lua > -- Will have to set up manually with `:Hermes build` or build manually from source > require("hermes").setup({ > download = { > auto = false, > }, > }) > ``` ## πŸ“¦ Installation **vim.pack** (v0.12+) ```lua vim.pack.add({ "Ruddickmg/hermes.nvim" }) ``` **lazy.nvim** ```lua { "Ruddickmg/hermes.nvim", config = function() require("hermes").setup() end } ``` **rocks.nvim** ```vim :Rocks install hermes.nvim ``` **NixOS** Hermes can be installed to nix directly as a flake or via `nixpkgs.vimPlugins.hermes-nvim`. ```nix programs.nixvim = { extraPlugins = [ pkgs.vimPlugins.hermes-nvim ]; }; ``` ## ⌨️ Commands Open the most recent log file in a new tab (read-only, cursor at the end). The buffer's filetype follows your `log.file.format` configuration β€” JSON logs open as `jsonl` (newline-delimited JSON). ```vim :Hermes log ``` Fetch the latest release from GitHub and replaces the current binary. ```vim :Hermes update ``` > Triggers [Progress](#progress) autocommand while downloading Download the currently configured version. ```vim :Hermes install ``` > Triggers [Progress](#progress) autocommand while downloading Remove the binary. Run `:Hermes install` or use Hermes API to re-download. ```vim :Hermes clean ``` Compile from source (requires Rust toolchain). Runs asynchronously without blocking Neovim. ```vim :Hermes build ``` Cancel an in-progress source build. Shows warning if no build is running. ```vim :Hermes cancel ``` ## πŸ”Œ API Hermes exposes the following functions for sending requests to AI assistants. > [!WARNING] > Methods marked β€œOptional” are implemented by Hermes but are not mandatory for agent implementations. ### βš™οΈ Setup Configure Hermes plugin settings. ```lua local hermes = require("hermes") local LogFormat = hermes.LogFormat -- Basic usage with no arguments (uses all defaults) hermes.setup() -- Configure specific permissions hermes.setup({ permissions = { fs_write_access = true, terminal_access = true, } }) -- Full configuration defaults hermes.setup({ download = { version = "latest", -- specify which hermes release to use auto = true, -- automatically download pre-built binary (set to false to build manually), defaults to false on Nixos environments timeout = 60, -- timeout in seconds for download }, root_markers = { ".git" }, -- used to detect the project root by matching file names in the root directory permissions = { fs_write_access = true, -- Allow file writes to the agent fs_read_access = true, -- Allow file reads to the agent terminal_access = true, -- Allow terminal access to the agent request_permissions = true, -- Allow agent to send permission requests send_notifications = true, -- Allow the agent to send notifications elicitation = { form = true, -- Allow the agent to send form elicitation requests url = true, -- Allow the agent to send URL elicitation requests reject_unknown_elicitation_values = false, -- Reject responses for unknown/future elicitation property types }, }, distributions = { -- path to distributions uvx = true, -- allows installing agents via UVX (default: true, false in Nix environments) npx = true, -- allows installing agents via NPX (default: true, false in Nix environments) binary = { -- configuration for binary behavior path = vim.fn.stdpath('state') .. "/nvim/hermes/binaries", -- path where binaries will be downloaded to enabled = true, -- allows installing agents via binary (default: true, false in Nix environments) }, }, terminal = { delete = true, -- Auto-delete terminals on exit enabled = true, -- Enable terminal functionality buffered = true, -- Buffer terminal output }, buffer = { auto_save = false, -- Auto-save modified files after writing to them }, session = { store_history = true, -- Store session history locally when agent does not support load_session }, log = { -- send logs to stdio stdio = { -- only logs of the set value and above will be sent level = vim.log.levels.OFF or "off", -- logs stdio logs will be formatted with the selected format format = LogFormat.compact, -- show ansi symbols show_ansi = false, }, -- send logs to Neovim "notify" notification = { level = vim.log.levels.ERROR or "error", show_ansi = false, -- show ansi symbols format = LogFormat.compact, }, -- send logs to Neovim ":messages" message = { level = vim.log.levels.OFF or "off", show_ansi = false, -- show ansi symbols format = LogFormat.compact, }, -- send logs to log files file = { level = vim.log.levels.OFF or "off", format = LogFormat.json, path = vim.fn.stdpath('state') .. "/nvim/hermes/logs", -- path to log file(s) name = "hermes.log", -- name of log file show_ansi = false, -- show ansi symbols max_size = 10485760, -- 10mb in bytes max_files = 5, -- Max log files to generate }, }, progress = { cmdline = false, -- Show progress messages in cmdline (0.12+ only) update_frequency = 150 -- how often to poll the download for progress in milliseconds }, agents = { -- User-defined agent connections to add to the agents list, keyed by agent id. opencode = { -- matching ids with an agent from the ACP registry will override the registered agent. command = "opencode", -- command to run for stdio connections args = { "acp" }, -- command arguments icon = "~/icons/opencode.svg", -- HTTP(S) URL or local path to an SVG icon (optional) description = "Some custom description", }, }, }) ``` > [!NOTE] > - `setup()` does not have to be called, hermes will operate off of defaults without it > - Configuration changes are applied immediately > - Multiple `setup()` calls merge configurations - only specified fields are updated > - All unspecified fields preserve their existing values ### πŸ€– Agents This method retrieves a list of available agents to choose from. ```lua local hermes = require("hermes") -- get list of agents hermes.agents() -- example with config options hermes.agents({ update = true, -- pull down the most up to date list from the ACP registry (will use last downloaded/pre-bundled registry if false) url = "https://cdn.agentclientprotocol.com/registry/v1/latest/registry.json", -- URL to pull ACP registry from }) ``` > **Triggers:** > - [AgentList](#agentslist) autocommand upon completion. > - [Progress](#progress) autocommand if the `update` option is enabled (for registry download progress) ### πŸ”— Connect This method allows you to connect to an agent, it takes the agent name and the protocol for the connection (defaults to `stdio`). ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand local Protocol = hermes.Protocol local Distribution = hermes.Distribution -- connect to pre-defined agent hermes.connect("github-copilot-cli") -- configure protocol hermes.connect("opencode", { protocol = Protocol.http, }) -- configure distribution hermes.connect("kilo", { -- Some agents have multiple different distributions; you can specify which to use. distribution = Distribution.binary, -- "binary", "npx", and/or "uvx" }) -- connect to custom agent (not pre-defined) hermes.connect( "my-claude", -- this will be the key you use for other methods (disconnect for example) { protocol = Protocol.socket, -- optional (Defaults to "stdio") command = "claude-acp", args = { "--socket", "/tmp/claude.sock" }, } ) -- connect to TCP socket hermes.connect( "copilot", { protocol = Protocol.tcp, host = "localhost", port = 8080, } ) --example vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.AgentList, callback = function(args) ---@type HermesAgentList local data = args.data local agent = table.remove(data.agents) -- select auth method id somehow hermes.connect(agent.id, { distribution = table.remove(agent.distributions), -- select distribution somehow }) end, }) ``` > **Triggers:** > - [ConnectionInitialized](#connectioninitialized) autocommand upon completion. > - [Progress](#progress) autocommand if the `distributions.binary.enabled` configuration is enabled (reports binary download progress) ### πŸ”Œ Disconnect Below are examples of how you can disconnect from agent(s). ```lua local hermes = require("hermes") -- disconnect from a single agent hermes.disconnect("copilot"); -- disconnect from a list of agents hermes.disconnect({ "copilot", "opencode" }) -- disconnect from all agents hermes.disconnect() ``` ### πŸšͺ Logout Below are examples of how you can log out from agent(s). ```lua local hermes = require("hermes") -- logout a single agent hermes.logout("copilot"); -- logout a list of agents hermes.logout({ "copilot", "opencode" }) -- logout all agents hermes.logout() ``` > **Triggers:** [LoggedOut](#loggedout) autocommand upon completion. ### πŸ”‘ Authenticate Handle agent authentication. ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand -- function signature hermes.authenticate(auth_method_id) -- example vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.ConnectionInitialized, callback = function(args) ---@type HermesConnectionInitialized local data = args.data local auth_method_id = table.remove(data.authMethods).id -- select auth method id somehow hermes.authenticate(auth_method_id) end, }) ``` > **Triggers:** [Authenticated](#authenticated) on success, or [TerminalAuthentication](#terminalauthentication) when the selected method is terminal. ### πŸ’¬ Prompt > **Note on `promptId`:** All agent notification autocommands (sourced from πŸ€– Agent) include a `promptId` field. This UUID is generated when a prompt is sent (via `prompt()`) or when a user message chunk arrives from the agent, and it is attached to all subsequent notifications for that session so you can correlate messages within a single prompt/response cycle. Send prompts to the agent There are five types of prompts you can send to an agent - [text](https://agentclientprotocol.com/protocol/content#text-content): Human readable prompts - [link](https://agentclientprotocol.com/protocol/content#resource-link): Links to resources (url, file path, etc) - [embedded](https://agentclientprotocol.com/protocol/content#embedded-resource): Similar to a link, but including the contents of the resource link (preferred over link if available) - [image](https://agentclientprotocol.com/protocol/content#image-content): An image (encoded as a base64) - [audio](https://agentclientprotocol.com/protocol/content#audio-content): Audio content for communication (encoded as base64) ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand local ContentType = hermes.ContentType -- single prompt call signature hermes.prompt(session_id, { type = ContentType.text, text = "What time is it?" }) -- multiple prompt call signature hermes.prompt(session_id, { { type = ContentType.text, text = "What time is it?" }, { type = ContentType.link, name = "Example file", uri = "/path/to/example.txt" }, { -- text type = ContentType.embedded, resource = { uri = "file:///home/user/script.py", mimeType = "text/x-python", text = "def hello():\n print('Hello, world!')" } }, { -- blob type = ContentType.embedded, resource = { uri = "file:///home/user/script.py", mimeType = "application/pdf", blob = "Base64-encoded binary data" } }, { type = ContentType.image, data = "base64-encoded-image-data", mimeType = "image/png" }, { type = ContentType.audio, data = "base64-encoded-audio-data", mimeType = "audio/wav" } } -- example vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.SessionCreated, callback = function(args) ---@type HermesSessionCreated local data = args.data local sessionId = data.sessionId local prompt_id = hermes.prompt(sessionId, { type = ContentType.text, text = "What time is it?" }) end, }) ``` > **Triggers:** [Prompted](#prompted) autocommand upon completion. ### βž• Create Session Create a new session. If no arguments are provided, the session defaults to either the project root or the current directory. ```lua local hermes = require("hermes") local McpServerType = hermes.McpServerType -- use default session configuration hermes.create_session() -- customize connection configuration hermes.create_session({ cwd = ".", -- path to create the session in (optional) additional_directories = {}, -- more directories to include in addition to the root directory (relative paths are relative to cwd) mcp_servers = { { -- Http or Sse MCP server definition type = McpServerType.http, -- or "sse" name = "Human readable name for MCP server", url = "http://url-to-mcp-server.com", headers = { { ["Content-Type"] = "application/json" }, { header_name = "header value" }, }, }, { -- Stdio MCP server definition type = McpServerType.stdio, name = "Human readable name for MCP server", command = "/path/to/the/MCP/server/executable", args = { "run", "--flag", "something" }, -- Environment variables to set when launching the MCP server. env = { { name = "ENVIRONMENT_VAR_NAME", value = "value" }, }, }, }, }) ``` > **Triggers:** [SessionCreated](#sessioncreated) autocommand upon completion. ### πŸ“‚ Load Session (**Optional**) Load an existing session (replays session history) ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand local McpServerType = hermes.McpServerType local session_id = "some-session-id" -- call signature (uses defaults) hermes.load_session(session_id) -- call signature (with further configuration) hermes.load_session(session_id, { cwd = ".", -- path to load the session from (optional, defaults to either project root or current directory) additional_directories = {}, -- more directories to include in addition to the root directory (relative paths are relative to cwd) mcp_servers = { { -- Http or Sse MCP server definition type = McpServerType.http, -- or "sse" name = "Human readable name for MCP server", url = "http://url-to-mcp-server.com", headers = { { ["Content-Type"] = "application/json" }, { header_name = "header value" }, }, }, { -- Stdio MCP server definition type = McpServerType.stdio, name = "Human readable name for MCP server", command = "/path/to/the/MCP/server/executable", args = { "run", "--flag", "something" }, -- Environment variables to set when launching the MCP server. env = { { name = "ENVIRONMENT_VAR_NAME", value = "value" }, }, }, }, }) -- example vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.SessionCreated, callback = function(args) ---@type HermesSessionCreated local data = args.data local session_id = data.sessionId hermes.load_session(session_id) end, }) ``` > **Triggers:** [SessionLoaded](#sessionloaded) autocommand upon completion ### ▢️ Resume Session (**Optional**) Resume an existing session (without replaying the session history) ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand local McpServerType = hermes.McpServerType local session_id = "some-session-id" -- call signature (uses defaults) hermes.resume_session(session_id) -- call signature (with further configuration) hermes.resume_session(session_id, { cwd = ".", -- path to load the session from (optional, defaults to either project root or current directory) additional_directories = {}, -- more directories to include in addition to the root directory (relative paths are relative to cwd) mcp_Servers = { { -- Http or Sse MCP server definition type = McpServerType.http, -- or "sse" name = "Human readable name for MCP server", url = "http://url-to-mcp-server.com", headers = { { ["Content-Type"] = "application/json" }, { header_name = "header value" }, }, }, { -- Stdio MCP server definition type = McpServerType.stdio, name = "Human readable name for MCP server", command = "/path/to/the/MCP/server/executable", args = { "run", "--flag", "something" }, -- Environment variables to set when launching the MCP server. env = { { name = "ENVIRONMENT_VAR_NAME", value = "value" }, }, }, }, }) -- example vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.SessionCreated, callback = function(args) ---@type HermesSessionCreated local data = args.data local session_id = data.sessionId hermes.resume_session(session_id) end, }) ``` > **Triggers:** [SessionResumed](#sessionresumed) autocommand upon completion ### πŸ“‹ List Sessions (**Optional**) List sessions, can be filtered by project path or cursor pagination. ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand -- list all sessions hermes.list_sessions() -- filter by directory hermes.list_sessions({ cwd = "/path/to/directory", }) -- filter by cursor based pagination hermes.list_sessions({ cursor = "abc123", }) -- example vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.SessionsListed, callback = function(args) ---@type HermesSessionsListed local data = args.data local next_page = data.nextCursor -- get next page of sessions with this cursor in the current directory hermes.list_sessions({ cwd = vim.fn.getcwd(), cursor = next_page, }) end, }) ``` > **Triggers:** [SessionsListed](#sessionslisted) autocommand upon completion ### ❌ Close Session (**Optional**) Close active session and free all resources associated with it ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand local session_id = "session-id-from-create-session-response" -- call signature hermes.close_session(session_id) -- example vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.SessionCreated, callback = function(args) ---@type HermesSessionCreated local data = args.data local session_id = data.sessionId hermes.close_session(session_id) end, }) ``` > **Triggers:** [SessionClosed](#sessionclosed) autocommand upon completion ### πŸ—‘οΈ Delete Session (**Optional**) Delete session from the session list ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand local session_id = "session-id-from-create-session-response" -- call signature hermes.delete_session(session_id) -- delete multiple sessions hermes.delete_session({ session_id, "other-session-id" }) -- cancel session(s) before deleting them (defaults to true; set to false to disable this behavior) hermes.delete_session(session_id, { cancel = true }) -- example vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.SessionCreated, callback = function(args) ---@type HermesSessionCreated local data = args.data local session_id = data.sessionId hermes.delete_session(session_id) end, }) ``` > **Triggers:** [SessionDeleted](#sessiondeleted) autocommand upon completion > [!WARNING] ### ⏹️ Cancel (**Optional**) Cancel the current operation of the agent (e.g., stop generating text, stop a tool call in progress, etc). ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand local session_id = 'session-id-from-create-session-response' -- call signature (session ID or pending request ID) hermes.cancel(session_id) -- example vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.PermissionRequest, callback = function(args) ---@type HermesPermissionRequest local data = args.data local request_id = data.requestId hermes.cancel(request_id) end, }) ``` > **Triggers:** [RequestCancelled](#requestcancelled) autocommand upon completion. > [!NOTE] > [RequestCancelled](#requestcancelled) may also be triggered by the agent (agents can cancel requests) ### 🎯 Set mode (**Optional**) Set what mode the agent is in (the plan/build modes for opencode for example) ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand local session_id = "some-session-id" local mode_id = "some-mode-id" -- call signature hermes.set_mode(session_id, mode_id) -- example vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.ModeUpdated, callback = function(args) ---@type HermesModeUpdated local data = args.data print("Mode changed to: " .. data.name) end, }) ``` > **Triggers:** [ModeUpdated](#modeupdated) autocommand upon completion. ### 🎯 Modes Get the selectable modes for a session. ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand -- call signature hermes.modes(session_id) -- example vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.Modes, callback = function(args) ---@type HermesModes local data = args.data local options = data.options for _, option in ipairs(options) do print("Mode: " .. option.name .. " (value: " .. option.value .. ")") end end, }) ``` > **Triggers:** [Modes](#modes-1) autocommand with a `Selection` payload containing: > - `options` (array): Available mode options > - `current` (object): The currently selected mode ### 🧠 Set model (**Optional**) Set what model the agent is using. ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand -- call signature hermes.set_model(sessionId, modelId) -- example vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.SessionModelUpdated, callback = function(args) ---@type HermesSessionModelUpdated local data = args.data print("Model changed to: " .. data.name) end, }) ``` > **Triggers:** [SessionModelUpdated](#sessionmodelupdated) autocommand upon completion. ### 🧠 Models Get the selectable models for a session. ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand local session_id = "some-session-id" -- call signature hermes.models(session_id) -- example vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.Models, callback = function(args) ---@type HermesModels local data = args.data local options = data.options for _, option in ipairs(options) do print("Model: " .. option.name .. " (value: " .. option.value .. ")") end end, }) ``` > **Triggers:** [Models](#models-1) autocommand with a `Selection` payload containing: > - `options` (array): Available model options > - `current` (object): The currently selected model ### βš™οΈ Model configurations Get the model configuration options for a session. ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand -- call signature hermes.model_configurations(session_id) -- example vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.ModelConfigurations, callback = function(args) ---@type HermesModelConfigurations local configs = args.data for _, config in ipairs(configs) do print("Config: " .. config.name .. " (current: " .. config.selection.current.value .. ")") end end, }) ``` > **Triggers:** [ModelConfigurations](#modelconfigurations) autocommand with an array of model configuration options. ### βš™οΈ Configure model (**Optional**) Configure a model option for a session. Takes a table with `id` and `value` keys. ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand -- call signature hermes.configure_model(session_id, { id = "context_size", value = "200k" }) -- example vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.ModelConfigurationUpdated, callback = function(args) print("Model configuration updated") end, }) ``` > **Triggers:** [ModelConfigurationUpdated](#modelconfigurationupdated) autocommand upon completion. ### πŸ’­ Set thought_level (**Optional**) Set the thought level for a session. ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand -- call signature hermes.set_thought_level(sessionId, thoughtLevelId) -- example vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.ThoughtLevelUpdated, callback = function(args) ---@type HermesThoughtLevelUpdated local data = args.data print("Thought level changed to: " .. data.name) end, }) ``` > **Triggers:** [ThoughtLevelUpdated](#thoughtlevelupdated) autocommand upon completion. ### πŸ’­ Thought levels Get the selectable thought levels for a session. ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand -- call signature hermes.thought_levels(session_id) -- example vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.ThoughtLevels, callback = function(args) ---@type HermesThoughtLevels local data = args.data local options = data.options for _, option in ipairs(options) do print("Thought Level: " .. option.name .. " (value: " .. option.value .. ")") end end, }) ``` > **Triggers:** [ThoughtLevels](#thoughtlevels) autocommand with a `Selection` payload containing: > - `options` (array): Available thought level options > - `current` (object): The currently selected thought level ### βš™οΈ Config options Get all configuration options available for a session. ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand -- call signature hermes.config_options(session_id) -- example vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.ConfigOptions, callback = function(args) ---@type HermesConfigOptions local options = args.data for _, option in ipairs(options) do print(option.name .. " (" .. option.type .. ") = " .. tostring(option.currentValue)) end end, }) ``` > **Triggers:** [ConfigOptions](#configoptions) autocommand with the array of all > configuration options. ### βš™οΈ Set config option (**Optional**) Set a single configuration option by id. Takes a table with `id` and `value` keys. `value` may be a string (for select options) or a boolean (for boolean options). ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand -- call signature hermes.set_config_option(session_id, { id = "brave_mode", value = true }) -- example: toggle a boolean option whenever the agent reports new values vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.ConfigOptions, callback = function(args) ---@type HermesConfigOptions local options = args.data for _, option in ipairs(options) do if option.id == "brave_mode" then hermes.set_config_option(session_id, { id = option.id, value = not option.currentValue, }) end end end, }) ``` > **Triggers:** [ConfigurationUpdated](#configurationupdated) autocommand upon completion. ### ↩️ Respond When an agent makes a request that requires user input (such as a permission request), it triggers an autocommand and pauses until the user responds. Use the `respond` method with the request ID to resume the agent's operation. If no autocommand handler is defined, a default workflow will be triggered. Requests can be disabled via the setup configuration. > [!WARNING] > While Hermes is a complete ACP client, most agents available today don't fully utilize the protocol. The following autocommands are [optional features](https://agentclientprotocol.com/protocol/overview#optional-methods-2) and often handled through agent-specific tools rather than calling the ACP methods that trigger them. This means some Hermes capabilities may not be exercised depending on which agent you use. #### πŸ”’ Permission request ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand -- call signature hermes.respond("requestId", "optionId") -- example: vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.PermissionRequest, callback = function(args) ---@type HermesPermissionRequest local data = args.data local selected_option_id = table.remove(data.options).id -- select id somehow local request_id = data.requestId hermes.respond(request_id, selected_option_id) end, }) ``` > **Responds to:** [PermissionRequest](#permissionrequest) autocommand. > > **Default behavior:** If no autocommand handler is defined for `PermissionRequest`, Hermes will use the native Neovim select menu to gather a response from the user. #### ✏️ Write to file ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand -- call signature hermes.respond("requestId") -- example: vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.WriteTextFile, callback = function(args) ---@type HermesWriteTextFile local data = args.data local request_id = data.requestId -- writing to a file doesn't take any data, but a notification is required when it is finished hermes.respond(request_id) end, }) ``` > **Responds to:** [WriteTextFile](#writetextfile) autocommand. > > **Default behavior:** If no autocommand handler is defined for `WriteTextFile`, Hermes will: > - Update buffers if they are open and mark them as modified (will not automatically save) > - Refresh the view of any modified buffers > - Write to the file on disk if it is not open in a buffer #### πŸ“– Read from file ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand -- call signature hermes.respond("requestId", "Hello World!") -- example: vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.ReadTextFile, callback = function(args) ---@type HermesReadTextFile local data = args.data local requestId = data.requestId local filename = data.path local _start = data.line -- optional, may not be provided by the agent local _end = data.limit -- optional, may not be provided by the agent local file = io.open(filename, "r") local content = file:read("*all") file:close() hermes.respond(requestId, content) end, }) ``` > **Responds to:** [ReadTextFile](#readtextfile) autocommand. > > **Default behavior:** If no autocommand handler is defined for `ReadTextFile`, Hermes will: > - Read the file from disk if one is not open in a buffer > - Read the current state of the open buffer if the target file is open > - Start at the `line` number if defined > - End at the `limit` number if defined #### πŸ”‘ Authentication via terminal ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand -- simple boolean response, true if successful, false if authentication failed local successfully_authenticated = true; -- call signature hermes.respond("requestId", successfully_authenticated); vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.TerminalAuthentication, callback = function(event) ---@type HermesTerminalAuthentication local data = event.data local request_id = data.requestId -- set up commands local cmd = vim.list_extend({ data.command }, data.args or {}) local env = vim.tbl_extend("force", vim.fn.environ(), data.env or {}) -- trigger authentication flow vim.api.nvim_command("botright new") vim.fn.termopen(cmd, { env = env, on_exit = function(_, exit_code) hermes.respond(request_id, exit_code == 0) end, }) end, }) ``` > **Responds to:** [TerminalAuthentication](#terminalauthentication) autocommand. > > **Default behavior:** If no autocommand handler is defined for `TerminalAuthentication`, Hermes will: > - Report terminal authentication as unsupported (no default can be applied) #### πŸ’» Create Terminal for agent communication ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand local terminals = {} -- call signature hermes.respond("requestId", "terminalId") -- example: vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.TerminalCreate, callback = function(event) ---@type HermesTerminalCreate local data = event.data local terminal_id = "your-generated-terminal-id" -- generate a unique id for terminal local request_id = data.requestId local command = data.command local term_args = data.args or {} local byte_limit = data.outputByteLimit -- lua combines args and command (add command to the beginning of args) table.insert(term_args, 1, command) terminals[terminal_id] = vim.fn.jobstart(term_args, { env = data.env, cwd = data.cwd, }) hermes.respond(request_id, terminal_id); end, }) ``` > **Responds to:** [TerminalCreate](#terminalcreate) autocommand. > > **Default behavior:** If no autocommand handler is defined for `TerminalCreate`, Hermes will: > - Create a terminal attached to a buffer (hidden by default) > - Handle byte limit constraints if defined > [!WARNING] > If no `TerminalCreate` autocommand is registered, Hermes will use default functionality to manage **all** subsequent terminal interaction. #### πŸ“€ Provide terminal output to the assistant ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand local terminals = {} local is_truncated = true; -- call signature (truncated defaults to false) hermes.respond("requestId", "terminal output text") -- call signature with truncation defined hermes.respond("requestId", { output = "terminal output text", truncated = is_truncated, }) -- example: vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.TerminalOutput, callback = function(args) ---@type HermesTerminalOutput local data = args.data local requestId = data.requestId local terminalId = data.terminalId local terminalOutput = terminals[terminalId].output -- get output somehow hermes.respond(requestId, terminalOutput); end, }) ``` > **Responds to:** [TerminalOutput](#terminaloutput) autocommand. > > **Default behavior:** If no autocommand handler is defined for [TerminalCreate](#terminalcreate), Hermes will: > - Collect and send the terminal output to the agent #### πŸšͺ Reporting terminal exit ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand local terminals = {} -- call signature for termination signal hermes.respond("requestId", "SIGTERM") -- call signature for exit code hermes.respond("requestId", 0) -- call signature with exit code and termination signal hermes.respond("requestId", { exitCode = 9, signal = "SIGKILL" }) -- example: vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.TerminalExit, callback = function(args) ---@type HermesTerminalExit local data = args.data local requestId = data.requestId local terminalId = data.terminalId hermes.respond(requestId, { exitCode = terminals[terminalId].exitCode, -- get output somehow signal = terminals[terminalId].signal, -- get output somehow }); end, }) ``` > **Responds to:** [TerminalExit](#terminalexit) autocommand. > > **Default behavior:** If no autocommand handler is defined for [TerminalCreate](#terminalcreate), Hermes will: > - Wait for and report terminal exit details #### ⚑ Kill terminal process ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand local terminals = {} -- call signature with exit code and termination signal hermes.respond("requestId") -- example: vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.TerminalKill, callback = function(args) ---@type HermesTerminalKill local data = args.data local request_id = data.requestId hermes.respond(request_id); end, }) ``` > **Responds to:** [TerminalKill](#terminalkill) autocommand. > > **Default behavior:** If no autocommand handler is defined for [TerminalCreate](#terminalcreate), Hermes will: > - Stop the process running in the terminal #### πŸ”“ Release terminal process ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand local terminals = {} -- call signature with exit code and termination signal hermes.respond("requestId") -- example: vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.TerminalRelease, callback = function(args) ---@type HermesTerminalRelease local data = args.data local request_id = data.requestId hermes.respond(request_id); end, }) ``` > **Responds to:** [TerminalRelease](#terminalrelease) autocommand. > > **Default behavior:** If no autocommand handler is defined for [TerminalCreate](#terminalcreate), Hermes will: > - Stop any process running in the terminal > - Remove the terminal > - Delete the attached buffer (can be configured to omit this step) #### πŸ“‹ User/Form input (elicitation) ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand local ElicitationAction = hermes.ElicitationAction -- Accept and provide content for the requested fields: hermes.respond("requestId", { action = ElicitationAction.accept, content = { name = "Alice", age = 30 }, }) -- Decline without providing content: hermes.respond("requestId", { action = ElicitationAction.decline }) -- Cancel the elicitation entirely: hermes.respond("requestId", { action = ElicitationAction.cancel }) -- example: vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.FormElicitation, callback = function(args) ---@type HermesFormElicitation local data = args.data local requestId = data.requestId local mode = data.mode -- "form" local message = data.message -- the prompt shown to the user hermes.respond(requestId, { action = ElicitationAction.accept, content = { name = vim.fn.input(message .. ": ") }, }) end, }) ``` > **Responds to:** [FormElicitation](#formelicitation) autocommand. > > **Default behavior:** If no autocommand handler is defined for [FormElicitation](#formelicitation), Hermes will: > - Report that form elicitation is not a supported capability > - Cancel any elicitation requests it may receive (should not happen when capabilities are reported as unsupported) #### πŸ”— Browser input (elicitation) ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand local ElicitationAction = hermes.ElicitationAction -- Decline without providing content: hermes.respond("requestId", { action = ElicitationAction.decline }) -- Cancel the elicitation entirely: hermes.respond("requestId", { action = ElicitationAction.cancel }) -- example: vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.UrlElicitation, callback = function(args) ---@type HermesUrlElicitation local data = args.data local requestId = data.requestId hermes.respond(requestId, { action = ElicitationAction.decline }) end, }) ``` > **Responds to:** [UrlElicitation](#urlelicitation) autocommand. > > **Default behavior:** If no autocommand handler is defined for [UrlElicitation](#urlelicitation), Hermes will: > - Report that url elicitation is not a supported capability > - Cancel any elicitation requests it may receive (should not happen when capabilities are reported as unsupported) ## πŸ“‘ Autocommands Hermes generates autocommands for all communication between agent and client. Here's an example of hooking into one: ```lua local hermes = require("hermes") local Autocommand = hermes.Autocommand vim.api.nvim_create_autocmd("User", { group = "hermes", pattern = Autocommand.AgentTextMessage, callback = function(args) ---@type HermesAgentTextMessage local data = args.data print("Received some text from our assistant: " .. data.update.content.text) end, }) ``` Below is a list of all autocommands and their associated data (passed to the callback in the `args.data` field). Hermes will only trigger autocommands if there is a listener defined for it (I.E. You have created one like the example above) > [!TIP] > Every autocommand's payload has a corresponding LuaLS class named after the autocommand (e.g. `AgentTextMessage` delivers a `HermesAgentTextMessage` payload, `PermissionRequest` delivers a `HermesPermissionRequest`, `ConfigOptions` delivers a `HermesConfigOptions` array). Cast `args.data` inside your callback β€” as in the example above β€” to get completion and type checking for the payload fields.
Autocommand Description Source Schema
AgentImageMessage An image from the agent πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "agent_message_chunk",
    "content": {
      "type": "image",
      "data": "base64 string",
      "mimeType": "string",
      "uri": "string (optional)",
      "annotations": { "audience": [], "priority": 1 }
    }
  }
}
AgentImageThought Visual reasoning/thought from the agent πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "agent_thought_chunk",
    "content": {
      "type": "image",
      "data": "base64 string",
      "mimeType": "string",
      "uri": "string (optional)",
      "annotations": { "audience": [], "priority": 1 }
    }
  }
}
AgentList List of available agents ⚑ agents()
{
  "agents": [
    {
      "id": "string",
      "name": "string",
      "version": "string",
      "license": "string",
      "description": "string",
      "website": "url string",
      "repository": "url string",
      "icon": "url string",
      "icon_pixel_data": { "width": 16, "height": 16, "pixels": [0] },
      "distributions": ["binary", "npx", "uvx"]
    }
  ]
}
AgentResourceLinkMessage A resource link from the agent πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "agent_message_chunk",
    "content": {
      "type": "resource_link",
      "name": "string",
      "uri": "string",
      "description": "string (optional)",
      "mimeType": "string (optional)",
      "size": "number (optional)",
      "title": "string (optional)",
      "annotations": { "audience": [], "priority": 1 }
    }
  }
}
AgentResourceLinkThought Resource link thought from the agent πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "agent_thought_chunk",
    "content": {
      "type": "resource_link",
      "name": "string",
      "uri": "string",
      "description": "string (optional)",
      "mimeType": "string (optional)",
      "size": "number (optional)",
      "title": "string (optional)",
      "annotations": { "audience": [], "priority": 1 }
    }
  }
}
AgentResourceMessage A resource from the agent πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "agent_message_chunk",
    "content": {
      "type": "resource",
      "resource": {
        "text": "string (if text resource)",
        "blob": "string (if blob resource)",
        "uri": "string",
        "mimeType": "string (optional)"
      },
      "annotations": { "audience": [], "lastModified": "string" }
    }
  }
}
AgentResourceThought Resource-based thought from the agent πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "agent_thought_chunk",
    "content": {
      "type": "resource",
      "resource": {
        "text": "string (if text resource)",
        "blob": "string (if blob resource)",
        "uri": "string",
        "mimeType": "string (optional)"
      },
      "annotations": { "audience": [], "lastModified": "string" }
    }
  }
}
AgentTextMessage A text message from the agent πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "agent_message_chunk",
    "content": {
      "type": "text",
      "text": "string",
      "annotations": { "audience": [], "priority": 1 }
    }
  }
}
AgentTextThought Textual thought/reasoning from the agent πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "agent_thought_chunk",
    "content": {
      "type": "text",
      "text": "string",
      "annotations": { "audience": [], "priority": 1 }
    }
  }
}
Authenticated Authentication completed ⚑ authenticate()
{
}
AvailableCommands Available commands are updated πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "available_commands_update",
    "availableCommands": [
      {
        "id": "string",
        "name": "string",
        "description": "string (optional)"
      }
    ]
  }
}
CompactionSummaryChunk Streamed chunk of a compaction summary πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "compaction_summary_chunk",
    "compactionId": "string",
    "content": {
      "type": "text",
      "text": "string"
    }
  }
}
CompactionUpdate Status update for a context compaction πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "compaction_update",
    "compactionId": "string",
    "status": "in_progress",
    "summary": [
      { "type": "text", "text": "string" }
    ],
    "error": "string (optional)"
  }
}
ConfigOptions All configuration options for a session ⚑ config_options()
[
  {
    "id": "string",
    "name": "string",
    "description": "string (optional)",
    "category": "string (optional)",
    "type": "boolean",
    "currentValue": true
  }
]
ConfigurationOption Configuration option updates πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "config_option_update",
    "configOptions": [
      {
        "id": "string",
        "name": "string",
        "description": "string (optional)",
        "category": "string (optional)",
        "type": "select",
        "currentValue": "string",
        "options": [
          { "value": "string", "name": "string", "description": "string (optional)" }
        ]
      }
    ]
  }
}
ConfigurationUpdated Session configuration updated ⚑ set_config_option() / configure_model()
{
  "configOptions": [
    {
      "id": "string",
      "name": "string",
      "description": "string (optional)",
      "category": "string (optional)",
      "type": "select",
      "currentValue": "string",
      "options": [
        { "value": "string", "name": "string", "description": "string (optional)" },
        {
          "group": "string",
          "name": "string",
          "options": [
            { "value": "string", "name": "string", "description": "string (optional)" }
          ]
        }
      ]
    }
  ]
}
ConnectionInitialized Connection established with agent ⚑ connect()
{
  "protocolVersion": "string",
  "agentCapabilities": {
    "loadSession": "boolean",
    "promptCapabilities": {
      "image": "boolean",
      "audio": "boolean",
      "embeddedContext": "boolean"
    },
    "mcpCapabilities": {
      "http": "boolean",
      "sse": "boolean",
      "acp": "boolean"
    },
    "sessionCapabilities": {
      "list": "boolean",
      "fork": "boolean",
      "resume": "boolean",
      "close": "boolean",
      "additionalDirectories": "boolean",
      "delete": "boolean"
    },
    "auth": {
      "logout": "boolean"
    }
  },
  "authMethods": [
    {
      "id": "string",
      "name": "string",
      "description": "string (optional)"
    }
  ],
  "agentInfo": {
    "name": "string",
    "version": "string",
    "title": "string (optional)"
  }
}
ElicitationComplete Agent notifies that an elicitation has completed πŸ€– Agent (notification)
{
  "elicitationId": "uuid string"
}
FormElicitation Agent requests form-based elicitation (structured user input) πŸ€– Agent (requires -> respond())
{
  "requestId": "uuid string",
  "mode": "form",
  "scope": { ... },
  "schema": { ... },
  "message": "string"
}
LoggedOut Agent logout completed ⚑ logout()
{}
ModeCurrent Current mode changes πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "current_mode_update",
    "currentModeId": "string"
  }
}
ModelConfigurations Available model configuration options retrieved ⚑ model_configurations()
[{
  "id": "string",
  "name": "string",
  "description": "string (optional)",
  "selection": {
    "options": [
      {
        "value": "string",
        "name": "string",
        "description": "string (optional)",
        "group": "string (optional)"
      }
    ],
    "current": {
      "value": "string",
      "name": "string",
      "description": "string (optional)",
      "group": "string (optional)"
    }
  }
}]
ModelConfigurationUpdated Model configuration options updated ⚑ configure_model()
[{
  "id": "string",
  "name": "string",
  "description": "string (optional)",
  "selection": {
    "options": [
      {
        "value": "string",
        "name": "string",
        "description": "string (optional)",
        "group": "string (optional)"
      }
    ],
    "current": {
      "value": "string",
      "name": "string",
      "description": "string (optional)",
      "group": "string (optional)"
    }
  }
}]
Models Available models retrieved ⚑ models()
{
  "options": [
    {
      "value": "string",
      "name": "string",
      "description": "string (optional)",
      "group": "string (optional)"
    }
  ],
  "current": {
    "value": "string",
    "name": "string",
    "description": "string (optional)",
    "group": "string (optional)"
  }
}
Modes Available modes retrieved ⚑ modes()
{
  "options": [
    {
      "value": "string",
      "name": "string",
      "description": "string (optional)",
      "group": "string (optional)"
    }
  ],
  "current": {
    "value": "string",
    "name": "string",
    "description": "string (optional)",
    "group": "string (optional)"
  }
}
ModeUpdated Session mode changed ⚑ set_mode()
{
  "value": "string",
  "name": "string",
  "description": "string (optional)",
  "group": "string (optional)"
}
Notice Informational notice for the user πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "notice",
    "severity": "info",
    "title": "string",
    "description": "string (optional)"
  }
}
PermissionRequest Agent requests permission to execute a tool πŸ€– Agent (requires -> respond())
{
  "requestId": "uuid string",
  "sessionId": "string",
  "toolCall": {
    "toolCallId": "string",
    "kind": "Read | Edit | Delete | Move | Search | Execute | Think | Fetch | SwitchMode | Other (optional)",
    "status": "Pending | InProgress | Completed | Cancelled | Error (optional)",
    "title": "string (optional)",
    "name": "string (optional)",
    "content": [
      {
        "type": "content",
        "content": {
          "type": "text",
          "text": "I need to read src/main.rs"
        }
      },
      {
        "type": "content",
        "content": {
          "type": "image",
          "data": "iVBORw0KGgo...",
          "mimeType": "image/png"
        }
      },
      {
        "type": "content",
        "content": {
          "type": "audio",
          "data": "UklGRiT0...",
          "mimeType": "audio/wav"
        }
      },
      {
        "type": "content",
        "content": {
          "type": "resource",
          "resource": {
            "text": "def hello():\n    print('hello')",
            "uri": "file:///home/user/script.py",
            "mimeType": "text/x-python"
          }
        }
      },
      {
        "type": "content",
        "content": {
          "type": "resource_link",
          "name": "Documentation",
          "uri": "file:///docs/api.md"
        }
      },
      {
        "type": "diff",
        "path": "src/main.rs",
        "oldText": "let x = 1;",
        "newText": "let x = 2;"
      },
      {
        "type": "terminal",
        "terminalId": "term-abc123"
      }
    ],
    "locations": [{ "path": "string", "line": "number (optional)" }],
    "rawInput": "JSON value (optional)",
    "rawOutput": "JSON value (optional)"
  },
  "options": [{ "id": "string", "label": "string", "description": "string (optional)" }]
}
Plan Agent generates a plan πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "plan",
    "entries": [
      { "content": "string", "priority": "High | Medium | Low", "status": "Pending | InProgress | Completed | Cancelled" }
    ]
  }
}
Progress Download progress update (binary, registry, agent) ⚑ :Hermes install, :Hermes update, agents(), connect(), setup()
{
  "id": "string",
  "title": "string",
  "source": "string",
  "status": "running | success | failure",
  "percent": "number (optional)",
  "text": ["string (optional)"]
}
Prompted Agent response received ⚑ prompt()
{
  "stopReason": "string (e.g., 'Stop', 'Cancelled', 'Error')"
}
ReadTextFile Agent requests to read a text file πŸ€– Agent (requires -> respond())
{
  "requestId": "uuid string",
  "sessionId": "string",
  "path": "string",
  "line": "number (optional, 1-based)",
  "limit": "number (optional, max lines to read)"
}
RequestCancelled Cancelled a pending request (Can be triggered by the user or the agent) πŸ€– Agent (notification), ⚑ cancel()
{
  "requestId": "uuid string",
  "sessionId": "string"
}
SessionClosed Active session closed ⚑ close_session()
{
  "sessionId": "string"
}
SessionCreated New session created ⚑ create_session()
{
  "sessionId": "string",
  "modes": {
    "currentModeId": "string",
    "availableModes": [
      {
        "id": "string",
        "name": "string",
        "description": "string (optional)"
      }
    ]
  },
  "configOptions": [
    {
      "id": "string",
      "name": "string",
      "description": "string (optional)",
      "category": "string (optional)",
      "type": "select",
      "currentValue": "string",
      "options": [
        { "value": "string", "name": "string", "description": "string (optional)" },
        {
          "group": "string",
          "name": "string",
          "options": [
            { "value": "string", "name": "string", "description": "string (optional)" }
          ]
        }
      ]
    }
  ]
}
SessionDeleted Session deleted ⚑ delete_session()
{
  "sessionId": "string"
}
SessionForked Session forked successfully ⚑ fork_session()
{
  "sessionId": "string",
  "modes": {
    "currentModeId": "string",
    "availableModes": [
      {
        "id": "string",
        "name": "string",
        "description": "string (optional)"
      }
    ]
  },
  "configOptions": [
    {
      "id": "string",
      "name": "string",
      "description": "string (optional)",
      "category": "string (optional)",
      "type": "select",
      "currentValue": "string",
      "options": [
        { "value": "string", "name": "string", "description": "string (optional)" },
        {
          "group": "string",
          "name": "string",
          "options": [
            { "value": "string", "name": "string", "description": "string (optional)" }
          ]
        }
      ]
    }
  ]
}
SessionLoaded Session loaded successfully ⚑ load_session()
{
  "modes": {
    "currentModeId": "string",
    "availableModes": [
      {
        "id": "string",
        "name": "string",
        "description": "string (optional)"
      }
    ]
  },
  "configOptions": [
    {
      "id": "string",
      "name": "string",
      "description": "string (optional)",
      "category": "string (optional)",
      "type": "select",
      "currentValue": "string",
      "options": [
        { "value": "string", "name": "string", "description": "string (optional)" },
        {
          "group": "string",
          "name": "string",
          "options": [
            { "value": "string", "name": "string", "description": "string (optional)" }
          ]
        }
      ]
    }
  ]
}
SessionModelUpdated Session model updated ⚑ set_model()
{
  "value": "string",
  "name": "string",
  "description": "string (optional)",
  "group": "string (optional)"
}
SessionResumed Session resumed successfully ⚑ resume_session()
{
  "modes": {
    "currentModeId": "string",
    "availableModes": [
      {
        "id": "string",
        "name": "string",
        "description": "string (optional)"
      }
    ]
  },
  "configOptions": [
    {
      "id": "string",
      "name": "string",
      "description": "string (optional)",
      "category": "string (optional)",
      "type": "select",
      "currentValue": "string",
      "options": [
        { "value": "string", "name": "string", "description": "string (optional)" },
        {
          "group": "string",
          "name": "string",
          "options": [
            { "value": "string", "name": "string", "description": "string (optional)" }
          ]
        }
      ]
    }
  ]
}
SessionsListed Session list received ⚑ list_sessions()
{
  "sessions": [
    {
      "sessionId": "string",
      "cwd": "string",
      "additionalDirectories": ["string"],
      "title": "string (optional)",
      "updatedAt": "string (optional)"
    }
  ],
  "nextCursor": "string (optional)"
}
SessionUpdate Session metadata updated (title, timestamps, etc.) πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "session_info_update",
    "title": "string (optional)",
    "updatedAt": "string (optional)"
  }
}
TerminalAuthentication Terminal auth method selected, run it in a terminal ⚑ authenticate()
{
  "requestId": "uuid string",
  "id": "string",
  "name": "string",
  "description": "string (optional)",
  "args": ["string"],
  "env": {"key": "value"},
  "command": "string"
}
TerminalCreate Agent requests to create a terminal for command execution πŸ€– Agent (requires -> respond())
{
  "requestId": "uuid string",
  "sessionId": "string",
  "command": "string",
  "args": ["string"],
  "env": [{"name": "string", "value": "string"}],
  "cwd": "string (optional)",
  "outputByteLimit": "number (optional)"
}
TerminalExit Agent requests notification when terminal process exits πŸ€– Agent (requires -> respond())
{
  "requestId": "uuid string",
  "sessionId": "string",
  "terminalId": "string"
}
TerminalKill Agent requests to kill a terminal process πŸ€– Agent (requires -> respond())
{
  "requestId": "uuid string",
  "sessionId": "string",
  "terminalId": "string",
  "signal": "string (optional, e.g., 'SIGTERM', 'SIGKILL')"
}
TerminalOutput Agent requests terminal output πŸ€– Agent (requires -> respond())
{
  "requestId": "uuid string",
  "sessionId": "string",
  "terminalId": "string",
  "byteLimit": "number (optional)"
}
TerminalRelease Agent requests to release a terminal πŸ€– Agent (requires -> respond())
{
  "requestId": "uuid string",
  "sessionId": "string",
  "terminalId": "string"
}
ThoughtLevels Available thought levels retrieved ⚑ thought_levels()
{
  "options": [
    {
      "value": "string",
      "name": "string",
      "description": "string (optional)",
      "group": "string (optional)"
    }
  ],
  "current": {
    "value": "string",
    "name": "string",
    "description": "string (optional)",
    "group": "string (optional)"
  }
}
ThoughtLevelUpdated Session thought level updated ⚑ set_thought_level()
{
  "value": "string",
  "name": "string",
  "description": "string (optional)",
  "group": "string (optional)"
}
ToolCall Agent makes a tool call πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "tool_call",
    "toolCallId": "string",
    "title": "string",
    "name": "string (optional)",
    "kind": "Read | Edit | Delete | Move | Search | Execute | Think | Fetch | SwitchMode | Other",
    "status": "Pending | InProgress | Completed | Cancelled | Error",
    "content": [
      {
        "type": "content",
        "content": {
          "type": "text",
          "text": "I need to read src/main.rs"
        }
      },
      {
        "type": "content",
        "content": {
          "type": "image",
          "data": "iVBORw0KGgo...",
          "mimeType": "image/png"
        }
      },
      {
        "type": "content",
        "content": {
          "type": "audio",
          "data": "UklGRiT0...",
          "mimeType": "audio/wav"
        }
      },
      {
        "type": "content",
        "content": {
          "type": "resource",
          "resource": {
            "text": "def hello():\n    print('hello')",
            "uri": "file:///home/user/script.py",
            "mimeType": "text/x-python"
          }
        }
      },
      {
        "type": "content",
        "content": {
          "type": "resource_link",
          "name": "Documentation",
          "uri": "file:///docs/api.md"
        }
      },
      {
        "type": "diff",
        "path": "src/main.rs",
        "oldText": "let x = 1;",
        "newText": "let x = 2;"
      },
      {
        "type": "terminal",
        "terminalId": "term-abc123"
      }
    ],
    "locations": [
      {
        "path": "string",
        "line": "number (optional)"
      }
    ],
    "rawInput": "JSON value (optional)",
    "rawOutput": "JSON value (optional)"
  }
}
ToolCallUpdate Tool call is updated (e.g., progress, output) πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "tool_call_update",
    "toolCallId": "string",
    "kind": "Read | Edit | Delete | Move | Search | Execute | Think | Fetch | SwitchMode | Other (optional)",
    "status": "Pending | InProgress | Completed | Cancelled | Error (optional)",
    "title": "string (optional)",
    "name": "string (optional)",
    "content": [
      {
        "type": "content",
        "content": {
          "type": "text",
          "text": "I need to read src/main.rs"
        }
      },
      {
        "type": "content",
        "content": {
          "type": "image",
          "data": "iVBORw0KGgo...",
          "mimeType": "image/png"
        }
      },
      {
        "type": "content",
        "content": {
          "type": "audio",
          "data": "UklGRiT0...",
          "mimeType": "audio/wav"
        }
      },
      {
        "type": "content",
        "content": {
          "type": "resource",
          "resource": {
            "text": "def hello():\n    print('hello')",
            "uri": "file:///home/user/script.py",
            "mimeType": "text/x-python"
          }
        }
      },
      {
        "type": "content",
        "content": {
          "type": "resource_link",
          "name": "Documentation",
          "uri": "file:///docs/api.md"
        }
      },
      {
        "type": "diff",
        "path": "src/main.rs",
        "oldText": "let x = 1;",
        "newText": "let x = 2;"
      },
      {
        "type": "terminal",
        "terminalId": "term-abc123"
      }
    ],
    "locations": [
      {
        "path": "string",
        "line": "number (optional)"
      }
    ],
    "rawInput": "JSON value (optional)",
    "rawOutput": "JSON value (optional)"
  }
}
UrlElicitation Agent requests URL-based elicitation (direct user to a browser URL) πŸ€– Agent (requires -> respond())
{
  "requestId": "uuid string",
  "mode": "url",
  "scope": { ... },
  "url": "string",
  "message": "string"
}
UsageUpdate Session usage metrics update (tokens, cost) πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "usage_update",
    "used": "number (tokens used)",
    "size": "number (max context size)",
    "cost": {
      "amount": "number",
      "currency": "string (e.g., 'USD')"
    }
  }
}
UserImageMessage An image sent from the client πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "user_message_chunk",
    "content": {
      "type": "image",
      "data": "base64 string",
      "mimeType": "string",
      "uri": "string (optional)",
      "annotations": { "audience": [], "priority": 1 }
    }
  }
}
UserResourceLinkMessage A resource link from the client πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "user_message_chunk",
    "content": {
      "type": "resource_link",
      "name": "string",
      "uri": "string",
      "description": "string (optional)",
      "mimeType": "string (optional)",
      "size": "number (optional)",
      "title": "string (optional)",
      "annotations": { "audience": [], "priority": 1 }
    }
  }
}
UserResourceMessage A resource sent from the client πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "user_message_chunk",
    "content": {
      "type": "resource",
      "resource": {
        "text": "string (if text resource)",
        "blob": "string (if blob resource)",
        "uri": "string",
        "mimeType": "string (optional)"
      },
      "annotations": { "audience": [], "lastModified": "string" }
    }
  }
}
UserTextMessage Message text sent from the client πŸ€– Agent
{
  "sessionId": "string",
  "promptId": "uuid string",
  "update": {
    "sessionUpdate": "user_message_chunk",
    "content": {
      "type": "text",
      "text": "string",
      "annotations": {
        "audience": ["Role1", "Role2"],
        "lastModified": "ISO8601 string",
        "priority": "number"
      }
    }
  }
}
WriteTextFile Agent requests to write to a text file πŸ€– Agent (requires -> respond())
{
  "requestId": "uuid string",
  "sessionId": "string",
  "path": "string",
  "content": "string"
}
## πŸ“ Logging ### πŸ”½ Level Hermes defaults to `INFO` log level until configured via `setup()`. Configure log levels and formats via the `setup()` function: ```lua local hermes = require("hermes") local LogFormat = hermes.LogFormat hermes.setup({ log = { notification = { level = vim.log.levels.ERROR }, -- Per-target config message = { level = vim.log.levels.INFO, format = LogFormat.pretty -- Each target has its own format }, } }) ``` ### 🎨 Format Log formats can be configured per-target via `setup()`. Each target has its own format setting that defaults to "compact" if not specified: ```lua local hermes = require("hermes") local LogFormat = hermes.LogFormat hermes.setup({ log = { -- Each target has its own format (defaults to LogFormat.compact if not set): notification = { format = LogFormat.pretty }, message = { format = LogFormat.json }, file = { format = nil }, -- nil = use default (LogFormat.compact) } }) ``` Available formats: - **pretty** - Human-readable with colors and formatting - **compact** - Condensed single-line format (default) - **full** - Complete information including timestamps and metadata - **json** - Machine-readable JSON format ## πŸ₯ Health & Configuration details Run the health check to see full diagnostics including Neovim version, binary status, platform info, download tools, log files, registry binaries, and configuration. ``` :checkhealth hermes ``` ## πŸ”¨ Building from Source If your platform is not in the supported or you'd rather build it yourself, you can build from source: **Requirements:** - [Rust toolchain](https://rustup.rs/) (1.70 or later) **Scripted** Run the build command in Neovim: ```vim :Hermes build ``` This will: - Compile the Rust code with `cargo build --release` - Install the resulting binary in the correct location **Manual** ```bash git clone https://github.com/Ruddickmg/hermes.nvim.git cd hermes.nvim cargo build --release # Copy target/release/libhermes.* to your Neovim data directory ``` > [!NOTE] > Hermes can pre-render icons during the build step to avoid having to do so at runtime. > > Using the build script: > ```vim > :Hermes build with-icons > ``` > > Or building manually: > ```bash > cargo build --release --features with-icons > ``` ## πŸ“‹ TODO: -- functionality - [ ] Support "unstable"/proposed ACP methods - [ ] [Fork sessions](https://agentclientprotocol.com/rfds/session-fork) - [ ] [Agent Extensions via ACP Proxies](https://agentclientprotocol.com/rfds/proxy-chains) - [ ] [ACP over MCP](https://agentclientprotocol.com/rfds/mcp-over-acp) - [ ] [Represent deleted files in diff](https://agentclientprotocol.com/rfds/diff-delete) - [ ] [Configurable LLM Providers](https://agentclientprotocol.com/rfds/custom-llm-endpoint) - [ ] [Plan Operations Support](https://agentclientprotocol.com/rfds/plan-operations) - [ ] [End-Turn Token Usage](https://agentclientprotocol.com/rfds/end-turn-token-usage) - [ ] [Agent Authentication State Query](https://agentclientprotocol.com/rfds/get-auth-state) - [ ] [Subagent Sessions](https://agentclientprotocol.com/rfds/subagents) -- nice to haves - [ ] research RLM ([example](https://github.com/JaredStewart/coderlm))