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,297 @@
1
+ import { createReadStream, existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
2
+ import { homedir } from 'node:os';
3
+ import { join, relative, resolve } from 'node:path';
4
+ import { createInterface } from 'node:readline';
5
+ import { agentIds, getAgent, skillUserDirSpecs } from '../agents.js';
6
+ export function resolveHome(dirPattern, homeDir) {
7
+ return dirPattern.startsWith('~') ? join(homeDir, dirPattern.slice(1)) : dirPattern;
8
+ }
9
+ function matchSegment(name, pattern) {
10
+ if (pattern === '*')
11
+ return true;
12
+ const star = pattern.indexOf('*');
13
+ if (star === -1)
14
+ return name === pattern;
15
+ const prefix = pattern.slice(0, star);
16
+ const suffix = pattern.slice(star + 1);
17
+ return (name.startsWith(prefix) &&
18
+ name.endsWith(suffix) &&
19
+ name.length >= prefix.length + suffix.length);
20
+ }
21
+ export function walkGlob(rootDir, pattern) {
22
+ const segments = pattern.split('/');
23
+ const out = [];
24
+ const walk = (dir, depth) => {
25
+ if (depth === segments.length) {
26
+ if (statSync(dir).isFile())
27
+ out.push(dir);
28
+ return;
29
+ }
30
+ const segment = segments[depth];
31
+ if (segment === undefined)
32
+ return;
33
+ let entries;
34
+ try {
35
+ entries = readdirSync(dir, { withFileTypes: true });
36
+ }
37
+ catch {
38
+ return;
39
+ }
40
+ if (segment === '**') {
41
+ walk(dir, depth + 1);
42
+ for (const entry of entries) {
43
+ if (entry.isDirectory()) {
44
+ walk(join(dir, entry.name), depth);
45
+ }
46
+ }
47
+ return;
48
+ }
49
+ for (const entry of entries) {
50
+ if (matchSegment(entry.name, segment)) {
51
+ walk(join(dir, entry.name), depth + 1);
52
+ }
53
+ }
54
+ };
55
+ walk(rootDir, 0);
56
+ return out.sort();
57
+ }
58
+ function extractSkillNames(event, cfg) {
59
+ const names = [];
60
+ const skillKey = cfg.skillKey ?? 'skill';
61
+ if (cfg.wireShape === 'flat-tool-call') {
62
+ let target = event;
63
+ if (event['type'] === 'context.append_loop_event') {
64
+ const nested = event['event'];
65
+ if (typeof nested === 'object' && nested !== null) {
66
+ target = nested;
67
+ }
68
+ }
69
+ if (target['type'] === 'tool.call' && target['name'] === cfg.skillToolName) {
70
+ const args = target['args'];
71
+ if (typeof args === 'object' && args !== null) {
72
+ const skill = args[skillKey];
73
+ if (typeof skill === 'string' && skill !== '')
74
+ names.push(skill);
75
+ }
76
+ }
77
+ return names;
78
+ }
79
+ if (cfg.wireShape === 'codex-rollout') {
80
+ if (event['type'] !== 'response_item')
81
+ return names;
82
+ const payload = event['payload'];
83
+ if (typeof payload !== 'object' || payload === null)
84
+ return names;
85
+ const record = payload;
86
+ if (record['type'] !== 'custom_tool_call')
87
+ return names;
88
+ const input = record['input'];
89
+ if (typeof input !== 'string')
90
+ return names;
91
+ const normalized = input.replace(/\\+/g, '/');
92
+ for (const match of normalized.matchAll(/skills\/([\w.-]+)\/SKILL\.md/gi)) {
93
+ const name = match[1];
94
+ if (name)
95
+ names.push(name);
96
+ }
97
+ return names;
98
+ }
99
+ if (event['type'] !== 'assistant')
100
+ return names;
101
+ const message = event['message'];
102
+ const content = typeof message === 'object' && message !== null
103
+ ? message['content']
104
+ : undefined;
105
+ if (!Array.isArray(content))
106
+ return names;
107
+ for (const block of content) {
108
+ if (typeof block !== 'object' || block === null)
109
+ continue;
110
+ const record = block;
111
+ if (record['type'] === 'tool_use' && record['name'] === cfg.skillToolName) {
112
+ const input = record['input'];
113
+ if (typeof input === 'object' && input !== null) {
114
+ const skill = input[skillKey];
115
+ if (typeof skill === 'string' && skill !== '')
116
+ names.push(skill);
117
+ }
118
+ }
119
+ }
120
+ return names;
121
+ }
122
+ function sessionKey(relPath, wireShape) {
123
+ const parts = relPath.split('/');
124
+ if (wireShape === 'flat-tool-call') {
125
+ return parts[1] ?? relPath;
126
+ }
127
+ const last = parts[parts.length - 1] ?? relPath;
128
+ return last.replace(/\.jsonl$/, '');
129
+ }
130
+ async function scanTranscript(file, cfg) {
131
+ const fires = new Map();
132
+ const stream = createReadStream(file, { encoding: 'utf8' });
133
+ const rl = createInterface({ input: stream, crlfDelay: Infinity });
134
+ try {
135
+ for await (const line of rl) {
136
+ const trimmed = line.trim();
137
+ if (trimmed === '' || !trimmed.startsWith('{'))
138
+ continue;
139
+ let event;
140
+ try {
141
+ event = JSON.parse(trimmed);
142
+ }
143
+ catch {
144
+ continue;
145
+ }
146
+ if (typeof event !== 'object' || event === null)
147
+ continue;
148
+ for (const name of extractSkillNames(event, cfg)) {
149
+ fires.set(name, (fires.get(name) ?? 0) + 1);
150
+ }
151
+ }
152
+ }
153
+ finally {
154
+ rl.close();
155
+ stream.destroy();
156
+ }
157
+ return fires;
158
+ }
159
+ export function installedUserSkills(agent, homeDir, env = {}) {
160
+ const skills = new Map();
161
+ for (const dirPattern of skillUserDirSpecs(agent, env)) {
162
+ const dir = resolveHome(dirPattern, homeDir);
163
+ if (!existsSync(dir))
164
+ continue;
165
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
166
+ if (entry.isDirectory() && existsSync(join(dir, entry.name, 'SKILL.md'))) {
167
+ if (!skills.has(entry.name))
168
+ skills.set(entry.name, join(dir, entry.name));
169
+ }
170
+ }
171
+ }
172
+ return [...skills.entries()].map(([name, dir]) => ({ name, dir })).sort((a, b) => a.name.localeCompare(b.name));
173
+ }
174
+ function estimateTokens(text) {
175
+ return Math.ceil(text.length / 4);
176
+ }
177
+ export function measureSkillTax(skillDir) {
178
+ const file = join(skillDir, 'SKILL.md');
179
+ const empty = { descTokens: 0, bodyTokens: 0 };
180
+ if (!existsSync(file))
181
+ return empty;
182
+ const text = readFileSync(file, 'utf8');
183
+ let description = '';
184
+ if (text.startsWith('---')) {
185
+ const end = text.indexOf('\n---', 3);
186
+ if (end !== -1) {
187
+ const frontmatter = text.slice(3, end);
188
+ const match = /^description:\s*(.+)$/m.exec(frontmatter);
189
+ description = match?.[1]?.trim() ?? '';
190
+ }
191
+ }
192
+ return { descTokens: estimateTokens(description), bodyTokens: estimateTokens(text) };
193
+ }
194
+ function median(values) {
195
+ if (values.length === 0)
196
+ return 0;
197
+ const sorted = [...values].sort((a, b) => a - b);
198
+ const mid = Math.floor(sorted.length / 2);
199
+ return sorted.length % 2 === 0
200
+ ? Math.round(((sorted[mid - 1] ?? 0) + (sorted[mid] ?? 0)) / 2)
201
+ : (sorted[mid] ?? 0);
202
+ }
203
+ export async function collectAgentReceipt(agent, homeDir, env = {}) {
204
+ const emptyTax = { descTokensTotal: 0, bodyTokensMedian: 0, heaviest: [] };
205
+ const cfg = agent.sessions;
206
+ if (!cfg) {
207
+ return {
208
+ agentId: agent.id,
209
+ sessionsDir: '',
210
+ present: false,
211
+ sessionsFound: 0,
212
+ transcriptsRead: 0,
213
+ skills: [],
214
+ installed: [],
215
+ installedCount: 0,
216
+ neverFired: [],
217
+ tax: emptyTax,
218
+ };
219
+ }
220
+ const homeOverride = cfg.homeOverride;
221
+ const overrideRoot = homeOverride === undefined ? undefined : env[homeOverride.env];
222
+ const sessionsDir = overrideRoot
223
+ ? resolve(overrideRoot, homeOverride.relativePath)
224
+ : resolveHome(cfg.dir, homeDir);
225
+ const installed = installedUserSkills(agent, homeDir, env);
226
+ const taxes = installed.map((skill) => ({ name: skill.name, ...measureSkillTax(skill.dir) }));
227
+ const tax = {
228
+ descTokensTotal: taxes.reduce((sum, entry) => sum + entry.descTokens, 0),
229
+ bodyTokensMedian: median(taxes.map((entry) => entry.bodyTokens)),
230
+ heaviest: [...taxes]
231
+ .sort((a, b) => b.descTokens - a.descTokens)
232
+ .filter((entry) => entry.descTokens > 0)
233
+ .slice(0, 3)
234
+ .map((entry) => ({ name: entry.name, descTokens: entry.descTokens })),
235
+ };
236
+ if (!existsSync(sessionsDir)) {
237
+ return {
238
+ agentId: agent.id,
239
+ sessionsDir,
240
+ present: false,
241
+ sessionsFound: 0,
242
+ transcriptsRead: 0,
243
+ skills: [],
244
+ installed: installed.map((skill) => skill.name),
245
+ installedCount: installed.length,
246
+ neverFired: installed.map((skill) => skill.name),
247
+ tax,
248
+ };
249
+ }
250
+ const transcripts = walkGlob(sessionsDir, cfg.transcriptGlob);
251
+ const perSkill = new Map();
252
+ const allSessions = new Set();
253
+ for (const file of transcripts) {
254
+ const rel = relative(sessionsDir, file).split('\\').join('/');
255
+ const session = sessionKey(rel, cfg.wireShape);
256
+ allSessions.add(session);
257
+ const mtime = statSync(file).mtimeMs;
258
+ const fires = await scanTranscript(file, cfg);
259
+ for (const [name, count] of fires) {
260
+ const entry = perSkill.get(name) ?? { fires: 0, sessions: new Set(), lastSeen: 0 };
261
+ entry.fires += count;
262
+ entry.sessions.add(session);
263
+ entry.lastSeen = Math.max(entry.lastSeen, mtime);
264
+ perSkill.set(name, entry);
265
+ }
266
+ }
267
+ const skills = [...perSkill.entries()]
268
+ .map(([name, entry]) => ({
269
+ name,
270
+ fires: entry.fires,
271
+ sessionCount: entry.sessions.size,
272
+ lastSeen: entry.lastSeen,
273
+ }))
274
+ .sort((a, b) => b.fires - a.fires || a.name.localeCompare(b.name));
275
+ return {
276
+ agentId: agent.id,
277
+ sessionsDir,
278
+ present: true,
279
+ sessionsFound: allSessions.size,
280
+ transcriptsRead: transcripts.length,
281
+ skills,
282
+ installed: installed.map((skill) => skill.name),
283
+ installedCount: installed.length,
284
+ neverFired: installed.filter((skill) => !perSkill.has(skill.name)).map((skill) => skill.name),
285
+ tax,
286
+ };
287
+ }
288
+ export async function collectReceipts(options = {}) {
289
+ const homeDir = options.homeDir ?? homedir();
290
+ const env = options.env ?? (options.homeDir === undefined ? process.env : {});
291
+ const ids = options.agent ? [options.agent] : agentIds();
292
+ const receipts = [];
293
+ for (const id of ids) {
294
+ receipts.push(await collectAgentReceipt(getAgent(id), homeDir, env));
295
+ }
296
+ return receipts;
297
+ }
@@ -0,0 +1,148 @@
1
+ import assert from 'node:assert/strict';
2
+ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
3
+ import { tmpdir } from 'node:os';
4
+ import { join } from 'node:path';
5
+ import { test } from 'node:test';
6
+ import { collectReceipts, measureSkillTax, walkGlob } from './receipts.js';
7
+ function makeHome(t) {
8
+ const home = mkdtempSync(join(tmpdir(), 'skillfit-receipts-'));
9
+ t.after(() => rmSync(home, { recursive: true, force: true }));
10
+ const kimiWire1 = join(home, '.kimi-code', 'sessions', 'wd_demo', 's1', 'agents', 'main');
11
+ const kimiWire2 = join(home, '.kimi-code', 'sessions', 'wd_demo', 's2', 'agents', 'main');
12
+ mkdirSync(kimiWire1, { recursive: true });
13
+ mkdirSync(kimiWire2, { recursive: true });
14
+ writeFileSync(join(kimiWire1, 'wire.jsonl'), [
15
+ '{"type":"metadata"}',
16
+ '{"type":"context.append_loop_event","event":{"type":"tool.call","name":"Skill","args":{"skill":"alpha"}},"time":1}',
17
+ '{"type":"context.append_loop_event","event":{"type":"tool.call","name":"Skill","args":{"skill":"alpha"}},"time":2}',
18
+ '{"type":"context.append_loop_event","event":{"type":"tool.call","name":"Read","args":{"path":"x"}},"time":3}',
19
+ 'not json at all',
20
+ '{"type":"context.append_loop_event","event":{"type":"tool.call","name":"Skill","args":{"skill":"beta"}},"time":4}',
21
+ '',
22
+ ].join('\n'));
23
+ writeFileSync(join(kimiWire2, 'wire.jsonl'), '{"type":"context.append_loop_event","event":{"type":"tool.call","name":"Skill","args":{"skill":"alpha"}},"time":5}\n');
24
+ const claudeDir = join(home, '.claude', 'projects', 'proj-x');
25
+ mkdirSync(claudeDir, { recursive: true });
26
+ writeFileSync(join(claudeDir, 'sess-1.jsonl'), [
27
+ '{"type":"assistant","message":{"content":[{"type":"tool_use","name":"Skill","input":{"skill":"gamma"}}]}}',
28
+ '{"type":"user","message":{"content":"hi"}}',
29
+ '{"type":"assistant","message":{"content":[{"type":"text","text":"ok"},{"type":"tool_use","name":"Bash","input":{}}]}}',
30
+ ].join('\n'));
31
+ for (const [base, name] of [
32
+ ['.kimi-code/skills', 'alpha'],
33
+ ['.agents/skills', 'beta'],
34
+ ['.agents/skills', 'never-skill'],
35
+ ['.claude/skills', 'gamma'],
36
+ ['.claude/skills', 'delta'],
37
+ ]) {
38
+ mkdirSync(join(home, base, name), { recursive: true });
39
+ writeFileSync(join(home, base, name, 'SKILL.md'), `# ${name}\n`);
40
+ }
41
+ return home;
42
+ }
43
+ test('walkGlob matches single-star segments and suffix patterns', (t) => {
44
+ const home = makeHome(t);
45
+ const kimiFiles = walkGlob(join(home, '.kimi-code', 'sessions'), '*/*/agents/*/wire.jsonl');
46
+ assert.equal(kimiFiles.length, 2);
47
+ const claudeFiles = walkGlob(join(home, '.claude', 'projects'), '*/*.jsonl');
48
+ assert.equal(claudeFiles.length, 1);
49
+ });
50
+ test('collectReceipts aggregates skill fires per agent and computes never-fired', async (t) => {
51
+ const home = makeHome(t);
52
+ const receipts = await collectReceipts({ homeDir: home });
53
+ const kimi = receipts.find((r) => r.agentId === 'kimi-code');
54
+ const claude = receipts.find((r) => r.agentId === 'claude-code');
55
+ const codex = receipts.find((r) => r.agentId === 'codex');
56
+ assert.ok(kimi?.present);
57
+ assert.equal(kimi.sessionsFound, 2);
58
+ assert.equal(kimi.transcriptsRead, 2);
59
+ const alpha = kimi.skills.find((s) => s.name === 'alpha');
60
+ const beta = kimi.skills.find((s) => s.name === 'beta');
61
+ assert.deepEqual({ fires: alpha?.fires, sessions: alpha?.sessionCount }, { fires: 3, sessions: 2 });
62
+ assert.deepEqual({ fires: beta?.fires, sessions: beta?.sessionCount }, { fires: 1, sessions: 1 });
63
+ assert.deepEqual(kimi.neverFired, ['never-skill']);
64
+ assert.ok(claude?.present);
65
+ const gamma = claude.skills.find((s) => s.name === 'gamma');
66
+ assert.equal(gamma?.fires, 1);
67
+ assert.deepEqual(claude.neverFired, ['delta']);
68
+ assert.ok(codex);
69
+ assert.equal(codex.present, false);
70
+ assert.equal(codex.skills.length, 0);
71
+ });
72
+ test('collectReceipts sees Codex skills installed under ~/.codex/skills', async (t) => {
73
+ const home = mkdtempSync(join(tmpdir(), 'skillfit-receipts-codex-skills-'));
74
+ t.after(() => rmSync(home, { recursive: true, force: true }));
75
+ mkdirSync(join(home, '.codex', 'skills', 'from-codex'), { recursive: true });
76
+ writeFileSync(join(home, '.codex', 'skills', 'from-codex', 'SKILL.md'), '# from-codex\n');
77
+ const receipts = await collectReceipts({ homeDir: home, agent: 'codex' });
78
+ assert.deepEqual(receipts[0]?.installed, ['from-codex']);
79
+ });
80
+ test('collectReceipts handles a home with no session stores at all', async (t) => {
81
+ const home = mkdtempSync(join(tmpdir(), 'skillfit-receipts-empty-'));
82
+ t.after(() => rmSync(home, { recursive: true, force: true }));
83
+ const receipts = await collectReceipts({ homeDir: home });
84
+ for (const receipt of receipts) {
85
+ assert.equal(receipt.present, false);
86
+ assert.equal(receipt.skills.length, 0);
87
+ }
88
+ });
89
+ test('collectReceipts filters to a single agent when asked', async (t) => {
90
+ const home = makeHome(t);
91
+ const receipts = await collectReceipts({ homeDir: home, agent: 'kimi-code' });
92
+ assert.equal(receipts.length, 1);
93
+ assert.equal(receipts[0]?.agentId, 'kimi-code');
94
+ });
95
+ test('walkGlob supports ** for any depth', (t) => {
96
+ const home = makeHome(t);
97
+ const deep = join(home, '.codex', 'sessions', '2026', '09', '22');
98
+ mkdirSync(deep, { recursive: true });
99
+ writeFileSync(join(deep, 'rollout-x.jsonl'), '');
100
+ const files = walkGlob(join(home, '.codex', 'sessions'), '**/rollout-*.jsonl');
101
+ assert.equal(files.length, 1);
102
+ });
103
+ test('collectReceipts reads codex rollouts (custom_tool_call skill-path evidence)', async (t) => {
104
+ const home = makeHome(t);
105
+ const deep = join(home, '.codex', 'sessions', '2026', '09', '22');
106
+ mkdirSync(deep, { recursive: true });
107
+ writeFileSync(join(deep, 'rollout-2026-09-22T00-00-00-aaaa.jsonl'), [
108
+ '{"type":"response_item","payload":{"type":"message","role":"user"}}',
109
+ '{"type":"response_item","payload":{"type":"custom_tool_call","status":"completed","name":"exec","input":"Get-Content -Raw C:\\\\repo\\\\.agents\\\\skills\\\\alpha\\\\SKILL.md"}}',
110
+ '{"type":"response_item","payload":{"type":"custom_tool_call","status":"completed","name":"exec","input":"type src\\\\main.js"}}',
111
+ ].join('\n'));
112
+ mkdirSync(join(home, '.agents', 'skills', 'codex-only-skill'), { recursive: true });
113
+ writeFileSync(join(home, '.agents', 'skills', 'codex-only-skill', 'SKILL.md'), '# x\n');
114
+ const receipts = await collectReceipts({ homeDir: home, agent: 'codex' });
115
+ const codex = receipts[0];
116
+ assert.ok(codex);
117
+ assert.equal(codex.present, true);
118
+ const alpha = codex.skills.find((s) => s.name === 'alpha');
119
+ assert.equal(alpha?.fires, 1);
120
+ assert.deepEqual(codex.neverFired, ['beta', 'codex-only-skill', 'never-skill']);
121
+ });
122
+ test('collectReceipts uses CODEX_HOME for Codex sessions', async (t) => {
123
+ const home = makeHome(t);
124
+ const codexHome = join(home, 'alternate-codex');
125
+ const sessionsDir = join(codexHome, 'sessions', '2026', '09', '29');
126
+ mkdirSync(sessionsDir, { recursive: true });
127
+ for (const id of ['one', 'two']) {
128
+ writeFileSync(join(sessionsDir, `rollout-${id}.jsonl`), '{"type":"response_item","payload":{"type":"custom_tool_call","status":"completed","name":"exec","input":"Get-Content C:\\\\repo\\\\.agents\\\\skills\\\\example\\\\SKILL.md"}}\n');
129
+ }
130
+ const receipt = (await collectReceipts({ homeDir: home, agent: 'codex', env: { CODEX_HOME: codexHome } }))[0];
131
+ assert.equal(receipt?.sessionsDir, join(codexHome, 'sessions'));
132
+ assert.equal(receipt?.skills.find((skill) => skill.name === 'example')?.sessionCount, 2);
133
+ });
134
+ test('measureSkillTax reads frontmatter description and body size', (t) => {
135
+ const dir = mkdtempSync(join(tmpdir(), 'skillfit-tax-'));
136
+ t.after(() => rmSync(dir, { recursive: true, force: true }));
137
+ writeFileSync(join(dir, 'SKILL.md'), '---\nname: demo\ndescription: Twelve chars\n---\n\n# Demo\n\nbody body body body\n');
138
+ const tax = measureSkillTax(dir);
139
+ assert.equal(tax.descTokens, 3);
140
+ assert.equal(tax.bodyTokens, Math.ceil('---\nname: demo\ndescription: Twelve chars\n---\n\n# Demo\n\nbody body body body\n'.length / 4));
141
+ });
142
+ test('measureSkillTax tolerates missing frontmatter and missing files', (t) => {
143
+ const dir = mkdtempSync(join(tmpdir(), 'skillfit-tax-'));
144
+ t.after(() => rmSync(dir, { recursive: true, force: true }));
145
+ assert.deepEqual(measureSkillTax(dir), { descTokens: 0, bodyTokens: 0 });
146
+ writeFileSync(join(dir, 'SKILL.md'), '# plain\n');
147
+ assert.deepEqual(measureSkillTax(dir), { descTokens: 0, bodyTokens: 2 });
148
+ });
@@ -0,0 +1,225 @@
1
+ import { mcnemarExactP, MIN_DISCORDANT_FOR_SIGNIFICANCE } from './stats.js';
2
+ import { CONDITIONS } from './types.js';
3
+ export const DISCRIMINATION_BASELINE_THRESHOLD = 0.9;
4
+ export const FLOOR_BASELINE_THRESHOLD = 0.1;
5
+ export const CONCLUSIVE_TASKS = 8;
6
+ export const CONCLUSIVE_TRIALS = 5;
7
+ export function formatPassRate(passes, trials) {
8
+ if (trials === 0)
9
+ return `${passes}/${trials} (n/a)`;
10
+ return `${passes}/${trials} (${Math.round((passes / trials) * 100)}%)`;
11
+ }
12
+ export function formatDeltaPp(delta) {
13
+ const pp = Math.round(delta * 100);
14
+ return `${pp > 0 ? '+' : ''}${pp}pp`;
15
+ }
16
+ /**
17
+ * Percentage points to one decimal. Interval bounds need this: rounding a CI to whole points turns
18
+ * [-0.044, 0.610] into [-4pp, +61pp], which reports the run's resolution as ±33pp when it is ±32.7 —
19
+ * and at the small sample sizes this tool targets, the tenths are the difference between "resolves a
20
+ * realistic effect" and "resolves nothing".
21
+ */
22
+ export function formatPp1(value) {
23
+ const pp = Math.round(value * 1000) / 10;
24
+ return `${pp > 0 ? '+' : ''}${pp.toFixed(1)}pp`;
25
+ }
26
+ export function formatP(p) {
27
+ return p < 0.0001 ? '<0.0001' : p.toFixed(4);
28
+ }
29
+ export function verdictFor(input) {
30
+ const { improved, regressed, deltaPassRate } = input;
31
+ const discordant = improved + regressed;
32
+ if (discordant < MIN_DISCORDANT_FOR_SIGNIFICANCE) {
33
+ return {
34
+ verdict: 'inconclusive',
35
+ reason: `only ${discordant} discordant pair(s) (Δpass ${formatDeltaPp(deltaPassRate)}); significance needs at least ${MIN_DISCORDANT_FOR_SIGNIFICANCE}`,
36
+ };
37
+ }
38
+ const p = mcnemarExactP(improved, regressed);
39
+ const detail = `${improved} improved vs ${regressed} regressed of ${discordant} discordant pair(s), McNemar exact p=${formatP(p)}`;
40
+ if (p < 0.05 && deltaPassRate > 0) {
41
+ return { verdict: 'effective', reason: detail };
42
+ }
43
+ if (p < 0.05 && deltaPassRate < 0) {
44
+ return { verdict: 'ineffective', reason: detail };
45
+ }
46
+ return { verdict: 'inconclusive', reason: `not significant: ${detail}` };
47
+ }
48
+ export function buildWarnings(manifest) {
49
+ const warnings = [];
50
+ if (manifest.experiment && manifest.experiment.status !== 'completed') {
51
+ warnings.push('Experiment did not complete its declared calls; no installation recommendation. Inspect _session.json and _calls.jsonl before planning a fresh run.');
52
+ }
53
+ if (manifest.skillDelivery) {
54
+ warnings.push('Installed Skill mode measures task outcomes with native discovery and complete resources; activation is not guaranteed. Inherited agent configuration still applies.');
55
+ }
56
+ if (manifest.executor.kind === 'mock') {
57
+ warnings.push('Executor is a mock: results are synthetic and only exercise the harness.');
58
+ }
59
+ for (const task of manifest.tasks) {
60
+ for (const condition of CONDITIONS) {
61
+ const stats = task.conditions[condition];
62
+ if (stats.errors > 0) {
63
+ const other = condition === 'baseline' ? 'treatment' : 'baseline';
64
+ warnings.push(`Task "${task.id}" (${condition}): ${stats.errors} trial(s) hit an executor, verifier, or engagement error and were excluded from the rates, together with their paired ${other} trial(s) — an ungraded run is not a failure.`);
65
+ }
66
+ }
67
+ const rate = task.conditions.baseline.passRate;
68
+ if (rate >= DISCRIMINATION_BASELINE_THRESHOLD) {
69
+ warnings.push(`Task "${task.id}": baseline pass rate is ${Math.round(rate * 100)}% (>= 90%) — this bench task may be too easy and the experiment may lack discriminative power.`);
70
+ }
71
+ if (task.conditions.baseline.trials > 0 && rate <= FLOOR_BASELINE_THRESHOLD) {
72
+ warnings.push(`Task "${task.id}": baseline pass rate is ${Math.round(rate * 100)}% (<= 10%) — this bench task may be too hard or broken, and all-zero arms are uninformative.`);
73
+ }
74
+ for (const facet of task.facets) {
75
+ if (facet.baselineTrials > 0 && facet.baselinePassRate >= DISCRIMINATION_BASELINE_THRESHOLD) {
76
+ warnings.push(`Task "${task.id}" facet "${facet.name}": baseline check pass rate is ${Math.round(facet.baselinePassRate * 100)}% (>= 90%) — this facet is saturated and measures no lift.`);
77
+ }
78
+ }
79
+ warnings.push(...task.verifierNotes);
80
+ }
81
+ const overallRate = manifest.overall.conditions.baseline.passRate;
82
+ if (manifest.tasks.length > 1 && overallRate >= DISCRIMINATION_BASELINE_THRESHOLD) {
83
+ warnings.push(`Overall baseline pass rate is ${Math.round(overallRate * 100)}% (>= 90%) — this bench may be too easy and the experiment may lack discriminative power.`);
84
+ }
85
+ const discordant = manifest.overall.stats.discordant.improved + manifest.overall.stats.discordant.regressed;
86
+ if (discordant < MIN_DISCORDANT_FOR_SIGNIFICANCE) {
87
+ warnings.push(`Only ${discordant} discordant pair(s) between conditions — a run this size can only certify very large effects; treat any delta as indicative.`);
88
+ }
89
+ return warnings;
90
+ }
91
+ function pad(text, width) {
92
+ return text.length >= width ? text : text + ' '.repeat(width - text.length);
93
+ }
94
+ export function renderSummary(manifest, manifestPath) {
95
+ const lines = [];
96
+ lines.push(`Target : ${manifest.target.name} (${manifest.target.kind}, bundle sha256 ${manifest.target.bundleSha256.slice(0, 12)}…, ${manifest.target.files.length} files)`);
97
+ lines.push(`Bench : ${manifest.bench.name} (${manifest.bench.taskCount} task(s), content sha256 ${manifest.bench.contentSha256.slice(0, 12)}…)`);
98
+ lines.push(`Input : ${manifest.inputMode ?? 'snapshot (legacy manifest; not recorded)'}`);
99
+ if (manifest.skillDelivery)
100
+ lines.push('Delivery : installed complete Skill at ' + manifest.skillDelivery.installDir + '/' + manifest.target.name);
101
+ lines.push(`Executor : ${describeExecutor(manifest.executor)}`);
102
+ lines.push(`Judge : ${manifest.judge ? describeExecutor(manifest.judge) : 'disabled'}`);
103
+ lines.push(`Trials : ${manifest.trials} per condition`);
104
+ if (manifest.experiment)
105
+ lines.push(`Session : ${manifest.experiment.status}; ${manifest.experiment.callsStarted}/${manifest.experiment.plannedCalls} calls started (ceiling ${manifest.experiment.maxCalls})`);
106
+ lines.push('');
107
+ const idWidth = Math.max(7, ...manifest.tasks.map((t) => t.id.length));
108
+ const header = `${pad('TASK', idWidth)} BASELINE TREATMENT DELTA VERDICT`;
109
+ lines.push(header);
110
+ for (const task of manifest.tasks) {
111
+ lines.push(renderRow(task.id, idWidth, task.conditions, task.deltaPassRate, task.verdict));
112
+ }
113
+ lines.push(renderRow('OVERALL', idWidth, manifest.overall.conditions, manifest.overall.deltaPassRate, manifest.overall.verdict));
114
+ lines.push('');
115
+ const stats = manifest.overall.stats;
116
+ lines.push(`Significance (overall): ${stats.discordant.improved} improved vs ${stats.discordant.regressed} regressed discordant pair(s), McNemar exact p=${formatP(stats.mcnemarP)}`);
117
+ lines.push(stats.deltaCi
118
+ ? `Δpass 95% CI (paired bootstrap, ${stats.deltaCi.resamples} resamples): [${formatPp1(stats.deltaCi.lo)}, ${formatPp1(stats.deltaCi.hi)}]`
119
+ : 'Δpass 95% CI: n/a (no trials)');
120
+ if (stats.deltaCi) {
121
+ const halfWidthPp = ((stats.deltaCi.hi - stats.deltaCi.lo) / 2) * 100;
122
+ lines.push(`Observed Δpass CI half-width: ±${halfWidthPp.toFixed(1)}pp; this is a bootstrap summary, not a validated minimum detectable effect`);
123
+ }
124
+ const anyScores = manifest.tasks.some((task) => task.scoreDelta !== null);
125
+ if (anyScores) {
126
+ lines.push(stats.scoreDeltaCi
127
+ ? `Δscore 95% CI (paired bootstrap, ${stats.scoreDeltaCi.resamples} resamples): [${signedScore(stats.scoreDeltaCi.lo)}, ${signedScore(stats.scoreDeltaCi.hi)}]`
128
+ : 'Δscore 95% CI: n/a (no task scored in both arms)');
129
+ }
130
+ if ((stats.deltaCi && stats.deltaCi.lo === stats.deltaCi.hi)
131
+ || (anyScores && stats.scoreDeltaCi && stats.scoreDeltaCi.lo === stats.scoreDeltaCi.hi)) {
132
+ lines.push('The bootstrap interval collapsed on the observed tasks; it does not establish zero uncertainty or validated effect resolution.');
133
+ }
134
+ const replicatedTasks = manifest.tasks.filter(t => Math.min(t.conditions.baseline.trials, t.conditions.treatment.trials) >= CONCLUSIVE_TRIALS).length;
135
+ if (replicatedTasks < CONCLUSIVE_TASKS) {
136
+ lines.push(`Scale: ${manifest.bench.taskCount} task(s) × ${manifest.trials} trials per condition — below the conclusive bar (${CONCLUSIVE_TASKS} tasks × ${CONCLUSIVE_TRIALS} trials); results are indicative for broader claims even if the within-bench verdict is statistically significant.`);
137
+ lines.push(`Completed scale: ${replicatedTasks} task(s) have at least ${CONCLUSIVE_TRIALS} graded pairs after exclusions.`);
138
+ }
139
+ const tokenLines = renderTokenDeltas(manifest);
140
+ if (tokenLines.length > 0) {
141
+ lines.push('');
142
+ lines.push(...tokenLines);
143
+ }
144
+ const facetLines = renderFacetScores(manifest);
145
+ if (facetLines.length > 0) {
146
+ lines.push('');
147
+ lines.push(...facetLines);
148
+ }
149
+ lines.push('');
150
+ lines.push('Warnings:');
151
+ if (manifest.warnings.length === 0) {
152
+ lines.push('- none');
153
+ }
154
+ else {
155
+ for (const warning of manifest.warnings)
156
+ lines.push(`- ${warning}`);
157
+ }
158
+ lines.push('');
159
+ lines.push(`Manifest: ${manifestPath}`);
160
+ return lines.join('\n');
161
+ }
162
+ function renderRow(id, idWidth, conditions, deltaPassRate, verdict) {
163
+ const baseline = formatPassRate(conditions.baseline.passes, conditions.baseline.trials);
164
+ const treatment = formatPassRate(conditions.treatment.passes, conditions.treatment.trials);
165
+ return `${pad(id, idWidth)} ${pad(baseline, 12)} ${pad(treatment, 12)} ${pad(formatDeltaPp(deltaPassRate), 8)} ${verdict}`;
166
+ }
167
+ function renderTokenDeltas(manifest) {
168
+ const rows = manifest.tasks.filter((task) => task.tokenDelta !== null);
169
+ if (rows.length === 0 || manifest.overall.tokenDelta === null)
170
+ return [];
171
+ const lines = ['Token delta (treatment - baseline):'];
172
+ for (const task of rows) {
173
+ const delta = task.tokenDelta;
174
+ if (delta)
175
+ lines.push(`- ${task.id}: input ${signed(delta.input)}, output ${signed(delta.output)}`);
176
+ }
177
+ const overall = manifest.overall.tokenDelta;
178
+ if (overall)
179
+ lines.push(`- overall: input ${signed(overall.input)}, output ${signed(overall.output)}`);
180
+ const baseline = manifest.overall.conditions.baseline;
181
+ const treatment = manifest.overall.conditions.treatment;
182
+ const totalTokens = (condition) => condition.tokens ? condition.tokens.input + condition.tokens.output : null;
183
+ const costBaseline = totalTokens(baseline);
184
+ const costTreatment = totalTokens(treatment);
185
+ const covered = (condition) => condition.trials > 0 &&
186
+ condition.tokenCoverage !== undefined &&
187
+ condition.tokenCoverage.input === condition.trials &&
188
+ condition.tokenCoverage.output === condition.trials;
189
+ if (costBaseline !== null &&
190
+ costTreatment !== null &&
191
+ baseline.passRate > 0 &&
192
+ treatment.passRate > 0 &&
193
+ covered(baseline) &&
194
+ covered(treatment)) {
195
+ const ratio = costTreatment / treatment.trials / treatment.passRate / (costBaseline / baseline.trials / baseline.passRate);
196
+ lines.push(`- cost-of-pass ratio (treatment / baseline): ${ratio.toFixed(2)} (lower is better)`);
197
+ }
198
+ return lines;
199
+ }
200
+ function signed(value) {
201
+ return value > 0 ? `+${value}` : String(value);
202
+ }
203
+ function signedScore(value) {
204
+ return `${value > 0 ? '+' : ''}${value.toFixed(2)}`;
205
+ }
206
+ function renderFacetScores(manifest) {
207
+ const rows = manifest.tasks.filter((task) => task.facets.length > 0);
208
+ if (rows.length === 0)
209
+ return [];
210
+ const percent = (rate) => `${Math.round(rate * 100)}%`;
211
+ const mean = (value) => (value === null ? 'n/a' : value.toFixed(2));
212
+ const delta = (value) => (value === null ? 'n/a' : signedScore(value));
213
+ const lines = ['Facet scores (mean checks passed, baseline → treatment):'];
214
+ for (const task of rows) {
215
+ lines.push(`- ${task.id}: score ${mean(task.conditions.baseline.meanScore)} → ${mean(task.conditions.treatment.meanScore)} (Δ ${delta(task.scoreDelta)})`);
216
+ for (const facet of task.facets) {
217
+ lines.push(` - ${facet.name}: ${percent(facet.baselinePassRate)} → ${percent(facet.treatmentPassRate)}`);
218
+ }
219
+ }
220
+ return lines;
221
+ }
222
+ function describeExecutor(descriptor) {
223
+ const base = `${descriptor.kind} (${descriptor.model})`;
224
+ return descriptor.detail ? `${base} — ${descriptor.detail}` : base;
225
+ }