freeharness 0.4.1

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 (375) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +108 -0
  3. package/README.md +134 -0
  4. package/canonical/HARVEST.yaml +858 -0
  5. package/canonical/PROVENANCE.yaml +740 -0
  6. package/canonical/agents/README.md +95 -0
  7. package/canonical/agents/agentic-architect.md +18 -0
  8. package/canonical/agents/database-reviewer.md +41 -0
  9. package/canonical/agents/explorer-ai-engineer-analyst.md +65 -0
  10. package/canonical/agents/pr-reviewer.md +96 -0
  11. package/canonical/agents/python-reviewer.md +55 -0
  12. package/canonical/agents/report-formatter.md +19 -0
  13. package/canonical/agents/security-reviewer.md +53 -0
  14. package/canonical/agents/test-writer.md +34 -0
  15. package/canonical/commands/fh-context.md +37 -0
  16. package/canonical/evals/promptfoo.redteam.yaml +108 -0
  17. package/canonical/hooks/cost-prices.json +14 -0
  18. package/canonical/hooks/freeharness-auto-memory.mjs +158 -0
  19. package/canonical/hooks/freeharness-config-guard.mjs +162 -0
  20. package/canonical/hooks/freeharness-context-monitor.mjs +198 -0
  21. package/canonical/hooks/freeharness-converge.mjs +227 -0
  22. package/canonical/hooks/freeharness-cost-tracker.mjs +1027 -0
  23. package/canonical/hooks/freeharness-memory-guard.mjs +57 -0
  24. package/canonical/hooks/freeharness-output-pruner.mjs +333 -0
  25. package/canonical/hooks/freeharness-precompact.mjs +323 -0
  26. package/canonical/hooks/freeharness-repeat-tool.mjs +208 -0
  27. package/canonical/hooks/freeharness-security-guidance.mjs +164 -0
  28. package/canonical/hooks/freeharness-session-start +583 -0
  29. package/canonical/hooks/hooks.auto-memory.claude-code.json +16 -0
  30. package/canonical/hooks/hooks.claude-code.json +17 -0
  31. package/canonical/hooks/hooks.config-guard.claude-code.json +16 -0
  32. package/canonical/hooks/hooks.context-monitor.claude-code.json +15 -0
  33. package/canonical/hooks/hooks.converge.claude-code.json +15 -0
  34. package/canonical/hooks/hooks.cost-tracker.claude-code.json +37 -0
  35. package/canonical/hooks/hooks.memory-guard.claude-code.json +16 -0
  36. package/canonical/hooks/hooks.output-pruner.claude-code.json +16 -0
  37. package/canonical/hooks/hooks.precompact.claude-code.json +15 -0
  38. package/canonical/hooks/hooks.repeat-tool.claude-code.json +25 -0
  39. package/canonical/hooks/hooks.security-guidance.claude-code.json +16 -0
  40. package/canonical/mcp/servers.json +20 -0
  41. package/canonical/openspec/config.base.yaml +89 -0
  42. package/canonical/openspec/schema.spec-driven.yaml +277 -0
  43. package/canonical/openspec/templates/data-contract.md +36 -0
  44. package/canonical/openspec/templates/design.md +84 -0
  45. package/canonical/openspec/templates/eval-plan.md +33 -0
  46. package/canonical/openspec/templates/follow-ups.md +2 -0
  47. package/canonical/openspec/templates/proposal.md +45 -0
  48. package/canonical/openspec/templates/spec.md +42 -0
  49. package/canonical/openspec/templates/tasks.md +38 -0
  50. package/canonical/profiles/local-llamacpp.LOCAL-MODELS.md +47 -0
  51. package/canonical/profiles/local-llamacpp.json +27 -0
  52. package/canonical/profiles/local-ollama.json +20 -0
  53. package/canonical/profiles/mcp.json +91 -0
  54. package/canonical/rules/CLAUDE.md +78 -0
  55. package/canonical/rules/project-CLAUDE.template.md +62 -0
  56. package/canonical/rules/routing.md +20 -0
  57. package/canonical/rules/safety.md +41 -0
  58. package/canonical/settings/settings.cache-hygiene.claude-code.json +5 -0
  59. package/canonical/skills/agent-evaluation/SKILL.md +102 -0
  60. package/canonical/skills/agent-evaluation/assets/evaluation_report_template.md +206 -0
  61. package/canonical/skills/agent-evaluation/evals/cases.yaml +106 -0
  62. package/canonical/skills/agent-evaluation/references/dataset-preparation.md +351 -0
  63. package/canonical/skills/agent-evaluation/references/scorers-constraints.md +165 -0
  64. package/canonical/skills/agent-evaluation/references/scorers.md +431 -0
  65. package/canonical/skills/agent-evaluation/references/setup-guide.md +252 -0
  66. package/canonical/skills/agent-evaluation/references/tracing-integration.md +164 -0
  67. package/canonical/skills/agent-evaluation/references/troubleshooting.md +514 -0
  68. package/canonical/skills/agent-evaluation/scripts/analyze_results.py +462 -0
  69. package/canonical/skills/agent-evaluation/scripts/create_dataset_template.py +382 -0
  70. package/canonical/skills/agent-evaluation/scripts/list_datasets.py +273 -0
  71. package/canonical/skills/agent-evaluation/scripts/run_evaluation_template.py +309 -0
  72. package/canonical/skills/agent-evaluation/scripts/setup_mlflow.py +353 -0
  73. package/canonical/skills/agent-evaluation/scripts/utils/__init__.py +27 -0
  74. package/canonical/skills/agent-evaluation/scripts/utils/env_validation.py +123 -0
  75. package/canonical/skills/agent-evaluation/scripts/utils/tracing_utils.py +108 -0
  76. package/canonical/skills/agent-evaluation/scripts/validate_agent_tracing.py +148 -0
  77. package/canonical/skills/agent-evaluation/scripts/validate_auth.py +240 -0
  78. package/canonical/skills/agent-evaluation/scripts/validate_environment.py +185 -0
  79. package/canonical/skills/agent-evaluation/scripts/validate_tracing_runtime.py +318 -0
  80. package/canonical/skills/agentic-architecture/SKILL.md +41 -0
  81. package/canonical/skills/agentic-architecture/evals/cases.yaml +94 -0
  82. package/canonical/skills/agentic-architecture/reference/context-engineering.md +75 -0
  83. package/canonical/skills/agentic-architecture/reference/patterns.md +76 -0
  84. package/canonical/skills/agentic-architecture/reference/reliability-observability.md +94 -0
  85. package/canonical/skills/agentic-architecture/reference/review-framework.md +59 -0
  86. package/canonical/skills/code-review/SKILL.md +52 -0
  87. package/canonical/skills/code-review/evals/cases.yaml +197 -0
  88. package/canonical/skills/git-workflow/SKILL.md +41 -0
  89. package/canonical/skills/git-workflow/evals/cases.yaml +92 -0
  90. package/canonical/skills/local-code/SKILL.md +24 -0
  91. package/canonical/skills/local-code/evals/cases.yaml +85 -0
  92. package/canonical/skills/local-code/scripts/query_llama.py +68 -0
  93. package/canonical/skills/report-formatting/SKILL.md +62 -0
  94. package/canonical/skills/report-formatting/evals/cases.yaml +83 -0
  95. package/canonical/skills/report-formatting/reference/ARCHITECTURE.md +135 -0
  96. package/canonical/skills/report-formatting/reference/HELPERS.md +120 -0
  97. package/canonical/skills/report-formatting/reference/PPTX.md +136 -0
  98. package/canonical/skills/report-formatting/reference/RELEASE.md +99 -0
  99. package/canonical/skills/report-formatting/reference/TEMPLATES.md +48 -0
  100. package/canonical/skills/report-formatting/reference/authoring.md +66 -0
  101. package/canonical/skills/report-formatting/scripts/architecture-template.md +271 -0
  102. package/canonical/skills/report-formatting/scripts/assets/claro-logo.png +0 -0
  103. package/canonical/skills/report-formatting/scripts/assets/claro-wordmark.svg +1 -0
  104. package/canonical/skills/report-formatting/scripts/build-architecture.js +57 -0
  105. package/canonical/skills/report-formatting/scripts/build-md-claro.js +224 -0
  106. package/canonical/skills/report-formatting/scripts/build-release.js +51 -0
  107. package/canonical/skills/report-formatting/scripts/check-env.js +58 -0
  108. package/canonical/skills/report-formatting/scripts/docmodel.js +283 -0
  109. package/canonical/skills/report-formatting/scripts/example-build.js +119 -0
  110. package/canonical/skills/report-formatting/scripts/example_build_ArchitectureReview_docx.js +195 -0
  111. package/canonical/skills/report-formatting/scripts/example_build_ExecutiveReport_docx.js +114 -0
  112. package/canonical/skills/report-formatting/scripts/package.json +17 -0
  113. package/canonical/skills/report-formatting/scripts/pptx/example_build_StatusReport_pptx.py +223 -0
  114. package/canonical/skills/report-formatting/scripts/pptx/example_build_WeeklyStatus_pptx.py +245 -0
  115. package/canonical/skills/report-formatting/scripts/pptx/pptx_office.py +144 -0
  116. package/canonical/skills/report-formatting/scripts/pptx/requirements.txt +7 -0
  117. package/canonical/skills/report-formatting/scripts/pptx/status_report_blocks.py +193 -0
  118. package/canonical/skills/report-formatting/scripts/pptx/theme_claro_pptx.py +473 -0
  119. package/canonical/skills/report-formatting/scripts/release-template.md +80 -0
  120. package/canonical/skills/report-formatting/scripts/render-mermaid.js +105 -0
  121. package/canonical/skills/report-formatting/scripts/theme-claro.js +403 -0
  122. package/canonical/skills/subagent-driven-development/SKILL.md +60 -0
  123. package/canonical/skills/subagent-driven-development/evals/cases.yaml +208 -0
  124. package/canonical/skills/subagent-driven-development/reference/brief.md +91 -0
  125. package/canonical/skills/subagent-driven-development/reference/handoff.md +118 -0
  126. package/canonical/skills/subagent-driven-development/scripts/validate-handoff.mjs +850 -0
  127. package/canonical/skills/systematic-debugging/SKILL.md +44 -0
  128. package/canonical/skills/systematic-debugging/evals/cases.yaml +90 -0
  129. package/canonical/skills/test-driven-development/SKILL.md +42 -0
  130. package/canonical/skills/test-driven-development/evals/cases.yaml +86 -0
  131. package/canonical/skills/test-driven-development/reference/writing-good-tests.md +52 -0
  132. package/canonical/skills/verification-before-completion/SKILL.md +53 -0
  133. package/canonical/skills/verification-before-completion/evals/cases.yaml +107 -0
  134. package/dist/adapters/content/language-lint.d.ts +46 -0
  135. package/dist/adapters/content/language-lint.js +191 -0
  136. package/dist/adapters/harness/claude-code.d.ts +57 -0
  137. package/dist/adapters/harness/claude-code.js +385 -0
  138. package/dist/adapters/harness/index.d.ts +3 -0
  139. package/dist/adapters/harness/index.js +17 -0
  140. package/dist/adapters/harness/opencode.d.ts +7 -0
  141. package/dist/adapters/harness/opencode.js +166 -0
  142. package/dist/adapters/harness/plugin.d.ts +22 -0
  143. package/dist/adapters/harness/plugin.js +257 -0
  144. package/dist/adapters/memory/doctor.d.ts +480 -0
  145. package/dist/adapters/memory/doctor.js +1217 -0
  146. package/dist/adapters/memory/vendored.d.ts +150 -0
  147. package/dist/adapters/memory/vendored.js +487 -0
  148. package/dist/adapters/package/node.d.ts +9 -0
  149. package/dist/adapters/package/node.js +20 -0
  150. package/dist/adapters/prompt/readline.d.ts +19 -0
  151. package/dist/adapters/prompt/readline.js +53 -0
  152. package/dist/adapters/sync/diff.d.ts +43 -0
  153. package/dist/adapters/sync/diff.js +380 -0
  154. package/dist/cli/cleanup.d.ts +86 -0
  155. package/dist/cli/cleanup.js +382 -0
  156. package/dist/cli/cost.d.ts +304 -0
  157. package/dist/cli/cost.js +501 -0
  158. package/dist/cli/doctor.d.ts +205 -0
  159. package/dist/cli/doctor.js +654 -0
  160. package/dist/cli/executor.d.ts +5 -0
  161. package/dist/cli/executor.js +48 -0
  162. package/dist/cli/plugin-validate.d.ts +37 -0
  163. package/dist/cli/plugin-validate.js +256 -0
  164. package/dist/cli/prefix.d.ts +68 -0
  165. package/dist/cli/prefix.js +218 -0
  166. package/dist/cli/profile.d.ts +170 -0
  167. package/dist/cli/profile.js +285 -0
  168. package/dist/cli/runner.d.ts +10 -0
  169. package/dist/cli/runner.js +27 -0
  170. package/dist/cli/uninstall.d.ts +65 -0
  171. package/dist/cli/uninstall.js +147 -0
  172. package/dist/index.d.ts +8 -0
  173. package/dist/index.js +989 -0
  174. package/dist/infra/dogfood.d.ts +31 -0
  175. package/dist/infra/dogfood.js +51 -0
  176. package/dist/infra/fsutil.d.ts +40 -0
  177. package/dist/infra/fsutil.js +143 -0
  178. package/dist/infra/manifest.d.ts +76 -0
  179. package/dist/infra/manifest.js +92 -0
  180. package/dist/infra/paths.d.ts +19 -0
  181. package/dist/infra/paths.js +74 -0
  182. package/dist/infra/routing.d.ts +4 -0
  183. package/dist/infra/routing.js +7 -0
  184. package/node_modules/@freeharness/core/dist/context.d.ts +30 -0
  185. package/node_modules/@freeharness/core/dist/context.js +1 -0
  186. package/node_modules/@freeharness/core/dist/index.d.ts +5 -0
  187. package/node_modules/@freeharness/core/dist/index.js +6 -0
  188. package/node_modules/@freeharness/core/dist/planner.d.ts +13 -0
  189. package/node_modules/@freeharness/core/dist/planner.js +18 -0
  190. package/node_modules/@freeharness/core/dist/ports.d.ts +90 -0
  191. package/node_modules/@freeharness/core/dist/ports.js +1 -0
  192. package/node_modules/@freeharness/core/dist/registry.d.ts +41 -0
  193. package/node_modules/@freeharness/core/dist/registry.js +124 -0
  194. package/node_modules/@freeharness/core/dist/tiers.d.ts +30 -0
  195. package/node_modules/@freeharness/core/dist/tiers.js +99 -0
  196. package/node_modules/@freeharness/core/package.json +34 -0
  197. package/node_modules/@freeharness/sdd/PROVENANCE.yaml +175 -0
  198. package/node_modules/@freeharness/sdd/dist/src/bin/openspec.d.ts +2 -0
  199. package/node_modules/@freeharness/sdd/dist/src/bin/openspec.js +166 -0
  200. package/node_modules/@freeharness/sdd/dist/src/index.d.ts +14 -0
  201. package/node_modules/@freeharness/sdd/dist/src/index.js +11 -0
  202. package/node_modules/@freeharness/sdd/dist/src/init.d.ts +39 -0
  203. package/node_modules/@freeharness/sdd/dist/src/init.js +190 -0
  204. package/node_modules/@freeharness/sdd/dist/src/root-resolver.d.ts +8 -0
  205. package/node_modules/@freeharness/sdd/dist/src/root-resolver.js +32 -0
  206. package/node_modules/@freeharness/sdd/dist/src/shim/archive.d.ts +81 -0
  207. package/node_modules/@freeharness/sdd/dist/src/shim/archive.js +483 -0
  208. package/node_modules/@freeharness/sdd/dist/src/shim/context.d.ts +4 -0
  209. package/node_modules/@freeharness/sdd/dist/src/shim/context.js +48 -0
  210. package/node_modules/@freeharness/sdd/dist/src/shim/follow-up.d.ts +57 -0
  211. package/node_modules/@freeharness/sdd/dist/src/shim/follow-up.js +279 -0
  212. package/node_modules/@freeharness/sdd/dist/src/shim/instructions.d.ts +67 -0
  213. package/node_modules/@freeharness/sdd/dist/src/shim/instructions.js +460 -0
  214. package/node_modules/@freeharness/sdd/dist/src/shim/list.d.ts +5 -0
  215. package/node_modules/@freeharness/sdd/dist/src/shim/list.js +95 -0
  216. package/node_modules/@freeharness/sdd/dist/src/shim/new-change.d.ts +6 -0
  217. package/node_modules/@freeharness/sdd/dist/src/shim/new-change.js +150 -0
  218. package/node_modules/@freeharness/sdd/dist/src/shim/schemas.d.ts +4 -0
  219. package/node_modules/@freeharness/sdd/dist/src/shim/schemas.js +23 -0
  220. package/node_modules/@freeharness/sdd/dist/src/shim/shared.d.ts +56 -0
  221. package/node_modules/@freeharness/sdd/dist/src/shim/shared.js +140 -0
  222. package/node_modules/@freeharness/sdd/dist/src/shim/status.d.ts +8 -0
  223. package/node_modules/@freeharness/sdd/dist/src/shim/status.js +85 -0
  224. package/node_modules/@freeharness/sdd/dist/src/shim/validate.d.ts +6 -0
  225. package/node_modules/@freeharness/sdd/dist/src/shim/validate.js +229 -0
  226. package/node_modules/@freeharness/sdd/dist/src/validate-change.d.ts +40 -0
  227. package/node_modules/@freeharness/sdd/dist/src/validate-change.js +114 -0
  228. package/node_modules/@freeharness/sdd/dist/src/validate.d.ts +24 -0
  229. package/node_modules/@freeharness/sdd/dist/src/validate.js +72 -0
  230. package/node_modules/@freeharness/sdd/dist/vendor/openspec/apply/specs-apply.d.ts +130 -0
  231. package/node_modules/@freeharness/sdd/dist/vendor/openspec/apply/specs-apply.js +981 -0
  232. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-metadata.d.ts +46 -0
  233. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-metadata.js +128 -0
  234. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-status-policy.d.ts +26 -0
  235. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-status-policy.js +32 -0
  236. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/file-system.d.ts +50 -0
  237. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/file-system.js +394 -0
  238. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/global-config.d.ts +15 -0
  239. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/global-config.js +49 -0
  240. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/graph.d.ts +71 -0
  241. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/graph.js +164 -0
  242. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/index.d.ts +11 -0
  243. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/index.js +21 -0
  244. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/instruction-loader.d.ts +102 -0
  245. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/instruction-loader.js +230 -0
  246. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/outputs.d.ts +18 -0
  247. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/outputs.js +138 -0
  248. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/resolver.d.ts +82 -0
  249. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/resolver.js +333 -0
  250. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/schema.d.ts +12 -0
  251. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/schema.js +110 -0
  252. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/state.d.ts +11 -0
  253. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/state.js +32 -0
  254. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/task-progress.d.ts +33 -0
  255. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/task-progress.js +149 -0
  256. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/types.d.ts +39 -0
  257. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/types.js +49 -0
  258. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/claude.d.ts +12 -0
  259. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/claude.js +31 -0
  260. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/index.d.ts +10 -0
  261. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/index.js +10 -0
  262. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/opencode.d.ts +12 -0
  263. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/adapters/opencode.js +26 -0
  264. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/generator.d.ts +28 -0
  265. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/generator.js +41 -0
  266. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/index.d.ts +23 -0
  267. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/index.js +25 -0
  268. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/invocation.d.ts +72 -0
  269. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/invocation.js +76 -0
  270. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/registry.d.ts +39 -0
  271. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/registry.js +53 -0
  272. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/types.d.ts +62 -0
  273. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/types.js +7 -0
  274. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/yaml.d.ts +35 -0
  275. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-generation/yaml.js +47 -0
  276. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-references.d.ts +33 -0
  277. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/command-references.js +55 -0
  278. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/shared/allowed-tools.d.ts +11 -0
  279. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/shared/allowed-tools.js +11 -0
  280. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/shared/skill-generation.d.ts +48 -0
  281. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/shared/skill-generation.js +99 -0
  282. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/skill-templates.d.ts +19 -0
  283. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/skill-templates.js +18 -0
  284. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/types.d.ts +18 -0
  285. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/types.js +4 -0
  286. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/apply-change.d.ts +19 -0
  287. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/apply-change.js +207 -0
  288. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/archive-change.d.ts +12 -0
  289. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/archive-change.js +409 -0
  290. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/bulk-archive-change.d.ts +9 -0
  291. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/bulk-archive-change.js +673 -0
  292. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/continue-change.d.ts +9 -0
  293. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/continue-change.js +230 -0
  294. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/explore.d.ts +12 -0
  295. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/explore.js +550 -0
  296. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/feedback.d.ts +8 -0
  297. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/feedback.js +107 -0
  298. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/ff-change.d.ts +12 -0
  299. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/ff-change.js +228 -0
  300. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/new-change.d.ts +9 -0
  301. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/new-change.js +147 -0
  302. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/onboard.d.ts +9 -0
  303. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/onboard.js +571 -0
  304. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/propose.d.ts +12 -0
  305. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/propose.js +322 -0
  306. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/store-selection.d.ts +7 -0
  307. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/store-selection.js +7 -0
  308. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/sync-specs.d.ts +9 -0
  309. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/sync-specs.js +518 -0
  310. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/update-change.d.ts +9 -0
  311. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/update-change.js +176 -0
  312. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/verify-change.d.ts +9 -0
  313. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/verify-change.js +344 -0
  314. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/constants.d.ts +39 -0
  315. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/constants.js +54 -0
  316. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/delta-resolution.d.ts +35 -0
  317. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/delta-resolution.js +171 -0
  318. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/change-parser.d.ts +27 -0
  319. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/change-parser.js +210 -0
  320. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/code-fence.d.ts +14 -0
  321. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/code-fence.js +48 -0
  322. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/markdown-parser.d.ts +22 -0
  323. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/markdown-parser.js +186 -0
  324. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-blocks.d.ts +65 -0
  325. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-blocks.js +409 -0
  326. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-text.d.ts +55 -0
  327. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-text.js +98 -0
  328. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/spec-structure.d.ts +8 -0
  329. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/spec-structure.js +77 -0
  330. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/purpose-placeholder.d.ts +44 -0
  331. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/purpose-placeholder.js +116 -0
  332. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/base.schema.d.ts +12 -0
  333. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/base.schema.js +17 -0
  334. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/change.schema.d.ts +72 -0
  335. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/change.schema.js +30 -0
  336. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/index.d.ts +3 -0
  337. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/index.js +3 -0
  338. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/spec.schema.d.ts +17 -0
  339. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/schemas/spec.schema.js +14 -0
  340. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/spec-discovery.d.ts +39 -0
  341. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/spec-discovery.js +114 -0
  342. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-lines.d.ts +45 -0
  343. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-lines.js +105 -0
  344. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-numbering.d.ts +15 -0
  345. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-numbering.js +56 -0
  346. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/types.d.ts +17 -0
  347. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/types.js +1 -0
  348. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/validator.d.ts +94 -0
  349. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/validator.js +756 -0
  350. package/node_modules/@freeharness/sdd/package.json +57 -0
  351. package/node_modules/@freeharness/sdd/vendor/openspec/LICENSE.upstream +22 -0
  352. package/node_modules/@freeharness/sdd/vendor/openspec/assets/schema.upstream.yaml +232 -0
  353. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/README.md +19 -0
  354. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-apply-change/SKILL.md +187 -0
  355. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-archive-change/SKILL.md +181 -0
  356. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-bulk-archive-change/SKILL.md +338 -0
  357. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-continue-change/SKILL.md +117 -0
  358. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-explore/SKILL.md +342 -0
  359. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-ff-change/SKILL.md +116 -0
  360. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-new-change/SKILL.md +76 -0
  361. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-onboard/SKILL.md +560 -0
  362. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-propose/SKILL.md +162 -0
  363. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-sync-specs/SKILL.md +261 -0
  364. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-update-change/SKILL.md +90 -0
  365. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-verify-change/SKILL.md +174 -0
  366. package/package.json +70 -0
  367. package/provenance/canonical.PROVENANCE.yaml +740 -0
  368. package/provenance/claude-mem.LICENSE.upstream +202 -0
  369. package/provenance/memory.PROVENANCE.yaml +399 -0
  370. package/provenance/sdd.PROVENANCE.yaml +175 -0
  371. package/vendor-licenses/caveman.LICENSE +27 -0
  372. package/vendor-licenses/deepseek-harness.LICENSE +21 -0
  373. package/vendor-licenses/ecc.LICENSE +21 -0
  374. package/vendor-licenses/pi.LICENSE +21 -0
  375. package/vendor-licenses/superpowers.LICENSE +21 -0
