The Self-Improving Harness

an agent that writes its own skills and lives on 31 chat platforms

NousResearch/hermes-agentView the repository
LANGUAGE
Python 3.11+ · TS surfaces
SOURCE LOC
919,291 py (+779k tests)
MODULES
13 packages · ~600 modules
BUILT-IN TOOLS
104 in ~60 toolsets
PROVIDERS
35 plugins · 6 api modes
OS SANDBOX
8 backends — local default
All 26 blocks

Surfaces & entry

The turn

Tools

Context & memory

Model layer

Safety

Extensibility

State

Isometric plate: the 26 subsystems of Hermes AgentBlocks are grouped into districts by hatching and tint; block height is a rough proxy for code mass. Lines trace the data flow of a single turn. The block index beside this diagram carries the same information as text.ABUVTWECFHDXIGPKQLNROMSYJZ

Hover to read · drag to pan · ⌘/ctrl + scroll to zoom

How to read this plate

Each block is one subsystem of Hermes Agent. Its height is a rough proxy for code mass, calibrated the same way across every harness so the plates are comparable. Hatching and tint group blocks into districts — surfaces, the turn, tools, context, the model layer, safety, extensibility and state.

Lines trace the real data flow of a single turn plus the major supporting links. Pick any block for a plain description and the files it was read from, or trace the turn to walk the path a request actually takes.

What this is

Hermes is the only one of the six that is not primarily a coding agent. It is a personal agent: Home Assistant, Spotify, Google Meet, image and video generation, TTS and wake words, a kanban board, a cron scheduler — alongside file editing, a persistent shell and three browser backends. Its 104 built-in tools are sliced into ~60 named toolsets so each surface presents a different, narrower schema.

The architectural centrepiece is a real learning loop. Every tenth turn, a forked AIAgent runs on a daemon thread, inherits the parent's exact runtime so it reuses the same prompt cache, is restricted at dispatch level to memory and skill tools, auto-denies dangerous commands, and asks itself whether anything should be written down. A separate curator then acts as librarian — consolidating, pinning and archiving skills, never deleting.

Memory is deliberately unfashionable: two markdown files with a § delimiter and character budgets, edited by substring match, injected wholesale as a frozen snapshot at session start. No vectors, no embeddings. The searchable half of memory is a SQLite/FTS5 conversation store; the procedural half is the skill library. Vector backends exist only as swappable plugins, capped at one at a time.

And the surface layer is as large as the agent itself. A single gateway process runs 31 chat platforms — Telegram, Discord, Slack, WhatsApp, Signal, Matrix, email, SMS and more — with turn leases, a delivery ledger, drain control and scale-to-zero. It is closer to a message-broker runtime than a chat REPL.

Implementation

Prompt as a write-once artifact. build_system_prompt_parts returns three ordered cache tiers — stable, context, volatile — joined once and cached for the agent's lifetime, deliberately never re-rendered mid-session. Memory writes hit disk immediately but only surface in the next session's snapshot. Approval mode is a persistent config value rather than conversation state for exactly this reason.

Skill policy in code. The review prompts encode a real editorial standard: class-level umbrella skills with references/ directories, user frustration treated as a first-class skill signal, a preference order that patches before creating, protected bundled/pinned/user-owned skills, and an explicit anti-capture list (environment-dependent failures, negative claims about tools, transient errors).

State. One SQLite database, schema version 26, 11 tables and three FTS5 variants including a Rust CJK tokenizer. Sessions carry ~55 columns; system prompts are content-hash deduplicated and referenced; compaction splits the session into a lineage chain via parent_session_id; WAL plus a serialized write queue and advisory cross-process leases because the gateway is multi-platform.

Everything is a directory plugin. 35 model providers, 22 chat platforms, 9 memory backends, context engines, cron providers and dashboard auth are all plugin.yaml + register(ctx) directories from four sources, with a capability grant system and 37 typed hooks with documented dispatch semantics.