Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ Changes are grouped by software version. Entries under Unreleased describe work
agent's commands get only `env`. The call's tools are one bash command, `hermit-tool`. `hermit deploy --host
mini-swe-agent` writes `mini-swe-agent.yaml`. Installed with the `mini-swe-agent` extra.
[Tutorial](docs/tutorials/mini-swe-agent.md).
- OpenCode as a CLI Base Agent (`opencode`): the acting agent `agent.base: opencode` and the `opencode` Evolver run
OpenCode 2.2's `run --format json --standalone` (a server of the session's own, never its shared background
service) in its own home and XDG folders, with no update, catalog or download requests. It runs a model reference
only, as OpenCode's provider `hermit` (the key as `{env:VARIABLE}`, chat completions); what the session must hold
(the provider, the permissions, no sharing) is its inline config, which outranks a workspace's `opencode.json`;
the call's tools are an MCP server offered directly (not through code mode). Whether its provider could not serve
is read from OpenCode's own error type (`provider.rate-limit`, `.internal`, `.transport`, `.timeout`), so the
acting agent runs such a task again. Its usage counts the model calls of its compactions, which its stream leaves
out, from its session's totals. OpenCode takes no roles and has no web search. `hermit deploy --host opencode`
writes `AGENTS.md`, the project's `opencode.json` and `.opencode/skills`.
- Models in sandboxes as Harbor's agents get theirs: each sandbox gets its models' key variables and provider hosts
(an isolated network becomes an allowlist) and forwards a model meter on the loopback; what a run keeps (the
learning material, the step records, the adapter) is scrubbed of key values (`hermit/redact.py`). The allowlist
Expand Down
2 changes: 1 addition & 1 deletion docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Follow [Deploy an adapter](tutorials/deploy-an-adapter.md) for the commands and
<details class="ha-faq" id="can-i-reuse-an-adapter-across-models-and-harnesses">
<summary>Can I Reuse an Adapter Across Models and Harnesses?</summary>

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

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).

Expand Down
34 changes: 23 additions & 11 deletions docs/framework/adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,18 @@ id>/`. Paths in the instructions below, and in the adapter's skills and roles, a
command they give from there." Then each export `exports.yaml` declares is
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
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
host, and for the built-in `codex`, `claude-code`, `pi` and `mini-swe-agent` acting agents, which deploy as `hermit deploy` does: an adapter
host, and for the built-in `codex`, `claude-code`, `pi`, `mini-swe-agent` and `opencode` acting agents, which deploy as `hermit deploy` does: an adapter
is deployed as far as the host can take it, and nothing it holds is out of the agent's reach.

| Adapter source | Deployment operation | Codex output | Claude Code output | Pi output | mini-swe-agent output |
|---|---|---|---|---|---|
| Every file but `.hermit/` and `.git/` | Copy it as it is. | `hermit/<id>/` | `hermit/<id>/` | `hermit/<id>/` | `hermit/<id>/` |
| `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` |
| `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` |
| `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) |
| `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 |
| 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) |
| 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 |
| Adapter source | Deployment operation | Codex output | Claude Code output | Pi output | mini-swe-agent output | OpenCode output |
|---|---|---|---|---|---|---|
| Every file but `.hermit/` and `.git/` | Copy it as it is. | `hermit/<id>/` | `hermit/<id>/` | `hermit/<id>/` | `hermit/<id>/` | `hermit/<id>/` |
| `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` |
| `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/` |
| `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 |
| `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`) |
| 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` |
| 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` |

