ACE
A harness evolution method after ACE, Agentic Context Engineering
(Zhang et al.). It grows a playbook of short lessons in the agent's rules.md. The prompts are this method's own;
ace-agent/ace is the upstream code, for reference only.
What it trains#
The harness: one marked block of rules.md. Each job reads the job's runs, the traces with a score or a reply.
A score or feedback helps, but no correct answer is needed. For each run, a Reflector model analyses the run and tags
the playbook's lessons (bullets) as helpful or harmful. A Curator model then writes new bullets. Code merges them:
it counts the tags, adds the new bullets, and removes harmful bullets and the bullets past the cap.
method.py describes the job, the playbook and the job's notes.
Differences from the paper:
- The served agent does not name the bullets that it used, so the Reflector tags every bullet that applies.
- The Reflector answers once per run. Reef does not run the agent again.
- Only exact duplicates are dropped (no embedding de-duplication). Counts and
max_bullets, not a token budget, limit the playbook. - The evaluation policy, not offline epochs, selects the served playbook.
- Bullets with the shape of a credential or of an instruction override are refused.
When to use it#
- To learn from live agent sessions on pi, with a plain done or not-done score, or with no score at all.
- When the lessons fit in one file that every session reads.
To keep each lesson as a separate skill that the agent opens on demand, use ReasoningBank. To improve harness text on fixed tasks with a scorer, use GEPA.
Requirements#
- A Reef checkout (
recipes/is not in the wheel) and an OpenAI-compatible model endpoint. No GPU. - The pi harness for the clients. Reef installs its pinned pi at startup when
evolution.binaryis unset.
Run the example#
From the repository root:
export REEF_UPSTREAM_URL=http://127.0.0.1:8000 REEF_UPSTREAM_MODEL=qwen3-8b
reef serve -c recipes/ace/examples/serve.yamlConnect pi as Evolve your harness describes.
After each session, post a report (POST /reef/report) with a score and the receipt of the session's last model
call. Each report starts one job. The new rules.md has a ## Playbook block below the seed's base rules, and the
job's record is under recipes/ace/work/harness/<scenario>/harness/steps/<step>/.
Configuration#
The settings reference describes the
recipe.config.evolution keys. A deployment sets:
evolution.method:recipes.ace:ACE. Itsconfigkeys are the fields ofACESettingsinmethod.py:model: the Reflector's and the Curator's model,served(the default, as in the paper) or anevolution.modelsname.sections: the playbook's sections.max_bullets: the most bullets that the playbook keeps (100).prune_margin: remove a bullet when its harmful count exceeds its helpful count by this many (2).max_traces_per_step: the most runs that one job reads; each costs two model calls (0, no limit).
evolution.evaluation.policy:nonein the example (publish each valid playbook).floorkeeps a health check;comparepublishes only a playbook that scores better on fixed tasks. A rejected job keeps its playbook instate/.pipeline.record2sample.module: reef.samples.traces:InferenceSamples: learn from recorded traffic without reports.
Results#
No measured results.
Files#
ace/ __init__.py exports ACE and ACESettings method.py ACE, ACESettings, the playbook and the merge prompts/reflector.md the Reflector's instructions prompts/curator.md the Curator's instructions examples/serve.yaml an online deployment on pi examples/seed/rules.md the first tree: base rules
The tests are in tests/recipes/ace/.