skillfit 0.10.1 → 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 (118) hide show
  1. package/README.md +43 -8
  2. package/README.zh-CN.md +43 -8
  3. package/benches/README.md +6 -2
  4. package/dist/cli.js +153 -37
  5. package/dist/cli.test.js +94 -0
  6. package/dist/commands/bench-calibration.js +201 -0
  7. package/dist/commands/bench-calibration.test.js +237 -0
  8. package/dist/commands/bench-check-json.test.js +24 -3
  9. package/dist/commands/bench-draft.js +167 -0
  10. package/dist/commands/bench-draft.test.js +168 -0
  11. package/dist/commands/bench-manage.js +5 -4
  12. package/dist/commands/bench-source.js +101 -0
  13. package/dist/commands/bench-source.test.js +84 -0
  14. package/dist/commands/bench.js +227 -245
  15. package/dist/commands/bench.test.js +7 -3
  16. package/dist/commands/calibration-cli.test.js +145 -0
  17. package/dist/commands/eval-agent-preflight.test.js +269 -0
  18. package/dist/commands/eval-api-failure.test.js +46 -0
  19. package/dist/commands/eval-cli-usage.test.js +75 -0
  20. package/dist/commands/eval-cli.js +31 -0
  21. package/dist/commands/eval-component.js +52 -28
  22. package/dist/commands/eval-export-modes.test.js +350 -0
  23. package/dist/commands/eval-export.js +12 -4
  24. package/dist/commands/eval-interruption.test.js +26 -1
  25. package/dist/commands/eval-layout.test.js +126 -0
  26. package/dist/commands/eval-plan.js +37 -0
  27. package/dist/commands/eval-preflight.test.js +144 -1
  28. package/dist/commands/eval-report.js +18 -3
  29. package/dist/commands/eval-single-arm-replay.js +21 -0
  30. package/dist/commands/eval-single-arm-report.js +223 -0
  31. package/dist/commands/eval.js +113 -88
  32. package/dist/commands/evaluation-report.js +5 -0
  33. package/dist/commands/evaluation-report.test.js +243 -0
  34. package/dist/commands/npm-first-run.test.js +74 -0
  35. package/dist/commands/replay-cancellation.test.js +105 -0
  36. package/dist/commands/workflow-entrypoints.test.js +137 -0
  37. package/dist/harness/agent-preflight.js +196 -0
  38. package/dist/harness/bench-location.js +29 -0
  39. package/dist/harness/bench-location.test.js +33 -0
  40. package/dist/harness/bench.js +10 -4
  41. package/dist/harness/command.js +49 -0
  42. package/dist/harness/eval-audit.js +162 -17
  43. package/dist/harness/eval-budget.js +46 -2
  44. package/dist/harness/eval-budget.test.js +26 -1
  45. package/dist/harness/eval-component.test.js +163 -0
  46. package/dist/harness/eval-contract.js +11 -5
  47. package/dist/harness/evaluation-layout.js +30 -0
  48. package/dist/harness/executors/api.js +24 -10
  49. package/dist/harness/executors/api.test.js +57 -0
  50. package/dist/harness/executors/cli.js +15 -25
  51. package/dist/harness/executors/cli.test.js +33 -2
  52. package/dist/harness/experiment-session.js +23 -25
  53. package/dist/harness/experiment-session.test.js +8 -0
  54. package/dist/harness/hash.js +3 -1
  55. package/dist/harness/invocation-costs.js +72 -0
  56. package/dist/harness/judge-accounting.test.js +216 -0
  57. package/dist/harness/judge-audit.js +56 -0
  58. package/dist/harness/judge.js +86 -21
  59. package/dist/harness/replay-package.js +71 -5
  60. package/dist/harness/runner.js +44 -33
  61. package/dist/harness/runner.test.js +23 -0
  62. package/dist/harness/single-arm-audit.js +436 -0
  63. package/dist/harness/trigger.js +22 -4
  64. package/dist/harness/trigger.test.js +12 -0
  65. package/dist/harness/verifier-error.js +65 -0
  66. package/dist/harness/verifier-timeout.js +8 -0
  67. package/dist/harness/verifier-timeout.test.js +76 -0
  68. package/dist/harness/verifier.test.js +128 -0
  69. package/docs/bench-authoring.md +57 -12
  70. package/docs/bench-check-json.md +28 -5
  71. package/docs/bench-drafting.md +75 -0
  72. package/docs/case-management.md +12 -1
  73. package/docs/eval-agent-preflight.md +114 -0
  74. package/docs/eval-case-preflight.md +5 -0
  75. package/docs/eval-component.md +38 -10
  76. package/docs/eval-costs.md +70 -0
  77. package/docs/eval-planning.md +167 -0
  78. package/docs/evaluation-input-snapshots.md +22 -5
  79. package/docs/evaluation-interruption.md +22 -10
  80. package/docs/evaluation-reports.md +97 -3
  81. package/docs/experiment-workflow.md +7 -0
  82. package/docs/first-real-eval.md +75 -3
  83. package/docs/growth-roadmap-2026-10.md +51 -10
  84. package/docs/metrics.md +40 -3
  85. package/docs/plans/2026-10-17-workflow-foundations.md +99 -0
  86. package/docs/releases/0.10.1-ci-registry-install.json +70 -0
  87. package/docs/releases/0.10.1-feature-smoke.json +28 -0
  88. package/docs/releases/0.10.1-local-registry-install.json +60 -0
  89. package/docs/releases/0.10.1-registry-metadata.json +33 -0
  90. package/docs/releases/0.10.1-signatures.txt +7 -0
  91. package/docs/releases/0.10.1-verification.json +90 -0
  92. package/docs/releases/0.10.1.md +37 -4
  93. package/docs/releases/0.11.0-ci-registry-install.json +130 -0
  94. package/docs/releases/0.11.0-feature-smoke.json +1576 -0
  95. package/docs/releases/0.11.0-feature-smoke.mjs +224 -0
  96. package/docs/releases/0.11.0-local-attempt-1.json +24 -0
  97. package/docs/releases/0.11.0-local-attempt-1.log +19 -0
  98. package/docs/releases/0.11.0-local-registry-install.json +25 -0
  99. package/docs/releases/0.11.0-registry-metadata.json +33 -0
  100. package/docs/releases/0.11.0-signatures.txt +12 -0
  101. package/docs/releases/0.11.0-verification.json +95 -0
  102. package/docs/releases/0.11.0.md +90 -0
  103. package/docs/releases/0.12.0-feature-smoke.mjs +73 -0
  104. package/docs/releases/0.12.0.md +68 -0
  105. package/docs/replay-packages.md +38 -6
  106. package/docs/schemas/agent-preflight.schema.json +31 -0
  107. package/docs/schemas/calibration-plan.schema.json +22 -0
  108. package/docs/schemas/calibration-result.schema.json +17 -0
  109. package/docs/schemas/eval-request.schema.json +1 -1
  110. package/docs/schemas/eval-result.schema.json +3 -1
  111. package/docs/schemas/invocation-costs.schema.json +31 -0
  112. package/docs/schemas/judge-call.schema.json +22 -0
  113. package/docs/schemas/single-arm-report.schema.json +20 -0
  114. package/docs/schemas/verifier-error.schema.json +11 -0
  115. package/docs/sharing-results.md +3 -0
  116. package/docs/verifier-contract.md +108 -0
  117. package/package.json +1 -1
  118. package/skills/skillfit/SKILL.md +61 -8
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.10.0 --help
69
- npx skillfit@0.10.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
@@ -114,9 +129,15 @@ node dist/cli.js eval skills/skillfit --bench my-bench --agent codex --input wor
114
129
 