This is how the adapter reaches the acting system. The host reads the generated instruction, skill, role and hook
files; tool configuration makes the declared tools available through its tool interface. What the adapter does not
Expand Down Expand Up @@ -148,6 +148,17 @@ mini-swe-agent-workspace/
.hermit-deploy.json
```

```text
opencode-workspace/ # roles stay files under hermit/<id>/, named in AGENTS.md
AGENTS.md
opencode.json
hermit/file-example/
ADAPTER.md exports.yaml tools.py agents/ skills/ README.md
.opencode/
skills/verify-output/SKILL.md
.hermit-deploy.json
```

Only declared exports are connected; every file is copied. A prompt-only adapter has no tool-server entry, skills,
roles or hooks to install, and its copy holds `ADAPTER.md`, `exports.yaml` and `README.md`. The generated deployment
report identifies the actual paths and role names, and lists every copied file with its digest.
Expand All @@ -172,7 +183,8 @@ A redeployment replaces the copy under `hermit/<id>/`: files the new version no
before writing anything, when a copied file was changed or replaced (by a directory or a link) since the last
deployment or another file is in the way, and
names the file; an adapter link that leads outside the adapter is refused too.
The generated `.codex/config.toml`, `.mcp.json` or `.pi/mcp.json` is rewritten on deployment; it is not a general configuration
The generated `.codex/config.toml`, `.mcp.json`, `.pi/mcp.json`, `mini-swe-agent.yaml` or `opencode.json` is rewritten on
deployment; it is not a general configuration
merger. Global host configuration is not modified.

### Tools run from the adapter source
Expand Down
26 changes: 14 additions & 12 deletions docs/framework/agent-layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ How a model takes steps. Layer 2 holds only the framework's agents:
| `claude` | The Claude Code CLI, working in a workspace |
| `pi` | The Pi CLI, working in a workspace (no roles, no web search) |
| `mini-swe-agent` | mini-swe-agent's bash loop, working in a workspace: one task through its Python API, in a process of its own (no roles, no web search) |
| `opencode` | The OpenCode CLI, working in a workspace (a model reference only; no roles, no web search) |

API, the only one Layer 3 sees:

Expand All @@ -70,7 +71,7 @@ agent, prompt = agent.instructed(system, prompt) # a copy that takes `system`
environment, step by step in a resumed learning session. Codex and Claude Code resume their thread; direct and
react carry the message history.
- `roles`: named sub-agents (name, description, instructions) the agent may delegate to: Codex's roles, Claude
Code's agents. direct, react, pi and mini-swe-agent refuse them.
Code's agents. direct, react, pi, mini-swe-agent and opencode refuse them.
- `trajectory`: the run as standard steps: messages, reasoning, commands with their exit codes and output, tool
calls, file changes, errors. Layer 3 reads only these; a CLI's raw log (`agent-codex.jsonl`) is kept beside them
as an archive.
Expand All @@ -82,12 +83,12 @@ none), Codex's own sandbox mode, the CLI's home, the time limit (the full list i
leaves the agent as it was. Running a task again when the provider could not serve it is Layer 3's: the workspace
is placed anew first.

Codex, Claude Code, Pi and mini-swe-agent share one runner, `CliAgent`: the isolation, the home, the sign-in, the tool
server and the process are the same for every CLI. Each CLI is a subclass whose hooks give what is its own: its
command, its home, and how its event stream is read (the reply, the trajectory, the usage, whether the provider served
it, and what a session that was not served met: `outcome`). mini-swe-agent's process is the framework's own
(`hermit/agent/base/mini_swe_agent_run.py`): it runs one task through mini-swe-agent's Python API and writes the
session as JSON events, the stream the runner reads. A new CLI is
Codex, Claude Code, Pi, mini-swe-agent and OpenCode share one runner, `CliAgent`: the isolation, the home, the
sign-in, the tool server and the process are the same for every CLI. Each CLI is a subclass whose hooks give what is
its own: its command, its home, and how its event stream is read (the reply, the trajectory, the usage, whether the
provider served it, and what a session that was not served met: `outcome`). mini-swe-agent's process is the
framework's own (`hermit/agent/base/mini_swe_agent_run.py`): it runs one task through mini-swe-agent's Python API and
writes the session as JSON events, the stream the runner reads. A new CLI is
a subclass listed in `CLIS`, a reader of its stream in `hermit/agent/base/trajectory.py`, and its model binding in
Layer 1.

Expand All @@ -102,8 +103,8 @@ What the Base Agent is used for. Two kinds:
record).
- The **Evolver Agent** learns. Its API to the Trainer is `step(ctx)` and `finalize(ctx)`. It reads the acting
runs' trajectories and writes a new adapter, calling a Base Agent: `direct` for methods that decide every step in
their own code (GEPA, SkillOpt, ReHarness, Continual Harness), `codex`, `claude` or `pi` for methods whose learner
is an agent (Meta-Harness Adapter, the `codex`, `claude` and `pi` Evolvers). The run's model reaches an Evolver as
their own code (GEPA, SkillOpt, ReHarness, Continual Harness), `codex`, `claude`, `pi` or `opencode` for methods
whose learner is an agent (Meta-Harness Adapter, the `codex`, `claude`, `pi` and `opencode` Evolvers). The run's model reaches an Evolver as
`ctx.agent`, a `direct` Base Agent metered against the budget; `ask(ctx.agent, messages, max_tokens=...)` returns
the reply as the `llm` tool does.

Expand Down Expand Up @@ -144,7 +145,7 @@ Each Base Agent offers the tools to the model in its own way:
|---|---|---|
| `direct` | Their schemas in the API request | Layer 3, which then calls `direct` again |
| `react` | Their schemas in the API request | `react`, in its loop |
| `codex`, `claude`, `pi` | The framework's tool server, over MCP (streamable HTTP) | The tool server |
| `codex`, `claude`, `pi`, `opencode` | The framework's tool server, over MCP (streamable HTTP) | The tool server |
| `mini-swe-agent` | One bash command, `hermit-tool <name> '<JSON arguments>'`, listed in its system message | The tool server, through its JSON entrance |

The tool server (`hermit/agent/base/tool_server.py`) is started for the one call and stopped after it. It carries a
Expand All @@ -160,8 +161,8 @@ inside the agent's sandbox with the agent's permissions.
## Limits

`limits` states what the agent may touch. Each Base Agent enforces it with its own isolation, and refuses a limit it
cannot enforce (`Unsupported`) rather than ignore it. For Codex, Claude Code, Pi and mini-swe-agent (Pi and
mini-swe-agent run in the run's sandbox or with no isolation, not in a container):
cannot enforce (`Unsupported`) rather than ignore it. For Codex, Claude Code, Pi, mini-swe-agent and OpenCode (Pi,
mini-swe-agent and OpenCode run in the run's sandbox or with no isolation, not in a container):

| Limit | In a container | In the run's sandbox | No isolation |
|---|---|---|---|
Expand Down Expand Up @@ -230,6 +231,7 @@ accepted; a key given in two layers is refused. On the command line a layer's se
| GEPA, SkillOpt, ReHarness, Continual Harness, OPRO | Evolver Agent | `direct` (`ctx.agent`); OPRO in OfficeQA: `codex` through `llm: {cli: codex}` |
| Meta-Harness Adapter, `codex` and `claude` Evolvers | Evolver Agent | `codex` or `claude` |
| `pi` Evolver | Evolver Agent | `pi` |
| `opencode` Evolver | Evolver Agent | `opencode` |
| RRSI Adapter | Evolver Agent: upstream's rules and roles, the proposer's prompt | `codex` or `claude` for the proposer, and the same, one call per upstream `generate`, for the analyst, digesters and critic |
| AHE Adapter | Evolver Agent: the Evolve Agent and the Agent Debugger | `codex` or `claude`, one session per step and per task |
| CL-Bench, ServeLearnBench | Acting Agent running the benchmark's loop | `direct`, per call, through the local endpoint |
Expand Down
10 changes: 8 additions & 2 deletions docs/framework/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ hermit deploy --adapter DIR --workspace WORKSPACE --host codex
hermit deploy --adapter DIR --workspace WORKSPACE --host claude-code
hermit deploy --adapter DIR --workspace WORKSPACE --host pi
hermit deploy --adapter DIR --workspace WORKSPACE --host mini-swe-agent
hermit deploy --adapter DIR --workspace WORKSPACE --host opencode
```

