itsflownium/mercury-hermes-rust-rewrite
حول
Mercury: a fast, native Rust rewrite of the Hermes Agent desktop app. A cross-platform AI agent for Windows, macOS and Linux with persistent memory and reviewable skill changes, no Electron.
الذكاء الاصطناعي وتعلّم الآلةالنمو المقاس للنجوم
- خلال 24 ساعة
- جارٍ جمع السجل
- خلال 7 أيام
- جارٍ جمع السجل
- خلال 15 يومًا
- جارٍ جمع السجل
- خلال شهر
- جارٍ جمع السجل
تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.
README.md
الأصلHermes Desktop — Rust rewrite
A native rewrite of the Hermes Agent desktop app in Rust. The UI is Iced and the agent engine (turns, streaming, tools, approvals, MCP, subagents) is Rust too, so the app is one native program: no Electron, Tauri, Node or bundled Chromium, and no separate Python backend to install. The only Python is the CPython interpreter embedded to run Python plugins (see Python plugins).
This is an independent community project, not an official Nous Research release. The upstream pull request is NousResearch/hermes-agent#159125.
Start with your first chat, the contributor guide, or the documentation index.
Download
| Platform | Download |
|---|---|
| macOS (Apple Silicon) | Hermes-macOS.zip |
| Windows (x64) | Hermes-windows-AMD64.zip |
| Linux (x86_64) | Hermes-linux-x86_64.tar.gz |
The Linux link is for the linux-v0.2.0 prerelease, which also includes a Debian package. The macOS and Windows links are for the v0.1.0 prerelease. Newer builds are on the releases page. Future macOS and Windows releases will also include a disk image and an installer, respectively. Settings › About can look for a newer release, download it and check its checksum.
Every build comes from the CI workflow, which runs the test suite on all three platforms, then starts each packaged app and requires its window. No build is notarized or signed with a developer certificate yet (the workflow signs when it is given certificates). On macOS, the first time you open the app, right-click it and choose Open. For the Linux tar archive, install WebKitGTK 4.1, GTK 3, and the X11 keyboard library (libxkbcommon-x11-0 on Ubuntu). The Debian package declares these dependencies.
Packages built from this revision embed Reliquary for native profile memory. Reliquary is MPL-2.0 software. Each package includes its exact source revision, source-archive link and license links in Reliquary-NOTICE (under Notices, the macOS app's Contents/Resources/Notices, or Linux's share/licenses/hermes). The corresponding source for the pinned revision is also available directly from GitHub.
To enable Perception for a Reliquary profile, configure General, Embedding and General Decision in Switchboard. Observation Contribution and Verify use the endpoint and model selected in General Decision. Perception waits when that route is unset. If you previously used the separate Perception picker, select a structured completion endpoint under General Decision. Mercury runs Perception on the profile’s writable General and project RELs. Enable Private PHY Perception to publish Observations in the active private PHY. Ordinary memory queries search Memories and current Observations across the chat’s assigned REL and active PHY using one ranked selection with exact owner-qualified references. Archive and Echo reads remain explicit REL operations.
Enable Reliquary Ego under Persistent memory on a Reliquary profile to use its approved Identity, Pins and verified summaries in native chats. The Identity occupies the profile's existing persona slot, which uses SOUL.md when there is no approved Identity. Enter /identity to view the current Identity or /identity <exact text> to open a draft for approval. The active PHY contains the approved Identity and the summary history. Ego controls and profile admission
Reliquary memory context retrieval
Choose Memory Context in Switchboard to set the Context Agent's completion endpoint. General serves those calls when the slot is unset.
When native Reliquary is active, general memory questions use Context retrieval by default. The read-only availability probe checks the profile's connected RELs and their granted parents, along with the active PHY. The notice names RELs where it found relevant evidence. memory_context_retrieval answers general memory questions in the turn's selected scope. Exact Archive, Echo, Memory, and Graph tools appear on the request carrying the checked package, with dispatch authorized after that request succeeds. Reliquary records admitted REL Memory use once per receiving turn. Earlier package IDs can be passed to another Context call in the same conversation. Set memory_context_enabled to false in the profile to use direct recall.
In an eligible native Reliquary chat, ask the assistant to remember something and it can call create_memory. It reports pending while Gateway commits the chat. Clients can read memory_retention on prompt.receipt with include_result enabled. Only saved confirms the Memory. Personal requests require an active writable private PHY.
Rust vs Electron benchmark (v0.1.0)
The same machine, the same source baseline, and a returning user in both cases (each app's data folder was isolated and already set up).
| Electron app (stock) | Rust rewrite | Difference | |
|---|---|---|---|
| Download (zipped app) | 148 MB | 39 MB | 3.8× smaller |
| App on disk | 346 MB | 65 MB | 5.3× smaller |
| Installed on first launch | ≈1.2 GB Python runtime, tools and environment | nothing | — |
| Time to first window | 2.36 s | 1.73 s | 27% faster |
| Memory at idle (app) | 262 MB | 214 MB | |
| Memory at idle (app + its backend) | 563 MB (262 + 301 for the Python gateway) | 214 MB | 2.6× less |
| Idle CPU (app + backend) | 4.5% (0.4% + 4.1% gateway) | 1.2% | 3.8× less |
| Processes | 6 (4 Electron + gateway + launcher) | 1 |
Measured on an Apple M4 with 16 GB of memory and macOS 27.0.1. Each figure is the median of runs 2–6 (run 1 is a discarded warm-up). The raw results are in benchmarks/results/.
How it is measured (benchmarks/bench.swift):
- Time to first window: from process start until a normal window larger than 100×100 belonging to the app is on screen. The window list is polled every 5 ms.
- Memory: the physical footprint reported by
/usr/bin/footprint(what Activity Monitor calls Memory), summed over every process the app started, 15 s after launch. - Idle CPU: CPU time used by the whole process tree over the next 10 s, divided by 10 s.
The Electron app starts its Python gateway as a detached background process, outside its own process tree. It was measured separately with the same tools (electron-gateway-macos.json) and is counted in the "app + backend" rows. In v0.1.0 the Rust engine ran inside the app process.
Caveats:
- One Rust run took 21.5 s to show its window. It is excluded by the median but still listed in the raw results; it looks like the window opened on another macOS Space.
- These figures are v0.1.0's and have not been measured again. Since then the app bundles CPython, Herdr and Reliquary, and each profile's chats run in a gateway process of the same program that stays up after the window closes. Downloads are larger now (about 59 MB on macOS, 70 MB on Windows and Linux), and the process count and memory rows no longer describe the current app.
- These are macOS numbers only. The Windows and Linux builds are tested in CI and have not been benchmarked.
To reproduce:
swift benchmarks/bench.swift rust 6 /path/to/Hermes.app/Contents/MacOS/hermes-desktop > benchmarks/results/rust-macos.jsonl
swift benchmarks/bench.swift electron 6 /path/to/Electron/Hermes.app/Contents/MacOS/Hermes > benchmarks/results/electron-macos.jsonl
python3 benchmarks/summarize.py
What's in it
- Chat:
- streamed Markdown, tool approvals;
@file,@folder,@diffand@urlreferences;- attachments, a prompt queue, group chats, subagents;
- chats in their own windows, with the chat list kept in sync across windows.
- Long chats: older messages are summarized when a chat outgrows the model. The saved chat stays whole.
- Accounts and models:
- Nous Portal, OpenAI Codex, xAI, MiniMax and Qwen device sign-ins;
- API keys, custom endpoints;
- model picker, reasoning presets;
- configure the remote gateway's provider from the connected desktop over its authenticated JSON-RPC connection.
- Capabilities:
- skills and MCP servers (HTTP, stdio, OAuth 2.1);
- the plugin catalog, with Agent Plugins v1 packages running natively;
- Python plugins, run in the built-in Python interpreter.
- Routines (cron): templates, scripts that collect data or are the whole job, monitors that run only on a change, a sidebar section with countdowns, and one chat per routine that streams its run live.
- Pages: artifacts (with HTML preview in the OS webview), messaging, webhooks, profiles, agents, command center, star map.
- Floating windows:
- HUD mode with native frosted glass, idle fade and click-through;
- quick entry (⌘⇧Space);
- a desktop pet with AI pet generation.
- Voice: dictation and voice conversation, recognized on this computer. macOS uses its own recognizer. Windows and Linux download one (faster-whisper, about 400 MB) the first time. The wake word uses the "hey hermes" model when the Python agent is installed.
- Connections: local and remote gateways (token or OAuth), SSH, Hermes Cloud discovery.
FEATURE_PARITY.md lists every screen against the Electron app and says what is verified live, covered by tests, or only built.
The backend parity plan gives contributors the implementation order and acceptance checks for Mercury’s gateway, runtime, and clients.
Team gateways
Desktop can connect to multiple gateways. Each gateway accepts its enrolled owner's OAuth login. The stock Teams plugin adds member enrollment and role-based access over General, project, Bot and Group chats. Teams can use Reliquary for governed RELs when enabled. Gateway setup · Teams and governance spec
CLIProxyAPI
Mercury releases use the desktop launcher from the hermes-cliproxyapi-launcher crate. It registers the stock provider plugin with the engine and starts the Mercury desktop. The stock hermes-gateway and hermes-desktop crates build independently.
Under Providers → Custom Endpoints, choose Add CLIProxyAPI endpoint. Enter the proxy URL and its client API key, then choose Discover models. The default URL is http://127.0.0.1:8317/v1. Mercury reads the proxy's public catalogs for context and output limits, image input, and supported reasoning levels. The model picker groups models by provider and uses the appropriate Chat Completions, Anthropic Messages, or Responses protocol.
Add a Management key to group models by the upstream providers that serve them. A shared model appears under each provider. The management pass reads credential listings, sampled model lists, and model definitions. Mercury falls back to public grouping if management is unavailable and stops checking a key after the proxy rejects it with HTTP 401.
Use Group overrides to name a group, replace its membership with case-sensitive shell patterns, or choose its protocol. Apply the override in the group editor and save the endpoint. Select a model in a specific group to use that group's protocol. The Default route uses Chat Completions when the model's providers use different protocols.
Set a Billing gateway URL and key to route inference through that gateway. Mercury continues to discover models from the proxy, then filters each group against the billing gateway's model list for its key. A group can have its own billing key. When that group declares a key variable in YAML, its route needs that variable even if the default billing key is available. Groups with their own working keys can still serve when the default key is unset. CLIProxyAPI source and billing endpoints accept HTTPS and private-network HTTP addresses.
For a headless gateway with CLIProxyAPI, run the launcher crate's gateway binary with the standard Mercury gateway arguments.
cargo run --locked -p hermes-cliproxyapi-launcher --features gateway --bin hermes-cliproxyapi-gateway -- gateway
Set HERMES_RUST_PROVIDER_KIND=cliproxyapi along with HERMES_RUST_BASE_URL, HERMES_RUST_API_KEY, and HERMES_RUST_MODEL. Optional settings go in the HERMES_RUST_CLIPROXYAPI_SETTINGS environment variable as JSON.
{
"management_api_key": "your-management-key",
"billing": {
"base_url": "https://gateway.example/v1",
"api_key": "your-billing-key"
},
"groups": {
"xai": {
"api_mode": "codex_responses",
"billing_api_key": "your-xai-billing-key"
},
"fast": {
"display_name": "Fast models",
"models": ["gpt-*-mini", "claude-haiku-*"],
"api_mode": "chat_completions"
}
}
}
All three settings sections are optional. You can also use the upstream plugin's cliproxyapi.instances section in the Mercury profile's config.yaml and supply its key variables through the profile's .env. Named instances are available as cpa-<name>, with a provider group suffix such as cpa-main-devin. Use model.provider and model.default to select a named default. The imported selection also honors model.api_mode and model.base_url when supplied. Set model_overrides or catalog_provider under providers.<CPA profile name> to override or fill in model metadata. Set CPA_LOCAL_API_KEY and optionally CPA_LOCAL_BASE_URL for the cpa-local instance. An unset key keeps that endpoint visible for setup.
Native clients can list the current provider and saved CLIProxyAPI endpoints with model.options. Pass a provider or group handle from that response to session.create or the session model update. Clients can also use generation_options.provider_group to choose a group on the selected endpoint.
Mercury saves the catalog after discovery, including group membership, model limits, and routing metadata. Startup loads it from disk. A new billing route can reuse the source catalog when it shares the proxy URL, client key, and management key. Opening the model picker or calling model.options refreshes a catalog after 30 seconds, with the saved list available if the refresh fails. A successful empty catalog clears the old models. When moving from Python, run discovery once to warm Mercury's credential-scoped cache. Choose Refresh in the model picker or pass {"refresh":true} to model.options to reload immediately.
Provider fallbacks
In Settings → Model → Provider fallbacks, add backup models in priority order for chat, messaging, and scheduled jobs. Room model pins and scheduled job provider pins take precedence. A fallback can use the current provider or a saved endpoint with its own credentials. For CLIProxyAPI routes, choose a provider group to use its credentials and routing settings. Leave the protocol on Discover automatically to use model discovery or choose the protocol explicitly. Delegation can inherit the chat chain or have its own.
Mercury tries the next route on authentication, quota, connectivity, or provider availability failures before the current request has streamed text. Completed tool calls stay in the conversation. A new turn starts with the primary route again unless the provider has declared a rate-limit window through Retry-After.
Headless clients can set fallback_providers and delegation_fallback_providers in the profile's agent-settings.json. Each entry contains a provider target (chat, endpoint:<saved ID>, account:<managed account ID>, or a named cpa-<name>[-<group>] route), a model ID, and optional CLIProxyAPI provider_group, api_mode, and base_url fields. Omit the delegation setting to inherit the chat chain, or set it to an empty list to use only the configured delegation provider. Mercury also imports named CPA entries from the profile's YAML fallback_providers and delegation.fallback_providers. A native chain configured for the same scope takes precedence.
Using a Devin subscription
Sign in to Cognition from CLIProxyAPI. On Windows, run the login command from your CLIProxyAPI installation and use the config file that the proxy normally runs with.
.\cli-proxy-api.exe -config .\config.yaml -devin-login
Start the proxy with the same config, then enter its URL and client API key in Mercury. Choose Discover models and select a devin/... model under Devin. CLIProxyAPI holds the Cognition login and sends requests through the Devin credentials configured in the proxy. Your Cognition plan governs model access and usage. Leave the billing gateway URL blank for a direct connection to CLIProxyAPI. Add a separate Management key to check account health and quota from local chat.
| Command | Result |
|---|---|
/cpa |
Account health by provider for each configured CLIProxyAPI instance |
/cpa current devin |
Devin account state, cooldowns, request counts, and last recorded quota for the current proxy |
/cpa quota current devin |
Live Devin daily and weekly usage, resets, and plan when the vendor supplies them |
Use a saved endpoint's name with spaces replaced by hyphens, or its endpoint ID, in place of current. Devin live quota requires CLIProxyAPI v7.3.2 or newer so the proxy can fill in the provider token in the request body. Account reports show short labels, quota, and plan. The provider token stays in CLIProxyAPI.
Live quota and messaging
/cpa quota shows usage. Run /cpa quota <endpoint> [provider] to check one proxy, optionally limited to one provider. Available adapters include Claude, Codex, xAI, Antigravity, Devin, Kimi, and quota plugins advertised by CLIProxyAPI, such as Kiro. Use plugin to select all quota plugins or the specific provider name to select one. Set status_enabled: false under cliproxyapi in the profile's config.yaml to disable /cpa while keeping model discovery and inference active.
Operators can run the same /cpa commands through Mercury's stock Discord, Telegram, Slack, and WhatsApp connections. Discord takes the arguments in its optional args field. Slack uses the /cpa command from Mercury's app manifest and also accepts !cpa in messages. Update the Slack app manifest to add the slash command to an existing installation. Discord and Slack slash results are private to the requester. Telegram and WhatsApp reply to the command in the source conversation.
On stock Telegram, /model opens the endpoint and provider-group picker. /model --refresh reloads the current proxy catalog and refreshes a saved endpoint when you open it from that picker. Use /model show <saved endpoint ID> --refresh to reload a saved proxy. Selection applies to the conversation where you opened the picker. An operator can set the profile default for new conversations with /model <model ID> --provider <route> --global.
For Telegram configured through the desktop's manual setup, add the allowed users who can run /cpa to CLIProxyAPI operators under Messaging → Telegram. The headless setup accepts the same grants through gateway telegram configure --cpa-operator-id ID.
Python plugins
Hermes plugins written in Python (plugin.yaml + __init__.py with register(ctx)) run without installing Python or the Python Hermes agent:
hermes-python-host, a small Rust program, embeds CPython through PyO3. Each enabled Python plugin runs in its own host process, so a crashing plugin can't take the app down.Each package ships a pinned, checksummed CPython 3.13 runtime from python-build-standalone, with tests, IDLE, Tk and headers removed:
Platform Interpreter library Where it ships Windows python313.dllpython\next toHermes.exemacOS libpython3.13.dylibHermes.app/Contents/Resources/pythonLinux libpython3.13.so.1.0lib/hermes/pythonA plugin registers tools (with
check_fn,requires_envand async handlers), hooks, slash commands and a memory provider, and reads its settings withget_config. Otherregister_*calls are skipped and listed under Capabilities › Plugins.Its tools run beside each other, so a slow one does not hold up other chats. Cancelling a reply stops an async tool at its next
await; Python cannot interrupt one that blocks.A desktop page (
desktop/plugin.js) opens from Capabilities › Plugins in a web view without network, files or access to your chats. It gets React and the page part of the plugin SDK; panes docked into the app, themes and composer extensions are not supported.These hooks run around every tool call:
pre_tool_call(it can block the call),transform_tool_resultandpost_tool_call.Approved Python dependency declarations are installed as wheels into a package generation in the plugin's data folder. Plugin entry points load when the harness uses the plugin.
A plugin that imports Hermes internals (
hermes_cli,tools, ...) falls back to an installed Hermes Python agent, if there is one.
The Python host reference documents process startup, protocol versioning, framing, cancellation, and verification.
Catalog plugin provenance
Mercury records each catalog plugin's HTTPS repository, pinned commit, package subdirectory, and checkout fingerprint. For Python plugins it also records the requirements and the selected wheel installation's fingerprint. The profile owns the admission policy at plugins/policy.json. A profile without this file has no dependency approvals or revocations.
To approve Python dependencies, add a dependency_approvals entry for the reviewed plugin name, repository, commit, subdirectory, and exact requirement list from the package manifest. Use an empty subdir for a package at the repository root. A dependency approval covers the declared requirements at that pin. The wheel installer resolves them and Mercury fingerprints the resulting generation.
{
"dependency_approvals": [
{
"name": "example",
"source": {
"repository": "https://github.com/example-org/example-plugin",
"commit": "0123456789abcdef0123456789abcdef01234567",
"subdir": ""
},
"requirements": ["example-lib==1.0"]
}
],
"revocations": [
{"kind": "plugin", "name": "retired-plugin"}
]
}
A source revocation uses {"kind":"source","repository":"https://github.com/example-org/example-plugin"}. Add commit to restrict it to one revision across that repository's plugin packages. Write policy changes with an atomic file replacement or the engine's plugins::write_policy API. The gateway's plugins.list reports the policy and artifact status separately from the saved enabled preference.
Reinstall a legacy plugin from a reviewed catalog pin to record its evidence. Back up any local source edits before reinstalling a drifted plugin. If a package moves to a new repository or subdirectory, review the new source and uninstall the old package before installing from the new pin.
Build from source
Install a recent stable Rust (rustup update stable), Git, and Zig 0.16.0. Put zig on PATH, or set ZIG to its absolute executable path. The embedded-herdr feature builds the pinned Herdr terminal core into Hermes; the Python plugin host is a separate binary that must be built beside the desktop executable.
Platform prerequisites:
macOS (Apple Silicon): install Xcode Command Line Tools with
xcode-select --install.Linux (x86_64): install a C/C++ compiler,
pkg-config,curl,rsync, and the development libraries used by the CI workflow. On Ubuntu 24.04:sudo apt-get update sudo apt-get install -y build-essential pkg-config curl rsync \ libxkbcommon-dev libxkbcommon-x11-0 libwayland-dev libdbus-1-dev libasound2-dev libfontconfig1-dev \ libgtk-3-dev libwebkit2gtk-4.1-dev libsoup-3.0-dev libjavascriptcoregtk-4.1-dev libxdo-devWindows (x64): install Visual Studio 2022 Build Tools with Desktop development with C++ and a Windows SDK, use the
stable-x86_64-pc-windows-msvcRust toolchain, and install the Microsoft Edge WebView2 Runtime. Git for Windows must providesh.exeonPATHfor shell commands. Run the Windows commands below in PowerShell.
From the repository root, use the pinned CPython runtime shipped in releases. On macOS and Linux, import both environment settings one line at a time so paths containing spaces stay intact:
python_settings=$(scripts/python-runtime.sh)
while IFS= read -r setting; do
export "$setting"
done <<EOF
$python_settings
EOF
cargo build --locked -p hermes-python-host
cargo run --locked -p hermes-cliproxyapi-launcher --features embedded-herdr --bin hermes-cliproxyapi-desktop
On Windows, add the Python DLL directory to this shell's PATH and stage the pinned ConPTY helpers next to the debug executables:
$env:PYO3_PYTHON = ./scripts/python-runtime.ps1
$env:PATH = "$(Split-Path -Parent $env:PYO3_PYTHON);$env:PATH"
cargo build --locked -p hermes-python-host
$fixture = ./scripts/prepare-herdr.ps1
$target = (cargo metadata --locked --no-deps --format-version 1 | ConvertFrom-Json).target_directory
Copy-Item -LiteralPath (Join-Path (Split-Path -Parent $fixture) "conpty") -Destination (Join-Path $target "debug") -Recurse -Force
cargo run --locked -p hermes-cliproxyapi-launcher --features embedded-herdr --bin hermes-cliproxyapi-desktop
Run the workspace tests in the same shell after setting up Python:
cargo test --locked --workspace
The packaging scripts are scripts/package-macos.sh, scripts/package-linux.sh and scripts/package-windows.ps1. Pushing a v* tag builds all three platforms and publishes them as a GitHub Release. Tags containing a hyphen (such as v0.2.0-rc.1) publish prereleases; other v* tags publish full releases.
Layout
| Path | What |
|---|---|
crates/engine |
Agent engine: providers (OpenAI-compatible, Anthropic, Responses), tools, MCP, subagents, accounts, plugins, references |
crates/library |
Local storage: sessions, projects, bots and groups, webhooks, profiles |
crates/gateway |
JSON-RPC gateway server and client, webhook receiver |
crates/desktop |
The Iced app, which also runs the gateway (hermes-desktop gateway) |
crates/python-host |
Embedded CPython that runs Python plugins |
benchmarks/ |
Benchmark harness and results |
Chat history and the catalog live in mercury.db. The session storage guide explains the profile layout and migration of earlier JSON data.
Credentials
Saved API keys and sign-in tokens are encrypted with a key kept in the macOS Keychain, Windows Credential Manager or the Linux Secret Service. Without one (a headless Linux host), they stay in files only your account can read. Because builds are not signed with a developer certificate, macOS may ask once after an update whether Hermes may use the key.
Not done yet
- Not tried by hand: Windows and Linux (CI tests them and starts the packaged apps), and connecting to a reachable cloud agent. SSH is tested against a real OpenSSH server on the same machine, with a stand-in for the remote Hermes.
- Missing:
- signing and notarization, which need paid certificates;
- installing updates by itself: Hermes downloads, verifies and opens the installer when you ask;
- most of the stock gateway's methods (
FEATURE_PARITY.mdlists them), and desktop plugin surfaces other than pages.
License
MIT; see LICENSE. The app is derived from Hermes Agent by Nous Research, also MIT. Its notice is in LICENSE-HERMES-AGENT. Official binaries embed MPL-2.0 Reliquary; see RELIQUARY-NOTICE for the pinned source and license. The Hermes name, wordmark and icon belong to Nous Research.
استكشف مشاريع مشابهة ومرتبطة
جارٍ التحميل…