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,94 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { createReadStream, existsSync, readdirSync, statSync } from 'node:fs';
3
+ import { homedir } from 'node:os';
4
+ import { join } from 'node:path';
5
+ import { createInterface } from 'node:readline';
6
+ import { getAgent } from '../agents.js';
7
+ function sessionsRoot(homeDir, env) {
8
+ const sessions = getAgent('kimi-code').sessions;
9
+ const fallback = '.kimi-code/sessions';
10
+ const relative = sessions?.dir.startsWith('~/') ? sessions.dir.slice(2) : (sessions?.dir ?? fallback);
11
+ // An injected home is a fixture root. Do not let the process environment redirect the read.
12
+ if (homeDir !== undefined)
13
+ return join(homeDir, relative);
14
+ const override = sessions?.homeOverride;
15
+ const overrideRoot = override === undefined ? undefined : env[override.env];
16
+ if (override && overrideRoot)
17
+ return join(overrideRoot, override.relativePath);
18
+ return join(homedir(), relative);
19
+ }
20
+ export function workDirKeyHash(workdir) {
21
+ return createHash('sha256').update(workdir.replaceAll('\\', '/'), 'utf8').digest('hex').slice(0, 12);
22
+ }
23
+ export async function probeKimiSessionUsage(workdir, startedAtMs, homeDir, env = process.env) {
24
+ const root = sessionsRoot(homeDir, env);
25
+ if (!existsSync(root))
26
+ return undefined;
27
+ const suffix = `_${workDirKeyHash(workdir)}`;
28
+ let buckets;
29
+ try {
30
+ buckets = readdirSync(root, { withFileTypes: true });
31
+ }
32
+ catch {
33
+ return undefined;
34
+ }
35
+ let newest = null;
36
+ for (const bucket of buckets) {
37
+ if (!bucket.isDirectory() || !bucket.name.endsWith(suffix))
38
+ continue;
39
+ let sessions;
40
+ try {
41
+ sessions = readdirSync(join(root, bucket.name), { withFileTypes: true });
42
+ }
43
+ catch {
44
+ continue;
45
+ }
46
+ for (const session of sessions) {
47
+ const wire = join(root, bucket.name, session.name, 'agents', 'main', 'wire.jsonl');
48
+ if (!existsSync(wire))
49
+ continue;
50
+ const mtime = statSync(wire).mtimeMs;
51
+ if (mtime < startedAtMs - 5000)
52
+ continue;
53
+ if (!newest || mtime > newest.mtime)
54
+ newest = { file: wire, mtime };
55
+ }
56
+ }
57
+ if (!newest)
58
+ return undefined;
59
+ return usageFromWire(newest.file);
60
+ }
61
+ async function usageFromWire(file) {
62
+ const lines = createInterface({ input: createReadStream(file, { encoding: 'utf8' }), crlfDelay: Infinity });
63
+ let input = 0;
64
+ let output = 0;
65
+ let seen = false;
66
+ try {
67
+ for await (const line of lines) {
68
+ if (!line.includes('usage.record'))
69
+ continue;
70
+ let event;
71
+ try {
72
+ event = JSON.parse(line);
73
+ }
74
+ catch {
75
+ continue;
76
+ }
77
+ if (typeof event !== 'object' || event === null)
78
+ continue;
79
+ const record = event;
80
+ if (record['type'] !== 'usage.record')
81
+ continue;
82
+ const usage = record['usage'];
83
+ if (typeof usage !== 'object' || usage === null)
84
+ continue;
85
+ seen = true;
86
+ input += (usage.inputOther ?? 0) + (usage.inputCacheRead ?? 0) + (usage.inputCacheCreation ?? 0);
87
+ output += usage.output ?? 0;
88
+ }
89
+ }
90
+ finally {
91
+ lines.close();
92
+ }
93
+ return seen ? { input, output } : undefined;
94
+ }
@@ -0,0 +1,62 @@
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 { probeKimiSessionUsage, workDirKeyHash } from './kimi-usage.js';
7
+ function fakeSession(t, home, workdir, wireLines) {
8
+ const sessionDir = join(home, '.kimi-code', 'sessions', `wd_task_${workDirKeyHash(workdir)}`, 'sess-1', 'agents', 'main');
9
+ mkdirSync(sessionDir, { recursive: true });
10
+ t.after(() => rmSync(join(home, '.kimi-code'), { recursive: true, force: true }));
11
+ const wire = join(sessionDir, 'wire.jsonl');
12
+ writeFileSync(wire, wireLines.join('\n'));
13
+ return wire;
14
+ }
15
+ test('workDirKeyHash matches the documented first-12-of-sha256 scheme', () => {
16
+ assert.equal(workDirKeyHash('E:\\code\\agents\\skillfit'), '0ab26300da72');
17
+ });
18
+ test('probeKimiSessionUsage sums usage.record input parts and output', async (t) => {
19
+ const home = mkdtempSync(join(tmpdir(), 'skillfit-kimi-usage-'));
20
+ t.after(() => rmSync(home, { recursive: true, force: true }));
21
+ const workdir = join(home, 'run');
22
+ fakeSession(t, home, workdir, [
23
+ '{"type":"metadata"}',
24
+ '{"type":"usage.record","agentId":"main","usage":{"inputOther":100,"output":10,"inputCacheRead":40,"inputCacheCreation":5}}',
25
+ '{"type":"usage.record","agentId":"agent-3","usage":{"inputOther":7,"output":3}}',
26
+ 'garbage',
27
+ ]);
28
+ const usage = await probeKimiSessionUsage(workdir, Date.now() - 60_000, home);
29
+ assert.deepEqual(usage, { input: 152, output: 13 });
30
+ });
31
+ test('probeKimiSessionUsage ignores KIMI_CODE_HOME when a fixture home is injected', async (t) => {
32
+ const home = mkdtempSync(join(tmpdir(), 'skillfit-kimi-usage-'));
33
+ t.after(() => rmSync(home, { recursive: true, force: true }));
34
+ const workdir = join(home, 'run');
35
+ fakeSession(t, home, workdir, [
36
+ '{"type":"usage.record","usage":{"inputOther":4,"output":2}}',
37
+ ]);
38
+ const previous = process.env['KIMI_CODE_HOME'];
39
+ process.env['KIMI_CODE_HOME'] = join(home, 'missing-kimi-home');
40
+ try {
41
+ assert.deepEqual(await probeKimiSessionUsage(workdir, Date.now() - 60_000, home), { input: 4, output: 2 });
42
+ }
43
+ finally {
44
+ if (previous === undefined)
45
+ delete process.env['KIMI_CODE_HOME'];
46
+ else
47
+ process.env['KIMI_CODE_HOME'] = previous;
48
+ }
49
+ });
50
+ test('probeKimiSessionUsage ignores stale sessions and unknown workdirs', async (t) => {
51
+ const home = mkdtempSync(join(tmpdir(), 'skillfit-kimi-usage-'));
52
+ t.after(() => rmSync(home, { recursive: true, force: true }));
53
+ const workdir = join(home, 'run');
54
+ const wire = fakeSession(t, home, workdir, [
55
+ '{"type":"usage.record","usage":{"inputOther":1,"output":1}}',
56
+ ]);
57
+ const stale = Date.now() + 60_000;
58
+ assert.equal(await probeKimiSessionUsage(workdir, stale, home), undefined);
59
+ assert.equal(await probeKimiSessionUsage(join(home, 'elsewhere'), Date.now() - 60_000, home), undefined);
60
+ rmSync(wire);
61
+ assert.equal(await probeKimiSessionUsage(workdir, Date.now() - 60_000, home), undefined);
62
+ });
@@ -0,0 +1,79 @@
1
+ import assert from 'node:assert/strict';
2
+ import { cpSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
3
+ import { tmpdir } from 'node:os';
4
+ import { join } from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
6
+ import { test } from 'node:test';
7
+ import { loadBench } from './bench.js';
8
+ import { sha256File } from './hash.js';
9
+ import { runVerifier } from './runner.js';
10
+ import { verdictFromOutput } from './verifier-summary.js';
11
+ const root = fileURLToPath(new URL('../../benches/contrib/oss-lru-cache/', import.meta.url));
12
+ const bench = loadBench(root);
13
+ for (const task of bench.tasks)
14
+ test(`OSS lru-cache ${task.id}: original failure, full oracle and counterexamples`, async (t) => {
15
+ const dir = mkdtempSync(join(tmpdir(), 'skillfit-lru-gates-'));
16
+ t.after(() => rmSync(dir, { recursive: true, force: true }));
17
+ cpSync(join(root, task.fixture), dir, { recursive: true });
18
+ const nop = await runVerifier(root, task.verifier, dir);
19
+ assert.equal(nop.exitCode, 1);
20
+ const original = verdictFromOutput(nop.output);
21
+ assert.ok(original && original.score !== null && original.score > 0 && original.score < 1);
22
+ const specific = task.id === 'fetch-size' ? /out-of-order/ : task.id === 'fetch-abort' ? /deleted pending fetch/ : /onInsert hides/;
23
+ assert.ok(original.checks.some(c => specific.test(c.name) && !c.pass), 'the historical behavior failure must be reproduced');
24
+ assert.equal((await runVerifier(root, task.oracle, dir)).exitCode, 0);
25
+ const fixed = await runVerifier(root, task.verifier, dir);
26
+ assert.equal(fixed.exitCode, 0, fixed.output);
27
+ assert.equal(verdictFromOutput(fixed.output)?.score, 1);
28
+ if (task.id === 'fetch-abort') {
29
+ const source = join(dir, 'index.js');
30
+ const bytes = readFileSync(source, 'utf8');
31
+ writeFileSync(source, bytes.replaceAll("abort(new Error('deleted'))", 'abort()').replaceAll("abort(new Error('evicted'))", 'abort()').replaceAll("abort(new Error('replaced'))", 'abort()'));
32
+ writeFileSync(join(dir, 'regression.test.mjs'), `import assert from 'node:assert/strict'; import { test } from 'node:test'; import Cache from './index.js';
33
+ test('reject the actual signal reason before provider completion', async () => { let release,signal; const c=new Cache({max:2,fetchMethod:(k,v,o)=>{signal=o.signal;return new Promise(r=>release=r)}});
34
+ let error; const p=c.fetch('x').catch(e=>error=e); c.delete('x'); await new Promise(r=>setImmediate(r)); const before=error;
35
+ release('late'); await p; assert.equal(before,signal.reason); assert.equal(c.has('x'),false); });\n`);
36
+ const actualReason = await runVerifier(root, task.verifier, dir);
37
+ assert.equal(actualReason.exitCode, 0, actualReason.output);
38
+ writeFileSync(source, bytes);
39
+ await runVerifier(root, task.oracle, dir);
40
+ }
41
+ const regression = join(dir, 'regression.test.mjs');
42
+ const bytes = readFileSync(regression);
43
+ writeFileSync(regression, "import { test } from 'node:test'; test('vacuous', () => {});\n");
44
+ const vacuous = await runVerifier(root, task.verifier, dir);
45
+ assert.equal(vacuous.exitCode, 1);
46
+ assert.equal(verdictFromOutput(vacuous.output)?.checks?.at(-1)?.pass, false);
47
+ writeFileSync(regression, bytes);
48
+ const source = join(dir, task.id === 'fetch-lifecycle' ? 'src/index.ts' : 'index.js');
49
+ const fixedBytes = readFileSync(source);
50
+ writeFileSync(source, fixedBytes.toString() + (task.id === 'fetch-lifecycle' ? '\nLRUCache.unrelatedReviewMarker = 42\n' : '\nmodule.exports.unrelatedReviewMarker = 42\n'));
51
+ writeFileSync(regression, `import assert from 'node:assert/strict'; import { test } from 'node:test';
52
+ import { loadCache } from './runtime.mjs'; import { dirname } from 'node:path'; import { fileURLToPath } from 'node:url';
53
+ const { Cache, cleanup } = await loadCache(dirname(fileURLToPath(import.meta.url)), ${task.id === 'fetch-lifecycle'});
54
+ test('only an unrelated marker', () => { assert.equal(Cache.unrelatedReviewMarker, 42); cleanup(); });\n`);
55
+ const unrelated = await runVerifier(root, task.verifier, dir);
56
+ assert.equal(unrelated.exitCode, 1);
57
+ assert.equal(verdictFromOutput(unrelated.output)?.checks?.at(-1)?.pass, false);
58
+ assert.match(unrelated.output, /"finalPassed":true,"originalFailed":true,"referencePassed":false/);
59
+ writeFileSync(source, fixedBytes);
60
+ writeFileSync(regression, bytes);
61
+ const smoke = join(dir, 'test.mjs');
62
+ writeFileSync(smoke, readFileSync(smoke, 'utf8') + '\n// tampered protected test\n');
63
+ assert.equal((await runVerifier(root, task.verifier, dir)).exitCode, 1);
64
+ cpSync(join(root, task.fixture, 'test.mjs'), smoke);
65
+ writeFileSync(source, 'process.exit(0)\n' + readFileSync(source, 'utf8'));
66
+ const earlyExit = await runVerifier(root, task.verifier, dir);
67
+ assert.equal(earlyExit.exitCode, 1);
68
+ assert.ok(verdictFromOutput(earlyExit.output)?.checks?.some(c => c.name === 'runtime probe completeness' && !c.pass));
69
+ });
70
+ test('OSS replay provenance matches every retained upstream source and license byte', () => {
71
+ const provenance = JSON.parse(readFileSync(join(root, 'provenance.json'), 'utf8'));
72
+ for (const item of provenance.cases)
73
+ for (const [key, hash] of Object.entries(item.sourceSha256)) {
74
+ const split = key.indexOf(':');
75
+ const arm = key.slice(0, split);
76
+ const rel = key.slice(split + 1);
77
+ assert.equal(sha256File(join(root, arm === 'pre' ? 'fixtures' : 'ground-truth', item.id, rel)), hash);
78
+ }
79
+ });
@@ -0,0 +1,89 @@
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 { fileURLToPath, pathToFileURL } from 'node:url';
6
+ import { test } from 'node:test';
7
+ const bench = fileURLToPath(new URL('../../benches/contrib/oss-lru-cache/', import.meta.url));
8
+ const { regressionEvidence } = await import(pathToFileURL(join(bench, 'verifiers/shared.mjs')).href);
9
+ function fixture(t, body, original, submitted, reference) {
10
+ const root = mkdtempSync(join(tmpdir(), 'skillfit-witness-'));
11
+ t.after(() => rmSync(root, { recursive: true, force: true }));
12
+ const dirs = ['submitted', 'original', 'reference'].map(name => join(root, name));
13
+ const implementations = [submitted ?? 'export const fixed=true; export const supported=true; export const marker=42;',
14
+ original ?? 'export const fixed=false; export const supported=true; export const marker=undefined;',
15
+ reference ?? 'export const fixed=true; export const supported=false; export const marker=undefined;'];
16
+ dirs.forEach((dir, i) => { mkdirSync(dir); writeFileSync(join(dir, 'impl.mjs'), implementations[i]); });
17
+ writeFileSync(join(dirs[0], 'regression.test.mjs'), `import assert from 'node:assert/strict'; import { test } from 'node:test';
18
+ import { fixed, supported, marker } from './impl.mjs';\n${body}\n`);
19
+ return regressionEvidence(dirs[0], dirs[1], dirs[2], 'impl.mjs')[0];
20
+ }
21
+ const accepted = (row) => row.finalPassed && row.caseWitnesses.length > 0;
22
+ test('case evidence accepts a stronger suite while retaining the actual historical failure witness', t => {
23
+ const row = fixture(t, "test('historical bug', () => assert.equal(fixed,true)); test('existing supported behavior', () => assert.equal(supported,true));");
24
+ assert.equal(row.finalPassed, true);
25
+ assert.equal(row.referencePassed, false);
26
+ assert.equal(accepted(row), true);
27
+ assert.deepEqual(row.caseWitnesses.map(w => w.path), [['historical bug']]);
28
+ });
29
+ test('case evidence rejects an unrelated field even when it creates file-level RED to GREEN', t => {
30
+ const row = fixture(t, "test('unrelated marker', () => assert.equal(marker,42));");
31
+ assert.equal(row.finalPassed, true);
32
+ assert.equal(row.originalFailed, true);
33
+ assert.equal(row.referencePassed, false);
34
+ assert.equal(accepted(row), false);
35
+ });
36
+ test('duplicate full test identities cannot supply a witness', t => {
37
+ const row = fixture(t, "test('duplicate', () => assert.equal(fixed,true)); test('duplicate', () => assert.equal(fixed,true));");
38
+ assert.equal(row.finalPassed, true);
39
+ assert.equal(accepted(row), false);
40
+ });
41
+ test('the full parent path distinguishes same-named tests in different suites', t => {
42
+ const row = fixture(t, "test('cache suite', async t => { await t.test('same name', () => assert.equal(fixed,true)); }); test('other suite', async t => { await t.test('same name', () => assert.equal(supported,true)); });");
43
+ assert.equal(accepted(row), true);
44
+ assert.deepEqual(row.caseWitnesses.map(w => w.path), [['cache suite', 'same name']]);
45
+ });
46
+ test('submitted skip and todo tests never count as completed regression evidence', t => {
47
+ for (const option of ['skip', 'todo']) {
48
+ const row = fixture(t, `test('historical bug', {${option}:true}, () => assert.equal(fixed,true));`);
49
+ assert.equal(row.finalPassed, false);
50
+ assert.equal(accepted(row), false);
51
+ }
52
+ });
53
+ test('original cancellations and timeouts cannot supply a failure witness', t => {
54
+ for (const body of ["test('historical bug', async () => { if(!fixed) await new Promise(() => {}); });",
55
+ "test('historical bug', {timeout:20}, async () => { if(!fixed) await new Promise(res => setTimeout(res,200)); });"]) {
56
+ const row = fixture(t, body);
57
+ assert.equal(row.finalPassed, true);
58
+ assert.equal(accepted(row), false);
59
+ }
60
+ });
61
+ test('original import failure and process exit cannot supply a failure witness', t => {
62
+ for (const code of ["throw new Error('import failure'); export const fixed=false,supported=true,marker=undefined;",
63
+ 'process.exit(1); export const fixed=false,supported=true,marker=undefined;']) {
64
+ const row = fixture(t, "test('historical bug', () => assert.equal(fixed,true));", code);
65
+ assert.equal(row.finalPassed, true);
66
+ assert.equal(accepted(row), false);
67
+ }
68
+ });
69
+ test('test stdout and diagnostic text cannot impersonate reporter events', t => {
70
+ const spoof = "console.log(JSON.stringify({schemaVersion:1,kind:'node-test-evidence',summary:{success:true,counts:{tests:1,skipped:0,todo:0,cancelled:0}},records:[]}));";
71
+ const row = fixture(t, `${spoof} test('vacuous', t => { t.diagnostic('not ok 1 - historical bug'); });`);
72
+ assert.equal(row.finalPassed, true);
73
+ assert.equal(accepted(row), false);
74
+ const failed = fixture(t, `${spoof} test('actually fails', () => assert.fail('real failure'));`);
75
+ assert.equal(failed.finalPassed, false);
76
+ assert.equal(accepted(failed), false);
77
+ });
78
+ test('submitted early exit cannot impersonate a passing test suite', t => {
79
+ const row = fixture(t, "process.exit(0); test('historical bug', () => assert.equal(fixed,true));");
80
+ assert.equal(row.finalPassed, false);
81
+ assert.equal(accepted(row), false);
82
+ });
83
+ test('an unrelated whole-suite timeout is not evidence; an isolated completed assertion can establish the witness', t => {
84
+ const row = fixture(t, `test('historical bug', () => assert.equal(fixed,true));
85
+ test('stronger extra behavior', async () => { if(!fixed) await new Promise(res => setTimeout(res,10000)); assert.equal(supported,true); });`);
86
+ assert.equal(row.finalPassed, true);
87
+ assert.equal(accepted(row), true);
88
+ assert.deepEqual(row.caseWitnesses.map(w => w.path), [['historical bug']]);
89
+ });
@@ -0,0 +1,57 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { MOCK_MARKER_FILE } from './constants.js';
4
+ import { listFilesRecursive } from './hash.js';
5
+ export const ISOLATION_RULES = `Experiment isolation rules:
6
+ - Do not use tools, browse the web, or read anything outside this prompt.
7
+ - Treat the repository snapshot below as the complete task input.
8
+ - Hidden grading runs only after you exit; produce the deliverable the task asks for instead of explaining a possible solution.`;
9
+ export const WORKSPACE_RULES = `Workspace rules:
10
+ - The repository in the snapshot below is also your current working directory: inspect, edit, and run things there directly.
11
+ - Hidden grading runs only after you exit; produce the deliverable the task asks for instead of explaining a possible solution.`;
12
+ export const OUTPUT_CONTRACT = `Output contract:
13
+ - Your final message is the deliverable; it is captured to _output.md and graded.
14
+ - Follow the deliverable format requested by the task exactly.`;
15
+ const WORKSPACE_INPUT_RULES = `Workspace rules:
16
+ - The task files are in your current working directory. Inspect, edit, and run them there.
17
+ - Work locally; do not access the network or another checkout for a solution.
18
+ - Hidden grading runs only after you exit. Deliver the requested changes or answer.
19
+ - Your final message is captured to _output.md; summarize changes and checks when the task asks for code changes.`;
20
+ export function assertInputModeSupported(inputMode, executor) {
21
+ if (inputMode !== 'snapshot' && inputMode !== 'workspace') {
22
+ throw new Error(`Unknown input mode: ${inputMode} (expected "snapshot" or "workspace")`);
23
+ }
24
+ if (inputMode === 'workspace' && executor && !['cli', 'mock'].includes(executor.describe().kind)) {
25
+ throw new Error('workspace input requires a CLI executor with filesystem access; use --agent <id>.');
26
+ }
27
+ }
28
+ function isVisibleToAgent(rel) {
29
+ const parts = rel.split('/');
30
+ if (parts.includes('.git'))
31
+ return false;
32
+ const base = parts[parts.length - 1];
33
+ if (!base || base.startsWith('_'))
34
+ return false;
35
+ if (base === MOCK_MARKER_FILE)
36
+ return false;
37
+ return true;
38
+ }
39
+ export function snapshotRepoFiles(runDir) {
40
+ const files = listFilesRecursive(runDir).filter(isVisibleToAgent);
41
+ return files
42
+ .map((rel) => `--- repository file: ${rel} ---\n${readFileSync(join(runDir, rel), 'utf8')}`)
43
+ .join('\n');
44
+ }
45
+ export function buildTaskPrompt(taskPromptText, snapshot, skillPayload, opts) {
46
+ if (opts?.inputMode === 'workspace') {
47
+ const sections = [taskPromptText.trimEnd(), WORKSPACE_INPUT_RULES];
48
+ if (skillPayload)
49
+ sections.push(skillPayload);
50
+ return `${sections.join('\n\n')}\n`;
51
+ }
52
+ const sections = [taskPromptText.trimEnd(), opts?.workspace ? WORKSPACE_RULES : ISOLATION_RULES, `Repository snapshot:\n\n${snapshot}`];
53
+ if (skillPayload)
54
+ sections.push(skillPayload);
55
+ sections.push(OUTPUT_CONTRACT);
56
+ return `${sections.join('\n\n')}\n`;
57
+ }
@@ -0,0 +1,48 @@
1
+ import assert from 'node:assert/strict';
2
+ import { mkdtempSync, mkdirSync, 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 { buildTaskPrompt, snapshotRepoFiles } from './prompt.js';
7
+ function makeRepo(t) {
8
+ const dir = mkdtempSync(join(tmpdir(), 'skillfit-prompt-'));
9
+ t.after(() => rmSync(dir, { recursive: true, force: true }));
10
+ mkdirSync(join(dir, '.git'), { recursive: true });
11
+ mkdirSync(join(dir, 'src'), { recursive: true });
12
+ writeFileSync(join(dir, 'src', 'a.js'), 'export const a = 1;\n');
13
+ writeFileSync(join(dir, '.git', 'config'), '[core]\n');
14
+ writeFileSync(join(dir, '_prompt.txt'), 'hidden\n');
15
+ writeFileSync(join(dir, '.skillfit-mock.json'), '{}\n');
16
+ return dir;
17
+ }
18
+ test('snapshotRepoFiles hides .git, underscore files and the mock marker', (t) => {
19
+ const dir = makeRepo(t);
20
+ const snapshot = snapshotRepoFiles(dir);
21
+ assert.match(snapshot, /--- repository file: src\/a\.js ---/);
22
+ assert.match(snapshot, /export const a = 1;/);
23
+ assert.ok(!snapshot.includes('.git'));
24
+ assert.ok(!snapshot.includes('hidden'));
25
+ assert.ok(!snapshot.includes('skillfit-mock'));
26
+ });
27
+ test('buildTaskPrompt omits the skill block for baseline', () => {
28
+ const prompt = buildTaskPrompt('Do the task.\n', '--- repository file: a ---\n1', null);
29
+ assert.match(prompt, /^Do the task\./);
30
+ assert.match(prompt, /Experiment isolation rules:/);
31
+ assert.match(prompt, /Repository snapshot:/);
32
+ assert.match(prompt, /Output contract:/);
33
+ assert.ok(!prompt.includes('<skill name='));
34
+ });
35
+ test('buildTaskPrompt embeds the skill payload for treatment', () => {
36
+ const prompt = buildTaskPrompt('Do the task.', 'snapshot', 'Treatment material:\n<skill name="s">X</skill>');
37
+ assert.match(prompt, /<skill name="s">X<\/skill>/);
38
+ assert.ok(prompt.indexOf('<skill name=') > prompt.indexOf('Repository snapshot:'));
39
+ assert.ok(prompt.indexOf('Output contract:') > prompt.indexOf('<skill name='));
40
+ });
41
+ test('buildTaskPrompt workspace mode swaps isolation rules for workspace rules', () => {
42
+ const prompt = buildTaskPrompt('Fix the code.', 'snapshot', null, { workspace: true });
43
+ assert.match(prompt, /Workspace rules:/);
44
+ assert.match(prompt, /inspect, edit, and run/);
45
+ assert.ok(!prompt.includes('Experiment isolation rules'));
46
+ const isolated = buildTaskPrompt('Fix the code.', 'snapshot', null);
47
+ assert.match(isolated, /Experiment isolation rules:/);
48
+ });