skillfit 0.11.0 → 0.12.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.
Files changed (61) hide show
  1. package/README.md +28 -5
  2. package/README.zh-CN.md +28 -5
  3. package/benches/README.md +6 -2
  4. package/dist/cli.js +28 -16
  5. package/dist/commands/bench-calibration.js +5 -1
  6. package/dist/commands/bench-draft.js +167 -0
  7. package/dist/commands/bench-draft.test.js +168 -0
  8. package/dist/commands/bench-manage.js +5 -4
  9. package/dist/commands/bench-source.js +101 -0
  10. package/dist/commands/bench-source.test.js +84 -0
  11. package/dist/commands/bench.js +165 -103
  12. package/dist/commands/bench.test.js +7 -3
  13. package/dist/commands/eval-agent-preflight.test.js +24 -0
  14. package/dist/commands/eval-api-failure.test.js +46 -0
  15. package/dist/commands/eval-cli-usage.test.js +75 -0
  16. package/dist/commands/eval-interruption.test.js +26 -1
  17. package/dist/commands/eval-layout.test.js +126 -0
  18. package/dist/commands/eval.js +7 -32
  19. package/dist/commands/npm-first-run.test.js +74 -0
  20. package/dist/harness/agent-preflight.js +18 -2
  21. package/dist/harness/bench-location.js +29 -0
  22. package/dist/harness/bench-location.test.js +33 -0
  23. package/dist/harness/bench.js +8 -3
  24. package/dist/harness/eval-audit.js +1 -1
  25. package/dist/harness/evaluation-layout.js +30 -0
  26. package/dist/harness/executors/api.js +20 -7
  27. package/dist/harness/executors/api.test.js +39 -0
  28. package/dist/harness/executors/cli.js +15 -25
  29. package/dist/harness/executors/cli.test.js +33 -2
  30. package/dist/harness/experiment-session.js +5 -15
  31. package/dist/harness/hash.js +3 -1
  32. package/dist/harness/runner.js +5 -4
  33. package/dist/harness/single-arm-audit.js +1 -1
  34. package/dist/harness/trigger.js +1 -1
  35. package/dist/harness/verifier-timeout.js +8 -0
  36. package/dist/harness/verifier-timeout.test.js +76 -0
  37. package/docs/bench-authoring.md +23 -3
  38. package/docs/bench-drafting.md +75 -0
  39. package/docs/case-management.md +12 -1
  40. package/docs/eval-agent-preflight.md +15 -2
  41. package/docs/eval-costs.md +28 -2
  42. package/docs/eval-planning.md +14 -0
  43. package/docs/evaluation-input-snapshots.md +20 -4
  44. package/docs/first-real-eval.md +28 -3
  45. package/docs/growth-roadmap-2026-10.md +23 -14
  46. package/docs/plans/2026-10-17-workflow-foundations.md +37 -2
  47. package/docs/releases/0.11.0-ci-registry-install.json +130 -0
  48. package/docs/releases/0.11.0-feature-smoke.json +1576 -0
  49. package/docs/releases/0.11.0-local-attempt-1.json +24 -0
  50. package/docs/releases/0.11.0-local-attempt-1.log +19 -0
  51. package/docs/releases/0.11.0-local-registry-install.json +25 -0
  52. package/docs/releases/0.11.0-registry-metadata.json +33 -0
  53. package/docs/releases/0.11.0-signatures.txt +12 -0
  54. package/docs/releases/0.11.0-verification.json +95 -0
  55. package/docs/releases/0.11.0.md +54 -11
  56. package/docs/releases/0.12.0-feature-smoke.mjs +73 -0
  57. package/docs/releases/0.12.0.md +68 -0
  58. package/docs/schemas/agent-preflight.schema.json +1 -1
  59. package/docs/verifier-contract.md +9 -0
  60. package/package.json +1 -1
  61. package/skills/skillfit/SKILL.md +25 -5
package/README.md CHANGED
@@ -65,13 +65,28 @@ The skill fired once in nine in-domain tasks — and the tasks pass 3/3 without
65
65
  ## Install
66
66
 
67
67
  ```bash
68
- npx skillfit@0.11.0 --help
69
- npx skillfit@0.11.0 doctor
68
+ npx skillfit@0.12.0 --help
69
+ npx skillfit@0.12.0 doctor
70
70
  ```
71
71
 
72
- `npx skillfit` installs the published release and needs Node.js 22 or newer. The quick start below uses a source checkout so you can run the benches that ship in this repository. After `npm run build`, `node dist/cli.js` is that checkout's CLI. `skillfit` is the command installed from npm.
72
+ `npx skillfit` installs the published release and needs Node.js 22 or newer. You can create and check cases without cloning this repository. npm may download the package first; the case checks and previews below then make no model calls. `skillfit` is the command installed from npm.
73
73
 
74
- ## Quick start
74
+ ## First run with npm
75
+
76
+ Run these commands in your project directory. Replace `./my-skill` with the directory containing your own `SKILL.md` before previewing:
77
+
78
+ ```bash
79
+ npx skillfit@0.12.0 bench init my-bench --kind command --dry-run
80
+ npx skillfit@0.12.0 bench init my-bench --kind command --yes
81
+ npx skillfit@0.12.0 bench check ./my-bench --json
82
+ npx skillfit@0.12.0 eval ./my-skill --bench ./my-bench --mode installed --agent codex --trials 1 --max-calls 2 --runs-root ./runs --run-group first-eval --json --dry-run
83
+ ```
84
+
85
+ The scaffold is a teaching case; replace its fixture, prompt, verifier and oracle with your real task before measuring benefit. The preview declares two calls and makes none. Read `plan.evaluation.agentPreflight.status`: generating a plan does not establish a ready CLI or valid login. Keep your bench and runs in separate directories. Continue with [your first real evaluation](docs/first-real-eval.md) for reviewed execution, reports and sharing.
86
+
87
+ ## Run from source
88
+
89
+ A source checkout lets you build and develop the CLI locally. After `npm run build`, `node dist/cli.js` is that checkout's CLI:
75
90
 