115
130
  This is a synthetic teaching case, not a Skill benchmark. Replace the fixture, prompt, verifier and oracle with your actual task before measuring benefit. The preview shows two planned calls and starts none. Omit `--kind` (or use `--kind output`) for the existing reply-grading starter. Capture an observed failure with `bench add --freeze`, or import a maintainer fix with `--from-commit`; follow the [authoring guide](docs/bench-authoring.md).
116
131
 
117
- Agent callers can use `bench check --json` for versioned gate identifiers, task IDs, locations, failure reasons, remediation suggestions and bounded verifier evidence. stdout is JSON only; exit codes distinguish passed checks, failed checks and errors. This interface is offline only and rejects `--calibrate`; warnings still need review. See the [JSON contract](docs/bench-check-json.md).
132
+ Agent callers can use `bench check --json` for versioned gate identifiers, task IDs, locations, failure reasons, remediation suggestions and bounded verifier evidence. stdout is JSON only; exit codes distinguish passed checks, failed checks and errors. Without `--calibrate`, this remains an offline integrity check; warnings still need review. Version 0.11.0 also supports a separate `--calibrate --json --dry-run` plan, with explicit hash confirmation before JSON execution. See the [JSON contract](docs/bench-check-json.md).
133
+
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).
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.
118
137
 
119
- 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 eval using repeated `--task`, or `taskIds` in a JSON request. IDs and order are frozen, budgets count only selected cases, and small samples remain indicative. See [case management](docs/case-management.md).
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).
139
+
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).
120
141
 
121
142
  ```bash
122
143
  node dist/cli.js bench list my-bench --json
@@ -165,6 +186,10 @@ Requests can also pin `executorTimeoutSeconds` (default 600) for both versions.
165
186
 
166
187
  Available in 0.10.0: optional `spendingBudget` sets five absolute batch stop lines. Reaching a line or losing complete final usage stops subsequent calls and retains spending; an in-flight call may overshoot. See the [guard contract](docs/eval-component.md#input-and-execution).
167
188
 
189
+ Version 0.11.0 unifies ordinary paired/trigger eval planning and paired Agent request plans. Ordinary eval also accepts `--json`, `--spending-budget <file>`, `--executor-timeout-seconds`, `--runs-root` and `--run-group`, plus `--pair-order` for paired runs; JSON execution requires the preview hash. Requests can set `baselineSkill: null` for no Skill installed by the harness in baseline, matching ordinary installed eval without `--baseline-skill`. This measures installation benefit but cannot authorize revision adoption. See [shared settings and confirmation](docs/eval-planning.md).
190
+
191
+ The same source gives baseline calibration and trigger runs JSON previews, frozen task selection, call/spending limits and per-call deadlines. Preview runs no verifier, oracle or agent; hard case/environment failures block live execution. JSON execution needs an explicit fresh group and the exact preview hash (`plan.planSha256` for calibration, `plan.sha256` for eval). Calibration measures baseline difficulty; trigger measures discovery. Neither establishes paired Skill benefit or authorizes adoption.
192
+
168
193
  Failed Codex JSON calls can retain identity-bound partial usage from local numeric counters. Private transcript bodies stay out of exports, and partial usage never satisfies the final-cost or adoption gates.
169
194
 
170
195
  ```bash
@@ -203,12 +228,22 @@ node dist/cli.js report eval docs/examples/eval-manifest.synthetic.json
203
228
 
204
229
  In 0.10.1, Markdown and JSON accept the same manifest, native run directory or portable package, including stopped/incomplete batches. Both assess saved evidence and explain acceptance separately from a quality verdict. `--replay`, `--records` and `--policy` work in either format; successful rendering does not authorize an upgrade. See [report inputs and states](docs/evaluation-reports.md).
205
230
 
