8000 Add DeepSeek Harness (dsh) as a CLI Base Agent (acting agent and dsh Evolver) by iamziyuzhao · Pull Request #90 · Infini-AI-Lab/hermit · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
03fafff
Add DeepSeek Harness (dsh) as a CLI Base Agent (acting agent and dsh …
iamziyuzhao Nov 9, 2026
7a076fb
dsh: fixes from review round 1 (two independent reviewers on 03fafff)
iamziyuzhao Nov 9, 2026
9d87553
dsh: fixes from review round 2 (two independent reviewers on 7a076fb)
iamziyuzhao Nov 9, 2026
2021944
dsh: fixes from review round 3 (two independent reviewers on 9d87553)
iamziyuzhao Nov 9, 2026
f4b7b09
dsh: fixes from review round 4 (two independent reviewers on 2021944)
iamziyuzhao Nov 9, 2026
f1a92ea
dsh: fixes from review round 5 (two independent reviewers on f4b7b09)
iamziyuzhao Nov 9, 2026
37aee8c
dsh: fixes from review round 6 (two independent reviewers on f1a92ea)
iamziyuzhao Nov 9, 2026
207ea88
dsh: leave the Pi fixes to their own PRs
iamziyuzhao Nov 9, 2026
1bbd57c
dsh: test which steps of dsh's stream count as calls
iamziyuzhao Nov 9, 2026
f4792e0
dsh: test a command dsh moves to the background at its timeout
iamziyuzhao Nov 9, 2026
d25958a
dsh: read a timeout marker at any timeout dsh prints (review round 8)
iamziyuzhao Nov 9, 2026
a43698d
dsh: wording from review round 9
iamziyuzhao Nov 9, 2026
cacb4ae
dsh: an outage only by the run's own end; the web-search test on the …
iamziyuzhao Nov 10, 2026
0ddba64
Merge main (6e421a4: mini-swe-agent #49, #87, #88) into the dsh branch
iamziyuzhao Nov 10, 2026
ace8fab
dsh: an overload dsh leaves unclassified is an outage by its words (r…
iamziyuzhao Nov 10, 2026
1e75c6f
dsh: guards and wording from review round 11 (post-PR audit of ace8fab)
iamziyuzhao Nov 10, 2026
77f3d75
Merge main (f469f59: ASPIRE #74, GPUs in the sandbox #93) into the ds…
iamziyuzhao Nov 10, 2026
f0d2091
dsh: documentation (the pages, the changelog, the AHE template's notes)
iamziyuzhao Nov 10, 2026
a7883d8
dsh: documentation, review round 13's corrections
iamziyuzhao Nov 10, 2026
d66105a
dsh: documentation, two corrections from the read-back
iamziyuzhao Nov 10, 2026
1f25839
Merge main (1b0d897) into the DeepSeek Harness branch
iamziyuzhao Nov 10, 2026
947f146
dsh: deploy retires stale skills as every host does since #97
iamziyuzhao Nov 10, 2026
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
16 changes: 13 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ Changes are grouped by software version. Entries under Unreleased describe work
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`.
- DeepSeek Harness as a CLI Base Agent (`dsh`): the acting agent `agent.base: dsh` and the `dsh` Evolver run DeepSeek
Harness 0.2.2-rc.1's `dsh --profile headless --json` in its own home, with a model reference as its `llm-pi-ai`
provider (the key by its variable's name); the call's tools are an MCP server; a run with no completed end, or whose
tools did not start, fails even when `dsh` exits 0. DeepSeek Harness takes no roles and no login;
`agent.dsh.permission_mode` picks its own sandbox; `image_input: true` declares a bound model that takes images;
`web_search: true` gives web fetch only unless the model is reached through DeepSeek's API on `DEEPSEEK_API_KEY`. The
MWM and RRSI Adapter Evolvers refuse `evolver.params.backend: dsh`. `hermit deploy --host dsh` writes the adapter's
tools, with a 120 s timeout, in a patch layer, `.dsh/hermit.patch.yml`, which a session loads with `--patch`.
- 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 Expand Up @@ -183,13 +191,15 @@ Changes are grouped by software version. Entries under Unreleased describe work
- The CLI Base Agents share one runner, `CliAgent` (`hermit/agent/base/cli.py`): what differs per CLI (its command,
its home, how its event stream is read) is its subclass's hooks, and `CLIS` names every CLI. `codex` and `claude`
behave as before; a new CLI is one subclass.
- `Usage` gains `unreported_calls`, the calls whose tokens a CLI did not report (only DeepSeek Harness's reader sets
it): a usage that has any keeps an unknown cost, not the price of the tokens reported.

### Fixed

- A redeployment (`hermit deploy` into the same workspace) left a skill the new adapter no longer exports in the
host's skills folder (`.codex/skills`, `.claude/skills`, `.pi/skills`, `.opencode/skills`), where the agent still
loaded it, and a file a skill no longer has inside its copy. Each exported skill's copy is now replaced, and a
skill the last deployment's record names that this one does not export is moved to `.retired-skills/` (as a
host's skills folder (`.codex/skills`, `.claude/skills`, `.pi/skills`, `.opencode/skills`, `.dsh/skills`), where the
agent still loaded it, and a file a skill no longer has inside its copy. Each exported skill's copy is now replaced,
and a skill the last deployment's record names that this one does not export is moved to `.retired-skills/` (as a
role is to `.retired-roles/`); a skill the user put there stays. A redeployment refuses, before writing anything,
when an exported skill would replace a skill folder no deployment wrote or the skills folder is a link (#96).
- ASPIRE's generated programs ran unconfined on the host: cap-harness runs them, and ASPIRE's program validator is
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ own tests under `examples/*/utils/tests/`) is:
python -m pytest
```

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

A pull request that adds or changes tests also answers the
Expand Down
2 changes: 1 addition & 1 deletion docs/developer/sandbox-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ way. A task whose own code calls a model (CL-Bench's and ServeLearnBench's runne
not copied: `CLAUDE_CODE_OAUTH_TOKEN` passes by name for the call that runs the session, never in a sandbox's own
variables (so neither its other commands nor its judge get it), and `api.anthropic.com` is allowed; in a container it
reaches the CLI on a file descriptor. A CLI learner that names neither a model reference nor a login copies the CLI's
own sign-in from the user's home.
own sign-in from the user's home; the `dsh` Evolver copies nothing (`home: []`): give it a model reference.

What a run keeps and may share is scrubbed of every key value (`hermit/redact.py`); each value of a key-like variable
of the Trainer (`..._API_KEY`, `..._KEY`, `..._TOKEN`, `..._SECRET`, at least 16 characters) becomes `<VARIABLE>`.
Expand Down
2 changes: 1 addition & 1 deletion docs/developer/service-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ with a control channel; today only the Lean collaboration run script plays that
`serve` is never typed by a user: it is the line `deploy` and `convert` write into the host's configuration, and
the host starts it. The user-facing consumption commands stay two, `deploy` (into a project) and `convert` (into
the agent). `serve` is host-agnostic by construction: it speaks MCP and nothing else, so the same process serves Codex,
Claude Code, Pi, Hermes or a custom pipeline. Everything host-specific (where the command line goes, which plugin
Claude Code, Pi, DeepSeek Harness, Hermes or a custom pipeline. Everything host-specific (where the command line goes, which plugin
slot takes the context) stays in `deploy` and `convert`. With this section, `deploy` and `convert` reduce to
copying context, skills and roles and writing the `command` line into the host's own format; `hermit check` can verify `health` before a run, and `serve` self-checks
at start. The stdio `serve` command exists. The proposed health check, lifecycle switch, standalone launcher, and relay do not; the `tools` in `exports.yaml` and the current runtimes are available.
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, 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.
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.

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
43 changes: 29 additions & 14 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`, `mini-swe-agent` and `opencode` acting agents, which deploy as `hermit deploy` does: an adapter
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
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 | 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` |
| Adapter source | Deployment operation | Codex output | Claude Code output | Pi output | mini-swe-agent output | OpenCode output | DeepSeek Harness output |
|---|---|---|---|---|---|---|---|
| Every file but `.hermit/` and `.git/` | Copy it as it is. | `hermit/<id>/` | `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` | `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/` | `.dsh/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 | named in `AGENTS.md` (DeepSeek Harness has no role file): name, description, the path of its instructions |
| `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` |
| 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) |
| 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` |

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 All @@ -96,7 +96,9 @@ export placed as files keeps its information but not its mechanism (a hook named
agent runs it), and the deployment record (`.hermit-deploy.json`, `placed`) says which exports went where. The
context must fit what the host reads: Codex reads `AGENTS.md` up to its `project_doc_max_bytes` (32 KiB unless set)
and drops the rest without a word, so the Codex deployment refuses a longer `AGENTS.md` (`hermit deploy
--context-limit`, the acting agent's `project_doc_max_bytes`). A hook runs in the
--context-limit`, the acting agent's `project_doc_max_bytes`). DeepSeek Harness gives the model at most 65,536 bytes
of a project's instructions and cuts the rest, so its deployment refuses an `AGENTS.md` that would not fit.
A hook runs in the
directory the session started in, so the deployment prefixes each command with `cd hermit/<id>` (its absolute path):
a hook finds the files it names where it found them in training. Interactive Codex asks the user to trust the
project's hooks before they run, and `codex exec` skips hooks nobody trusted, so the built-in Codex agent passes
Expand Down Expand Up @@ -159,6 +161,17 @@ opencode-workspace/ # roles stay files under hermit/<id>/, named in AGENTS.
.hermit-deploy.json
```

```text
dsh-workspace/
AGENTS.md
hermit/file-example/
ADAPTER.md exports.yaml tools.py agents/ skills/ README.md
.dsh/
hermit.patch.yml # the tools and the skills' folder; a session loads it with --patch
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 Down Expand Up @@ -187,8 +200,8 @@ before writing anything, when a copied file was changed or replaced (by a direct
deployment or another file is in the way, when an exported skill would replace a skill folder no deployment wrote,
or when the skills folder is a link (or reached through one), and
names the file; an adapter link that leads outside the adapter is refused too.
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
The generated `.codex/config.toml`, `.mcp.json`, `.pi/mcp.json`, `mini-swe-agent.yaml`, `opencode.json` or
`.dsh/hermit.patch.yml` is rewritten on deployment; it is not a general configuration
merger. Global host configuration is not modified.

### Tools run from the adapter source
Expand All @@ -201,7 +214,9 @@ python -m hermit.runtime.mcp_server --adapter /absolute/path/to/adapter ...
```

That wrapper exposes the declared tool schemas, loads the Python functions, and returns their results to the
acting agent. The source adapter and its runtime dependencies must remain available.
acting agent. The source adapter and its runtime dependencies must remain available. If DeepSeek Harness cannot start
the wrapper, it says so on its stderr and goes on without the tools: the `dsh` acting agent then fails the session,
but a session started by hand continues.

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