claude-test-bench 1.0.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 (314) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +474 -0
  3. package/dist/bin/ctb.d.ts +3 -0
  4. package/dist/bin/ctb.d.ts.map +1 -0
  5. package/dist/bin/ctb.js +107 -0
  6. package/dist/bin/ctb.js.map +1 -0
  7. package/dist/server/index.d.ts +13 -0
  8. package/dist/server/index.d.ts.map +1 -0
  9. package/dist/server/index.js +72 -0
  10. package/dist/server/index.js.map +1 -0
  11. package/dist/server/interfaces/evaluator.d.ts +15 -0
  12. package/dist/server/interfaces/evaluator.d.ts.map +1 -0
  13. package/dist/server/interfaces/evaluator.js +2 -0
  14. package/dist/server/interfaces/evaluator.js.map +1 -0
  15. package/dist/server/interfaces/logger.d.ts +9 -0
  16. package/dist/server/interfaces/logger.d.ts.map +1 -0
  17. package/dist/server/interfaces/logger.js +2 -0
  18. package/dist/server/interfaces/logger.js.map +1 -0
  19. package/dist/server/interfaces/runner.d.ts +9 -0
  20. package/dist/server/interfaces/runner.d.ts.map +1 -0
  21. package/dist/server/interfaces/runner.js +2 -0
  22. package/dist/server/interfaces/runner.js.map +1 -0
  23. package/dist/server/interfaces/storage.d.ts +36 -0
  24. package/dist/server/interfaces/storage.d.ts.map +1 -0
  25. package/dist/server/interfaces/storage.js +2 -0
  26. package/dist/server/interfaces/storage.js.map +1 -0
  27. package/dist/server/interfaces/workspace.d.ts +9 -0
  28. package/dist/server/interfaces/workspace.d.ts.map +1 -0
  29. package/dist/server/interfaces/workspace.js +2 -0
  30. package/dist/server/interfaces/workspace.js.map +1 -0
  31. package/dist/server/routes/eval-queue.d.ts +23 -0
  32. package/dist/server/routes/eval-queue.d.ts.map +1 -0
  33. package/dist/server/routes/eval-queue.js +45 -0
  34. package/dist/server/routes/eval-queue.js.map +1 -0
  35. package/dist/server/routes/evaluations.d.ts +8 -0
  36. package/dist/server/routes/evaluations.d.ts.map +1 -0
  37. package/dist/server/routes/evaluations.js +217 -0
  38. package/dist/server/routes/evaluations.js.map +1 -0
  39. package/dist/server/routes/providers.d.ts +5 -0
  40. package/dist/server/routes/providers.d.ts.map +1 -0
  41. package/dist/server/routes/providers.js +194 -0
  42. package/dist/server/routes/providers.js.map +1 -0
  43. package/dist/server/routes/run-queue.d.ts +17 -0
  44. package/dist/server/routes/run-queue.d.ts.map +1 -0
  45. package/dist/server/routes/run-queue.js +34 -0
  46. package/dist/server/routes/run-queue.js.map +1 -0
  47. package/dist/server/routes/run-sse.d.ts +18 -0
  48. package/dist/server/routes/run-sse.d.ts.map +1 -0
  49. package/dist/server/routes/run-sse.js +57 -0
  50. package/dist/server/routes/run-sse.js.map +1 -0
  51. package/dist/server/routes/runs.d.ts +9 -0
  52. package/dist/server/routes/runs.d.ts.map +1 -0
  53. package/dist/server/routes/runs.js +379 -0
  54. package/dist/server/routes/runs.js.map +1 -0
  55. package/dist/server/routes/scenarios.d.ts +5 -0
  56. package/dist/server/routes/scenarios.d.ts.map +1 -0
  57. package/dist/server/routes/scenarios.js +209 -0
  58. package/dist/server/routes/scenarios.js.map +1 -0
  59. package/dist/server/routes/setups.d.ts +5 -0
  60. package/dist/server/routes/setups.d.ts.map +1 -0
  61. package/dist/server/routes/setups.js +194 -0
  62. package/dist/server/routes/setups.js.map +1 -0
  63. package/dist/server/services/agent-mapper.d.ts +12 -0
  64. package/dist/server/services/agent-mapper.d.ts.map +1 -0
  65. package/dist/server/services/agent-mapper.js +75 -0
  66. package/dist/server/services/agent-mapper.js.map +1 -0
  67. package/dist/server/services/env-builder.d.ts +10 -0
  68. package/dist/server/services/env-builder.d.ts.map +1 -0
  69. package/dist/server/services/env-builder.js +50 -0
  70. package/dist/server/services/env-builder.js.map +1 -0
  71. package/dist/server/services/eval-helpers.d.ts +22 -0
  72. package/dist/server/services/eval-helpers.d.ts.map +1 -0
  73. package/dist/server/services/eval-helpers.js +75 -0
  74. package/dist/server/services/eval-helpers.js.map +1 -0
  75. package/dist/server/services/eval-parsers-debate-impl.d.ts +11 -0
  76. package/dist/server/services/eval-parsers-debate-impl.d.ts.map +1 -0
  77. package/dist/server/services/eval-parsers-debate-impl.js +133 -0
  78. package/dist/server/services/eval-parsers-debate-impl.js.map +1 -0
  79. package/dist/server/services/eval-parsers.d.ts +24 -0
  80. package/dist/server/services/eval-parsers.d.ts.map +1 -0
  81. package/dist/server/services/eval-parsers.js +153 -0
  82. package/dist/server/services/eval-parsers.js.map +1 -0
  83. package/dist/server/services/eval-prompts.d.ts +9 -0
  84. package/dist/server/services/eval-prompts.d.ts.map +1 -0
  85. package/dist/server/services/eval-prompts.js +170 -0
  86. package/dist/server/services/eval-prompts.js.map +1 -0
  87. package/dist/server/services/evaluator.d.ts +10 -0
  88. package/dist/server/services/evaluator.d.ts.map +1 -0
  89. package/dist/server/services/evaluator.js +156 -0
  90. package/dist/server/services/evaluator.js.map +1 -0
  91. package/dist/server/services/fs-adapter.d.ts +20 -0
  92. package/dist/server/services/fs-adapter.d.ts.map +1 -0
  93. package/dist/server/services/fs-adapter.js +13 -0
  94. package/dist/server/services/fs-adapter.js.map +1 -0
  95. package/dist/server/services/instruction-parser.d.ts +26 -0
  96. package/dist/server/services/instruction-parser.d.ts.map +1 -0
  97. package/dist/server/services/instruction-parser.js +121 -0
  98. package/dist/server/services/instruction-parser.js.map +1 -0
  99. package/dist/server/services/log-rotator.d.ts +20 -0
  100. package/dist/server/services/log-rotator.d.ts.map +1 -0
  101. package/dist/server/services/log-rotator.js +60 -0
  102. package/dist/server/services/log-rotator.js.map +1 -0
  103. package/dist/server/services/logger.d.ts +15 -0
  104. package/dist/server/services/logger.d.ts.map +1 -0
  105. package/dist/server/services/logger.js +69 -0
  106. package/dist/server/services/logger.js.map +1 -0
  107. package/dist/server/services/runner.d.ts +12 -0
  108. package/dist/server/services/runner.d.ts.map +1 -0
  109. package/dist/server/services/runner.js +161 -0
  110. package/dist/server/services/runner.js.map +1 -0
  111. package/dist/server/services/seeder.d.ts +5 -0
  112. package/dist/server/services/seeder.d.ts.map +1 -0
  113. package/dist/server/services/seeder.js +79 -0
  114. package/dist/server/services/seeder.js.map +1 -0
  115. package/dist/server/services/storage-test-helpers.d.ts +21 -0
  116. package/dist/server/services/storage-test-helpers.d.ts.map +1 -0
  117. package/dist/server/services/storage-test-helpers.js +158 -0
  118. package/dist/server/services/storage-test-helpers.js.map +1 -0
  119. package/dist/server/services/storage.d.ts +35 -0
  120. package/dist/server/services/storage.d.ts.map +1 -0
  121. package/dist/server/services/storage.js +219 -0
  122. package/dist/server/services/storage.js.map +1 -0
  123. package/dist/server/services/transcript-formatter.d.ts +18 -0
  124. package/dist/server/services/transcript-formatter.d.ts.map +1 -0
  125. package/dist/server/services/transcript-formatter.js +156 -0
  126. package/dist/server/services/transcript-formatter.js.map +1 -0
  127. package/dist/server/services/workspace.d.ts +11 -0
  128. package/dist/server/services/workspace.d.ts.map +1 -0
  129. package/dist/server/services/workspace.js +113 -0
  130. package/dist/server/services/workspace.js.map +1 -0
  131. package/dist/server/types/evaluation.d.ts +108 -0
  132. package/dist/server/types/evaluation.d.ts.map +1 -0
  133. package/dist/server/types/evaluation.js +5 -0
  134. package/dist/server/types/evaluation.js.map +1 -0
  135. package/dist/server/types/index.d.ts +5 -0
  136. package/dist/server/types/index.d.ts.map +1 -0
  137. package/dist/server/types/index.js +5 -0
  138. package/dist/server/types/index.js.map +1 -0
  139. package/dist/server/types/provider.d.ts +99 -0
  140. package/dist/server/types/provider.d.ts.map +1 -0
  141. package/dist/server/types/provider.js +5 -0
  142. package/dist/server/types/provider.js.map +1 -0
  143. package/dist/server/types/run.d.ts +31 -0
  144. package/dist/server/types/run.d.ts.map +1 -0
  145. package/dist/server/types/run.js +5 -0
  146. package/dist/server/types/run.js.map +1 -0
  147. package/dist/server/types/scenario.d.ts +32 -0
  148. package/dist/server/types/scenario.d.ts.map +1 -0
  149. package/dist/server/types/scenario.js +5 -0
  150. package/dist/server/types/scenario.js.map +1 -0
  151. package/dist/server/types/setup.d.ts +99 -0
  152. package/dist/server/types/setup.d.ts.map +1 -0
  153. package/dist/server/types/setup.js +5 -0
  154. package/dist/server/types/setup.js.map +1 -0
  155. package/dist/src/server/index.d.ts +13 -0
  156. package/dist/src/server/index.d.ts.map +1 -0
  157. package/dist/src/server/index.js +72 -0
  158. package/dist/src/server/index.js.map +1 -0
  159. package/dist/src/server/interfaces/evaluator.d.ts +15 -0
  160. package/dist/src/server/interfaces/evaluator.d.ts.map +1 -0
  161. package/dist/src/server/interfaces/evaluator.js +2 -0
  162. package/dist/src/server/interfaces/evaluator.js.map +1 -0
  163. package/dist/src/server/interfaces/logger.d.ts +9 -0
  164. package/dist/src/server/interfaces/logger.d.ts.map +1 -0
  165. package/dist/src/server/interfaces/logger.js +2 -0
  166. package/dist/src/server/interfaces/logger.js.map +1 -0
  167. package/dist/src/server/interfaces/runner.d.ts +9 -0
  168. package/dist/src/server/interfaces/runner.d.ts.map +1 -0
  169. package/dist/src/server/interfaces/runner.js +2 -0
  170. package/dist/src/server/interfaces/runner.js.map +1 -0
  171. package/dist/src/server/interfaces/storage.d.ts +36 -0
  172. package/dist/src/server/interfaces/storage.d.ts.map +1 -0
  173. package/dist/src/server/interfaces/storage.js +2 -0
  174. package/dist/src/server/interfaces/storage.js.map +1 -0
  175. package/dist/src/server/interfaces/workspace.d.ts +9 -0
  176. package/dist/src/server/interfaces/workspace.d.ts.map +1 -0
  177. package/dist/src/server/interfaces/workspace.js +2 -0
  178. package/dist/src/server/interfaces/workspace.js.map +1 -0
  179. package/dist/src/server/routes/eval-queue.d.ts +23 -0
  180. package/dist/src/server/routes/eval-queue.d.ts.map +1 -0
  181. package/dist/src/server/routes/eval-queue.js +45 -0
  182. package/dist/src/server/routes/eval-queue.js.map +1 -0
  183. package/dist/src/server/routes/evaluations.d.ts +8 -0
  184. package/dist/src/server/routes/evaluations.d.ts.map +1 -0
  185. package/dist/src/server/routes/evaluations.js +217 -0
  186. package/dist/src/server/routes/evaluations.js.map +1 -0
  187. package/dist/src/server/routes/providers.d.ts +5 -0
  188. package/dist/src/server/routes/providers.d.ts.map +1 -0
  189. package/dist/src/server/routes/providers.js +194 -0
  190. package/dist/src/server/routes/providers.js.map +1 -0
  191. package/dist/src/server/routes/run-queue.d.ts +17 -0
  192. package/dist/src/server/routes/run-queue.d.ts.map +1 -0
  193. package/dist/src/server/routes/run-queue.js +34 -0
  194. package/dist/src/server/routes/run-queue.js.map +1 -0
  195. package/dist/src/server/routes/run-sse.d.ts +18 -0
  196. package/dist/src/server/routes/run-sse.d.ts.map +1 -0
  197. package/dist/src/server/routes/run-sse.js +57 -0
  198. package/dist/src/server/routes/run-sse.js.map +1 -0
  199. package/dist/src/server/routes/runs.d.ts +9 -0
  200. package/dist/src/server/routes/runs.d.ts.map +1 -0
  201. package/dist/src/server/routes/runs.js +379 -0
  202. package/dist/src/server/routes/runs.js.map +1 -0
  203. package/dist/src/server/routes/scenarios.d.ts +5 -0
  204. package/dist/src/server/routes/scenarios.d.ts.map +1 -0
  205. package/dist/src/server/routes/scenarios.js +209 -0
  206. package/dist/src/server/routes/scenarios.js.map +1 -0
  207. package/dist/src/server/routes/setups.d.ts +5 -0
  208. package/dist/src/server/routes/setups.d.ts.map +1 -0
  209. package/dist/src/server/routes/setups.js +194 -0
  210. package/dist/src/server/routes/setups.js.map +1 -0
  211. package/dist/src/server/services/agent-mapper.d.ts +12 -0
  212. package/dist/src/server/services/agent-mapper.d.ts.map +1 -0
  213. package/dist/src/server/services/agent-mapper.js +75 -0
  214. package/dist/src/server/services/agent-mapper.js.map +1 -0
  215. package/dist/src/server/services/env-builder.d.ts +10 -0
  216. package/dist/src/server/services/env-builder.d.ts.map +1 -0
  217. package/dist/src/server/services/env-builder.js +50 -0
  218. package/dist/src/server/services/env-builder.js.map +1 -0
  219. package/dist/src/server/services/eval-helpers.d.ts +22 -0
  220. package/dist/src/server/services/eval-helpers.d.ts.map +1 -0
  221. package/dist/src/server/services/eval-helpers.js +75 -0
  222. package/dist/src/server/services/eval-helpers.js.map +1 -0
  223. package/dist/src/server/services/eval-parsers-debate-impl.d.ts +11 -0
  224. package/dist/src/server/services/eval-parsers-debate-impl.d.ts.map +1 -0
  225. package/dist/src/server/services/eval-parsers-debate-impl.js +133 -0
  226. package/dist/src/server/services/eval-parsers-debate-impl.js.map +1 -0
  227. package/dist/src/server/services/eval-parsers.d.ts +24 -0
  228. package/dist/src/server/services/eval-parsers.d.ts.map +1 -0
  229. package/dist/src/server/services/eval-parsers.js +153 -0
  230. package/dist/src/server/services/eval-parsers.js.map +1 -0
  231. package/dist/src/server/services/eval-prompts.d.ts +9 -0
  232. package/dist/src/server/services/eval-prompts.d.ts.map +1 -0
  233. package/dist/src/server/services/eval-prompts.js +170 -0
  234. package/dist/src/server/services/eval-prompts.js.map +1 -0
  235. package/dist/src/server/services/evaluator.d.ts +10 -0
  236. package/dist/src/server/services/evaluator.d.ts.map +1 -0
  237. package/dist/src/server/services/evaluator.js +156 -0
  238. package/dist/src/server/services/evaluator.js.map +1 -0
  239. package/dist/src/server/services/fs-adapter.d.ts +20 -0
  240. package/dist/src/server/services/fs-adapter.d.ts.map +1 -0
  241. package/dist/src/server/services/fs-adapter.js +13 -0
  242. package/dist/src/server/services/fs-adapter.js.map +1 -0
  243. package/dist/src/server/services/instruction-parser.d.ts +26 -0
  244. package/dist/src/server/services/instruction-parser.d.ts.map +1 -0
  245. package/dist/src/server/services/instruction-parser.js +121 -0
  246. package/dist/src/server/services/instruction-parser.js.map +1 -0
  247. package/dist/src/server/services/log-rotator.d.ts +20 -0
  248. package/dist/src/server/services/log-rotator.d.ts.map +1 -0
  249. package/dist/src/server/services/log-rotator.js +60 -0
  250. package/dist/src/server/services/log-rotator.js.map +1 -0
  251. package/dist/src/server/services/logger.d.ts +15 -0
  252. package/dist/src/server/services/logger.d.ts.map +1 -0
  253. package/dist/src/server/services/logger.js +69 -0
  254. package/dist/src/server/services/logger.js.map +1 -0
  255. package/dist/src/server/services/runner.d.ts +12 -0
  256. package/dist/src/server/services/runner.d.ts.map +1 -0
  257. package/dist/src/server/services/runner.js +161 -0
  258. package/dist/src/server/services/runner.js.map +1 -0
  259. package/dist/src/server/services/seeder.d.ts +5 -0
  260. package/dist/src/server/services/seeder.d.ts.map +1 -0
  261. package/dist/src/server/services/seeder.js +79 -0
  262. package/dist/src/server/services/seeder.js.map +1 -0
  263. package/dist/src/server/services/storage.d.ts +35 -0
  264. package/dist/src/server/services/storage.d.ts.map +1 -0
  265. package/dist/src/server/services/storage.js +219 -0
  266. package/dist/src/server/services/storage.js.map +1 -0
  267. package/dist/src/server/services/transcript-formatter.d.ts +18 -0
  268. package/dist/src/server/services/transcript-formatter.d.ts.map +1 -0
  269. package/dist/src/server/services/transcript-formatter.js +156 -0
  270. package/dist/src/server/services/transcript-formatter.js.map +1 -0
  271. package/dist/src/server/services/workspace.d.ts +11 -0
  272. package/dist/src/server/services/workspace.d.ts.map +1 -0
  273. package/dist/src/server/services/workspace.js +113 -0
  274. package/dist/src/server/services/workspace.js.map +1 -0
  275. package/dist/src/server/types/evaluation.d.ts +108 -0
  276. package/dist/src/server/types/evaluation.d.ts.map +1 -0
  277. package/dist/src/server/types/evaluation.js +5 -0
  278. package/dist/src/server/types/evaluation.js.map +1 -0
  279. package/dist/src/server/types/index.d.ts +5 -0
  280. package/dist/src/server/types/index.d.ts.map +1 -0
  281. package/dist/src/server/types/index.js +5 -0
  282. package/dist/src/server/types/index.js.map +1 -0
  283. package/dist/src/server/types/provider.d.ts +99 -0
  284. package/dist/src/server/types/provider.d.ts.map +1 -0
  285. package/dist/src/server/types/provider.js +5 -0
  286. package/dist/src/server/types/provider.js.map +1 -0
  287. package/dist/src/server/types/run.d.ts +31 -0
  288. package/dist/src/server/types/run.d.ts.map +1 -0
  289. package/dist/src/server/types/run.js +5 -0
  290. package/dist/src/server/types/run.js.map +1 -0
  291. package/dist/src/server/types/scenario.d.ts +32 -0
  292. package/dist/src/server/types/scenario.d.ts.map +1 -0
  293. package/dist/src/server/types/scenario.js +5 -0
  294. package/dist/src/server/types/scenario.js.map +1 -0
  295. package/dist/src/server/types/setup.d.ts +99 -0
  296. package/dist/src/server/types/setup.d.ts.map +1 -0
  297. package/dist/src/server/types/setup.js +5 -0
  298. package/dist/src/server/types/setup.js.map +1 -0
  299. package/dist/web/assets/index-C4dw8OpW.css +1 -0
  300. package/dist/web/assets/index-wve8IczO.js +76 -0
  301. package/dist/web/index.html +15 -0
  302. package/docs/schemas/provider-api.example.json +16 -0
  303. package/docs/schemas/provider-oauth.example.json +15 -0
  304. package/docs/schemas/provider.example.json +16 -0
  305. package/docs/schemas/scenario-baseline.example.json +35 -0
  306. package/docs/schemas/scenario-carwash-baseline.example.json +33 -0
  307. package/docs/schemas/scenario-carwash-with-claude-md.example.json +40 -0
  308. package/docs/schemas/scenario-golden-rules-baseline.example.json +51 -0
  309. package/docs/schemas/scenario-golden-rules-with-claude-md.example.json +61 -0
  310. package/docs/schemas/scenario-negative-analysis-baseline.example.json +34 -0
  311. package/docs/schemas/scenario-negative-analysis-with-claude-md.example.json +41 -0
  312. package/docs/schemas/scenario-with-claude-md.example.json +41 -0
  313. package/docs/schemas/scenario.example.json +33 -0
  314. package/package.json +92 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,474 @@
