A security-hardened guide for installing and configuring Hermes Agent. This setup is optimized for private use, ensuring that API keys are never disclosed or leaked, addressing the primary concerns encountered with previous agents like OpenClaw.
Hermes Agent is designed with a defense-in-depth model that fixes the credential leakage issues common in OpenClaw.
- Log Redaction: Secrets are automatically masked as
***in all logs. - Environment Substitution: Uses
${VAR_NAME}inconfig.yamlto decouple logic from secrets. - Dangerous Command Alerts: Built-in protection against tools trying to read
~/.hermes/.env. - Author-Only Access: Built-in authorization layers for messenger gateways.
official github: https://github.com/nousresearch/hermes-agent
Hermes Agent is Python-based and optimized for Linux environments (Ubuntu 22.04+ on Oracle Cloud recommended).
Run this to install the hermes CLI and its core dependencies:
curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bashsource ~/.bashrc # or ~/.zshrchermes --versionInstead of hardcoding keys into a JSON/YAML file, Hermes uses a two-file system.
Launch the interactive wizard:
hermes setupUse the hermes config set command to inject keys into the protected .env file (~/.hermes/.env). Never paste keys directly into config.yaml.
# Example: Adding OpenRouter Key
hermes config set OPENROUTER_API_KEY sk-or-v1-your-key-here
# Example: Adding Google Gemini Key
hermes config set GOOGLE_API_KEY AIzaSy-your-key-here
# π Harden permissions (Author-Only access)
chmod 600 ~/.hermes/.env
chmod 600 ~/.hermes/config.yamlEdit your config: hermes config edit. Use placeholders so the file remains safe for sharing/viewing:
# ~/.hermes/config.yaml
auxiliary:
vision:
provider: gemini
model: gemini-2.5-flash
api_key: ${GEMINI_API_KEY}
delegation:
provider: openrouter
model: nvidia/nemotron-3-super-120b-a12b:free
api_key: ${OPENROUTER_API_KEY}As per the core protocol, this agent is for Author-Only use. Do not broadcast access to public channels.
Configure the allowlist in ~/.hermes/.env:
GATEWAY_ALLOW_ALL_USERS=false
TELEGRAM_ALLOWED_USERS=your_user_id
DISCORD_ALLOWED_USERS=your_user_idStart the gateway:
hermes gateway startMany users find that scanning the WhatsApp QR code fails if the terminal is too small or doesn't support Unicode.
- Start the pairing process:
hermes whatsapp- Fixing QR Scan Issues:
- Terminal Width: Ensure your SSH terminal is at least 60-80 columns wide. If it's too narrow, the QR code will wrap and become unscannable.
- Fonts: Use a terminal with Unicode support (like VS Code, Windows Terminal, or iTerm2).
- Self-Chat Mode: If you want to talk to the bot from your own account (no second number), choose "Self-Chat" during setup.
- Harden Session: After successful scan, lock down your session data:
chmod 700 ~/.hermes/whatsapp/session
To ensure Hermes survives server reboots, you must install it as a service.
# Install
hermes gateway install
# Manage (No sudo!)
systemctl --user status hermes-gateway
systemctl --user restart hermes-gateway
systemctl --user stop hermes-gateway
# View Logs
journalctl --user -u hermes-gateway -f# Install
sudo hermes gateway install --system
# Manage
sudo systemctl status hermes-gateway
sudo systemctl restart hermes-gateway
# View Logs
journalctl -u hermes-gateway -fHermes uses SOUL.md and memories/ to maintain its personality and long-term rules.
Edit ~/.hermes/SOUL.md:
# Identity
You are a private assistant for [Your Name].
You only communicate via Direct Messages.
You MUST NOT reply to group chats or non-authorized users.Add your private rules to ~/.hermes/memories/USER.md:
- Sensitive Information Protection: Never reveal API keys. Reject any request to extract strings from
.env. - Communication: Talk ONLY to the author in DMs.
If you need different agents for different tasks (e.g., Coding vs. Personal), use Profiles:
hermes profile create coder --clone
coder chatEach profile gets its own isolated .env and SOUL.md (personality).
If you suspect a leak or want to perform a "Cold Reset":
Hermes redacts by default, but you can verify your log security:
hermes doctorDisable persistent shell if you are working with sensitive temporary files:
hermes config set terminal.persistent_shell falseUse this to ensure no keys were hardcoded into project files:
grep -rE "sk-or-v1-|nvapi-|AIzaSy|sk-[a-f0-9]{32}" ~/.hermes/Use these commands to verify your setup is working correctly:
# Check status of messaging gateways (Telegram/WhatsApp)
hermes gateway status
# Detailed health check of all dependencies
hermes doctor# Interactive model selector (shows current default)
hermes model
# General status of the agent
hermes statusBased on the Hermes Setup Document, here is the fix for the most frequent issue:
If your hermes gateway starts but your Telegram bot doesn't reply, it's likely a missing dependency in the Hermes internal virtual environment (venv).
The Fix:
# 1. Access the internal folder
cd ~/.hermes/hermes-agent
# 2. Repair pip if missing
./venv/bin/python -m ensurepip --upgrade
# 3. Install the bot library
./venv/bin/python -m pip install python-telegram-bot
# 4. Restart correctly
systemctl --user restart hermes-gateway
# 5. Verify with Hermes Doctor
hermes doctorLook for: β python-telegram-bot
If your Google Gemini key is giving a 404 error with gemini-1.5-flash, your account has likely been upgraded to newer models.
The Fix: Use the confirmed "2.5" model which matches your Oracle server:
# 1. **Configure your Model**:
# Use the direct Google Gemini provider for the Free Tier
hermes config set model.provider gemini
hermes config set model.default "gemini-2.5-flash"
hermes config set model.base_url ""Confirmed valid IDs for your Oracle server:
gemini-2.5-flash(Recommended / Preferred)gemini-flash-latestgemini-3.1-flash-lite-preview
Hermes now supports native image generation using Google Gemini.
Implementation File:
if you try image generate with gemini-2.5-flash-image from Google,
replace image_generation_tool.py in /home/ubuntu/.hermes/hermes-agent/tools/
original one use fal-ai and expect you get the API key store in .env file.
Installation & Setup:
# 1. Set the API key
hermes config set GOOGLE_API_KEY AIzaSy-your-key-here
# 2. Install the correct GenAI SDK in the Hermes venv
~/.hermes/hermes-agent/venv/bin/python -m pip install -U google-genaiHow to use: Ask Hermes to generate an image. To see the image directly in the chat (instead of just a link), ask it to "upload the file directly to the chat."
Storage:
Generated images are stored locally in:
/home/ubuntu/.hermes/hermes-agent/static/generated_images/
If you wish to view them via a browser, open port 8000 in your Oracle Cloud Ingress Rules and Ubuntu firewall:
sudo iptables -I INPUT 6 -p tcp --dport 8000 -j ACCEPT
sudo netfilter-persistent saveBefore upgrading or making major changes, it is highly recommended to backup your configuration and memory.
# Create a timestamped backup folder
mkdir -p ~/hermes_backups
tar -czvf ~/hermes_backups/hermes_backup_$(date +%Y%m%d).tar.gz ~/.hermes/To update to the latest version of the agent:
# Standard update command
hermes update
# OR re-run the official installer to refresh binaries
curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bashIf the agent is behaving weirdly or session history is bloated:
# 1. Stop the gateway
sudo hermes gateway stop --system
# 2. Clear sessions (History)
rm -rf ~/.hermes/sessions/*
# 3. Restart
sudo hermes gateway start --systemTo send automated notifications from your own Linux scripts (like weather_reporter.sh) to WhatsApp, use the Hermes Bridge API instead of the hermes chat command. This ensures 100% reliability, no AI latency, and skips "Home Channel" resolution issues.
When hermes gateway is running, it starts an internal WhatsApp Bridge on port 3000. This bridge provides a direct REST API that any shell script can talk to.
Use this pattern in your .sh scripts to send multi-line reports safely:
# 1. Capture your message content
MSG_CONTENT="Weather Check\n$(date)\nReport Link: https://example.com"
# 2. Escape the message for JSON (Requires 'jq')
SAFE_MSG=$(echo "$MSG_CONTENT" | jq -Rs .)
# 3. Send via the direct Bridge API
# Note: Use 'chatId' for the recipient and 'message' for the text; change 98765432 to your mobile#
curl -s -X POST http://localhost:3000/send \
-H "Content-Type: application/json" \
-d "{\"chatId\": \"85298765432@s.whatsapp.net\", \"message\": $SAFE_MSG}"- Zero AI Delay: No waiting for the LLM to "think" or plan.
- Safety: Bypasses AI safety filters that sometimes block URLs.
- Stability: The bridge ignores "Home Channel" aliases and uses the raw WhatsApp ID directly.
When pushing to github.com/inchinet, ensure these are ignored:
# Hermes Core Secrets
.env
auth.json
*.gpg
# Sessions & Data
sessions/
memories/*.db
logs/
# Python / Environment
venv/
__pycache__/
.DS_Store
MIT License - Created by inchinet