@@ -0,0 +1,431 @@
1
+ # MLflow Evaluation Scorers Guide
2
+
3
+ Complete guide for selecting and creating scorers to evaluate agent quality.
4
+
5
+ ## Table of Contents
6
+
7
+ 1. [Understanding Scorers](#understanding-scorers)
8
+ 2. [Built-in Scorers](#built-in-scorers)
9
+ 3. [Custom Scorer Design](#custom-scorer-design)
10
+ 4. [Scorer Registration](#scorer-registration)
11
+ 5. [Testing Scorers](#testing-scorers)
12
+
13
+ ## Understanding Scorers
14
+
15
+ ### What are Scorers?
16
+
17
+ Scorers (also called "judges" or "LLM-as-a-judge") are evaluation criteria that assess the quality of agent responses. They:
18
+
19
+ - Take as input single-turn inputs&outputs, or multi-turn conversations, or traces
20
+ - Apply quality criteria (relevance, accuracy, completeness, etc.)
21
+ - Return a score or pass/fail judgment
22
+ - Can be built-in (provided by MLflow) or custom (defined by you)
23
+
24
+ ### Types of Scorers
25
+
26
+ **1. Reference-Free Scorers**
27
+
28
+ - Don't require ground truth or expected outputs
29
+ - Judge quality based on their inputs alone
30
+ - Examples: Relevance, Completeness, Clarity
31
+ - **Easiest to use** - work with any dataset
32
+
33
+ **2. Ground-Truth Scorers**
34
+
35
+ - Require expectations in the dataset
36
+ - Compare agent response to ground truth
37
+ - Examples: Factual Accuracy, Answer Correctness
38
+ - Require datasets with `expectations` field
39
+
40
+ ### LLM-as-a-Judge Pattern
41
+
42
+ Modern scorers use an LLM to judge quality:
43
+
44
+ 1. Scorer receives information on agent's execution (input&output, or trace, or conversation)
45
+ 2. LLM is given evaluation instructions
46
+ 3. LLM judges whether criteria is met
47
+ 4. Returns a structured assessment (pass/fail or numeric) along with a rationale
48
+
49
+ ## Built-in Scorers
50
+
51
+ MLflow provides several built-in scorers for common evaluation criteria.
52
+
53
+ ### Discovering Built-in Scorers
54
+
55
+ **IMPORTANT: Use the documentation protocol to discover built-in scorers.**
56
+
57
+ Do NOT use `mlflow scorers list -b` - it may be incomplete or unavailable in some environments. Instead:
58
+
59
+ 1. Query MLflow documentation via llms.txt:
60
+ ```
61
+ WebFetch https://mlflow.org/docs/latest/llms.txt with prompt:
62
+ "What built-in LLM judges or scorers are available in MLflow for evaluating GenAI agents?"
63
+ ```
64
+
65
+ 2. Read scorer documentation pages referenced in llms.txt to understand:
66
+ - Scorer names and how to import them
67
+ - What each scorer evaluates
68
+ - Required inputs (trace structure, expected_response, etc.)
69
+ - When to use each scorer
70
+
71
+ 3. Verify scorer availability by attempting import:
72
+ ```python
73
+ from mlflow.genai.scorers import Correctness, RelevanceToQuery
74
+ ```
75
+
76
+ ### Checking Registered Scorers
77
+
78
+ List scorers registered in your experiment:
79
+
80
+ ```bash
81
+ uv run mlflow scorers list -x $MLFLOW_EXPERIMENT_ID
82
+ ```
83
+
84
+ Output shows:
85
+ - Scorer names
86
+ - Whether they're built-in or custom
87
+ - Registration details
88
+
89
+ **IMPORTANT: if there are registered scorers in the experiment then they must be used for evaluation.**
90
+
91
+ ### Understanding Built-in Scorers
92
+
93
+ After querying the documentation, you'll typically find scorers in these categories:
94
+
95
+ **Reference-free scorers** (judge without ground truth):
96
+
97
+ - Relevance, Completeness, Coherence, Clarity
98
+ - Use for: All agents, no expected outputs needed
99
+
100
+ **Ground-truth scorers** (require expected outputs):
101
+
102
+ - Answer Correctness, Faithfulness, Accuracy
103
+ - Use for: When you have known correct answers in dataset
104
+
105
+ **Context-based scorers** (require context/documents):
106
+
107
+ - Groundedness, Citation Quality
108
+ - Use for: RAG systems, knowledge base agents
109
+
110
+ ### Important: Trace Structure Assumptions
111
+
112
+ **CRITICAL**: Built-in scorers make assumptions about trace structure.
113
+
114
+ Before using a built-in scorer:
115
+
116
+ 1. **Read its documentation** to understand required inputs
117
+ 2. **Check trace structure** matches expectations
118
+ 3. **Verify it works** with a test trace before full evaluation
119
+
120
+ **Example issue**:
121
+
122
+ - Scorer expects `context` field in trace
123
+ - Your agent doesn't provide `context`
124
+ - Scorer fails or returns null
125
+
126
+ **Solution**:
127
+
128
+ - Read scorer docs carefully
129
+ - Test on single trace first
130
+ - Create custom scorer if built-in doesn't match your structure
131
+
132
+ ### Using Built-in Scorers
133
+
134
+ After discovering scorers via documentation, register them to your experiment:
135
+
136
+ ```python
137
+ import os
138
+ from mlflow.genai.scorers import Correctness, RelevanceToQuery
139
+
140
+ # Note: Import exact class names from documentation
141
+ # Common mistake: trying to import "Relevance" when it's actually "RelevanceToQuery"
142
+
143
+ # Register built-in scorer to experiment
144
+ scorer = Correctness()
145
+ scorer.register(experiment_id=os.getenv("MLFLOW_EXPERIMENT_ID"))
146
+ ```
147
+
148
+ **Benefits of registration**:
149
+
150
+ - Shows up in `mlflow scorers list -x <id>`
151
+ - Keeps all evaluation criteria in one place
152
+ - Makes it clear what scorers are being used for the experiment
153
+
154
+ ## Custom Scorer Design
155
+
156
+ Create custom scorers when:
157
+
158
+ - Built-in scorers don't match your criteria
159
+ - You need domain-specific evaluation
160
+ - Your agent has unique requirements
161
+ - Trace structure doesn't match built-in assumptions
162
+
163
+ ## MLflow Judge Constraints
164
+
165
+ ⚠️ **The MLflow CLI has specific requirements for custom scorers.**
166
+
167
+ Before creating custom scorers, read the complete constraints guide:
168
+
169
+ - See `references/scorers-constraints.md` for detailed requirements
170
+
171
+ **Key constraints:**
172
+
173
+ 1. `{{trace}}` variable cannot be mixed with `{{inputs}}` or `{{outputs}}`
174
+ 2. CLI requires "yes"/"no" return values (not "pass"/"fail")
175
+ 3. Instructions must include at least one template variable
176
+
177
+ ---
178
+
179
+ ### Design Process
180
+
181
+ **Step 1: Define Quality Criterion Clearly**
182
+
183
+ What specific aspect of quality are you judging?
184
+
185
+ **Examples**:
186
+
187
+ - "Response uses appropriate tools for the query"
188
+ - "Response is factually accurate based on available data"
189
+ - "Response follows the expected format"
190
+ - "Response appropriately handles ambiguous queries"
191
+
192
+ **Step 2: Determine Required Inputs**
193
+
194
+ What information does the scorer need?
195
+
196
+ **Common inputs**:
197
+
198
+ - `query`: The user's question
199
+ - `response`: The agent's answer
200
+ - `trace`: Full trace with tool calls, LLM calls, etc.
201
+ - `context`: Retrieved documents or context (if applicable)
202
+
203
+ **Step 3: Write Evaluation Instructions**
204
+
205
+ Clear instructions for the LLM judge:
206
+
207
+ ```
208
+ You are evaluating whether an agent used appropriate tools for a query.
209
+
210
+ Given:
211
+ - Query: {query}
212
+ - Response: {response}
213
+ - Trace: {trace} (contains tool calls)
214
+
215
+ Criteria: The agent should use tools when needed (e.g., search for factual queries)
216
+ and should not use tools unnecessarily (e.g., for greetings).
217
+
218
+ Evaluate whether appropriate tools were used. Return "yes" if tools were used
219
+ appropriately, "no" if not.
220
+ ```
221
+
222
+ **Step 4: Choose Output Format**
223
+
224
+ Use yes/no format as required by the CLI (see CRITICAL CONSTRAINTS above).
225
+
226
+ ### Example Custom Scorers
227
+
228
+ **Example 1: Tool Usage Appropriateness**
229
+
230
+ ```
231
+ Scorer Name: ToolUsageAppropriate
232
+
233
+ Definition: Judges whether the agent used appropriate tools for the query.
234
+
235
+ Instructions:
236
+ You are evaluating tool usage by an AI agent.
237
+
238
+ Given a query and trace showing tool calls, determine if:
239
+ 1. Tools were used when needed (factual questions, searches, lookups)
240
+ 2. Tools were NOT used unnecessarily (greetings, simple questions)
241
+ 3. The RIGHT tools were chosen for the task
242
+
243
+ Return "yes" if tool usage was appropriate, "no" if not.
244
+
245
+ Variables: query, response, trace
246
+ Output: yes/no
247
+ ```
248
+
249
+ **Example 2: Factual Accuracy**
250
+
251
+ ```
252
+ Scorer Name: FactualAccuracy
253
+
254
+ Definition: Judges whether the response is factually accurate.
255
+
256
+ Instructions:
257
+ You are evaluating the factual accuracy of an AI agent's response.
258
+
259
+ Review the agent's response and determine if the information provided is
260
+ factually correct based on the context and your knowledge.
261
+
262
+ Return "yes" if the response is factually accurate, "no" if it contains
263
+ incorrect information or makes unsupported claims.
264
+
265
+ Variables: query, response, context (optional)
266
+ Output: yes/no
267
+ ```
268
+
269
+ ## Scorer Registration
270
+
271
+ ### Check CLI Help First
272
+
273
+ Run `--help` to verify parameter names:
274
+
275
+ ```bash
276
+ uv run mlflow scorers register-llm-judge --help
277
+ ```
278
+
279
+ ### Correct CLI Parameters
280
+
281
+ ### Registration Example - All Requirements Met
282
+
283
+ ```bash
284
+ # ✅ CORRECT - Has variable, uses yes/no, correct parameters
285
+ uv run mlflow scorers register-llm-judge \
286
+ -n "RelevanceCheck" \
287
+ -d "Checks if response addresses the query" \
288
+ -i "Given the response {{ outputs }}, determine if it directly addresses the query. Return 'yes' if relevant, 'no' if not."
289
+ ```
290
+
291
+ ```bash
292
+ # ✅ CORRECT - Uses {{trace}} only (no other variables), yes/no, correct parameters
293
+ uv run mlflow scorers register-llm-judge \
294
+ -n "ToolUsageCheck" \
295
+ -d "Evaluates tool selection quality" \
296
+ -i "Examine the trace {{ trace }}. Did the agent use appropriate tools for the query? Return 'yes' if appropriate, 'no' if not."
297
+ ```
298
+
299
+ ### Using make_judge() Function
300
+
301
+ **Programmatic registration** for advanced use cases:
302
+
303
+ ```python
304
+ from mlflow.genai.judges import make_judge
305
+ from typing import Literal
306
+
307
+ scorer = make_judge(
308
+ name="ToolUsageAppropriate",
309
+ description="Judges whether appropriate tools were used",
310
+ instructions="""
311
+ You are evaluating tool usage by an AI agent.
312
+
313
+ Given a trace: {{ trace }}
314
+
315
+ Determine if appropriate tools were used.
316
+ Return "yes" if tool usage was appropriate, "no" if not.
317
+ """,
318
+ feedback_value_type=Literal["yes", "no"],
319
+ )
320
+
321
+ # Register the scorer
322
+ registered_scorer = scorer.register(experiment_id="your_experiment_id")
323
+ ```
324
+
325
+ **When to use make_judge()**:
326
+
327
+ - `mlflow scorers register-llm-judge` fails with an obscure error
328
+ - Need programmatic control
329
+ - Integration with existing code
330
+
331
+ **Important**: The `make_judge()` API follows the same constraints documented in the CRITICAL CONSTRAINTS section above. Use `Literal["yes", "no"]` for `feedback_value_type` for binary scorers.
332
+
333
+ ### Best Practices
334
+
335
+ **1. Use default model** unless you have specific needs:
336
+
337
+ - Default is usually sufficient and cost-effective
338
+ - Specify model only for specialized evaluation
339
+
340
+ **2. Register both built-in and custom scorers for version control and team collaboration**
341
+
342
+ **3. Test before full evaluation**:
343
+
344
+ - Test on single trace first
345
+ - Verify output format is correct
346
+ - Check that instructions are clear
347
+
348
+ **4. Version your scorers**:
349
+
350
+ - Include version in name if criteria change: `ToolUsageAppropriate_v2`
351
+ - Document what changed between versions
352
+
353
+ ## Testing Scorers
354
+
355
+ **Always test a scorer** before using it on your full evaluation dataset.
356
+
357
+ ### Quick Single-Trace Test
358
+
359
+ ```bash
360
+ # Get a sample trace ID (from previous agent run)
361
+ export TRACE_ID="<sample_trace_id>"
362
+
363
+ # Test scorer on single trace
364
+ uv run mlflow traces evaluate \
365
+ --output json \
366
+ --scorers ToolUsageAppropriate \
367
+ --trace-ids $TRACE_ID
368
+ ```
369
+
370
+ ### Verify Scorer Behavior
371
+
372
+ **Check 1: No Errors**
373
+
374
+ - Scorer executes without errors
375
+ - No null or empty outputs
376
+
377
+ **Check 2: Output Format**
378
+
379
+ - For yes/no: Returns "yes" or "no"
380
+ - For numeric: Returns number in expected range
381
+
382
+ **Check 3: Makes Sense**
383
+
384
+ - Review the trace
385
+ - Manually judge if scorer output is reasonable
386
+ - If scorer is wrong, refine instructions
387
+
388
+ **Check 4: Trace Coverage**
389
+
390
+ - Test on diverse traces (different query types)
391
+ - Ensure scorer handles all cases
392
+ - Check edge cases
393
+
394
+ ### Iteration Workflow
395
+
396
+ 1. **Register scorer** with initial instructions
397
+ 2. **Test on single trace** with known expected outcome
398
+ 3. **Review output** - does it match your judgment?
399
+ 4. **If wrong**: Refine instructions, re-register, test again
400
+ 5. **Test on diverse traces** (3-5 different types)
401
+ 6. **Deploy to full evaluation** once confident
402
+
403
+ ### Example Test Session
404
+
405
+ ```bash
406
+ # Test ToolUsageAppropriate scorer
407
+
408
+ # Test 1: Query that should use tools (expect: yes)
409
+ uv run mlflow traces evaluate \
410
+ --scorers ToolUsageAppropriate \
411
+ --trace-ids <trace_with_tool_use> \
412
+ --output json
413
+
414
+ # Test 2: Greeting that shouldn't use tools (expect: yes)
415
+ uv run mlflow traces evaluate \
416
+ --scorers ToolUsageAppropriate \
417
+ --trace-ids <trace_greeting> \
418
+ --output json
419
+
420
+ # Test 3: Query that should use tools but didn't (expect: no)
421
+ uv run mlflow traces evaluate \
422
+ --scorers ToolUsageAppropriate \
423
+ --trace-ids <trace_missing_tools> \
424
+ --output json
425
+ ```
426
+
427
+ Review each output to verify scorer behaves as expected.
428
+
429
+ ---
430
+
431
+ **For troubleshooting scorer issues**, see `references/troubleshooting.md`
@@ -0,0 +1,252 @@
1
+ # MLflow Environment Setup Guide
2
+
3
+ Complete guide for setting up MLflow environment before agent evaluation.
4
+
5
+ ## Table of Contents
6
+
7
+ 1. [Step 1: Install MLflow](#step-1-install-mlflow)
8
+ 2. [Step 2: Configure Environment](#step-2-configure-environment)
9
+ 3. [Step 3: Integrate MLflow Tracing](#step-3-integrate-mlflow-tracing)
10
+
11
+ ## Overview
12
+
13
+ Before evaluation, complete these setup steps in order.
14
+
15
+ ## Step 1: Install MLflow
16
+
17
+ Check if MLflow >=3.8.0 is installed:
18
+
19
+ ```bash
20
+ uv run mlflow --version
21
+ ```
22
+
23
+ If not installed or version too old:
24
+
25
+ ```bash
26
+ uv pip install mlflow>=3.8.0
27
+ ```
28
+
29
+ ## Step 2: Configure Environment
30
+
31
+ ### Quick Setup (Recommended - 90% of cases)
32
+
33
+ **Auto-detects Databricks or local MLflow server:**
34
+
35
+ Run these commands to auto-configure MLflow:
36
+
37
+ ```bash
38
+ # 1. Detect tracking server type
39
+ if databricks current-user me &> /dev/null; then
40
+ # Databricks detected
41
+ export MLFLOW_TRACKING_URI="databricks"
42
+ export DB_USER=$(databricks current-user me --output json | grep -o '"value":"[^"]*"' | head -1 | cut -d'"' -f4)
43
+ export PROJECT_NAME=$(basename $(pwd))
44
+ export EXP_NAME="/Users/$DB_USER/${PROJECT_NAME}-evaluation"
45
+ echo "✓ Detected Databricks"
46
+ echo " User: $DB_USER"
47
+ echo " Experiment: $EXP_NAME"
48
+ else
49
+ # Local or other server
50
+ export MLFLOW_TRACKING_URI="http://127.0.0.1:5000"
51
+ export PROJECT_NAME=$(basename $(pwd))
52
+ export EXP_NAME="${PROJECT_NAME}-evaluation"
53
+ echo "✓ Using local MLflow server"
54
+ echo " URI: $MLFLOW_TRACKING_URI"
55
+ echo " Experiment: $EXP_NAME"
56
+ echo ""
57
+ echo " Note: If MLflow server isn't running, start it with:"
58
+ echo " mlflow server --host 127.0.0.1 --port 5000 &"
59
+ fi
60
+
61
+ # 2. Find existing or create new experiment
62
+ export EXP_ID=$(uv run python -c "
63
+ import mlflow
64
+ mlflow.set_tracking_uri('$MLFLOW_TRACKING_URI')
65
+ experiments = mlflow.search_experiments(
66
+ filter_string=\"name = '$EXP_NAME'\",
67
+ max_results=1
68
+ )
69
+ if experiments:
70
+ print(experiments[0].experiment_id)
71
+ else:
72
+ print(mlflow.create_experiment('$EXP_NAME'))
73
+ ")
74
+
75
+ # 3. Display configuration
76
+ echo ""
77
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
78
+ echo "✓ MLflow Configuration Complete"
79
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
80
+ echo "Tracking URI: $MLFLOW_TRACKING_URI"
81
+ echo "Experiment ID: $EXP_ID"
82
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
83
+ echo ""
84
+
85
+ # Export for use in subsequent steps
86
+ export MLFLOW_EXPERIMENT_ID="$EXP_ID"
87
+ ```
88
+
89
+ **Alternative**: Use the setup script with auto-detection:
90
+
91
+ ```bash
92
+ uv run python scripts/setup_mlflow.py
93
+ # Auto-detects Databricks or local MLflow, creates experiment if needed
94
+ # Outputs: export MLFLOW_TRACKING_URI="..." and export MLFLOW_EXPERIMENT_ID="..."
95
+ ```
96
+
97
+ **After running the above commands**, automatically detect and update the agent's configuration:
98
+
99
+ 1. **Detect configuration mechanism** by checking for:
100
+ - `.env` file (most common)
101
+ - `config.py` or `settings.py` with Settings/Config class
102
+ - Other configuration files
103
+
104
+ 2. **Update configuration automatically**:
105
+ - If `.env` exists: Append `MLFLOW_TRACKING_URI` and `MLFLOW_EXPERIMENT_ID`
106
+ - If config class exists: Add `mlflow_tracking_uri` and `mlflow_experiment_id` fields
107
+ - If neither exists: Set environment variables in agent initialization code
108
+
109
+ 3. **Verify configuration** by importing the agent and checking values load correctly:
110
+ ```bash
111
+ uv run python -c "
112
+ import os
113
+ import mlflow
114
+
115
+ tracking_uri = os.getenv('MLFLOW_TRACKING_URI')
116
+ experiment_id = os.getenv('MLFLOW_EXPERIMENT_ID')
117
+
118
+ if tracking_uri and experiment_id:
119
+ print(f'✓ MLFLOW_TRACKING_URI: {tracking_uri}')
120
+ print(f'✓ MLFLOW_EXPERIMENT_ID: {experiment_id}')
121
+ mlflow.set_tracking_uri(tracking_uri)
122
+ exp = mlflow.get_experiment(experiment_id)
123
+ print(f'✓ Connected to experiment: {exp.name}')
124
+ else:
125
+ print('⚠ Environment variables not set - check agent configuration')
126
+ "
127
+ ```
128
+ ```
129
+
130
+ **If the quick setup succeeds**, you're done! Skip to Step 3.
131
+
132
+ **If the quick setup fails**, proceed to Manual Setup below.
133
+
134
+ ---
135
+
136
+ ### Manual Setup (10% edge cases)
137
+
138
+ **Note**: The `setup_mlflow.py` script now includes auto-detection for most scenarios. Manual setup is primarily needed for edge cases where auto-detection cannot work.
139
+
140
+ Use manual setup if:
141
+ - Using a custom remote MLflow server (not Databricks, not localhost)
142
+ - Non-standard port or hostname for local server
143
+ - Quick setup and `setup_mlflow.py` both failed
144
+ - Need more control over experiment naming or configuration
145
+
146
+ #### Step 2.1: Set Tracking URI
147
+
148
+ Choose your tracking server type:
149
+
150
+ ```bash
151
+ # For Databricks
152
+ export MLFLOW_TRACKING_URI="databricks"
153
+
154
+ # For local server (start server first: mlflow server --host 127.0.0.1 --port 5000 &)
155
+ export MLFLOW_TRACKING_URI="http://127.0.0.1:5000"
156
+
157
+ # For other remote server
158
+ export MLFLOW_TRACKING_URI="<your_server_uri>"
159
+ ```
160
+
161
+ #### Step 2.2: Find or Create Experiment
162
+
163
+ **Option A: Use Existing Experiment**
164
+
165
+ Find an experiment to use (efficient lookup by name):
166
+
167
+ ```bash
168
+ export EXP_NAME="<your_experiment_name>"
169
+ export EXP_ID=$(uv run python -c "
170
+ import mlflow
171
+ mlflow.set_tracking_uri('$MLFLOW_TRACKING_URI')
172
+ experiments = mlflow.search_experiments(
173
+ filter_string=\"name = '$EXP_NAME'\",
174
+ max_results=1
175
+ )
176
+ print(experiments[0].experiment_id if experiments else 'NOT_FOUND')
177
+ ")
178
+
179
+ if [ "$EXP_ID" = "NOT_FOUND" ]; then
180
+ echo "Experiment not found: $EXP_NAME"
181
+ exit 1
182
+ fi
183
+
184
+ export MLFLOW_EXPERIMENT_ID="$EXP_ID"
185
+ ```
186
+
187
+ **Option B: Create New Experiment**
188
+
189
+ ```bash
190
+ # For Databricks - must use /Users/<username>/<name> format
191
+ export EXP_NAME="/Users/<your_email>/<experiment_name>"
192
+ uv run mlflow experiments create --experiment-name "$EXP_NAME"
193
+
194
+ # For local - simple name works
195
+ export EXP_NAME="<experiment_name>"
196
+ uv run mlflow experiments create --experiment-name "$EXP_NAME"
197
+
198
+ # Get the experiment ID
199
+ export EXP_ID=$(uv run python -c "
200
+ import mlflow
201
+ mlflow.set_tracking_uri('$MLFLOW_TRACKING_URI')
202
+ exp = mlflow.get_experiment_by_name('$EXP_NAME')
203
+ print(exp.experiment_id)
204
+ ")
205
+ export MLFLOW_EXPERIMENT_ID="$EXP_ID"
206
+ ```
207
+
208
+ #### Step 2.3: Persist Configuration
209
+
210
+ Add to .env file:
211
+
212
+ ```bash
213
+ cat >> .env << EOF
214
+
215
+ # MLflow Configuration
216
+ MLFLOW_TRACKING_URI=$MLFLOW_TRACKING_URI
217
+ MLFLOW_EXPERIMENT_ID=$MLFLOW_EXPERIMENT_ID
218
+ EOF
219
+ ```
220
+
221
+ Add to config.py Settings class (if not present):
222
+
223
+ ```python
224
+ # MLflow Configuration
225
+ mlflow_tracking_uri: Optional[str] = Field(
226
+ default=None,
227
+ description="MLflow tracking URI (e.g., 'databricks', 'http://localhost:5000')",
228
+ )
229
+ mlflow_experiment_id: Optional[str] = Field(
230
+ default=None,
231
+ description="MLflow experiment ID for logging traces and evaluation results",
232
+ )
233
+ ```
234
+
235
+ #### Step 2.4: Verify Configuration
236
+
237
+ ```bash
238
+ uv run python -c "
239
+ from config import settings
240
+ assert settings.mlflow_tracking_uri, 'MLFLOW_TRACKING_URI not loaded'
241
+ assert settings.mlflow_experiment_id, 'MLFLOW_EXPERIMENT_ID not loaded'
242
+ print('✓ MLflow configuration verified')
243
+ "
244
+ ```
245
+
246
+ ## Setup Complete - Environment Configured
247
+
248
+ To complete the setup, verify:
249
+
250
+ - [ ] MLflow >=3.8.0 installed (`uv run mlflow --version`)
251
+ - [ ] MLFLOW_TRACKING_URI set (points to your tracking server)
252
+ - [ ] MLFLOW_EXPERIMENT_ID set (experiment exists and is accessible)