76
91
  ```bash
77
92
  git clone https://github.com/remote-controlled-man/skillfit.git
@@ -118,6 +133,8 @@ Agent callers can use `bench check --json` for versioned gate identifiers, task
118
133
 
119
134
  Version 0.11.0 supports quoted verifier/oracle arguments, including script paths with spaces. Recognized grader load/runtime errors and explicit infrastructure-error messages block offline gates or become ungraded evaluation errors, preserving agent costs. Normal task failures and assertions remain graded failures. See [verifier commands and error reporting](docs/verifier-contract.md).
120
135
 
136
+ Version 0.12.0 tightens `bench add --freeze`: Git imports never fall back to ignored files, non-Git imports require `--include`, and selected links or destination-bench files are rejected. `--decompose` confirms before its single drafting call and retains costs and failures; see [drafting records](docs/bench-drafting.md). Each case can set `verifierTimeoutSeconds` for verifier/oracle checks, including preflight and replay; the default stays 120 seconds.
137
+
121
138
  The same source checks the Agent environment in eval and baseline-calibration previews and before dispatch: CLI file availability, matrix capability matching and global same-name Skill conflicts. Known failures block before case probes or model calls; login remains explicitly unknown offline. Checks are sealed with the run and read without probing the current machine during report/replay. See [Agent environment preflight](docs/eval-agent-preflight.md).
122
139
 
123
140
  List and inspect cases, then preview an edit or removal. `--yes` applies a validated manifest change with a backup; removal preserves the case files. Select a smaller paired eval, trigger run or baseline calibration using repeated `--task`, or `taskIds` in a paired JSON request. IDs and order are frozen, budgets count only selected cases, and small samples remain indicative. See [case management](docs/case-management.md).
@@ -217,10 +234,16 @@ New reports separate cached and uncached input, output, and elapsed time, with s
217
234
 
218
235
  Version 0.11.0 records `invocationCosts` for primary Agent, judge and total spending, preserving failed/partial/unknown usage. Optional judge spending shares the batch stop lines; an explicitly enabled API judge with missing credentials fails instead of silently turning off. Historical missing judge receipts stay unknown. See [cost accounting](docs/eval-costs.md).
219
236
 
237
+ Version 0.12.0 also reads ordinary Codex eval and CLI judge JSON usage without requiring trigger detection. Offline `USAGE_CAPABILITY` checks reject strict budgets when a primary/judge adapter is known to lack required token counters, before spending. Unknown API/injected coverage still needs runtime checks; missing costs never become zero.
238
+
239
+ That source also preserves API-reported usage when an answer has an invalid format or HTTP status. Available response counters stay recorded alongside the raw response; missing fields remain unknown. The call remains an execution error and stops further dispatches, rather than losing its cost evidence.
240
+
220
241
  That source can export a supported sealed native paired, calibration or trigger run, including new paired runs with judge receipts, as a portable directory with original receipts, matching inputs, pinned compiled CLI, checksums and a replay entry point. Export previews by default; missing inputs, required receipt/runtime support or an existing destination stop it. The whole package can move to another machine. Replay calls no model, preserves stopped/unknown costs and authorizes no upgrade. Review project data before sharing; see [portable replay packages](docs/replay-packages.md).
221
242
 
222
243
  Version 0.10.1 seals input copies before dispatch: later edits/deletions of the original Skill, bench or request no longer prevent export/replay. The plan records snapshot integrity, local copy time and storage; a damaged declared snapshot is rejected. Historical runs still need matching recovered inputs. See [sealed evaluation inputs](docs/evaluation-input-snapshots.md).
223
244
 
245
+ Version 0.12.0 supports benches at a Git repository root: hashing and snapshots both exclude Git metadata. Previews reject output inside the bench, Skill/configuration inputs, compiled runtime or Git metadata, including directory aliases. Keep inputs and runs in sibling directories, such as `--bench ./my-bench --runs-root ./runs`.
246
+
224
247
  ```bash
225
248
  node dist/cli.js report eval ./runs/my-run --export ./exports/my-run --json
226
249
  node dist/cli.js report eval ./runs/my-run --export ./exports/my-run --yes --json
@@ -312,7 +335,7 @@ Not affiliated with Anthropic, OpenAI, Moonshot AI, or any agent vendor. Evaluat
312
335
  - [x] Optional `triggerClass` (`explicit`, `implicit`, `contextual`) on positive tasks. Unlabeled tasks stay in the pooled recall.
313
336
  - [x] `--compete-installed` copies other user-level Skills into a trigger trial. System Skills and plugins outside the matrix directories are not copied. `installed` reports a long-body read separately from the task result; that read is not trigger recall.
314
337
  - [ ] An installation recommendation. The July 2026 eight-skill study found no robust task-quality gain. The 67-Skill catalog and the 13-Skill starter set are not evaluated as sets.
315
- - [x] npm publication (`skillfit@0.10.1`), with [verified CLI/OIDC publication and registry installation](docs/releases/0.10.1-verification.json). `npx skillfit` installs that release. Clone, `npm ci`, and `npm run build` remain valid.
338
+ - [x] npm distribution through [CLI/OIDC releases](docs/releases/trusted-publishing.md). See the [0.12.0 release record](docs/releases/0.12.0.md) for publication status and verification. Clone, `npm ci`, and `npm run build` remain valid.
316
339
  - [x] Community bench and evidence submissions. Benches go in `benches/contrib`; evidence uses the Evidence submission issue template. CI runs the offline gates and does not call an agent.
317
340
  - [ ] Cursor / Gemini CLI / OpenCode adapters
318
341
  - [x] Streamable HTTP MCP preflight (`mcp check` transport `http`). It does not call a tool.
