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,249 @@
1
+ import assert from 'node:assert/strict';
2
+ import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
3
+ import { tmpdir } from 'node:os';
4
+ import { join } from 'node:path';
5
+ import { test } from 'node:test';
6
+ import { loadBench } from './bench.js';
7
+ import { collectInstalledSkillFingerprint, collectSkillBundle } from './bundle.js';
8
+ import { MockExecutor } from './executors/mock.js';
9
+ import { renderTriggerSummary, runTriggerExperiment, triggerMetrics } from './trigger.js';
10
+ function tmp(t, prefix) {
11
+ const dir = mkdtempSync(join(tmpdir(), prefix));
12
+ t.after(() => rmSync(dir, { recursive: true, force: true }));
13
+ return dir;
14
+ }
15
+ const PASS_VERIFIER = `import fs from 'node:fs';
16
+ const out = fs.readFileSync(process.argv[2] + '/_output.md', 'utf8');
17
+ process.exit(out.includes('done') ? 0 : 1);
18
+ `;
19
+ function makeTriggerBench(t) {
20
+ const dir = tmp(t, 'skillfit-trigger-bench-');
21
+ for (const id of ['pos-task', 'neg-task']) {
22
+ mkdirSync(join(dir, 'fixtures', id), { recursive: true });
23
+ writeFileSync(join(dir, 'fixtures', id, 'index.txt'), 'x\n');
24
+ }
25
+ mkdirSync(join(dir, 'prompts'), { recursive: true });
26
+ writeFileSync(join(dir, 'prompts', 'pos.md'), 'Review this code and finish with done.\n');
27
+ writeFileSync(join(dir, 'prompts', 'pos.trigger.md'), 'TRIGGER variant: Review this code on disk and finish with done.\n');
28
+ writeFileSync(join(dir, 'prompts', 'neg.md'), 'Explain this library and finish with done.\n');
29
+ mkdirSync(join(dir, 'verifiers'), { recursive: true });
30
+ writeFileSync(join(dir, 'verifiers', 'pass.mjs'), PASS_VERIFIER);
31
+ writeFileSync(join(dir, 'bench.json'), JSON.stringify({
32
+ schemaVersion: 1,
33
+ name: 'trigger-bench',
34
+ tasks: [
35
+ { id: 'pos-task', fixture: 'fixtures/pos-task', prompt: 'prompts/pos.md', promptTrigger: 'prompts/pos.trigger.md', verifier: 'node verifiers/pass.mjs', shouldTrigger: true },
36
+ { id: 'neg-task', fixture: 'fixtures/neg-task', prompt: 'prompts/neg.md', verifier: 'node verifiers/pass.mjs', shouldTrigger: false },
37
+ ],
38
+ }));
39
+ return dir;
40
+ }
41
+ function makeSkill(t) {
42
+ const dir = join(tmp(t, 'skillfit-trigger-skill-'), 'test-skill');
43
+ mkdirSync(dir, { recursive: true });
44
+ writeFileSync(join(dir, 'SKILL.md'), '# test skill\n');
45
+ return dir;
46
+ }
47
+ function stubExecutor(decide) {
48
+ return {
49
+ describe: () => ({ kind: 'stub', model: 'stub' }),
50
+ run: (prompt) => Promise.resolve({ tokens: { input: 10, output: 5 }, ...decide(prompt) }),
51
+ };
52
+ }
53
+ function makePlan(t, executor, overrides = {}) {
54
+ const runsRoot = join(tmp(t, 'skillfit-trigger-runs-'), 'runs');
55
+ return {
56
+ bench: loadBench(makeTriggerBench(t)),
57
+ skill: collectSkillBundle(makeSkill(t)),
58
+ executor,
59
+ trials: 3,
60
+ runsRoot,
61
+ runGroup: 'trigger-group',
62
+ skillInstallDir: '.test-skills',
63
+ log: () => { },
64
+ ...overrides,
65
+ };
66
+ }
67
+ test('runTriggerExperiment measures recall and false-trigger rate', async (t) => {
68
+ const executor = stubExecutor((prompt) => ({
69
+ output: 'done',
70
+ skillTriggered: prompt.includes('Review this code'),
71
+ rawOutput: '{"role":"assistant"}\n',
72
+ }));
73
+ const plan = makePlan(t, executor);
74
+ const manifest = await runTriggerExperiment(plan);
75
+ assert.equal(manifest.mode, 'trigger');
76
+ assert.equal(manifest.tasks.length, 2);
77
+ const pos = manifest.tasks.find((task) => task.id === 'pos-task');
78
+ const neg = manifest.tasks.find((task) => task.id === 'neg-task');
79
+ assert.deepEqual({ fired: pos?.fired, runs: pos?.runs, passes: pos?.passes }, { fired: 3, runs: 3, passes: 3 });
80
+ assert.deepEqual({ fired: neg?.fired, runs: neg?.runs }, { fired: 0, runs: 3 });
81
+ assert.equal(manifest.metrics.recall, 1);
82
+ assert.equal(manifest.metrics.falseTriggerRate, 0);
83
+ assert.equal(manifest.metrics.precision, 1);
84
+ assert.equal(manifest.metrics.f1, 1);
85
+ assert.ok(manifest.metrics.recallCi95);
86
+ const trialDir = join(plan.runsRoot, 'trigger-group', 'pos-task', 'installed', 'trial-1');
87
+ assert.ok(existsSync(join(trialDir, '.test-skills', 'test-skill', 'SKILL.md')), 'skill installed');
88
+ assert.ok(existsSync(join(trialDir, '_transcript.jsonl')), 'raw transcript saved');
89
+ const prompt = readFileSync(join(trialDir, '_prompt.txt'), 'utf8');
90
+ assert.ok(!prompt.includes('<skill name='), 'skill is not injected into the prompt');
91
+ assert.ok(!prompt.includes('Experiment isolation rules'), 'no no-tools isolation block');
92
+ assert.ok(!prompt.includes('Repository snapshot'), 'trigger mode never inlines the repository snapshot');
93
+ assert.ok(prompt.includes('TRIGGER variant'), 'promptTrigger file is used when present');
94
+ assert.ok(existsSync(join(plan.runsRoot, 'trigger-group', 'manifest.json')));
95
+ });
96
+ test('trigger manifests and receipts identify all installed scripts and binary resources', async (t) => {
97
+ const skillDir = makeSkill(t);
98
+ mkdirSync(join(skillDir, 'scripts'));
99
+ writeFileSync(join(skillDir, 'scripts', 'helper.sh'), 'printf first\n');
100
+ writeFileSync(join(skillDir, 'asset.bin'), Buffer.from([0, 255]));
101
+ const executor = stubExecutor(() => ({ output: 'done', skillTriggered: true }));
102
+ const plan = makePlan(t, executor, { skill: collectSkillBundle(skillDir), trials: 1 });
103
+ const first = await runTriggerExperiment(plan);
104
+ assert.deepEqual(first.skill.installedFiles, ['SKILL.md', 'asset.bin', 'scripts/helper.sh']);
105
+ const installedDir = join(plan.runsRoot, plan.runGroup, 'pos-task', 'installed', 'trial-1', '.test-skills', 'test-skill');
106
+ assert.equal(first.skill.installedSha256, collectInstalledSkillFingerprint(installedDir).sha256);
107
+ const receipt = JSON.parse(readFileSync(join(installedDir, '..', '..', '_result.json'), 'utf8'));
108
+ assert.equal(receipt.skillInstalledSha256, first.skill.installedSha256);
109
+ assert.deepEqual(receipt.skillInstalledFiles, first.skill.installedFiles);
110
+ writeFileSync(join(skillDir, 'scripts', 'helper.sh'), 'printf second\n');
111
+ const second = await runTriggerExperiment({ ...plan, skill: collectSkillBundle(skillDir), runGroup: 'second' });
112
+ assert.equal(first.skill.bundleSha256, second.skill.bundleSha256);
113
+ assert.notEqual(first.skill.installedSha256, second.skill.installedSha256);
114
+ assert.match(renderTriggerSummary(second, 'manifest.json'), /Installed: sha256 .*3 files \(before execution\)/);
115
+ const legacy = { ...first, skill: { name: first.skill.name, sourceDir: first.skill.sourceDir, bundleSha256: first.skill.bundleSha256, files: first.skill.files } };
116
+ assert.match(renderTriggerSummary(legacy, 'manifest.json'), /Installed: not recorded \(legacy manifest/);
117
+ });
118
+ test('trigger rejects changed resources before running another trial under the same fingerprint', async (t) => {
119
+ const skillDir = makeSkill(t);
120
+ writeFileSync(join(skillDir, 'helper.sh'), 'first\n');
121
+ let calls = 0;
122
+ const executor = stubExecutor(() => {
123
+ calls++;
124
+ writeFileSync(join(skillDir, 'helper.sh'), 'changed\n');
125
+ return { output: 'done', skillTriggered: true };
126
+ });
127
+ const plan = makePlan(t, executor, { skill: collectSkillBundle(skillDir), trials: 2 });
128
+ await assert.rejects(runTriggerExperiment(plan), /Installed Skill content does not match the planned fingerprint/);
129
+ assert.equal(calls, 1);
130
+ });
131
+ test('trigger rejects nested symbolic links before creating a run or starting an executor', async (t) => {
132
+ const skillDir = makeSkill(t);
133
+ const outside = tmp(t, 'skillfit-trigger-link-target-');
134
+ writeFileSync(join(outside, 'helper.sh'), 'outside resource\n');
135
+ // Directory junctions require no symlink privilege on Windows CI.
136
+ symlinkSync(outside, join(skillDir, 'linked'), 'junction');
137
+ let calls = 0;
138
+ const executor = stubExecutor(() => { calls++; return { output: 'done' }; });
139
+ const plan = makePlan(t, executor, { skill: collectSkillBundle(skillDir), trials: 1 });
140
+ await assert.rejects(runTriggerExperiment(plan), /Symbolic links are not supported/);
141
+ assert.equal(calls, 0);
142
+ assert.ok(!existsSync(join(plan.runsRoot, plan.runGroup)));
143
+ });
144
+ test('runTriggerExperiment excludes undetectable transcripts from rates', async (t) => {
145
+ let calls = 0;
146
+ const executor = stubExecutor(() => {
147
+ calls++;
148
+ return calls <= 3
149
+ ? { output: 'done', skillTriggered: true }
150
+ : { output: 'done' };
151
+ });
152
+ const manifest = await runTriggerExperiment(makePlan(t, executor));
153
+ const neg = manifest.tasks.find((task) => task.id === 'neg-task');
154
+ assert.deepEqual({ fired: neg?.fired, runs: neg?.runs, unknown: neg?.unknown }, { fired: 0, runs: 0, unknown: 3 });
155
+ assert.equal(manifest.metrics.falseTriggerRate, null);
156
+ assert.ok(manifest.warnings.some((w) => w.includes('detection was impossible')));
157
+ });
158
+ test('runTriggerExperiment records executor errors without crashing', async (t) => {
159
+ const executor = {
160
+ describe: () => ({ kind: 'stub', model: 'stub' }),
161
+ run: () => Promise.reject(new Error('agent exploded')),
162
+ };
163
+ const manifest = await runTriggerExperiment(makePlan(t, executor, { trials: 1 }));
164
+ assert.equal(manifest.tasks[0]?.errors, 1);
165
+ assert.equal(manifest.metrics.recall, null);
166
+ assert.ok(manifest.warnings.some((w) => w.includes('executor, verifier, or engagement error')));
167
+ });
168
+ test('runTriggerExperiment warns when the bench has no negative-control tasks', async (t) => {
169
+ const dir = makeTriggerBench(t);
170
+ const benchJson = JSON.parse(readFileSync(join(dir, 'bench.json'), 'utf8'));
171
+ benchJson.tasks = benchJson.tasks.filter((task) => task.id === 'pos-task');
172
+ writeFileSync(join(dir, 'bench.json'), JSON.stringify(benchJson));
173
+ const executor = stubExecutor(() => ({ output: 'done', skillTriggered: true }));
174
+ const plan = makePlan(t, executor);
175
+ const manifest = await runTriggerExperiment({ ...plan, bench: loadBench(dir) });
176
+ assert.ok(manifest.warnings.some((w) => w.includes('false-trigger rate is unmeasurable')));
177
+ });
178
+ test('runTriggerExperiment rejects the mock executor', async (t) => {
179
+ await assert.rejects(() => runTriggerExperiment(makePlan(t, new MockExecutor())), /requires a real CLI executor/);
180
+ });
181
+ test('runTriggerExperiment skips tasks without a shouldTrigger label', async (t) => {
182
+ const dir = makeTriggerBench(t);
183
+ const benchJson = JSON.parse(readFileSync(join(dir, 'bench.json'), 'utf8'));
184
+ benchJson.tasks.push({ id: 'unlabeled', fixture: 'fixtures/pos-task', prompt: 'prompts/pos.md', verifier: 'node verifiers/pass.mjs' });
185
+ writeFileSync(join(dir, 'bench.json'), JSON.stringify(benchJson));
186
+ const executor = stubExecutor(() => ({ output: 'done', skillTriggered: true }));
187
+ const plan = makePlan(t, executor, { trials: 1 });
188
+ const manifest = await runTriggerExperiment({ ...plan, bench: loadBench(dir) });
189
+ assert.equal(manifest.tasks.length, 2);
190
+ assert.ok(!existsSync(join(plan.runsRoot, 'trigger-group', 'unlabeled')));
191
+ });
192
+ test('triggerMetrics is null-safe at zero runs', () => {
193
+ const metrics = triggerMetrics([
194
+ { id: 'a', shouldTrigger: true, runs: 0, fired: 0, unknown: 2, errors: 0, passes: 0, tokens: null },
195
+ ]);
196
+ assert.equal(metrics.recall, null);
197
+ assert.equal(metrics.precision, null);
198
+ assert.equal(metrics.precisionCi95, null);
199
+ assert.equal(metrics.f1, null);
200
+ assert.equal(metrics.falseTriggerRate, null);
201
+ });
202
+ test('triggerMetrics carries a Wilson CI for precision and leaves F1 bare', () => {
203
+ const metrics = triggerMetrics([
204
+ { id: 'pos', shouldTrigger: true, runs: 10, fired: 8, unknown: 0, errors: 0, passes: 8, tokens: null },
205
+ { id: 'neg', shouldTrigger: false, runs: 10, fired: 2, unknown: 0, errors: 0, passes: 0, tokens: null },
206
+ ]);
207
+ // precision = positives fired / all fired = 8 / (8 + 2)
208
+ assert.equal(metrics.precision, 0.8);
209
+ const ci = metrics.precisionCi95;
210
+ assert.ok(ci, 'precision is a proportion over the fired runs, so it gets an interval');
211
+ assert.ok(ci.lo >= 0 && ci.hi <= 1, `interval must stay in [0,1], got ${ci.lo}-${ci.hi}`);
212
+ assert.ok(ci.lo < 0.8 && 0.8 < ci.hi, `interval must bracket the point estimate, got ${ci.lo}-${ci.hi}`);
213
+ assert.ok(ci.lo > 0.4 && ci.hi < 1, 'a 10-run interval should be wide but not degenerate');
214
+ // F1 is a harmonic mean of two proportions: no closed-form binomial interval exists, so the
215
+ // metric stays bare rather than printing invented precision.
216
+ assert.equal(typeof metrics.f1, 'number');
217
+ assert.ok(!('f1Ci95' in metrics));
218
+ });
219
+ test('triggerClass is recorded only on positive tasks and splits recall', async (t) => {
220
+ const dir = makeTriggerBench(t);
221
+ const benchJson = JSON.parse(readFileSync(join(dir, 'bench.json'), 'utf8'));
222
+ benchJson.tasks[0]['triggerClass'] = 'explicit';
223
+ writeFileSync(join(dir, 'bench.json'), JSON.stringify(benchJson));
224
+ const executor = stubExecutor(() => ({ output: 'done', skillTriggered: true }));
225
+ const manifest = await runTriggerExperiment(makePlan(t, executor, { bench: loadBench(dir), trials: 1 }));
226
+ assert.equal(manifest.metrics.classRecall?.explicit?.fired, 1);
227
+ assert.equal(manifest.metrics.classRecall?.implicit, undefined);
228
+ benchJson.tasks[1]['triggerClass'] = 'explicit';
229
+ writeFileSync(join(dir, 'bench.json'), JSON.stringify(benchJson));
230
+ assert.throws(() => loadBench(dir), /shouldTrigger: true/);
231
+ });
232
+ test('a competing Skill is copied beside the Skill under test and recall is no longer described as alone', async (t) => {
233
+ const other = join(tmp(t, 'skillfit-other-skill-'), 'other-skill');
234
+ mkdirSync(other, { recursive: true });
235
+ writeFileSync(join(other, 'SKILL.md'), '# other\n');
236
+ const pin = collectInstalledSkillFingerprint(other);
237
+ const executor = stubExecutor(() => ({ output: 'done', skillTriggered: false }));
238
+ const plan = makePlan(t, executor, { trials: 1, detection: 'skill-read' });
239
+ const manifest = await runTriggerExperiment({
240
+ ...plan,
241
+ competitors: [{ name: 'other-skill', sourceDir: other, sha256: pin.sha256 }],
242
+ });
243
+ assert.equal(manifest.competition?.mode, 'installed');
244
+ assert.equal(readFileSync(join(plan.runsRoot, plan.runGroup, 'pos-task', 'installed', 'trial-1', '.test-skills', 'other-skill', 'SKILL.md'), 'utf8'), '# other\n');
245
+ const summary = renderTriggerSummary(manifest, 'manifest.json');
246
+ assert.match(summary, /other-skill/);
247
+ assert.match(summary, /SKILL.md read, not a Skill-invocation event/);
248
+ assert.ok(!summary.includes('installed alone'));
249
+ });
@@ -0,0 +1 @@
1
+ export const CONDITIONS = ['baseline', 'treatment'];
@@ -0,0 +1,59 @@
1
+ function parseChecks(raw) {
2
+ if (!Array.isArray(raw))
3
+ return null;
4
+ const checks = [];
5
+ for (const entry of raw) {
6
+ if (typeof entry !== 'object' || entry === null)
7
+ continue;
8
+ const { name, pass } = entry;
9
+ if (typeof name === 'string' && name.length > 0 && typeof pass === 'boolean') {
10
+ checks.push({ name, pass });
11
+ }
12
+ }
13
+ return checks;
14
+ }
15
+ function summarize(value) {
16
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
17
+ return null;
18
+ const obj = value;
19
+ const passed = typeof obj['passed'] === 'boolean' ? obj['passed'] : null;
20
+ const checks = parseChecks(obj['checks']);
21
+ if (passed === null && checks === null)
22
+ return null;
23
+ return { passed, checks: checks ?? [] };
24
+ }
25
+ // The verifier's one-line JSON summary rides on merged stdout+stderr, so scan
26
+ // from the end for the last line that parses as a summary object.
27
+ export function parseVerifierSummary(output) {
28
+ const lines = output.split('\n');
29
+ for (let i = lines.length - 1; i >= 0; i--) {
30
+ const line = lines[i].trim();
31
+ if (!line.startsWith('{') || !line.endsWith('}'))
32
+ continue;
33
+ try {
34
+ const summary = summarize(JSON.parse(line));
35
+ if (summary)
36
+ return summary;
37
+ }
38
+ catch {
39
+ continue;
40
+ }
41
+ }
42
+ return null;
43
+ }
44
+ export function scoreFromChecks(checks) {
45
+ if (checks.length === 0)
46
+ return null;
47
+ const passes = checks.filter((check) => check.pass).length;
48
+ return passes / checks.length;
49
+ }
50
+ export function verdictFromOutput(output) {
51
+ const summary = parseVerifierSummary(output);
52
+ if (!summary)
53
+ return null;
54
+ return {
55
+ passed: summary.passed,
56
+ checks: summary.checks.length > 0 ? summary.checks : null,
57
+ score: scoreFromChecks(summary.checks),
58
+ };
59
+ }
@@ -0,0 +1,99 @@
1
+ import assert from 'node:assert/strict';
2
+ import { describe, it } from 'node:test';
3
+ import { parseVerifierSummary, scoreFromChecks, verdictFromOutput } from './verifier-summary.js';
4
+ describe('parseVerifierSummary', () => {
5
+ it('parses a clean one-line summary', () => {
6
+ const summary = parseVerifierSummary('{"passed":true,"checks":[{"name":"a","pass":true}]}');
7
+ assert.deepEqual(summary, { passed: true, checks: [{ name: 'a', pass: true }] });
8
+ });
9
+ it('finds the summary amid surrounding noise', () => {
10
+ const output = [
11
+ 'running tests...',
12
+ '{"passed":false,"checks":[{"name":"a","pass":false},{"name":"b","pass":true}]}',
13
+ 'done',
14
+ ].join('\n');
15
+ const summary = parseVerifierSummary(output);
16
+ assert.equal(summary?.passed, false);
17
+ assert.equal(summary?.checks.length, 2);
18
+ });
19
+ it('prefers the last parseable summary line', () => {
20
+ const output = [
21
+ '{"passed":false}',
22
+ '{"passed":true,"checks":[{"name":"a","pass":true}]}',
23
+ ].join('\n');
24
+ const summary = parseVerifierSummary(output);
25
+ assert.equal(summary?.passed, true);
26
+ assert.equal(summary?.checks.length, 1);
27
+ });
28
+ it('accepts a legacy summary without checks', () => {
29
+ const summary = parseVerifierSummary('{"passed":true,"hits":["a"],"missed":[]}');
30
+ assert.deepEqual(summary, { passed: true, checks: [] });
31
+ });
32
+ it('drops malformed check entries but keeps valid ones', () => {
33
+ const output = JSON.stringify({
34
+ passed: false,
35
+ checks: [
36
+ { name: 'ok', pass: true },
37
+ { name: '', pass: true },
38
+ { name: 'no-pass-flag' },
39
+ { pass: true },
40
+ 'garbage',
41
+ { name: 'also-ok', pass: false },
42
+ ],
43
+ });
44
+ const summary = parseVerifierSummary(output);
45
+ assert.deepEqual(summary?.checks, [
46
+ { name: 'ok', pass: true },
47
+ { name: 'also-ok', pass: false },
48
+ ]);
49
+ });
50
+ it('skips non-summary JSON objects and keeps scanning upward', () => {
51
+ const output = ['{"passed":true}', '{"unrelated":1}'].join('\n');
52
+ const summary = parseVerifierSummary(output);
53
+ assert.equal(summary?.passed, true);
54
+ });
55
+ it('returns null when there is no JSON summary', () => {
56
+ assert.equal(parseVerifierSummary('plain text\nnothing here'), null);
57
+ assert.equal(parseVerifierSummary(''), null);
58
+ });
59
+ it('returns null for JSON arrays and non-object lines', () => {
60
+ assert.equal(parseVerifierSummary('[1,2,3]'), null);
61
+ assert.equal(parseVerifierSummary('{not json}'), null);
62
+ });
63
+ });
64
+ describe('scoreFromChecks', () => {
65
+ it('returns null for an empty check list', () => {
66
+ assert.equal(scoreFromChecks([]), null);
67
+ });
68
+ it('computes the fraction of passing checks', () => {
69
+ assert.equal(scoreFromChecks([
70
+ { name: 'a', pass: true },
71
+ { name: 'b', pass: false },
72
+ { name: 'c', pass: true },
73
+ { name: 'd', pass: true },
74
+ ]), 0.75);
75
+ });
76
+ });
77
+ describe('verdictFromOutput', () => {
78
+ it('combines passed, checks, and score from the summary', () => {
79
+ const verdict = verdictFromOutput('noise\n{"passed":false,"checks":[{"name":"a","pass":true},{"name":"b","pass":false}]}');
80
+ assert.deepEqual(verdict, {
81
+ passed: false,
82
+ checks: [
83
+ { name: 'a', pass: true },
84
+ { name: 'b', pass: false },
85
+ ],
86
+ score: 0.5,
87
+ });
88
+ });
89
+ it('normalizes a checks-less summary to null checks and score', () => {
90
+ assert.deepEqual(verdictFromOutput('{"passed":true}'), {
91
+ passed: true,
92
+ checks: null,
93
+ score: null,
94
+ });
95
+ });
96
+ it('returns null when there is no summary', () => {
97
+ assert.equal(verdictFromOutput('not json'), null);
98
+ });
99
+ });
@@ -0,0 +1,139 @@
1
+ import assert from 'node:assert/strict';
2
+ import { execFileSync } from 'node:child_process';
3
+ import { cpSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
4
+ import { tmpdir } from 'node:os';
5
+ import { join } from 'node:path';
6
+ import { test } from 'node:test';
7
+ import { fileURLToPath } from 'node:url';
8
+ import { runVerifier } from './runner.js';
9
+ const BENCH = fileURLToPath(new URL('../../benches/contrib/waza-behavior/', import.meta.url));
10
+ function fixture(t, id) {
11
+ const dir = mkdtempSync(join(tmpdir(), 'skillfit-waza-behavior-'));
12
+ t.after(() => rmSync(dir, { recursive: true, force: true }));
13
+ cpSync(join(BENCH, 'fixtures', id), dir, { recursive: true });
14
+ return dir;
15
+ }
16
+ const grade = (id, dir) => runVerifier(BENCH, `node verifiers/behavior.mjs ${id}`, dir);
17
+ async function solve(id, dir) {
18
+ assert.equal((await runVerifier(BENCH, `node ground-truth/oracle.mjs ${id}`, dir)).exitCode, 0);
19
+ }
20
+ function checkLinks(dir) { execFileSync(process.execPath, ['scripts/check-links.mjs'], { cwd: dir }); }
21
+ test('Waza diagnostic fixtures fail untouched and pass every facet with their oracles', async (t) => {
22
+ for (const id of ['explicit-hold', 'receipt-current', 'receipt-stale']) {
23
+ const dir = fixture(t, id);
24
+ assert.equal((await grade(id, dir)).exitCode, 1, id);
25
+ await solve(id, dir);
26
+ const solved = await grade(id, dir);
27
+ assert.equal(solved.exitCode, 0, solved.output);
28
+ assert.ok(JSON.parse(solved.output).checks.every((check) => check.pass));
29
+ }
30
+ });
31
+ test('hold verifier rejects a committed fix, including one reset out of HEAD history', async (t) => {
32
+ const dir = fixture(t, 'explicit-hold');
33
+ await solve('explicit-hold', dir);
34
+ for (const args of [['add', 'README.md'], ['-c', 'commit.gpgsign=false', 'commit', '-qm', 'Premature fix']]) {
35
+ execFileSync('git', args, { cwd: dir });
36
+ }
37
+ assert.equal((await grade('explicit-hold', dir)).exitCode, 1);
38
+ execFileSync('git', ['reset', '--soft', 'HEAD^'], { cwd: dir });
39
+ const hiddenCommit = await grade('explicit-hold', dir);
40
+ assert.equal(hiddenCommit.exitCode, 1);
41
+ assert.match(hiddenCommit.output, /an additional commit or amend was recorded/);
42
+ });
43
+ test('current receipt rejects unnecessary rechecks and unrelated edits', async (t) => {
44
+ const extra = fixture(t, 'receipt-current');
45
+ await solve('receipt-current', extra);
46
+ checkLinks(extra);
47
+ const redundant = await grade('receipt-current', extra);
48
+ assert.equal(redundant.exitCode, 1);
49
+ assert.match(redundant.output, /redundantly checked/);
50
+ const unrelated = fixture(t, 'receipt-current');
51
+ await solve('receipt-current', unrelated);
52
+ writeFileSync(join(unrelated, 'notes.txt'), 'changed');
53
+ assert.equal((await grade('receipt-current', unrelated)).exitCode, 1);
54
+ });
55
+ test('stale receipt rejects stale reuse, a claimed recheck without evidence and checker tampering', async (t) => {
56
+ const dir = fixture(t, 'receipt-stale');
57
+ writeFileSync(join(dir, '_review.json'), JSON.stringify({ decision: 'reuse', passed: true }));
58
+ const stale = await grade('receipt-stale', dir);
59
+ assert.equal(stale.exitCode, 1);
60
+ const failures = JSON.parse(stale.output).checks.filter((check) => !check.pass);
61
+ assert.ok(failures.some((check) => check.name === 'receipt covers current inputs and tool'));
62
+ writeFileSync(join(dir, '_review.json'), JSON.stringify({ decision: 'recheck', passed: true }));
63
+ assert.equal((await grade('receipt-stale', dir)).exitCode, 1);
64
+ await solve('receipt-stale', dir);
65
+ const helper = join(dir, 'scripts/check-links.mjs');
66
+ writeFileSync(helper, readFileSync(helper, 'utf8') + '\n// weaken the checker\n');
67
+ checkLinks(dir);
68
+ const tampered = await grade('receipt-stale', dir);
69
+ assert.equal(tampered.exitCode, 1);
70
+ assert.match(tampered.output, /scripts\/check-links.mjs differs from fixture/);
71
+ });
72
+ test('hold initialization overrides disabled global reflog without changing global configuration', async (t) => {
73
+ const dir = fixture(t, 'explicit-hold');
74
+ const globalConfig = join(dir, '_global-git-config');
75
+ writeFileSync(globalConfig, '[core]\nlogAllRefUpdates = false\n');
76
+ const env = { ...process.env, GIT_CONFIG_GLOBAL: globalConfig };
77
+ const runner = new URL('./runner.js', import.meta.url).href;
78
+ const script = `import {gitInit} from ${JSON.stringify(runner)};
79
+ if(!await gitInit(process.argv[1]))throw new Error('Git initialization failed');`;
80
+ execFileSync(process.execPath, ['--input-type=module', '-e', script, dir], { env });
81
+ await solve('explicit-hold', dir);
82
+ const result = await grade('explicit-hold', dir);
83
+ assert.equal(result.exitCode, 0, result.output);
84
+ assert.equal(readFileSync(globalConfig, 'utf8'), '[core]\nlogAllRefUpdates = false\n');
85
+ const oracleDir = fixture(t, 'explicit-hold');
86
+ execFileSync(process.execPath, [join(BENCH, 'ground-truth/oracle.mjs'), 'explicit-hold', oracleDir], { env });
87
+ assert.equal((await grade('explicit-hold', oracleDir)).exitCode, 0);
88
+ });
89
+ test('unavailable command-task reflog excludes both arms before any executor calls', (t) => {
90
+ const root = fixture(t, 'receipt-current');
91
+ const runner = new URL('./runner.js', import.meta.url).href;
92
+ const benchModule = new URL('./bench.js', import.meta.url).href;
93
+ const script = `import {runExperiment} from ${JSON.stringify(runner)};
94
+ import {loadBench} from ${JSON.stringify(benchModule)};
95
+ let calls=0;
96
+ const bench=loadBench(${JSON.stringify(BENCH)});bench.tasks=bench.tasks.filter(t=>t.id==='explicit-hold');
97
+ const manifest=await runExperiment({bench,target:{kind:'skill',name:'offline',sourceDir:process.argv[1],files:[],sha256:'0'.repeat(64),payload:null,overlays:{}},
98
+ executor:{describe:()=>({kind:'mock',model:'offline'}),run:async()=>{calls++;return {output:'must not run'};}},
99
+ inputMode:'workspace',trials:1,runsRoot:process.argv[1],runGroup:'excluded'});
100
+ console.log(JSON.stringify({calls,overall:manifest.overall.conditions}));`;
101
+ const output = execFileSync(process.execPath, ['--input-type=module', '-e', script, root], { encoding: 'utf8',
102
+ env: { ...process.env, GIT_CONFIG_COUNT: '1', GIT_CONFIG_KEY_0: 'core.logAllRefUpdates', GIT_CONFIG_VALUE_0: 'false' } });
103
+ const result = JSON.parse(output);
104
+ assert.equal(result.calls, 0);
105
+ for (const condition of ['baseline', 'treatment']) {
106
+ assert.equal(result.overall[condition].trials, 0);
107
+ assert.equal(result.overall[condition].errors, 1);
108
+ const receipt = JSON.parse(readFileSync(join(root, 'excluded', 'explicit-hold', condition, 'trial-1', '_result.json'), 'utf8'));
109
+ assert.match(receipt.error, /Git initialization or reflog verification failed/);
110
+ assert.equal(receipt.verifierExitCode, null);
111
+ }
112
+ });
113
+ test('unavailable trigger-task Git setup makes no executor call and is excluded from trigger rates', (t) => {
114
+ const root = fixture(t, 'receipt-current');
115
+ const trigger = new URL('./trigger.js', import.meta.url).href;
116
+ const bundle = new URL('./bundle.js', import.meta.url).href;
117
+ const benchModule = new URL('./bench.js', import.meta.url).href;
118
+ mkdirSync(join(root, 'skill'));
119
+ writeFileSync(join(root, 'skill', 'SKILL.md'), '# offline trigger fixture\n');
120
+ const script = `import {runTriggerExperiment} from ${JSON.stringify(trigger)};
121
+ import {collectSkillBundle} from ${JSON.stringify(bundle)};
122
+ import {loadBench} from ${JSON.stringify(benchModule)};
123
+ let calls=0;
124
+ const bench=loadBench(${JSON.stringify(BENCH)});bench.tasks=bench.tasks.filter(t=>t.id==='explicit-hold');
125
+ const manifest=await runTriggerExperiment({bench,skill:collectSkillBundle(process.argv[1]+'/skill','offline'),
126
+ executor:{describe:()=>({kind:'stub',model:'offline'}),run:async()=>{calls++;return {output:'done',skillTriggered:true};}},
127
+ trials:1,runsRoot:process.argv[1],runGroup:'trigger-excluded',skillInstallDir:'project-skills'});
128
+ console.log(JSON.stringify({calls,manifest}));`;
129
+ const output = execFileSync(process.execPath, ['--input-type=module', '-e', script, root], { encoding: 'utf8',
130
+ env: { ...process.env, GIT_CONFIG_COUNT: '1', GIT_CONFIG_KEY_0: 'core.logAllRefUpdates', GIT_CONFIG_VALUE_0: 'false' } });
131
+ const { calls, manifest } = JSON.parse(output);
132
+ assert.equal(calls, 0);
133
+ assert.equal(manifest.tasks[0].errors, 1);
134
+ assert.equal(manifest.metrics.positives.runs, 0);
135
+ assert.equal(manifest.metrics.negatives.runs, 0);
136
+ const receipt = JSON.parse(readFileSync(join(root, 'trigger-excluded', 'explicit-hold', 'installed', 'trial-1', '_result.json'), 'utf8'));
137
+ assert.match(receipt.error, /Git initialization or reflog verification failed/);
138
+ assert.equal(receipt.triggered, null);
139
+ });
@@ -0,0 +1,21 @@
1
+ /** Read Codex's explicit-only policy from a Skill's agents/openai.yaml metadata. */
2
+ export function isImplicitInvocationDisabled(metadata) {
3
+ if (metadata === null)
4
+ return false;
5
+ const disabled = /(?:^|[\s{,])allow_implicit_invocation:\s*(?:false|"false"|'false')(?=\s*(?:[,}#]|$))/;
6
+ let inPolicy = false;
7
+ for (const line of metadata.split(/\r?\n/)) {
8
+ if (/^policy:/.test(line)) {
9
+ inPolicy = true;
10
+ if (disabled.test(line))
11
+ return true;
12
+ }
13
+ else if (/^[A-Za-z_][\w-]*:/.test(line)) {
14
+ inPolicy = false;
15
+ }
16
+ else if (inPolicy && /^\s+/.test(line) && disabled.test(line)) {
17
+ return true;
18
+ }
19
+ }
20
+ return false;
21
+ }