@jadelau/ace-rsi-toolkit 0.0.0-stage → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/icon.svg ADDED
@@ -0,0 +1,7 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">
2
+ <rect x="4.5" y="3" width="15" height="18" rx="2" />
3
+ <path d="M8.5 3v18" />
4
+ <path d="M11.5 8h5" />
5
+ <path d="M11.5 12h5" />
6
+ <path d="M11.5 16h3" />
7
+ </svg>
package/package.json CHANGED
@@ -1,6 +1,24 @@
1
1
  {
2
2
  "name": "@jadelau/ace-rsi-toolkit",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.4.0",
4
+ "description": "The ACE RSI Toolkit: Agentic Context Engineering (Zhang et al., 2025, https://arxiv.org/abs/2510.04618), the sequential offline algorithm — a Reflector reads each training Trace, a Curator folds the lessons into a playbook of rules the Target reads before every task, and the final playbook is measured on the frozen Benchmark. Self-contained: it creates the Target's playbook Skill, evaluates its own cells and writes the Evaluation Center's scoreboard.",
5
+ "license": "Apache-2.0",
6
+ "keywords": [
7
+ "jiumate-plugin"
8
+ ],
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/qiaiqian67/jiumate",
12
+ "directory": "plugins/ace-rsi-toolkit"
13
+ },
14
+ "files": [
15
+ "plugin.json",
16
+ "icon.svg",
17
+ "skills",
18
+ "hooks",
19
+ "LICENSE"
20
+ ],
21
+ "publishConfig": {
22
+ "access": "public"
23
+ }
24
+ }
package/plugin.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "description": "The ACE RSI Toolkit: Agentic Context Engineering (Zhang et al., 2025, https://arxiv.org/abs/2510.04618), the sequential offline algorithm — a Reflector reads each training Trace, a Curator folds the lessons into a playbook of rules the Target reads before every task, and the final playbook is measured on the frozen Benchmark. Self-contained: it creates the Target's playbook Skill, evaluates its own cells and writes the Evaluation Center's scoreboard.",
3
+ "version": "2026-10-12.1",
4
+ "category": "ai-app-development",
5
+ "description_zh": "ACE RSI 工具包:按论文《Agentic Context Engineering》(Zhang 等,2025,https://arxiv.org/abs/2510.04618)的顺序离线算法——Reflector 逐条阅读训练轨迹,Curator 把教训并入 Target 每次任务前都会读的规则手册(playbook),最终手册在冻结的 Benchmark 上测量。自成一体:自行创建 Target 的手册 Skill、自行评测每个单元、写入评估中心的记分板。",
6
+ "short_description": "ACE RSI Toolkit: evolve a playbook from Traces.",
7
+ "short_description_zh": "ACE RSI 工具包:从轨迹进化规则手册。",
8
+ "quick_start": {
9
+ "prompt": "Use the `ace-rsi-toolkit` Skill to run ACE on an agent of this Project: ask me for the Test Agent and the published Benchmark to train on, initialize the playbook, run one epoch at the smoke budget, and report the baseline and final scores.",
10
+ "prompt_zh": "使用 `ace-rsi-toolkit` 技能在本 Project 的一个智能体上运行 ACE:先问我被测智能体与用于训练的已发布 Benchmark,初始化规则手册,以冒烟预算跑一个 epoch,报告基线分与最终分。",
11
+ "skills": ["ace-rsi-toolkit"]
12
+ }
13
+ }
@@ -0,0 +1,169 @@
1
+ ---
2
+ name: ace-rsi-toolkit
3
+ description: Run ACE (Agentic Context Engineering, Zhang et al. 2025) on an agent the sequential offline way - a Reflector reads each training Trace, a Curator adds the lessons to a playbook of rules the agent reads before every task, and the final playbook is measured on a published Benchmark.
4
+ ---
5
+
6
+ # ACE
7
+
8
+ [Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models](https://arxiv.org/abs/2510.04618), Zhang et al., 2025 ([arXiv:2510.04618v1](https://arxiv.org/abs/2510.04618v1), §3–4 and Appendix B). GitHub: [ace-agent/ace](https://github.com/ace-agent/ace). Verified implementation revision `82709de050e1db6e6ef2f07bcb0393560b94992a`, chiefly `ace/ace.py` (`_train_single_sample`, `_offline_train`), `ace/core/reflector.py`, `ace/core/curator.py`, `ace/prompts/` and `playbook_utils.py`. This Skill runs the **sequential offline** algorithm: the Target (the paper's Generator) solves one training case at a time with the current playbook, a Reflector diagnoses that execution, and a Curator adds the lessons the playbook lacks as itemized rules; the final playbook is then measured on the frozen Benchmark. Run the method the way the paper does; every departure is a declared adaptation reported at the end.
9
+
10
+ ## Before you start
11
+
12
+ This Skill needs `run_subagent`, so it runs in a top-level Session. If the message only names it, ask which agent to train and on which published Benchmark. Otherwise resolve the inputs below and ask only for a missing Target or Benchmark; everything else has a default.
13
+
14
+ - `test_agent_id` — the Target (the Evaluation Center's Test Agent): an existing agent of this Project, or `create: <id>` when the user wants a fresh one, created with no plugins by `penguin agent create --agent-id <id> --project-id "$PROJECT_ID" --json` (an id matches `^[a-z][a-z0-9_-]{1,63}$`). If that id exists already, stop and ask; never reinitialize an agent. The Target is never the agent you run as: training rewrites its State while you work.
15
+ - `benchmark_id` — a Benchmark of this Project whose `benchmark_config.toml` status is published (not a literal `draft` or `failed`). Its cases (every directory of it holding a `statement/README.md`) are both the training samples and the measured case set. Without one, list the published Benchmarks and ask; this Skill never builds one.
16
+ - `test_benchmark_id` (optional) — a second published Benchmark held out from training: H1 (the initialized State) and the final playbook are measured on it too, and nothing of it reaches the Reflector or the Curator.
17
+ - `runs` — runs per case in every measurement; default 1.
18
+ - The runtime — the `provider` / `model_id` pair the user names, else your Environment's, fixed for the whole experiment (`references/evaluation.md`, controller step 2). The Reflector and the Curator run on your own model; record it.
19
+ - The settings below. Use the smoke profile unless the user asks for other values. A target score or a round limit is not an ACE setting: say so and leave it out.
20
+
21
+ | Setting | Smoke profile (default) | Source |
22
+ | --- | --- | --- |
23
+ | `num_epochs` | 1 | release default 1; the paper's experiments use up to 5 |
24
+ | `max_num_rounds`: reflections per incorrect sample | 3 | release default 3; the paper's experiments use up to 5 |
25
+ | `curator_frequency`: curate after every k-th sample | 1 | batch size 1, as in the paper's experiments |
26
+ | `playbook_token_budget` | 80000 | release default |
27
+ | `use_bulletpoint_analyzer`: embedding deduplication | false | release default |
28
+ | Training order | the case ids, sorted | fixed before the first execution |
29
+
30
+ Budget, for C training cases, E epochs, M rounds, k = `curator_frequency` and R runs: at most `E × C × (2 + M)` training executions of the Target, `2 × C × R` executions for the H1 and final measurements (plus `2 × C' × R` on a test Benchmark of C' cases), at most `E × C × M` Reflector calls and `E × ⌊C / k⌋` Curator calls. Before the first execution, state the profile and these numbers. Never launch the paper's full budget (5 epochs, 5 rounds) implicitly: a profile above the smoke one runs only when the user asks for it, after you have restated its arithmetic.
31
+
32
+ ## Paths and records
33
+
34
+ Resolve every path from your Environment's `App Data Dir`, as `references/evaluation.md` does; never search for the Project:
35
+
36
+ ```text
37
+ PROJECT_DIR = <app_data_dir>
38
+ PROJECT_ID = basename of PROJECT_DIR
39
+ PENGUIN_HOME = dirname of PROJECT_DIR
40
+ TARGET = PROJECT_DIR/agents/<test_agent_id>
41
+ STATE = TARGET/agent_state
42
+ BENCHMARK = PROJECT_DIR/benchmarks/<benchmark_id>
43
+ CASE = BENCHMARK/<case_id> # statement/README.md is public; rubric/README.md is private
44
+ SCOREBOARD = BENCHMARK/scoreboard.yaml
45
+ SKILL_DIR = PROJECT_DIR/agents/<your Agent ID>/agent_state/skills/ace-rsi-toolkit
46
+ PLAYBOOK = STATE/skills/ace-playbook # SKILL.md + rules.yaml, the only learned slot
47
+ OUT = <this Session's scratchpad>/ace-rsi-toolkit/<experiment_id>
48
+ ```
49
+
50
+ `<experiment_id>` is `<test_agent_id>-<UTC time as YYYYMMDDTHHMMSSZ>`. Before the first execution, write `OUT/experiment.yaml`; its `dimensions` place the run in the Awesome-RSI taxonomy:
51
+
52
+ ```yaml
53
+ method: ACE
54
+ paper: "Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models"
55
+ arxiv_url: https://arxiv.org/abs/2510.04618
56
+ github_url: https://github.com/ace-agent/ace
57
+ source_revision: 82709de050e1db6e6ef2f07bcb0393560b94992a
58
+ settings: { num_epochs: 1, max_num_rounds: 3, curator_frequency: 1, playbook_token_budget: 80000, use_bulletpoint_analyzer: false, correct: "score = 100" }
59
+ test_agent_id: <id>
60
+ benchmark_id: <id>
61
+ test_benchmark_id: <id or null>
62
+ training_order: [<case ids>]
63
+ runs: 1
64
+ runtime: { provider: <provider>, model_id: <model_id>, thinking_level: <level> }
65
+ roles_model: { provider: <your Provider>, model_id: <your Model ID> }
66
+ h1: { version: <n>, sha256: { <every file of STATE but .vault.toml>: <hash> } }
67
+ dimensions:
68
+ artifact: playbook of itemized rules
69
+ source: the Target's own training executions
70
+ feedback: Rubric score and correctness
71
+ updater: Reflector and Curator, merged deterministically
72
+ frequency: every curator_frequency samples
73
+ topology: sequential, one Target
74
+ selection: none, the final playbook is kept
75
+ mode: offline
76
+ scope: the ace-playbook Skill
77
+ adaptations: []
78
+ ```
79
+
80
+ Keep in OUT every role request and raw reply, every cell result, every published `rules.yaml` as `OUT/playbook/v<version>.yaml`, every failure and adaptation, and `OUT/state.yaml` (epoch, sample, phase, State version), so that a compacted or resumed Session continues the run instead of restarting it.
81
+
82
+ Only the evaluation worker reads a `rubric/`; you, the Reflector and the Curator never do. A Harbor case's session id `harbor:<trial>` names a trial directory under `BENCHMARK/.jobs/<job>/`: its Trace is under `agent/penguin/traces/`, it has no Workspace on this machine, and its `verifier/` output and the tasks' `tests/` and `solution/` are private.
83
+
84
+ Snapshots: before the first change to a measured State, make sure `TARGET/snapshots/v<version>.tar.gz` exists: an archive of `agent_state/` without `.vault.toml`, its entries rooted at `agent_state/`. Never overwrite one, and stop if it cannot be created. State versions only increase and are never reused.
85
+
86
+ ## Initialize
87
+
88
+ Follow `references/initialization.md`. It creates the empty playbook Skill and one fixed reader line in the Target's `AGENTS.md`, and changes nothing else. The initialized State is H1.
89
+
90
+ ## Measure
91
+
92
+ Every measurement is a full case × `runs` matrix through `references/evaluation.md`, following its controller section, and lands in that Benchmark's `SCOREBOARD`. Measure H1 first. A prior record is reusable only when its State version, case set, runtime and runs all match. Training executions are single cells and never enter a scoreboard: the per-sample trajectory runs on a playbook that changes as it goes, so it is never reported as a matrix.
93
+
94
+ ## Train the playbook
95
+
96
+ Make `num_epochs` passes over the training order, one sample at a time; two training cells never run at once. Every execution of the Target is one cell through `references/evaluation.md`: the request of its controller step 3 on the current State version, with a fresh `run` label for each execution of the same case (1, 2, … across the experiment), and the result handled as its controller steps 4 and 5 say. A cell is **correct** when it scores 100, or when it meets another predicate the user set before the first execution (record it). After every cell, check that `PLAYBOOK` still matches what you last published; a Target that edits it fails the run's integrity.
97
+
98
+ For each sample:
99
+
100
+ 1. **Generate.** Run one cell on the current playbook.
101
+ 2. **Reflect.** Run the Reflector on the latest execution, then publish the counter updates its tags give. If the execution was correct, go to 3. Otherwise **regenerate**: run a training cell on the same case with that reflection in its Workspace (Regeneration, below). If it is correct, go to 3; if not, reflect on it and regenerate again, up to `max_num_rounds` reflections in all. Never add rounds because a score disappoints.
102
+ 3. **Curate.** After every `curator_frequency`-th sample, run the Curator on the latest reflection and the current playbook, and publish its ADD operations. An empty list is a valid answer.
103
+ 4. **Observe.** Run one more cell on the same case, without reflection, on the updated playbook. Record it as the post-curation observation: it gates nothing.
104
+
105
+ Then go on to the next sample with the updated playbook.
106
+
107
+ ### Regeneration
108
+
109
+ A regeneration is the one cell that differs from `references/evaluation.md`: the reflection reaches the Target as a file in its Workspace. Send the worker:
110
+
111
+ ```text
112
+ Read <SKILL_DIR>/references/evaluation.md and follow its "The worker" section with one training change: after copying `statement/`, write everything below the line `--- REFLECTION.md ---` into the Workspace as `REFLECTION.md`, and launch with the message "Read README.md in the current Workspace and complete the task exactly as specified there. REFLECTION.md holds feedback on an earlier attempt at this task; use it." Evaluate one cell and reply with the protocol YAML only.
113
+ <the eight request fields of controller step 3>
114
+ --- REFLECTION.md ---
115
+ <the latest reflection's error identification, root cause analysis, correct approach and key insight>
116
+ ```
117
+
118
+ A Harbor case runs from its benchmark repository and has no Workspace here to carry the file: on Harbor cases, skip regeneration (one reflection per sample) and declare it.
119
+
120
+ ### Reflector
121
+
122
+ Run one with `run_subagent` per reflection (omit `agent_id`), each in a fresh context:
123
+
124
+ ```text
125
+ Read <SKILL_DIR>/SKILL.md, section "Reflector", and act as the ACE Reflector. Reply with the JSON only.
126
+ statement: <CASE/statement/README.md>
127
+ execution: session <session_id>, score <score>, correct <true | false>
128
+ trace: <its root Trace files, TARGET/traces/*/<session_id>_*.jsonl, or the Harbor trial's>
129
+ rules_used: <TARGET/scratchpad/<session_id>/ace-rules-used.txt>
130
+ playbook: <PLAYBOOK/rules.yaml>
131
+ ```
132
+
133
+ As the Reflector, read only these inputs and the Workspace the Trace's `session_meta` names: never a `rubric/`, a gold answer, another case, another Trace or OUT. When `rules_used` is missing, take the ids from the Trace's write of that file, else treat them as none. Work from what the execution actually did and produced, not from what it said it did. Reply with one JSON object: `error_identification` (what went wrong, or `none`), `root_cause_analysis`, `correct_approach`, `key_insight` (a lesson that holds beyond this case, with no case id, instance value or answer), and `bullet_tags`, a list of `{"id": "<rule id>", "tag": "helpful" | "harmful" | "neutral"}` covering only the rules used.
134
+
135
+ ### Curator
136
+
137
+ ```text
138
+ Read <SKILL_DIR>/SKILL.md, section "Curator", and act as the ACE Curator. Reply with the JSON only.
139
+ playbook: <PLAYBOOK/rules.yaml>
140
+ reflection: <the OUT file of the latest reflection>
141
+ statement: <CASE/statement/README.md>
142
+ progress: sample <i> of <C>, epoch <e> of <E>; playbook token budget <playbook_token_budget>
143
+ ```
144
+
145
+ As the Curator, read only these inputs. Add only what the playbook lacks: reusable insights from the reflection that no entry already covers, with no quota to fill. Reply `{"reasoning": "…", "operations": [{"type": "ADD", "section": "<snake_case section>", "content": "<one rule>"}]}`; an empty `operations` list is valid. ADD is the only operation, as in the release: never restate, edit, merge or delete an entry. Never copy a case id, an instance value or an answer, and keep the playbook within the token budget.
146
+
147
+ ### Publish
148
+
149
+ Only you write `PLAYBOOK`, and only while no cell runs. Apply a change deterministically: a `helpful` or `harmful` tag adds 1 to that counter of an existing entry, and `neutral` changes nothing; an ADD appends `{id, section, content, helpful: 0, harmful: 0}` with the next fresh id (`r-0001`, `r-0002`, …, never reused) and the Curator's `content` verbatim, with no second rewrite. Drop, and record, an ADD whose content names a case id. Then bump the `ace-playbook` Skill's `version` (the next `N` when it carries today's date, else today's `.1`) and the State `version` in `STATE/system_config.yaml` by 1, replacing the field rather than adding a second one; parse both files back, and copy `rules.yaml` to `OUT/playbook/v<version>.yaml`. A change that leaves `rules.yaml` as it was publishes nothing.
150
+
151
+ Deduplication stays off, as in the release: its optional BulletpointAnalyzer needs an embedding model this toolkit does not configure, so decline a request for it rather than imitate it with a model's similarity judgement and call that the paper's grow-and-refine. If a publication would push `rules.yaml` past `playbook_token_budget` (about 4 characters per token), stop training at the last published State; never compress the playbook.
152
+
153
+ ### Stops
154
+
155
+ Stop when the budget is spent, on `version_changed` or `benchmark_invalid`, on an `evaluation_failed` with no repair left, on a runtime mismatch, on a Target edit to `PLAYBOOK`, and when private scoring material enters a role's context (discard that reflection or curation as contaminated). The last published State stays; never publish a partial or contaminated change, and say what stopped the run.
156
+
157
+ ## Freeze and report
158
+
159
+ After the last sample, the live State is the final playbook. ACE keeps it whatever it scores: with no validation split here, the release's best-validation selection does not apply, and a training score never selects a version. Make sure its snapshot exists, then measure it on `benchmark_id`, and on `test_benchmark_id` when given, with a `summary_title` such as `ACE · final playbook, 1 epoch, 14 rules · 71.50`. After an early stop, measure the last published State only when the user asks, and name the stop in its summary. Keep every snapshot, record and OUT file; the user can bring H1 back from its snapshot.
160
+
161
+ Report:
162
+
163
+ - the H1 and final State versions, the initial and final `rules.yaml` with their SHA-256 hashes, and the entries per section;
164
+ - the baseline and final scores per Benchmark, and per case;
165
+ - per sample, the initial, regenerated and post-curation results, kept apart from the frozen matrices; the reflections, counter events, ADD operations and empty curations; the rules the Traces show the Target applying (a read is not a use, and a use is not a gain);
166
+ - the settings and budget used against the plan, and every stop or skip;
167
+ - the cost of every role: the Target cells' costs from the worker results, and the usage the Reflector and Curator Sessions recorded;
168
+ - the source links and revision, and every adaptation: the playbook is a target-owned Skill read through a fixed `AGENTS.md` line; the Generator is a full agent run with tools that reports the rules it applied; correctness is a full Rubric score, and the Reflector sees the score but never a gold answer (the paper's setting without ground-truth labels, plus a score); the final playbook is kept without validation; training and measurement share `benchmark_id` unless `test_benchmark_id` was given; Harbor cases skip regeneration. This is not a reproduction of the paper's AppWorld or financial-analysis numbers;
169
+ - that the Evaluation Center's chart shows the curve under the label `<agent_id> · <model_id> · <thinking_level>`.
@@ -0,0 +1,130 @@
1
+ # Evaluate one cell
2
+
3
+ How this toolkit measures a Target Agent on a Benchmark without any other plugin: the toolkit's Skill is the controller, every Case × run cell is scored by a worker the controller spawns through `run_subagent`, and every complete evaluation lands in the Benchmark's `scoreboard.yaml` in the shape the Evaluation Center reads. The same file ships in every RSI toolkit; keep it byte-identical.
4
+
5
+ ## Paths
6
+
7
+ Resolve every path from the Environment's `App Data Dir`; never search for the Project:
8
+
9
+ ```text
10
+ PROJECT_DIR = <app_data_dir>
11
+ PROJECT_ID = basename of PROJECT_DIR
12
+ PENGUIN_HOME = dirname of PROJECT_DIR
13
+ TARGET = PROJECT_DIR/agents/<test_agent_id>
14
+ STATE = TARGET/agent_state
15
+ BENCHMARK = PROJECT_DIR/benchmarks/<benchmark_id>
16
+ CASE = BENCHMARK/<case_id> # statement/README.md is public; rubric/README.md is private
17
+ SCOREBOARD = BENCHMARK/scoreboard.yaml
18
+ ```
19
+
20
+ Reject traversal, symlink escape, or any path outside TARGET and BENCHMARK. Never read `.project_config.toml`, `.vault.toml`, the server's `api-token` file or `web.db`, and never call the server's HTTP API with a token read from disk.
21
+
22
+ ## The controller
23
+
24
+ 1. Require `benchmark_config.toml` and read its `status`: a literal `draft` is not frozen and a literal `failed` one never calibrated (stop and say so); a missing or any other value is published. Read the Agent State `version` from `STATE/system_config.yaml` (1 when absent) and `model.thinking_level` (`medium` when absent).
25
+ 2. Fix the runtime once per experiment: `provider` and `model_id` are the pair the user named, else the `Provider` and `Model ID` lines of your own Environment. Never read a pair from the Target's files, a Project default or the server. A half pair stops the run.
26
+ 3. For every Case in the declared case set and every run index `1..runs`, call `run_subagent` once (omit `agent_id`: the worker is this Agent, so it can read this file) with exactly:
27
+
28
+ ```text
29
+ Read <absolute path of this references/evaluation.md> and follow its "The worker" section. Evaluate one cell and reply with the protocol YAML only.
30
+ protocol_version: 1
31
+ case_id: <case_id>
32
+ run: <1_based_run_index>
33
+ expected_version: <agent_state_version>
34
+ test_agent_id: <test_agent_id>
35
+ benchmark_id: <benchmark_id>
36
+ provider: <provider>
37
+ model_id: <model_id>
38
+ ```
39
+
40
+ Cases of one frozen State may run in parallel within capacity; two States of the same Target never run at the same time. A Case whose statement has a `## How this case is run` section naming the Harbor framework is a Harbor case, as every built-in Benchmark's are: run its cells in the background, at most four at a time unless the user named another limit (never above eight), launching the next cell the moment one returns rather than in batches and without polling, and retry once, at lower concurrency, a cell Docker could not give a network (its trial's `result.json` under `BENCHMARK/.jobs/` names an exhausted address pool; that is never a score).
41
+
42
+ 4. Before reading any field, check that the worker-authored text is exactly one plain YAML document. If not, ask the same worker to resend the YAML from its existing result; never rerun the Target for a formatting repair. Require every scored result's `agent_id`, `provider`, `model_id` and `thinking_level` to equal the fixed runtime, else the matrix is invalid: stop.
43
+ 5. `invalid_request`: correct and resend. `version_changed` or `benchmark_invalid`: stop. `evaluation_failed`: ask the same worker to diagnose and repair, and rerun only that cell when Workspace and Trace evidence proves the Target never started; every retry applies a new, specific repair. A matrix with a missing cell has no score: never average a partial matrix.
44
+ 6. Append one evaluation per complete matrix to `SCOREBOARD` (create the file with `evaluations: []` if the Benchmark has none), then re-parse the file and verify the appended record:
45
+
46
+ ```yaml
47
+ - time: <ISO-8601 UTC, from `date -u +"%Y-%m-%dT%H:%M:%SZ"`>
48
+ agent_id: <test_agent_id>
49
+ version: <agent_state_version measured>
50
+ provider: <provider>
51
+ model_id: <model_id>
52
+ thinking_level: <thinking_level>
53
+ summary_title: >-
54
+ <public title: the method, the step or candidate, and the result>
55
+ summary: >-
56
+ <public summary; never the rubric, gold answers or private scoring>
57
+ score: <average of the Case scores, two decimals>
58
+ cost: <average of known Case costs (six decimals), or null when every Case cost is null>
59
+ duration_ms: <average of the Case durations, integer>
60
+ cases:
61
+ - case: <case_id>
62
+ score: <average of the Run scores>
63
+ cost: <average of known Run costs, or null>
64
+ duration_ms: <average of the Run durations>
65
+ runs:
66
+ - score: <Run score>
67
+ cost: <Run cost or null>
68
+ duration_ms: <Run duration>
69
+ session_id: <Test Session id>
70
+ ```
71
+
72
+ Every score is on the fixed `0..100` scale; write no `max_score`, no `aggregate`, and no field the shape above does not have. The stored averages are authoritative. Record only complete measurements of a State that still exists as a snapshot; a method's own history (proposals, skipped candidates, partial matrices, failures) stays in the method's output directory, not in the scoreboard.
73
+
74
+ ## The worker
75
+
76
+ You evaluate exactly one cell. Do not spawn another worker, do not write `SCOREBOARD`, do not change the Target or the Benchmark. Operate silently: across streamed and final responses, the only text you author is the final protocol YAML — no narration, headings, fences or scoring details.
77
+
78
+ 1. Validate the request: every field present once and consistent, else return `invalid_request`. Require `STATE/system_config.yaml`, `benchmark_config.toml`, `CASE/statement/README.md` and `CASE/rubric/README.md`; `status = "failed"` is `benchmark_invalid`. The State `version` (1 when absent) must equal `expected_version`, else `version_changed`. Snapshot `model.thinking_level` (`medium` when absent) and every file under `statement/` and `rubric/`. The Rubric's items must total exactly 100 points.
79
+ 2. **Workspace cases.** Create a unique Workspace under `TARGET/workspaces/`, resolve it to an absolute canonical path under that directory, and copy only `statement/` into it. The Target may see the statement and its own State, never the rubric. Run one foreground execution as separate shell statements in this order:
80
+
81
+ ```bash
82
+ PROJECT_DIR="<app_data_dir>"
83
+ PROJECT_ID="$(basename "$PROJECT_DIR")"
84
+ PENGUIN_HOME="$(dirname "$PROJECT_DIR")"
85
+ export PENGUIN_HOME
86
+ penguin run \
87
+ --message "Read README.md in the current Workspace and complete the task exactly as specified there." \
88
+ --provider "<provider>" --model-id "<model_id>" --project-id "$PROJECT_ID" \
89
+ --agent-id "<test_agent_id>" --workspace "<absolute_unique_workspace_path>" \
90
+ --approve allow-all
91
+ ```
92
+
93
+ (Never pass `--source`: it is retired; every Session `penguin run` creates is a CLI Session and lands in the Web App's Background folder.) Use the exact requested Agent, Project, Workspace and model pair; never fall back to a Project default. Retry a launch only when unchanged Workspace and Trace evidence proves the Target did not start, each retry with a new diagnosis and a specific correction. Return `evaluation_failed` when no safe repair remains or it is unclear whether the Target started.
94
+ 3. **Harbor cases.** If the statement's `## How this case is run` section names the Harbor framework, links the benchmark repository at a 40-character commit and gives the `harbor run` launch, run that launch instead of step 2, from the root of a checkout at that commit, following the repository README section the statement links (fetching, concurrency, retries, `result.json`, credentials). The trial must run the Target, not a stock agent: derive `PROJECT_ID` and `PENGUIN_HOME` as in step 2, pick a job name not used before (`<case_id>-run<run>-<UTC timestamp>`), pack the State into `BENCHMARK/.jobs/<job>.agent-state.tar.gz` (create `.jobs/` when missing) with `tar --exclude=./.vault.toml --exclude=./memory --exclude=./schedule -czf <archive> -C "STATE" .`, and insert `--ak agent_state_tar=<archive> --ak host_penguin_home="$PENGUIN_HOME" --ak host_project_id="$PROJECT_ID"` and, when the checkout holds the install bundle the README describes, `--ak install_bundle=<that file>` before `--agent-setup-timeout-multiplier`, with `--job-name <job> -o "BENCHMARK/.jobs"`; remove the archive after the run. The verifier's reward × 100 is the score; `result.json`'s `agent_result.cost_usd` the cost; `agent_execution` start/finish the duration; `harbor:<trial directory name>` the session id. The one configuration value you look up is the model's API host, through the repository's helper, as that section says.
95
+ 4. After the run, verify that the State `version`, `model.thinking_level` and both material snapshots are unchanged (`version_changed` / `benchmark_invalid` otherwise). Bind exactly one root Trace whose Workspace, Agent State path, provider and model match this request (`evaluation_failed` if there is no unique match); read the actual `provider` / `model_id` from its `session_meta`. A Harbor case binds its trial instead: the actual pair is the key of `agent_result.model_usage`, and a trial the README says has no score is `evaluation_failed`.
96
+ 5. Score against the private Rubric from the Workspace, the bound root Trace and its directly referenced child Traces only. A wrong, missing or malformed answer is scored behavior (`status: ok`); a launcher, binding or scoring failure is not. `duration_ms` is the root Session's; `cost` only from usage or cost already recorded in those Traces, else `null`.
97
+ 6. Return the YAML as the only worker-authored text, without fences. Scored:
98
+
99
+ ```text
100
+ protocol_version: 1
101
+ status: ok
102
+ case_id: <case_id>
103
+ run: <run>
104
+ agent_id: <test_agent_id>
105
+ expected_version: <version>
106
+ provider: <actual_provider>
107
+ model_id: <actual_model_id>
108
+ thinking_level: <configured_thinking_level>
109
+ score: <0_to_100, two decimals>
110
+ cost: <number_or_null>
111
+ duration_ms: <non_negative_integer>
112
+ session_id: <test_session_id>
113
+ ```
114
+
115
+ Failed (`null` for an identity field that was missing or conflicting; never a score, cost, duration, session id, private data or advice):
116
+
117
+ ```text
118
+ protocol_version: 1
119
+ status: failed
120
+ case_id: <case_id_or_null>
121
+ run: <run_or_null>
122
+ agent_id: <test_agent_id_or_null>
123
+ expected_version: <version_or_null>
124
+ provider: <provider_or_null>
125
+ model_id: <model_id_or_null>
126
+ thinking_level: <thinking_level_or_null>
127
+ failure_code: <invalid_request | benchmark_invalid | version_changed | evaluation_failed>
128
+ ```
129
+
130
+ If the controller reports invalid formatting, resend only the clean YAML from the result already in this Session; do not call tools, relaunch or rescore.
@@ -0,0 +1,42 @@
1
+ # Initialize the ACE playbook
2
+
3
+ Prepare the Target before H1 is measured: one target-owned Skill holding an empty playbook, and one fixed line in the Target's `AGENTS.md`. Run no execution here. The model settings, tools, hooks, memory and every other Skill stay as they are. `STATE`, `PLAYBOOK` and `OUT` are the paths of the Skill's "Paths and records".
4
+
5
+ 1. **Learned state.** If `PLAYBOOK` exists already, stop. It is either an experiment to resume, which needs the matching `OUT/experiment.yaml`, or learning that must not be lost: ask the user, and never empty a learned `rules.yaml`.
6
+ 2. **Version.** A Target created for this experiment is initialized in place, at `version` 1. For an existing agent, make sure the snapshot of its current version exists (the Skill's snapshot rule); the initialized State then takes that version + 1 as `version` in `STATE/system_config.yaml`.
7
+ 3. **The Skill.** Write `PLAYBOOK/SKILL.md`, with today's date version (`YYYY.MM.DD.1`) in place of the placeholder, exactly:
8
+
9
+ ```markdown
10
+ ---
11
+ name: ace-playbook
12
+ description: Playbook of rules learned from earlier tasks - read it in full before your first substantive action on a task.
13
+ version: <YYYY.MM.DD.1>
14
+ ---
15
+
16
+ # Playbook
17
+
18
+ `rules.yaml` beside this file holds rules learned from earlier tasks. Each entry has an `id`, a `section`, the rule's `content`, and `helpful` / `harmful` counts of how often it helped or hurt before. Read the whole file before your first substantive action. Apply the entries that fit the current task, weigh them by their counts, and check them against the task's own evidence; where none fits, solve the task as you normally would. Keep the output the task asks for.
19
+
20
+ Before you finish, write the ids of the entries you applied, comma-separated, or `none`, as the only line of `ace-rules-used.txt` in this Session's scratchpad. Never change this Skill, `rules.yaml` or anything else in your Agent State.
21
+ ```
22
+
23
+ 4. **The playbook.** Write `PLAYBOOK/rules.yaml` as `entries: []`. Every entry the Curator adds later has this form, and only its two counters ever change:
24
+
25
+ ```yaml
26
+ entries:
27
+ - id: r-0001 # fresh, never reused
28
+ section: common_mistakes # the Curator's section
29
+ content: <the Curator's rule, verbatim>
30
+ helpful: 0
31
+ harmful: 0
32
+ ```
33
+
34
+ 5. **The reader.** Append this line to `STATE/AGENTS.md`, after a blank line when the file is not empty, exactly:
35
+
36
+ ```text
37
+ Before your first substantive action on any task, read `skills/ace-playbook/SKILL.md` and `skills/ace-playbook/rules.yaml` in your Agent State in full, and follow that Skill.
38
+ ```
39
+
40
+ 6. **Verify.** Parse `STATE/system_config.yaml` (the expected `version`, no duplicate key), the frontmatter of `PLAYBOOK/SKILL.md` (`name: ace-playbook`, matching its directory) and `PLAYBOOK/rules.yaml` (`entries: []`), and check that the reader line appears exactly once in `STATE/AGENTS.md`. Record the SHA-256 of these four files in `OUT/experiment.yaml`.
41
+
42
+ The Skill body and the reader line stay unchanged through H1, training and the final measurement: only `rules.yaml` learns, and only through the Skill's Publish step.
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.