Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6578a05
feat(ahe-beta): add native simulated-user Codex adapter evolution
mmjzmy Nov 16, 2026
b891897
fix(ahe-beta): isolate user channel and trusted service cleanup
mmjzmy Nov 19, 2026
6d026ba
fix(cli): repair invalid web search settings syntax
mmjzmy Nov 19, 2026
ac1c530
refactor(ahe-beta): use the standard evolver guide name
mmjzmy Nov 19, 2026
3531c7c
docs(ahe-beta): cite the requirement-centered evolution paper
mmjzmy Nov 19, 2026
9483456
fix(ahe-beta): enforce adapter delivery boundaries
mmjzmy Nov 20, 2026
2094fd0
feat(ahe-beta): bootstrap pinned delivery workspace
mmjzmy Nov 20, 2026
bef1304
test(ahe-beta): align acting fixtures with Harbor checks
mmjzmy Nov 20, 2026
8c32ac6
refactor(hermit): keep adapter contract in integration layer
mmjzmy Nov 20, 2026
d643c61
Merge main into feat/ahe-beta-integration
iamziyuzhao Nov 24, 2026
9d72e20
ahe-beta: leave Hermit's core as main has it
iamziyuzhao Nov 24, 2026
10be97d
ahe-beta: keep the template and AHE-Beta's own Evolver in the example
iamziyuzhao Nov 24, 2026
49202a9
ahe-beta: the simulated user on Hermit's Codex agent in each task's H…
iamziyuzhao Nov 24, 2026
d68e99c
ahe-beta: the recorded verdict holds only what a learner may read
iamziyuzhao Nov 24, 2026
068549f
ahe-beta: fixes from an independent review
iamziyuzhao Nov 24, 2026
47b8768
ahe-beta-adapter: rename, ten review rounds, AHE-Beta's team in the r…
iamziyuzhao Nov 25, 2026
11e2cdb
ahe-beta-adapter: the delivery route run end to end, review rounds 11-30
iamziyuzhao Nov 26, 2026
b5d73aa
Merge main into feat/ahe-beta-integration
iamziyuzhao Nov 28, 2026
fa7e1c6
ahe-beta-adapter: the bridge test's socket named relative to its folder
iamziyuzhao Nov 28, 2026
1731144
ahe-beta-adapter: the first evaluation's record (OfficeQA, GPT-5.6-Luna)
iamziyuzhao Nov 29, 2026
f77a3ab
ahe-beta-adapter: examples/README.md as main has it
iamziyuzhao Nov 30, 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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ Changes are grouped by software version. Entries under Unreleased describe work

### Added

