A local-first multi-agent app development platform, built on PenguinHarness
fix(web): every Benchmark flow preselects its Skills, examples back to plain prose, requirements in the tail (#728)
Yaowei Zheng33627888caae
diff --git a/changelog/unreleased/2026-09-15-benchmark-flows-skills.md b/changelog/unreleased/2026-09-15-benchmark-flows-skills.mdnew file mode 100644index 00000000..eb2fcd14--- /dev/null+++ b/changelog/unreleased/2026-09-15-benchmark-flows-skills.md@@ -0,0 +1,17 @@+# Every Benchmark flow uses agent-evaluation, and the create examples are plain prose again++- **Date:** 2026-09-15+- **Type:** fix+- **Scope:** `web`+- **PR:** [#728](https://github.com/Prism-Shadow/penguin-harness/pull/728)++[中文版](2026-09-15-benchmark-flows-skills.zh.md)++## What changed++- The create, evaluate and optimize conversations the Evaluation Center opens now start with the Skills they rest on preselected — create with `benchmark-design` and `agent-evaluation`, evaluate with `agent-evaluation`, optimize with `agent-optimization` and `agent-evaluation` — so the `[use_skills]` block names them on send and the model reads them before it acts; a Skill the chosen agent lacks is simply not preselected, and the Use dialog already warns about a missing one. All three fixed tails also say in as many words that every evaluation goes through a `run_subagent` subagent told to use `agent-evaluation`, never scored by the model itself and never bypassed. Left to itself, a model sometimes did exactly that.+- The four "Create with AI" examples are one- or two-sentence scenario descriptions again (what contradicts, what is hidden, what is vague). The structured requirements moved into the fixed tail — about three cases, few and hard; the techniques (hidden preconditions, vague or incomplete input, conflicting sources, strict deliverables, no difficulty by piling on rows or rules); a desired baseline below 50; a pilot limit of 4 — each still overridable by the draft above it.+- `benchmark-design` no longer treats a missed desired baseline score as a failed calibration. The publish gate is a fixed 85 on the `0..100` scale: a frozen Formal Baseline below 85 is published however far it stays from the desired score, and `status = "failed"` is written only when no valid Pilot revision can be produced or the lowest-scoring valid one still scores 85 or above at the iteration limit (plugin `agent-tuning` 2026.09.15.1).+- The built-in example Benchmark is seeded whenever `benchmarks/example-benchmark/` itself is missing, not only when the whole `benchmarks/` directory is. A Project that created Benchmarks of its own before the example ever appeared (creating one makes the directory), or that still keeps the old per-agent copy under `agents/default_agent/benchmarks/`, now gets the Project-level example on the next load of `default_agent`. An example that is present is never touched, and the user's own Benchmarks beside it are never touched either; a deleted example comes back on the next load.+- Under Workspace grouping, the isolated Test Workspaces an evaluation creates for each Case × Run no longer form one group each: any directory directly under an Agent's own `workspaces/` — those Test Workspaces and core's `tmp-` directories alike — folds into the **Temporary workspaces** group, on the server's paging filter and in the sidebar's grouping alike. A directory the user picks keeps its own group.+- The first "Create with AI" example is the home page's decision-agent scenario — football betting, an after-sales action, an investment move, each a finite choice under rules, past cases and current facts that conflict or fall short. The list stays at four: the data-analysis example makes room for it.diff --git a/changelog/unreleased/2026-09-15-benchmark-flows-skills.zh.md b/changelog/unreleased/2026-09-15-benchmark-flows-skills.zh.mdnew file mode 100644index 00000000..89365cf5--- /dev/null+++ b/changelog/unreleased/2026-09-15-benchmark-flows-skills.zh.md@@ -0,0 +1,17 @@+# 三条 Benchmark 流程都用上 agent-evaluation,创建示例改回纯文本++- **Date:** 2026-09-15+- **Type:** fix+- **Scope:** `web`+- **PR:** [#728](https://github.com/Prism-Shadow/penguin-harness/pull/728)++[English](2026-09-15-benchmark-flows-skills.md)++## 变更内容++- 评估中心开出的出题、评估、优化对话现在都预选了它们依赖的技能——出题预选 `benchmark-design` 与 `agent-evaluation`,评估预选 `agent-evaluation`,优化预选 `agent-optimization` 与 `agent-evaluation`——发送时随 `[use_skills]` 块送达,模型动手前先读技能;所选 Agent 没装的技能不会被预选,使用弹窗本来就有缺技能提示。三段固定尾部也都明说:每一次评测都必须经 `run_subagent` 派发子会话、在子会话里使用 `agent-evaluation`,不得自行打分、不得绕过——此前模型时不时正是这么干的。+- 「用 AI 创建」的四个示例改回一两句话的纯文本场景描述(材料怎么矛盾、什么被藏起来、输入哪里模糊)。结构化要求挪进固定尾部:题量约 3 道、少而难;出题手法(隐藏的先验条件、模糊或不完整的输入、互相冲突的材料、严格的交付格式,不靠堆行数堆规则加难度);期望基线分 50 以下;Pilot 上限 4——上文另有要求时仍以上文为准。+- `benchmark-design` 不再把「没达到 desired_baseline_score」当作校准失败。发布门槛固定为 `0..100` 里的 85:冻结的 Formal Baseline 低于 85 就发布,离期望分数多远都无妨;只有做不出任何有效的 Pilot 版本、或迭代上限内最低分的有效版本仍不低于 85 时才写 `status = "failed"`(插件 `agent-tuning` 2026.09.15.1)。+- 内置示例 Benchmark 改为只要 `benchmarks/example-benchmark/` 本身不存在就预置,而不再要求整个 `benchmarks/` 目录不存在。示例出现之前就自己创建过 Benchmark(创建即建目录)、或者还留着旧的按 Agent 存放的 `agents/default_agent/benchmarks/` 副本的 Project,下次装载 `default_agent` 时都会得到 Project 层级的示例。已存在的示例一概不动,旁边用户自己的 Benchmark 也一概不动;删掉的示例会在下次装载时回来。+- 按 Workspace 分组时,评估为每个 Case × Run 建的独立 Test Workspace 不再各自成组:凡直接位于 Agent 自己的 `workspaces/` 之下的目录——这些 Test Workspace 与 core 的 `tmp-` 目录一样——都并入**临时工作区**分组,服务端的分组分页与侧栏的分组用同一条规则。用户自选的目录仍各自成组。+- 「用 AI 创建」的第一个示例改为首页同款的通用决策场景——足球投注、售后处置、投资动作,各是在互相冲突或不完整的规则、历史案例与当前事实下做有限选择。示例仍是四个:数据分析那条让位。diff --git a/packages/core/src/state/agent-state.ts b/packages/core/src/state/agent-state.tsindex 49542bfc..0e38a73a 100644--- a/packages/core/src/state/agent-state.ts+++ b/packages/core/src/state/agent-state.ts@@ -184,10 +184,11 @@ export async function loadAgentState(opts?: {);}// The example Benchmark is provisioned on this path too, not only at initialization: a- // Project whose benchmarks/ directory does not exist gets one the first time its- // default_agent is loaded, which is what gives a data root created before this provisioning- // existed the same example a fresh one has. Best effort — opening a model context must not- // fail because a directory could not be written.+ // Project without benchmarks/example-benchmark/ gets it the first time its default_agent+ // is loaded, whatever else benchmarks/ holds — which is what gives a data root created+ // before this provisioning existed, or one that made Benchmarks of its own first, the same+ // example a fresh one has. Best effort — opening a model context must not fail because a+ // directory could not be written.if (agentId === DEFAULT_AGENT_ID) {try {await provisionExampleBenchmark(root, projectId);@@ -243,7 +244,7 @@ export async function loadAgentState(opts?: {...plugins.map((plugin) => installPlugin(root, projectId, agentId, plugin)),// The example Benchmark is only provisioned alongside default_agent (so the evaluation// center has data out of the box). It lands in the Project's benchmarks/, a sibling of- // agents/: skipped whenever that directory already exists, and never written for a plain+ // agents/: skipped when the example is already there, and never written for a plain// Agent, whose creation is not a Project's first day. Awaited here, unlike on the load// path — a Project's first day is the one moment a failure is worth reporting....(agentId === DEFAULT_AGENT_ID ? [provisionExampleBenchmark(root, projectId)] : []),diff --git a/packages/core/src/state/example-benchmark.ts b/packages/core/src/state/example-benchmark.tsindex 6c001928..8f480954 100644--- a/packages/core/src/state/example-benchmark.ts+++ b/packages/core/src/state/example-benchmark.ts@@ -1,8 +1,7 @@/*** Provisioning of the example Benchmark.*- * A Project whose `benchmarks/` directory does not exist yet gets the Project-level- * `benchmarks/example-benchmark/`: two sample cases (each with statement/ and rubric/ indexed+ * A Project without `benchmarks/example-benchmark/` gets it, at the Project level: two sample cases (each with statement/ and rubric/ indexed* by a README.md), benchmark_config.toml (runs = 2, status = published — the example is a* finished Benchmark, not one a Skill is still writing), and a scoreboard.yaml with three sample* evaluations, each labelled with default_agent as the Agent it tested — so the evaluation@@ -11,11 +10,13 @@* default_agent alone, on both its initialization and every later load; creating or loading an* ordinary Agent provisions nothing.*- * The check is on the DIRECTORY, not on the example inside it: deleting the example while- * keeping `benchmarks/` (which is what deleting it through the Evaluation Center leaves behind,- * and what a Project holding Benchmarks of its own looks like) is a decision, and writing the- * example back on the next load would undo it. Removing `benchmarks/` whole asks for the- * example again, which is also how a data root that predates this provisioning gets one.+ * The check is on the example's own directory, nothing else: whatever else `benchmarks/`+ * holds — the user's own Benchmarks, created before the example was ever seeded (creating one+ * makes the directory, and an older build seeded only on initialization) — and whatever an+ * older data root keeps at the retired per-agent location `agents/<agent>/benchmarks/`, which+ * this code never reads, the Project-level example is written when it is missing. That also+ * means deleting the example lasts until the next load of default_agent; an example that is+ * present is never touched, evaluations appended to it included.** Scoring numbers follow the current Scoreboard contract: every Case is scored out of 100;* Case metrics are model-written Run averages and Evaluation metrics are model-written Case@@ -332,19 +333,20 @@ export function buildExampleScoreboard(): {}/**- * Provisions the example Benchmark into the Project's `benchmarks/`: if that directory exists at- * all — holding the example, the user's own Benchmarks, or nothing — does nothing; otherwise- * creates `benchmarks/example-benchmark/` (config, the two sample cases, and the scoreboard).- * Callers are restricted to default_agent's initialization and load paths (see agent-state.ts).+ * Provisions the example Benchmark into the Project's `benchmarks/`: when+ * `benchmarks/example-benchmark/` does not exist, creates it (config, the two sample cases, and+ * the scoreboard), making `benchmarks/` on the way if needed; when it does, does nothing. The+ * user's own Benchmarks beside it, and anything at the retired per-agent location, play no+ * part. Callers are restricted to default_agent's initialization and load paths (see+ * agent-state.ts).*/export async function provisionExampleBenchmark(root: string, projectId: string): Promise<void> {- const dir = benchmarksDir(root, projectId);- const benchDir = path.join(dir, EXAMPLE_BENCHMARK_ID);+ const benchDir = path.join(benchmarksDir(root, projectId), EXAMPLE_BENCHMARK_ID);try {- await fs.access(dir);+ await fs.access(benchDir);return;} catch {- // The Project has no benchmarks/ at all: proceed with provisioning.+ // The Project has no example: proceed with provisioning.}await Promise.all(EXAMPLE_CASES.flatMap((c) => [diff --git a/packages/core/test/example-benchmark.test.ts b/packages/core/test/example-benchmark.test.tsindex 6be7ab65..18aefb7f 100644--- a/packages/core/test/example-benchmark.test.ts+++ b/packages/core/test/example-benchmark.test.ts@@ -16,6 +16,7 @@ import {DEFAULT_AGENT_ID,DEFAULT_PROJECT_ID,EXAMPLE_BENCHMARK_ID,+ agentStateDir,benchmarksDir,buildExampleScoreboard,loadAgentState,@@ -170,13 +171,38 @@ describe("example benchmark provisioning", () => {expect(await exists(benchmarksDir(tmpRoot, DEFAULT_PROJECT_ID))).toBe(false);});- it("writes no example into a benchmarks/ directory that already holds a Benchmark", async () => {+ it("seeds the example beside Benchmarks the user already keeps, touching none of them", async () => {const dir = benchmarksDir(tmpRoot, DEFAULT_PROJECT_ID);- // The directory is the decision: a Project that already keeps Benchmarks of its own is not- // a Project's first day, so the example is not added beside them.+ // Creating a Benchmark makes benchmarks/ on its own, and an older build seeded only on+ // initialization — so a Project can hold its own Benchmarks and no example. The example's+ // own directory is the check, not the directory around it.await fs.mkdir(path.join(dir, "swe-bench-v1"), { recursive: true });+ await fs.writeFile(path.join(dir, "swe-bench-v1", "benchmark_config.toml"), 'title = "mine"\n');await loadAgentState({ init: {} });- expect(await fs.readdir(dir)).toEqual(["swe-bench-v1"]);+ expect((await fs.readdir(dir)).sort()).toEqual([EXAMPLE_BENCHMARK_ID, "swe-bench-v1"]);+ expect(await fs.readFile(path.join(dir, "swe-bench-v1", "benchmark_config.toml"), "utf8")).toBe(+ 'title = "mine"\n',+ );+ });++ it("seeds the Project-level example even when the retired per-agent location holds one", async () => {+ // A data root from before Benchmarks moved to the Project level keeps+ // agents/default_agent/benchmarks/example-benchmark/; nothing reads it, and it must not+ // stand in for the Project-level example.+ const legacy = path.join(+ agentStateDir(tmpRoot, DEFAULT_PROJECT_ID, DEFAULT_AGENT_ID),+ "benchmarks",+ EXAMPLE_BENCHMARK_ID,+ );+ await fs.mkdir(legacy, { recursive: true });+ await fs.writeFile(path.join(legacy, "benchmark_config.toml"), 'title = "old"\n');+ await loadAgentState({ init: {} });+ const dir = benchmarksDir(tmpRoot, DEFAULT_PROJECT_ID);+ expect(await exists(path.join(dir, EXAMPLE_BENCHMARK_ID, "benchmark_config.toml"))).toBe(true);+ // The legacy copy is left exactly as it was.+ expect(await fs.readFile(path.join(legacy, "benchmark_config.toml"), "utf8")).toBe(+ 'title = "old"\n',+ );});it("loading default_agent re-creates the example when benchmarks/ is gone", async () => {@@ -189,12 +215,12 @@ describe("example benchmark provisioning", () => {expect(await exists(path.join(dir, EXAMPLE_BENCHMARK_ID, "benchmark_config.toml"))).toBe(true);});- it("loading default_agent does not write the example back once it alone was deleted", async () => {+ it("loading default_agent writes the example back once it alone was deleted", async () => {await loadAgentState({ init: {} });const dir = benchmarksDir(tmpRoot, DEFAULT_PROJECT_ID);await fs.rm(path.join(dir, EXAMPLE_BENCHMARK_ID), { recursive: true, force: true });await loadAgentState();- // benchmarks/ is still there, so deleting the example is a decision that stands.- expect(await fs.readdir(dir)).toEqual([]);+ // The example's own directory is the check, so a deletion lasts until the next load.+ expect(await fs.readdir(dir)).toEqual([EXAMPLE_BENCHMARK_ID]);});});diff --git a/packages/docs/content/self-improvement.en.md b/packages/docs/content/self-improvement.en.mdindex 06f422a1..92e3d91b 100644--- a/packages/docs/content/self-improvement.en.md+++ b/packages/docs/content/self-improvement.en.md@@ -59,7 +59,7 @@ The separation of `rubric/` from `statement/` is deliberate: the Target Agent se`benchmark_config.toml` is what makes a directory a Benchmark: a directory under `benchmarks/` without one is not listed. Deleting a Benchmark while an evaluation is still running leaves such a directory behind, because the running evaluation keeps writing to the paths it was deleted from. A Benchmark that has simply never been evaluated still has its config and is listed as usual; a leftover directory is safe to delete by hand.-`status` says whether the Benchmark is finished: `draft` while `benchmark-design` is still writing its cases and calibrating their difficulty, which the Web App masks — no Use, no detail — `published` once the Formal Baseline is recorded, and `failed` once `benchmark-design` reports `calibration_failed`, meaning no valid Pilot result could be frozen. A failed Benchmark is unusable: the Web App masks it as a failed creation and asks the user to delete it and create it again. A Benchmark created by hand and the built-in example are published from the start. A config without the field, or with any value other than `draft` or `failed`, reads as published.+`status` says whether the Benchmark is finished: `draft` while `benchmark-design` is still writing its cases and calibrating their difficulty, which the Web App masks — no Use, no detail — `published` once the Formal Baseline is recorded, and `failed` once `benchmark-design` reports `calibration_failed`, meaning no valid Pilot result could be frozen or every valid one still scored 85 or above at the iteration limit. The publish gate is that fixed 85, not the desired baseline score the request asked for: a Formal Baseline below 85 is published even when it missed the desired score. A failed Benchmark is unusable: the Web App masks it as a failed creation and asks the user to delete it and create it again. A Benchmark created by hand and the built-in example are published from the start. A config without the field, or with any value other than `draft` or `failed`, reads as published.Each evaluation record in `scoreboard.yaml` is timestamped and carries:@@ -71,7 +71,7 @@ Each evaluation record in `scoreboard.yaml` is timestamped and carries:Every Run and every Case has a fixed maximum Score of 100, so Scoreboard entries do not carry `max_score`. The server and Web UI trust the stored aggregate values and do not recompute or cross-check them. Old Scoreboard formats are not migrated or backfilled.-Initializing a Project's `default_agent` seeds an example Benchmark at the Project level (`packages/core/src/state/example-benchmark.ts`), its three sample evaluations labelled `agent_id: default_agent`, so the evaluation pages have data out of the box; the whole directory can be deleted or replaced at any time.+Initializing a Project's `default_agent` seeds an example Benchmark at the Project level (`packages/core/src/state/example-benchmark.ts`), its three sample evaluations labelled `agent_id: default_agent`, so the evaluation pages have data out of the box; the whole directory can be deleted or replaced at any time. The check is the example's own directory, `benchmarks/example-benchmark/`: when it is missing, loading `default_agent` writes it, whatever else `benchmarks/` already holds and whatever an older data root still keeps at the retired per-agent location `agents/<agent>/benchmarks/` (which nothing reads). An example that is present is never touched, and a deleted one comes back on the next load.## Snapshots and versionsdiff --git a/packages/docs/content/self-improvement.zh.md b/packages/docs/content/self-improvement.zh.mdindex f3a0a2c4..4e6048a6 100644--- a/packages/docs/content/self-improvement.zh.md+++ b/packages/docs/content/self-improvement.zh.md@@ -59,7 +59,7 @@ Benchmark 属于 Project,存放在与 `agents/` 平级的 `<root>/<project>/be`benchmark_config.toml` 是目录成为 Benchmark 的标志:`benchmarks/` 下缺少该文件的目录不会被列出。在评测运行期间删除 Benchmark 会留下这样的目录——正在运行的评测仍在向被删除的路径写入。从未评测过的 Benchmark 仍带有配置文件,照常列出;残留目录可以手工删除。-`status` 表示这个 Benchmark 是否已经完成:`benchmark-design` 仍在出题与校准难度时为草稿 `draft`,Web App 对其遮罩——不能使用、也看不到详情;记录 Formal Baseline 后为发布 `published`;`benchmark-design` 报告 `calibration_failed`(没有任何可冻结的有效 Pilot 结果)时为失败 `failed`。失败的 Benchmark 不可用:Web App 同样遮罩,提示创建失败、请删除后重新创建。手动创建的 Benchmark 与内置示例一开始就是 `published`。没有该字段、或取值既不是 `draft` 也不是 `failed` 的配置,都按 `published` 读。+`status` 表示这个 Benchmark 是否已经完成:`benchmark-design` 仍在出题与校准难度时为草稿 `draft`,Web App 对其遮罩——不能使用、也看不到详情;记录 Formal Baseline 后为发布 `published`;`benchmark-design` 报告 `calibration_failed`(没有任何可冻结的有效 Pilot 结果,或迭代上限内最低分的有效版本仍不低于 85)时为失败 `failed`。发布的门槛是固定的 85 分,而不是请求里要求的 desired_baseline_score:Formal Baseline 低于 85 就发布,未达期望分数不算失败。失败的 Benchmark 不可用:Web App 同样遮罩,提示创建失败、请删除后重新创建。手动创建的 Benchmark 与内置示例一开始就是 `published`。没有该字段、或取值既不是 `draft` 也不是 `failed` 的配置,都按 `published` 读。`scoreboard.yaml` 中的每条评测记录带时间戳,并记录:@@ -71,7 +71,7 @@ Benchmark 属于 Project,存放在与 `agents/` 平级的 `<root>/<project>/be每个 Run 和每个 Case 都固定满分 100,因此 Scoreboard 不再记录 `max_score`。服务端与 Web UI 直接信任已写入的聚合值,不重算、不交叉校验;旧 Scoreboard 不迁移、不回填。-初始化 Project 的 `default_agent` 时会在 Project 层级预置一个示例 Benchmark(`packages/core/src/state/example-benchmark.ts`),三条示例评估都标注 `agent_id: default_agent`,评测页面开箱即有数据;整个目录可随时删除或替换。+初始化 Project 的 `default_agent` 时会在 Project 层级预置一个示例 Benchmark(`packages/core/src/state/example-benchmark.ts`),三条示例评估都标注 `agent_id: default_agent`,评测页面开箱即有数据;整个目录可随时删除或替换。判定只看示例自己的目录 `benchmarks/example-benchmark/`:它不存在时,装载 `default_agent` 就写入——不管 `benchmarks/` 里已经有什么,也不管旧数据根是否还留着已退役的按 Agent 存放的 `agents/<agent>/benchmarks/`(没有任何代码读它)。已存在的示例一概不动,删掉的示例会在下次装载时回来。## Snapshot 与版本diff --git a/packages/docs/content/web-app.en.md b/packages/docs/content/web-app.en.mdindex b8b16e5c..9da38a63 100644--- a/packages/docs/content/web-app.en.md+++ b/packages/docs/content/web-app.en.md@@ -41,7 +41,7 @@ Below the composer the draft page files example prompts into folders, exactly on### The Conversation List-The sidebar's conversation list groups by Workspace or by Agent. Grouping and sort order are switched in the **List options** menu (the sliders icon in the section header), where each option carries its own icon: a folder for Workspace grouping, the Agent glyph for Agent grouping, a clock for most-recent order, and up/down arrows for the drag-reordered manual order.+The sidebar's conversation list groups by Workspace or by Agent. Under Workspace grouping, the directories the system makes for itself — the temporary Workspace a conversation gets when none is chosen, and the isolated Test Workspace an evaluation creates for each Case × Run, both directly under the Agent's own `workspaces/` directory — fold into one **Temporary workspaces** group instead of each standing alone; a directory you pick yourself always has its own group. Grouping and sort order are switched in the **List options** menu (the sliders icon in the section header), where each option carries its own icon: a folder for Workspace grouping, the Agent glyph for Agent grouping, a clock for most-recent order, and up/down arrows for the drag-reordered manual order.A row's actions come at two levels:diff --git a/packages/docs/content/web-app.zh.md b/packages/docs/content/web-app.zh.mdindex ed0c0d3d..96b9e9e2 100644--- a/packages/docs/content/web-app.zh.md+++ b/packages/docs/content/web-app.zh.md@@ -41,7 +41,7 @@ penguin web### 会话列表-侧边栏的会话列表按 Workspace 或 Agent 分组,分组方式与排序方式在标题栏的**列表选项**菜单(滑块图标)里切换,每个选项前带一枚对应图标:文件夹表示按 Workspace 分组、机器人表示按智能体分组、时钟表示按最近更新排序、上下箭头表示手动拖拽排序。+侧边栏的会话列表按 Workspace 或 Agent 分组;按 Workspace 分组时,系统为自己建的目录——未指定 Workspace 时自动建的临时目录,以及评估为每个 Case × Run 建的独立 Test Workspace,两者都直接位于 Agent 自己的 `workspaces/` 目录下——一律并入同一个**临时工作区**分组,而不是各自成组;自己选的目录始终单独成组。分组方式与排序方式在标题栏的**列表选项**菜单(滑块图标)里切换,每个选项前带一枚对应图标:文件夹表示按 Workspace 分组、机器人表示按智能体分组、时钟表示按最近更新排序、上下箭头表示手动拖拽排序。会话行的操作分两层:diff --git a/packages/server/src/services/workspace-group.ts b/packages/server/src/services/workspace-group.tsindex c0d8d645..f8d38c8d 100644--- a/packages/server/src/services/workspace-group.ts+++ b/packages/server/src/services/workspace-group.ts@@ -3,11 +3,15 @@* the unit its paging runs in.** There is no Workspace entity: a Session carries the plain filesystem path locked in at- * creation, so a group is identified by that path. The one exception is the Sessions- * created without an explicit Workspace: core auto-creates a single-use directory shaped- * `<agentDir>/workspaces/tmp-<8hex>` for each of them (createTempWorkspace in- * packages/core/src/internal/session-support.ts), so per-path groups would be one-session- * noise — every such path belongs to ONE merged group, named by the sentinel below.+ * creation, so a group is identified by that path. The one exception is the directories the+ * system makes for itself under an Agent's own `workspaces/`: the single-use+ * `<agentDir>/workspaces/tmp-<8hex>` core auto-creates for a Session started without an+ * explicit Workspace (createTempWorkspace in packages/core/src/internal/session-support.ts),+ * and the isolated Test Workspace the evaluation Skill creates there for every Case × Run,+ * which only ever holds that run's Test Session. Per-path groups for either would be+ * one-session noise — every such path belongs to ONE merged group, named by the sentinel+ * below. A directory the user picks lives elsewhere; only paths directly under an Agent's+ * `workspaces/` fold.*//**@@ -19,12 +23,24 @@ export const TEMP_WORKSPACE_GROUP = "temp";/** Auto-created temporary Workspace tail: `workspaces/tmp-<8hex>` (either separator — core supports win32). */const TEMP_WORKSPACE_RE = /[/\\]workspaces[/\\]tmp-[0-9a-f]{8}$/;-/** Whether a Session's Workspace is one of core's auto-created temporary directories. */+/**+ * Any directory directly under an Agent's own `workspaces/` — `agents/<agent>/workspaces/<name>`+ * — which is where the evaluation Skill creates its isolated Test Workspaces (their names are+ * the Skill's own, so the parent is the rule, not a prefix). A directory below one of them is+ * not itself such a Workspace.+ */+const AGENT_WORKSPACES_RE = /[/\\]agents[/\\][^/\\]+[/\\]workspaces[/\\][^/\\]+$/;++/**+ * Whether a Session's Workspace is one the system made for itself: core's auto-created+ * temporary directory, or any directory directly under an Agent's `workspaces/` (the+ * evaluation Skill's Test Workspaces). Both fold into the merged temp group.+ */export function isTempWorkspace(workspace: string): boolean {const path = workspace.trim();// An empty path counts as temporary: the resolved path is always backfilled, so this is// defensive only.- return path === "" || TEMP_WORKSPACE_RE.test(path);+ return path === "" || TEMP_WORKSPACE_RE.test(path) || AGENT_WORKSPACES_RE.test(path);}/** Whether a Session's Workspace belongs to the requested group (see TEMP_WORKSPACE_GROUP). */diff --git a/packages/server/test/session-index.test.ts b/packages/server/test/session-index.test.tsindex 70d4f521..9ddbcef4 100644--- a/packages/server/test/session-index.test.ts+++ b/packages/server/test/session-index.test.ts@@ -452,6 +452,13 @@ describe("session-index", () => {`${agentDir}/workspaces/tmp-89abcdef`,"2026-07-03T09:05:00.000Z",);+ // The isolated Test Workspace an evaluation creates for one Case × Run: directly under+ // the Agent's workspaces/, named by the Skill.+ await seed(+ "session-2026-07-03-09-06-00-dddd0001",+ `${agentDir}/workspaces/eval-example-benchmark-case-1-run-1`,+ "2026-07-03T09:06:00.000Z",+ );const list = async (qs: string) => {const res = await api.get(`${base()}${qs}`);@@ -470,8 +477,10 @@ describe("session-index", () => {]);// Every auto-created temporary Workspace is ONE group (they are single-use, so a group- // per path would be one-session noise).+ // per path would be one-session noise) — and so is every other directory directly under+ // the Agent's workspaces/, the evaluation Skill's Test Workspaces among them.expect(ids(await list("?category=active&workspaceGroup=temp"))).toEqual([+ "session-2026-07-03-09-06-00-dddd0001","session-2026-07-03-09-05-00-cccc0002","session-2026-07-03-09-04-00-cccc0001",]);@@ -499,7 +508,7 @@ describe("session-index", () => {`?category=active&counts=1&workspaceGroup=${encodeURIComponent(alpha)}`,);expect(ids(counted)).toHaveLength(2);- expect(counted.counts?.active).toBe(6);+ expect(counted.counts?.active).toBe(7);// Each path's newest Session rides with the counts: what places a Workspace group the// sidebar has loaded no rows of. Keyed by the stored path — the client merges the// temporary ones — and whole-Agent under the group filter, like the counts.@@ -508,6 +517,7 @@ describe("session-index", () => {[beta]: "2026-07-03T09:03:00.000Z",[`${agentDir}/workspaces/tmp-0123abcd`]: "2026-07-03T09:04:00.000Z",[`${agentDir}/workspaces/tmp-89abcdef`]: "2026-07-03T09:05:00.000Z",+ [`${agentDir}/workspaces/eval-example-benchmark-case-1-run-1`]: "2026-07-03T09:06:00.000Z",});// An empty group name is rejected, never silently unfiltered.diff --git a/packages/web/src/components/layout/sidebar.tsx b/packages/web/src/components/layout/sidebar.tsxindex 91066984..61fc5b6e 100644--- a/packages/web/src/components/layout/sidebar.tsx+++ b/packages/web/src/components/layout/sidebar.tsx@@ -595,10 +595,11 @@ export function Sidebar({/*** The folder-only groups of each mode: group key → the conversations folded inside it. A- * group with no active conversation of its own but rows inside its folders — the Workspace- * an evaluation creates per Case × Run, an Agent that has only ever been evaluated — folds- * up, sorts behind the other groups of its mode and wears a dimmed header carrying that- * count.+ * group with no active conversation of its own but rows inside its folders — a Workspace+ * only subagents ever ran in, an Agent that has only ever been evaluated — folds up, sorts+ * behind the other groups of its mode and wears a dimmed header carrying that count. (The+ * Test Workspaces an evaluation creates per Case × Run never form groups of their own: they+ * fold into the merged temp group, see session-grouping.ts's isTempWorkspace.)** Read off the group lists BEFORE they are ordered: the ordering consumes this, so it* cannot be what feeds it. The search query is deliberately not part of it either — a querydiff --git a/packages/web/src/features/benchmark/benchmark-page.tsx b/packages/web/src/features/benchmark/benchmark-page.tsxindex e89a6165..a3d884c9 100644--- a/packages/web/src/features/benchmark/benchmark-page.tsx+++ b/packages/web/src/features/benchmark/benchmark-page.tsx@@ -43,6 +43,9 @@ import { CreateBenchmarkModal } from "./create-benchmark-modal";import { ScoreSparkline } from "./score-sparkline";import { UseBenchmarkModal } from "./use-benchmark-modal";+/** The Skills a design conversation is opened with (see the create modal below). */+const BENCHMARK_DESIGN_SKILLS = ["benchmark-design", "agent-evaluation"];+/** Delete (trash can), the same card-row mark the Agents list carries. */const TRASH_ICON ="M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2m3 0l-1 13a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2L6 7m4 4v6m4-6v6";@@ -474,6 +477,10 @@ export function BenchmarkPage() {description={S.benchmark.aiCreateDescription}agents={agents}examples={benchmarkCreateExamples()}+ // The Skills the design conversation rests on, preselected in the composer so the+ // `[use_skills]` block names them on send: the designer's own, and the evaluator it has+ // to delegate every trial evaluation to. An agent that lacks one keeps its list short.+ skills={BENCHMARK_DESIGN_SKILLS}{...(aiTarget !== "" ? { tail: benchmarkCreateTail(aiTarget) } : {})}intro={<Selectdiff --git a/packages/web/src/features/benchmark/use-benchmark-modal.tsx b/packages/web/src/features/benchmark/use-benchmark-modal.tsxindex 956990d8..eaf85e61 100644--- a/packages/web/src/features/benchmark/use-benchmark-modal.tsx+++ b/packages/web/src/features/benchmark/use-benchmark-modal.tsx@@ -9,7 +9,11 @@* is a choice here; the baseline and the default target follow that choice. The model of the* conversation that carries the work out is picked with the Project settings' own model picker* (ModelSelect in its form variant, the one the new-chat defaults and the schedule form use),- * preset to the Project's default model. The evaluation runtime is never picked in this dialog —+ * preset to the Project's default model. The new conversation opens with the Skills its tab+ * rests on preselected — the evaluator on both tabs, the optimizer on its own — so the+ * `[use_skills]` block names them on send and the model reads them before it acts; a model+ * left to its own devices sometimes scored the runs itself instead of delegating to+ * agent-evaluation. The evaluation runtime is never picked in this dialog —* Evaluate takes the tested agent's own configured model and thinking level, and Optimize reuses* what that agent's baseline recorded, so scores stay comparable. Mounted fresh per Benchmark.*/@@ -174,6 +178,7 @@ export function UseBenchmarkModal({openAiChat({agentId: runnerId,text,+ skills: tab === "evaluate" ? [EVALUATION_SKILL] : [OPTIMIZATION_SKILL, EVALUATION_SKILL],...(ref !== undefined ? { modelRef: ref } : {}),// An evaluation / optimization run, not a conversation of the user's own: the session// list files it, and the Test Sessions it launches, under the Evaluations folder.diff --git a/packages/web/src/lib/session-grouping.ts b/packages/web/src/lib/session-grouping.tsindex 32395d9c..e55392c2 100644--- a/packages/web/src/lib/session-grouping.ts+++ b/packages/web/src/lib/session-grouping.ts@@ -23,13 +23,25 @@ export const TEMP_WORKSPACE_GROUP_KEY = "\0temp-workspaces";const TEMP_WORKSPACE_RE = /[/\\]workspaces[/\\]tmp-[0-9a-f]{8}$/;/**- * Whether a Session's Workspace is an auto-created temporary workspace. An empty- * path also counts as one: the server always backfills the resolved path, so this- * is defensive only.+ * Any directory directly under an Agent's own `workspaces/` — `agents/<agent>/workspaces/<name>`+ * — which is where the evaluation Skill creates its isolated Test Workspaces, one per Case ×+ * Run, each holding that run's Test Session and nothing else. Their names are the Skill's+ * own, so the parent directory is the rule, not a prefix; a directory below one of them is+ * not itself such a Workspace. The server's workspace-group.ts folds the same paths, so the+ * group the sidebar draws is the group it pages.+ */+const AGENT_WORKSPACES_RE = /[/\\]agents[/\\][^/\\]+[/\\]workspaces[/\\][^/\\]+$/;++/**+ * Whether a Session's Workspace is one the system made for itself — core's auto-created+ * temporary directory, or any directory directly under an Agent's `workspaces/` (the+ * evaluation Skill's Test Workspaces) — and so belongs to the merged temp group instead of+ * a group of its own. An empty path also counts as one: the server always backfills the+ * resolved path, so this is defensive only.*/export function isTempWorkspace(workspace: string): boolean {const p = workspace.trim();- return p === "" || TEMP_WORKSPACE_RE.test(p);+ return p === "" || TEMP_WORKSPACE_RE.test(p) || AGENT_WORKSPACES_RE.test(p);}/** Stable group key for a Session's Workspace (collapse state / React key): the path itself, or the temp sentinel. */diff --git a/packages/web/src/lib/strings-en.ts b/packages/web/src/lib/strings-en.tsindex 8bfe28cf..b79a10db 100644--- a/packages/web/src/lib/strings-en.ts+++ b/packages/web/src/lib/strings-en.ts@@ -3090,69 +3090,46 @@ Scenarios:targetAgentHint:"The agent the cases are written for and scored under; the writing itself is done by the agent named below, in a new conversation",aiCreateExamples: {+ decisionAgent: {+ label: "Decisions: finite choices in football, after-sales and investing",+ description: "Public rules, past cases and current facts that conflict or fall short",+ prompt:+ "Write cases for a general decision agent: three scenarios — football betting, an after-sales action, an investment move — each with a fixed set of options, where the public rules, the historical cases and the current facts are either incomplete or contradict one another. Does it make a stable, explainable choice instead of following the latest fact it saw?",+ },reportWriter: {- label: "Report writing: 3 cases with contradicting sources",- description:- "3 cases: conflicting material, unstated conventions, strict length and citations",- prompt: `Write a small, hard Benchmark for the report-writing agent — few cases, a low baseline.--- benchmark_id: \`report-conflicting-sources\`-- capability: still deliver a report with traceable conclusions and one consistent set of conventions when the sources contradict each other, key conventions are unstated, and length and citations are constrained-- case count: 3-- techniques: each case gives 2–3 sources that contradict one another, one of them newer but dated only in a footer; currency, time zone and counting conventions are deliberately left incomplete, and the right move is to name the gap, make a conservative assumption and mark it; a strict length cap and citation format, where overrunning or a missing citation costs points outright-- desired_baseline_score: \`<50\`-- pilot_iteration_limit: \`4\``,+ label: "Report writing: contradicting sources",+ description: "Conflicting material, unstated conventions, strict length and citations",+ prompt:+ "Write cases for the report-writing agent: the sources contradict each other, key conventions such as currency and time zone are deliberately left incomplete, and the length cap and citation format are strict — does it name the gap and make a conservative assumption first?",},customerService: {- label: "Support: 3 conversations with a hidden policy condition",+ label: "Support: a hidden policy condition",description:- "3 cases: incomplete users, policy conditions buried in an appendix, an over-promise trap",- prompt: `Write a small, hard multi-turn Benchmark for the customer-support agent — few cases, a low baseline.--- benchmark_id: \`support-hidden-policy\`-- capability: verify before answering, never over-promise, and stay consistent with the policy when the user's information is incomplete, the policy condition is buried deep in the material, and an emotional message invites a promise the agent cannot make-- case count: 3-- techniques: the policy's exceptions and effective dates appear only in an appendix; the user's description is vague and the key facts come out only when asked; in at least one case the most natural reply is exactly the forbidden promise; scoring looks at verification, over-promising, tone and accuracy-- desired_baseline_score: \`<50\`-- pilot_iteration_limit: \`4\``,+ "Incomplete users, policy conditions buried in an appendix, an over-promise trap",+ prompt:+ "Write multi-turn cases for the customer-support agent: the user's description is vague and the key facts come out only when asked, the policy's exceptions sit in an appendix, and an emotional message invites a promise the agent cannot make — does it verify before answering and hold the policy line?",},codeReview: {- label: "Code review: 3 cases whose defects hide in the contracts",- description:- "3 cases: unstated calling and concurrency assumptions, misleading comments and tests",- prompt: `Write a small, hard Benchmark for the code-review agent — few cases, a low baseline.--- benchmark_id: \`review-hidden-contracts\`-- capability: find every real defect without false positives, and say how to verify each, when the defects hide in calling conventions, concurrency assumptions and data shapes and the comments and tests mislead-- case count: 3-- techniques: each case is a small multi-file repository with 2–3 real defects that depend on an unstated call order, a time-zone or encoding assumption, or a concurrency precondition; add one or two stale comments and a test that passes without covering the defects; scoring looks at recall, false positives and whether reproducible verification steps are given-- desired_baseline_score: \`<50\`-- pilot_iteration_limit: \`4\``,- },- dataAnalysis: {- label: "Data analysis: 3 cases with a vague ask and a booby-trapped dataset",- description: "3 cases: dirty data, unstated conventions, assumptions to clarify first",- prompt: `Write a small, hard Benchmark for the data-analysis agent — few cases, a low baseline.--- benchmark_id: \`analysis-ambiguous-asks\`-- capability: clarify assumptions before analysing, then reach a correct conclusion with verifiable conventions, when the business question is vague and the data carries dirty values and unstated conventions-- case count: 3-- techniques: each case ships a CSV with duplicate rows, mixed units and missing values, and a data dictionary that explains only some of the fields; the business question has two reasonable readings, and the right move is to name the split and answer under each stated assumption; scoring looks at the conclusion, the stated conventions and whether the charts agree with the conclusion-- desired_baseline_score: \`<50\`-- pilot_iteration_limit: \`4\``,+ label: "Code review: defects hidden in the contracts",+ description: "Unstated calling and concurrency assumptions, misleading comments and tests",+ prompt:+ "Write cases for the code-review agent: each a small multi-file repository whose defects hide in an unstated call order, a time-zone or encoding assumption and a concurrency precondition, with a stale comment or two and a test that passes without covering them — score recall, false positives and the verification steps.",},},aiCreateTail: (targetAgentId: string): string =>"Use the `benchmark-design` Skill: as the Builder, design and calibrate a Benchmark for the Test Agent below without changing that agent itself.\n\n" +`- test_agent_id: \`${targetAgentId}\`\n` +"- benchmark_id: keep the one named above if any; otherwise derive a short semantic id (letters, digits, `_` and `-` only)\n" +- "- desired_baseline_score: `<70` (unless the text above says otherwise)\n" +- "- pilot_iteration_limit: `3` (the draft above wins when it names one)\n\n" ++ "- case count: about 3 — few and hard, each with at least one decision that separates following the motions from actually doing the work (the draft above wins when it names one)\n" ++ "- techniques: hidden preconditions, vague or incomplete input, sources that contradict each other, strict deliverables; no difficulty from piling on rows or rules\n" ++ "- desired_baseline_score: `<50` (the draft above wins when it names one)\n" ++ "- pilot_iteration_limit: `4` (the draft above wins when it names one)\n\n" +"A Benchmark sits beside agents, not under one: create `benchmarks/<benchmark_id>/` under the Project (never inside the tested agent's directory) with " +"`benchmark_config.toml` (title, description, runs = 1; it records no agent), " +"one `CASE-NNN-<slug>/` per case (`statement/README.md` is the statement, `rubric/README.md` the scoring rubric, 100 points per case, nothing from the rubric leaking into the statement) " +"and `scoreboard.yaml` (initially `evaluations: []`; every evaluation records the tested `agent_id`, its `version`, the paired `provider` / `model_id` and the `thinking_level`). " +- "Delegate one `agent-evaluation` run per case through `run_subagent` to calibrate difficulty, " ++ "Every trial evaluation goes through `run_subagent`, and the subagent's prompt must say to use the `agent-evaluation` Skill — never score a run yourself and never bypass that Skill; " ++ "calibrate difficulty case by case, " +"freeze the final revision, append the Formal Baseline to scoreboard.yaml, and finish by reporting the Benchmark id, the baseline score and the per-case scores.",manualCreateTitle: "Create a Benchmark manually",manualCreateIntro:@@ -3215,7 +3192,7 @@ Scenarios:`- test_agent_id: \`${p.targetAgentId}\`\n` +`- benchmark_id: \`${p.benchmarkId}\` (the Project's \`benchmarks/${p.benchmarkId}/\`, beside the agents)\n` +`- runs: \`${p.runs}\`\n\n` +- "Evaluate the full Case × runs matrix through `run_subagent`, one self-spawned `agent-evaluation` subagent per matrix cell (omit `agent_id`); " ++ "Evaluate the full Case × runs matrix through `run_subagent`, one self-spawned subagent per matrix cell (omit `agent_id`), and say in every subagent's prompt to use the `agent-evaluation` Skill — never score a run yourself and never bypass that Skill; " +"the evaluation runtime is the model and thinking level that tested agent is configured with right now. Require every returned result to agree on " +"`agent_id`, `provider`, `model_id` and `thinking_level`, and stop rather than merge two labels into one record. Average the runs per case and the cases " +"per evaluation as the scoreboard contract specifies, then append exactly ONE evaluation to `scoreboard.yaml`, labelled with `agent_id`, `version`, " +@@ -3258,7 +3235,7 @@ Scenarios:`- runs: \`${p.runs}\`\n` +`- desired_score: \`>=${p.targetScore}\`\n` +`- candidate_round_limit: \`${p.roundLimit}\`\n\n` +- "Each round, state one falsifiable hypothesis from the current Reference and make one bounded change; evaluate the full Case × runs matrix through `run_subagent` with `agent-evaluation`, " ++ "Each round, state one falsifiable hypothesis from the current Reference and make one bounded change; evaluate the full Case × runs matrix through `run_subagent`, saying in every subagent's prompt to use the `agent-evaluation` Skill — never score a run yourself and never bypass that Skill; " +"keeping the provider / model_id / thinking_level that tested agent's baseline recorded; keep the version and append an evaluation carrying `agent_id`, `version`, `provider` / `model_id` and `thinking_level` " +"to scoreboard.yaml only when the total score is strictly higher than the Reference, otherwise roll back. " +"Finish by reporting the scores before and after, the retained version, and each round's change and decision.",diff --git a/packages/web/src/lib/strings.ts b/packages/web/src/lib/strings.tsindex a7b05103..af96b146 100644--- a/packages/web/src/lib/strings.ts+++ b/packages/web/src/lib/strings.ts@@ -3073,53 +3073,29 @@ Benchmark:targetAgent: "被测智能体",targetAgentHint: "题目为它而出、分数记在它名下;出题本身由下方所示的智能体在新对话里完成",aiCreateExamples: {+ decisionAgent: {+ label: "决策:足球、售后与投资的有限选择",+ description: "公开规则、历史案例与当前事实互相冲突或不完整",+ prompt:+ "为通用决策智能体出题:足球投注、售后处置、投资动作三个场景,各给一组有限选项,公开规则、历史案例与当前事实要么不完整、要么互相冲突,看它能不能给出稳定、可解释的选择,而不是被最近的一条信息带着走。",+ },reportWriter: {- label: "报告写作:材料互相矛盾的 3 道题",- description: "3 道题:冲突材料、缺失口径、严格篇幅与引用",- prompt: `为报告写作智能体出一套题量少而难的 Benchmark,把基线分压低。--- benchmark_id:\`report-conflicting-sources\`-- capability:在材料互相矛盾、关键口径没有写明、篇幅与引用受限时,仍能交出结论可追溯、口径一致的报告-- 题量:3 道-- 出题手法:每题给 2–3 份彼此冲突的材料,其中一份日期更新但只在页脚标注;币种、时区、统计口径等关键前提刻意不写全,正确做法是先指出缺口、再做保守假设并标明;篇幅上限与引用格式严格,超限或漏引直接失分-- desired_baseline_score:\`<50\`-- pilot_iteration_limit:\`4\``,+ label: "报告写作:材料互相矛盾",+ description: "冲突材料、缺失口径、严格的篇幅与引用",+ prompt:+ "为报告写作智能体出题:材料互相矛盾,币种、时区这类关键口径故意不写全,篇幅和引用格式卡得很严,看它会不会先指出缺口、再做保守假设。",},customerService: {- label: "客服:隐藏政策前提的 3 道对话题",- description: "3 道题:信息不全的用户、藏在附录的政策条件、越权承诺陷阱",- prompt: `为客服智能体出一套题量少而难的多轮对话 Benchmark,把基线分压低。--- benchmark_id:\`support-hidden-policy\`-- capability:在用户信息不全、政策条件藏在资料深处、情绪化表达诱导越权承诺时,仍能先核实再答复、不越权、口径与政策一致-- 题量:3 道-- 出题手法:政策文件的例外条款与生效日期只出现在附录;用户描述模糊,关键事实要追问才给;至少一题里最顺手的答复正是越权承诺;评分看是否核实、是否越权、语气与准确性-- desired_baseline_score:\`<50\`-- pilot_iteration_limit:\`4\``,+ label: "客服:隐藏政策前提的对话题",+ description: "信息不全的用户、藏在附录的政策条件、越权承诺陷阱",+ prompt:+ "为客服智能体出多轮对话题:用户描述模糊、关键事实要追问才给,政策的例外条款藏在附录里,情绪化的表达在诱导越权承诺,看它会不会先核实再答复、守住政策口径。",},codeReview: {- label: "代码审查:缺陷藏在约定里的 3 道题",- description: "3 道题:调用约定与并发前提未写明,注释与测试会误导",- prompt: `为代码审查智能体出一套题量少而难的 Benchmark,把基线分压低。--- benchmark_id:\`review-hidden-contracts\`-- capability:在缺陷藏在调用约定、并发前提与数据形态里、注释与测试反而误导时,仍能查全真实缺陷、不误报、并说明如何验证-- 题量:3 道-- 出题手法:每题一个小型多文件仓库,2–3 个真实缺陷分别依赖未写明的调用顺序、时区或编码假设、并发前提;附带一两条过时注释和一份能通过却覆盖不到缺陷的测试;评分看查全、误报与是否给出可复现的验证步骤-- desired_baseline_score:\`<50\`-- pilot_iteration_limit:\`4\``,- },- dataAnalysis: {- label: "数据分析:问题模糊、数据带坑的 3 道题",- description: "3 道题:脏数据、未说明的口径、需要先澄清假设",- prompt: `为数据分析智能体出一套题量少而难的 Benchmark,把基线分压低。--- benchmark_id:\`analysis-ambiguous-asks\`-- capability:在业务问题表述模糊、数据带脏值与未说明的口径时,先澄清假设再分析,结论正确且口径可核对-- 题量:3 道-- 出题手法:每题附一份带重复行、混合单位与缺失值的 CSV,字段含义只有一部分写在数据字典里;业务问题本身有两种合理解读,正确做法是指出分歧、按标明的假设分别作答;评分看结论、口径说明与图表是否与结论一致-- desired_baseline_score:\`<50\`-- pilot_iteration_limit:\`4\``,+ label: "代码审查:缺陷藏在约定里",+ description: "未写明的调用与并发前提,误导人的注释与测试",+ prompt:+ "为代码审查智能体出题:每题一个小型多文件仓库,缺陷藏在没写明的调用顺序、时区或编码假设和并发前提里,再配上过时的注释和一份能通过却盖不住缺陷的测试,看它查全、误报和验证步骤。",},},/** The fixed tail after the draft: the `benchmark-design` inputs and the layout it writes. */@@ -3127,14 +3103,16 @@ Benchmark:"请使用 `benchmark-design` Skill,作为 Builder 为下面的被测智能体设计并校准一套 Benchmark,不要修改被测智能体本身。\n\n" +`- test_agent_id:\`${targetAgentId}\`\n` +"- benchmark_id:上文已指定则沿用,否则按场景取一个简短的语义化 id(仅字母、数字、`_` 和 `-`)\n" +- "- desired_baseline_score:`<70`(上文另有要求时以上文为准)\n" +- "- pilot_iteration_limit:`3`(上文另有要求时以上文为准)\n\n" ++ "- 题量:3 道左右——少而难,每题至少有一个能把「照着做」和「真会做」分开的决定点(上文另有要求时以上文为准)\n" ++ "- 出题手法:隐藏的先验条件、模糊或不完整的输入、互相冲突的材料、严格的交付格式;不要靠堆行数、堆规则来加难度\n" ++ "- desired_baseline_score:`<50`(上文另有要求时以上文为准)\n" ++ "- pilot_iteration_limit:`4`(上文另有要求时以上文为准)\n\n" +"Benchmark 与 Agent 平级:在 Project 的 `benchmarks/<benchmark_id>/` 下(不在被测智能体目录内)创建 `benchmark_config.toml`" +"(title、description、runs = 1;不记录被测智能体)、" +"每题一个 `CASE-NNN-<slug>/`(`statement/README.md` 为题干,`rubric/README.md` 为评分细则,每题满分 100 分,细则不得泄露到题干)" +"以及 `scoreboard.yaml`(初始为 `evaluations: []`;每条 evaluation 记录被测的 `agent_id`、`version`、成对的 `provider` / `model_id` 与 `thinking_level`)。" +- "通过 `run_subagent` 委派 `agent-evaluation` 逐题试测以校准难度," +- "定稿后冻结并把 Formal Baseline 追加进 scoreboard.yaml,最后报告 Benchmark id、基线分数与各题得分。",+ "每一次试测都必须通过 `run_subagent` 派发子会话,并在子会话的 prompt 里写明使用 `agent-evaluation` Skill——不要自己打分,也不要绕过这个技能;" ++ "逐题试测以校准难度,定稿后冻结并把 Formal Baseline 追加进 scoreboard.yaml,最后报告 Benchmark id、基线分数与各题得分。",// New Benchmark, manual mode: the form.manualCreateTitle: "手动创建 Benchmark",manualCreateIntro:@@ -3195,7 +3173,7 @@ Benchmark:`- test_agent_id:\`${p.targetAgentId}\`\n` +`- benchmark_id:\`${p.benchmarkId}\`(Project 的 \`benchmarks/${p.benchmarkId}/\`,与 Agent 平级)\n` +`- runs:\`${p.runs}\`\n\n` +- "通过 `run_subagent` 按完整的 Case × runs 矩阵评测,每个矩阵单元一个自调用的 `agent-evaluation` 子会话(省略 `agent_id`);" ++ "通过 `run_subagent` 按完整的 Case × runs 矩阵评测,每个矩阵单元一个自调用的子会话(省略 `agent_id`),并在每个子会话的 prompt 里写明使用 `agent-evaluation` Skill——不要自己打分,也不要绕过这个技能;" +"评测 Runtime 取被测智能体当前配置的模型与思考等级。校验每条返回结果的 `agent_id`、`provider`、`model_id` 与 `thinking_level` 完全一致," +"不一致就停下、不要把不同标签混成一条。按记分契约求各题(runs 平均)与整体(各题平均)的分数," +"然后只向 `scoreboard.yaml` 追加一条 evaluation,记上 `agent_id`、`version`、`provider` / `model_id` 与 `thinking_level` 作为标签。" +@@ -3234,7 +3212,7 @@ Benchmark:`- runs:\`${p.runs}\`\n` +`- desired_score:\`>=${p.targetScore}\`\n` +`- candidate_round_limit:\`${p.roundLimit}\`\n\n` +- "每轮从当前 Reference 出发提出一个可证伪的假设、只做一个有界改动;通过 `run_subagent` 委派 `agent-evaluation` 评测完整的 Case × runs 矩阵," ++ "每轮从当前 Reference 出发提出一个可证伪的假设、只做一个有界改动;通过 `run_subagent` 评测完整的 Case × runs 矩阵,每个子会话的 prompt 里都写明使用 `agent-evaluation` Skill——不要自己打分,也不要绕过这个技能;" +"评测沿用该被测智能体基线记录的 provider / model_id / thinking_level;仅当总分严格高于 Reference 时保留该版本," +"并把记有 `agent_id`、`version`、`provider` / `model_id` 与 `thinking_level` 的 evaluation 追加到 scoreboard.yaml,否则回滚。" +"结束时报告优化前后的分数、保留的版本号,以及每轮的改动与取舍。",diff --git a/packages/web/test/session-grouping.test.ts b/packages/web/test/session-grouping.test.tsindex 098e2bc7..d81d4151 100644--- a/packages/web/test/session-grouping.test.ts+++ b/packages/web/test/session-grouping.test.ts@@ -80,6 +80,18 @@ describe("isTempWorkspace (temporary-workspace pattern from core's createTempWorexpect(isTempWorkspace(" ")).toBe(true);});+ it("matches any directory directly under an Agent's workspaces/ — the evaluation Skill's Test Workspaces", () => {+ expect(+ isTempWorkspace("/pg/data/proj/agents/a/workspaces/eval-example-benchmark-case-1-run-1"),+ ).toBe(true);+ expect(isTempWorkspace("C:\\pg\\data\\proj\\agents\\a\\workspaces\\run-7")).toBe(true);+ // A directory below one of them is not itself such a Workspace, and a workspaces/+ // directory that is not an Agent's is a user directory that just looks similar.+ expect(isTempWorkspace("/pg/data/proj/agents/a/workspaces/run-7/nested")).toBe(false);+ expect(isTempWorkspace("/srv/repo/workspaces/run-7")).toBe(false);+ expect(isTempWorkspace("/pg/data/proj/agents/a/workspaces")).toBe(false);+ });+it("rejects named directories and near misses", () => {expect(isTempWorkspace("/srv/repo")).toBe(false);// tmp-<8hex> without a workspaces/ parent is a user directory that just looks similardiff --git a/plugins/agent-tuning/plugin.json b/plugins/agent-tuning/plugin.jsonindex 5aea0219..8e5307de 100644--- a/plugins/agent-tuning/plugin.json+++ b/plugins/agent-tuning/plugin.json@@ -3,6 +3,6 @@"description_zh": "闭环的 Agent 调优:依据需求初始化 Agent、设计并校准能力 Benchmark、隔离执行与评分、再根据测得结果改进 Agent。","short_description": "Initialize, benchmark, evaluate and improve agents.","short_description_zh": "初始化、评测、评分与改进 Agent。",- "version": "2026.09.14.3",+ "version": "2026.09.15.1","category": "ai-app-development"}diff --git a/plugins/agent-tuning/skills/benchmark-design/SKILL.md b/plugins/agent-tuning/skills/benchmark-design/SKILL.mdindex fd0bed5b..347f6afb 100644--- a/plugins/agent-tuning/skills/benchmark-design/SKILL.md+++ b/plugins/agent-tuning/skills/benchmark-design/SKILL.md@@ -26,7 +26,7 @@ Follow this order:3. Plan the complete initial Case set and point allocation. For each Case, privately state the intended behavior, a plausible shortcut for a strong Test Agent, and how the Case distinguishes them. Write and leak-check the complete initial Benchmark.4. Complete one valid evaluation for every planned Case. Together these results form Pilot iteration 1; finish this complete set before refining any Case.5. For later Pilot iterations, use scores and Traces to reconstruct how the Test Agent solved each Case. A single iteration may refine multiple Cases or difficulty dimensions; rerun every affected Case.-6. Freeze the first valid Pilot revision that meets the desired baseline score. If none does within the requested valid-iteration limit, restore and freeze the lowest-scoring valid Pilot revision.+6. Freeze the first valid Pilot revision that meets the desired baseline score. If none does within the requested valid-iteration limit, restore and freeze the lowest-scoring valid Pilot revision. The desired score steers refinement; the publish gate is fixed at 85 on the `0..100` scale, so a frozen revision that scores below 85 is published even when it misses the desired score.7. Freeze the selected revision and record its complete one-Run-per-Case Pilot result as the Formal Baseline when every cell is valid, the Agent State version remains unchanged, and no known design defect remains. Do not rerun or backfill it. The Formal score does not determine validity.## Setup and access@@ -70,7 +70,7 @@ Each Case contains:Both directories require a `README.md` and may contain supporting files. Do not put Gold answers for evaluated instances, hidden mappings, or private scoring conditions in `statement/`.-Create `benchmark_config.toml` with `title`, `description`, `runs = 1`, and `status = "draft"`. Benchmark design always uses one Run per Case; do not ask for or accept another Run count. `status = "draft"` tells the Web App that the Benchmark is still being built — it shows the Benchmark masked, and nobody can use or open it until the status is `published`. A draft ends in one of two states: `published` once the Formal Baseline is recorded, or `failed` when calibration produces no valid Pilot result to freeze. Initialize `scoreboard.yaml` with `evaluations: []`.+Create `benchmark_config.toml` with `title`, `description`, `runs = 1`, and `status = "draft"`. Benchmark design always uses one Run per Case; do not ask for or accept another Run count. `status = "draft"` tells the Web App that the Benchmark is still being built — it shows the Benchmark masked, and nobody can use or open it until the status is `published`. A draft ends in one of two states: `published` once a Formal Baseline scoring below 85 is recorded, or `failed` when calibration produces no valid Pilot result to freeze or when the lowest-scoring valid revision still scores 85 or above at the iteration limit. Initialize `scoreboard.yaml` with `evaluations: []`.Pass the resolved `(provider, model_id)` explicitly in every Pilot Evaluator request, starting with the first cell. Freeze that pair and the Test Agent's configured `thinking_level` for the complete Benchmark workflow. Every scored Evaluator result must report the requested pair and the same configured thinking level. A mismatch invalidates the matrix.@@ -152,15 +152,15 @@ An information gap or supported alternative is not automatically a design defectMore rows, fields, distractors, files, near-duplicate examples, or explicit rule layers do not increase difficulty when the observed strategy still solves the Case. Base refinements on observed behavior and fix the Gold before each evaluation.-Freeze immediately when a complete valid Pilot iteration meets the desired baseline score and no known design defect remains. Do not run another difficulty refinement merely to create more score margin. Otherwise continue through the requested valid-iteration limit. If the desired score is still unmet, restore the temporary lowest-scoring valid revision and proceed to Freeze. Report `calibration_failed` only when no valid Pilot revision can be produced or evaluation failures prevent a valid selection; missing the desired score alone is not a failure.+Freeze immediately when a complete valid Pilot iteration meets the desired baseline score and no known design defect remains. Do not run another difficulty refinement merely to create more score margin. Otherwise continue through the requested valid-iteration limit. If the desired score is still unmet, restore the temporary lowest-scoring valid revision and proceed to Freeze. The desired baseline score is a calibration target, not the publish gate: the gate is fixed at 85 on the `0..100` scale, and any frozen valid revision scoring below 85 is published, however far it stays from the desired score. Report `calibration_failed` only when no valid Pilot revision can be produced, evaluation failures prevent a valid selection, or the lowest-scoring valid revision still scores 85 or above at the iteration limit — a Test Agent that already scores that high leaves the Benchmark nothing to measure. Missing the desired score alone is never a failure.## Freeze and record the Formal BaselineAfter selecting the Pilot revision, restore that exact revision and its complete result if needed. Run a complete consistency review and final leak check across every Case. If the review finds a defect, repair it and produce a complete valid one-Run-per-Case Pilot result for the repaired revision before selecting and freezing it. Freeze the Benchmark and record the current Agent State version. Do not launch a fresh Formal matrix, rerun the selected Pilot, or backfill it to another Run count.-Accept the selected Pilot result as the Formal Baseline when every Case has exactly one valid Run, every cell reports the frozen evaluation runtime, the Agent State version remains unchanged, the private scoring standard remained fixed, and every score loss reflects the Capability Contract. Record the Formal Baseline even when its score does not meet the desired baseline score.+Accept the selected Pilot result as the Formal Baseline when every Case has exactly one valid Run, every cell reports the frozen evaluation runtime, the Agent State version remains unchanged, the private scoring standard remained fixed, and every score loss reflects the Capability Contract. Record the Formal Baseline even when its score does not meet the desired baseline score; only a score of 85 or above blocks it.-Report `calibration_failed` only when no valid revision remains or evaluation failures prevent a complete selected Pilot result. Never record a partial, abandoned, invalid, or non-selected Pilot result as the Formal Baseline.+Report `calibration_failed` only when no valid revision remains, evaluation failures prevent a complete selected Pilot result, or the selected revision scores 85 or above. Never record a partial, abandoned, invalid, or non-selected Pilot result as the Formal Baseline.## Record and finish@@ -195,7 +195,7 @@ evaluations:After writing, parse the complete `scoreboard.yaml` and verify the appended Evaluation, including its `agent_id`, before reporting success or continuing.-Once the Formal Baseline is verified, set `status = "published"` in `benchmark_config.toml`. Change only that line, keep `title`, `description` and `runs` as they are, and parse the file again to confirm it is valid TOML. When the run ends in `calibration_failed`, set `status = "failed"` the same way — change only that line, keep the other fields, and parse the file again — so the Web App tells the user that this Benchmark failed to calibrate and has to be deleted and created again. Never leave a failed Benchmark on `draft`.+Once the Formal Baseline is verified, set `status = "published"` in `benchmark_config.toml`. Change only that line, keep `title`, `description` and `runs` as they are, and parse the file again to confirm it is valid TOML. When the run ends in `calibration_failed`, set `status = "failed"` the same way — change only that line, keep the other fields, and parse the file again — so the Web App tells the user that this Benchmark failed to calibrate and has to be deleted and created again. Never leave a failed Benchmark on `draft`, and never write `failed` because the desired baseline score was missed: a Formal Baseline below 85 is published.Every Run and Case score is on the fixed `0..100` scale. Do not write `max_score`. Calculate and write every Case and Evaluation average directly in the Scoreboard: ignore `null` values when averaging cost and write `null` only when all contributing costs are unknown; round `score` averages to two decimal places, `cost` averages to six decimal places, and `duration_ms` averages to the nearest integer. These stored values are authoritative—do not add a server, frontend, script, or consistency check that recomputes or validates them. Do not add an `aggregate` object or use `case_id`, `mean_score`, `mean_cost`, or `mean_duration_ms`.