package/README.zh-CN.md CHANGED
@@ -65,13 +65,28 @@ F1 : 0.20 (no CI: a harmonic mean of two proportions has no clo
65
65
  ## 安装
66
66
 
67
67
  ```bash
68
- npx skillfit@0.11.0 --help
69
- npx skillfit@0.11.0 doctor
68
+ npx skillfit@0.12.0 --help
69
+ npx skillfit@0.12.0 doctor
70
70
  ```
71
71
 
72
- `npx skillfit` 安装的是已发布的版本,需要 Node.js 22 或更新。下面的快速开始用的是源码检出,这样才能跑本仓库自带的 bench。`npm run build` 之后,`node dist/cli.js` 是这份检出的 CLI。`skillfit` 是从 npm 装上的命令。
72
+ `npx skillfit` 安装的是已发布的版本,需要 Node.js 22 或更新。不克隆仓库也能创建和校验 case。npm 可能先下载包;之后下面的 case 校验与预览不调用模型。`skillfit` 是从 npm 装上的命令。
73
73
 
74
- ## 快速开始
74
+ ## 用 npm 开始
75
+
76
+ 在自己的项目目录运行这些命令。预览前,把 `./my-skill` 换成包含你自己的 `SKILL.md` 的目录:
77
+
78
+ ```bash
79
+ npx skillfit@0.12.0 bench init my-bench --kind command --dry-run
80
+ npx skillfit@0.12.0 bench init my-bench --kind command --yes
81
+ npx skillfit@0.12.0 bench check ./my-bench --json
82
+ npx skillfit@0.12.0 eval ./my-skill --bench ./my-bench --mode installed --agent codex --trials 1 --max-calls 2 --runs-root ./runs --run-group first-eval --json --dry-run
83
+ ```
84
+
85
+ 脚手架是教学 case;衡量收益前,要把初始文件、任务、校验器和参考解换成自己的真实任务。预览声明两次调用,但不会执行。检查 `plan.evaluation.agentPreflight.status`:能生成计划不代表 CLI 已就绪或登录有效。bench 与运行结果放在不同目录。后续的确认执行、报告和分享见[第一次真实评估指南](docs/first-real-eval.md)。
86
+
87
+ ## 从源码运行
88
+
89
+ 源码检出可以在本地构建和开发 CLI。`npm run build` 之后,`node dist/cli.js` 是这份检出的 CLI:
75
90
 
76
91
  ```bash
77
92
  git clone https://github.com/remote-controlled-man/skillfit.git
@@ -118,6 +133,8 @@ Agent 可以用 `bench check --json` 读取带版本的校验标识、任务 ID
118
133
 
119
134
  0.11.0支持给校验器和参考解命令的参数加引号,包括含空格的脚本路径。已识别的评分器加载/运行异常及显式基础设施错误消息会阻止离线校验通过,或记为不参与评分的评测错误,同时保留 Agent 成本。正常任务失败和断言失败仍参与评分。详见[校验命令与错误报告](docs/verifier-contract.md)。
120
135
 
136
+ 0.12.0收紧了 `bench add --freeze`:Git 导入不会回退读取被忽略的文件,非 Git 导入必须用 `--include` 选择,选中的链接或目标 bench 文件会被拒绝。`--decompose` 在唯一一次生成调用前确认,并保留成本和失败记录;参见[生成记录](docs/bench-drafting.md)。每个 case 可用 `verifierTimeoutSeconds` 设置 verifier/oracle 的超时,开跑前校验和离线重放也使用该值;默认仍为 120 秒。
137
+
121
138
  0.11.0 还会在 eval 和基线校准的预览及开跑前检查 Agent 环境:CLI 文件是否可用、能力是否与矩阵声明匹配,以及全局是否存在同名 Skill。已知失败会在 case 探测或模型调用前拦住;登录状态明确标为离线未知。检查结果随运行封存,报告和重放读取当时记录,不探测当前机器。详见 [Agent 环境自检](docs/eval-agent-preflight.md)。
122
139
 
123
140
  可以列出和查看 case,再预览编辑或移除操作。加 `--yes` 才会备份并应用通过校验的清单变更;移除会保留 case 文件。配对评估、触发率测试和基线校准都可重复 `--task` 只选择部分 case;配对 JSON 请求用 `taskIds`。所选 ID 和顺序会固定到计划中,预算只计算所选 case,小样本仍只作参考。参见 [case 管理](docs/case-management.md)。
@@ -214,10 +231,16 @@ node dist/cli.js report eval docs/examples/eval-manifest.synthetic.json
214
231
 
215
232
  0.11.0用 `invocationCosts` 分别记录 Agent、裁判和合计消耗,保留失败、部分和未知用量。可选裁判的消耗计入同一批次停线;显式启用 API 裁判却缺少凭据会报错,不会静默关闭。历史缺失的裁判记录仍标未知。参见[成本统计](docs/eval-costs.md)。
216
233
 
234
+ 0.12.0也会读取普通 Codex 评测和 CLI 裁判的 JSON 用量,不再要求启用触发检测。离线 `USAGE_CAPABILITY` 检查会在花费前拒绝已知缺少必要计数的 Agent/裁判严格预算组合。API/注入执行器的覆盖情况仍标未知,需要运行时检查;缺失成本不会补成零。
235
+
236
+ 这份源码也会在 API 回答格式或 HTTP 状态异常时保留接口已报告的用量。可用计数与原始响应一起保存;缺失字段仍标未知。调用仍属于执行异常并停止后续调用,不会因此丢掉已有成本证据。
237
+
217
238
  同一份源码可把受支持且已封存的原生配对、校准和触发率实验(包括带有新裁判记录的配对实验)导出为独立目录,包含原始记录、匹配的输入、当时的编译版 CLI、校验清单和重放入口。默认只预览;缺输入、缺少必需的调用记录/原始运行时支持或目标目录已存在就停止。整个目录可搬到另一台机器,重放不调用模型,保留中止状态和未知成本,也不能授权升级。分享前检查项目数据,参见[可搬走的复现包](docs/replay-packages.md)。
218
239
 
219
240
  0.10.1 会在调用前封存输入副本:原始 Skill、bench 或请求之后被修改、删除,也不影响导出和重放。计划会记录快照校验信息、本地复制耗时和存储量;已声明的快照损坏就拒绝使用。历史记录仍需找回匹配的原始输入。参见[评测输入封存](docs/evaluation-input-snapshots.md)。
220
241
 
242
+ 0.12.0支持把 bench 放在 Git 仓库根目录:指纹和快照统一排除 Git 元数据。预览会拦住位于 bench、Skill/配置输入、编译运行时或 Git 元数据内部的输出,目录别名也不能绕过。输入与结果应放在同级目录,例如 `--bench ./my-bench --runs-root ./runs`。
243
+
221
244
  ```bash
222
245
  node dist/cli.js report eval ./runs/my-run --export ./exports/my-run --json
223
246
  node dist/cli.js report eval ./runs/my-run --export ./exports/my-run --yes --json
@@ -309,7 +332,7 @@ node ./personal-codex/setup.mjs --yes
309
332
  - [x] 正例任务可选 `triggerClass`(`explicit`、`implicit`、`contextual`)。没标类别的任务仍只进汇总召回率。
310
333
  - [x] `--compete-installed` 把其他用户级 Skill 复制进 trigger 试验。矩阵目录之外的系统 Skill 和插件不会被复制。`installed` 把「读了长正文」和任务结果分开报告;这次读取不是 trigger 召回率。
311
334
  - [ ] 安装建议。2026 年 7 月的 8 个 Skill 实验没有可靠的任务质量增益。67 个 Skill 目录和 13 个入门套装都没有作为一组被评过。
312
- - [x] 已发布到 npm(`skillfit@0.10.1`),并通过 [CLI/OIDC 发布与注册表安装验收](docs/releases/0.10.1-verification.json)。`npx skillfit` 安装的是这个版本。克隆后 `npm ci` 再 `npm run build` 仍然可用。
335
+ - [x] 通过 [CLI/OIDC 流程](docs/releases/trusted-publishing.md)分发 npm 包。发布状态和验收结果见 [0.12.0 发布记录](docs/releases/0.12.0.md)。克隆后 `npm ci` 再 `npm run build` 仍然可用。
313
336
  - [x] 社区 bench 与 evidence 提交。bench 放在 `benches/contrib`;证据用 Evidence submission issue 模板。CI 只跑离线检查,不调用 agent。
314
337
  - [ ] Cursor / Gemini CLI / OpenCode 适配器
315
338
  - [x] Streamable HTTP MCP 预检(`mcp check` 的 `http` 传输)。不会调用工具。
package/benches/README.md CHANGED
@@ -84,15 +84,19 @@ Only the task's `fixtures/<task-id>/` directory is copied into a run directory.
84
84
  | `tasks[].rubric` | no | Markdown file injected into the optional LLM judge prompt (never shown to the agent under test). |
85
85
  | `tasks[].shouldTrigger` | no | Whether an in-scope skill *should* fire on this task. Required for `--mode trigger` (unlabeled tasks are skipped there). Include negative controls (`false`) — aim for ≥30% of tasks; `bench check` reports the fraction and warns below that target, because false-trigger rate is the metric a thin negative sample undermines first. |
86
86
 
87
+ Version 0.12.0 also accepts optional `tasks[].verifierTimeoutSeconds` (integer 1–3600,
88
+ default 120). It bounds each verifier/oracle process during checks, evaluation, calibration,
89
+ triggering and replay, separately from model execution. See [the command contract](../docs/verifier-contract.md).
90
+
87
91
  All paths must stay inside the bench directory.
88
92
 
89
93
  ## Verifier contract
90
94
 
91
95
  The verifier is the heart of a bench. It must be **deterministic**: same run directory in, same verdict out — no network, no clocks, no randomness.
92
96
 
93
- - Invocation: `<verifier command> <absolute run directory>`, working directory = bench root. The command is spawned **without a shell**, so its first token must be an executable the operating system can start directly: `node verifiers/x.mjs` works, while a bare `npm test` or a `.cmd`/`.bat` wrapper does not (`ENOENT` / `EINVAL` on Windows). Source after npm 0.10.1 groups quoted arguments, so `node "verifiers/check answer.mjs"` works; malformed quoting fails before execution. No shell expansion runs. See [command and error contract](../docs/verifier-contract.md). If the verdict genuinely comes from a shell command, use `bench add --freeze --verifier-cmd "<cmd>"`, which writes a generated `verifiers/<task-id>.mjs` that node runs and that runs your command under a shell inside. Keeping the harness's own spawn shell-free is deliberate, not an oversight — benches are contributed by third parties, and a shell here would turn `"verifier": "node v.mjs & curl …"` in somebody else's `bench.json` into code execution on your machine.
97
+ - Invocation: `<verifier command> <absolute run directory>`, working directory = bench root. The command is spawned **without a shell**, so its first token must be an executable the operating system can start directly: `node verifiers/x.mjs` works, while a bare `npm test` or a `.cmd`/`.bat` wrapper does not (`ENOENT` / `EINVAL` on Windows). Version 0.11.0 groups quoted arguments, so `node "verifiers/check answer.mjs"` works; malformed quoting fails before execution. No shell expansion runs. See [command and error contract](../docs/verifier-contract.md). If the verdict genuinely comes from a shell command, use `bench add --freeze --verifier-cmd "<cmd>"`, which writes a generated `verifiers/<task-id>.mjs` that node runs and that runs your command under a shell inside. Keeping the harness's own spawn shell-free is deliberate, not an oversight — benches are contributed by third parties, and a shell here would turn `"verifier": "node v.mjs & curl …"` in somebody else's `bench.json` into code execution on your machine.
94
98
  - A verifier that produces **no exit code at all** — unspawnable, or killed by the 2-minute timeout — has graded nothing, so it is never read as a verdict: `bench check` fails the task and names the cause, and `eval` excludes that trial *and its paired arm* from the rates rather than scoring a fabricated failure. Without that, a broken verifier command would look like a 0% pass rate in both arms and get reported as "bench too hard".
95
- - **For a functioning verifier, exit code 0 = pass, anything else = fail.** Source after npm 0.10.1 separately excludes recognized grader infrastructure errors, including bench-owned Node uncaught exceptions and explicit `skillfit.verifier-error` JSON messages. They cannot satisfy NOP gates or score a model failure merely by exiting nonzero. Candidate failures/assertions retain normal grading; agent spending stays recorded. See [the contract and custom-runtime error channel](../docs/verifier-contract.md).
99
+ - **For a functioning verifier, exit code 0 = pass, anything else = fail.** Version 0.11.0 separately excludes recognized grader infrastructure errors, including bench-owned Node uncaught exceptions and explicit `skillfit.verifier-error` JSON messages. They cannot satisfy NOP gates or score a model failure merely by exiting nonzero. Candidate failures/assertions retain normal grading; agent spending stays recorded. See [the contract and custom-runtime error channel](../docs/verifier-contract.md).
96
100
  - Print a one-line JSON summary as the **last stdout line**. The harness parses it (tolerating surrounding noise) and saves the raw output to `_verifier.txt`:
97
101
  - `passed` (boolean) — informational; the exit code is authoritative, and a disagreement is flagged as a warning.
98
102
  - `checks` (optional) — `[{"name": "discount-boundary", "pass": true}, ...]`: the acceptance criteria decomposed into 2–8 named programmatic checks. The trial **score** is the fraction of checks passed; scores feed the per-facet table and the paired-bootstrap Δscore CI in the report, letting a bench resolve effects binary pass/fail cannot at small sample sizes. Checks never flip a verdict. Keep them deterministic and outcome-focused. `bench check` reads the count back out of your verifier and warns outside 2–8: one check is binary pass/fail in facet costume and carries none of the graded signal, while a dozen lets whatever those checks happen to measure dominate the score.
package/dist/cli.js CHANGED
@@ -32,12 +32,12 @@ Usage:
32
32
  skillfit eval <target-path> [options] A/B-test a Skill, rules, or MCP setup against a bench
33
33
  skillfit mcp check <spec.json> Handshake with a stdio or Streamable HTTP MCP server and audit its tool catalog
34
34
  skillfit bench init [dir] [--kind output|command] Scaffold a text-output or code-editing case
35
- skillfit bench check [dir] [--json] Validate a bench offline (verifier self-tests, hygiene)
36
- skillfit bench check [dir] --calibrate Plus real baseline-difficulty runs (needs --agent)
35
+ skillfit bench check [path-or-name] [--json] Validate a local/bundled bench offline
36
+ skillfit bench check [path-or-name] --calibrate Plus real baseline-difficulty runs (needs --agent)
37
37
  skillfit bench add <dir> --freeze ... Freeze a real failure into a bench task (see below)
38
38
  skillfit bench add <dir> --from-commit <sha> Mine a fix commit (parent = fixture, fix's tests = verifier)
39
- skillfit bench list <dir> [--json] List registered cases without running verifiers
40
- skillfit bench show <dir> <task-id> [--json] Inspect one registered case
39
+ skillfit bench list <path-or-name> [--json] List local/bundled cases without running verifiers
40
+ skillfit bench show <path-or-name> <task-id> [--json] Inspect one registered case
41
41
  skillfit bench edit <dir> <task-id> --set <field=value> Plan a manifest edit (apply with --yes)
42
42
  skillfit bench remove <dir> <task-id> Plan to unregister a case, preserving its files
43
43
  skillfit install [options] Inspect or apply a managed configuration profile
@@ -52,11 +52,11 @@ Options:
52
52
  --request <path> Version 1 Skill revision request (JSON output; excludes positional eval options)
53
53
  --plan-sha <hash> Confirm an eval/calibration dry-run plan (also needs --run-group)
54
54
  --json Machine output for bench check/list/show/edit/remove, report, eval and calibration
55
- --spending-budget <file> Eval/calibration: input, cachedInput, uncachedInput, output, durationSeconds stop lines
56
- --executor-timeout-seconds <n> Eval/calibration: executor deadline (integer 1–3600)
55
+ --spending-budget <file> Eval/calibration/drafting: input, cachedInput, uncachedInput, output, durationSeconds stop lines
56
+ --executor-timeout-seconds <n> Eval/calibration/drafting: executor deadline (integer 1–3600)
57
57
  --pair-order <order> Paired eval: baseline-first (default) | balanced
58
- --runs-root <dir> Eval/calibration output parent (default: ./runs)
59
- --run-group <name> Fresh eval group; reuse its name when confirming a preview
58
+ --runs-root <dir> Eval/calibration/drafting output parent (default: ./runs)
59
+ --run-group <name> Fresh record group; reuse its name when confirming an eval preview
60
60
  --policy <path> With paired report eval, assess against a policy (post-hoc changes cannot authorize adoption)
61
61
  --records <dir> With paired report eval, use native evidence from this run directory
62
62
  --replay With report eval, audit receipts and regrade cloned deliveries; never call a model
@@ -67,7 +67,7 @@ Options:
67
67
  --bench <path> Bench directory for eval (default: bundled benches)
68
68
  --task <id> With eval/calibration, select cases (repeatable, manifest order); requests use taskIds
69
69
  --trials <n> Repetitions per condition for eval (integer 1–20; default: ${DEFAULT_EVAL_TRIALS})
70
- --max-calls <n> Call ceiling for eval / bench check --calibrate (includes enabled judges)
70
+ --max-calls <n> Call ceiling for eval / bench check --calibrate / bench add --decompose
71
71
  Also controls baseline calibration repetitions
72
72
  --profile <name> Profile for install (default: "recommended")
73
73
  --profile-path <dir> Install a portable profile from a local directory
@@ -90,9 +90,9 @@ bench init options:
90
90
  --kind <kind> output (default, grades a reply) | command (grades file edits)
91
91
 
92
92
  bench edit options:
93
- --set <field=value> Change fixture, prompt, promptTrigger, verifier, verifierKind,
93
+ --set <field=value> Change fixture, prompt, promptTrigger, verifier, verifierKind, verifierTimeoutSeconds,
94
94
  oracle, rubric or shouldTrigger (repeatable)
95
- --unset <field> Remove promptTrigger, oracle, rubric or shouldTrigger (repeatable)
95
+ --unset <field> Remove promptTrigger, verifierTimeoutSeconds, oracle, rubric or shouldTrigger (repeatable)
96
96
  Edits/removals default to a plan; --yes backs up bench.json and applies
97
97
 
98
98
  bench add --freeze options:
@@ -103,7 +103,9 @@ bench add --freeze options:
103
103
  --decompose Draft verifier.mjs + oracle.mjs with an agent (--agent <id>), gated by NOP + oracle checks
104
104
  --verifier-kind <k> With --decompose: output (default, grades _output.md) | command (grades file state)
105
105
  --oracle <cmd> Register an oracle (reference-solution) command for the new task
106
+ --verifier-timeout-seconds <n> Each verifier/oracle deadline (integer 1–3600; default: 120)
106
107
  --source-dir <dir> Directory to snapshot as the fixture (default: cwd; git-tracked files only when inside a git repo)
108
+ --include <path> Select a file/subdirectory (repeatable; required outside Git; no symlinks)
107
109
  --should-trigger <yes|no> Label for trigger-mode evaluation
108
110
 
109
111
  bench add --from-commit options:
@@ -160,6 +162,7 @@ const CLI_OPTIONS = {
160
162
  oracle: { type: 'string' },
161
163
  decompose: { type: 'boolean', default: false },
162
164
  'verifier-kind': { type: 'string' },
165
+ 'verifier-timeout-seconds': { type: 'string' },
163
166
  kind: { type: 'string' },
164
167
  'should-trigger': { type: 'string' },
165
168
  calibrate: { type: 'boolean', default: false },
@@ -232,10 +235,13 @@ async function main() {
232
235
  if (values['plan-sha'] !== undefined && ((command !== 'eval' && !calibrationCommand) || values['dry-run']))
233
236
  throw new Error('--plan-sha requires a non-dry-run eval or calibration.');
234
237
  const evalSettings = ['spending-budget', 'executor-timeout-seconds', 'pair-order', 'runs-root', 'run-group'];
235
- if (command !== 'eval' && !calibrationCommand && evalSettings.some(key => values[key] !== undefined))
236
- throw new Error('Budget, timeout and output settings apply only to eval or calibration.');
237
- if (calibrationCommand && values['pair-order'] !== undefined)
238
+ const draftingCommand = command === 'bench' && positionals[1] === 'add' && values.decompose;
239
+ if (command !== 'eval' && !calibrationCommand && !draftingCommand && evalSettings.some(key => values[key] !== undefined))
240
+ throw new Error('Budget, timeout and output settings apply only to eval, calibration or bench add --decompose.');
241
+ if ((calibrationCommand || draftingCommand) && values['pair-order'] !== undefined)
238
242
  throw new Error('--pair-order requires a paired eval.');
243
+ if (values['verifier-timeout-seconds'] !== undefined && !(command === 'bench' && positionals[1] === 'add'))
244
+ throw new Error('--verifier-timeout-seconds applies only to bench add; edit an existing case with --set verifierTimeoutSeconds=<n>.');
239
245
  if (calibrationCommand && (values.mode !== undefined || values['judge-agent'] !== undefined || values['baseline-skill'] !== undefined || values['compete-installed'] || values.bench !== undefined)) {
240
246
  throw new Error('Calibration is single-arm: --mode, --judge-agent, --baseline-skill, --compete-installed and --bench do not apply; supply the bench directory after check.');
241
247
  }
@@ -261,8 +267,8 @@ async function main() {
261
267
  const maxCalls = values['max-calls'] === undefined ? undefined : Number(values['max-calls']);
262
268
  if (maxCalls !== undefined && (!Number.isSafeInteger(maxCalls) || maxCalls < 1))
263
269
  throw new Error('--max-calls must be a positive safe integer.');
264
- if (maxCalls !== undefined && command !== 'eval' && !(command === 'bench' && positionals[1] === 'check' && values.calibrate)) {
265
- throw new Error('--max-calls applies only to eval or bench check --calibrate.');
270
+ if (maxCalls !== undefined && command !== 'eval' && !draftingCommand && !(command === 'bench' && positionals[1] === 'check' && values.calibrate)) {
271
+ throw new Error('--max-calls applies only to eval, bench check --calibrate or bench add --decompose.');
266
272
  }
267
273
  if (trials !== undefined && (!Number.isInteger(trials) || trials < 1 || trials > 20)) {
268
274
  throw new Error(`--trials must be an integer between 1 and 20, got ${JSON.stringify(values.trials)}`);
@@ -543,6 +549,12 @@ async function main() {
543
549
  oracle: values.oracle,
544
550
  decompose: values.decompose ?? false,
545
551
  verifierKind,
552
+ verifierTimeoutSeconds: values['verifier-timeout-seconds'] === undefined ? undefined : Number(values['verifier-timeout-seconds']),
553
+ maxCalls,
554
+ runsRoot: values['runs-root'],
555
+ runGroup: values['run-group'],
556
+ spendingBudget: values['spending-budget'] === undefined ? undefined : parseSpendingBudget(readComponentJson(resolve(values['spending-budget'])).value),
557
+ executorTimeoutSeconds: values['executor-timeout-seconds'] === undefined ? undefined : Number(values['executor-timeout-seconds']),
546
558
  shouldTrigger: shouldTrigger === undefined ? undefined : shouldTrigger === 'yes',
547
559
  });
548
560
  return;
@@ -5,10 +5,12 @@ import { fileURLToPath } from 'node:url';
5
5
  import { getAgent } from '../agents.js';
6
6
  import { assertAgentEnvironment, assertAgentEnvironmentUnchanged, inspectAgentEnvironment, renderAgentEnvironment } from '../harness/agent-preflight.js';
7
7
  import { loadBench, selectBenchTasks } from '../harness/bench.js';
8
+ import { resolveBenchDir } from '../harness/bench-location.js';
8
9
  import { RUN_GROUP_PATTERN } from '../harness/constants.js';
9
10
  import { summarizeCosts } from '../harness/costs.js';
10
11
  import { createSpendingBudgetRecorder, parseSpendingBudget } from '../harness/eval-budget.js';
11
12
  import { parseExecutorTimeoutSeconds } from '../harness/eval-contract.js';
13
+ import { assertEvaluationOutputLayout } from '../harness/evaluation-layout.js';
12
14
  import { ExperimentSession, validateCallBudget } from '../harness/experiment-session.js';
13
15
  import { CliExecutor } from '../harness/executors/cli.js';
14
16
  import { hashFileSet, listFilesRecursive, sha256File, sha256Text } from '../harness/hash.js';
@@ -20,7 +22,7 @@ function emptySkill(sourceDir) {
20
22
  }
21
23
  function resolveCalibration(input) {
22
24
  const options = input.calibrate;
23
- const bench = selectBenchTasks(loadBench(resolve(input.dir ?? '.')), input.taskIds ?? options.taskIds);
25
+ const bench = selectBenchTasks(loadBench(resolveBenchDir(input.dir ?? '.')), input.taskIds ?? options.taskIds);
24
26
  const trials = options.trials ?? 2;
25
27
  if (!Number.isInteger(trials) || trials < 1 || trials > 20)
26
28
  throw new Error(`calibration trials must be an integer between 1 and 20, got ${trials}`);
@@ -55,6 +57,7 @@ function resolveCalibration(input) {
55
57
  const inspect = () => inspectAgentEnvironment({ roles: [{ role: 'agent', definition, executor: executor?.describe() ?? null,
56
58
  injected: options.executor !== undefined, resolutionError: resolutionError ?? (!executor ? '--calibrate needs --agent (a CLI executor for real runs)' : undefined) }],
57
59
  mode: 'inject', target: emptySkill(bench.dir), capabilityError,
60
+ spendingBudget: spendingBudget !== undefined,
58
61
  homeDir: options.sessionOptions?.homeDir, env: options.sessionOptions?.env });
59
62
  const agentPreflight = inspect();
60
63
  const runsRoot = resolve(options.runsRoot ?? 'runs');
@@ -62,6 +65,7 @@ function resolveCalibration(input) {
62
65
  if (!RUN_GROUP_PATTERN.test(runGroup))
63
66
  throw new Error(`Invalid run group: ${runGroup}`);
64
67
  const outputDir = join(runsRoot, runGroup);
68
+ assertEvaluationOutputLayout(outputDir, { benchDir: bench.dir });
65
69
  if (existsSync(outputDir))
66
70
  throw new Error(`Run group directory already exists: ${outputDir}`);
67
71
  const guardFiles = (options.guardFiles ?? []).map(file => ({ ...file, path: resolve(file.path) }));
@@ -0,0 +1,167 @@
1
+ import { createHash, randomUUID } from 'node:crypto';
2
+ import { appendFileSync, existsSync, lstatSync, mkdirSync, readdirSync, writeFileSync } from 'node:fs';
3
+ import { dirname, join, resolve } from 'node:path';
4
+ import { getAgent } from '../agents.js';
5
+ import { VERSION } from '../version.js';
6
+ import { agentTokenCounters, findExecutable } from '../harness/agent-preflight.js';
7
+ import { summarizeCosts } from '../harness/costs.js';
8
+ import { createSpendingBudgetRecorder, parseSpendingBudget, spendingBudgetState } from '../harness/eval-budget.js';
9
+ import { parseExecutorTimeoutSeconds } from '../harness/eval-contract.js';
10
+ import { assertEvaluationOutputLayout } from '../harness/evaluation-layout.js';
11
+ import { executionClock } from '../harness/execution-timing.js';
12
+ import { validateCallBudget } from '../harness/experiment-session.js';
13
+ import { CliExecutor } from '../harness/executors/cli.js';
14
+ import { hashFileSet, sha256Text } from '../harness/hash.js';
15
+ import { EvaluationInterrupted, evaluationSignal, throwIfEvaluationInterrupted } from '../harness/interruption.js';
16
+ import { RUN_GROUP_PATTERN } from '../harness/constants.js';
17
+ import { ExecutorFailure } from '../harness/types.js';
18
+ import { parseVerifierTimeoutSeconds } from '../harness/verifier-timeout.js';
19
+ /** A single drafting call is authoring evidence, never an evaluation or upgrade verdict. */
20
+ export class BenchDraftSession {
21
+ taskId;
22
+ files;
23
+ prompt;
24
+ dir;
25
+ workspace;
26
+ plan;
27
+ executor;
28
+ clock;
29
+ budget;
30
+ observations = [];
31
+ started = false;
32
+ callsStarted = 0;
33
+ callsFinished = 0;
34
+ finished = false;
35
+ constructor(options, taskId, benchDir, cwd, files, prompt) {
36
+ this.taskId = taskId;
37
+ this.files = files;
38
+ this.prompt = prompt;
39
+ const timeout = parseExecutorTimeoutSeconds(options.executorTimeoutSeconds);
40
+ const budget = options.spendingBudget === undefined ? undefined : parseSpendingBudget(options.spendingBudget);
41
+ const maxCalls = validateCallBudget(1, options.maxCalls);
42
+ if (!options.executor && !options.agent)
43
+ throw new Error('bench add --decompose needs an agent to draft with: --agent <id>.');
44
+ if (options.agent && !options.executor) {
45
+ const agent = getAgent(options.agent), argv = agent.headless.streamJson?.argv ?? agent.headless.argv;
46
+ if (!findExecutable(argv[0]))
47
+ throw new Error(`Drafting CLI is missing or not executable on PATH: ${argv[0]}. No calls started.`);
48
+ const missing = ['input', 'cachedInput', 'output'].filter(metric => !agentTokenCounters(agent).includes(metric));
49
+ if (budget && missing.length)
50
+ throw new Error(`Draft spending limits require unavailable CLI counters: ${missing.join(', ')}. No calls started.`);
51
+ }
52
+ this.executor = options.executor ?? CliExecutor.forAgent(options.agent, { timeoutMs: timeout * 1000 });
53
+ this.clock = options.clock ?? executionClock;
54
+ const group = options.runGroup ?? `draft-${Date.now()}-${randomUUID().slice(0, 8)}`;
55
+ if (!RUN_GROUP_PATTERN.test(group))
56
+ throw new Error('Invalid draft --run-group.');
57
+ this.dir = resolve(cwd, options.runsRoot ?? 'runs', group);
58
+ assertEvaluationOutputLayout(this.dir, { benchDir });
59
+ if (existsSync(this.dir))
60
+ throw new Error(`Draft record directory already exists: ${this.dir}`);
61
+ this.workspace = join(this.dir, 'workspace');
62
+ this.plan = { schemaVersion: 1, kind: 'skillfit.bench-draft-plan', taskId, benchDir,
63
+ plannedCalls: 1, maxCalls, executorTimeoutSeconds: timeout, spendingBudget: budget ?? null,
64
+ verifierTimeoutSeconds: parseVerifierTimeoutSeconds(options.verifierTimeoutSeconds),
65
+ executor: this.executor.describe(), nodeVersion: process.version, packageVersion: VERSION,
66
+ authentication: 'unknown', outputDir: this.dir, promptSha256: sha256Text(prompt),
67
+ fixtureFiles: files.map(file => ({ path: file.rel, bytes: file.content.length, sha256: createHash('sha256').update(file.content).digest('hex') })),
68
+ automaticRetry: false, automaticUpgrade: false };
69
+ this.budget = createSpendingBudgetRecorder({ budget, groupDir: this.dir });
70
+ }
71
+ write(path, content) {
72
+ const target = join(this.dir, path);
73
+ mkdirSync(dirname(target), { recursive: true });
74
+ writeFileSync(target, content, { flag: 'wx' });
75
+ }
76
+ async run() {
77
+ if (this.started)
78
+ throw new Error('A drafting session cannot be retried. Choose a fresh record group.');
79
+ throwIfEvaluationInterrupted();
80
+ mkdirSync(dirname(this.dir), { recursive: true });
81
+ mkdirSync(this.dir); // Exclusive claim; never replace an earlier draft, including a failed one.
82
+ this.started = true;
83
+ this.write('_plan.json', JSON.stringify(this.plan, null, 2) + '\n');
84
+ this.write('prompt.md', this.prompt);
85
+ for (const file of this.files) {
86
+ this.write(join('_inputs/fixture', file.rel), file.content);
87
+ this.write(join('workspace/fixture', file.rel), file.content);
88
+ }
89
+ const expectedFixture = hashFileSet(join(this.dir, '_inputs/fixture'), this.files.map(file => file.rel));
90
+ const identity = { taskId: this.taskId, trial: 1, role: 'drafter' };
91
+ this.budget.before(identity);
92
+ throwIfEvaluationInterrupted();
93
+ this.callsStarted++;
94
+ const startedAt = this.clock.wallNow(), start = this.clock.monotonicNow();
95
+ appendFileSync(join(this.dir, '_calls.jsonl'), JSON.stringify({ event: 'started', at: new Date(startedAt).toISOString(), ...identity }) + '\n');
96
+ let result = { output: '' }, failure;
97
+ try {
98
+ result = await this.executor.run(this.prompt, this.workspace);
99
+ }
100
+ catch (error) {
101
+ failure = error;
102
+ if (error instanceof ExecutorFailure)
103
+ result = error.result;
104
+ }
105
+ const durationSeconds = Math.max(0, (this.clock.monotonicNow() - start) / 1000);
106
+ const invoked = !(failure instanceof ExecutorFailure && !failure.executorInvoked);
107
+ const observation = { executorInvoked: invoked, passed: false,
108
+ error: failure || result.guardError ? 'Draft executor failed.' : evaluationSignal()?.aborted ? 'Draft interrupted.' : null,
109
+ durationSeconds, tokens: result.tokens ?? null, usageStatus: result.usageStatus ?? (result.tokens ? 'final' : 'unknown') };
110
+ this.observations.push(observation);
111
+ this.write('_result.json', JSON.stringify({ schemaVersion: 1, ...identity, ...observation,
112
+ startedAt: new Date(startedAt).toISOString(), executionTiming: result.executionTiming ?? null, usageEvidence: result.usageEvidence ?? null }, null, 2) + '\n');
113
+ this.write('_output.md', result.output);
114
+ if (result.rawOutput !== undefined)
115
+ this.write('_transcript.jsonl', result.rawOutput);
116
+ this.callsFinished++;
117
+ appendFileSync(join(this.dir, '_calls.jsonl'), JSON.stringify({ event: 'finished', ...identity, executorInvoked: invoked }) + '\n');
118
+ this.budget.after(identity, observation);
119
+ throwIfEvaluationInterrupted();
120
+ if (failure || result.guardError)
121
+ throw new Error('Draft executor failed; retained records include every reported cost. No retry.', { cause: failure });
122
+ const tree = (root) => {
123
+ if (!lstatSync(root).isDirectory() || lstatSync(root).isSymbolicLink())
124
+ throw new Error('Draft replaced a fixture directory; rejected without retry.');
125
+ const paths = [];
126
+ const walk = (rel) => {
127
+ for (const entry of readdirSync(join(root, rel), { withFileTypes: true })) {
128
+ const path = rel ? `${rel}/${entry.name}` : entry.name;
129
+ if (entry.isDirectory())
130
+ walk(path);
131
+ else if (entry.isFile())
132
+ paths.push(path);
133
+ else
134
+ throw new Error('Draft inserted an unsupported fixture entry; rejected without retry.');
135
+ }
136
+ };
137
+ walk('');
138
+ return paths.sort();
139
+ };
140
+ const files = tree(join(this.workspace, 'fixture'));
141
+ if (JSON.stringify(files) !== JSON.stringify(this.files.map(file => file.rel).sort()) ||
142
+ hashFileSet(join(this.workspace, 'fixture'), files) !== expectedFixture ||
143
+ JSON.stringify(tree(join(this.dir, '_inputs/fixture'))) !== JSON.stringify(files) ||
144
+ hashFileSet(join(this.dir, '_inputs/fixture'), files) !== expectedFixture)
145
+ throw new Error('Draft modified the pristine fixture; rejected without retry.');
146
+ }
147
+ gate(name, result) {
148
+ appendFileSync(join(this.dir, '_gates.jsonl'), JSON.stringify({ name, ...result }) + '\n');
149
+ throwIfEvaluationInterrupted();
150
+ }
151
+ finish(error) {
152
+ if (!this.started || this.finished)
153
+ return;
154
+ this.finished = true;
155
+ const interrupted = evaluationSignal()?.aborted;
156
+ const interrupt = evaluationSignal()?.reason;
157
+ const population = summarizeCosts({ baseline: this.observations, treatment: [] }, { baseline: [], treatment: [] }).attempts.baseline;
158
+ this.write('_summary.json', JSON.stringify({ schemaVersion: 1, kind: 'skillfit.bench-draft-result',
159
+ status: error || interrupted ? 'stopped' : 'completed', taskId: this.taskId,
160
+ plannedCalls: 1, maxCalls: this.plan.maxCalls, callsStarted: this.callsStarted, callsFinished: this.callsFinished,
161
+ reason: interrupted ? 'Interrupted; no automatic retry.' : error instanceof Error ? error.message : error ? 'Draft stopped.' : null,
162
+ interruption: interrupt instanceof EvaluationInterrupted ? { signal: interrupt.signalName, receivedAt: interrupt.receivedAt } : null,
163
+ costs: { invocations: population.runs, metrics: population.metrics },
164
+ spendingBudget: this.plan.spendingBudget ? spendingBudgetState(this.plan.spendingBudget, this.observations) : null,
165
+ automaticRetry: false, automaticUpgrade: false }, null, 2) + '\n');
166
+ }
167
+ }