Skip to content

Commit 616e818

Browse files
veoeryclaudehaizhongzheng
authored
Add Hermes Agent as a CLI Base Agent (acting agent and hermes Evolver) (#107)
* add Hermes as CLI base agent, acting agent and evolver * hermes: fixes from the post-PR audit of 6c76cca An independent audit of 6c76cca (general, test and sandbox checklists; findings reproduced with the real hermes 0.19.0 against a scripted model) found no blocker and these, now fixed: - A kept home holds only Hermes's sessions, hermit's ledger and the logs between calls (HERMES_KEPT): a profile Hermes would switch its home to (active_profile, profiles/), a .env/.op.env, credentials and skills a session left are removed; a home hermit did not make (no marker) is refused, never cleared. - context_files false (the Evolver's): the plugin turns off Hermes's subdirectory hints, which --ignore-rules leaves on (a touched folder's AGENTS.md added to a tool result), and reports it; a session whose hints stayed on fails. - A context file Hermes's prompt-injection scan replaced with a [BLOCKED: ...] notice fails the session, naming it (benign rules match). - The reply is the model's own: Hermes's verifier footer and completion explainer are off. - The output limit is the model's max_tokens (Hermes ignores the provider's); a fresh empty models.dev catalog in the home, so no catalog request; extra_body documented as chat-completions only. - Readers stop at the turn's end, so a reply printed after it is never read as events; an incomplete turn with no reply is no turn limit; the plugin's payload cap raised; --no-restore-cwd on resume; the plugin's database connection closed. - Tests: each fix, the "failed request then served" rule, the context-tool and isolate checks for the host; integration tests for hints, the blocked context and the footer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * hermes: fixes from the dual review - Rollouts count every usage: the acting agent kept only usage[0], dropping Hermes's auxiliary calls from cost, tokens and model calls. - A reply cut at its output limit, which Hermes continues before its hook reports the request, is counted: the plugin writes hermes.request_start for every attempt, and a request that neither answered nor failed is an unreported call (cost unknown); a 400 policy rejection is a failed one. - A failed turn's auxiliary calls are read from the home's state.db (no session_end reports them). - A request after a 503 counts as recovery: a continued reply that ended at the turn limit is no outage to retry. - ANTHROPIC_AUTH_TOKEN is dropped; the bound key is kept whatever its name (HERMES_API_KEY). - A context file Hermes's scan blocked is reported from the scan itself, on the Responses and Messages APIs too. - Docs: hermes-agent[mcp,anthropic]; max_output_tokens on the model; Hermes loads its own source's .env and a managed .env. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Haizhong Zheng <hzzheng@umich.edu>
1 parent e813538 commit 616e818

60 files changed

Lines changed: 2505 additions & 200 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGELOG.md‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,23 @@ Changes are grouped by software version. Entries under Unreleased describe work
6262
`web_search: true` gives web fetch only unless the model is reached through DeepSeek's API on `DEEPSEEK_API_KEY`. The
6363
MWM and RRSI Adapter Evolvers refuse `evolver.params.backend: dsh`. `hermit deploy --host dsh` writes the adapter's
6464
tools, with a 120 s timeout, in a patch layer, `.dsh/hermit.patch.yml`, which a session loads with `--patch`.
65+
- Hermes Agent as a CLI Base Agent (`hermes`): the acting agent `agent.base: hermes` and the `hermes` Evolver run Hermes
66+
Agent 0.19's `hermes chat -Q` in its own home, with a model reference as its config's provider `hermit` (the key by
67+
its variable's name; chat completions, else the Messages or the Responses API). `chat -Q` prints only the reply:
68+
hermit's Hermes plugin, copied into the home, writes each hook Hermes fires (requests with their reasoning, tool calls
69+
and usage; failed requests with Hermes's own classification; tool results; the turn's end) as the session's JSON
70+
stream, `agent-hermes.jsonl`. What Hermes reaches besides that model is off (its auxiliary tasks go to the same model;
71+
no fallback provider, tirith download, update check, models.dev catalog, memory or skill nudges), and the reply is the
72+
model's own (no verifier footer). The call's tools are an MCP server Hermes waits for; a session whose first request
73+
lacks them, whose context file Hermes's prompt-injection scan refused, or that reached Hermes's turn limit
74+
(`agent.hermes.max_turns`), fails although Hermes exits 0; only Hermes's classification of a failed request (rate
75+
limit, overload, server error, timeout) makes it unavailable. A kept home (the Evolver's) holds only Hermes's
76+
sessions, hermit's ledger and the logs between calls, and the Evolver's sessions are given no folder's `AGENTS.md`
77+
(Hermes's subdirectory hints off). Hermes takes no roles, no login, no web search and a prompt of up to 120,000 bytes
78+
(one argument). `hermit deploy --host hermes` writes the context to `.hermes.md` (Hermes's first project file),
79+
`.hermes/skills`, and `.hermes/hermit.config.yaml`, the part of Hermes's own config the tools and skills need (Hermes
80+
has no project file for them). The MWM and RRSI Adapter Evolvers refuse `evolver.params.backend: hermes`; the AHE
81+
template lists its hooks in `.hermes.md` to run by hand, as for Pi.
6582
- Models in sandboxes as Harbor's agents get theirs: each sandbox gets its models' key variables and provider hosts
6683
(an isolated network becomes an allowlist) and forwards a model meter on the loopback; what a run keeps (the
6784
learning material, the step records, the adapter) is scrubbed of key values (`hermit/redact.py`). The allowlist
@@ -191,8 +208,8 @@ Changes are grouped by software version. Entries under Unreleased describe work
191208
- The CLI Base Agents share one runner, `CliAgent` (`hermit/agent/base/cli.py`): what differs per CLI (its command,
192209
its home, how its event stream is read) is its subclass's hooks, and `CLIS` names every CLI. `codex` and `claude`
193210
behave as before; a new CLI is one subclass.
194-
- `Usage` gains `unreported_calls`, the calls whose tokens a CLI did not report (only DeepSeek Harness's reader sets
195-
it): a usage that has any keeps an unknown cost, not the price of the tokens reported.
211+
- `Usage` gains `unreported_calls`, the calls whose tokens a CLI did not report (DeepSeek Harness's and Hermes Agent's
212+
readers set it): a usage that has any keeps an unknown cost, not the price of the tokens reported.
196213

197214
### Fixed
198215

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ own tests under `examples/*/utils/tests/`) is:
4747
python -m pytest
4848
```
4949

50-
Tests marked `integration` run an agent CLI installed on the machine (`codex`, `claude`, `dsh`) and depend on its
50+
Tests marked `integration` run an agent CLI installed on the machine (`codex`, `claude`, `dsh`, `hermes`) and depend on its
5151
release; they run only with `--integration`.
5252

5353
A pull request that adds or changes tests also answers the

‎docs/developer/sandbox-design.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ way. A task whose own code calls a model (CL-Bench's and ServeLearnBench's runne
166166
not copied: `CLAUDE_CODE_OAUTH_TOKEN` passes by name for the call that runs the session, never in a sandbox's own
167167
variables (so neither its other commands nor its judge get it), and `api.anthropic.com` is allowed; in a container it
168168
reaches the CLI on a file descriptor. A CLI learner that names neither a model reference nor a login copies the CLI's
169-
own sign-in from the user's home; the `dsh` Evolver copies nothing (`home: []`): give it a model reference.
169+
own sign-in from the user's home; the `dsh` and `hermes` Evolvers copy nothing (`home: []`): give them a model
170+
reference.
170171

171172
What a run keeps and may share is scrubbed of every key value (`hermit/redact.py`); each value of a key-like variable
172173
of the Trainer (`..._API_KEY`, `..._KEY`, `..._TOKEN`, `..._SECRET`, at least 16 characters) becomes `<VARIABLE>`.

‎docs/faq.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Follow [Deploy an adapter](tutorials/deploy-an-adapter.md) for the commands and
6161
<details class="ha-faq" id="can-i-reuse-an-adapter-across-models-and-harnesses">
6262
<summary>Can I Reuse an Adapter Across Models and Harnesses?</summary>
6363

64-
Yes, when the receiving agent supports the exports the adapter needs. Hermit currently generates workspaces for Codex, Claude Code, Pi, mini-swe-agent, OpenCode, and DeepSeek Harness, and converts native plugin packages for Claude Code, Codex, Pi, and Hermes. Each route has different capabilities; a target may refuse unsupported exports.
64+
Yes, when the receiving agent supports the exports the adapter needs. Hermit currently generates workspaces for Codex, Claude Code, Pi, mini-swe-agent, OpenCode, DeepSeek Harness, and Hermes Agent, and converts native plugin packages for Claude Code, Codex, Pi, and Hermes. Each route has different capabilities; a target may refuse unsupported exports.
6565

6666
Compatibility does not guarantee the same performance on a different model, harness, or task. Evaluate the adapter in its new setting. See the [host capability matrix](framework/commands.md#what-each-hosts-plugin-carries) and [compatibility limits](reference/compatibility.md).
6767

‎docs/framework/adapter.md‎

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,18 @@ id>/`. Paths in the instructions below, and in the adapter's skills and roles, a
7676
command they give from there." Then each export `exports.yaml` declares is
7777
connected to the host's own place when the host has one, so that the host loads it; an export the host has no place
7878
for stays a file of the copy, and the context names it with what to do with it. The rule is the same for every
79-
host, and for the built-in `codex`, `claude-code`, `pi`, `mini-swe-agent`, `opencode` and `dsh` acting agents, which deploy as `hermit deploy` does: an adapter
79+
host, and for the built-in `codex`, `claude-code`, `pi`, `mini-swe-agent`, `opencode`, `dsh` and `hermes` acting agents, which deploy as `hermit deploy` does: an adapter
8080
is deployed as far as the host can take it, and nothing it holds is out of the agent's reach.
8181

82-
| Adapter source | Deployment operation | Codex output | Claude Code output | Pi output | mini-swe-agent output | OpenCode output | DeepSeek Harness output |
83-
|---|---|---|---|---|---|---|---|
84-
| Every file but `.hermit/` and `.git/` | Copy it as it is. | `hermit/<id>/` | `hermit/<id>/` | `hermit/<id>/` | `hermit/<id>/` | `hermit/<id>/` | `hermit/<id>/` |
85-
| `ADAPTER.md` (always exported) | Insert the line above and its text into a managed instruction block. | `AGENTS.md` | `CLAUDE.md` | `AGENTS.md` | the system template of `mini-swe-agent.yaml` | `AGENTS.md` | `AGENTS.md` |
86-
| `skills/verify-output/`, through `skills` in `exports.yaml` | Copy the skill directory. | `.codex/skills/verify-output/` | `.claude/skills/verify-output/` | `.pi/skills/verify-output/` | named in the system template (mini-swe-agent loads no skills): name, description, the path of its `SKILL.md` | `.opencode/skills/verify-output/` | `.dsh/skills/verify-output/` |
87-
| `agents/reviewer.md` (or `agents/reviewer/AGENT.md`), through `agents` in `exports.yaml` | Convert the subagent into native host files: frontmatter gives name and description, the body becomes its instructions. | `.codex/agents/reviewer.toml`, registered in `.codex/config.toml` | `.claude/agents/reviewer.md` | named in `AGENTS.md` (Pi has no subagents): name, description, the path of its instructions | named in the system template (no subagents) | named in `AGENTS.md`, as for Pi | named in `AGENTS.md` (DeepSeek Harness has no role file): name, description, the path of its instructions |
88-
| `tools.py`, through `tools` in `exports.yaml` | Configure a framework MCP server that loads the source adapter. | `.codex/config.toml` | `.mcp.json` | `.pi/mcp.json` | `environment` in `mini-swe-agent.yaml`: Hermit's environment class answers the `hermit-tool` command | `opencode.json` (`mcp.servers`, `codemode: false`) | `.dsh/hermit.patch.yml`, which a session loads with `--patch` |
89-
| a hooks file, through `hooks` in `exports.yaml` | Write the hooks the host runs, each command run from `hermit/<id>/`; name the others in the context (a command to run, a `prompt` hook's check to make at that moment); a hook of another type is refused. | `.codex/hooks.json` (command hooks; Codex runs no prompt or agent hooks) | `hooks` in `.claude/settings.json` (command and prompt hooks) | named in `AGENTS.md` (Pi reads no hook file) | named in the system template (mini-swe-agent runs no hooks) | named in `AGENTS.md` | named in `AGENTS.md` (DeepSeek Harness has no hook file of its own) |
90-
| every other file of the copy | Name it, with its frontmatter description or first line, under "Adapter resources" in the context (up to 60 files; the rest are counted). | `AGENTS.md` | `CLAUDE.md` | `AGENTS.md` | the system template | `AGENTS.md` | `AGENTS.md` |
82+
| Adapter source | Deployment operation | Codex output | Claude Code output | Pi output | mini-swe-agent output | OpenCode output | DeepSeek Harness output | Hermes Agent output |
83+
|---|---|---|---|---|---|---|---|---|
84+
| Every file but `.hermit/` and `.git/` | Copy it as it is. | `hermit/<id>/` | `hermit/<id>/` | `hermit/<id>/` | `hermit/<id>/` | `hermit/<id>/` | `hermit/<id>/` | `hermit/<id>/` |
85+
| `ADAPTER.md` (always exported) | Insert the line above and its text into a managed instruction block. | `AGENTS.md` | `CLAUDE.md` | `AGENTS.md` | the system template of `mini-swe-agent.yaml` | `AGENTS.md` | `AGENTS.md` | `.hermes.md` |
86+
| `skills/verify-output/`, through `skills` in `exports.yaml` | Copy the skill directory. | `.codex/skills/verify-output/` | `.claude/skills/verify-output/` | `.pi/skills/verify-output/` | named in the system template (mini-swe-agent loads no skills): name, description, the path of its `SKILL.md` | `.opencode/skills/verify-output/` | `.dsh/skills/verify-output/` | `.hermes/skills/verify-output/` |
87+
| `agents/reviewer.md` (or `agents/reviewer/AGENT.md`), through `agents` in `exports.yaml` | Convert the subagent into native host files: frontmatter gives name and description, the body becomes its instructions. | `.codex/agents/reviewer.toml`, registered in `.codex/config.toml` | `.claude/agents/reviewer.md` | named in `AGENTS.md` (Pi has no subagents): name, description, the path of its instructions | named in the system template (no subagents) | named in `AGENTS.md`, as for Pi | named in `AGENTS.md` (DeepSeek Harness has no role file): name, description, the path of its instructions | named in `.hermes.md` (Hermes Agent has no role file), as for DeepSeek Harness |
88+
| `tools.py`, through `tools` in `exports.yaml` | Configure a framework MCP server that loads the source adapter. | `.codex/config.toml` | `.mcp.json` | `.pi/mcp.json` | `environment` in `mini-swe-agent.yaml`: Hermit's environment class answers the `hermit-tool` command | `opencode.json` (`mcp.servers`, `codemode: false`) | `.dsh/hermit.patch.yml`, which a session loads with `--patch` | `.hermes/hermit.config.yaml` (`mcp_servers`), a part of Hermes's `config.yaml` to merge into your own |
89+
| a hooks file, through `hooks` in `exports.yaml` | Write the hooks the host runs, each command run from `hermit/<id>/`; name the others in the context (a command to run, a `prompt` hook's check to make at that moment); a hook of another type is refused. | `.codex/hooks.json` (command hooks; Codex runs no prompt or agent hooks) | `hooks` in `.claude/settings.json` (command and prompt hooks) | named in `AGENTS.md` (Pi reads no hook file) | named in the system template (mini-swe-agent runs no hooks) | named in `AGENTS.md` | named in `AGENTS.md` (DeepSeek Harness has no hook file of its own) | named in `.hermes.md` (Hermes Agent runs no hook file of a project) |
90+
| every other file of the copy | Name it, with its frontmatter description or first line, under "Adapter resources" in the context (up to 60 files; the rest are counted). | `AGENTS.md` | `CLAUDE.md` | `AGENTS.md` | the system template | `AGENTS.md` | `AGENTS.md` | `.hermes.md` |
9191

9292
This is how the adapter reaches the acting system. The host reads the generated instruction, skill, role and hook
9393
files; tool configuration makes the declared tools available through its tool interface. What the adapter does not
@@ -98,6 +98,10 @@ context must fit what the host reads: Codex reads `AGENTS.md` up to its `project
9898
and drops the rest without a word, so the Codex deployment refuses a longer `AGENTS.md` (`hermit deploy
9999
--context-limit`, the acting agent's `project_doc_max_bytes`). DeepSeek Harness gives the model at most 65,536 bytes
100100
of a project's instructions and cuts the rest, so its deployment refuses an `AGENTS.md` that would not fit.
101+
Hermes Agent reads one project context file, the first it finds of `.hermes.md` (also searched up to the repository's
102+
root), `AGENTS.md`, `CLAUDE.md` and `.cursorrules`, so its deployment writes `.hermes.md`; Hermes cuts a context file
103+
past a share of the model's context window unless `context_file_max_chars` is larger, which the deployment's config
104+
part sets (1,000,000).
101105
A hook runs in the
102106
directory the session started in, so the deployment prefixes each command with `cd hermit/<id>` (its absolute path):
103107
a hook finds the files it names where it found them in training. Interactive Codex asks the user to trust the
@@ -172,14 +176,31 @@ dsh-workspace/
172176
.hermit-deploy.json
173177
```
174178

179+
```text
180+
hermes-workspace/ # roles and hooks stay files under hermit/<id>/, named in .hermes.md
181+
.hermes.md
182+
hermit/file-example/
183+
ADAPTER.md exports.yaml tools.py agents/ skills/ README.md
184+
.hermes/
185+
hermit.config.yaml # the tools and the skills' folder, to merge into ~/.hermes/config.yaml
186+
skills/verify-output/SKILL.md
187+
.hermit-deploy.json
188+
```
189+
190+
Hermes Agent has no project file for MCP servers or skill folders: both are settings of its home's `config.yaml`, which
191+
a deployment never changes. `.hermes/hermit.config.yaml` is the part of it the deployment needs, for you to merge into
192+
your own (`mcp_servers.<adapter id>`, `skills.external_dirs` with the absolute `.hermes/skills`,
193+
`context_file_max_chars`). The `hermes` acting agent needs none of it: its Base Agent serves the adapter's tools from
194+
the session's own tool server and gives the session the deployment's skills folder.
195+
175196
Only declared exports are connected; every file is copied. A prompt-only adapter has no tool-server entry, skills,
176197
roles or hooks to install, and its copy holds `ADAPTER.md`, `exports.yaml` and `README.md`. The generated deployment
177198
report identifies the actual paths and role names, and lists every copied file with its digest.
178199

179200
### Context is inserted into project instructions
180201

181-
`ADAPTER.md` is the source. `AGENTS.md` or `CLAUDE.md` is the host-facing result. The connector inserts the
182-
rendered context between markers like these:
202+
`ADAPTER.md` is the source. `AGENTS.md`, `CLAUDE.md` or `.hermes.md` is the host-facing result. The connector
203+
inserts the rendered context between markers like these:
183204

184205
```html
185206
<!-- hermit:file-example:start -->
@@ -200,8 +221,8 @@ before writing anything, when a copied file was changed or replaced (by a direct
200221
deployment or another file is in the way, when an exported skill would replace a skill folder no deployment wrote,
201222
or when the skills folder is a link (or reached through one), and
202223
names the file; an adapter link that leads outside the adapter is refused too.
203-
The generated `.codex/config.toml`, `.mcp.json`, `.pi/mcp.json`, `mini-swe-agent.yaml`, `opencode.json` or
204-
`.dsh/hermit.patch.yml` is rewritten on deployment; it is not a general configuration
224+
The generated `.codex/config.toml`, `.mcp.json`, `.pi/mcp.json`, `mini-swe-agent.yaml`, `opencode.json`,
225+
`.dsh/hermit.patch.yml` or `.hermes/hermit.config.yaml` is rewritten on deployment; it is not a general configuration
205226
merger. Global host configuration is not modified.
206227

207228
### Tools run from the adapter source
@@ -216,7 +237,8 @@ python -m hermit.runtime.mcp_server --adapter /absolute/path/to/adapter ...
216237
That wrapper exposes the declared tool schemas, loads the Python functions, and returns their results to the
217238
acting agent. The source adapter and its runtime dependencies must remain available. If DeepSeek Harness cannot start
218239
the wrapper, it says so on its stderr and goes on without the tools: the `dsh` acting agent then fails the session,
219-
but a session started by hand continues.
240+
but a session started by hand continues. Hermes Agent waits for its MCP servers before its first request and goes on
241+
without one it could not reach: the `hermes` acting agent fails a session whose first request lacks the call's tools.
220242

221243
Each tool declaration names an `entrypoint` such as `tools.py:count_words` and object input/output JSON Schemas.
222244
The Python function may be synchronous or asynchronous. Subagents can also come from a Python exporter that returns

0 commit comments

Comments
 (0)