skillfit 0.0.0-stage → 0.8.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 (371) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +226 -2
  3. package/README.zh-CN.md +224 -0
  4. package/benches/README.md +172 -0
  5. package/benches/code-review/bench.json +57 -0
  6. package/benches/code-review/fixtures/explain-x1/.skillfit-mock.json +10 -0
  7. package/benches/code-review/fixtures/explain-x1/SPEC.md +16 -0
  8. package/benches/code-review/fixtures/explain-x1/src/compact.js +18 -0
  9. package/benches/code-review/fixtures/explain-x1/tests/compact.test.js +18 -0
  10. package/benches/code-review/fixtures/review-r1/.skillfit-mock.json +10 -0
  11. package/benches/code-review/fixtures/review-r1/CHANGES.diff +42 -0
  12. package/benches/code-review/fixtures/review-r1/SPEC.md +16 -0
  13. package/benches/code-review/fixtures/review-r1/src/errors.js +7 -0
  14. package/benches/code-review/fixtures/review-r1/src/money.js +3 -0
  15. package/benches/code-review/fixtures/review-r1/src/order.js +13 -0
  16. package/benches/code-review/fixtures/review-r1/tests/order.test.js +17 -0
  17. package/benches/code-review/fixtures/review-r2/.skillfit-mock.json +10 -0
  18. package/benches/code-review/fixtures/review-r2/CHANGES.diff +81 -0
  19. package/benches/code-review/fixtures/review-r2/SPEC.md +25 -0
  20. package/benches/code-review/fixtures/review-r2/src/errors.js +7 -0
  21. package/benches/code-review/fixtures/review-r2/src/invoice.js +9 -0
  22. package/benches/code-review/fixtures/review-r2/src/money.js +3 -0
  23. package/benches/code-review/fixtures/review-r2/tests/invoice.test.js +13 -0
  24. package/benches/code-review/fixtures/review-r3/.skillfit-mock.json +10 -0
  25. package/benches/code-review/fixtures/review-r3/CHANGES.diff +76 -0
  26. package/benches/code-review/fixtures/review-r3/SPEC.md +24 -0
  27. package/benches/code-review/fixtures/review-r3/src/errors.js +7 -0
  28. package/benches/code-review/fixtures/review-r3/src/money.js +3 -0
  29. package/benches/code-review/fixtures/review-r3/src/pricing.js +20 -0
  30. package/benches/code-review/fixtures/review-r3/tests/pricing.test.js +15 -0
  31. package/benches/code-review/fixtures/summarize-s1/.skillfit-mock.json +16 -0
  32. package/benches/code-review/fixtures/summarize-s1/CHANGES.diff +27 -0
  33. package/benches/code-review/fixtures/summarize-s1/SPEC.md +15 -0
  34. package/benches/code-review/fixtures/summarize-s1/src/discount.js +20 -0
  35. package/benches/code-review/fixtures/summarize-s1/src/errors.js +7 -0
  36. package/benches/code-review/fixtures/summarize-s1/src/money.js +7 -0
  37. package/benches/code-review/ground-truth/oracle-r1.mjs +21 -0
  38. package/benches/code-review/ground-truth/oracle-r2.mjs +21 -0
  39. package/benches/code-review/ground-truth/oracle-r3.mjs +20 -0
  40. package/benches/code-review/ground-truth/oracle-summarize-s1.mjs +21 -0
  41. package/benches/code-review/ground-truth/oracle-x1.mjs +18 -0
  42. package/benches/code-review/ground-truth/r1.md +22 -0
  43. package/benches/code-review/ground-truth/r2.md +21 -0
  44. package/benches/code-review/ground-truth/r3.md +18 -0
  45. package/benches/code-review/ground-truth/summarize-s1.md +26 -0
  46. package/benches/code-review/ground-truth/x1.md +7 -0
  47. package/benches/code-review/prompts/explain-x1.md +5 -0
  48. package/benches/code-review/prompts/explain-x1.trigger.md +5 -0
  49. package/benches/code-review/prompts/review-r1.md +7 -0
  50. package/benches/code-review/prompts/review-r1.trigger.md +7 -0
  51. package/benches/code-review/prompts/review-r2.md +7 -0
  52. package/benches/code-review/prompts/review-r2.trigger.md +7 -0
  53. package/benches/code-review/prompts/review-r3.md +7 -0
  54. package/benches/code-review/prompts/review-r3.trigger.md +7 -0
  55. package/benches/code-review/prompts/summarize-s1.md +9 -0
  56. package/benches/code-review/prompts/summarize-s1.trigger.md +9 -0
  57. package/benches/code-review/verifiers/explain-x1.mjs +30 -0
  58. package/benches/code-review/verifiers/review-r2.mjs +66 -0
  59. package/benches/code-review/verifiers/review-r3.mjs +60 -0
  60. package/benches/code-review/verifiers/seeded-bugs.mjs +74 -0
  61. package/benches/code-review/verifiers/summarize-s1.mjs +80 -0
  62. package/benches/contrib/README.md +42 -0
  63. package/benches/contrib/oss-lru-cache/README.md +24 -0
  64. package/benches/contrib/oss-lru-cache/bench.json +37 -0
  65. package/benches/contrib/oss-lru-cache/fixtures/fetch-abort/LICENSE +15 -0
  66. package/benches/contrib/oss-lru-cache/fixtures/fetch-abort/README.md +3 -0
  67. package/benches/contrib/oss-lru-cache/fixtures/fetch-abort/index.js +1044 -0
  68. package/benches/contrib/oss-lru-cache/fixtures/fetch-abort/package.json +11 -0
  69. package/benches/contrib/oss-lru-cache/fixtures/fetch-abort/runtime.mjs +22 -0
  70. package/benches/contrib/oss-lru-cache/fixtures/fetch-abort/test.mjs +11 -0
  71. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/LICENSE.md +55 -0
  72. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/README.md +3 -0
  73. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/package.json +11 -0
  74. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/runtime.mjs +22 -0
  75. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/src/diagnostics-channel-browser.ts +11 -0
  76. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/src/diagnostics-channel-cjs.cts +11 -0
  77. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/src/diagnostics-channel-esm.mts +29 -0
  78. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/src/diagnostics-channel-node.ts +7 -0
  79. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/src/diagnostics-channel.ts +6 -0
  80. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/src/index.ts +3148 -0
  81. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/src/perf.ts +17 -0
  82. package/benches/contrib/oss-lru-cache/fixtures/fetch-lifecycle/test.mjs +11 -0
  83. package/benches/contrib/oss-lru-cache/fixtures/fetch-size/LICENSE +15 -0
  84. package/benches/contrib/oss-lru-cache/fixtures/fetch-size/README.md +3 -0
  85. package/benches/contrib/oss-lru-cache/fixtures/fetch-size/index.js +1028 -0
  86. package/benches/contrib/oss-lru-cache/fixtures/fetch-size/package.json +11 -0
  87. package/benches/contrib/oss-lru-cache/fixtures/fetch-size/runtime.mjs +22 -0
  88. package/benches/contrib/oss-lru-cache/fixtures/fetch-size/test.mjs +11 -0
  89. package/benches/contrib/oss-lru-cache/ground-truth/fetch-abort/LICENSE +15 -0
  90. package/benches/contrib/oss-lru-cache/ground-truth/fetch-abort/index.js +1053 -0
  91. package/benches/contrib/oss-lru-cache/ground-truth/fetch-abort.md +11 -0
  92. package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/LICENSE.md +55 -0
  93. package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/src/diagnostics-channel-browser.ts +11 -0
  94. package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/src/diagnostics-channel-cjs.cts +11 -0
  95. package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/src/diagnostics-channel-esm.mts +29 -0
  96. package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/src/diagnostics-channel-node.ts +7 -0
  97. package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/src/diagnostics-channel.ts +6 -0
  98. package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/src/index.ts +3174 -0
  99. package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle/src/perf.ts +17 -0
  100. package/benches/contrib/oss-lru-cache/ground-truth/fetch-lifecycle.md +11 -0
  101. package/benches/contrib/oss-lru-cache/ground-truth/fetch-size/LICENSE +15 -0
  102. package/benches/contrib/oss-lru-cache/ground-truth/fetch-size/index.js +1028 -0
  103. package/benches/contrib/oss-lru-cache/ground-truth/fetch-size.md +11 -0
  104. package/benches/contrib/oss-lru-cache/ground-truth/oracle-fetch-abort.mjs +8 -0
  105. package/benches/contrib/oss-lru-cache/ground-truth/oracle-fetch-lifecycle.mjs +7 -0
  106. package/benches/contrib/oss-lru-cache/ground-truth/oracle-fetch-size.mjs +7 -0
  107. package/benches/contrib/oss-lru-cache/ground-truth/oracle.mjs +9 -0
  108. package/benches/contrib/oss-lru-cache/prompts/fetch-abort.md +5 -0
  109. package/benches/contrib/oss-lru-cache/prompts/fetch-lifecycle.md +5 -0
  110. package/benches/contrib/oss-lru-cache/prompts/fetch-size.md +5 -0
  111. package/benches/contrib/oss-lru-cache/provenance.json +62 -0
  112. package/benches/contrib/oss-lru-cache/runtime.mjs +22 -0
  113. package/benches/contrib/oss-lru-cache/verifiers/cases.mjs +74 -0
  114. package/benches/contrib/oss-lru-cache/verifiers/fetch-abort.mjs +3 -0
  115. package/benches/contrib/oss-lru-cache/verifiers/fetch-lifecycle.mjs +3 -0
  116. package/benches/contrib/oss-lru-cache/verifiers/fetch-size.mjs +3 -0
  117. package/benches/contrib/oss-lru-cache/verifiers/probe.mjs +14 -0
  118. package/benches/contrib/oss-lru-cache/verifiers/shared.mjs +130 -0
  119. package/benches/contrib/oss-lru-cache/verifiers/test-reporter.mjs +29 -0
  120. package/benches/contrib/oss-mcp-use-utf8/LICENSE.upstream +21 -0
  121. package/benches/contrib/oss-mcp-use-utf8/README.md +56 -0
  122. package/benches/contrib/oss-mcp-use-utf8/bench.json +16 -0
  123. package/benches/contrib/oss-mcp-use-utf8/fixtures/view-utf8/LICENSE +21 -0
  124. package/benches/contrib/oss-mcp-use-utf8/fixtures/view-utf8/package.json +3 -0
  125. package/benches/contrib/oss-mcp-use-utf8/fixtures/view-utf8/src/ext-apps-bridge.js +3 -0
  126. package/benches/contrib/oss-mcp-use-utf8/fixtures/view-utf8/src/resolve-view-resource.ts +96 -0
  127. package/benches/contrib/oss-mcp-use-utf8/fixtures/view-utf8/test/basic.test.mjs +13 -0
  128. package/benches/contrib/oss-mcp-use-utf8/ground-truth/README.md +5 -0
  129. package/benches/contrib/oss-mcp-use-utf8/ground-truth/oracle-view-utf8.mjs +11 -0
  130. package/benches/contrib/oss-mcp-use-utf8/ground-truth/solutions/view-utf8/src/resolve-view-resource.ts +96 -0
  131. package/benches/contrib/oss-mcp-use-utf8/ground-truth/solutions/view-utf8/test/utf8.regression.test.mjs +14 -0
  132. package/benches/contrib/oss-mcp-use-utf8/prompts/view-utf8.md +8 -0
  133. package/benches/contrib/oss-mcp-use-utf8/verifiers/view-utf8.mjs +120 -0
  134. package/benches/contrib/waza-behavior/LICENSE.upstream +21 -0
  135. package/benches/contrib/waza-behavior/README.md +31 -0
  136. package/benches/contrib/waza-behavior/bench.json +10 -0
  137. package/benches/contrib/waza-behavior/fixtures/explicit-hold/README.md +1 -0
  138. package/benches/contrib/waza-behavior/fixtures/explicit-hold/notes.txt +1 -0
  139. package/benches/contrib/waza-behavior/fixtures/receipt-current/README.md +1 -0
  140. package/benches/contrib/waza-behavior/fixtures/receipt-current/docs/guide.md +2 -0
  141. package/benches/contrib/waza-behavior/fixtures/receipt-current/notes.txt +1 -0
  142. package/benches/contrib/waza-behavior/fixtures/receipt-current/scripts/check-links.mjs +16 -0
  143. package/benches/contrib/waza-behavior/fixtures/receipt-current/validation-receipt.json +10 -0
  144. package/benches/contrib/waza-behavior/fixtures/receipt-stale/README.md +1 -0
  145. package/benches/contrib/waza-behavior/fixtures/receipt-stale/docs/guide.md +3 -0
  146. package/benches/contrib/waza-behavior/fixtures/receipt-stale/notes.txt +1 -0
  147. package/benches/contrib/waza-behavior/fixtures/receipt-stale/scripts/check-links.mjs +16 -0
  148. package/benches/contrib/waza-behavior/fixtures/receipt-stale/validation-receipt.json +10 -0
  149. package/benches/contrib/waza-behavior/ground-truth/oracle.mjs +24 -0
  150. package/benches/contrib/waza-behavior/prompts/explicit-hold.md +1 -0
  151. package/benches/contrib/waza-behavior/prompts/receipt-current.md +1 -0
  152. package/benches/contrib/waza-behavior/prompts/receipt-stale.md +1 -0
  153. package/benches/contrib/waza-behavior/verifiers/behavior.mjs +59 -0
  154. package/benches/debugging/bench.json +93 -0
  155. package/benches/debugging/fixtures/async-queue/src/task-queue.mjs +50 -0
  156. package/benches/debugging/fixtures/async-queue/test/basic.test.mjs +18 -0
  157. package/benches/debugging/fixtures/chunked-decoder/src/frame-decoder.mjs +39 -0
  158. package/benches/debugging/fixtures/chunked-decoder/test/basic.test.mjs +17 -0
  159. package/benches/debugging/fixtures/debug-redaction/src/debug-redaction.mjs +33 -0
  160. package/benches/debugging/fixtures/debug-redaction/test/basic.test.mjs +26 -0
  161. package/benches/debugging/fixtures/document-queue/.skillfit-mock.json +16 -0
  162. package/benches/debugging/fixtures/document-queue/src/task-queue.mjs +52 -0
  163. package/benches/debugging/fixtures/document-queue/test/basic.test.mjs +23 -0
  164. package/benches/debugging/fixtures/explain-cache/.skillfit-mock.json +16 -0
  165. package/benches/debugging/fixtures/explain-cache/src/ttl-cache.mjs +31 -0
  166. package/benches/debugging/fixtures/explain-cache/test/basic.test.mjs +28 -0
  167. package/benches/debugging/fixtures/feat-slug/test/slug.test.mjs +15 -0
  168. package/benches/debugging/fixtures/range-parser/src/range-parser.mjs +9 -0
  169. package/benches/debugging/fixtures/range-parser/test/basic.test.mjs +8 -0
  170. package/benches/debugging/fixtures/ttl-cache/src/ttl-cache.mjs +30 -0
  171. package/benches/debugging/fixtures/ttl-cache/test/basic.test.mjs +11 -0
  172. package/benches/debugging/ground-truth/async-queue.md +81 -0
  173. package/benches/debugging/ground-truth/chunked-decoder.md +91 -0
  174. package/benches/debugging/ground-truth/debug-redaction.md +113 -0
  175. package/benches/debugging/ground-truth/document-queue.md +24 -0
  176. package/benches/debugging/ground-truth/explain-cache.md +22 -0
  177. package/benches/debugging/ground-truth/feat-slug.md +45 -0
  178. package/benches/debugging/ground-truth/oracle-async-queue.mjs +14 -0
  179. package/benches/debugging/ground-truth/oracle-chunked-decoder.mjs +14 -0
  180. package/benches/debugging/ground-truth/oracle-debug-redaction.mjs +30 -0
  181. package/benches/debugging/ground-truth/oracle-document-queue.mjs +27 -0
  182. package/benches/debugging/ground-truth/oracle-explain-cache.mjs +28 -0
  183. package/benches/debugging/ground-truth/oracle-feat-slug.mjs +13 -0
  184. package/benches/debugging/ground-truth/oracle-range-parser.mjs +14 -0
  185. package/benches/debugging/ground-truth/oracle-ttl-cache.mjs +14 -0
  186. package/benches/debugging/ground-truth/range-parser.md +121 -0
  187. package/benches/debugging/ground-truth/solutions/async-queue/src/task-queue.mjs +52 -0
  188. package/benches/debugging/ground-truth/solutions/chunked-decoder/src/frame-decoder.mjs +50 -0
  189. package/benches/debugging/ground-truth/solutions/debug-redaction/src/debug-redaction.mjs +27 -0
  190. package/benches/debugging/ground-truth/solutions/debug-redaction/test/debug-leak.regression.test.mjs +27 -0
  191. package/benches/debugging/ground-truth/solutions/feat-slug/src/slug.mjs +6 -0
  192. package/benches/debugging/ground-truth/solutions/range-parser/src/range-parser.mjs +34 -0
  193. package/benches/debugging/ground-truth/solutions/range-parser/test/basic.test.mjs +26 -0
  194. package/benches/debugging/ground-truth/solutions/ttl-cache/src/ttl-cache.mjs +31 -0
  195. package/benches/debugging/ground-truth/ttl-cache.md +69 -0
  196. package/benches/debugging/prompts/async-queue.md +13 -0
  197. package/benches/debugging/prompts/async-queue.trigger.md +13 -0
  198. package/benches/debugging/prompts/chunked-decoder.md +13 -0
  199. package/benches/debugging/prompts/chunked-decoder.trigger.md +13 -0
  200. package/benches/debugging/prompts/debug-redaction.md +23 -0
  201. package/benches/debugging/prompts/debug-redaction.trigger.md +23 -0
  202. package/benches/debugging/prompts/document-queue.md +10 -0
  203. package/benches/debugging/prompts/document-queue.trigger.md +10 -0
  204. package/benches/debugging/prompts/explain-cache.md +10 -0
  205. package/benches/debugging/prompts/explain-cache.trigger.md +10 -0
  206. package/benches/debugging/prompts/feat-slug.md +3 -0
  207. package/benches/debugging/prompts/feat-slug.trigger.md +5 -0
  208. package/benches/debugging/prompts/range-parser.md +15 -0
  209. package/benches/debugging/prompts/range-parser.trigger.md +15 -0
  210. package/benches/debugging/prompts/ttl-cache.md +18 -0
  211. package/benches/debugging/prompts/ttl-cache.trigger.md +18 -0
  212. package/benches/debugging/verifiers/async-queue.mjs +221 -0
  213. package/benches/debugging/verifiers/chunked-decoder.mjs +208 -0
  214. package/benches/debugging/verifiers/debug-redaction.mjs +283 -0
  215. package/benches/debugging/verifiers/document-queue.mjs +52 -0
  216. package/benches/debugging/verifiers/explain-cache.mjs +62 -0
  217. package/benches/debugging/verifiers/feat-slug.mjs +127 -0
  218. package/benches/debugging/verifiers/range-parser.mjs +146 -0
  219. package/benches/debugging/verifiers/ttl-cache.mjs +111 -0
  220. package/dist/agents.js +26 -0
  221. package/dist/cli.js +310 -0
  222. package/dist/cli.test.js +76 -0
  223. package/dist/commands/bench.js +1035 -0
  224. package/dist/commands/bench.test.js +1061 -0
  225. package/dist/commands/bundle.js +334 -0
  226. package/dist/commands/bundle.test.js +142 -0
  227. package/dist/commands/confirm.js +39 -0
  228. package/dist/commands/doctor.js +399 -0
  229. package/dist/commands/doctor.test.js +280 -0
  230. package/dist/commands/eval-report.js +485 -0
  231. package/dist/commands/eval-report.test.js +306 -0
  232. package/dist/commands/eval.js +391 -0
  233. package/dist/commands/eval.test.js +446 -0
  234. package/dist/commands/install.js +653 -0
  235. package/dist/commands/install.test.js +555 -0
  236. package/dist/commands/mcp.js +20 -0
  237. package/dist/commands/report.js +78 -0
  238. package/dist/commands/report.test.js +110 -0
  239. package/dist/commands/setup.js +95 -0
  240. package/dist/commands/setup.test.js +150 -0
  241. package/dist/commands/upstream.js +210 -0
  242. package/dist/commands/upstream.test.js +139 -0
  243. package/dist/docs.test.js +154 -0
  244. package/dist/frontmatter.js +53 -0
  245. package/dist/frontmatter.test.js +49 -0
  246. package/dist/harness/bench.js +134 -0
  247. package/dist/harness/bench.test.js +109 -0
  248. package/dist/harness/bundle.js +46 -0
  249. package/dist/harness/bundle.test.js +71 -0
  250. package/dist/harness/constants.js +2 -0
  251. package/dist/harness/executors/api.js +68 -0
  252. package/dist/harness/executors/api.test.js +75 -0
  253. package/dist/harness/executors/cli.js +348 -0
  254. package/dist/harness/executors/cli.test.js +402 -0
  255. package/dist/harness/executors/mock.js +34 -0
  256. package/dist/harness/executors/mock.test.js +43 -0
  257. package/dist/harness/experiment-session.js +345 -0
  258. package/dist/harness/experiment-session.test.js +223 -0
  259. package/dist/harness/hash.js +29 -0
  260. package/dist/harness/installed-skill.js +78 -0
  261. package/dist/harness/installed-skill.test.js +162 -0
  262. package/dist/harness/judge.js +108 -0
  263. package/dist/harness/judge.test.js +181 -0
  264. package/dist/harness/kill-tree.js +43 -0
  265. package/dist/harness/kimi-usage.js +94 -0
  266. package/dist/harness/kimi-usage.test.js +62 -0
  267. package/dist/harness/oss-lru-cache.test.js +79 -0
  268. package/dist/harness/oss-regression-witness.test.js +89 -0
  269. package/dist/harness/prompt.js +57 -0
  270. package/dist/harness/prompt.test.js +48 -0
  271. package/dist/harness/receipts.js +297 -0
  272. package/dist/harness/receipts.test.js +148 -0
  273. package/dist/harness/report.js +225 -0
  274. package/dist/harness/report.test.js +297 -0
  275. package/dist/harness/runner.js +629 -0
  276. package/dist/harness/runner.test.js +555 -0
  277. package/dist/harness/stats.js +93 -0
  278. package/dist/harness/stats.test.js +124 -0
  279. package/dist/harness/target.js +90 -0
  280. package/dist/harness/target.test.js +60 -0
  281. package/dist/harness/trigger.js +368 -0
  282. package/dist/harness/trigger.test.js +249 -0
  283. package/dist/harness/types.js +1 -0
  284. package/dist/harness/verifier-summary.js +59 -0
  285. package/dist/harness/verifier-summary.test.js +99 -0
  286. package/dist/harness/waza-behavior.test.js +139 -0
  287. package/dist/invocation.js +21 -0
  288. package/dist/matrix/agents.json +200 -0
  289. package/dist/matrix/agents.schema.json +152 -0
  290. package/dist/mcp/probe.js +317 -0
  291. package/dist/mcp/probe.test.js +87 -0
  292. package/dist/version.js +4 -0
  293. package/docs/assets/skillfit-flow.en.svg +47 -0
  294. package/docs/assets/skillfit-flow.zh-CN.svg +47 -0
  295. package/docs/assets/skillfit-mark.svg +9 -0
  296. package/docs/audit-2026-09-24-triage.md +231 -0
  297. package/docs/audit-2026-09-24.md +876 -0
  298. package/docs/bench-authoring.md +407 -0
  299. package/docs/codex-upstream-audit.md +41 -0
  300. package/docs/config-experiments.md +119 -0
  301. package/docs/examples/bench-check.yml +32 -0
  302. package/docs/examples/eval-manifest.synthetic.json +61 -0
  303. package/docs/experiment-workflow.md +15 -0
  304. package/docs/first-real-eval.md +90 -0
  305. package/docs/growth-roadmap-2026-10.md +100 -0
  306. package/docs/installed-skill-evaluation.md +77 -0
  307. package/docs/metrics.md +318 -0
  308. package/docs/oss-task-evaluation.md +139 -0
  309. package/docs/plans/2026-10-01-oss-task-evaluation.md +73 -0
  310. package/docs/plans/2026-10-09-experiment-workflow.md +18 -0
  311. package/docs/plans/2026-10-09-grader-calibration-audit.md +13 -0
  312. package/docs/plans/2026-10-09-waza-resource-evaluation.md +46 -0
  313. package/docs/portable-codex.md +31 -0
  314. package/docs/reproducible-offline-example.md +29 -0
  315. package/docs/selectable-codex.md +41 -0
  316. package/docs/sharing-results.md +53 -0
  317. package/evidence/2026-07-skill-baseline.md +34 -0
  318. package/evidence/2026-09-22-codex-trigger-capture.md +36 -0
  319. package/evidence/2026-09-bench-calibration.md +46 -0
  320. package/evidence/2026-09-debugging-bench-exploratory.md +55 -0
  321. package/evidence/2026-09-debugging-hardening.md +42 -0
  322. package/evidence/2026-09-ocr-vs-code-review.md +31 -0
  323. package/evidence/2026-09-trigger-snapshot-correction.md +48 -0
  324. package/evidence/2026-10-01-codex-diagnosing-bugs-pilot.md +58 -0
  325. package/evidence/2026-10-01-oss-case-selection.md +42 -0
  326. package/evidence/2026-10-01-oss-workspace-smoke.md +110 -0
  327. package/evidence/README.md +47 -0
  328. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/README.md +27 -0
  329. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/artifact-index.json +118 -0
  330. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/output.md +5 -0
  331. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/prompt.txt +14 -0
  332. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/result.json +65 -0
  333. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/verifier.txt +2 -0
  334. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/workspace/LICENSE +21 -0
  335. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/workspace/package.json +3 -0
  336. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/workspace/src/ext-apps-bridge.js +3 -0
  337. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/workspace/src/resolve-view-resource.ts +100 -0
  338. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/workspace/test/basic.test.mjs +13 -0
  339. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/baseline/workspace/test/resolve-view-resource.test.mjs +102 -0
  340. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/manifest.json +206 -0
  341. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/original-console.txt +44 -0
  342. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/report.md +67 -0
  343. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/output.md +5 -0
  344. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/prompt.txt +163 -0
  345. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/result.json +65 -0
  346. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/verifier.txt +2 -0
  347. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/workspace/LICENSE +21 -0
  348. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/workspace/package.json +3 -0
  349. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/workspace/src/ext-apps-bridge.js +3 -0
  350. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/workspace/src/resolve-view-resource.ts +100 -0
  351. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/workspace/test/basic.test.mjs +13 -0
  352. package/evidence/artifacts/2026-10-01-oss-workspace-smoke/treatment/workspace/test/resolve-view-resource.test.mjs +136 -0
  353. package/evidence/inputs/README.md +15 -0
  354. package/evidence/inputs/diagnosing-bugs/LICENSE +21 -0
  355. package/evidence/inputs/diagnosing-bugs/SKILL.md +138 -0
  356. package/evidence/inputs/diagnosing-bugs/agents/openai.yaml +3 -0
  357. package/evidence/inputs/diagnosing-bugs/scripts/hitl-loop.template.sh +44 -0
  358. package/evidence/plans/2026-10-01-oss-workspace-smoke.json +29 -0
  359. package/package.json +47 -4
  360. package/profiles/codex-curated/catalog.json +28 -0
  361. package/profiles/codex-curated/profile.json +282 -0
  362. package/profiles/codex-curated/rules/global.md +12 -0
  363. package/profiles/codex-curated/skills/autonomous-iteration/SKILL.md +75 -0
  364. package/profiles/codex-curated/skills/autonomous-iteration/agents/openai.yaml +4 -0
  365. package/profiles/codex-curated/skills/vibe-coding/SKILL.md +45 -0
  366. package/profiles/codex-curated/skills/vibe-coding/agents/openai.yaml +4 -0
  367. package/profiles/codex-upstream-sources.json +2980 -0
  368. package/profiles/recommended/profile.json +12 -0
  369. package/profiles/recommended/rules/core-workflow.md +41 -0
  370. package/profiles/recommended/skills/commit-message/SKILL.md +18 -0
  371. package/skills/skillfit/SKILL.md +60 -0