231
+ Version 0.11.0 also reads calibration directories/`_calibration.json` and trigger manifests in either format. Completed calibration stays completed and shows baseline difficulty; trigger reports show recall, false-trigger rate, precision, F1 and detection coverage. New sealed single-arm runs support native audit, offline delivery replay and portable export; standalone historical summaries stay unverified. These separate reports cannot authorize adoption or use paired acceptance-policy options. See [report types](docs/evaluation-reports.md#calibration-and-trigger-reports-source-after-npm-0101).
232
+
206
233
  New reports separate cached and uncached input, output, and elapsed time, with spending per successful task that includes failed runs. They show surviving pairs alongside all agent invocations, and mark partial or missing timeout usage instead of treating it as zero. Chat-completions API responses retain explicit cached-input counts, including zero; missing or invalid counts stay unknown. Older manifests identify these fields as unrecorded. See [cost accounting](docs/eval-costs.md).
207
234
 
208
- Export a native paired run without a judge as a portable directory with original receipts, matching inputs, pinned compiled CLI, checksums and a replay entry point. Export previews by default; missing inputs 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).
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).
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
+
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).
209
242
 
210
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).
211
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
+
212
247
  ```bash
213
248
  node dist/cli.js report eval ./runs/my-run --export ./exports/my-run --json
214
249
  node dist/cli.js report eval ./runs/my-run --export ./exports/my-run --yes --json
@@ -300,7 +335,7 @@ Not affiliated with Anthropic, OpenAI, Moonshot AI, or any agent vendor. Evaluat
300
335
  - [x] Optional `triggerClass` (`explicit`, `implicit`, `contextual`) on positive tasks. Unlabeled tasks stay in the pooled recall.
301
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.
302
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.
303
- - [x] npm publication (`skillfit@0.10.0`), with [verified CLI/OIDC publication and registry installation](docs/releases/0.10.0-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.
304
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.
305
340
  - [ ] Cursor / Gemini CLI / OpenCode adapters
306
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.10.0 --help
69
- npx skillfit@0.10.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
@@ -114,9 +129,15 @@ node dist/cli.js eval skills/skillfit --bench my-bench --agent codex --input wor
114
129
 
115
130
  这是用于教格式的合成案例,不是 Skill 基准。在衡量收益前,把初始文件、任务请求、评分器和参考修复一起替换为你的真实任务。预览会显示计划调用两次,实际一次也不会启动。不传 `--kind`(或用 `--kind output`)仍生成原来的回复评分模板。已有失败可用 `bench add --freeze` 固定,维护者修复可用 `--from-commit` 导入;参见[编写指南](docs/bench-authoring.md)。
116
131
 
117
- Agent 可以用 `bench check --json` 读取带版本的校验标识、任务 ID、位置、失败原因、处理建议和限长的评分器证据。标准输出只有 JSON,退出码区分通过、校验失败和执行错误。这项接口仅做离线校验,拒绝与 `--calibrate` 混用;警告仍需检查。参见 [JSON 契约](docs/bench-check-json.md)。
132
+ Agent 可以用 `bench check --json` 读取带版本的校验标识、任务 ID、位置、失败原因、处理建议和限长的评分器证据。标准输出只有 JSON,退出码区分通过、校验失败和执行错误。不加 `--calibrate` 时,它仍是离线完整性校验,警告仍需检查。0.11.0还支持独立的 `--calibrate --json --dry-run` 计划;JSON 正式执行前必须明确确认计划哈希。参见 [JSON 契约](docs/bench-check-json.md)。
133
+
134
+ 0.11.0支持给校验器和参考解命令的参数加引号,包括含空格的脚本路径。已识别的评分器加载/运行异常及显式基础设施错误消息会阻止离线校验通过,或记为不参与评分的评测错误,同时保留 Agent 成本。正常任务失败和断言失败仍参与评分。详见[校验命令与错误报告](docs/verifier-contract.md)。
135
+
136
+ 0.12.0收紧了 `bench add --freeze`:Git 导入不会回退读取被忽略的文件,非 Git 导入必须用 `--include` 选择,选中的链接或目标 bench 文件会被拒绝。`--decompose` 在唯一一次生成调用前确认,并保留成本和失败记录;参见[生成记录](docs/bench-drafting.md)。每个 case 可用 `verifierTimeoutSeconds` 设置 verifier/oracle 的超时,开跑前校验和离线重放也使用该值;默认仍为 120 秒。
118
137
 
119
- 可以列出和查看 case,再预览编辑或移除操作。加 `--yes` 才会备份并应用通过校验的清单变更;移除会保留 case 文件。重复 `--task` 或在 JSON 请求中设置 `taskIds` 可以只评估部分 case。所选 ID 和顺序会固定到计划中,预算只计算所选 case,小样本仍只作参考。参见 [case 管理](docs/case-management.md)。
138
+ 0.11.0 还会在 eval 和基线校准的预览及开跑前检查 Agent 环境:CLI 文件是否可用、能力是否与矩阵声明匹配,以及全局是否存在同名 Skill。已知失败会在 case 探测或模型调用前拦住;登录状态明确标为离线未知。检查结果随运行封存,报告和重放读取当时记录,不探测当前机器。详见 [Agent 环境自检](docs/eval-agent-preflight.md)。
139
+
140
+ 可以列出和查看 case,再预览编辑或移除操作。加 `--yes` 才会备份并应用通过校验的清单变更;移除会保留 case 文件。配对评估、触发率测试和基线校准都可重复 `--task` 只选择部分 case;配对 JSON 请求用 `taskIds`。所选 ID 和顺序会固定到计划中,预算只计算所选 case,小样本仍只作参考。参见 [case 管理](docs/case-management.md)。
120
141
 
121
142
  ```bash
122
143
  node dist/cli.js bench list my-bench --json
@@ -162,6 +183,10 @@ node dist/cli.js eval ./skill-new --baseline-skill ./skill-old --mode installed
162
183
 