- The AHE-Beta Adapter (AHE-Beta, arXiv:2611.24924, `examples/ahe_beta_adapter/`, `docs/methods/ahe_beta_adapter.md`):
AHE-Beta's requirement-centered harness evolution confined to a Codex adapter. `utils/user.py`'s `UserCodexAgent`
(a `CliAgent`) runs one Codex session in each task's Harbor environment while a simulated user, written against
`simulate(task, agent, workspace, params)`, talks to it through Codex hooks and a root-owned bridge (messages while it
works, follow-ups, interrupts, then a verdict); `utils/ahe_user.py` puts AHE-Beta's own simulator behind it, its
model reached through Hermit; `utils/judge.py` scores the verdict the host kept; `prepare.py` turns an AHE-Beta
cohort into a run whose learner never reads a persona. AHE-Beta's own demand and delivery Evolver (Gitea,
OpenAgents) is in `delivery/`: its controller and worker run in the run's sandbox; run end to end once (a U4 round
on the paper's models, its delivery bound for the next round), not evaluated.
- `examples/officeqa_harbor/`: OfficeQA as Harbor's task set (harbor-datasets' `datasets/officeqa`, pinned) in the
OfficeQA paper's evaluation: each question in its own Harbor environment, the paper's agent prompt, the final
message's `<FINAL_ANSWER>` scored by the paper's `reward.py` (the OfficeQA repository's at its commit) at a 0.0%
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ methods/aspire
methods/meta_harness_adapter
methods/ace
methods/ahe_adapter
methods/ahe_beta_adapter
methods/rrsi_adapter
methods/evosafe
methods/opro
Expand Down
146 changes: 146 additions & 0 deletions docs/methods/ahe_beta_adapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# AHE-Beta Adapter

AHE-Beta, Agentic Harness Engineering Beta: Requirement-Centered Evolution of Agent Harnesses
([arXiv:2611.24924](https://arxiv.org/abs/2611.24924), [code](https://github.com/Curry09/AHE-Beta)), evolves a coding
agent's harness from what simulated users ask for while they work with it, in three parts: user-driven evaluation (a
user simulator follows a persona through multi-turn sessions, sends follow-ups and messages while the agent works,
interrupts it, checks the result with its own commands, then rates the session from 1 to 4 and files the issues it
saw), team-based modification (on a Gitea repository, Triage drops invalid and task-specific issues, an Architect merges
issues that share a root cause into an RFC, a PM mines unstated requirements, developers implement) and
requirement-driven selection (a change merges only when it resolves a verified requirement and passes review; no
verifier result or benchmark score is used while the harness evolves). AHE-Beta edits its whole NexAU seed harness: the
agent's configuration and entry point, its tool definitions, its prompts and parameters. **AHE-Beta Adapter is
AHE-Beta's loop confined to an adapter:** the acting agent (Codex), its loop and its tools are fixed, and only the
adapter's files change: Codex's project instructions, command hooks, helper scripts, skills and roles. AHE-Beta's own
Hermit integration makes the same choice: its handoff to the delivery team names "an external Hermit Adapter deployed
to an unchanged host" as the evolving product. Choose it when the learning signal is a user's (here a simulator's)
judgment of interactive sessions rather than a verifier's score.

## Setup

```bash
PYTHONPATH="$AHE_ROOT/backend" python -m ahe_beta.integrations.hermit.export \
--experiment "$AHE_ROOT/examples/experiments/u8-mixed-e2b.json" --output <cohort> --cache <material cache>
python examples/ahe_beta_adapter/prepare.py --cohort <cohort> --ahe-root "$AHE_ROOT" --run-id u8-codex
```

`prepare.py` writes the run beside AHE-Beta's export: the rows (`rows.jsonl`: id, Harbor task, instruction), each
session's assignment (`assignments.json`: its persona, scenario and round, read only by the acting agent), the splits
without the sessions it leaves out (a task with a companion container), what the learner is told of the tasks and
their records (`task-info/README.md`) and `run.yaml` (paths shown schematically; prepare.py writes them absolute):

```yaml
template: examples/ahe_beta_adapter/template # ahe-beta-adapter@1.0
agent:
name: examples/ahe_beta_adapter/utils/user.py:UserCodexAgent # Codex in each task's Harbor environment
base: codex
params:
user: {simulate: ahe_user:simulate, assignments: assignments.json, params: {model: ...}} # AHE-Beta's simulator
judge: {path: examples/ahe_beta_adapter/utils/judge.py, name: user} # the user's rating, (rating - 1) / 3
evolver: {name: codex, base: codex, params: {tools: [check_spec]}} # Hermit's Codex Evolver
data: {step_size: <a round's sessions>, shuffle: false} # one step = one round of the cohort
```

The example's [README](https://github.com/Infini-AI-Lab/hermit/tree/main/examples/ahe_beta_adapter) has the setup
(AHE-Beta's pinned checkout, Harbor, the Codex release mounted into each task's container) and AHE-Beta's own demand
and delivery Evolver (`examples/ahe_beta_adapter/delivery/`: its team in the run's sandbox, run end to end once, not
evaluated).

## The template

`examples/ahe_beta_adapter/template/` (`ahe-beta-adapter@1.0`):

| Path | Learnable | Limits | What reaches the acting agent |
|---|---|---|---|
| `ADAPTER.md` | yes | 32 KB | Codex's project instructions |
| `.codex/hooks.json` | yes | 24 KB | command hooks; Stop hooks without a matcher, run inside the user's Stop hook |
| `scripts/*.py` | yes | 40 files, 200 KB each | helpers the shell runs |
| `.agents/skills/*/SKILL.md`, `.agents/skills/*/scripts/*` | yes | 40 skills, 80 scripts | skills (a `description` in the frontmatter) |
| `agents/*.md` | yes | 20 files | Codex roles (`name`, `description`) |
| `exports.yaml`, `README.md` | no | | what the deployment exports |

`.hermit/check.py` refuses hooks of unknown events, hooks not shaped as Hermit loads them (each event a list of
groups, each hook a `command` hook with a command), a Stop hook with a matcher, an empty `ADAPTER.md` and a script
that does not compile. After every step of the validated route the Trainer checks the adapter against the template and
repairs it (a file outside every path removed, a fixed file restored, a learnable file in a wrong format back to the
parent's); AHE-Beta's own Evolver (`run-delivery.yaml`) refuses a delivery that fails the check instead, and the step
fails with the adapter as it was.

## One framework step

```mermaid
flowchart LR
A[adapter H_r] --> R[round r: every seed once,<br/>Codex in its Harbor environment,<br/>AHE-Beta's user over the channel]
R --> V[the users' verdicts: rating, outcome,<br/>reason, issues; their transcripts]
V --> L[one Codex learner session,<br/>AHE-Beta's protocol in EVOLVER.md]
L --> C[check_spec, repair]
C --> B[adapter H_r+1]
```

A step is one round of the cohort: every seed once with its persona (`data.step_size` is a round's sessions). Each
session is one `codex exec` in the task's own Harbor environment, led by AHE-Beta's simulator through three Codex hooks
and a root-owned bridge (a message inserted after a tool call, a tool call denied after an interrupt, a Stop that hands
the reply to the user and continues with the user's next message). The judge scores the user's rating and gives the
learner what the user said. The Codex Evolver reads the round's verdicts, the user transcripts and the agent's event
streams (never a persona or the simulator's own records) and edits the adapter following AHE-Beta's protocol in the
template's learner guide (`.hermit/EVOLVER.md`, adapted from its Triage, Architect and PM roles): issues as evidence of
requirements, merged by root cause, changed at the layer that owns the behaviour, with no task names. The next round runs the new adapter; the final adapter is the last step's.

## Parameters

The learner is Hermit's [Codex Evolver](agent.md), with `check_spec` as its only Hermit tool (beside its own files
and shell):

```{literalinclude} ../../hermit/agent/evolver/methods/codex/evolver.yaml
:language: yaml
```

`prepare.py` sets the models (`--actor-model`, `--user-model`, `--learner-model`: a Codex model name on the ChatGPT
login, or a `<backend>/<model>` reference) and their efforts; the user's options (`user.wait_s`, `exit_wait_s`,
`review_s`) are in `utils/user.py`'s docstring.

## Records

Each rollout's log holds `user-transcript.jsonl` (every message, reply and tool event the user could see),
`user-verdict.json` (the visible verdict) and, for a session the user rated, `user-reward.txt`; the simulator's own
records (its session, the persona, its private checks, AHE-Beta's full outcome) stay under the acting agent's
`<workspaces>/user/<session>/`, outside every log, and its usage ledger beside them (`user-model/usage.jsonl`).

## The authors' implementation against this one

| Dimension | AHE-Beta (43b165f) | AHE-Beta Adapter | Why | Open? |
|---|---|---|---|---|
| When learning happens | after each round: every seed once with its persona; five rounds learn, the sixth is observed | the same: one step is one round (`step_size`: the round's sessions), one epoch; the last round is the evaluation split | Same | no |
| What the learner sees | Triage: issues with their evidence, interaction records, harness logs; PM: ratings and summaries; never a persona prompt or a verifier | the users' verdicts (rating, outcome, reason, issues), their transcripts, the agent's event stream; no persona and no simulator record; the task's verifier verdict is recorded with each rollout (AHE-Beta's exported tasks only copy the user's rating) | Framework: the learning material | no |
| Each component's carrier | NexAU's whole seed harness: configuration, entry point, tool definitions and their code, prompts, parameters; written by the developer agents | the adapter's files (the table above): instructions, command hooks, scripts and skills, roles; written by the learner only; Codex's loop, tools, context handling and sampling fixed | Framework: the acting agent is fixed; the reason for the name | no |
| The update | requirement-driven: Triage, the Architect's RFC, the PM, admission, developers' pull requests, review; a change merges only for a verified requirement | one Codex learner session with AHE-Beta's protocol as text (`.hermit/EVOLVER.md`), `check_spec`; every step kept, no gate, no rollback | Decision: the validated route; AHE-Beta's own pipeline is in the example, run end to end once | yes: requirement-driven selection |
| User simulation | its persona loop, private checks, terminal review | the same code, its transport Hermit's channel in each task's Harbor environment | Same | no |
| Tasks and runtime | 32 seeds; U8, U16 and U32 over six rounds; E2B sandboxes with internet access | the same cohorts as Harbor task directories (local Docker, the public network), without the sessions whose task needs a companion container (one a round in U8 and U16, two in U32) | Framework: a Hermit environment does not reach a companion container yet | yes: companion containers |
| Models and budgets | GLM-5.3-Flash acting and user, GLM-5.3 team, Claude Code developers; the recipes' budgets | configuration (GPT-5.6-Luna on a ChatGPT login by default, GLM-5.3-Flash by reference); the exporter's budgets, Codex's clock ending `review_s` before the deadline | Decision | no |
| What is not ported | | the held-out evaluation suite (38 Harbor-index tasks), its evaluation persona, the human A/B study | Decision | yes: the held-out evaluation |

## Result

The first evaluation is on OfficeQA with GPT-5.6-Luna in every role, AHE-Beta's schedule on the 50 training questions
(five rounds that learn, a sixth observed) and one pass over the 172 test questions without a user
([record](https://github.com/Infini-AI-Lab/hermit/tree/main/examples/ahe_beta_adapter#first-evaluation)):

| Evaluation | No adapter | Starting adapter | Final adapter | Final − starting (paired) |
|---|---|---|---|---|
| `examples/officeqa`, exact match (2026-11-27) | 0.308 | 0.366 | 0.471 | +10.5 points, SE 3.4 |
| `examples/officeqa_harbor`, the OfficeQA paper's scorer at 0.0% (2026-11-28) | 0.576 | 0.622 | 0.605 | −1.7 points, SE 3.0 |

The first run's gain is the answer's form (22 of its 27 gained questions already held the reference's value), and its
users' ratings did not move, because AHE-Beta's terminal review at `43b165f` reads an 80-character preview of each
reply. The second run fixed that in a local copy of AHE-Beta: the rating then follows a correct answer, but neither
it (3.50 in round 1, 3.46 in round 6) nor the test score rose. No experiment of the paper's has run: its tasks are
coding, optimization, analysis and tool use, and its held-out suite is not packaged.

## What it is not

The learner cannot change Codex's own loop, tools, context handling or sampling: a tool is a script the shell runs or a
skill, and a behaviour at run time acts only through what Codex's hooks allow (add context after a tool call, deny a
tool call, block a stop). The validated run (`run.yaml`) gives the learner AHE-Beta's protocol as text; it has neither
AHE-Beta's team nor its requirement-driven selection, which only `run-delivery.yaml` runs (run end to end once on one
round, not evaluated).
The held-out evaluation is not packaged.
2 changes: 2 additions & 0 deletions docs/methods/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ template–method combinations meaningful.
| Refine a policy, sub-agents, skills and memory in place from each step's trajectories, without a gate | [Continual Harness](continual_harness.md) | `continual-harness@1.1` | Learner model endpoint, Codex |
| Grow an itemised playbook by incremental deltas from reflections, keeping the best validation playbook | [ACE](ace.md) | `ace@1.0` | Learner model endpoint; optional validation split |
| Evolve an agent's harness (prompt, middleware, scripts, skills, sub-agents, memory) from k rollouts per task, with each change attributed and reversible | [AHE Adapter](ahe_adapter.md) | `ahe@1.0` | An acting agent that runs hooks (Codex, Claude Code), a learner CLI (Codex, Claude Code or Pi), k rows per task |
| Evolve a Codex adapter from what simulated users ask for in interactive sessions (their ratings and issues, no verifier score), one round of persona-led sessions per step | [AHE-Beta Adapter](ahe_beta_adapter.md) | the example's `ahe-beta-adapter@1.0` | AHE-Beta's checkout (its user simulator), Harbor task environments with python3 and a Codex release mounted, a ChatGPT login or model references |
| Search a dual-surface defense (prompt + tool hooks) for a frozen victim against frozen attack cases | [EvoSafeHarness](evosafe.md) | `evosafe@1.0` | Hook-bridge pipeline, utility/attack judge (verdicts in `JudgeResult.extra`), optional validation split, Claude Code, Codex or Pi |
| Search instructions with a model that reads the best earlier instructions with their training scores | [OPRO](opro.md) | `prompt-only@1.0` | Learner model endpoint; validation split for `select: validation` |
| Build a persistent world model from an ordered environment stream | [MWM](mwm.md) | `mwm` | Evidence store, deployment description, tools, Linux learner environment, a learner CLI (Codex, Claude Code or Pi) |
Expand Down Expand Up @@ -42,6 +43,7 @@ task-specific service overhead. Call counts vary with evidence, candidates, and
| Continual Harness | Four Refiner calls per step (policy, sub-agents, skills, memory); no candidate rollout, no validation | Step log in `state/`; the memory the agent writes comes back with each trajectory | Current adapter |
| ACE | Per sample: one Reflector call, or for a wrong answer up to `max_num_rounds` Reflector calls and agent re-runs, one Curator call; validation at each epoch's end when `data.val` is set | `state/ace.json` (sample records, validation scores) and the best validation playbook | Best validation playbook, else the current one |
| AHE Adapter | Per step: one Agent Debugger session per task (up to three attempts) and one Evolve Agent session; no candidate rollout, no validation | `state/`: stats, Debugger reports, manifests, verdicts, rollbacks, best-ever | Best-ever iteration by training pass rate, or the last |
| AHE-Beta Adapter | Each rollout is a whole conversation: the simulated user's model calls (its turns, its checks, its review) beside the actor's; one Codex learner session per step (`run-delivery.yaml`: AHE-Beta's delivery team instead, its demand roles and Claude Code developers); no candidate rollout, no validation | Notes the learner keeps in `state/` (`run-delivery.yaml`: AHE-Beta's controller state and its Gitea repository, outside the run) | Current adapter |
| EvoSafeHarness | Per trial: Designer, Criticizer and Analyzer calls, plus candidate runs on the training cases (and the parent's validation cases when a candidate qualifies); the parent reuses the step's rollouts when they match | Lessons archive and trial history | Last promoted bundle |
| OPRO | `n_candidates` optimizer calls per step; each new instruction run on every training task; with `select: validation`, the `top_k` best run on validation at the end | `state/opro.json` (every instruction with its per-task training scores) | Best training score, or the best validation mean of the top `top_k` |
| MWM | Maintenance and a learner session per eligible block, plus native bootstrap/retry behavior | World-model adapter plus method/session records | Current world-model adapter |
Expand Down
Loading
Loading