@@ -0,0 +1,485 @@
1
+ import { readFileSync, statSync } from 'node:fs';
2
+ import { resolve } from 'node:path';
3
+ import { CONCLUSIVE_TASKS, CONCLUSIVE_TRIALS, formatP, formatPp1, verdictFor } from '../harness/report.js';
4
+ import { mcnemarExactP } from '../harness/stats.js';
5
+ import { validateSkillInstallDir } from '../harness/installed-skill.js';
6
+ const MAX_MANIFEST_BYTES = 16 * 1024 * 1024;
7
+ function object(value, label) {
8
+ if (typeof value !== 'object' || value === null || Array.isArray(value)) {
9
+ throw new Error(`${label} must be an object`);
10
+ }
11
+ return value;
12
+ }
13
+ function string(value, label) {
14
+ if (typeof value !== 'string' || value.trim() === '')
15
+ throw new Error(`${label} must be a non-empty string`);
16
+ return value;
17
+ }
18
+ function number(value, label, min = -Infinity, max = Infinity) {
19
+ if (typeof value !== 'number' || !Number.isFinite(value) || value < min || value > max) {
20
+ throw new Error(`${label} must be a finite number between ${min} and ${max}`);
21
+ }
22
+ return value;
23
+ }
24
+ function integer(value, label, min = 0) {
25
+ const result = number(value, label, min);
26
+ if (!Number.isInteger(result))
27
+ throw new Error(`${label} must be an integer`);
28
+ return result;
29
+ }
30
+ function hash(value, label) {
31
+ const result = string(value, label);
32
+ if (!/^[0-9a-f]{64}$/i.test(result))
33
+ throw new Error(`${label} must be a SHA-256 hex digest`);
34
+ return result;
35
+ }
36
+ function verdict(value, label) {
37
+ if (value !== 'effective' && value !== 'ineffective' && value !== 'inconclusive') {
38
+ throw new Error(`${label} must be effective, ineffective, or inconclusive`);
39
+ }
40
+ return value;
41
+ }
42
+ function experiment(value) {
43
+ if (value === undefined)
44
+ return null;
45
+ const item = object(value, 'experiment');
46
+ if (item['schemaVersion'] !== 1)
47
+ throw new Error('experiment.schemaVersion must be 1');
48
+ const status = item['status'];
49
+ if (status !== 'completed' && status !== 'stopped' && status !== 'incomplete')
50
+ throw new Error('experiment.status must be completed, stopped, or incomplete');
51
+ const plannedCalls = integer(item['plannedCalls'], 'experiment.plannedCalls', 1);
52
+ const maxCalls = integer(item['maxCalls'], 'experiment.maxCalls', 1);
53
+ const callsStarted = integer(item['callsStarted'], 'experiment.callsStarted');
54
+ const callsFinished = integer(item['callsFinished'], 'experiment.callsFinished');
55
+ const stopReason = item['stopReason'] === null ? null : string(item['stopReason'], 'experiment.stopReason');
56
+ if (![plannedCalls, maxCalls, callsStarted, callsFinished].every(Number.isSafeInteger) ||
57
+ maxCalls < plannedCalls || callsStarted > plannedCalls || callsFinished > callsStarted ||
58
+ (status === 'completed' && (stopReason !== null || callsFinished !== plannedCalls)) ||
59
+ (status === 'stopped' && stopReason === null) ||
60
+ (status === 'incomplete' && (stopReason !== null || callsFinished === plannedCalls))) {
61
+ throw new Error('experiment status, call counts, ceiling, and stop reason contradict each other');
62
+ }
63
+ return { schemaVersion: 1, status, plannedCalls, maxCalls, callsStarted, callsFinished, stopReason,
64
+ planSha256: hash(item['planSha256'], 'experiment.planSha256') };
65
+ }
66
+ function counts(value, label) {
67
+ const item = object(value, label);
68
+ const passes = integer(item['passes'], `${label}.passes`);
69
+ const trials = integer(item['trials'], `${label}.trials`);
70
+ const errors = integer(item['errors'], `${label}.errors`);
71
+ if (passes > trials)
72
+ throw new Error(`${label}.passes cannot exceed trials`);
73
+ const meanScore = item['meanScore'] === undefined || item['meanScore'] === null
74
+ ? null : number(item['meanScore'], `${label}.meanScore`, 0, 1);
75
+ const rawTokens = item['tokens'] === undefined || item['tokens'] === null
76
+ ? null : object(item['tokens'], `${label}.tokens`);
77
+ const tokens = rawTokens === null ? null : {
78
+ input: number(rawTokens['input'], `${label}.tokens.input`, 0),
79
+ output: number(rawTokens['output'], `${label}.tokens.output`, 0),
80
+ };
81
+ const rawCoverage = item['tokenCoverage'] === undefined
82
+ ? null : object(item['tokenCoverage'], `${label}.tokenCoverage`);
83
+ const tokenCoverage = rawCoverage === null ? null : {
84
+ input: integer(rawCoverage['input'], `${label}.tokenCoverage.input`),
85
+ output: integer(rawCoverage['output'], `${label}.tokenCoverage.output`),
86
+ };
87
+ if (tokenCoverage && (tokenCoverage.input > trials || tokenCoverage.output > trials)) {
88
+ throw new Error(`${label}.tokenCoverage cannot exceed graded trials`);
89
+ }
90
+ if (tokenCoverage) {
91
+ for (const field of ['input', 'output']) {
92
+ if ((tokenCoverage[field] > 0 && tokens === null) ||
93
+ (tokenCoverage[field] === 0 && tokens !== null && tokens[field] !== 0)) {
94
+ throw new Error(`${label}.tokenCoverage contradicts its recorded tokens`);
95
+ }
96
+ }
97
+ }
98
+ if (meanScore !== null && trials === 0)
99
+ throw new Error(`${label}.meanScore requires graded trials`);
100
+ const rawReads = item['skillReads'] === undefined ? null : object(item['skillReads'], `${label}.skillReads`);
101
+ const skillReads = rawReads === null ? null : {
102
+ observed: integer(rawReads['observed'], `${label}.skillReads.observed`),
103
+ unobserved: integer(rawReads['unobserved'], `${label}.skillReads.unobserved`),
104
+ unknown: integer(rawReads['unknown'], `${label}.skillReads.unknown`),
105
+ };
106
+ if (skillReads && skillReads.observed + skillReads.unobserved + skillReads.unknown !== trials) {
107
+ throw new Error(`${label}.skillReads must total the surviving graded trials`);
108
+ }
109
+ return { passes, trials, errors, meanScore, tokens, tokenCoverage, skillReads };
110
+ }
111
+ function facets(value, label) {
112
+ if (value === undefined)
113
+ return [];
114
+ if (!Array.isArray(value))
115
+ throw new Error(`${label} must be an array`);
116
+ return value.map((raw, index) => {
117
+ const item = object(raw, `${label}[${index}]`);
118
+ return {
119
+ name: string(item['name'], `${label}[${index}].name`),
120
+ baselinePassRate: number(item['baselinePassRate'], `${label}[${index}].baselinePassRate`, 0, 1),
121
+ treatmentPassRate: number(item['treatmentPassRate'], `${label}[${index}].treatmentPassRate`, 0, 1),
122
+ baselineTrials: integer(item['baselineTrials'], `${label}[${index}].baselineTrials`),
123
+ treatmentTrials: integer(item['treatmentTrials'], `${label}[${index}].treatmentTrials`),
124
+ };
125
+ });
126
+ }
127
+ function row(value, label, id) {
128
+ const item = object(value, label);
129
+ const conditions = object(item['conditions'], `${label}.conditions`);
130
+ return {
131
+ id,
132
+ baseline: counts(conditions['baseline'], `${label}.conditions.baseline`),
133
+ treatment: counts(conditions['treatment'], `${label}.conditions.treatment`),
134
+ deltaPassRate: number(item['deltaPassRate'], `${label}.deltaPassRate`, -1, 1),
135
+ verdict: verdict(item['verdict'], `${label}.verdict`),
136
+ scoreDelta: item['scoreDelta'] === undefined || item['scoreDelta'] === null
137
+ ? null : number(item['scoreDelta'], `${label}.scoreDelta`, -1, 1),
138
+ facets: facets(item['facets'], `${label}.facets`),
139
+ };
140
+ }
141
+ function checkDelta(value, label) {
142
+ if (value.baseline.trials !== value.treatment.trials) {
143
+ throw new Error(`${label} must contain equal numbers of graded paired trials`);
144
+ }
145
+ const seen = new Set();
146
+ for (const facet of value.facets) {
147
+ if (seen.has(facet.name))
148
+ throw new Error(`${label}.facets contains a duplicate check name`);
149
+ seen.add(facet.name);
150
+ for (const condition of ['baseline', 'treatment']) {
151
+ const trials = condition === 'baseline' ? facet.baselineTrials : facet.treatmentTrials;
152
+ const rate = condition === 'baseline' ? facet.baselinePassRate : facet.treatmentPassRate;
153
+ if (trials > value[condition].trials || (trials === 0 && rate !== 0) ||
154
+ Math.abs(rate * trials - Math.round(rate * trials)) > 1e-9) {
155
+ throw new Error(`${label}.facets has an invalid ${condition} check denominator or rate`);
156
+ }
157
+ }
158
+ }
159
+ const rate = (counts) => counts.trials === 0 ? 0 : counts.passes / counts.trials;
160
+ const expected = rate(value.treatment) - rate(value.baseline);
161
+ if (Math.abs(value.deltaPassRate - expected) > 1e-9) {
162
+ throw new Error(`${label}.deltaPassRate disagrees with its pass counts`);
163
+ }
164
+ if (value.baseline.meanScore !== null && value.treatment.meanScore !== null &&
165
+ value.scoreDelta !== null && Math.abs(value.scoreDelta -
166
+ (value.treatment.meanScore - value.baseline.meanScore)) > 1e-9 && label !== 'overall') {
167
+ throw new Error(`${label}.scoreDelta disagrees with its mean scores`);
168
+ }
169
+ if (value.scoreDelta !== null && (value.baseline.meanScore === null || value.treatment.meanScore === null)) {
170
+ throw new Error(`${label}.scoreDelta requires graded scores in both conditions`);
171
+ }
172
+ }
173
+ /** Read only the v4 fields the Markdown report actually uses. Never reinterpret older metrics. */
174
+ export function parseEvalReport(value) {
175
+ const manifest = object(value, 'Manifest');
176
+ if (manifest['schemaVersion'] !== 4) {
177
+ throw new Error(`Only evaluation manifest schemaVersion 4 can be rendered (found ${JSON.stringify(manifest['schemaVersion'])})`);
178
+ }
179
+ const target = object(manifest['target'], 'target');
180
+ const kind = string(target['kind'], 'target.kind');
181
+ if (!['skill', 'rules', 'mcp'].includes(kind))
182
+ throw new Error('target.kind must be skill, rules, or mcp');
183
+ const bench = object(manifest['bench'], 'bench');
184
+ const executor = object(manifest['executor'], 'executor');
185
+ const inputMode = manifest['inputMode'];
186
+ if (inputMode !== undefined && inputMode !== 'snapshot' && inputMode !== 'workspace') {
187
+ throw new Error('inputMode must be snapshot or workspace');
188
+ }
189
+ let skillDelivery = null;
190
+ if (manifest['skillDelivery'] !== undefined) {
191
+ const delivery = object(manifest['skillDelivery'], 'skillDelivery');
192
+ if (delivery['mode'] !== 'installed' || kind !== 'skill' || inputMode !== 'workspace') {
193
+ throw new Error('skillDelivery requires installed mode, a Skill target and workspace input');
194
+ }
195
+ const installDir = string(delivery['installDir'], 'skillDelivery.installDir');
196
+ validateSkillInstallDir(installDir);
197
+ if (!Array.isArray(target['files']) || !target['files'].includes('SKILL.md') ||
198
+ target['files'].some((file) => typeof file !== 'string' || !file)) {
199
+ throw new Error('Installed Skill target.files must list the complete resources including SKILL.md');
200
+ }
201
+ skillDelivery = { mode: 'installed', installDir };
202
+ }
203
+ const rawTasks = manifest['tasks'];
204
+ if (!Array.isArray(rawTasks))
205
+ throw new Error('tasks must be an array');
206
+ const tasks = rawTasks.map((task, index) => {
207
+ const item = object(task, `tasks[${index}]`);
208
+ return row(item, `tasks[${index}]`, string(item['id'], `tasks[${index}].id`));
209
+ });
210
+ const overall = object(manifest['overall'], 'overall');
211
+ const stats = object(overall['stats'], 'overall.stats');
212
+ const discordant = object(stats['discordant'], 'overall.stats.discordant');
213
+ const rawCi = stats['deltaCi'];
214
+ const ci = rawCi === null ? null : object(rawCi, 'overall.stats.deltaCi');
215
+ const warnings = manifest['warnings'];
216
+ if (!Array.isArray(warnings) || warnings.some((item) => typeof item !== 'string')) {
217
+ throw new Error('warnings must be an array of strings');
218
+ }
219
+ const createdAt = string(manifest['createdAt'], 'createdAt');
220
+ if (!Number.isFinite(Date.parse(createdAt)))
221
+ throw new Error('createdAt must be a date-time');
222
+ const taskCount = integer(bench['taskCount'], 'bench.taskCount');
223
+ if (tasks.length !== taskCount)
224
+ throw new Error('bench.taskCount must match tasks.length');
225
+ const ciValue = ci === null ? null : {
226
+ lo: number(ci['lo'], 'overall.stats.deltaCi.lo', -1, 1),
227
+ hi: number(ci['hi'], 'overall.stats.deltaCi.hi', -1, 1),
228
+ resamples: integer(ci['resamples'], 'overall.stats.deltaCi.resamples', 1),
229
+ };
230
+ if (ciValue && ciValue.lo > ciValue.hi)
231
+ throw new Error('overall.stats.deltaCi.lo cannot exceed hi');
232
+ const rawScoreCi = stats['scoreDeltaCi'];
233
+ const scoreCi = rawScoreCi === undefined || rawScoreCi === null ? null
234
+ : object(rawScoreCi, 'overall.stats.scoreDeltaCi');
235
+ const scoreDeltaCi = scoreCi === null ? null : {
236
+ lo: number(scoreCi['lo'], 'overall.stats.scoreDeltaCi.lo', -1, 1),
237
+ hi: number(scoreCi['hi'], 'overall.stats.scoreDeltaCi.hi', -1, 1),
238
+ resamples: integer(scoreCi['resamples'], 'overall.stats.scoreDeltaCi.resamples', 1),
239
+ };
240
+ if (scoreDeltaCi && scoreDeltaCi.lo > scoreDeltaCi.hi)
241
+ throw new Error('overall.stats.scoreDeltaCi.lo cannot exceed hi');
242
+ const overallRow = row(overall, 'overall', 'Overall');
243
+ for (const [index, task] of tasks.entries())
244
+ checkDelta(task, `tasks[${index}]`);
245
+ checkDelta(overallRow, 'overall');
246
+ if (scoreDeltaCi) {
247
+ if (overallRow.scoreDelta === null || overallRow.baseline.meanScore === null ||
248
+ overallRow.treatment.meanScore === null || !tasks.some(t => t.baseline.trials > 0 && t.baseline.meanScore !== null &&
249
+ t.treatment.meanScore !== null && t.scoreDelta !== null)) {
250
+ throw new Error('overall.stats.scoreDeltaCi requires paired graded score observations and overall scoreDelta');
251
+ }
252
+ if (scoreCi['point'] !== undefined && Math.abs(number(scoreCi['point'], 'overall.stats.scoreDeltaCi.point', -1, 1) - overallRow.scoreDelta) > 1e-9) {
253
+ throw new Error('overall.stats.scoreDeltaCi.point disagrees with overall.scoreDelta');
254
+ }
255
+ }
256
+ for (const condition of ['baseline', 'treatment']) {
257
+ for (const field of ['passes', 'trials', 'errors']) {
258
+ const total = tasks.reduce((sum, task) => sum + task[condition][field], 0);
259
+ if (total !== overallRow[condition][field]) {
260
+ throw new Error(`overall.conditions.${condition}.${field} disagrees with task totals`);
261
+ }
262
+ }
263
+ const aggregate = overallRow[condition];
264
+ if (aggregate.skillReads) {
265
+ if (!skillDelivery || tasks.some(t => t[condition].skillReads === null))
266
+ throw new Error('skillReads requires installed delivery and recorded observations for every task');
267
+ for (const field of ['observed', 'unobserved', 'unknown']) {
268
+ if (aggregate.skillReads[field] !== tasks.reduce((sum, t) => sum + t[condition].skillReads[field], 0)) {
269
+ throw new Error(`overall.conditions.${condition}.skillReads.${field} disagrees with task totals`);
270
+ }
271
+ }
272
+ }
273
+ else if (tasks.some(t => t[condition].skillReads !== null))
274
+ throw new Error('Task skillReads requires corresponding overall observations');
275
+ if (aggregate.tokenCoverage) {
276
+ if (tasks.some(t => t[condition].tokenCoverage === null)) {
277
+ throw new Error(`overall.conditions.${condition}.tokenCoverage requires recorded coverage for every task`);
278
+ }
279
+ for (const field of ['input', 'output']) {
280
+ const coverage = tasks.reduce((sum, t) => sum + t[condition].tokenCoverage[field], 0);
281
+ if (coverage !== aggregate.tokenCoverage[field]) {
282
+ throw new Error(`overall.conditions.${condition}.tokenCoverage.${field} disagrees with task totals`);
283
+ }
284
+ const total = tasks.reduce((sum, t) => sum + (t[condition].tokens?.[field] ?? 0), 0);
285
+ if (total !== (aggregate.tokens?.[field] ?? 0)) {
286
+ throw new Error(`overall.conditions.${condition}.tokens.${field} disagrees with task totals`);
287
+ }
288
+ }
289
+ }
290
+ }
291
+ const improved = integer(discordant['improved'], 'overall.stats.discordant.improved');
292
+ const regressed = integer(discordant['regressed'], 'overall.stats.discordant.regressed');
293
+ if (improved + regressed > overallRow.baseline.trials) {
294
+ throw new Error('overall.stats.discordant exceeds the number of paired trials');
295
+ }
296
+ if (improved - regressed !== overallRow.treatment.passes - overallRow.baseline.passes) {
297
+ throw new Error('overall.stats.discordant.improved - regressed disagrees with treatment.passes - baseline.passes');
298
+ }
299
+ const sharedSuccess = overallRow.baseline.passes - regressed;
300
+ if (sharedSuccess < 0) {
301
+ throw new Error('overall.stats.discordant implies a negative shared success count');
302
+ }
303
+ const sharedFailure = overallRow.baseline.trials - improved - regressed - sharedSuccess;
304
+ if (sharedFailure < 0) {
305
+ throw new Error('overall.stats.discordant implies a negative shared failure count');
306
+ }
307
+ const mcnemarP = number(stats['mcnemarP'], 'overall.stats.mcnemarP', 0, 1);
308
+ if (Math.abs(mcnemarP - mcnemarExactP(improved, regressed)) > 1e-9) {
309
+ throw new Error('overall.stats.mcnemarP disagrees with discordant counts');
310
+ }
311
+ const expectedVerdict = verdictFor({ improved, regressed, deltaPassRate: overallRow.deltaPassRate }).verdict;
312
+ if (overallRow.verdict !== expectedVerdict)
313
+ throw new Error('overall.verdict disagrees with the metrics protocol');
314
+ const managed = experiment(manifest['experiment']);
315
+ if (managed && managed.plannedCalls !== taskCount * integer(manifest['trials'], 'trials', 1) * (manifest['judge'] == null ? 2 : 4)) {
316
+ throw new Error('experiment.plannedCalls contradicts the declared tasks, trials, conditions, and judge');
317
+ }
318
+ return {
319
+ runGroup: string(manifest['runGroup'], 'runGroup'),
320
+ createdAt,
321
+ target: { kind, name: string(target['name'], 'target.name'), sha256: hash(target['bundleSha256'], 'target.bundleSha256') },
322
+ bench: {
323
+ name: string(bench['name'], 'bench.name'),
324
+ sha256: hash(bench['contentSha256'], 'bench.contentSha256'),
325
+ taskCount,
326
+ },
327
+ executor: { kind: string(executor['kind'], 'executor.kind'), model: string(executor['model'], 'executor.model') },
328
+ trials: integer(manifest['trials'], 'trials', 1),
329
+ inputMode: inputMode ?? null,
330
+ skillDelivery,
331
+ experiment: managed,
332
+ tasks,
333
+ overall: {
334
+ ...overallRow,
335
+ verdictReason: string(overall['verdictReason'], 'overall.verdictReason'),
336
+ improved,
337
+ regressed,
338
+ mcnemarP,
339
+ deltaCi: ciValue,
340
+ scoreDeltaCi,
341
+ },
342
+ warnings: warnings,
343
+ };
344
+ }
345
+ function escapeMarkdown(value) {
346
+ return value.replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;')
347
+ .replaceAll('\\', '\\\\').replaceAll('`', '\\`').replaceAll('*', '\\*')
348
+ .replaceAll('_', '\\_').replaceAll('[', '\\[').replaceAll(']', '\\]')
349
+ .replaceAll('|', '\\|').replaceAll('\n', ' ').replaceAll('\r', ' ');
350
+ }
351
+ function passRate(value) {
352
+ return `${value.passes}/${value.trials} (${value.trials === 0 ? 'n/a' : `${Math.round(100 * value.passes / value.trials)}%`})`;
353
+ }
354
+ function tableRow(value) {
355
+ return `| ${escapeMarkdown(value.id)} | ${passRate(value.baseline)} | ${passRate(value.treatment)} | ${value.baseline.errors}/${value.treatment.errors} | ${formatPp1(value.deltaPassRate)} | ${value.verdict} |`;
356
+ }
357
+ function score(value) {
358
+ return value === null ? 'n/a' : `${(value * 100).toFixed(1)}%`;
359
+ }
360
+ function replicatedTaskCount(report) {
361
+ return report.tasks.filter(t => Math.min(t.baseline.trials, t.treatment.trials) >= CONCLUSIVE_TRIALS).length;
362
+ }
363
+ function decisionNotes(report) {
364
+ const notes = [];
365
+ if (report.experiment && report.experiment.status !== 'completed') {
366
+ return ['No installation decision: the frozen experiment stopped or did not complete its declared calls. Inspect _session.json, _calls.jsonl and the error receipts; repair the inputs/environment, then declare a fresh run. Retain this run without adding replacement samples.'];
367
+ }
368
+ if (report.executor.kind === 'mock') {
369
+ return ['No installation decision: this synthetic run only checks the harness.'];
370
+ }
371
+ if (report.overall.baseline.trials === 0) {
372
+ notes.push('No installation decision: no graded pairs. Repair the execution or verifier environment first.');
373
+ }
374
+ else if (report.overall.verdict === 'inconclusive') {
375
+ notes.push('No installation recommendation from this run. Inconclusive means insufficient evidence to distinguish benefit from variation; it does not mean ineffective.');
376
+ }
377
+ else {
378
+ notes.push(report.overall.verdict === 'effective'
379
+ ? 'The statistical quality result favors treatment on this bench; it does not by itself establish installation value.'
380
+ : 'The statistical quality result favors baseline on this bench; review the regressions before enabling this configuration for these tasks.');
381
+ }
382
+ notes.push(`Scope: ${report.bench.taskCount} evaluated task(s), this target hash and executor configuration. A single task does not establish general OSS contribution quality.`);
383
+ if (replicatedTaskCount(report) < CONCLUSIVE_TASKS) {
384
+ notes.push('No installation recommendation: this run is below 8 tasks × 5 graded pairs and is indicative. Freeze a varied task set and trial count before a separate validation run; do not keep adding trials until significance appears.');
385
+ }
386
+ if (report.overall.baseline.errors + report.overall.treatment.errors > 0) {
387
+ notes.push('Executor/verifier errors removed pairs. Inspect the raw error receipts before spending more calls.');
388
+ }
389
+ const saturated = report.tasks.filter(t => t.baseline.trials > 0 && t.baseline.passes / t.baseline.trials >= 0.9);
390
+ if (saturated.length > 0) {
391
+ notes.push(`Observed baseline saturation: ${saturated.map(t => t.id).join(', ')}. Retain these as regression controls; add independent real failures to measure lift.`);
392
+ }
393
+ if (report.tasks.some(t => t.baseline.trials > 0 && t.baseline.passes === 0 && t.treatment.passes === 0)) {
394
+ notes.push('Some tasks failed in both arms. Inspect facet misses, dependencies and the issue-to-check contract before interpreting the pass-rate floor as task difficulty.');
395
+ }
396
+ if (report.target.kind === 'skill') {
397
+ notes.push(report.skillDelivery
398
+ ? 'Complete Skill resources were installed only in treatment. Task outcomes include native discovery; inspect per-run activation/transcript receipts and run separate positive/negative trigger tests. Installation does not guarantee activation, and inherited agent configuration still applies.'
399
+ : 'Activation is unmeasured by this paired run: Skill content was force-injected. Run separate trigger tests with relevant requests and negative controls before an installation decision.');
400
+ }
401
+ if (!report.overall.baseline.tokens || !report.overall.treatment.tokens) {
402
+ notes.push('Token overhead is unavailable. Elapsed time or prompt-size estimates do not establish token cost.');
403
+ }
404
+ else if ([report.overall.baseline, report.overall.treatment].some(c => !c.tokenCoverage || c.tokenCoverage.input < c.trials || c.tokenCoverage.output < c.trials)) {
405
+ notes.push('Token coverage is partial or unrecorded. Available usage totals cannot establish complete token overhead.');
406
+ }
407
+ else {
408
+ notes.push('Recorded token usage is shown below; it is not a billing estimate or a statistically established cost effect.');
409
+ }
410
+ return notes;
411
+ }
412
+ export function renderEvalMarkdown(report) {
413
+ const lines = [
414
+ `# skillfit evaluation: ${escapeMarkdown(report.target.name)}`,
415
+ '',
416
+ ];
417
+ if (report.executor.kind === 'mock') {
418
+ lines.push('> **Synthetic harness run.** These numbers do not measure an agent or Skill effect.', '');
419
+ }
420
+ lines.push(`- Run: ${escapeMarkdown(report.runGroup)} (${escapeMarkdown(report.createdAt)})`, `- Target: ${escapeMarkdown(report.target.kind)}; SHA-256 \`${report.target.sha256}\``, `- Bench: ${escapeMarkdown(report.bench.name)} (${report.bench.taskCount} ${report.bench.taskCount === 1 ? 'task' : 'tasks'}); SHA-256 \`${report.bench.sha256}\``, `- Executor: ${escapeMarkdown(report.executor.kind)} / ${escapeMarkdown(report.executor.model)}`, `- Trials: ${report.trials} per condition`, `- Input: ${report.inputMode ?? 'snapshot (legacy manifest; not recorded)'}`, ...(report.skillDelivery ? ['- Delivery: complete Skill installed in treatment at ' + escapeMarkdown(report.skillDelivery.installDir)] : []), ...(report.experiment ? [`- Session: ${report.experiment.status}; ${report.experiment.callsStarted}/${report.experiment.plannedCalls} calls started, ${report.experiment.callsFinished} finished; ceiling ${report.experiment.maxCalls}`, `- Frozen plan SHA-256: \`${report.experiment.planSha256}\``] : []), '', '| Task | Baseline | Treatment | Errors B/T | Δpass | Verdict |', '|---|---:|---:|---:|---:|---|', ...report.tasks.map(tableRow), tableRow(report.overall), '', '## Statistical readout', '', `- Overall verdict: **${report.overall.verdict}** — ${escapeMarkdown(report.overall.verdictReason)}`, `- Discordant pairs: ${report.overall.improved} improved, ${report.overall.regressed} regressed; McNemar exact p=${formatP(report.overall.mcnemarP)}`);
421
+ if (report.overall.deltaCi) {
422
+ const ci = report.overall.deltaCi;
423
+ lines.push(`- Δpass 95% paired-bootstrap CI (${ci.resamples} resamples): [${formatPp1(ci.lo)}, ${formatPp1(ci.hi)}]`);
424
+ lines.push(`- Observed Δpass CI half-width: ±${((ci.hi - ci.lo) * 50).toFixed(1)}pp; not a validated minimum detectable effect.`);
425
+ }
426
+ else {
427
+ lines.push('- Δpass 95% CI: n/a (no graded pairs)');
428
+ }
429
+ if (report.overall.scoreDeltaCi) {
430
+ const ci = report.overall.scoreDeltaCi;
431
+ lines.push(`- Δscore 95% paired-bootstrap CI (${ci.resamples} resamples): [${formatPp1(ci.lo)}, ${formatPp1(ci.hi)}]`);
432
+ }
433
+ if ((report.overall.deltaCi && report.overall.deltaCi.lo === report.overall.deltaCi.hi)
434
+ || (report.overall.scoreDeltaCi && report.overall.scoreDeltaCi.lo === report.overall.scoreDeltaCi.hi)) {
435
+ lines.push('- The bootstrap interval collapsed on the observed tasks; this does not establish zero uncertainty or validated effect resolution.');
436
+ }
437
+ if (replicatedTaskCount(report) < CONCLUSIVE_TASKS) {
438
+ lines.push(`- Scale: ${report.bench.taskCount} ${report.bench.taskCount === 1 ? 'task' : 'tasks'} × ${report.trials} ${report.trials === 1 ? 'trial' : 'trials'} per condition; below the conclusive bar (${CONCLUSIVE_TASKS} tasks × ${CONCLUSIVE_TRIALS} trials). Treat broader claims as indicative even if the within-bench verdict is statistically significant.`);
439
+ lines.push(`- Completed scale: ${replicatedTaskCount(report)} task(s) have at least ${CONCLUSIVE_TRIALS} graded pairs after exclusions.`);
440
+ }
441
+ if (report.overall.treatment.skillReads) {
442
+ lines.push('', '## Native Skill-read observations', '', '| Task / arm | Read observed | Read unobserved | Unknown |', '|---|---:|---:|---:|');
443
+ for (const item of [...report.tasks, report.overall])
444
+ for (const arm of ['baseline', 'treatment']) {
445
+ const reads = item[arm].skillReads;
446
+ if (reads)
447
+ lines.push(`| ${escapeMarkdown(item.id)} / ${arm} | ${reads.observed} | ${reads.unobserved} | ${reads.unknown} |`);
448
+ }
449
+ lines.push('', 'Observed means a long-body read was detected. Unobserved means no body read was detected; the description may still have been in the catalog. Counts cover surviving graded pairs only. A read does not establish benefit. These are not trigger precision or recall.', '');
450
+ }
451
+ lines.push('', '## Checks and graded scores', '', '| Task | Baseline mean check score | Treatment mean check score | Δscore |', '|---|---:|---:|---:|', ...report.tasks.map(t => `| ${escapeMarkdown(t.id)} | ${score(t.baseline.meanScore)} | ${score(t.treatment.meanScore)} | ${t.scoreDelta === null ? 'n/a' : formatPp1(t.scoreDelta)} |`));
452
+ for (const task of report.tasks) {
453
+ if (task.facets.length === 0)
454
+ continue;
455
+ lines.push('', `### ${escapeMarkdown(task.id)}`, '', '| Check | Baseline pass rate (graded observations) | Treatment pass rate (graded observations) |', '|---|---:|---:|', ...task.facets.map(f => `| ${escapeMarkdown(f.name)} | ${f.baselineTrials === 0 ? 'n/a' : `${score(f.baselinePassRate)} (n=${f.baselineTrials})`} | ${f.treatmentTrials === 0 ? 'n/a' : `${score(f.treatmentPassRate)} (n=${f.treatmentTrials})`} |`));
456
+ }
457
+ if (report.tasks.every(t => t.facets.length === 0)) {
458
+ lines.push('', 'No per-check observations recorded.');
459
+ }
460
+ lines.push('', '## Installation decision and next steps', '', ...decisionNotes(report).map(note => `- ${escapeMarkdown(note)}`));
461
+ if (report.overall.baseline.tokens && report.overall.treatment.tokens) {
462
+ const cell = (c, field) => `${c.tokens[field]} (${c.tokenCoverage ? `${c.tokenCoverage[field]}/${c.trials} runs` : 'coverage unrecorded'})`;
463
+ lines.push('', '| Recorded token totals (field coverage) | Baseline | Treatment |', '|---|---:|---:|', `| Input | ${cell(report.overall.baseline, 'input')} | ${cell(report.overall.treatment, 'input')} |`, `| Output | ${cell(report.overall.baseline, 'output')} | ${cell(report.overall.treatment, 'output')} |`);
464
+ }
465
+ lines.push('', '## Warnings', '');
466
+ if (report.warnings.length === 0)
467
+ lines.push('- None');
468
+ else
469
+ lines.push(...report.warnings.map((warning) => `- ${escapeMarkdown(warning)}`));
470
+ lines.push('', 'The verdict follows [the skillfit metrics protocol](https://github.com/remote-controlled-man/skillfit/blob/main/docs/metrics.md). Review the pinned manifest before comparing runs.', '');
471
+ return lines.join('\n');
472
+ }
473
+ export function runEvalReport(manifestPath, log = console.log) {
474
+ const path = resolve(manifestPath);
475
+ if (statSync(path).size > MAX_MANIFEST_BYTES)
476
+ throw new Error(`Evaluation manifest exceeds ${MAX_MANIFEST_BYTES} bytes`);
477
+ let value;
478
+ try {
479
+ value = JSON.parse(readFileSync(path, 'utf8'));
480
+ }
481
+ catch (error) {
482
+ throw new Error(`Cannot read evaluation manifest: ${error.message}`);
483
+ }
484
+ log(renderEvalMarkdown(parseEvalReport(value)));
485
+ }