@mutagent/helix 0.1.0-alpha.14

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 (357) hide show
  1. package/.claude/skills/mutagent-helix/SKILL.md +113 -0
  2. package/.claude/skills/mutagent-helix/scripts/cli/codex-transcode.ts +143 -0
  3. package/.claude/skills/mutagent-helix/scripts/cli/doctor.ts +111 -0
  4. package/.claude/skills/mutagent-helix/scripts/cli/init.ts +382 -0
  5. package/.claude/skills/mutagent-helix/scripts/cli/run.sh +61 -0
  6. package/CLAUDE.md +193 -0
  7. package/LICENSE +201 -0
  8. package/NOTICE +22 -0
  9. package/README.md +209 -0
  10. package/assets/adl-loop.svg +162 -0
  11. package/assets/system-status.svg +422 -0
  12. package/bin/mutagent-cli.mjs +9950 -0
  13. package/bin/mutagent-helix.mjs +78 -0
  14. package/mutagent-agentspec/.claude/skills/mutagent-agentspec/CLAUDE.md +28 -0
  15. package/mutagent-agentspec/.claude/skills/mutagent-agentspec/SKILL.md +138 -0
  16. package/mutagent-agentspec/.claude/skills/mutagent-agentspec/assets/templates/agentspec.yaml.tpl +247 -0
  17. package/mutagent-agentspec/.claude/skills/mutagent-agentspec/references/frameworks/doc-pins.md +53 -0
  18. package/mutagent-agentspec/.claude/skills/mutagent-agentspec/references/principles.md +91 -0
  19. package/mutagent-agentspec/.claude/skills/mutagent-agentspec/references/requirements.yaml +295 -0
  20. package/mutagent-agentspec/.claude/skills/mutagent-agentspec/references/workflows/orchestrator-protocol.md +302 -0
  21. package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/cli/doctor.ts +116 -0
  22. package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/cli/init.ts +230 -0
  23. package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/cli/run.sh +60 -0
  24. package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/config/resolve-spec-dir.ts +199 -0
  25. package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/contract/agentspec.schema.ts +455 -0
  26. package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/setup/detect.ts +67 -0
  27. package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/validate/validate-spec.ts +93 -0
  28. package/mutagent-agentspec/LICENSE +201 -0
  29. package/mutagent-agentspec/NOTICE +19 -0
  30. package/mutagent-agentspec/README.md +44 -0
  31. package/mutagent-builder/.claude/skills/mutagent-builder/SKILL.md +100 -0
  32. package/mutagent-builder/.claude/skills/mutagent-builder/assets/agents/ai-architect.md +312 -0
  33. package/mutagent-builder/.claude/skills/mutagent-builder/assets/agents/ai-engineer.md +357 -0
  34. package/mutagent-builder/.claude/skills/mutagent-builder/assets/templates/build-report.md.tpl +39 -0
  35. package/mutagent-builder/.claude/skills/mutagent-builder/references/principles.md +31 -0
  36. package/mutagent-builder/.claude/skills/mutagent-builder/references/workflows/build-protocol.md +61 -0
  37. package/mutagent-builder/.claude/skills/mutagent-builder/references/workflows/improve-handoff.md +23 -0
  38. package/mutagent-builder/.claude/skills/mutagent-builder/scripts/cli/run.sh +60 -0
  39. package/mutagent-builder/.claude/skills/mutagent-builder/scripts/handoff/validate-build-input.ts +72 -0
  40. package/mutagent-builder/.claude/skills/mutagent-builder/scripts/sync-spec/check-sync-spec.ts +499 -0
  41. package/mutagent-builder/.claude/skills/mutagent-builder/scripts/verify/spec-impl-coverage.ts +182 -0
  42. package/mutagent-builder/CLAUDE.md +25 -0
  43. package/mutagent-builder/README.md +26 -0
  44. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/README.md +192 -0
  45. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/SKILL.md +352 -0
  46. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/agents/ai-architect.md +256 -0
  47. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/agents/ai-engineer.md +344 -0
  48. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/agents/diagnostics-analyzer.md +576 -0
  49. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/agents/discovery.md +425 -0
  50. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/audit.json.tpl +24 -0
  51. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/audit.md.tpl +49 -0
  52. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/config.yaml.tpl +100 -0
  53. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/pr-body.md.tpl +56 -0
  54. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/report.html.tpl +327 -0
  55. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/README.md +27 -0
  56. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/iter-N-handover.md.tpl +125 -0
  57. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/self-diagnosis-contract.v0.1.0.yaml.tpl +234 -0
  58. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/spec.yaml.tpl +152 -0
  59. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/team.yaml.tpl +127 -0
  60. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/wave-N-dashboard.html.tpl +1712 -0
  61. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.1-nl-query.md +59 -0
  62. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.2-tier0-progress.md +58 -0
  63. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.3-analysis-progress.md +44 -0
  64. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.4-html-report.md +61 -0
  65. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.5-rca-detail.md +69 -0
  66. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.6-stale-warning.md +53 -0
  67. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.1-welcome.md +60 -0
  68. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.2-source-platform-picker.md +41 -0
  69. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.3-source-auth.md +75 -0
  70. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.4-target-picker.md +48 -0
  71. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.5-ask-tool.md +43 -0
  72. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.6-config-review.md +57 -0
  73. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.7-filter-defaults.md +52 -0
  74. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.8-first-run.md +59 -0
  75. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/examples/sample-findings.json +92 -0
  76. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/examples/sample-meta.json +47 -0
  77. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/adapter-strategy.md +75 -0
  78. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/config-migration.md +84 -0
  79. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/config.md +159 -0
  80. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/filter-search-matrix.md +66 -0
  81. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/harness-knowledge.md +22 -0
  82. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/memory-format.md +78 -0
  83. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/onboarding-decisions.yaml +187 -0
  84. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/operation-inventory.md +59 -0
  85. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/overview.md +167 -0
  86. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/reference.md +119 -0
  87. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/script-index.md +101 -0
  88. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-adapter-contract.md +93 -0
  89. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/claude-code-transcripts.md +66 -0
  90. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/codex-transcripts.md +78 -0
  91. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/codex.md +145 -0
  92. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/install-paths.md +57 -0
  93. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/langfuse.md +178 -0
  94. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/local-jsonl.md +55 -0
  95. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/openobserve.md +102 -0
  96. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/otel.md +63 -0
  97. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/cloud-rest.md +84 -0
  98. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-claude.md +65 -0
  99. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-cloud-agent-sdk.md +92 -0
  100. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-codex.md +72 -0
  101. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-cursor.md +108 -0
  102. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-mastra.md +77 -0
  103. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-opencode.md +70 -0
  104. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/apply-pr-comment-format.md +82 -0
  105. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/diagnostics.md +35 -0
  106. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/handover-contract.md +247 -0
  107. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/onboarding.md +300 -0
  108. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/orchestrator-protocol.md +1861 -0
  109. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/rca.md +331 -0
  110. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/rendering-anatomy.md +314 -0
  111. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/schedule-prep.md +100 -0
  112. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/scope-model.md +128 -0
  113. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/verification-methodology.md +174 -0
  114. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/aggregate/sort-findings.ts +0 -0
  115. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/awareness/blind-spots.ts +167 -0
  116. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/awareness/llm-sample.ts +681 -0
  117. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/cli/doctor.ts +215 -0
  118. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/cli/init.ts +1013 -0
  119. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/cli/install-agents.ts +350 -0
  120. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/cli/run.sh +61 -0
  121. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/cli/shared-templates.ts +79 -0
  122. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/config/load.ts +392 -0
  123. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/config/resolve-credential.ts +120 -0
  124. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/config/schema.ts +641 -0
  125. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/config/validate.ts +134 -0
  126. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/context/build-diagnosis-context.ts +417 -0
  127. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/context/load-context.ts +105 -0
  128. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/contract/types.ts +166 -0
  129. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/enrich/build-render-input.ts +1964 -0
  130. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/enrich/corpus-severity.ts +172 -0
  131. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/enrich/dismissal-match.ts +270 -0
  132. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/enrich/rank-remedies.ts +75 -0
  133. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/hooks/install-hooks.sh +46 -0
  134. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/hooks/pre-push.sh +78 -0
  135. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/invocation/parse-brief.ts +188 -0
  136. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/library/match.ts +114 -0
  137. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/library/paths.ts +95 -0
  138. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/library/store.ts +535 -0
  139. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/library/types.ts +181 -0
  140. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/lint/template-inline-js.ts +267 -0
  141. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/memory/append.ts +188 -0
  142. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/memory/read.ts +218 -0
  143. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/normalize/platforms/entity-context.ts +686 -0
  144. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/normalize/read-unitf.ts +267 -0
  145. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/normalize/trace.ts +1078 -0
  146. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/normalize/unitf-adapter.ts +0 -0
  147. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/normalize/unitf-types.ts +213 -0
  148. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/report/persist-selections.ts +174 -0
  149. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/report/render.ts +3254 -0
  150. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/run/diagnose.ts +64 -0
  151. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/run/session.ts +167 -0
  152. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/sample/caps.ts +345 -0
  153. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/sample/deep-read-gate.ts +424 -0
  154. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/sample/representative.ts +584 -0
  155. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/scan/objection.ts +224 -0
  156. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/scan/trajectory.ts +489 -0
  157. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/self-diagnostics/dispatch.ts +135 -0
  158. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/self-diagnostics/probe.ts +170 -0
  159. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/setup/detect.ts +307 -0
  160. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/setup/ensure-cli.ts +315 -0
  161. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/setup/reconfigure.ts +77 -0
  162. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/setup/verify-agents.ts +207 -0
  163. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/slicer.ts +166 -0
  164. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/adapters/claude-code.ts +17 -0
  165. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/adapters/codex.ts +11 -0
  166. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/adapters/langfuse.ts +17 -0
  167. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/adapters/local-jsonl.ts +12 -0
  168. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/adapters/otel.ts +12 -0
  169. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/index.ts +54 -0
  170. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/registry.ts +45 -0
  171. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/types.ts +86 -0
  172. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/stale-detector.ts +74 -0
  173. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/test/render-playwright.cli.ts +477 -0
  174. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/tier0/claude-code.ts +133 -0
  175. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/tier0/langfuse.ts +143 -0
  176. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/tier0-scan.ts +423 -0
  177. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/completeness-check.ts +436 -0
  178. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/doc-refs.ts +190 -0
  179. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/finalize-gate.ts +417 -0
  180. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/findings-contract.ts +628 -0
  181. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/render-js-syntax.ts +188 -0
  182. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/report-checklist.yaml +217 -0
  183. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/trace-shape.ts +262 -0
  184. package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/wave6-checklist.ts +326 -0
  185. package/mutagent-diagnostics/CLAUDE.md +41 -0
  186. package/mutagent-diagnostics/LICENSE +201 -0
  187. package/mutagent-diagnostics/NOTICE +18 -0
  188. package/mutagent-diagnostics/README.md +343 -0
  189. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/SKILL.md +548 -0
  190. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/agents/audit-executor.md +169 -0
  191. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/agents/dataset-builder.md +160 -0
  192. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/agents/discovery.md +425 -0
  193. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/agents/evaluator.md +1108 -0
  194. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/brand/theme.css +213 -0
  195. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/brand/wordmark.html +9 -0
  196. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/lenses/context-flow-lens.md +85 -0
  197. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/lenses/data-lens.md +47 -0
  198. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/lenses/decision-lens.md +48 -0
  199. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/lenses/methodology-critic-lens.md +53 -0
  200. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/lenses/trajectory-lens.md +44 -0
  201. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/build-review-interface.md +83 -0
  202. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/edd-loop.md +134 -0
  203. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/error-analysis.md +113 -0
  204. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/eval-audit.md +154 -0
  205. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/eval-stage.md +168 -0
  206. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/generate-synthetic-data.md +81 -0
  207. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/grounded-adjudication.md +221 -0
  208. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/memory-format.md +65 -0
  209. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/methodology.md +201 -0
  210. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/operation-inventory.md +197 -0
  211. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/validate-evaluator.md +125 -0
  212. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/workflows/orchestrator-protocol.md +300 -0
  213. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/write-judge-prompt.md +123 -0
  214. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/behavior-tree.schema.yaml +73 -0
  215. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/dataset.schema.yaml +66 -0
  216. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/edd-change-request.schema.yaml +114 -0
  217. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/eval-matrix.schema.yaml +74 -0
  218. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/flow-graph.schema.yaml +69 -0
  219. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/flow-profile.schema.yaml +49 -0
  220. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/methodology-review.schema.yaml +40 -0
  221. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/scorecard.schema.yaml +85 -0
  222. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/agent-dispatch.ts +0 -0
  223. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/aggregate-discover.ts +543 -0
  224. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/artifact-paths.ts +115 -0
  225. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/assemble-scorecard.ts +172 -0
  226. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/build-dataset.ts +186 -0
  227. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/build-evals.ts +93 -0
  228. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/build-review-ui.ts +393 -0
  229. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/check-method-router.ts +170 -0
  230. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/aggregate.ts +112 -0
  231. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/audit-run.ts +182 -0
  232. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/doctor.ts +211 -0
  233. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/dogfood.ts +133 -0
  234. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/init.ts +601 -0
  235. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/methodology-review.ts +122 -0
  236. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/prep.ts +295 -0
  237. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/profile-subject.ts +165 -0
  238. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/run.sh +56 -0
  239. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/variance-check.ts +105 -0
  240. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/code-eval.ts +248 -0
  241. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/code-quality-verdict.ts +285 -0
  242. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/codegen-evals.ts +173 -0
  243. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cold-start-project.ts +151 -0
  244. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cold-start-sampler.ts +267 -0
  245. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/config/load.ts +343 -0
  246. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/config/schema.ts +380 -0
  247. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/agentspec-evals.ts +85 -0
  248. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/dataset.ts +149 -0
  249. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/eval-engine.ts +118 -0
  250. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/eval-matrix.ts +577 -0
  251. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/eval-types.ts +1074 -0
  252. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/flow-graph.ts +194 -0
  253. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/types.ts +303 -0
  254. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/validation.ts +193 -0
  255. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/derive-dataset.ts +152 -0
  256. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/determine-outcome.ts +219 -0
  257. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/diff-discriminate.ts +160 -0
  258. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/discover-criteria.ts +348 -0
  259. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/edd/change-request.ts +232 -0
  260. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/edd/edd-types.ts +210 -0
  261. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/edd/variance-gate.ts +186 -0
  262. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/emit-completeness.ts +111 -0
  263. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/eval-engine.ts +160 -0
  264. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/evaluate.ts +333 -0
  265. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/flow-graph.ts +230 -0
  266. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/judge-prompt-template.ts +253 -0
  267. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/judge-provider.ts +135 -0
  268. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/lint-grounding.ts +229 -0
  269. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/lint-uniformity.ts +168 -0
  270. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/living-suite.ts +109 -0
  271. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/load-bundle.ts +203 -0
  272. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/load-profile-vocab.ts +64 -0
  273. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/load-profile.ts +106 -0
  274. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/mask.ts +138 -0
  275. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/materialize-dataset.ts +113 -0
  276. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/matrix-judge.ts +750 -0
  277. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/memory/append.ts +215 -0
  278. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/memory/read.ts +168 -0
  279. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/persist-eval-criteria.ts +232 -0
  280. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/prep-tasks.ts +125 -0
  281. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/profile-subject.ts +310 -0
  282. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/publish-report.ts +131 -0
  283. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/read-unitf-traces.ts +81 -0
  284. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/render-build-cards.ts +195 -0
  285. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/render-discover-report.ts +1640 -0
  286. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/render-eval-report.ts +3838 -0
  287. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/render-report.ts +212 -0
  288. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/resolve-credential.ts +110 -0
  289. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/resolve-ref.ts +98 -0
  290. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/result-verify.ts +129 -0
  291. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/route-failures.ts +330 -0
  292. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/run-deterministic.ts +367 -0
  293. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/run-evaluate.ts +719 -0
  294. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/run-judge.ts +155 -0
  295. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/run-pipeline.ts +175 -0
  296. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/sample-traces.ts +210 -0
  297. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/self-audit.ts +387 -0
  298. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/source-map.ts +106 -0
  299. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/subject-profile.ts +134 -0
  300. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/substrate.ts +162 -0
  301. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/sync-eval-criteria.ts +244 -0
  302. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/ui-slots.ts +119 -0
  303. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/unitf-to-evaltrace.ts +284 -0
  304. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/validate-judge.ts +358 -0
  305. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/variance-compare.ts +177 -0
  306. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/subjects/mutagent-diagnostics/behavior-tree.yaml +140 -0
  307. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/subjects/mutagent-diagnostics/eval-matrix.yaml +1270 -0
  308. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/subjects/mutagent-diagnostics/methodology-review.yaml +105 -0
  309. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/workflows/audit.workflow.js +82 -0
  310. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/workflows/data-leak.workflow.js +236 -0
  311. package/mutagent-evaluator/.claude/skills/mutagent-evaluator/workflows/variance.workflow.js +163 -0
  312. package/mutagent-evaluator/CLAUDE.md +45 -0
  313. package/mutagent-evaluator/LICENSE +201 -0
  314. package/mutagent-evaluator/NOTICE +23 -0
  315. package/mutagent-evaluator/README.md +88 -0
  316. package/mutagent-optimize/.claude/skills/mutagent-optimize/SKILL.md +287 -0
  317. package/mutagent-optimize/.claude/skills/mutagent-optimize/scripts/contracts/amend-request.ts +503 -0
  318. package/mutagent-optimize/.claude/skills/mutagent-optimize/scripts/improve-loop-run.ts +304 -0
  319. package/mutagent-optimize/.claude/skills/mutagent-optimize/scripts/loop-state-cli.ts +300 -0
  320. package/mutagent-optimize/.claude/skills/mutagent-optimize/scripts/loop-state.ts +440 -0
  321. package/mutagent-optimize/CLAUDE.md +49 -0
  322. package/mutagent-optimize/README.md +26 -0
  323. package/mutagent-orchestrator/CLAUDE.md +102 -0
  324. package/mutagent-orchestrator/README.md +20 -0
  325. package/mutagent-orchestrator/assets/agents/discovery.md +425 -0
  326. package/mutagent-orchestrator/assets/agents/dogfood-monitor.md +266 -0
  327. package/mutagent-orchestrator/assets/agents/monitor.md +258 -0
  328. package/mutagent-orchestrator/orchestrator.md +782 -0
  329. package/mutagent-orchestrator/references/MONITORING.md +209 -0
  330. package/mutagent-orchestrator/references/config-fields.md +132 -0
  331. package/mutagent-orchestrator/references/config-migration.md +132 -0
  332. package/mutagent-orchestrator/references/index-registry.md +92 -0
  333. package/mutagent-orchestrator/routing.yaml +391 -0
  334. package/mutagent-orchestrator/scripts/config-schema.ts +1010 -0
  335. package/mutagent-orchestrator/scripts/dispatch.ts +439 -0
  336. package/mutagent-orchestrator/scripts/dogfood/extract-feedback.ts +203 -0
  337. package/mutagent-orchestrator/scripts/dogfood/reconstruct-trajectory.ts +327 -0
  338. package/mutagent-orchestrator/scripts/dogfood/render-dogfood-report.ts +347 -0
  339. package/mutagent-orchestrator/scripts/dogfood/resolve-subagents.ts +160 -0
  340. package/mutagent-orchestrator/scripts/dogfood/run-report.ts +264 -0
  341. package/mutagent-orchestrator/scripts/dogfood/slack-thread.ts +106 -0
  342. package/mutagent-orchestrator/scripts/dogfood/types.ts +257 -0
  343. package/mutagent-orchestrator/scripts/eval-routing.ts +753 -0
  344. package/mutagent-orchestrator/scripts/gate.ts +219 -0
  345. package/mutagent-orchestrator/scripts/handover-contract.ts +362 -0
  346. package/mutagent-orchestrator/scripts/index/build-index.ts +351 -0
  347. package/mutagent-orchestrator/scripts/index/render-index.ts +110 -0
  348. package/mutagent-orchestrator/scripts/monitor/slack-notify.ts +111 -0
  349. package/mutagent-orchestrator/scripts/monitor/triggers.ts +162 -0
  350. package/mutagent-orchestrator/scripts/onboarding-check.ts +369 -0
  351. package/mutagent-orchestrator/scripts/render-roster.ts +308 -0
  352. package/mutagent-orchestrator/scripts/resolve-credential.ts +185 -0
  353. package/mutagent-orchestrator/scripts/resolve-paths.ts +114 -0
  354. package/mutagent-orchestrator/scripts/slack/format.ts +63 -0
  355. package/mutagent-orchestrator/scripts/slack/post.ts +115 -0
  356. package/mutagent-orchestrator/scripts/sync-index.ts +311 -0
  357. package/package.json +64 -0