163
184
  0.10.0 已包含可选 `spendingBudget`,设置五项整批预算停止线。触线或缺失完整最终用量时停止后续调用并保留花费;正在运行的一次仍可能越线。详见[预算检查契约](docs/eval-component.md#input-and-execution)。
164
185
 
186
+ 0.11.0统一了普通配对/触发率 eval 和配对 Agent 请求的计划生成。普通 eval 也支持 `--json`、`--spending-budget <file>`、`--executor-timeout-seconds`、`--runs-root` 和 `--run-group`,配对实验另可设置 `--pair-order`;JSON 执行必须确认预览指纹。请求可用 `baselineSkill: null` 表示 baseline 不由 harness 安装 Skill,与普通 installed eval 省略 `--baseline-skill` 对应。这能测量安装收益,但不能授权采用某个修订版本。详见[统一设置与确认流程](docs/eval-planning.md)。
187
+
188
+ 0.11.0 还为基线校准和触发率测试提供 JSON 预览、固定任务选择、调用/消耗上限及每次调用的超时。预览不执行评分器、参考解或 Agent;case 或环境硬失败会阻止正式开跑。JSON 执行必须指定新的批次名,并提交准确的预览哈希(校准用 `plan.planSha256`,eval 用 `plan.sha256`)。校准测基线难度,触发率测试测发现能力,两者都不能证明配对的 Skill 收益或授权采用。
189
+
165
190
  失败的 Codex JSON 调用可从本地数值计数器保留身份匹配的部分用量。导出不包含私有会话正文;部分用量仍不能满足最终成本覆盖或采用门槛。
166
191
 
167
192
  ```bash
@@ -200,12 +225,22 @@ node dist/cli.js report eval docs/examples/eval-manifest.synthetic.json
200
225
 
201
226
  0.10.1 中,普通报告和 JSON 都接受同样的 manifest、原生运行目录或复现包,包括中止和未完成批次。两者都会核查已存证据,并把采用决定与质量判定分开解释。`--replay`、`--records` 和 `--policy` 两种格式都能用;成功生成报告不代表获准升级。参见[报告输入和状态](docs/evaluation-reports.md)。
202
227
 
228
+ 0.11.0还支持用两种格式读取校准目录/`_calibration.json` 和触发率 manifest。已完成的校准保持完成状态,展示基线难度;触发率报告展示召回率、误触发率、精确率、F1 和检测覆盖情况。新封存的单组运行支持原生证据审计、离线交付结果重放和便携导出;独立的历史摘要仍未验证。这两种报告不能授权采用,也不能使用配对采用策略选项。参见[报告类型](docs/evaluation-reports.md#calibration-and-trigger-reports-source-after-npm-0101)。
229
+
203
230
  新报告分别列出缓存输入、未缓存输入、输出和耗时,并把失败运行的消耗计入每次成功任务的成本。报告同时展示存活配对和全部 agent 调用;超时导致的用量不完整或缺失会单独标记,不会当作零。Chat completions API 明确返回的缓存输入计数(包括零)会被保留;缺失或非法值仍记为未知。旧 manifest 会显示这些字段未记录。详见[成本统计](docs/eval-costs.md)。
204
231
 
205
- 没有 judge 的原生配对实验可导出为独立目录,包含原始记录、匹配的输入、当时的编译版 CLI、校验清单和重放入口。默认只预览;缺输入或目标目录已存在就停止。整个目录可搬到另一台机器,重放不调用模型,保留中止状态和未知成本,也不能授权升级。分享前检查项目数据,参见[可搬走的复现包](docs/replay-packages.md)。
232
+ 0.11.0用 `invocationCosts` 分别记录 Agent、裁判和合计消耗,保留失败、部分和未知用量。可选裁判的消耗计入同一批次停线;显式启用 API 裁判却缺少凭据会报错,不会静默关闭。历史缺失的裁判记录仍标未知。参见[成本统计](docs/eval-costs.md)。
233
+
234
+ 0.12.0也会读取普通 Codex 评测和 CLI 裁判的 JSON 用量,不再要求启用触发检测。离线 `USAGE_CAPABILITY` 检查会在花费前拒绝已知缺少必要计数的 Agent/裁判严格预算组合。API/注入执行器的覆盖情况仍标未知,需要运行时检查;缺失成本不会补成零。
235
+
236
+ 这份源码也会在 API 回答格式或 HTTP 状态异常时保留接口已报告的用量。可用计数与原始响应一起保存;缺失字段仍标未知。调用仍属于执行异常并停止后续调用,不会因此丢掉已有成本证据。
237
+
238
+ 同一份源码可把受支持且已封存的原生配对、校准和触发率实验(包括带有新裁判记录的配对实验)导出为独立目录,包含原始记录、匹配的输入、当时的编译版 CLI、校验清单和重放入口。默认只预览;缺输入、缺少必需的调用记录/原始运行时支持或目标目录已存在就停止。整个目录可搬到另一台机器,重放不调用模型,保留中止状态和未知成本,也不能授权升级。分享前检查项目数据,参见[可搬走的复现包](docs/replay-packages.md)。
206
239
 
207
240
  0.10.1 会在调用前封存输入副本:原始 Skill、bench 或请求之后被修改、删除,也不影响导出和重放。计划会记录快照校验信息、本地复制耗时和存储量;已声明的快照损坏就拒绝使用。历史记录仍需找回匹配的原始输入。参见[评测输入封存](docs/evaluation-input-snapshots.md)。
208
241
 
242
+ 0.12.0支持把 bench 放在 Git 仓库根目录:指纹和快照统一排除 Git 元数据。预览会拦住位于 bench、Skill/配置输入、编译运行时或 Git 元数据内部的输出,目录别名也不能绕过。输入与结果应放在同级目录,例如 `--bench ./my-bench --runs-root ./runs`。
243
+
209
244
  ```bash
210
245
  node dist/cli.js report eval ./runs/my-run --export ./exports/my-run --json
211
246
  node dist/cli.js report eval ./runs/my-run --export ./exports/my-run --yes --json
@@ -297,7 +332,7 @@ node ./personal-codex/setup.mjs --yes
297
332
  - [x] 正例任务可选 `triggerClass`(`explicit`、`implicit`、`contextual`)。没标类别的任务仍只进汇总召回率。
298
333
  - [x] `--compete-installed` 把其他用户级 Skill 复制进 trigger 试验。矩阵目录之外的系统 Skill 和插件不会被复制。`installed` 把「读了长正文」和任务结果分开报告;这次读取不是 trigger 召回率。
299
334
  - [ ] 安装建议。2026 年 7 月的 8 个 Skill 实验没有可靠的任务质量增益。67 个 Skill 目录和 13 个入门套装都没有作为一组被评过。
300
- - [x] 已发布到 npm(`skillfit@0.10.0`),并通过 [CLI/OIDC 发布与注册表安装验收](docs/releases/0.10.0-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` 仍然可用。
301
336
  - [x] 社区 bench 与 evidence 提交。bench 放在 `benches/contrib`;证据用 Evidence submission issue 模板。CI 只跑离线检查,不调用 agent。
302
337
  - [ ] Cursor / Gemini CLI / OpenCode 适配器
303
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 split on whitespace and 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). 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
- - **Exit code 0 = pass, anything else = fail.** That is the only pass/fail signal the harness aggregates.
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
@@ -1,14 +1,19 @@
1
1
  #!/usr/bin/env node
2
2
  import { parseArgs } from 'node:util';
3
- import { runBenchAdd, runBenchCheck, runBenchInit } from './commands/bench.js';
3
+ import { resolve } from 'node:path';
4
+ import { runBenchAdd, runBenchCheck, runBenchInit, prepareBenchCalibration, runBenchCalibration } from './commands/bench.js';
4
5
  import { benchCheckError, benchCheckJson } from './commands/bench-check-report.js';
5
6
  import { inspectBench, manageBench } from './commands/bench-manage.js';
6
7
  import { exportEvaluation } from './commands/eval-export.js';
7
8
  import { runBundleExport } from './commands/bundle.js';
8
9
  import { runDoctor } from './commands/doctor.js';
9
- import { DEFAULT_EVAL_TRIALS, runEval } from './commands/eval.js';
10
+ import { DEFAULT_EVAL_TRIALS } from './commands/eval.js';
11
+ import { runEvalCli } from './commands/eval-cli.js';
12
+ import { readComponentJson } from './harness/eval-contract.js';
13
+ import { parseSpendingBudget } from './harness/eval-budget.js';
10
14
  import { runEvalReport } from './commands/eval-report.js';
11
- import { componentError, reportEvalComponent, runEvalComponent } from './commands/eval-component.js';
15
+ import { componentError, runEvalComponent } from './commands/eval-component.js';
16
+ import { readEvaluationReport } from './commands/evaluation-report.js';
12
17
  import { runInstall } from './commands/install.js';
13
18
  import { runMcpCheck } from './commands/mcp.js';
14
19
  import { runReport } from './commands/report.js';
@@ -19,20 +24,20 @@ const USAGE = `skillfit ${VERSION} — evidence-driven configuration for AI codi
19
24
  Usage:
20
25
  skillfit doctor [--agent <id>] Inspect current agent configuration health
21
26
  skillfit report [--agent <id>] [--json] Skill usage receipts from local session history (read-only)
22
- skillfit report eval <manifest-or-run-dir> Assess saved evidence as Markdown (read-only)
23
- skillfit report eval <manifest-or-run-dir> --json [--replay] Assess saved evidence for an Agent
27
+ skillfit report eval <summary-or-run-dir> Read paired, calibration or trigger reports (read-only)
28
+ skillfit report eval <summary-or-run-dir> --json Return a typed saved-evidence report for an Agent
24
29
  skillfit report eval <run-dir> --export <new-dir> Plan a portable offline replay package
25
30
  skillfit eval --request <request.json> --dry-run Return a pinned JSON plan without calls
26
31
  skillfit eval --request <request.json> --plan-sha <sha256> Run that plan and return JSON evidence
27
32
  skillfit eval <target-path> [options] A/B-test a Skill, rules, or MCP setup against a bench
28
33
  skillfit mcp check <spec.json> Handshake with a stdio or Streamable HTTP MCP server and audit its tool catalog
29
34
  skillfit bench init [dir] [--kind output|command] Scaffold a text-output or code-editing case
30
- skillfit bench check [dir] [--json] Validate a bench offline (verifier self-tests, hygiene)
31
- 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)
32
37
  skillfit bench add <dir> --freeze ... Freeze a real failure into a bench task (see below)
33
38
  skillfit bench add <dir> --from-commit <sha> Mine a fix commit (parent = fixture, fix's tests = verifier)
34
- skillfit bench list <dir> [--json] List registered cases without running verifiers
35
- 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
36
41
  skillfit bench edit <dir> <task-id> --set <field=value> Plan a manifest edit (apply with --yes)
37
42
  skillfit bench remove <dir> <task-id> Plan to unregister a case, preserving its files
38
43
  skillfit install [options] Inspect or apply a managed configuration profile
@@ -41,23 +46,28 @@ Usage:
41
46
 
42
47
  Options:
43
48
  --agent <id> Target agent: claude-code | codex | kimi-code (default: all detected)
44
- --judge-agent <id> Drive the blind judge with a local agent CLI (inject mode; prefer a different family than --agent)
49
+ --judge-agent <id> Drive a paired eval's blind judge (prefer a different family than --agent)
45
50
  --mode <mode> Eval mode: inject (default) | installed (paired complete Skill) | trigger (single arm)
46
51
  --baseline-skill <path> With --mode installed, compare a previous Skill version against the target
47
52
  --request <path> Version 1 Skill revision request (JSON output; excludes positional eval options)
48
- --plan-sha <hash> Confirm the current --request dry-run plan before real calls
49
- --json Machine output for bench check/list/show/edit/remove, report, and request-based eval
50
- --policy <path> With report eval, assess against a policy (post-hoc changes cannot authorize adoption)
51
- --records <dir> With report eval, use native evidence from this run directory
52
- --replay With report eval, regrade cloned deliveries using the frozen bench
53
+ --plan-sha <hash> Confirm an eval/calibration dry-run plan (also needs --run-group)
54
+ --json Machine output for bench check/list/show/edit/remove, report, eval and calibration
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
+ --pair-order <order> Paired eval: baseline-first (default) | balanced
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
+ --policy <path> With paired report eval, assess against a policy (post-hoc changes cannot authorize adoption)
61
+ --records <dir> With paired report eval, use native evidence from this run directory
62
+ --replay With report eval, audit receipts and regrade cloned deliveries; never call a model
53
63
  --export <dir> With report eval, plan a portable package; --yes writes a fresh destination
54
64
  --input-root <label=path> With --export, recover pinned inputs from a matching copy (repeatable)
55
65
  --compete-installed With --mode trigger, copy other user-level Skills into each trial so recall is not an upper bound
56
66
  --input <mode> Paired eval or baseline calibration: snapshot (default) | workspace (CLI only)
57
67
  --bench <path> Bench directory for eval (default: bundled benches)
58
- --task <id> With eval, select cases (repeatable, manifest order); requests use taskIds
68
+ --task <id> With eval/calibration, select cases (repeatable, manifest order); requests use taskIds
59
69
  --trials <n> Repetitions per condition for eval (integer 1–20; default: ${DEFAULT_EVAL_TRIALS})
60
- --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
61
71
  Also controls baseline calibration repetitions
62
72
  --profile <name> Profile for install (default: "recommended")
63
73
  --profile-path <dir> Install a portable profile from a local directory
@@ -80,9 +90,9 @@ bench init options:
80
90
  --kind <kind> output (default, grades a reply) | command (grades file edits)
81
91
 
82
92
  bench edit options:
83
- --set <field=value> Change fixture, prompt, promptTrigger, verifier, verifierKind,
93
+ --set <field=value> Change fixture, prompt, promptTrigger, verifier, verifierKind, verifierTimeoutSeconds,
84
94
  oracle, rubric or shouldTrigger (repeatable)
85
- --unset <field> Remove promptTrigger, oracle, rubric or shouldTrigger (repeatable)
95
+ --unset <field> Remove promptTrigger, verifierTimeoutSeconds, oracle, rubric or shouldTrigger (repeatable)
86
96
  Edits/removals default to a plan; --yes backs up bench.json and applies
87
97
 
88
98
  bench add --freeze options:
@@ -93,7 +103,9 @@ bench add --freeze options:
93
103
  --decompose Draft verifier.mjs + oracle.mjs with an agent (--agent <id>), gated by NOP + oracle checks
94
104
  --verifier-kind <k> With --decompose: output (default, grades _output.md) | command (grades file state)
95
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)
96
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)
97
109
  --should-trigger <yes|no> Label for trigger-mode evaluation