This generates host instruction files, role/skill files, and tool configuration. It does not launch the acting
Expand All @@ -80,7 +81,12 @@ instead; its `.pi/` files (tools, skills) load once the user trusts the project
trust. mini-swe-agent reads one config file, so `--host mini-swe-agent` writes `mini-swe-agent.yaml`: Hermit's
prompts over mini-swe-agent's `mini` config, with the context, the names of the adapter's skills, roles, hooks and
other files, and its tools as one bash command (`hermit-tool`) in the system template; run `mini -c
mini-swe-agent.yaml` from the workspace ([tutorial](../tutorials/mini-swe-agent.md)). `--context-limit BYTES` (Codex) is the `project_doc_max_bytes` your Codex configuration sets, 32768 (Codex's
mini-swe-agent.yaml` from the workspace ([tutorial](../tutorials/mini-swe-agent.md)).
`--host opencode` writes `AGENTS.md`, the project's `opencode.json` (the tools, offered directly) and
`.opencode/skills`, which OpenCode loads with no trust step; it names roles and hooks in `AGENTS.md`, as for Pi.
OpenCode 2.2 waits at most 2 s for the tools' server it starts, which takes about 3 s: an `opencode run` given its
prompt at once may send the first request without the adapter's tools (the `opencode` acting agent serves them itself).
`--context-limit BYTES` (Codex) is the `project_doc_max_bytes` your Codex configuration sets, 32768 (Codex's
default) when not given: a longer `AGENTS.md` is refused, since Codex would cut it; `0` skips the check. It is the per-project way to use an adapter; the per-agent way, `convert`, and how the two compare are in
[What is a harness adapter?](what-is-a-harness-adapter.md#two-ways-to-use-an-adapter). The workspace must be an empty directory or one previously generated for the same host, separate from
the adapter directory. See the [file mapping](adapter.md#acting-interface) for exact paths and update behavior.
Expand Down Expand Up @@ -170,7 +176,7 @@ It is not an HTTP preview server or the proposed standalone-service launcher. `-
`evolver_access.environment`) and that no declared path holds the data, the judge or the runs. It does not check
the pipeline's host: adapters are meant to be usable by any acting agent, and each pipeline deploys the exports
(context, tools, roles, skills) in its own way.
- `hermit deploy --adapter DIR --workspace WORKSPACE --host codex|claude-code|pi` copies an adapter to
- `hermit deploy --adapter DIR --workspace WORKSPACE --host codex|claude-code|pi|mini-swe-agent|opencode` copies an adapter to
`hermit/<id>/` in a host workspace and connects its exports there (context block, MCP tools, native roles, skills,
hooks).
- `hermit convert --adapter DIR --output OUT --target ...` emits a plugin in the host's native format instead,
Expand Down
Loading
Loading