@@ -0,0 +1,197 @@
1
+ # Operation Inventory — LLM-only / Code-only / Hybrid Classification
2
+
3
+ > Every evaluator action is classified into exactly one of three types. No overlap.
4
+ > This inventory is the **source of truth the script-austerity audit enforces**: a
5
+ > script may be Code-only or the deterministic half of a Hybrid — it may NEVER hold
6
+ > LLM-reasoning prompt prose or make a pass/fail decision. That reasoning belongs in
7
+ > a subagent def (`assets/agents/{evaluator,audit-executor}.md`).
8
+ >
9
+ > Mirrors the SHAPE of `mutagent-diagnostics` `references/operation-inventory.md`
10
+ > (sealed-sibling: shape mirrored, never source-referenced). Diagnostics' Type
11
+ > A/B/C map onto this skill's vocabulary as: **Type A = Code-only (script)** ·
12
+ > **Type B = LLM-only (subagent)** · **Type C = Hybrid (agent invokes script)**.
13
+
14
+ ## Classification Rules
15
+
16
+ - **Code-only — Type A — Pure Script**: deterministic logic, structured I/O.
17
+ TypeScript, invoked via `Bash("scripts/cli/run.sh scripts/<name>.ts ...")`. Zero
18
+ LLM calls, no provider SDK on the default path. Unit-testable in isolation with a
19
+ stub. PURE (no clock / random / network in the core).
20
+ - **LLM-only — Type B — Agent Operation**: host-runtime reasoning by a dispatched
21
+ `pure_subagent_executor` (`Agent({subagent_type})`), or an `AskUserQuestion` /
22
+ chat-fallback HITL gate. The reasoning RUBRIC lives in the subagent def, never in
23
+ a script. Cannot be unit-tested in isolation.
24
+ - **Hybrid — Type C**: the parent session invokes a Code-only script for the
25
+ deterministic shape, dispatches a subagent for the reasoning, and reads the
26
+ structured output back. The agent decides *when/how* to invoke; the script
27
+ decides *nothing* about the verdict.
28
+
29
+ > **The judging pattern is Hybrid by construction (agent-dispatch DEFAULT):**
30
+ > `PREP (Code-only script → task/packet files) → DISPATCH (LLM-only subagent →
31
+ > verdict files) → AGGREGATE (Code-only script → labels / scorecard)`. The verdict
32
+ > NEVER comes from a script calling a provider; it comes from a host-runtime
33
+ > subagent, read back from a verdict FILE (`references/workflows/orchestrator-protocol.md`).
34
+
35
+ ---
36
+
37
+ ## Type A — Code-only (Pure Scripts)
38
+
39
+ Deterministic. Zero LLM on the default path. A stub `JudgeInvoke` (a file read, or a
40
+ fixed JSON string) satisfies the gate.
41
+
42
+ ### v2 eval-development engine
43
+
44
+ | Op | File | Why Code-only |
45
+ |----|------|---------------|
46
+ | Eval-matrix × trajectory PREP+AGGREGATE | `scripts/matrix-judge.ts` | Builds the per-trajectory DATA packet (whole matrix + trajectory + transcript) and folds the Judge Agent verdict files into the GATE rollup. **No judge prompt, no LLM** — reasoning is the Judge Agent's (`assets/agents/evaluator.md#mode-judge-trajectory`). |
47
+ | Eval-matrix × trajectory data contract | `scripts/contracts/eval-matrix.ts` | TypeBox shapes (MatrixCriterion/Packet/Verdict) + `parseMatrixVerdictFile`/`assertMatrixPacket`. Schema + validation only. |
48
+ | Agent-dispatch transport | `scripts/agent-dispatch.ts` | `promptHash` content key · `writeJudgeTask` (PREP) · `createAgentDispatchJudge` (AGGREGATE = **reads a verdict file**, no LLM) · `missingVerdictKeys`. The DEFAULT judge transport. |
49
+ | Determiner + judge PREP | `scripts/prep-tasks.ts` | `prepDeterminerTasks` / `prepJudgeTasks` — emit task-spec files (the exact prompt + pinned envelope). Reads stage-A verdicts to build stage-B; never decides. |
50
+ | Determiner DATA (EV-042) | `scripts/determine-outcome.ts` | **Slimmed to Type A (austerity):** `extractOutcomeSignals` (signal prep — toolCount is a signal, never a verdict) · `parseCritiqueVerdict` (critique-before-verdict schema gate) · `assembleOutcome` (deterministic verdict + signals → result). NO judge prompt, NO LLM. The success/failure DECISION is `evaluator.md#mode-discover`'s. |
51
+ | Judge-spec DATA (EV-043) | `scripts/build-evals.ts` | **Slimmed to Type A (austerity):** `splitTrainEval` (held-out split) · `assertExemplarsFromTrain` (leakage guard) · `buildJudgeSpec` (4-component SPEC DATA, no Likert). NO judge prompt, NO LLM. The judging rubric is `evaluator.md#mode-judge-criterion`'s. |
52
+ | Judge-prompt renderer (EV-050 EXCEPTION) | `scripts/judge-prompt-template.ts` | The ONE place a judge prompt is rendered — the operator-named export/in-house **exception** (templating, not skill-triggered judging). Holds `buildOutcomePrompt`/`buildJudgePrompt` + the in-house/export run-wrappers `determineOutcome`/`runJudge`. **The DEFAULT agent-dispatch path NEVER imports it**; the subagent defs are the rubric source-of-truth, this is their provider-call mirror. |
53
+ | GATE + variance rollup | `scripts/evaluate.ts` | `evaluateGate` (severity-gated binary) · `evalScoreVariance` · `trajectoryVariance` · `rollupScorecard`. Pure math over verdicts. |
54
+ | Emergent-criteria remainder | `scripts/discover-criteria.ts` | `failureRates` · `deriveCriteria` · saturation detection. The clustering itself is the evaluator `#mode-discover`'s job; this is the deterministic aggregate over its labels. |
55
+ | Balanced sampling | `scripts/sample-traces.ts` | Random + outlier + failure-driven + uncertainty + stratified ✓/✗ sampling. Deterministic math (re-implements the diagnostics filtering PATTERN; never imports it). |
56
+ | Subject auto-gen core | `scripts/profile-subject.ts` | Infer tool inventory + event taxonomy from `observations[].type=="TOOL"` frequency. Pure trace stats. |
57
+ | Route-failures handoff | `scripts/route-failures.ts` | `routeFailures` / `validateHandoverBundle` — serialize a diagnostics-handoff bundle. EV-051 judge-only: emits, never fixes. |
58
+ | UniTF trace intake | `scripts/read-unitf-traces.ts` + `scripts/unitf-to-evaltrace.ts` | `parseUnitfJsonl` / `readUnitfAsEvalTraces` — read the handed-over UniTF `.jsonl` (`mutagent-cli trace fetch --export` output) → `EvalTrace[]` via `projectUnitfToEvalTrace`. Tolerant parse; malformed/non-UniTF lines skipped+counted. The skill NEVER fetches (`mutagent-cli trace --help`). |
59
+ | Profile loader | `scripts/load-profile.ts` | YAML parse + TypeBox validation of `subjects/<name>/*.yaml`. |
60
+ | Shared v2 contracts | `scripts/contracts/eval-types.ts` | TraceLabel · Category · CriterionSpec · JudgeVerdict · Scorecard type defs. |
61
+ | Byte-identity masking | `scripts/mask.ts` | C-PIN: strips runId / timestamps / abs-paths so reruns are byte-identical. |
62
+ | Substrate selection | `scripts/substrate.ts` | `resolveJudgeRuntime` / `judgeForRuntime` — returns the chosen `JudgeInvoke` seam (default = agent-dispatch file read). Selection logic only; holds no prompt. |
63
+ | PREP I/O shell | `scripts/cli/prep.ts` | Writes task-spec files over the tested PREP cores. Calls NO LLM / NO provider. |
64
+ | Runner | `scripts/cli/run.sh` | bun→pnpm→npm dispatch. |
65
+ | Publish guard | `scripts/release/prepublish-guard.mjs` | Leak/version-mismatch pre-publish checks. |
66
+
67
+ ### v2 eval-development engine — W2 (trust + data)
68
+
69
+ Deterministic shape for the W2 trust+data track. Each holds NO judge prompt and
70
+ makes NO pass/fail decision; the LLM/HITL halves are Type B (below).
71
+
72
+ | Op | File | Why Code-only |
73
+ |----|------|---------------|
74
+ | `*validate` stats (EV-044) | `scripts/validate-judge.ts` | Confusion matrix → TPR/TNR (not raw accuracy) · split-disjointness + TEST-ONCE guards · Rogan-Gladen θ=(p_obs+TNR−1)/(TPR+TNR−1) w/ clip + invalid-when denom≈0 · DETERMINISTIC seeded-LCG bootstrap CI (no Math.random) · graceful `unvalidated` degradation under MIN_LABELS. Pure math; the verdicts it consumes come from dispatched evaluator (`#mode-judge-criterion`) files. The Code half of the `*validate` Hybrid (mostly CODE). |
75
+ | `*review` UI render (EV-045) | `scripts/build-review-ui.ts` | `renderReviewUi` — DETERMINISTIC HTML annotation interface (one trace/screen, native-format render, Pass/Fail/Defer, notes, keyboard, localStorage auto-save, labels export) + `mergeLabels` (round-trip + dedup by traceId). Holds NO judge prompt; the HUMAN decides. The Code half of the `*review` Hybrid (CODE render + HITL label). |
76
+ | `*build-dataset` expand (EV-046) | `scripts/build-dataset.ts` | `buildCase` · cartesian dimension×value expand · deterministic token-Jaccard near-dup removal · content-derived id · `mergeCases` MONOTONIC merge. The agent PROPOSES realism; the script ENFORCES non-redundancy. Code half of the 3-way `*build-dataset` Hybrid. |
77
+ | `*discover-dataset` distill (EV-047) | `scripts/derive-dataset.ts` | Distill a living regression set from past ✓/✗ — reuses EV-052 `sample-traces.ts` selectors (failure/outlier/uncertainty) + EV-046 monotonic merge; trace→`DatasetCase` whose query IS the real input. Labels already on traces (from `*discover-evals`); makes NO new decision. Type A Code-only. |
78
+ | Living-suite writer (EV-053) | `scripts/living-suite.ts` | `appendOnly` + `assertMonotonicGrowth` — generic-over-`T` append-only writer (a living artifact NEVER shrinks) shared by datasets + criteria. Pure-counter provenance (no clock → byte-identity, C-PIN). Pure set algebra w/ fail-loud monotonicity guard. |
79
+ | Eval-leg reconcile contract (W2I5 · KP-003) | `scripts/sync-eval-criteria.ts` | The eval leg of `#sync-spec` (def → impl → eval triad). `evalLegForSubjectKind` (agent/skill → eval-suite · code → code-quality) · `flagEvalLegDrift`/`assessEvalLeg` (pure freshness flag) · `reconcileEvalCriteria` (upsert-by-id criteria MAINTENANCE via `assertMonotonicGrowth` — never drops, EV-053). Criteria maintenance, NOT judging (EV-051): scores nothing, decides no pass/fail. The reconcile REASONING is `ai-architect #sync-spec`'s (Model-B); this holds only the deterministic contract. Pure (no clock/random/network, C-PIN). |
80
+ | W2 dataset contract | `scripts/contracts/dataset.ts` | TypeBox `Dimension`/`DatasetTuple`/`DatasetCase`/`Dataset` (companion to `schemas/dataset.schema.yaml`) + `tupleKey`. NEW W2-OWN file — does NOT touch shared `contracts/eval-types.ts`. Data contract only. |
81
+ | W2 trust contract | `scripts/contracts/validation.ts` | TypeBox `HumanLabel` (produced by `*review`, consumed by `*validate`) + the confusion-matrix / validation-result shapes. NEW W2-OWN file; disjoint from shared types. Data contract only. |
82
+
83
+ ### v2 eval-development engine — W3 (scale + context-flow / UI audit)
84
+
85
+ The W3 deterministic enablers: `flow-graph.ts` lets the evaluator SEE an agent's
86
+ context-flow; `ui-slots.ts` does the HTML-artifact missing-data cross-ref. The
87
+ judge interprets severity (Type B context-flow-lens, below).
88
+
89
+ | Op | File | Why Code-only |
90
+ |----|------|---------------|
91
+ | Trace→flow-graph (EV-032) | `scripts/flow-graph.ts` | THE FOUNDATION — deterministic adapter: `EvalTrace` (events + TOOL obs + sub-agent dispatches) → subject-agnostic info-flow graph (producer/consumer nodes · data-handoff edges) + `diffExpectedFlow` (which expected threadings are missing). Threading = deterministic verbatim content-overlap signal. Sub-agent vocab SUPPLIED via opts (EV-049/037), never a constant. Pure. |
92
+ | HTML missing-data audit (EV-039/040) | `scripts/ui-slots.ts` | Cross-refs a PROFILE-SUPPLIED `expectedUiSlots` (EV-037, NOT v1 hardcoded slot names) against computed values + published HTML → classifies each slot computed-but-not-rendered (039, locus UI cls B) · orphan (039) · faithful. Works on the HTML-only path (v1 OUTSIDER FALLBACK promoted to first-class). Flags verbatim presence/absence only; nuanced faithfulness (040 altered/truncated) left to the judge. Pure. |
93
+ | W3 flow contract | `scripts/contracts/flow-graph.ts` | TypeBox info-flow-graph (EV-032) + expected-flow profile (EV-037) shapes + `FlowEdgeKind` (no magic strings). NEW W3-OWN file — deliberately disjoint from shared `eval-types.ts` + v1 `types.ts` so shared types stay frozen. Subject-agnostic; pure. |
94
+ | Expected-flow auto-gen (EV-037) | `scripts/profile-subject.ts` (extended) | Adds the `expectedFlow` / `expectedUiSlots` section to the auto-generated subject profile (EV-049, never hand-authored) — the spec `diffExpectedFlow` + `ui-slots.ts` diff against. Pure trace stats. |
95
+ | Agent-appropriate variance (EV-054) | `scripts/evaluate.ts` (deepened) | N-rerun harness → `evalScoreVariance` (eval-score flap across N scorecards) · `trajectoryVariance` / `trajectoryShapeVariance` (distinct tool-trajectory + turn/sub-agent-count spread ACROSS reruns) · `trajectoryFlowDivergence` (one observed trajectory vs the subject's **expected information-flow**, EV-037, per expected edge). The "vs expected-flow" comparison is `trajectoryFlowDivergence` — NOT `trajectoryVariance` (which is rerun-to-rerun distinctness). Pure stats over verdicts. |
96
+ | Mask-on-handoff (carry) | `scripts/route-failures.ts` (extended) | Wraps the diagnostics-handoff bundle in `mask.ts` (`maskValue`/`maskedCanonicalJson`) — masks `produced_at` + abs artifact `path` before serialize. Dogfoods the data-leak audit on the evaluator's OWN output (restores C-PIN byte-identity; no home-path leak). Type A. |
97
+
98
+ ### v2 eval-development engine — W4 (eval-of-the-eval / self-QA)
99
+
100
+ The deterministic half of the meta-skill: `self-audit.ts` runs the eval-audit
101
+ six-area diagnostic over the evaluator's OWN eval-dev artifacts. It REUSES the
102
+ existing outputs (`*validate` `ValidationResult[]` · `*review` `HumanLabel[]` ·
103
+ `*discover-evals` `DiscoveredCriterion[]` · living-suite provenance) — it rebuilds
104
+ nothing. The nuanced reads + overall verdict are Type B (below).
105
+
106
+ | Op | File | Why Code-only |
107
+ |----|------|---------------|
108
+ | Eval-of-the-eval checks (EV-055) | `scripts/self-audit.ts` | The eval-audit six-area diagnostic as PURE threshold checks over the evaluator's own artifacts: `auditErrorAnalysis` (supportCount grounding) · `auditEvaluatorDesign` (code-before-judge) · `auditJudgeValidation` + `auditUncalibratedJudges` (status / TPR≥`TARGET_TPR` / TNR≥`TARGET_TNR`, reused from `validate-judge.ts`) · `auditHumanReview` (decided labels exist) · `auditLabeledData` (≥`MIN_LABELS_PER_CLASS` each) · `auditPipelineHygiene` (monotonic-growth + C-PIN re-validation). Emits impact-ordered FINDING DATA + a deterministic per-finding `status`; holds NO judge prose, makes NO subjective verdict. PURE (no clock/random/network → byte-identical report). |
109
+
110
+ ### v1 4-tab static-auditor (KEEP — EV-001..027)
111
+
112
+ | Op | File | Why Code-only |
113
+ |----|------|---------------|
114
+ | Two-track scorecard | `scripts/assemble-scorecard.ts` | GATE + 15-dim TREND rollup, stable ordering. |
115
+ | Deterministic rows | `scripts/run-deterministic.ts` | Tab-1 deterministic checks (typebox-schema / gate); judge rows emitted as skip placeholders. |
116
+ | Pinned-judge applicator | `scripts/run-judge.ts` (v1) | `applyJudgeVerdicts` — consumes a CALLER-SUPPLIED verdict map keyed by row id. The inner, testable half; the live judge is a workflow-layer seam, never in this script. |
117
+ | 15-dim variance | `scripts/variance-compare.ts` | Compares two masked bundles on the fixed determinism scorecard. |
118
+ | 4-tab HTML render | `scripts/render-report.ts` | Template + scorecard → HTML (own Mutagent brand asset). |
119
+ | Run-bundle loader | `scripts/load-bundle.ts` | Discovers + parses run artifacts into a validated `RunBundle`. |
120
+ | v1 shared contracts | `scripts/contracts/types.ts` | Criterion · Scorecard · Severity type defs. |
121
+ | Variance coordinator CLI | `scripts/cli/variance-check.ts` | Fully-wired deterministic 2-bundle delta — no judge, no model. |
122
+ | Mode A harness CLI | `scripts/cli/audit-run.ts` | Loads profile+bundle, deterministic pass, assemble, render. |
123
+
124
+ ---
125
+
126
+ ## Type B — LLM-only (Agent Operations)
127
+
128
+ Host-runtime reasoning by a dispatched subagent, or a HITL gate. The rubric lives in
129
+ the subagent def, NEVER in a script.
130
+
131
+ | Op | Agent action | Rubric home |
132
+ |----|--------------|-------------|
133
+ | **Eval-matrix × trajectory judging (DEFAULT)** | `Agent({subagent_type: 'evaluator', run_in_background: true})` — `#mode-judge-trajectory`: one judge per trajectory scores the WHOLE matrix | `assets/agents/evaluator.md#mode-judge-trajectory` |
134
+ | Success/failure determination (EV-042) | `Agent({subagent_type: 'evaluator'})` — `#mode-discover`: deep-read trace → goal-attained pass/fail ("inaction can be success") | `assets/agents/evaluator.md#mode-discover` |
135
+ | Emergent-criteria clustering (EV-041) | evaluator `#mode-discover` — first-thing-wrong → emergent BINARY ACTIONABLE categories (never a pre-defined list) | `assets/agents/evaluator.md#mode-discover` |
136
+ | Per-criterion judging (ALTERNATE axis) | `Agent({subagent_type: 'evaluator'})` — `#mode-judge-criterion`: one binary+confidence judge per `(criterion × trace-slice)` | `assets/agents/evaluator.md#mode-judge-criterion` |
137
+ | v1 behavioral-row judging (`*audit`) | `Agent({subagent_type: 'audit-executor'})` — pinned LLM-judge over behavior-tree rows | `assets/agents/audit-executor.md` + `lenses/*.md` |
138
+ | **Dataset generation (EV-046)** | `Agent({subagent_type: 'dataset-builder'})` — generate dimension tuples → NL queries → quality-filter for realism (generate-synthetic-data Steps 1-5). GENERATOR, NOT judge (host leaf). The deterministic expand/dedup is `build-dataset.ts`. | `assets/agents/dataset-builder.md` |
139
+ | **Context-flow judging (EV-028/029, `*audit`)** | `audit-executor` reasons over the flow-graph (EV-032) + expected-flow (EV-037): was a tool-result THREADED at step N+k or dropped (028)? does a sub-agent dispatch brief carry the context the child needs vs expected-flow (029)? Emits `LEAK_SCHEMA` leaks (locus C2C, cls B). | `lenses/context-flow-lens.md` |
140
+ | **HTML-artifact faithfulness (EV-040, `*audit`)** | judge confirms a value present in BOTH computed + rendered but ALTERED/truncated in the UI (the nuanced case `ui-slots.ts` cannot flag verbatim). | `lenses/context-flow-lens.md` + `data-leak.workflow.js` |
141
+ | **Eval-of-the-eval nuance (EV-055, `*self-audit`)** | `Agent({subagent_type: 'audit-executor'})` Mode D — over the `self-audit.ts` finding DATA, the nuanced reads the thresholds can't decide (is a criterion *actionable* vs generic? does a judge prompt target ONE failure mode?) + the overall eval-of-the-eval verdict. Host-runtime, NO provider key / NO Gemini. **On-demand only** (no cron/monitor/auto-fire). | `assets/agents/audit-executor.md` (Mode D) + `references/eval-audit.md` |
142
+ | **`*review` human labeling (EV-045)** | HITL gate — a HUMAN labels traces Pass/Fail/Defer in the `build-review-ui.ts` browser interface. The ground-truth `*validate` calibrates against. | `references/build-review-interface.md` |
143
+ | **`*build-dataset` seed interview (EV-046)** | `AskUserQuestion` / chat-fallback HITL gate — ~10 seed tuples before the agent expands. | SKILL.md §0.1 + `references/generate-synthetic-data.md` |
144
+ | Subject + substrate onboarding | `AskUserQuestion` / chat-fallback HITL gate | SKILL.md §0 |
145
+ | NL subject/trace exploration (onboarding) | LLM reasoning to infer the subject profile when no profile exists | `references/error-analysis.md` |
146
+
147
+ > **Critique-before-verdict + binary-not-Likert + judge-only + C-PIN/temp-0** are
148
+ > invariants of every Type-B judging op — declared in each subagent def, enforced at
149
+ > AGGREGATE by the deterministic parsers (`parseMatrixVerdictFile` /
150
+ > `parseCritiqueVerdict`), which THROW on a bare verdict or out-of-set result.
151
+
152
+ ---
153
+
154
+ ## Type C — Hybrid (agent invokes script)
155
+
156
+ The parent session invokes a Code-only script for the deterministic shape,
157
+ dispatches Type-B subagents for the reasoning, and reads structured output back.
158
+
159
+ | Op | Pattern |
160
+ |----|---------|
161
+ | `*evaluate` (DEFAULT, eval-matrix × trajectory) | parent `Bash(matrix-judge PREP)` → dispatch N `evaluator` (`#mode-judge-trajectory`, one per trajectory, mass-parallel) → `Bash(matrix-judge AGGREGATE)` reads verdict files → GATE scorecard |
162
+ | `*discover-evals` (EV-041/042/052) | parent `Bash(prep.ts --stage determiner)` → dispatch `evaluator` (`#mode-discover`, mass-parallel) → `Bash(aggregate, discover-criteria.ts)` → emergent criteria |
163
+ | `*build-evals` + `*evaluate` (per-criterion ALTERNATE) | parent `Bash(prep.ts --stage judge)` → dispatch `evaluator` (`#mode-judge-criterion`, one per criterion × slice) → `Bash(run-pipeline aggregate)` → scorecard |
164
+ | Success/failure determination integration (in-house/alternate) | `judge-prompt-template.ts` `determineOutcome` renders the determiner prompt + calls the injected `JudgeInvoke` seam — used by the OPTIONAL in-house substrate + the alternate per-criterion PREP; the decision is the subagent's. The DEFAULT path uses `determine-outcome.ts` `assembleOutcome` over a verdict file (no prompt). |
165
+ | Per-criterion judge integration (in-house/alternate) | `judge-prompt-template.ts` `runJudge` renders the 4-component prompt + calls the seam — never decides; only the in-house/alternate axis uses it. |
166
+ | Balanced sampling | parent `Bash(sample-traces.ts)` → reads the ✓/✗ sample plan |
167
+ | Subject profiling | parent `Bash(profile-subject.ts)` (or v1 `cli/profile-subject.ts`) → reads the generated profile → routes |
168
+ | Route failures to diagnostics | parent `Bash(route-failures.ts)` → reads the handover bundle (masked, mask-on-handoff carry) → hands to `mutagent-diagnostics` |
169
+ | `*validate` (EV-044) | parent `Bash(validate-judge.ts)` over `*review` labels + `*evaluate` verdicts → TPR/TNR · Rogan-Gladen · bootstrap CI → stamps validation provenance into the scorecard. Mostly CODE; the OPTIONAL `evaluator` `#mode-discover` disagreement read is the Type B half. |
170
+ | `*review` (EV-045) | parent `Bash(build-review-ui.ts)` renders the annotation UI → **HITL**: a human labels in the browser → `mergeLabels` persists → labels feed `*validate`. CODE render + HITL label. |
171
+ | `*build-dataset` (EV-046) | HITL seed interview (~10) → dispatch `dataset-builder` (tuples → NL queries → realism filter) → parent `Bash(build-dataset.ts)` cartesian-expand + near-dup drop + monotonic merge → growing dataset. 3-way Hybrid. |
172
+ | `*discover-dataset` (EV-047) | parent `Bash(derive-dataset.ts)` distills a living regression set from labeled ✓/✗ traces (reuses `sample-traces.ts` selectors + `build-dataset.ts` merge). Code-only — no dispatch. |
173
+ | context-flow audit (EV-028/029, `*audit`) | parent `Bash(flow-graph.ts)` builds the info-flow graph + `diffExpectedFlow` (deterministic) → dispatch `audit-executor` w/ `context-flow-lens.md` to judge threading/handoff leaks → `data-leak.workflow.js` new context-flow DIM emits `LEAK_SCHEMA`. |
174
+ | HTML missing-data audit (EV-039/040, `*audit`) | parent `Bash(ui-slots.ts)` cross-refs `expectedUiSlots` vs computed + HTML (deterministic computed-but-not-rendered / orphan) → dispatch `audit-executor` for the nuanced faithfulness (040) → `data-leak.workflow.js` de-hardcoded ui-render + data-correctness dims (subject-agnostic). |
175
+ | `*self-audit` (EV-055, eval-of-the-eval) | parent `Bash(self-audit.ts)` over the evaluator's OWN `*validate`/`*review`/`*discover-evals`/living-suite artifacts → deterministic six-area finding DATA → dispatch `audit-executor` (Mode D) for the nuanced reads + overall verdict → impact-ordered report. Reuses `*audit` + `*validate`; rebuilds nothing. **On-demand only** — no cron/monitor/auto-fire (`feedback_self_diagnostics_on_demand_only`); the orchestrator trigger block ships `enabled:false`. |
176
+ | **OPTIONAL in-house substrate** | when `substrate: in-house`, `judge-provider.ts` `createInHouseJudge` lazy-imports `@langchain/google-genai` (temp 0, THROW on missing creds). NOT the default; the only path where a script issues a provider call. The prompt it sends is rendered by `judge-prompt-template.ts` (the EV-050 export/in-house exception). |
177
+
178
+ ---
179
+
180
+ ## Austerity note — judge prose lives ONLY in the exception renderer
181
+
182
+ The judge-prompt prose has been **relocated out of** `determine-outcome.ts` and
183
+ `build-evals.ts` — they are now Type A (DATA only: signals · parse · assemble · split ·
184
+ leakage-guard · spec). The ONLY script that renders a judge prompt is
185
+ `judge-prompt-template.ts`, the operator-named **EV-050 exception** ("export a judge
186
+ PROMPT artifact = templating, not skill-triggered judging"). It exists for two
187
+ consumers ONLY: the OPTIONAL in-house provider substrate (no subagent → must carry the
188
+ prompt) and user-framework export.
189
+
190
+ The **DEFAULT agent-dispatch path never imports the renderer**: under it the
191
+ authoritative rubric is the unified subagent def (`evaluator.md#mode-judge-trajectory` /
192
+ `#mode-judge-criterion` / `#mode-discover`), the host runtime reasons from the def + the DATA packet, and the
193
+ verdict file is keyed by **task DATA** — the matrix-judge default keys by `trajectoryKey`
194
+ (a hash of the trajectory id), NOT a rendered prompt. So the prose genuinely leaves the
195
+ default path (no documented residual in the named scripts). The subagent defs are the
196
+ authoritative reasoning contract; the renderer's prose is their downstream provider-call
197
+ mirror, kept in lockstep.
@@ -0,0 +1,125 @@
1
+ # validate-evaluator — calibrate a judge against human labels
2
+
3
+ > **Source:** absorbed from `mutagent-system/.memory/features/evals-skills-source/skills/validate-evaluator/SKILL.md`.
4
+ > **Loaded by:** `*validate` (EV-043 trust layer; W2). Load on demand.
5
+ > **Sibling refs:** `write-judge-prompt.md` (build the judge) · `error-analysis.md` (mine the criterion) · `grounded-adjudication.md` (the GA doctrine: bind · gather refs · typed assumptions · abstain · verify).
6
+ > Use for **LLM judges only**. Code-based evaluators are deterministic — test them with unit tests.
7
+
8
+ A judge is not trustworthy until it ALIGNS with human judgment. Calibrate it with data splits,
9
+ TPR/TNR, and bias correction before reporting any of its verdicts.
10
+
11
+ > **GA — the verdict is ternary.** Under Grounded Adjudication a judge may emit `pass`, `fail`, OR
12
+ > `indeterminate` (the `uncertain` + `blockedBy` abstain). **TPR/TNR are computed over DECIDED
13
+ > verdicts only — `indeterminate` rows are EXCLUDED from the confusion matrix** (an abstain is not a
14
+ > wrong answer; folding it in would punish honest abstention and corrupt the bias correction). The
15
+ > indeterminate rows are instead tracked separately as **assumption agreement** (Step 3a) — does the
16
+ > human agree the situation was genuinely underdetermined? A judge that abstains where the human
17
+ > would decide is a calibration signal, not a TPR/TNR miss.
18
+
19
+ ## The 8-step calibration
20
+
21
+ ### Step 1 — Create disjoint data splits
22
+
23
+ | Split | Size | Purpose | Rules |
24
+ |-------|------|---------|-------|
25
+ | **Train** | 10-20% (~10-20) | Few-shot source for the judge prompt | Clear-cut cases only; used directly in the prompt |
26
+ | **Dev** | 40-45% (~40-45) | Iterative refinement | Never in the prompt; evaluate against repeatedly |
27
+ | **Test** | 40-45% (~40-45) | Final unbiased measurement | Do NOT look at during development; used ONCE |
28
+
29
+ Target 30-50 examples of EACH class (Pass + Fail) across dev+test. Use **balanced** splits even if
30
+ real prevalence is skewed — you need enough Fail examples to measure TNR reliably.
31
+
32
+ ### Step 2 — Run the judge on the dev set
33
+ Run on every dev example; compare predictions to human labels. **Partition the predictions first:**
34
+ DECIDED (`pass` / `fail`) feed the confusion matrix (Step 3); INDETERMINATE (`uncertain` +
35
+ `blockedBy`) are set aside for assumption agreement (Step 3a) and are NOT counted as Pass or Fail.
36
+
37
+ ### Step 3 — Measure TPR and TNR (not accuracy) — over DECIDED verdicts only
38
+
39
+ ```
40
+ # denominators/numerators range over DECIDED verdicts only — indeterminate EXCLUDED
41
+ TPR = (judge Pass AND human Pass) / (human Pass, judge decided) # true positive rate
42
+ TNR = (judge Fail AND human Fail) / (human Fail, judge decided) # true negative rate
43
+ ```
44
+
45
+ Use TPR/TNR — they map directly to the bias-correction formula. With class imbalance, raw accuracy
46
+ is misleading. Cohen's Kappa is for human-vs-human agreement, not judge-vs-ground-truth.
47
+ **Indeterminate verdicts are excluded** — an abstain is neither a Pass nor a Fail, so it never
48
+ enters the matrix (counting it as either would punish honest abstention and bias `theta_hat`).
49
+
50
+ ### Step 3a — Track assumption agreement (the indeterminate rows · GA)
51
+
52
+ The set-aside `indeterminate` verdicts get their OWN agreement metric — does the human agree the
53
+ situation was genuinely **underdetermined** (the criterion's term was unbound, or a premise was
54
+ ungroundable)?
55
+
56
+ ```
57
+ assumption-agreement = (judge indeterminate AND human "underdetermined") / (judge indeterminate)
58
+ ```
59
+
60
+ - **High agreement** → the judge abstains where it should; the criterion needs calibration
61
+ (re-ground the fact / ratify the normative call / re-scope), not a judge fix. Route the blocking
62
+ assumption by its `kind` (`factual-intent` → re-ground · `normative` → operator · `scope` → skip).
63
+ - **Low agreement** (judge abstains where the human decides) → the judge is over-abstaining; tighten
64
+ BIND or the Pass/Fail defs so it can decide on the evidence present.
65
+ - Also surface, per `blockedBy.kind`, how many indeterminates each typed assumption produced — that
66
+ is the calibration-loop work queue.
67
+
68
+ ### Step 4 — Inspect EVERY disagreement
69
+
70
+ | Type | Judge | Human | Fix |
71
+ |------|-------|-------|-----|
72
+ | **False Pass** | Pass | Fail | Judge too lenient → strengthen Fail definitions / add edge-case examples |
73
+ | **False Fail** | Fail | Pass | Judge too strict → clarify Pass definitions / adjust examples |
74
+ | **Over-abstain** | indeterminate | decided | Judge abstains where the human decides → tighten BIND / Pass-Fail defs (Step 3a) — NOT a TPR/TNR miss |
75
+ | **Under-abstain** | decided | underdetermined | Judge decided where the situation was underdetermined → the unbound term should have abstained (an inferential leap the verifier should have caught) |
76
+
77
+ ### Step 5 — Iterate to target
78
+ Refine prompt → re-run on dev → repeat until stable. **Target TPR > 90% AND TNR > 90%**
79
+ (minimum acceptable 80%/80%). If both low → more capable model. If both plateau → decompose the
80
+ criterion into smaller atomic checks. If labels seem inconsistent → re-examine the human labels.
81
+
82
+ ### Step 6 — Final measurement on the test set (ONCE)
83
+ Run the judge **exactly once** on the held-out test set; record final TPR/TNR. Do NOT iterate after
84
+ seeing test results — go back to step 4 with new dev data if needed.
85
+
86
+ ### Step 7 — Estimate true success rate (Rogan-Gladen correction)
87
+ Raw judge scores on unlabeled production data are biased. Correct for known judge error:
88
+
89
+ ```
90
+ theta_hat = (p_obs + TNR - 1) / (TPR + TNR - 1)
91
+ ```
92
+
93
+ - `p_obs` = fraction of unlabeled traces the judge scored Pass · `TPR`/`TNR` from the test set.
94
+ - Clip to [0,1]. **Invalid when `TPR + TNR - 1` ≈ 0** (judge is no better than random).
95
+ - *Example:* TPR=0.92, TNR=0.88, p_obs=0.80 → (0.80+0.88−1)/(0.92+0.88−1) = 0.68/0.80 = **0.85**
96
+ (true rate ~85%, not the raw 80%).
97
+
98
+ ### Step 8 — Confidence interval
99
+ A point estimate alone is not enough. Compute a **bootstrap 95% CI** (resample test labels+preds,
100
+ recompute theta_hat per resample, take the 2.5/97.5 percentiles). Or use `judgy`
101
+ (`estimate_success_rate`). Report the range so stakeholders know how much to trust the number.
102
+
103
+ ## Practical guidance
104
+
105
+ - **Pin exact model versions** (dated snapshot id, not a floating alias) — providers update silently
106
+ (C-PIN). **Re-validate** after a prompt change, a model switch, or when production CIs widen.
107
+ - ~100 labeled examples (50 Pass / 50 Fail); below ~60 the CIs get wide.
108
+ - **One trusted domain expert** is the most efficient labeling path; else two annotators on 20-50
109
+ traces, resolve disagreements first.
110
+ - **Improving TPR narrows the CI more than improving TNR** — the correction divides by `(TPR+TNR−1)`,
111
+ so a low TPR shrinks the denominator and amplifies error into wide CIs.
112
+
113
+ ## Anti-patterns
114
+
115
+ - **Assuming judges "just work" without validation.**
116
+ - **Raw accuracy / percent agreement** instead of TPR/TNR (misleading under imbalance).
117
+ - **Dev/test examples as few-shot** — data leakage.
118
+ - **Reporting dev-set performance as final accuracy** — dev numbers are optimistic; the test set
119
+ gives the unbiased estimate.
120
+ - **Raw judge rates without Rogan-Gladen correction** when reporting an aggregate pass rate.
121
+ - **Point estimates without a confidence interval** — an 85% corrected rate could be 78-92% on a
122
+ small test set.
123
+ - **Folding `indeterminate` into TPR/TNR** — an abstain is not a wrong answer; counting it as a
124
+ Pass or Fail punishes honest abstention and corrupts `theta_hat`. Exclude it from the matrix; track
125
+ it as assumption agreement (Step 3a).
@@ -0,0 +1,300 @@
1
+ # Orchestrator Protocol — Parent-Session Dispatch FSM (agent-dispatch)
2
+
3
+ > **Authority**: SKILL.md §0 (Setup) + §0.1 (`*commands`) + §5 (agents). This is the
4
+ > inline procedure the PARENT SESSION runs once `*discover-evals` / `*build-evals` /
5
+ > `*evaluate` is invoked under the DEFAULT **agent-dispatch** substrate.
6
+ >
7
+ > **Why this file exists.** Claude Code leaf subagents cannot dispatch other
8
+ > subagents (the `Agent` tool) or invoke `AskUserQuestion`. Coordinator-class
9
+ > orchestration therefore MUST run in the PARENT SESSION — the one that invoked
10
+ > the skill. The evaluator's judging is performed BY an Evaluator agent on the
11
+ > host runtime, mass-dispatched for throughput (the SHAPE diagnostics uses,
12
+ > mirrored here — never source-referenced; sealed-sibling).
13
+ >
14
+ > **Operator correction (2026-06-19).** "Use Claude Code itself to discover, not
15
+ > gemini. Evaluator functions must be performed with an Evaluator agent,
16
+ > mass-dispatched when needed. Make the Evaluator Skill's Dispatch patterns
17
+ > similar to Diagnostics for highest throughput." → agent-dispatch is the
18
+ > DEFAULT; the in-house Gemini judge is an OPTIONAL substrate (§ Fallback).
19
+
20
+ ---
21
+
22
+ ## The model in one line
23
+
24
+ `PREP (deterministic script → task-spec files) → DISPATCH (parent fans out leaf
25
+ subagents MASS-PARALLEL on the host runtime → they write verdict files) →
26
+ AGGREGATE (deterministic script reads the verdict files → labels / scorecard)`.
27
+
28
+ The LLM verdict NEVER comes from a script calling a provider. It comes from
29
+ parent-session-dispatched `evaluator` subagents (discover / judge modes) reasoning
30
+ on the HOST runtime, written to verdict FILES. The scripts only PREP (emit the exact
31
+ prompts to judge) and AGGREGATE (read the verdicts back). See
32
+ `scripts/agent-dispatch.ts` (the transport) + `scripts/prep-tasks.ts` (PREP).
33
+
34
+ ### The verdict-file contract (every dispatched subagent honors it)
35
+
36
+ - A PREP task-spec is `<key>.task.json` where `key = promptHash(system, user)`
37
+ (FNV-1a, `scripts/agent-dispatch.ts`). It carries the EXACT `{system, user}`
38
+ prompt the subagent must reason over, the `verdictFile` it must write, and the
39
+ pinned `{model, temperature: 0}` envelope (C-PIN; model-intent-sacred).
40
+ - The subagent writes `<key>.verdict.json` = a **critique-before-verdict** JSON
41
+ string: `{ "critique": "<reasoning first>", "result": "pass"|"fail"|"uncertain",
42
+ "confidence": <0..1> }`. The critique is written BEFORE the result. Binary
43
+ only — no Likert. `uncertain` ONLY when the trace genuinely lacks the evidence;
44
+ it is NEVER silently coerced to pass/fail.
45
+ - AGGREGATE re-derives `key` from the prompt alone and reads the verdict file —
46
+ so PREP and AGGREGATE need no shared mutable state. A missing verdict file is
47
+ **fail-loud** (the JudgeInvoke throws): it means the parent skipped dispatch,
48
+ never a fabricated pass.
49
+
50
+ ---
51
+
52
+ ## Throughput / concurrency model (MASS-PARALLEL — no hardcoded 5)
53
+
54
+ Dispatch leaf subagents **mass-parallel** for throughput. The REAL bound is the
55
+ host harness's own concurrency cap (how many `Agent` calls it runs at once); the
56
+ protocol does NOT hardcode a number. Practically:
57
+
58
+ - Fan out as wide as the work-list allows (one subagent per trace-batch for
59
+ `*discover-evals`; one per `(criterion × trace-slice)` for `*build-evals`/`*evaluate`),
60
+ and let the harness schedule them under its cap. Excess dispatches queue and
61
+ drain as slots free — coverage is complete, only the in-flight count is bounded.
62
+ - Batch sizing: keep each subagent's slice within a single context window
63
+ (a trace-batch of deep-readable size; a criterion's eval-slice). Prefer MORE,
64
+ SMALLER subagents over few large ones — that maximizes parallel drain and keeps
65
+ each verdict grounded.
66
+ - Identical prompts dedupe by content key (PREP emits one task per unique
67
+ `(system, user)`), so redundant judging units never re-dispatch.
68
+ - Record the dispatched count + the observed concurrency in the run scratchpad
69
+ (`runMeta.dispatch`). Do NOT silently cap coverage — if a work-list is trimmed,
70
+ `log()` what was dropped.
71
+
72
+ > **Dispatch-recursion rule.** Leaf subagents (the `evaluator` cell, any mode)
73
+ > CANNOT themselves dispatch subagents or call `AskUserQuestion`. Only THIS
74
+ > top-level parent session fans them out. A dogfood / re-run that needs the
75
+ > fan-out must therefore run from a TOP-LEVEL parent session, not from inside a
76
+ > subagent.
77
+
78
+ ---
79
+
80
+ ## Step 0 — Setup detection
81
+
82
+ ```bash
83
+ Bash("scripts/cli/run.sh scripts/profile-subject.ts --detect")
84
+ ```
85
+
86
+ Expect a complete subject (EV-049) + a resolved substrate (EV-050). If missing,
87
+ route to onboarding (subject auto-gen + substrate fork — SKILL.md §0). Under the
88
+ DEFAULT substrate (`agent-dispatch`) no provider key is needed; the host runtime
89
+ is the judge. (In-house substrate → see § Fallback.)
90
+
91
+ Resolve the pinned envelope ONCE for the whole run (C-PIN): `model` from
92
+ `--model` ?? `config.models.default` (else REFUSE — model-intent-sacred),
93
+ `temperature: 0`. Every PREP task carries it; every subagent honors it.
94
+
95
+ ---
96
+
97
+ ## Step 0.5 — Trace intake (delegate-or-artifact — the evaluator ACQUIRES traces · reports-PRD R-6)
98
+
99
+ The evaluator owns NO fetch/normalize code (that lives in `mutagent-cli` + the `discovery`
100
+ agent) — but **a real user will not hand you a trace file**. So, in **parity with Diagnostics
101
+ Step 3.6 (V3-9)**, traces are acquired by EXACTLY ONE of the 3 legal paths:
102
+
103
+ | # | Path | Who fetches | When |
104
+ |---|---|---|---|
105
+ | a | **Helix pre-fetch / handover** | Helix (pre-stage) or a pre-produced `mutagent-cli trace fetch --export`, handed in via `--traces <handover.jsonl>` | orchestrated runs |
106
+ | b | **`*discover` dispatch** | the `discovery` system agent | orchestrated collection |
107
+ | c | **Standalone: artifact intake OR vendored-Discovery spawn** | a pre-staged artifact, or the vendored `discovery` sub-agent | THIS step |
108
+
109
+ **Standalone flow (path c), in order:**
110
+ 1. **Handover / artifact intake first.** If `--traces <handover.jsonl>` (`.gz` ok) was handed in,
111
+ or a pre-staged `.mutagent/evaluator/<run>/ingest/traces.jsonl` exists → consume it; do NOT spawn Discovery.
112
+ 2. **Else DELEGATE to the vendored Discovery agent.** Spawn `assets/agents/discovery.md` (installed at
113
+ `.claude/agents/discovery.md`) via the Task tool (`subagent_type: "discovery"`), handing it the
114
+ resolved TraceQuery (source + filters + window + `--export .mutagent/evaluator/<run>/ingest/traces.jsonl`).
115
+ Discovery fetches + curates → a `SelectionManifest` + `traces.jsonl`; the PREP/AGGREGATE CLIs then
116
+ read it via `--traces` (P-B curated `ext.signals`/`ext.classification` consumed when present).
117
+
118
+ The PREP/AGGREGATE CLIs (`scripts/cli/{prep,aggregate,dogfood}.ts`) take the
119
+ handover file via `--traces <handover.jsonl>` (`.gz` also accepted) and read it
120
+ with `parseUnitfJsonl` (`scripts/read-unitf-traces.ts`), which projects each
121
+ `UnifiedTrace` → the in-package `EvalTrace` via `projectUnitfToEvalTrace`
122
+ (`scripts/unitf-to-evaltrace.ts`). Malformed / non-UniTF lines are skipped +
123
+ counted (never swallowed). Everything downstream (sample / profile / discover /
124
+ judge / scorecard) consumes `EvalTrace[]` unchanged.
125
+
126
+ ---
127
+
128
+ ## Step 1 — `*discover-evals` (EV-041/042/052) — fan out `evaluator` (#mode-discover)
129
+
130
+ The determiner labels (EV-042) have NO label dependency, so this stage runs first.
131
+
132
+ 1. **Sample + slice (PREP-A).** Balanced ✓/✗ sampling (`scripts/sample-traces.ts`,
133
+ EV-052) → trace batches. For each trace emit a determiner task-spec:
134
+ ```bash
135
+ Bash("scripts/cli/run.sh scripts/cli/prep.ts --stage determiner \
136
+ --traces /tmp/handover.jsonl --task-dir .mutagent/evaluator/<run>/tasks/discover \
137
+ --model <pinned> ")
138
+ ```
139
+ (`scripts/prep-tasks.ts` `prepDeterminerTasks` — one `<key>.task.json` per trace.)
140
+
141
+ 2. **Dispatch `evaluator` (#mode-discover) MASS-PARALLEL** — one subagent per trace-BATCH:
142
+ ```
143
+ Agent(
144
+ subagent_type: "evaluator",
145
+ run_in_background: true,
146
+ prompt: |
147
+ Run #mode-discover (the evaluator's discover mode; unit.kind="discover").
148
+ Read your assigned task-spec files in <tasks/discover>. For each, reason
149
+ on the host runtime under the pinned envelope (temp 0). Determine the
150
+ outcome (EV-042 — "inaction can be success"; a guard-hold is a PASS), note
151
+ the FIRST thing that went wrong, and cluster into emergent BINARY
152
+ ACTIONABLE categories. Write each <key>.verdict.json (critique-before-
153
+ verdict) into <verdicts/discover>, and your mining report per batch.
154
+ )
155
+ ```
156
+ Pre-read for the agent: `references/error-analysis.md` + the `subjects/<name>/`
157
+ profile. Fan out as wide as the batch list; the harness cap bounds in-flight.
158
+
159
+ 3. **Collect + AGGREGATE-A.** Await the verdict files (use the `Monitor` tool with
160
+ an `until` test-`-f` loop — NEVER `Bash("sleep N && cat")`). Then:
161
+ ```bash
162
+ Bash("scripts/cli/run.sh scripts/cli/aggregate.ts --stage discover \
163
+ --annotations-dir .mutagent/evaluator/<run>/discover \
164
+ --out /tmp/criteria.json")
165
+ ```
166
+ The dispatched evaluator (discover mode) writes BOTH the per-trace determiner verdict files
167
+ AND a `TraceAnnotation[]` mining report per batch into `<run>/discover`. AGGREGATE
168
+ reads the annotation files and mines criteria (`scripts/discover-criteria.ts`
169
+ `deriveCriteria`): one binary criterion per emergent category, per-category
170
+ failure rates, **flag fixable-vs-eval-worthy** (fixables route to
171
+ diagnostics, EV-051 — never judged), saturation stop.
172
+
173
+ ---
174
+
175
+ ## Step 2 (DEFAULT) — `*evaluate` — fan out `evaluator` (#mode-judge-trajectory, per-TRAJECTORY)
176
+
177
+ The **headline judging cell**. Score each trajectory against the WHOLE eval matrix (the criteria
178
+ set — bridged from v1 `subjects/<name>/eval-matrix.yaml` or the `*discover-evals` output). One Judge Agent
179
+ per trajectory, MASS-PARALLEL — high throughput across many sessions.
180
+
181
+ 1. **PREP — one matrix packet per trajectory** (`scripts/matrix-judge.ts buildMatrixPacket` →
182
+ `writeMatrixPacket`): assemble `{subject, trajectoryId, criteria[] (the whole matrix),
183
+ trajectory[], transcript[], pin}` per trajectory into the run's packet dir. Pure DATA — no
184
+ prompt, no LLM.
185
+ ```bash
186
+ Bash("scripts/cli/run.sh scripts/cli/prep.ts --stage matrix \
187
+ --traces /tmp/handover.jsonl --criteria /tmp/matrix.json \
188
+ --task-dir .mutagent/evaluator/<run>/packets --model <pinned>")
189
+ ```
190
+
191
+ 2. **Dispatch `evaluator` (#mode-judge-trajectory) MASS-PARALLEL** — one subagent per trajectory:
192
+ ```
193
+ Agent(
194
+ subagent_type: "evaluator",
195
+ run_in_background: true,
196
+ prompt: |
197
+ Run judge/trajectory (#mode-judge-trajectory; input is a *.packet.json).
198
+ Read your assigned <trajectory_key>.packet.json. Score EVERY criterion in its matrix for
199
+ THIS trajectory on the host runtime, pinned (temp 0, C-PIN). Critique BEFORE verdict; binary
200
+ (inaction-can-be-success for goal/restraint criteria); judge-only. Write
201
+ <trajectory_key>.verdict.json (a MatrixVerdictFile) into <verdicts/eval>.
202
+ )
203
+ ```
204
+ Pre-read for the agent: `references/write-judge-prompt.md`. The judging RUBRIC lives in the agent
205
+ def — the script never builds a prompt. Fan out one per trajectory; harness cap bounds in-flight.
206
+
207
+ 3. **Collect + AGGREGATE** (`Monitor` until the verdict files exist):
208
+ ```bash
209
+ Bash("scripts/cli/run.sh scripts/cli/aggregate.ts --stage evaluate \
210
+ --traces /tmp/handover.jsonl --criteria /tmp/matrix.json \
211
+ --verdict-dir .mutagent/evaluator/<run>/verdicts/eval \
212
+ --out .mutagent/evaluator/<run>/scorecard.json")
213
+ ```
214
+ `cli/aggregate.ts` (→ `scripts/matrix-judge.ts aggregateMatrixScorecard`) reads the
215
+ per-trajectory `MatrixVerdictFile`s, folds each criterion across trajectories (binary: PASS iff
216
+ all pass; any fail → fail; else uncertain), and rolls up the severity-gated **GATE** +
217
+ per-trajectory **variance** (`evaluate.ts`) → route failures to diagnostics (EV-051).
218
+
219
+ ## Step 2b (ALTERNATE) — `*build-evals` + per-CRITERION `*evaluate` — fan out `evaluator` (#mode-judge-criterion)
220
+
221
+ The alternate fan-out axis: one judge per CRITERION across a trace-slice (vs one judge per
222
+ trajectory across the whole matrix). Use when you want criterion-parallel judging or are building a
223
+ per-criterion judge suite. Now the determiner labels are REAL, so the judge few-shot (TRAIN split)
224
+ can be built.
225
+
226
+ 1. **PREP-B — emit judge task-specs.** Replay the pipeline with the capturing
227
+ judge so the emitted judge prompts are byte-identical to AGGREGATE's:
228
+ ```bash
229
+ Bash("scripts/cli/run.sh scripts/cli/prep.ts --stage judge \
230
+ --traces /tmp/handover.jsonl --criteria /tmp/criteria.json \
231
+ --verdict-dir .mutagent/evaluator/<run>/verdicts/discover \
232
+ --task-dir .mutagent/evaluator/<run>/tasks/eval --model <pinned>")
233
+ ```
234
+ (`scripts/prep-tasks.ts` `prepJudgeTasks` — one `<key>.task.json` per
235
+ `(criterion × subject-trace)`; few-shot from the TRAIN split ONLY — leakage
236
+ guard throws otherwise.)
237
+
238
+ 2. **Dispatch `evaluator` (#mode-judge-criterion) MASS-PARALLEL** — one subagent per `(criterion × trace-slice)`:
239
+ ```
240
+ Agent(
241
+ subagent_type: "evaluator",
242
+ run_in_background: true,
243
+ prompt: |
244
+ Run judge/criterion (#mode-judge-criterion; unit.axis="criterion"; input is a *.task.json).
245
+ Read your assigned task-spec files in <tasks/eval>. For each, run the ONE
246
+ binary+confidence judge over the slice on the host runtime, pinned (temp 0,
247
+ C-PIN). Critique BEFORE verdict; binary only; never fabricate evidence;
248
+ never fix the subject (judge-only, EV-051). Write each <key>.verdict.json
249
+ into <verdicts/eval>.
250
+ )
251
+ ```
252
+ Pre-read for the agent: `references/write-judge-prompt.md` (the 4-component
253
+ contract). Fan out per judging unit; harness cap bounds in-flight.
254
+
255
+ 3. **Collect + AGGREGATE-B.** Await the verdict files (`Monitor` until present),
256
+ then roll up the per-criterion alternate via the dogfood aggregate entrypoint:
257
+ ```bash
258
+ Bash("scripts/cli/run.sh scripts/cli/dogfood.ts \
259
+ --traces /tmp/handover.jsonl --criteria /tmp/criteria.json \
260
+ --substrate agent-dispatch --verdict-dir .mutagent/evaluator/<run>/verdicts/eval \
261
+ --model <pinned> --out .mutagent/evaluator/<run>/scorecard.json")
262
+ ```
263
+ AGGREGATE runs `scripts/run-pipeline.ts` with the agent-dispatch judge (reads
264
+ every verdict file) → per-criterion binary+confidence → **severity-gated GATE**
265
+ (EV-048) + **agent-variance** view → **route failures** to diagnostics
266
+ (EV-051; fixables + any non-pass eval-worthy verdicts, judge-only).
267
+
268
+ > **AGGREGATE readiness.** Before rollup, `scripts/agent-dispatch.ts`
269
+ > `missingVerdictKeys(verdictDir, specs)` must be empty — every dispatched
270
+ > judging unit has a collected verdict. A non-empty list means a subagent failed
271
+ > or was skipped → re-dispatch that slice, do NOT roll up a partial suite silently.
272
+
273
+ ---
274
+
275
+ ## Step 3 — Report
276
+
277
+ Emit the verdict + scorecard (SKILL.md §3.1). The scorecard is deterministic given
278
+ the pinned envelope + the collected verdict files (`mask.ts` strips run-id /
279
+ timestamps / abs-paths → byte-identical reruns, C-PIN). Failures are ROUTED to
280
+ `mutagent-diagnostics` (EV-051) — the evaluator never fixes.
281
+
282
+ ---
283
+
284
+ ## Fallback — the OPTIONAL in-house substrate (EV-050)
285
+
286
+ When the run is configured `substrate: in-house` (e.g. a CI / code-based export
287
+ context that wants a provider call instead of host dispatch), the same PREP/
288
+ AGGREGATE cores run, but the judge seam is `createInHouseJudge`
289
+ (`scripts/judge-provider.ts`, `@langchain/google-genai`, temp 0, THROW on missing
290
+ creds) — see `scripts/cli/dogfood.ts`. This is KEPT but is NOT the default. If
291
+ `Agent` dispatch is unavailable in the host runtime, surface that + offer the
292
+ in-house substrate explicitly (model-intent-sacred: no silent provider swap).
293
+
294
+ ## Monitor compliance
295
+
296
+ When awaiting verdict files, USE the `Monitor` tool with an `until` loop:
297
+ ```
298
+ Monitor: until test -f <verdicts>/<key>.verdict.json; do sleep 2; done
299
+ ```
300
+ DO NOT `Bash("sleep N && cat …")` — it hits the harness `Blocked: sleep` guard.