98
110
 
99
111
  bench add --from-commit options:
@@ -112,6 +124,11 @@ const CLI_OPTIONS = {
112
124
  'baseline-skill': { type: 'string' },
113
125
  request: { type: 'string' },
114
126
  'plan-sha': { type: 'string' },
127
+ 'spending-budget': { type: 'string' },
128
+ 'executor-timeout-seconds': { type: 'string' },
129
+ 'pair-order': { type: 'string' },
130
+ 'runs-root': { type: 'string' },
131
+ 'run-group': { type: 'string' },
115
132
  policy: { type: 'string' },
116
133
  records: { type: 'string' },
117
134
  replay: { type: 'boolean', default: false },
@@ -145,6 +162,7 @@ const CLI_OPTIONS = {
145
162
  oracle: { type: 'string' },
146
163
  decompose: { type: 'boolean', default: false },
147
164
  'verifier-kind': { type: 'string' },
165
+ 'verifier-timeout-seconds': { type: 'string' },
148
166
  kind: { type: 'string' },
149
167
  'should-trigger': { type: 'string' },
150
168
  calibrate: { type: 'boolean', default: false },
@@ -192,14 +210,15 @@ async function main() {
192
210
  console.log(USAGE);
193
211
  return;
194
212
  }
213
+ const calibrationCommand = command === 'bench' && positionals[1] === 'check' && values.calibrate;
195
214
  if (values['baseline-skill'] !== undefined && command !== 'eval') {
196
215
  throw new Error('--baseline-skill applies only to eval --mode installed.');
197
216
  }
198
217
  if (values.kind !== undefined && !(command === 'bench' && positionals[1] === 'init')) {
199
218
  throw new Error('--kind applies only to bench init.');
200
219
  }
201
- if (values.task !== undefined && command !== 'eval' && !(command === 'bench' && positionals[1] === 'add')) {
202
- throw new Error('--task applies only to eval or bench add.');
220
+ if (values.task !== undefined && command !== 'eval' && !calibrationCommand && !(command === 'bench' && positionals[1] === 'add')) {
221
+ throw new Error('--task applies only to eval, calibration or bench add.');
203
222
  }
204
223
  if ((values.set || values.unset) && !(command === 'bench' && positionals[1] === 'edit'))
205
224
  throw new Error('--set and --unset apply only to bench edit.');
@@ -213,8 +232,21 @@ async function main() {
213
232
  throw new Error('bench add requires exactly one --task.');
214
233
  if (values.request !== undefined && command !== 'eval')
215
234
  throw new Error('--request applies only to eval.');
216
- if (values['plan-sha'] !== undefined && (command !== 'eval' || values.request === undefined || values['dry-run']))
217
- throw new Error('--plan-sha requires a non-dry-run eval --request.');
235
+ if (values['plan-sha'] !== undefined && ((command !== 'eval' && !calibrationCommand) || values['dry-run']))
236
+ throw new Error('--plan-sha requires a non-dry-run eval or calibration.');
237
+ const evalSettings = ['spending-budget', 'executor-timeout-seconds', 'pair-order', 'runs-root', 'run-group'];
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)
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>.');
245
+ if (calibrationCommand && (values.mode !== undefined || values['judge-agent'] !== undefined || values['baseline-skill'] !== undefined || values['compete-installed'] || values.bench !== undefined)) {
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.');
247
+ }
248
+ if (values['runs-root'] !== undefined && (!values['runs-root'].trim() || values['runs-root'].includes('\0')))
249
+ throw new Error('--runs-root must be a non-empty path.');
218
250
  if ((values.policy !== undefined || values.records !== undefined || values.replay) && !(command === 'report' && positionals[1] === 'eval')) {
219
251
  throw new Error('--policy, --records and --replay require report eval.');
220
252
  }
@@ -235,8 +267,8 @@ async function main() {
235
267
  const maxCalls = values['max-calls'] === undefined ? undefined : Number(values['max-calls']);
236
268
  if (maxCalls !== undefined && (!Number.isSafeInteger(maxCalls) || maxCalls < 1))
237
269
  throw new Error('--max-calls must be a positive safe integer.');
238
- if (maxCalls !== undefined && command !== 'eval' && !(command === 'bench' && positionals[1] === 'check' && values.calibrate)) {
239
- 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.');
240
272
  }
241
273
  if (trials !== undefined && (!Number.isInteger(trials) || trials < 1 || trials > 20)) {
242
274
  throw new Error(`--trials must be an integer between 1 and 20, got ${JSON.stringify(values.trials)}`);
@@ -249,8 +281,8 @@ async function main() {
249
281
  if (positionals[1] === 'eval') {
250
282
  if (!positionals[2]) {
251
283
  if (values.json)
252
- throw new Error('report eval --json requires a manifest or native run directory.');
253
- console.error('Usage: skillfit report eval <manifest-or-run-dir>');
284
+ throw new Error('report eval --json requires a saved summary or native run directory.');
285
+ console.error('Usage: skillfit report eval <summary-or-run-dir>');
254
286
  process.exitCode = 2;
255
287
  return;
256
288
  }
@@ -262,7 +294,7 @@ async function main() {
262
294
  return;
263
295
  }
264
296
  if (values.json)
265
- console.log(JSON.stringify(await reportEvalComponent(positionals[2], {
297
+ console.log(JSON.stringify(await readEvaluationReport(positionals[2], {
266
298
  policyPath: values.policy, recordsPath: values.records, replay: values.replay, benchDir: values.bench,
267
299
  }), null, 2));
268
300
  else
@@ -275,7 +307,7 @@ async function main() {
275
307
  return;
276
308
  case 'eval': {
277
309
  if (values.request !== undefined) {
278
- if (positionals.length !== 1 || ['agent', 'mode', 'baseline-skill', 'bench', 'task', 'trials', 'max-calls', 'input', 'judge-agent'].some(key => values[key] !== undefined) || values['compete-installed']) {
310
+ if (positionals.length !== 1 || ['agent', 'mode', 'baseline-skill', 'bench', 'task', 'trials', 'max-calls', 'input', 'judge-agent', ...evalSettings].some(key => values[key] !== undefined) || values['compete-installed']) {
279
311
  throw new Error('--request cannot be combined with a target or positional eval settings; put settings in the request.');
280
312
  }
281
313
  const result = await runEvalComponent(values.request, { dryRun: values['dry-run'], expectedPlanSha256: values['plan-sha'], log: line => console.error(line) });
@@ -284,33 +316,57 @@ async function main() {
284
316
  process.exitCode = failureExitCode(2);
285
317
  return;
286
318
  }
287
- if (values.json)
288
- throw new Error('eval --json requires --request.');
319
+ if (values['plan-sha'] !== undefined && !values['run-group'])
320
+ throw new Error('Positional eval --plan-sha requires --run-group from the dry-run plan.');
321
+ if (values.json && !values['dry-run'] && values['plan-sha'] === undefined)
322
+ throw new Error('JSON eval execution requires --plan-sha from a dry-run and --run-group; no calls started.');
289
323
  const skillPath = positionals[1];
290
324
  if (!skillPath) {
325
+ if (values.json)
326
+ throw new Error('Usage: skillfit eval <target-path> [options]');
291
327
  console.error('Usage: skillfit eval <target-path> [--bench <path>] [--trials <n>] [--agent <id>] [--mode <mode>]');
292
328
  process.exitCode = 2;
293
329
  return;
294
330
  }
295
331
  const mode = values.mode ?? 'inject';
296
332
  if (mode !== 'inject' && mode !== 'installed' && mode !== 'trigger') {
333
+ if (values.json)
334
+ throw new Error(`Unknown --mode: ${mode} (expected "inject", "installed" or "trigger")`);
297
335
  console.error(`Unknown --mode: ${mode} (expected "inject", "installed" or "trigger")`);
298
336
  process.exitCode = 2;
299
337
  return;
300
338
  }
301
- await runEval({
339
+ if (values['runs-root'] !== undefined && (!values['runs-root'].trim() || values['runs-root'].includes('\0')))
340
+ throw new Error('--runs-root must be a non-empty path.');
341
+ const spendingBudget = values['spending-budget'] === undefined ? undefined : parseSpendingBudget(readComponentJson(resolve(values['spending-budget'])).value);
342
+ const options = {
302
343
  ...common,
303
344
  skillPath,
304
345
  baselineSkillPath: values['baseline-skill'],
305
346
  bench: values.bench,
306
347
  taskIds: values.task,
307
- mode,
348
+ mode: mode,
308
349
  inputMode,
309
350
  judgeAgent: values['judge-agent'],
310
351
  competeInstalled: values['compete-installed'],
311
352
  maxCalls,
312
353
  trials,
313
- });
354
+ spendingBudget,
355
+ executorTimeoutSeconds: values['executor-timeout-seconds'] === undefined ? undefined : Number(values['executor-timeout-seconds']),
356
+ pairOrder: values['pair-order'],
357
+ runsRoot: values['runs-root'] === undefined ? undefined : resolve(values['runs-root']),
358
+ runGroup: values['run-group'],
359
+ log: values.json ? (line) => console.error(line) : (line) => console.log(line),
360
+ };
361
+ {
362
+ const result = await runEvalCli(options, values['plan-sha']);
363
+ if (values.json)
364
+ console.log(JSON.stringify(result, null, 2));
365
+ else if ('executionError' in result)
366
+ console.error(result.executionError);
367
+ if (result.status === 'stopped')
368
+ process.exitCode = failureExitCode(2);
369
+ }
314
370
  return;
315
371
  }
316
372
  case 'mcp': {
@@ -395,8 +451,57 @@ async function main() {
395
451
  return;
396
452
  }
397
453
  if (subcommand === 'check') {
398
- if (values.json && values.calibrate)
399
- throw new Error('bench check --json is offline only; --calibrate cannot be combined with --json.');
454
+ if (values.calibrate) {
455
+ if (values['plan-sha'] !== undefined && !values['run-group'])
456
+ throw new Error('Calibration --plan-sha requires --run-group from the preview.');
457
+ if (values.json && !values['dry-run'] && !values['plan-sha'])
458
+ throw new Error('JSON calibration execution requires --plan-sha and --run-group; no calls started.');
459
+ const calibrate = { agent: values.agent, inputMode: inputMode, maxCalls, trials,
460
+ dryRun: values['dry-run'] ?? false,
461
+ runsRoot: values['runs-root'] === undefined ? undefined : resolve(values['runs-root']),
462
+ runGroup: values['run-group'],
463
+ executorTimeoutSeconds: values['executor-timeout-seconds'] === undefined ? undefined : Number(values['executor-timeout-seconds']),
464
+ spendingBudget: values['spending-budget'] === undefined ? undefined : parseSpendingBudget(readComponentJson(resolve(values['spending-budget'])).value),
465
+ reviewedPlanSha256: values['plan-sha'] };
466
+ const plan = prepareBenchCalibration({ dir: positionals[2], taskIds: values.task, calibrate });
467
+ if (values['dry-run']) {
468
+ if (values.json)
469
+ console.log(JSON.stringify({ schemaVersion: 1, kind: 'skillfit.calibration-result', status: 'planned', plan,
470
+ acceptance: { decision: 'inconclusive', eligibleForUpgrade: false, automaticUpgrade: false } }, null, 2));
471
+ else {
472
+ console.log(`calibration executor: ${plan.executor?.detail ?? plan.executor?.model ?? 'unresolved'}`);
473
+ console.log(`calibration plan: ${plan.bench.taskIds.length} task(s) × ${plan.trials} baseline run(s), input ${plan.inputMode}; ${plan.plannedCalls} calls, ceiling ${plan.maxCalls}`);
474
+ console.log(`Agent environment: ${plan.agentPreflight.status}; login remains offline unknown`);
475
+ console.log(`Executor deadline: ${plan.executorTimeoutSeconds}s; output ${plan.outputDir}`);
476
+ if (plan.spendingBudget)
477
+ console.log(`Spending stop lines: ${JSON.stringify(plan.spendingBudget)}`);
478
+ console.log(`Plan SHA: ${plan.planSha256}`);
479
+ console.log('Dry run: no verifier, oracle or agent started; nothing written.');
480
+ }
481
+ return;
482
+ }
483
+ try {
484
+ const report = await runBenchCalibration({ dir: positionals[2], taskIds: values.task,
485
+ log: values.json ? line => console.error(line) : undefined,
486
+ calibrate: { ...calibrate, runsRoot: plan.runsRoot, runGroup: plan.runGroup, reviewedPlanSha256: plan.planSha256 } });
487
+ if (values.json)
488
+ console.log(JSON.stringify(await readEvaluationReport(plan.outputDir), null, 2));
489
+ if (report.failures > 0)
490
+ process.exitCode = failureExitCode(1);
491
+ }
492
+ catch (error) {
493
+ const { existsSync } = await import('node:fs');
494
+ if (!existsSync(resolve(plan.outputDir, '_plan.json')))
495
+ throw error;
496
+ const report = await readEvaluationReport(plan.outputDir);
497
+ if (values.json)
498
+ console.log(JSON.stringify({ ...report, executionError: error instanceof Error ? error.message : String(error) }, null, 2));
499
+ else
500
+ console.error(error instanceof Error ? error.message : String(error));
501
+ process.exitCode = failureExitCode(2);
502
+ }
503
+ return;
504
+ }
400
505
  const report = await runBenchCheck({
401
506
  dir: positionals[2],
402
507
  log: values.json ? () => { } : undefined,
@@ -444,6 +549,12 @@ async function main() {
444
549
  oracle: values.oracle,
445
550
  decompose: values.decompose ?? false,
446
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']),
447
558
  shouldTrigger: shouldTrigger === undefined ? undefined : shouldTrigger === 'yes',
448
559
  });
449
560
  return;
@@ -460,6 +571,11 @@ async function main() {
460
571
  }
461
572
  main().catch((err) => {
462
573
  const benchCommand = jsonBenchCommand();
574
+ if (benchCommand === 'check' && process.argv.includes('--calibrate')) {
575
+ console.log(JSON.stringify(componentError(err), null, 2));
576
+ process.exitCode = failureExitCode(2);
577
+ return;
578
+ }
463
579
  if (benchCommand === 'check') {
464
580
  console.log(JSON.stringify(benchCheckError(err), null, 2));
465
581
  process.exitCode = failureExitCode(2);
@@ -472,7 +588,7 @@ main().catch((err) => {
472
588
  return;
473
589
  }
474
590
  if (process.argv.some(arg => arg === '--request' || arg.startsWith('--request=')) ||
475
- (process.argv.includes('--json') && process.argv.includes('report') && process.argv.includes('eval'))) {
591
+ (process.argv.some(arg => arg === '--json' || arg.startsWith('--json=')) && process.argv.includes('eval'))) {
476
592
  console.log(JSON.stringify(componentError(err), null, 2));
477
593
  process.exitCode = failureExitCode(2);
478
594
  return;