1
+ <p align="center">
2
+ <img src="https://img.shields.io/badge/Claude_Test_Bench-Benchmark_Agent_Behavior-7c3aed?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0id2hpdGUiPjxwYXRoIGQ9Ik0xMiAyTDIgN2wxMCA1IDEwLTV6Ii8+PHBhdGggZD0iTTIgMTdsMTAgNSAxMC01Ii8+PHBhdGggZD0iTTIgMTJsMTAgNSAxMC01Ii8+PC9zdmc+" alt="Claude Test Bench" />
3
+ </p>
4
+
5
+ <p align="center">
6
+ <strong>Do your CLAUDE.md instructions actually work? Now you can measure it.</strong>
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/package/claude-test-bench"><img src="https://img.shields.io/npm/v/claude-test-bench?style=flat-square&color=cb3837&logo=npm" alt="npm version" /></a>
11
+ <a href="https://www.npmjs.com/package/claude-test-bench"><img src="https://img.shields.io/npm/dm/claude-test-bench?style=flat-square&color=cb3837&logo=npm" alt="npm downloads" /></a>
12
+ <a href="https://github.com/Z-M-Huang/claude-test-bench"><img src="https://img.shields.io/github/stars/Z-M-Huang/claude-test-bench?style=flat-square&logo=github" alt="GitHub stars" /></a>
13
+ <a href="https://github.com/Z-M-Huang/claude-test-bench/issues"><img src="https://img.shields.io/github/issues/Z-M-Huang/claude-test-bench?style=flat-square&logo=github" alt="GitHub issues" /></a>
14
+ <a href="https://github.com/Z-M-Huang/claude-test-bench/blob/main/LICENSE"><img src="https://img.shields.io/github/license/Z-M-Huang/claude-test-bench?style=flat-square" alt="License" /></a>
15
+ </p>
16
+
17
+ <p align="center">
18
+ <img src="https://img.shields.io/badge/node-%3E%3D18.0.0-339933?style=flat-square&logo=node.js&logoColor=white" alt="Node.js" />
19
+ <img src="https://img.shields.io/badge/TypeScript-5.7+-3178c6?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript" />
20
+ <img src="https://img.shields.io/badge/React-19-61dafb?style=flat-square&logo=react&logoColor=black" alt="React 19" />
21
+ <img src="https://img.shields.io/badge/Express-5-000000?style=flat-square&logo=express&logoColor=white" alt="Express 5" />
22
+ <img src="https://img.shields.io/badge/tests-357-brightgreen?style=flat-square" alt="357 Tests" />
23
+ <img src="https://visitor-badge.laobi.icu/badge?page_id=Z-M-Huang.claude-test-bench&style=flat-square" alt="Visitors" />
24
+ </p>
25
+
26
+ <p align="center">
27
+ <a href="#what-it-does">What It Does</a> &nbsp;&middot;&nbsp;
28
+ <a href="#use-cases">Use Cases</a> &nbsp;&middot;&nbsp;
29
+ <a href="#quick-start">Quick Start</a> &nbsp;&middot;&nbsp;
30
+ <a href="#built-in-test-suites">Test Suites</a> &nbsp;&middot;&nbsp;
31
+ <a href="#how-evaluation-works">Evaluation</a> &nbsp;&middot;&nbsp;
32
+ <a href="#core-concepts">Concepts</a> &nbsp;&middot;&nbsp;
33
+ <a href="#architecture">Architecture</a> &nbsp;&middot;&nbsp;
34
+ <a href="#development">Dev</a>
35
+ </p>
36
+
37
+ ---
38
+
39
+ ## What It Does
40
+
41
+ Claude Test Bench is a local benchmarking tool for testing AI agent configurations using the Claude Agent SDK. You define a **Provider** (connection credentials + model), pair it with a **Scenario** (task, agent config, workspace files, and grading rubric), run it, and evaluate the results through a web UI — with LLM-based grading that tracks which specific instructions were followed, violated, or deemed not applicable.
42
+
43
+ The core insight: **writing CLAUDE.md instructions is easy, but knowing whether they actually change agent behavior is hard.** Claude Test Bench solves this by running controlled experiments and grading the results with a multi-stage evaluation pipeline.
44
+
45
+ ```
46
+ Provider (credentials + model) ──────────────────────┐
47
+ ├──▶ Run (SDK query) ──▶ Evaluation
48
+ Scenario (prompt + CLAUDE.md + agent config + rubric) ┘
49
+ ```
50
+
51
+ ## Use Cases
52
+
53
+ | Use Case | What You Test | What You Learn |
54
+ |----------|--------------|----------------|
55
+ | **CLAUDE.md A/B Testing** | Same task with and without CLAUDE.md | Whether your instructions actually change agent behavior |
56
+ | **Model Comparison** | Same scenario across Sonnet, Opus, etc. | Which model reasons best for your specific task |
57
+ | **Skill & Subagent Testing** | Skill and subagent definitions in a scenario | Whether your custom tools work as intended |
58
+ | **Instruction Effectiveness** | Individual CLAUDE.md rules | Which specific instructions were followed vs. ignored |
59
+ | **Regression Testing** | Same scenario across code changes | Whether prompt/config changes improve or degrade quality |
60
+ | **Evaluation Calibration** | Same run with different evaluator configs | Whether your grading rubric produces consistent scores |
61
+
62
+ ## Quick Start
63
+
64
+ ### Install from npm
65
+
66
+ ```bash
67
+ npm install -g claude-test-bench
68
+ claude-test-bench
69
+ # Opens browser at http://localhost:3847
70
+ ```
71
+
72
+ ### Or run from source
73
+
74
+ ```bash
75
+ git clone https://github.com/Z-M-Huang/claude-test-bench.git
76
+ cd claude-test-bench
77
+ npm install
78
+ npm run build && node dist/bin/ctb.js
79
+ ```
80
+
81
+ Once the UI opens:
82
+
83
+ 1. **Create a Provider** — Add your API key, base URL, and model on the Providers page
84
+ 2. **Pick a Scenario** — 8 built-in scenarios are seeded on first launch, or create your own
85
+ 3. **Run** — Pair a provider with a scenario and execute
86
+ 4. **Evaluate** — Grade the completed run with an LLM evaluator
87
+
88
+ CLI flags:
89
+
90
+ | Flag | Default | Description |
91
+ |------|---------|-------------|
92
+ | `--port N` | 3847 | HTTP port |
93
+ | `--log-level` | info | debug, info, warn, error |
94
+ | `--open` / `--no-open` | `--open` | Auto-open browser on launch |
95
+
96
+ ## Built-in Test Suites
97
+
98
+ Claude Test Bench ships with 8 ready-to-run scenarios in 4 paired suites. Each pair has a **baseline** (no CLAUDE.md) and an **instruction-guided** version (with CLAUDE.md) so you can directly measure instruction effectiveness.
99
+
100
+ | Suite | Baseline Category | With CLAUDE.md Category | What It Tests | Key Trap |
101
+ |-------|-------------------|-------------------------|---------------|----------|
102
+ | **Migration Planning** | `reasoning` | `reasoning` | Critical path reasoning under time constraints | Naive sequential scheduling misses the window |
103
+ | **Car Wash Test** | `reasoning` | `instruction-following` | Goal-oriented physical reasoning | Recommending walking 50m instead of driving the car to the car wash |
104
+ | **Negative Analysis** | `reasoning` | `instruction-following` | Failure-first evaluation of a startup pitch | Sycophantic "looks great!" response vs. structured risk analysis |
105
+ | **Golden Rules** | `instruction-following` | `instruction-following` | Auth refactor with 7 deliberate traps | Sycophancy bait, fake dead code, timing attack, push-to-main |
106
+
107
+ Each suite is in `docs/schemas/` and auto-seeds on first launch. The instruction-guided versions include CLAUDE.md content designed to improve performance on that specific task — the evaluation then measures whether the instructions were actually effective.
108
+
109
+ ## How Evaluation Works
110
+
111
+ Every completed run is graded by an LLM evaluator using a **split-query strategy** — multiple focused queries instead of one monolithic prompt:
112
+
113
+ ```
114
+ Run Transcript
115
+
116
+
117
+ ┌─────────────────┐ ┌──────────────────┐
118
+ │ 1. Score Query │ │ 2. Compliance │
119
+ │ │ │ Query │
120
+ │ • Dimension │ │ │
121
+ │ scores (0-10) │ │ • Instruction │
122
+ │ • Answer │ │ compliance │
123
+ │ comparison │ │ (followed / │
124
+ │ • Critical │ │ violated / │
125
+ │ requirements │ │ not_applicable│
126
+ │ │ │ per rule) │
127
+ └────────┬────────┘ └────────┬─────────┘
128
+ │ │
129
+ ▼ ▼
130
+ ┌─────────────────────────────────────────┐
131
+ │ 3. Debate Rounds │
132
+ │ (optional, multi-evaluator consensus) │
133
+ └────────────────┬────────────────────────┘
134
+
135
+
136
+ ┌─────────────────────────────────────────┐
137
+ │ 4. Synthesis Query │
138
+ │ Final weighted scores + confidence │
139
+ │ + dissenting opinions │
140
+ └─────────────────────────────────────────┘
141
+ ```
142
+
143
+ The evaluation produces:
144
+
145
+ - **Per-dimension scores** (0-10) for each scoring dimension
146
+ - **Answer comparison** — match status, similarity (0-1), explanation
147
+ - **Critical requirement results** — binary pass/fail with evidence
148
+ - **Instruction compliance report** — each CLAUDE.md instruction classified as `followed`, `violated`, or `not_applicable`
149
+ - **Strengths and weaknesses** — summary assessment from the evaluator
150
+ - **Weighted total score** with confidence level and dissent tracking
151
+ - **Cost tracking** — aggregated API cost per evaluator
152
+
153
+ ## Core Concepts
154
+
155
+ ### Provider
156
+
157
+ A **Provider** defines how to connect to an LLM. It contains only connection credentials and model configuration:
158
+
159
+ ```json
160
+ {
161
+ "name": "Sonnet via API",
162
+ "description": "Anthropic API with claude-sonnet-4-6",
163
+ "provider": {
164
+ "kind": "api",
165
+ "baseUrl": "https://api.anthropic.com",
166
+ "apiKey": "<ANTHROPIC_API_KEY>",
167
+ "model": "claude-sonnet-4-6"
168
+ },
169
+ "timeoutSeconds": 300
170
+ }
171
+ ```
172
+
173
+ Providers support two auth modes: `api` (API key + base URL) and `oauth` (OAuth token). See `docs/schemas/provider.example.json`, `docs/schemas/provider-oauth.example.json`, and `docs/schemas/provider-api.example.json`.
174
+
175
+ > **Security note:** Provider JSON files are stored in `.claude-test-bench/providers/` which is gitignored. Credentials are stored locally in plaintext and transmitted to the configured provider endpoint at run time.
176
+
177
+ ### Scenario
178
+
179
+ A **Scenario** defines the complete test: the task, agent configuration, workspace, and grading rubric. Agent behavior settings (CLAUDE.md, rules, skills, subagents, MCP servers, permissions) live here — not on the provider — so you can test the same model with different configurations.
180
+
181
+ ```json
182
+ {
183
+ "name": "Migration Planning Scenario",
184
+ "category": "reasoning",
185
+ "claudeMdFiles": [
186
+ { "role": "project", "content": "# Rules\n- Always calculate the critical path first" }
187
+ ],
188
+ "rules": [],
189
+ "skills": [],
190
+ "subagents": [],
191
+ "mcpServers": [],
192
+ "permissionMode": "acceptEdits",
193
+ "allowedTools": ["Read", "Write", "Edit"],
194
+ "prompt": "Read migration_plan.md and create an optimal schedule...",
195
+ "workspaceFiles": [{ "path": "migration_plan.md", "content": "..." }],
196
+ "expectedAnswer": "The migration CANNOT fit in the 4-hour window...",
197
+ "criticalRequirements": ["Must identify the window is exceeded"],
198
+ "gradingGuidelines": "Grade on correctness, reasoning quality...",
199
+ "scoringDimensions": [
200
+ { "name": "Correctness", "weight": 0.4, "description": "..." }
201
+ ]
202
+ }
203
+ ```
204
+
205
+ Key fields:
206
+
207
+ | Field | Purpose |
208
+ |-------|---------|
209
+ | `claudeMdFiles` | CLAUDE.md entries (project and/or user role) written to the workspace |
210
+ | `rules`, `skills`, `subagents` | Named agent configuration entries |
211
+ | `mcpServers` | MCP server configs (stdio, http, or sse transport) |
212
+ | `permissionMode` | SDK permission mode (`default`, `acceptEdits`, `bypassPermissions`, `plan`, `dontAsk`) |
213
+ | `allowedTools` / `disallowedTools` | Tool allow/deny lists |
214
+ | `maxTurns` | Maximum conversation turns |
215
+ | `prompt` | The task given to the agent |
216
+ | `workspaceFiles` | Files written to a temp directory before execution |
217
+ | `expectedAnswer` | Ground truth for comparison |
218
+ | `criticalRequirements` | Must-pass checks (binary pass/fail) |
219
+ | `gradingGuidelines` | The LLM grading prompt — tells the evaluator what to look for |
220
+ | `scoringDimensions` | Named dimensions with weights (must sum to 1.0), each scored 0-10 |
221
+
222
+ Categories: `planning`, `instruction-following`, `reasoning`, `tool-strategy`, `error-handling`, `ambiguity-handling`, `scope-management`, `custom`.
223
+
224
+ See `docs/schemas/scenario.example.json` and `docs/schemas/scenario-baseline.example.json` for complete examples.
225
+
226
+ ### Run
227
+
228
+ A **Run** pairs one Provider with one Scenario. The Claude Agent SDK's `query()` function executes the scenario prompt inside an isolated temp workspace with the scenario's agent configuration (CLAUDE.md, rules, skills, etc.). The full execution transcript — tool calls, thinking, output — is captured and stored.
229
+
230
+ ### Evaluation
231
+
232
+ An **Evaluation** grades a completed Run using the [split-query strategy](#how-evaluation-works) described above. One or more LLM evaluators read the full transcript and produce scores, compliance reports, and a synthesized verdict.
233
+
234
+ ## How to Test CLAUDE.md Effectiveness
235
+
236
+ ### Step 1: Create a Provider
237
+
238
+ Create a provider with your API credentials on the Providers page, or write JSON to `.claude-test-bench/providers/{id}.json`.
239
+
240
+ ### Step 2: Create two Scenarios — baseline and with instructions
241
+
242
+ **Baseline** (no CLAUDE.md):
243
+ ```json
244
+ {
245
+ "name": "Migration Baseline",
246
+ "claudeMdFiles": [],
247
+ "prompt": "Read migration_plan.md and create an optimal schedule...",
248
+ "...": "..."
249
+ }
250
+ ```
251
+
252
+ **With instructions** (CLAUDE.md configured):
253
+ ```json
254
+ {
255
+ "name": "Migration With Instructions",
256
+ "claudeMdFiles": [{
257
+ "role": "project",
258
+ "content": "# Reasoning Guidelines\n\n1. Always calculate the critical path before proposing a schedule\n2. Verify all constraints are satisfied before declaring success\n3. If a constraint cannot be met, state this clearly rather than forcing a solution\n4. Show all arithmetic work"
259
+ }],
260
+ "prompt": "Read migration_plan.md and create an optimal schedule...",
261
+ "...": "..."
262
+ }
263
+ ```
264
+
265
+ Both scenarios should have identical prompts, workspace files, and grading criteria — only the `claudeMdFiles` differ.
266
+
267
+ ### Step 3: Write instruction-aware grading guidelines
268
+
269
+ Write `gradingGuidelines` that evaluate both correctness AND whether each CLAUDE.md instruction visibly influenced behavior. See `docs/schemas/scenario-with-claude-md.example.json` for a full example.
270
+
271
+ ### Step 4: Run both scenarios against the same provider
272
+
273
+ Use the Run page to execute each scenario with your provider.
274
+
275
+ ### Step 5: Evaluate and compare
276
+
277
+ Evaluate both runs. The compliance query will report which instructions were `followed`, `violated`, or `not_applicable`. Compare the two evaluation reports to see whether instructions changed behavior and improved scores.
278
+
279
+ ## Creating Providers & Scenarios
280
+
281
+ You can create providers and scenarios through the web UI or by writing JSON files directly:
282
+
283
+ - **Via UI** — Navigate to the Providers or Scenarios page in the web interface
284
+ - **Via JSON** — Write files to `.claude-test-bench/providers/{id}.json` or `.claude-test-bench/scenarios/custom/{id}.json`
285
+ - **Via AI** — Ask an AI assistant to generate JSON matching the schemas in `docs/schemas/`
286
+
287
+ Reference examples:
288
+
289
+ | File | Description |
290
+ |------|-------------|
291
+ | `docs/schemas/provider.example.json` | API provider with CLAUDE.md |
292
+ | `docs/schemas/provider-oauth.example.json` | OAuth provider (baseline) |
293
+ | `docs/schemas/provider-api.example.json` | API provider with reasoning instructions |
294
+ | `docs/schemas/scenario.example.json` | Multi-file refactor scenario |
295
+ | `docs/schemas/scenario-baseline.example.json` | Migration scenario (baseline grading) |
296
+ | `docs/schemas/scenario-with-claude-md.example.json` | Migration scenario (instruction-aware grading) |
297
+ | `docs/schemas/scenario-carwash-baseline.example.json` | Car Wash Test (baseline) |
298
+ | `docs/schemas/scenario-carwash-with-claude-md.example.json` | Car Wash Test (with goal-first reasoning) |
299
+ | `docs/schemas/scenario-negative-analysis-baseline.example.json` | Startup evaluation (baseline) |
300
+ | `docs/schemas/scenario-negative-analysis-with-claude-md.example.json` | Startup evaluation (with negative-first framework) |
301
+ | `docs/schemas/scenario-golden-rules-baseline.example.json` | Auth refactor with 7 traps (baseline) |
302
+ | `docs/schemas/scenario-golden-rules-with-claude-md.example.json` | Auth refactor with 7 traps (with Golden CLAUDE.md) |
303
+
304
+ ## Data Storage & Security
305
+
306
+ All data lives in `.claude-test-bench/` in the current working directory (typically the repo root):
307
+
308
+ ```
309
+ .claude-test-bench/
310
+ providers/{id}.json # Provider records (contains API keys)
311
+ scenarios/custom/{id}.json # User-created scenarios
312
+ runs/{id}.json # Run records with full transcript
313
+ evaluations/{id}.json # Evaluation records with scores
314
+ logs/ctb.log # JSON log file (rotated at 2MB, 25 files max)
315
+ ```
316
+
317
+ > **This entire directory is gitignored.** Credentials are stored locally in plaintext and transmitted to the configured provider endpoint at run time. Never commit `.claude-test-bench/` or `.env` files.
318
+
319
+ ## Architecture
320
+
321
+ ```
322
+ bin/ctb.ts ──▶ Express app (src/server/index.ts) ──▶ React SPA (src/web/)
323
+
324
+ IStorage IRunner IEvaluator ILogger IWorkspaceBuilder
325
+ │ │ │ │ │
326
+ JsonFileStorage ScenarioRunner EvaluationOrchestrator JsonLogger WorkspaceBuilder
327
+ │ │ │
328
+ .claude-test-bench/ SDK query() SDK query() (split-query eval)
329
+ ```
330
+
331
+ ### Tech Stack
332
+
333
+ | Layer | Technology |
334
+ |-------|------------|
335
+ | Backend | Express 5, Node.js (ESM) |
336
+ | Frontend | React 19, React Router 7, Tailwind CSS 4 |
337
+ | Build | TypeScript 5, Vite 6 |
338
+ | Agent SDK | `@anthropic-ai/claude-agent-sdk` (query, streaming) |
339
+ | Testing | Vitest (unit), Playwright (E2E), Supertest (routes) |
340
+ | Storage | File-based JSON in `.claude-test-bench/` |
341
+ | Streaming | Server-Sent Events (SSE) for run and eval progress |
342
+
343
+ ### Design Patterns
344
+
345
+ - **Interface-first** — Every service has an interface in `src/server/interfaces/`. Route factories accept interfaces, not implementations. This enables testing with mocks.
346
+ - **Route factories** — All route files export `createXxxRoutes(deps)` returning an Express Router.
347
+ - **FsAdapter** — File system operations go through an adapter for testability.
348
+ - **Workspace isolation** — Each run gets its own temp directory with CLAUDE.md, rules, skills, and workspace files.
349
+
350
+ ## Development
351
+
352
+ ```bash
353
+ # Run tests
354
+ npm test
355
+
356
+ # Run tests with coverage
357
+ npm run test:coverage
358
+
359
+ # Lint (source files)
360
+ npm run lint
361
+
362
+ # Format (source files)
363
+ npm run format
364
+
365
+ # Dev mode (watch server TypeScript compilation)
366
+ npm run dev
367
+
368
+ # Build everything (server + web)
369
+ npm run build
370
+ ```
371
+
372
+ > `npm run dev` watches only the server TypeScript. For frontend development, use `npx vite dev` in the `src/web/` directory or run `npm run build:web` after changes.
373
+
374
+ ## Project Structure
375
+
376
+ ```
377
+ claude-test-bench/
378
+ bin/
379
+ ctb.ts # CLI entry point (port, log-level, --open/--no-open)
380
+ docs/
381
+ schemas/ # Example JSON for providers and scenarios
382
+ e2e/ # Playwright end-to-end tests
383
+ src/
384
+ server/
385
+ index.ts # Express app factory (createApp)
386
+ interfaces/
387
+ evaluator.ts # IEvaluator
388
+ logger.ts # ILogger
389
+ runner.ts # IRunner
390
+ storage.ts # IStorage
391
+ workspace.ts # IWorkspaceBuilder
392
+ routes/
393
+ providers.ts # /api/providers CRUD
394
+ scenarios.ts # /api/scenarios CRUD
395
+ runs.ts # /api/runs + run execution
396
+ evaluations.ts # /api/evaluations + eval pipeline
397
+ run-queue.ts # Run queue management
398
+ eval-queue.ts # Eval queue management
399
+ run-sse.ts # SSE streaming for run progress
400
+ services/
401
+ storage.ts # JsonFileStorage (file-based JSON)
402
+ runner.ts # ScenarioRunner (SDK query())
403
+ evaluator.ts # EvaluationOrchestrator (split-query eval)
404
+ workspace.ts # WorkspaceBuilder (temp dir per run)
405
+ agent-mapper.ts # Scenario types -> SDK option types
406
+ env-builder.ts # Provider config -> env vars
407
+ eval-prompts.ts # Prompt builders for eval queries
408
+ eval-parsers.ts # Response parsers for eval results
409
+ eval-parsers-debate-impl.ts # Debate round parsing
410
+ eval-helpers.ts # Consensus, answer comparison, compliance merge
411
+ instruction-parser.ts # Splits CLAUDE.md into testable blocks
412
+ transcript-formatter.ts # Formats run messages for eval context
413
+ fs-adapter.ts # File system abstraction for testing
414
+ logger.ts # JsonLogger with file output
415
+ log-rotator.ts # Log rotation (2MB/file, 25 files max)
416
+ seeder.ts # Seed storage on first launch
417
+ types/
418
+ provider.ts # Provider, ProviderConfig, ClaudeMdEntry, etc.
419
+ scenario.ts # Scenario, WorkspaceFile, ScenarioCategory
420
+ run.ts # Run, RunStatus, SDKMessageRecord
421
+ evaluation.ts # Evaluation, EvaluationRound, InstructionCompliance
422
+ index.ts # Re-exports
423
+ web/
424
+ src/
425
+ App.tsx # React router (all page routes)
426
+ api.ts # API client
427
+ main.tsx # Entry point
428
+ index.css # Tailwind CSS entry
429
+ components/ # Shared UI components
430
+ hooks/ # Shared React hooks (useLiveProcess, etc.)
431
+ pages/
432
+ Dashboard.tsx # /
433
+ ProviderList.tsx # /providers
434
+ ProviderEditor.tsx # /providers/new, /providers/:id/edit
435
+ ScenarioList.tsx # /scenarios
436
+ ScenarioEditor.tsx # /scenarios/new, /scenarios/:id
437
+ RunPage.tsx # /run
438
+ RunHistory.tsx # /history (split-panel with eval sidebar)
439
+ RunDetail.tsx # /runs/:id
440
+ EvalConfig.tsx # /runs/:id/evaluate
441
+ ReportView.tsx # /evaluations/:id
442
+ .env.example # Environment template
443
+ package.json # Scripts, deps, bin entries
444
+ tsconfig.json # Base TypeScript config
445
+ tsconfig.server.json # Server build config
446
+ tsconfig.bin.json # CLI build config
447
+ vite.config.ts # Vite config (web build)
448
+ vitest.config.ts # Test runner config
449
+ playwright.config.ts # E2E test config
450
+ tailwind.config.ts # Tailwind configuration
451
+ ```
452
+
453
+ ## Contributing
454
+
455
+ Contributions welcome! Please open an issue first to discuss what you'd like to change.
456
+
457
+ ```bash
458
+ git clone https://github.com/Z-M-Huang/claude-test-bench.git
459
+ cd claude-test-bench
460
+ npm install
461
+ npm test
462
+ npm run build
463
+ npm run lint
464
+ ```
465
+
466
+ ## License
467
+
468
+ [Apache-2.0](LICENSE)
469
+
470
+ ---
471
+
472
+ <p align="center">
473
+ <sub>Built for testing Claude Code agent configurations. Not affiliated with or endorsed by Anthropic.</sub>
474
+ </p>