Skip to content
Draft
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ Changes are grouped by software version. Entries under Unreleased describe work

### Added

- CaP-Agent0 (CaP-X, arXiv:2603.22435; capgym/cap-x at acac62f): the `cap-agent0@1.0` template (the skill
library, `skill_library.py`, rendered by its context tool and checked against the cap-harness engine's program
rules), the acting agent `hermit.agent.evolver.methods.cap_agent0.actor:CapAgent0Actor` (cap-x's trial loop on the
engine: the multi-turn loop replayed per turn, the Visual Differencing Module, the parallel ensemble; every call one
`Direct` call), and the `cap_agent0` Evolver (cap-x's library compile, `setting: paper` for the paper's single
pass, `setting: continual` for a synthesis after every step with validation-based selection), with cap-x's pure
functions and prompts copied verbatim. `examples/libero/cap_agent0/`: one task row per trial on LIBERO-Pro
(`rows.py`), the paper's pipeline (`paper.yaml`) and the continual setting (`continual.yaml`), smoke configs.
- `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 @@ -76,6 +76,7 @@ methods/harness2
methods/continual_harness
methods/reharness
methods/aspire
methods/cap_agent0
methods/meta_harness_adapter
methods/ace
methods/ahe_adapter
Expand Down
252 changes: 252 additions & 0 deletions docs/methods/cap_agent0.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/methods/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ template–method combinations meaningful.
| Evolve whole adapters round by round under regularizers against overfitting the evolve set: an annealed edit budget, the edit history, exploration when stalled, a pre-evaluation leakage critic, a noise-adjusted floor and a cost rule | [RRSI Adapter](rrsi_adapter.md) | `rrsi-adapter` | A training split (the evolve set, k rows per task), a proposer CLI (Codex, Claude Code or Pi), the `rrsi` dependency group, a domain module with the benchmark's texts |
| Learn the framework contract offline | [Quick Start](../get-started/quickstart.md) | Prompt-only with a teaching learner | Included toy tasks |
| Grow a library of verified skill entries from robot tasks, each proposal re-solved by a fresh actor before it is admitted, with the coordinator choosing the next task | [ASPIRE](aspire.md) | `aspire` | A coordinator CLI (Codex, Claude Code or Pi), verifier task rows in `data.val`, an acting agent that delivers the adapter |
| Synthesize a library of helper functions from the functions that recur in successful robot programs, for a multi-turn coding agent with visual differencing and a parallel ensemble | [CaP-Agent0](cap_agent0.md) | `cap-agent0@1.0` | The run's `llm`, the cap-harness engine on the host, one task row per trial; validation trials for the `continual` setting |

A learner model endpoint above can be your Claude subscription, and a learner CLI can run on it, with no API key:
[Claude subscription](../guides/claude-subscription.md) says which roles go which way.
Expand All @@ -48,6 +49,7 @@ task-specific service overhead. Call counts vary with evidence, candidates, and
| ReHarness | Per instance, one reflection call, one revision call per retrieved reflection (up to k) and one embedding call; no candidate rollouts or validation | Reflection bank in the adapter; source trajectories and per-instance retrieval and revision records in `state/` | Current adapter: the bank after the last instance |
| Meta-Harness Adapter | One proposer session per round writing k candidates; each candidate is a full rollout of the search set, one step per candidate | Every candidate's files, hypothesis, base and per-task scores in `state/` | Best mean on the search set |
| ASPIRE | Per task, one coordinator session and, when it proposes entries, a verifier rollout (a fresh actor on the task's verifier row) | The coordinator's curriculum and changelog notes in `state/` | Current adapter: the library after the last task |
| CaP-Agent0 | Per synthesis (`paper`: once, at the epoch's end; `continual`: every step), one curation call; `continual` also runs the new library on every validation trial | `state/cap_agent0.json` (the pool of successful trials' code, each synthesis's record) and every library in `state/libraries/` | `paper`: the library; `continual`: the best validation mean, the starting library included |
| RRSI Adapter | Per round: the analyst with a digester per rendered trace (a session per turn), m proposer sessions with the critic's review and repairs, a smoke on the domain's smoke tasks per screened candidate; each candidate is a full rollout of the evolve set (k rows per task), one step per candidate | Every candidate's files and digest, the edit history, the attribution and the frontier in `state/` (upstream's files under `state/rrsi/`) | The incumbent H_T, admitted above the noise floor and within the cost rule |

`use_gate: false` in SkillOpt removes the ordinary improvement requirement, **not** the validation calls.
Expand Down
3 changes: 3 additions & 0 deletions examples/libero/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ runs/
# ASPIRE's tasks and splits, written by aspire/tasks.sh at launch
aspire/tasks/
aspire/splits/
# CaP-Agent0's trial rows and splits, written by cap_agent0/tasks.sh at launch
cap_agent0/tasks/
cap_agent0/splits/
1 change: 1 addition & 0 deletions examples/libero/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on held-out seeds by the task's own success check.
| `utils/launch.sh` | Starts a method folder's run: the simulator service and hermit |
| [`aspire/`](aspire/) | The ASPIRE method (its session's task functions, verifier and coordinator are ASPIRE's own; `tasks.sh` adds its verifiers to the tasks). `run.yaml` (Object, Spatial, Goal, Long: 40 tasks), `run_90.yaml` (LIBERO-90), `run_pro.yaml` (LIBERO-Pro: 80), `run_pro_long.yaml` (LIBERO-Long-Pro), `run_luna.yaml` (`run.yaml` on Luna), `run_sample_luna.yaml` (six of the forty on Luna, for a run of a day or two), `smoke*.yaml`, `launch.sh` |
| [`prompt_only/`](prompt_only/) | The prompt-only template: one `ADAPTER.md` the built-in Codex Evolver revises after each task, with the method-neutral prompt. `run.yaml`, `run_pro.yaml`, `smoke.yaml`, `smoke_luna.yaml`, `launch.sh` |
| [`cap_agent0/`](cap_agent0/) | CaP-Agent0 (CaP-X): its own acting agent on the engine (the multi-turn loop with visual differencing and the parallel ensemble) and the `cap_agent0` Evolver's skill library; one task row per trial (`rows.py`). `paper.yaml` (the paper's pipeline: the single-turn collection, one synthesis, CaP-Agent0 on the test), `continual.yaml` (ours: a synthesis after every step, validation-based selection), `smoke_*.yaml`, `launch.sh` |

The `*_luna.yaml` configs run GPT-5.6-Luna on the machine's ChatGPT login; the others GLM 5.3 Flash on Fireworks.

Expand Down
100 changes: 100 additions & 0 deletions examples/libero/cap_agent0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# LIBERO-Pro with CaP-Agent0

[CaP-Agent0](https://capgym.github.io/) (CaP-X, Fu et al., [arXiv:2603.22435](https://arxiv.org/abs/2603.22435);
[code](https://github.com/capgym/cap-x)), the paper's training-free coding agent for robot control, on LIBERO-Pro in
the [cap-harness engine](../../cap_harness/): multi-turn code generation with the Visual Differencing Module (VDM),
the parallel ensemble, and the automatically synthesized skill library, which the
[`cap_agent0`](../../../docs/methods/cap_agent0.md) Evolver writes. One task row is one trial: a task and one seed.

Two settings, on the same trials:

| | `paper.yaml`: the paper's pipeline | `continual.yaml`: our continual setting |
|---|---|---|
| Training rollouts | the collection (`splits/collect.txt`): the single-turn, low-level tier, no VDM, no ensemble, no library (the paper names its S3 rollouts, with usage examples in the API's documentation, and cap-x's compile pools S3 and S4; the engine's has no examples, as S4) | CaP-Agent0 with the library as it stands (`splits/train.txt`) |
| The library | synthesized once, at the epoch's end, from the collection's successful trials | synthesized again after every step of fifty trials, from every successful trial so far |
| Selection | none: the one library | the best validation mean of every step's library and the starting one (`splits/val.txt`, run only by the Evolver) |
| Test | `eval --adapter final`: CaP-Agent0 with the library, frozen (`splits/test.txt`) | the same |

The library is frozen at test time in both. The paper synthesizes its library once from S3 rollouts (cap-x's compile
takes S3 and S4) on CaP-Bench's Robosuite tasks, pooled across twelve models, and calls the process "inherently
iterative"; the continual setting is that iteration, and is ours. A trial the agent or the judge failed (an outage, a
rerun that ran no episode) is an error row, never pooled and run again in validation; `hermit eval` counts it in
`errors` and as 0 in `mean_score`.

## The splits

`rows.py` (run by `tasks.sh` before every launch) writes one row per trial from the benchmark's tasks
(`../utils/benchmark/prepare.py`). The seed sets never meet: a test seed is never run before the test.

| Split | Trials | Suites | Seeds | Run by |
|---|---|---|---|---|
| `collect` | 200 | `libero_object`, `libero_spatial`, `libero_goal`, `libero_10` (unperturbed; 40 tasks) | 51-55 | `paper.yaml`'s training rollouts (the rows carry the single-turn tier) |
| `train` | 200 | the same 40 tasks | 51-55 | `continual.yaml`'s training rollouts |
| `val` | 60 | the six test suites (60 tasks) | 66 | `continual.yaml`'s Evolver |
| `test` | 3,000 | `libero_{object,spatial,goal}_{swap,task}`: Table 2's Pos and Task perturbations of Object, Spatial and Goal (60 tasks) | 1-50 | `eval` |
| `test_sample` | 300 | the same 60 tasks | 1-5 | `eval`, a cheaper look (rows of `test`) |
| `test_long` | 1,000 | `libero_10_swap`, `libero_10_task` (LIBERO-Long-Pro, beyond Table 2) | 1-50 | `eval` |

The `*_smoke` splits are two collection and two training trials (`libero_object` and `libero_spatial` task 0, seed
51), one validation trial (`libero_object_swap` task 0, seed 66) and two test trials (`libero_object_swap` and
`libero_object_task` task 0, seed 1).

The validation trials are the test's 60 tasks on a seed of their own (66): `continual.yaml` selects its library on
the perturbations it is tested on, never on a test trial, and the Evolver sees only their scores, not their
trajectories.

The seeds are `rows.py`'s own (`--train-seeds`, `--val-seeds`, `--test-seeds`, `--sample-seeds`; `tasks.sh` passes
none, so the ones above), and it refuses sets that meet. `ASPIRE_SEEDS` and `ASPIRE_EVAL_SEEDS` change only the
benchmark's own task rows, which these trials do not read.

A seed is a scene LIBERO samples (the engine's `--init-mode seeded`), not one of the fifty saved initial states the
paper's trials use (cap-x maps trial `t` to saved state `t - 1`), so a success rate here is not comparable with
Table 2's; [the engine and the protocol](../README.md#the-engine-and-the-protocol) say why. The judge runs each trial's
final program once more on its seed; the actor's own last run is its `output`, and the two can differ where a
perception or planning service is not deterministic (each turn records `replay_matches`).

## Run

As [ASPIRE's](../README.md#setup): an ASPIRE checkout at the pinned commit with `.venv-libero`, its SAM3, PyRoki,
cuRobo and Contact-GraspNet services up, and `FIREWORKS_API_KEY` for GLM 5.3 Flash. From this folder:

```bash
export ASPIRE_ROOT=/path/to/ASPIRE FIREWORKS_API_KEY=... ASPIRE_SIM_GPU=0
ASPIRE_CONFIG=smoke_paper.yaml ./launch.sh # the paper's pipeline, two trials
ASPIRE_CONFIG=smoke_paper.yaml ./launch.sh eval --adapter final # its two test trials
ASPIRE_CONFIG=smoke_continual.yaml ./launch.sh # ours, two trials and one validation trial

