
Hermes Agent: Teach a Local LLM to Write Its Own Skills
Summary
Install Nous Research's self-improving agent, run it on a local model, and build a reusable skill.
Teach a Local Model to Write Its Own Skills with Hermes Agent
Nous Research shipped Hermes Agent, an open-source agent harness that has become hard to ignore. It crossed 140,000 GitHub stars in under three months and, according to OpenRouter usage, briefly became the single most-used agent in the world. The pitch that made it spread: it is built to get real work done on open-weight, local models, not just frontier APIs, and it improves itself by writing reusable skills from the tasks you give it.
Most agent tutorials stop at "install it and chat." This one goes to the part that actually makes Hermes different: its closed learning loop. You will run Hermes on a local model through Ollama, then hand it a task, watch it write a reusable SKILL.md, and call that skill back as a slash command. By the end you will understand how the agent turns a one-off workflow into permanent capability, and how to author skills by hand so you are not waiting for it to discover them.
Everything here is verified against the official Hermes Agent docs at hermes-agent.nousresearch.com. Hermes is MIT-licensed and runs on Linux, macOS, and WSL2.
Prerequisites
- OS: Linux, macOS, or Windows via WSL2 (native Windows has a PowerShell installer).
- Runtime: Python 3.11 and Node.js. The installer pulls most dependencies for you.
- A model. Either an API key (OpenRouter, Anthropic, OpenAI, etc.) or a local model via Ollama. This guide uses local Ollama so it is free to run.
- Hardware for local: a GPU with roughly 16 GB+ VRAM is comfortable for a capable tool-calling model. Smaller models work but tool use gets less reliable.
- Context window: Hermes rejects any model with less than 64,000 tokens of context at startup. This is non-negotiable and trips up most first-timers.
Step 1: Install Hermes Agent
On Linux, macOS, or WSL2, the one-line installer is all you need:
curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash
# reload your shell so the `hermes` command is on PATH
source ~/.bashrc # or: source ~/.zshrc
On native Windows, run this in PowerShell instead:
iex (irm https://hermes-agent.nousresearch.com/install.ps1)
Confirm the binary is available and healthy:
hermes --version
hermes doctor
hermes doctor is your best friend for the rest of this guide. It checks provider auth, environment variables, and paths, and tells you exactly what is misconfigured before you waste time debugging a chat that silently returns nothing.
Step 2: Point Hermes at a local model
Pull a tool-capable model with Ollama. A coder model in the 14B-32B range handles multi-step tool calling well; pick a size your VRAM can hold.
# install a tool-capable model
ollama pull qwen2.5-coder:32b
# start Ollama with a context window >= 64K, or Hermes will reject the model
OLLAMA_CONTEXT_LENGTH=65536 ollama serve # listens on port 11434
The OLLAMA_CONTEXT_LENGTH=65536 part matters. Ollama defaults to a small context, and Hermes refuses anything under 64K because the system prompt, tool schemas, and memory need room to breathe. If you manage Ollama with systemd, set the same variable in the service instead:
sudo systemctl edit ollama.service
# add under [Service]:
# Environment="OLLAMA_CONTEXT_LENGTH=65536"
sudo systemctl daemon-reload && sudo systemctl restart ollama
Now connect Hermes to it. Run the interactive model picker:
hermes model
# choose: Custom endpoint (self-hosted / vLLM / Ollama / etc.)
# URL: http://localhost:11434/v1
# API key: (leave blank - Ollama does not need one)
# model: qwen2.5-coder:32b
Hermes splits configuration into two files, which is worth knowing before you start editing things by hand:
- Secrets and tokens live in
~/.hermes/.env(API keys, bot tokens). - Non-secret settings live in
~/.hermes/config.yaml(model, tools, compression, MCP servers).
The hermes config set command routes each value to the correct file automatically, so you rarely need to open them:
hermes config set model qwen2.5-coder:32b
hermes config set terminal.backend docker # sandbox shell commands (recommended)
# an API key example, if you later add a hosted provider:
hermes config set OPENROUTER_API_KEY sk-or-...
Step 3: Run your first chat and prove tool use works
Start the agent. The modern TUI is nicer, but both interfaces share the same sessions and config:
hermes --tui # modern terminal UI (recommended)
# or simply:
hermes
You should see a banner listing your model, enabled tools, and installed skills. Give it a task that forces a real tool call so you know the harness works end to end, not just text generation:
What's my disk usage? Show the top 5 largest directories under my home folder.
A healthy run looks like this: the agent decides it needs the terminal, runs a command, reads the output, and answers. In the transcript you will see the tool call inline:
[tool: terminal] du -h -d1 ~ | sort -hr | head -5
-> 8.1G /home/you/.ollama
3.4G /home/you/Projects
1.2G /home/you/.cache
680M /home/you/Downloads
240M /home/you/.hermes
Your biggest space users are the Ollama model cache (8.1G) and your
Projects folder (3.4G). The .ollama directory is model weights - safe
to prune with `ollama rm <model>` if you need room.
Confirm sessions persist, because the whole learning story depends on it. Exit, then resume:
hermes --continue # or the short form: hermes -c
If that drops you back into the same conversation, the SQLite session store is working. If it does not, you are probably in a different profile; check hermes sessions list.
Step 4: Author a skill by hand
A Hermes skill is a single SKILL.md file: a name, a one-line description, and a step-by-step procedure. The format is compatible with agentskills.io and uses progressive disclosure. The agent reads only the short descriptions of all your skills for free, and loads a skill's full body only when a task actually matches it. That is why you can have dozens of skills installed without bloating every request.
Skills live in ~/.hermes/skills/, one folder per skill. Let's write a skill that turns your staged git changes into a clean pull-request description. Create the file:
mkdir -p ~/.hermes/skills/pr-summary
$EDITOR ~/.hermes/skills/pr-summary/SKILL.md
Put this inside. The frontmatter description is the single most important line: it is what the agent uses to decide when to reach for the skill, so make it specific about when to trigger.
---
name: pr-summary
description: Summarize staged git changes into a clean pull-request
description with a title, a summary, and a bulleted list of changes.
Use when the user asks for a PR description, a changelog entry, or a
summary of what changed in the current branch.
---
# PR Summary
Produce a pull-request description from the staged diff.
## Steps
1. Run `git diff --staged --stat` to see which files changed.
2. Run `git diff --staged` to read the actual changes.
3. Write output in exactly this shape:
- **Title**: one line, imperative mood, under 60 chars.
- **Summary**: 1-2 sentences on why the change exists.
- **Changes**: a bullet per meaningful change, grouped by area.
4. Do not invent changes that are not in the diff.
5. If nothing is staged, say so and stop - do not guess.
## Output format
Return Markdown only, ready to paste into a GitHub PR body.
Every installed skill automatically becomes a slash command. Stage some changes and call it:
git add -A
# in the Hermes CLI:
/pr-summary
Example output for a small refactor:
**Title**: Extract auth token refresh into its own helper
**Summary**: The token refresh logic was duplicated across three
callers. This pulls it into one place so expiry handling stays
consistent.
**Changes**:
- auth/session.py: add `refresh_if_expired()` and route all callers
through it
- api/client.py: drop the inline refresh block, call the new helper
- tests/test_session.py: add cases for expired and near-expiry tokens
If the skill does not fire when you expect it to, force it so you can confirm the file is valid and being read:
hermes chat --toolsets skills -q "Use the pr-summary skill on my staged changes"
Step 5: Watch the closed learning loop
Here is what makes Hermes viral rather than just another harness. You do not have to write every skill. When Hermes notices it has solved the same kind of task more than once, it can write its own skill from that experience and drop it into ~/.hermes/skills/ for next time. This is the closed loop: solve a task, extract a reusable procedure, store it, and reach for it automatically later.
It is backed by real persistence, not a scratch buffer:
- Every session is stored in a SQLite database with FTS5 full-text search, so the agent can retrieve a conversation from weeks ago even when it is not in the active context.
memory.mdanduser.mdhold durable notes about your preferences, goals, and recurring context.- Self-written skills accumulate in
~/.hermes/skills/and are indexed exactly like the ones you author by hand.
To see it happen, give the agent the same shape of task a couple of times in one project, for example: "generate release notes from the last 10 commits" and then "do release notes again for this week." After the repeat, list your skills directory:
ls ~/.hermes/skills/
# pr-summary/ <- the one you wrote
# release-notes/ <- one Hermes wrote for itself
cat ~/.hermes/skills/release-notes/SKILL.md
The agent-authored skill has the same structure as yours: a description of when to use it and the concrete steps it found worked. From then on, "release notes" triggers the saved procedure instead of re-deriving it, which is faster and more consistent. You can edit these files, delete ones you do not like, or promote a good one into version control to share with a team.
Two settings keep the loop stable on a local model. Compression prevents long sessions from blowing past the context window, and it is configured in config.yaml:
# ~/.hermes/config.yaml
compression:
enabled: true
threshold: 0.50 # compress at 50% of the context limit
summary_model: "qwen2.5-coder:32b" # model used to summarize old turns
You can also trigger it manually mid-conversation by typing /compress.
Step 6: Extend with MCP tools and a messaging gateway
Skills are procedures. When you need new capabilities, like querying a database or hitting an internal API, add a Model Context Protocol server. Hermes reads MCP servers from config.yaml:
# ~/.hermes/config.yaml
mcp_servers:
github:
command: npx
args: ["-y", "@modelcontextprotocol/server-github"]
env:
GITHUB_PERSONAL_ACCESS_TOKEN: "ghp_xxx"
To make the agent reachable outside your terminal, set up a gateway. It connects Telegram, Discord, Slack, WhatsApp, Signal, and more, all sharing the same session store, so you can start a task in your terminal and continue it from your phone:
hermes gateway setup # interactive: pick a platform, paste a bot token, set an allowlist
hermes gateway status # confirm it is running and listening
Worked example: a free local research assistant
Put the pieces together into something useful. The goal: a local, no-API-cost assistant that researches a topic and files a short brief, reusing a skill you teach it once.
- Start Ollama with 64K context and connect Hermes as in Steps 2-3.
- Write a
research-briefskill whose steps are: search the web for the topic, read the top 3 results, and write a 5-bullet brief with a sources line. - Enable a web search tool. Set an API key for a search provider (for example FireCrawl) with
hermes config set FIRECRAWL_API_KEY ..., or rely on the terminal tool to curl a public API. - Ask: "Research the state of open-weight agent harnesses and file a brief." The agent plans, may spin up subagents with its
delegate_tasktool to read pages in parallel, then writes the brief. - Wire it to Telegram with
hermes gateway setupso you can request a brief from your phone and get it back in chat.
Because it runs on a local model, you can ask for briefs all day without a metered bill. Because the procedure is a skill, every brief comes out in the same shape. And because sessions persist, you can ask a follow-up next week and the agent still has the thread.
Common pitfalls and how to avoid them
The 64K context rejection. This is the number one first-run failure. Ollama's default context is well under 64K, so Hermes refuses the model at startup. Always launch with OLLAMA_CONTEXT_LENGTH=65536 (or bake PARAMETER num_ctx 65536 into a custom Modelfile). Run hermes doctor to confirm the model is accepted.
Weak tool calling on tiny models. A 3B model can chat but will fumble multi-step tool use, producing malformed calls or ignoring tool results. If the agent "talks about" running a command instead of running it, move up to a 14B-32B tool-tuned model, or fall back to a hosted model for the hard tasks and keep local for the cheap ones.
A skill that never triggers. If Hermes ignores a skill you wrote, the description is almost always too vague. It should name the situations that should activate it ("use when the user asks for a PR description or changelog"), not just what it does. Test in isolation with hermes chat --toolsets skills -q "...".
Running the shell unsandboxed. An agent that can run terminal commands can also delete files. Set hermes config set terminal.backend docker so commands run in a container, use explicit allowlists on any gateway, and never run the agent as root. Treat a public-facing gateway like any other internet-exposed service.
Context creep on long sessions. Even with a 64K window, a marathon session fills up. Leave compression enabled, and when a reply starts feeling slow or forgetful, type /compress to prune and summarize old turns before continuing.
Lost sessions after switching setups. If hermes --continue cannot find your last chat, you likely switched profiles. Hermes supports multiple independent profiles, each with its own config, keys, memory, and sessions. Check hermes sessions list and confirm which profile you are in.
Quick reference
| Command | What it does |
|---|---|
| hermes model | Pick or switch your LLM provider and model |
| hermes setup | Full interactive setup wizard |
| hermes doctor | Diagnose provider, config, and path problems |
| hermes --tui | Start the modern terminal UI |
| hermes --continue / -c | Resume the most recent session |
| hermes config set KEY VALUE | Set a secret or setting (routed to the right file) |
| hermes skills browse / search | List or find installable skills from the hub |
| /pr-summary (any skill name) | Run an installed skill as a slash command |
| /compress | Manually compress the current context |
| hermes gateway setup / status | Connect and check a messaging platform |
Key paths: secrets in ~/.hermes/.env, settings in ~/.hermes/config.yaml, skills in ~/.hermes/skills/, memory in memory.md and user.md.
Next steps
- Promote a good auto-written skill into a git repo so your whole team gets it, then install it with
hermes skills install. - Add a second profile (
hermes profile create work --clone) to keep a coding agent and a research agent fully separate. - Try the RL angle: Hermes ships an integrated training pipeline (Tinker-Atropos, GRPO with LoRA adapters) that can fine-tune a model on trajectories from your own tasks.
- Sandbox harder for always-on use: run the agent on a VPS with the Docker terminal backend and pairing-code auth instead of a raw user ID.
The reason Hermes spread is not a benchmark score. It is that a local, open-weight model plus a good harness plus a memory of what worked starts to feel like an assistant that actually compounds. Write one skill, let it write the next, and the loop does the rest.
Sources: Hermes Agent official docs (hermes-agent.nousresearch.com), NousResearch/hermes-agent on GitHub, and Ollama integration docs. Verify commands against the docs for your installed version, as flags evolve between releases.
Comments
Be the first to comment
Found this useful?
Get new AI guides for builders by email. Free.
Join 3,604 newsletter subscribers.