ASPIRE_CONFIG=paper.yaml ./launch.sh # collect, then synthesize once
ASPIRE_CONFIG=paper.yaml ./launch.sh eval --adapter final # CaP-Agent0 with the library on the test split
ASPIRE_CONFIG=paper.yaml ./launch.sh eval --adapter root # the same without a library
ASPIRE_CONFIG=continual.yaml ./launch.sh # ours
ASPIRE_CONFIG=continual.yaml ./launch.sh eval --adapter final
ASPIRE_CONFIG=paper.yaml ./launch.sh eval --adapter final data.test=splits/test_sample.txt # seeds 1-5 only
```

`ASPIRE_OUT` puts the runs on a large disk (default `../runs`). The two settings' runs are apart
(`trainer.run_name`, and the launcher's tree per config). The smoke configs use three ensemble temperatures, two
regenerations and `min_occurrences: 1`; the code path is the run's.

A trial is a probe episode, one episode per turn (a turn replays the blocks before it) and the judge's episode;
CaP-Agent0's default ensemble sends nine candidate requests and a synthesis per turn, with the VDM's one image
request. A run's `budget` bounds its training and validation; `eval` has none of its own.

## What to read after the smoke

In `$ASPIRE_OUT/actor-logs/<trial>-<stamp>/` (also each step's `trajectories/` in the learning material):

- `prompt.json`: the first request (the task prompt, the engine's API reference and the library's functions, then
the VDM's description of the initial frame) and the text the decision requests start from;
- `trial.json`: each turn's stdout and stderr, termination reason, `replay_matches` and decision, the VDM's
descriptions, and every ensemble candidate;
- `programs/turnNN.py`: what each turn ran (the library, then each block in its `try`); `code.py`: the blocks as
the synthesis reads them;
- `images/`: the initial frame and each turn's last frame (up to twelve a trial; the VDM compares them when it is on).
The smokes keep them; `paper.yaml` and `continual.yaml` set `agent.params.keep_images: false`, which removes them
when the trial ends (a test split is thousands of trials); `agent.params.keep_images=true` keeps them.

In the run's step directories: `output/skill_library_raw.txt` (the pooled, filtered functions), `output/prompt.md`
(the curation request), `output/skill_library.attemptN.txt` (each reply) and `output/skill_library.txt` (the one
kept), the step's `extra.record` (what was kept, why the others were left out, each attempt) and the adapter's
`skill_library.py`.
60 changes: 60 additions & 0 deletions examples/libero/cap_agent0/continual.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# CaP-Agent0 on LIBERO-Pro in our continual setting (not the paper's): CaP-Agent0 (multi-turn with the VDM and the
# parallel ensemble) acts on the four LIBERO suites, seeds 51-55 (splits/train.txt), fifty trials a step in a
# shuffled order; after every step the library is synthesized again from every successful trial so far and scored on
# the validation trials (splits/val.txt: the six test suites on seed 66, run only by the Evolver), and the run keeps
# the library that scored best there (the starting, empty one included). `./launch.sh eval --adapter final` then
# runs it, frozen, on the paper's LIBERO-PRO set (splits/test.txt, seeds 1-50), as paper.yaml's eval does.
# Started by launch.sh: ASPIRE_CONFIG=continual.yaml ./launch.sh.
data:
tasks: tasks # CaP-Agent0's trial rows (tasks.sh, rows.py)
view: ../../cap_harness/utils/agent/fields.py:task_row # each task as the row it always was
train: splits/train.txt
val: splits/val.txt
test: splits/test.txt
step_size: 50 # four steps, four syntheses
shuffle: true # the suites mixed in every step
shuffle_seed: 0
task_info: ../utils/benchmark/task-info
agent:
name: hermit.agent.evolver.methods.cap_agent0.actor:CapAgent0Actor
concurrency: 4 # trials at a time, each one simulator episode after the other
params:
engine: ../../cap_harness/utils/agent/sim.py # the engine the programs run on (ASPIRE's harness)
aspire_root: $ASPIRE_ROOT # an ASPIRE checkout with .venv-libero (launch.sh)
model: fireworks/accounts/fireworks/models/glm-5p3-flash
effort: medium # cap-x's reasoning_effort default
temperature: 1.0 # cap-x's default for a single request and the VDM
max_tokens: 20480 # cap-x's default
multi_turn: true
multiturn_limit: 10 # cap-x MULTITURN_LIMIT
vdm: true
vdm_model: null # null: the acting model (the paper's VDM is Gemini-3-Pro)
ensemble: single # nine temperatures of the acting model and a synthesis (the paper's +1M)
decision_prompt: upstream # the decision requests as cap-x builds them (docs/methods/cap_agent0.md)
max_steps: 8000 # cap-x's LIBERO CaP-Agent0 config
keep_images: false # a test split is thousands of trials: each one's frames go when it ends
judge:
path: judge.py # the engine's judge on the row's seed, its images pruned
template: cap-agent0@1.0
evolver:
name: cap_agent0
base: direct # the curation: one call of the run's model
model: {ref: fireworks/accounts/fireworks/models/glm-5p3-flash, effort: medium}
params:
setting: continual
engine: ../../cap_harness/utils/agent/sim.py # each library checked by the engine's own validator
aspire_root: $ASPIRE_ROOT # on its venv's Python (ASPIRE runs on 3.10 to 3.12)
select: validation
environment:
runner: host # the actor starts the GPU simulator itself; each program runs in its sandbox
sandbox:
enabled: true
enforce: required
trainer:
run_name: cap-agent0-continual
epochs: 1
call_timeout_min: 1440 # a step: the curation and sixty validation trials (step 1: also the starting
# library's sixty)
budget: {usd: 600, hours: 240}
eval:
repeats: 1
Loading
Loading