@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,387 @@
1
+ /**
2
+ * scripts/self-audit.ts — EV-055 the EVAL-OF-THE-EVAL deterministic core (Type A — Code-only).
3
+ * ---------------------------------------------------------------------------
4
+ * The evaluator audits its OWN eval-development artifacts — *is my judge
5
+ * validated? is my dataset balanced? are my criteria grounded? is my suite
6
+ * living?* — by running the `eval-audit` six-area diagnostic (S16) over the
7
+ * evaluator's own output (S17 meta-skill). It REUSES the existing surfaces — it
8
+ * consumes the `*validate` `ValidationResult[]`, the `*review` `HumanLabel[]`,
9
+ * the `*discover-evals` `DiscoveredCriterion[]`, and the living-suite provenance — it
10
+ * does NOT rebuild a second auditor (`references/eval-audit.md`).
11
+ *
12
+ * Austerity (Type A): this core holds NO judge-prompt prose and makes NO
13
+ * subjective pass/fail decision. It emits FINDING DATA — a deterministic
14
+ * threshold check per area, exactly like `validate-judge.ts` emits a
15
+ * `validated`/`unvalidated` status from TPR/TNR thresholds. The NUANCED
16
+ * judgments (is this criterion *actionable* vs merely generic? does this judge
17
+ * prompt target ONE failure mode?) are dispatched to the `audit-executor`
18
+ * subagent (`*self-audit` mode, host-runtime, NO provider key) — Type B. The
19
+ * overall "is the evaluator healthy?" verdict is the AGENT's, never this script's.
20
+ *
21
+ * PURE — no clock / random / network; same input → byte-identical report.
22
+ */
23
+ import {
24
+ CriterionFlag,
25
+ JudgeKind,
26
+ type DiscoveredCriterion,
27
+ } from "./contracts/eval-types.ts";
28
+ import {
29
+ HumanVerdict,
30
+ ValidationStatus,
31
+ type HumanLabel,
32
+ type ValidationResult,
33
+ } from "./contracts/validation.ts";
34
+ import { TARGET_TPR, TARGET_TNR } from "./validate-judge.ts";
35
+
36
+ // ── The six diagnostic areas (eval-audit S16) ───────────────────────────────
37
+ export const SelfAuditArea = {
38
+ /** Area 1 — were criteria MINED from real ✓/✗ traces (vs brainstormed)? */
39
+ ErrorAnalysis: "error-analysis",
40
+ /** Area 2 — binary · failure-mode-specific · code-where-possible? */
41
+ EvaluatorDesign: "evaluator-design",
42
+ /** Area 3 — judges validated vs human labels (TPR/TNR · clean split)? */
43
+ JudgeValidation: "judge-validation",
44
+ /** Area 4 — domain experts · full traces · enough human labels to validate? */
45
+ HumanReview: "human-review",
46
+ /** Area 5 — enough + balanced labeled data (≥ per-class minimum)? */
47
+ LabeledData: "labeled-data",
48
+ /** Area 6 — suite living (never shrinks) · re-validated after model change? */
49
+ PipelineHygiene: "pipeline-hygiene",
50
+ } as const;
51
+ export type SelfAuditAreaValue = (typeof SelfAuditArea)[keyof typeof SelfAuditArea];
52
+
53
+ /** Stable area ordering for the deterministic report sort (S16 order). */
54
+ const AREA_ORDER: SelfAuditAreaValue[] = [
55
+ SelfAuditArea.ErrorAnalysis,
56
+ SelfAuditArea.EvaluatorDesign,
57
+ SelfAuditArea.JudgeValidation,
58
+ SelfAuditArea.HumanReview,
59
+ SelfAuditArea.LabeledData,
60
+ SelfAuditArea.PipelineHygiene,
61
+ ];
62
+
63
+ /** A finding's status — a DETERMINISTIC threshold outcome, NOT a subjective verdict. */
64
+ export const SelfAuditStatus = {
65
+ /** a measured threshold was breached — the agent should act on it. */
66
+ Problem: "problem",
67
+ /** the deterministic check passed; the nuanced read is still the agent's. */
68
+ Ok: "ok",
69
+ /** the artifact needed to decide is absent — neither pass nor problem. */
70
+ CannotDetermine: "cannot-determine",
71
+ } as const;
72
+ export type SelfAuditStatusValue = (typeof SelfAuditStatus)[keyof typeof SelfAuditStatus];
73
+
74
+ /** Severity = IMPACT on trustworthiness (not code size). Drives the report sort. */
75
+ export const SelfAuditSeverity = {
76
+ /** blocks the whole trust chain (e.g. zero labels ⇒ no judge can be validated). */
77
+ Crit: "crit",
78
+ /** a judge/criterion the suite relies on is untrustworthy. */
79
+ High: "high",
80
+ /** a quality smell that widens CIs / weakens coverage. */
81
+ Med: "med",
82
+ /** advisory hygiene. */
83
+ Low: "low",
84
+ } as const;
85
+ export type SelfAuditSeverityValue = (typeof SelfAuditSeverity)[keyof typeof SelfAuditSeverity];
86
+
87
+ /** Higher rank sorts FIRST (most impactful finding leads the report). */
88
+ const SEVERITY_RANK: Record<SelfAuditSeverityValue, number> = {
89
+ [SelfAuditSeverity.Crit]: 3,
90
+ [SelfAuditSeverity.High]: 2,
91
+ [SelfAuditSeverity.Med]: 1,
92
+ [SelfAuditSeverity.Low]: 0,
93
+ };
94
+
95
+ /** One deterministic finding — DATA, never judge prose. */
96
+ export interface SelfAuditFinding {
97
+ area: SelfAuditAreaValue;
98
+ status: SelfAuditStatusValue;
99
+ severity: SelfAuditSeverityValue;
100
+ /** the criterion/judge this finding concerns, when scoped to one. */
101
+ subjectId?: string;
102
+ /** the measured fact (a signal string: "tpr 0.82 < 0.90 target"), NOT a verdict. */
103
+ signal: string;
104
+ }
105
+
106
+ /** The per-class minimum labeled examples for a reliable TPR/TNR (eval-audit Area 5). */
107
+ export const MIN_LABELS_PER_CLASS = 50;
108
+
109
+ /** The eval-development artifacts the self-audit reasons over (all REUSED, none rebuilt). */
110
+ export interface SelfAuditInput {
111
+ /** the `*discover-evals` output — Areas 1 + 2. */
112
+ criteria?: DiscoveredCriterion[];
113
+ /** the `*validate` output, one per calibrated judge — Area 3. */
114
+ validations?: ValidationResult[];
115
+ /** the `*review` human labels — Areas 4 + 5. */
116
+ labels?: HumanLabel[];
117
+ /** living-suite size before→after a `*discover-dataset` / `*discover-evals` append — Area 6. */
118
+ suiteGrowth?: { beforeCount: number; afterCount: number };
119
+ /** judge-pin hygiene — did the model change without a re-validation? Area 6. */
120
+ pinHygiene?: { modelChanged: boolean; revalidatedAfterChange: boolean };
121
+ }
122
+
123
+ /** The eval-of-the-eval report — findings ordered by impact + per-area/-status tallies. */
124
+ export interface SelfAuditReport {
125
+ /** findings, sorted most-impactful first (severity desc → area order → subjectId). */
126
+ findings: SelfAuditFinding[];
127
+ /** the areas that surfaced at least one `problem` finding. */
128
+ areasWithProblems: SelfAuditAreaValue[];
129
+ /** deterministic tallies for the rollup. */
130
+ totals: {
131
+ problem: number;
132
+ ok: number;
133
+ cannotDetermine: number;
134
+ crit: number;
135
+ high: number;
136
+ };
137
+ }
138
+
139
+ // ── Area 1 — Error Analysis (were criteria mined from real ✓/✗ evidence?) ─────
140
+
141
+ /**
142
+ * A criterion with ZERO support count was not surfaced by an actual ✓/✗ split —
143
+ * a brainstormed-not-observed smell (eval-audit Area 1). PURE.
144
+ */
145
+ export function auditErrorAnalysis(criteria: DiscoveredCriterion[]): SelfAuditFinding[] {
146
+ return criteria
147
+ .filter((c) => c.supportCount <= 0)
148
+ .map((c) => ({
149
+ area: SelfAuditArea.ErrorAnalysis,
150
+ status: SelfAuditStatus.Problem,
151
+ severity: SelfAuditSeverity.High,
152
+ subjectId: c.id,
153
+ signal: `criterion supportCount=0 — ungrounded (no ✓/✗ trace evidence); brainstormed-not-observed`,
154
+ }));
155
+ }
156
+
157
+ // ── Area 2 — Evaluator Design (code-before-judge: not all-LLM) ───────────────
158
+
159
+ /**
160
+ * Among the eval-worthy criteria, if NONE is code-based the suite likely
161
+ * over-relies on LLM judges where a deterministic check would do (eval-audit
162
+ * Area 2 — "code where possible"). Binary-not-Likert + one-failure-mode are
163
+ * invariants by construction; the nuanced "is THIS one objectively checkable?"
164
+ * read is the agent's. PURE.
165
+ */
166
+ export function auditEvaluatorDesign(criteria: DiscoveredCriterion[]): SelfAuditFinding[] {
167
+ const evalWorthy = criteria.filter((c) => c.flag === CriterionFlag.EvalWorthy);
168
+ if (evalWorthy.length === 0) return [];
169
+ const codeBased = evalWorthy.filter((c) => c.judgeKind === JudgeKind.Code);
170
+ if (codeBased.length > 0) return [];
171
+ return [
172
+ {
173
+ area: SelfAuditArea.EvaluatorDesign,
174
+ status: SelfAuditStatus.Problem,
175
+ severity: SelfAuditSeverity.Med,
176
+ signal:
177
+ `${evalWorthy.length} eval-worthy criteria, 0 code-based — possible over-reliance ` +
178
+ `on LLM judges; reserve judges for interpretation, use code for objective checks`,
179
+ },
180
+ ];
181
+ }
182
+
183
+ // ── Area 3 — Judge Validation (validated vs human labels, TPR/TNR ≥ target) ───
184
+
185
+ /**
186
+ * A judge is trustworthy only when its `*validate` result is `validated` AND its
187
+ * TPR/TNR clear the target (eval-audit Area 3). Consumes the `ValidationResult[]`
188
+ * straight from `*validate` (EV-044) — no recompute. PURE.
189
+ */
190
+ export function auditJudgeValidation(validations: ValidationResult[]): SelfAuditFinding[] {
191
+ const findings: SelfAuditFinding[] = [];
192
+ for (const v of validations) {
193
+ if (v.status === ValidationStatus.Unvalidated) {
194
+ findings.push({
195
+ area: SelfAuditArea.JudgeValidation,
196
+ status: SelfAuditStatus.Problem,
197
+ severity: SelfAuditSeverity.High,
198
+ subjectId: v.criterionId,
199
+ signal: `judge status=unvalidated (labelCount=${v.labelCount}) — verdicts bias-corrected, not trusted raw`,
200
+ });
201
+ continue;
202
+ }
203
+ const lowTpr = v.tpr !== null && v.tpr < TARGET_TPR;
204
+ const lowTnr = v.tnr !== null && v.tnr < TARGET_TNR;
205
+ if (lowTpr || lowTnr) {
206
+ findings.push({
207
+ area: SelfAuditArea.JudgeValidation,
208
+ status: SelfAuditStatus.Problem,
209
+ severity: SelfAuditSeverity.High,
210
+ subjectId: v.criterionId,
211
+ signal:
212
+ `judge below target: tpr=${fmt(v.tpr)} (≥${TARGET_TPR}) · ` +
213
+ `tnr=${fmt(v.tnr)} (≥${TARGET_TNR})`,
214
+ });
215
+ }
216
+ }
217
+ return findings;
218
+ }
219
+
220
+ /**
221
+ * Every eval-worthy LLM/hybrid criterion SHOULD have a validation result; one
222
+ * with no `ValidationResult` at all has an uncalibrated judge (eval-audit Area 3).
223
+ * PURE.
224
+ */
225
+ export function auditUncalibratedJudges(
226
+ criteria: DiscoveredCriterion[],
227
+ validations: ValidationResult[],
228
+ ): SelfAuditFinding[] {
229
+ const calibrated = new Set(validations.map((v) => v.criterionId));
230
+ return criteria
231
+ .filter(
232
+ (c) =>
233
+ c.flag === CriterionFlag.EvalWorthy &&
234
+ (c.judgeKind === JudgeKind.Llm || c.judgeKind === JudgeKind.Hybrid) &&
235
+ !calibrated.has(c.id),
236
+ )
237
+ .map((c) => ({
238
+ area: SelfAuditArea.JudgeValidation,
239
+ status: SelfAuditStatus.Problem,
240
+ severity: SelfAuditSeverity.High,
241
+ subjectId: c.id,
242
+ signal: `${c.judgeKind} judge has NO validation result — uncalibrated; run *validate before trusting it`,
243
+ }));
244
+ }
245
+
246
+ // ── Area 4 — Human Review (any ground-truth labels at all?) ──────────────────
247
+
248
+ /** Non-deferred Pass/Fail labels — the calibration ground truth. */
249
+ function decidedLabels(labels: HumanLabel[]): HumanLabel[] {
250
+ return labels.filter((l) => l.label !== HumanVerdict.Defer);
251
+ }
252
+
253
+ /**
254
+ * With zero decided human labels NO judge can be validated — the trust chain is
255
+ * broken at the root (eval-audit Area 4). CRIT. PURE.
256
+ */
257
+ export function auditHumanReview(labels: HumanLabel[]): SelfAuditFinding[] {
258
+ if (decidedLabels(labels).length > 0) return [];
259
+ return [
260
+ {
261
+ area: SelfAuditArea.HumanReview,
262
+ status: SelfAuditStatus.Problem,
263
+ severity: SelfAuditSeverity.Crit,
264
+ signal: `0 decided human labels (Pass/Fail) — no ground truth; *validate cannot calibrate any judge`,
265
+ },
266
+ ];
267
+ }
268
+
269
+ // ── Area 5 — Labeled Data (enough + balanced per class) ──────────────────────
270
+
271
+ /**
272
+ * Reliable TPR/TNR needs ≥ MIN_LABELS_PER_CLASS of EACH class; a Fail-starved
273
+ * set can't measure TNR (eval-audit Area 5). Skipped (cannot-determine) when
274
+ * there are no labels at all — that gap is Area 4's CRIT, not double-counted
275
+ * here. PURE.
276
+ */
277
+ export function auditLabeledData(labels: HumanLabel[]): SelfAuditFinding[] {
278
+ const decided = decidedLabels(labels);
279
+ if (decided.length === 0) {
280
+ return [
281
+ {
282
+ area: SelfAuditArea.LabeledData,
283
+ status: SelfAuditStatus.CannotDetermine,
284
+ severity: SelfAuditSeverity.Low,
285
+ signal: `no labels to measure balance (see human-review CRIT)`,
286
+ },
287
+ ];
288
+ }
289
+ const pass = decided.filter((l) => l.label === HumanVerdict.Pass).length;
290
+ const fail = decided.filter((l) => l.label === HumanVerdict.Fail).length;
291
+ if (pass >= MIN_LABELS_PER_CLASS && fail >= MIN_LABELS_PER_CLASS) return [];
292
+ return [
293
+ {
294
+ area: SelfAuditArea.LabeledData,
295
+ status: SelfAuditStatus.Problem,
296
+ severity: SelfAuditSeverity.Med,
297
+ signal:
298
+ `insufficient/imbalanced labels: ${pass} Pass / ${fail} Fail ` +
299
+ `(need ≥${MIN_LABELS_PER_CLASS} of each for reliable TPR/TNR)`,
300
+ },
301
+ ];
302
+ }
303
+
304
+ // ── Area 6 — Pipeline Hygiene (living suite · re-validate on model change) ────
305
+
306
+ /**
307
+ * A living suite NEVER shrinks (EV-053), and a judge-model change forces a
308
+ * re-validation (C-PIN). Either violation is an Area-6 finding. PURE.
309
+ */
310
+ export function auditPipelineHygiene(input: SelfAuditInput): SelfAuditFinding[] {
311
+ const findings: SelfAuditFinding[] = [];
312
+ const g = input.suiteGrowth;
313
+ if (g && g.afterCount < g.beforeCount) {
314
+ findings.push({
315
+ area: SelfAuditArea.PipelineHygiene,
316
+ status: SelfAuditStatus.Problem,
317
+ severity: SelfAuditSeverity.Crit,
318
+ signal: `suite shrank ${g.beforeCount}→${g.afterCount} — monotonic-growth violation (EV-053)`,
319
+ });
320
+ }
321
+ const p = input.pinHygiene;
322
+ if (p && p.modelChanged && !p.revalidatedAfterChange) {
323
+ findings.push({
324
+ area: SelfAuditArea.PipelineHygiene,
325
+ status: SelfAuditStatus.Problem,
326
+ severity: SelfAuditSeverity.High,
327
+ signal: `judge model changed without re-validation — stale calibration (C-PIN)`,
328
+ });
329
+ }
330
+ return findings;
331
+ }
332
+
333
+ // ── The aggregate eval-of-the-eval ───────────────────────────────────────────
334
+
335
+ /**
336
+ * Run the six-area diagnostic over the evaluator's own eval-dev artifacts and
337
+ * assemble the findings into an impact-ordered report. DETERMINISTIC: findings
338
+ * sort by severity (desc) → area order → subjectId, so the same input yields a
339
+ * byte-identical report. Emits DATA only — the nuanced read + overall verdict
340
+ * are the `audit-executor` agent's (Type B). PURE.
341
+ */
342
+ export function selfAudit(input: SelfAuditInput): SelfAuditReport {
343
+ const criteria = input.criteria ?? [];
344
+ const validations = input.validations ?? [];
345
+ const labels = input.labels ?? [];
346
+
347
+ const findings: SelfAuditFinding[] = [
348
+ ...auditErrorAnalysis(criteria),
349
+ ...auditEvaluatorDesign(criteria),
350
+ ...auditJudgeValidation(validations),
351
+ ...auditUncalibratedJudges(criteria, validations),
352
+ ...auditHumanReview(labels),
353
+ ...auditLabeledData(labels),
354
+ ...auditPipelineHygiene(input),
355
+ ];
356
+
357
+ findings.sort((a, b) => {
358
+ const sev = SEVERITY_RANK[b.severity] - SEVERITY_RANK[a.severity];
359
+ if (sev !== 0) return sev;
360
+ const area = AREA_ORDER.indexOf(a.area) - AREA_ORDER.indexOf(b.area);
361
+ if (area !== 0) return area;
362
+ return (a.subjectId ?? "").localeCompare(b.subjectId ?? "");
363
+ });
364
+
365
+ const problems = findings.filter((f) => f.status === SelfAuditStatus.Problem);
366
+ const areasWithProblems = AREA_ORDER.filter((area) =>
367
+ problems.some((f) => f.area === area),
368
+ );
369
+
370
+ return {
371
+ findings,
372
+ areasWithProblems,
373
+ totals: {
374
+ problem: problems.length,
375
+ ok: findings.filter((f) => f.status === SelfAuditStatus.Ok).length,
376
+ cannotDetermine: findings.filter((f) => f.status === SelfAuditStatus.CannotDetermine)
377
+ .length,
378
+ crit: findings.filter((f) => f.severity === SelfAuditSeverity.Crit).length,
379
+ high: findings.filter((f) => f.severity === SelfAuditSeverity.High).length,
380
+ },
381
+ };
382
+ }
383
+
384
+ /** Format a nullable rate for a signal string (deterministic). */
385
+ function fmt(n: number | null): string {
386
+ return n === null ? "n/a" : n.toFixed(2);
387
+ }
@@ -0,0 +1,106 @@
1
+ /**
2
+ * scripts/source-map.ts — P2 §5a: the source-map (topology) artifact.
3
+ * ---------------------------------------------------------------------------
4
+ * The FIRST step of every `*discover-evals` run: MAP the source before mining. The map
5
+ * = the entity/feature/stage topology + the per-stage I/O schema. It reuses the
6
+ * existing `profileSubject` topology (subject name · platform · tool inventory ·
7
+ * event taxonomy) and ADDS the per-stage I/O view derived from the GENERATION
8
+ * observations.
9
+ *
10
+ * SCHEMA-VARIANCE TOLERANT (SV-1, the P1 discipline): production sources carry a
11
+ * null trace-level `.output` (real I/O lives in the GENERATION observations) and
12
+ * ≥2 coexisting prompt-template shapes. This mapper reads the GENERATION obs,
13
+ * tolerates a bare-string output (no object keys) without aborting, and counts
14
+ * the null-trace-output traces as an honest SV-1 signal.
15
+ *
16
+ * GENERIC: stage ids + I/O keys are DATA-DERIVED from the traces — NO client
17
+ * topology / field / template literal is hard-coded. PURE + deterministic
18
+ * (stages ranked by count desc then id asc; keys sorted) — no clock/random.
19
+ */
20
+ import { profileSubject, type ToolStat } from "./profile-subject.ts";
21
+ import type { EvalTrace, TraceObservation } from "./contracts/eval-types.ts";
22
+
23
+ /** One pipeline stage's I/O topology (a GENERATION observation, by name). */
24
+ export interface StageIO {
25
+ /** the stage id = the GENERATION observation name (else "generation"). */
26
+ id: string;
27
+ /** distinct input-object keys seen for this stage across the batch (sorted). */
28
+ inputKeys: string[];
29
+ /** distinct output-object keys seen for this stage across the batch (sorted). */
30
+ outputKeys: string[];
31
+ /** how many traces exhibit this stage. */
32
+ count: number;
33
+ }
34
+
35
+ /** The source-map artifact: topology + per-stage I/O, SV-1-tolerant. */
36
+ export interface SourceMap {
37
+ subjectName: string;
38
+ platform: string;
39
+ traceCount: number;
40
+ /** SV-1 signal: # traces whose trace-level output was null/absent. */
41
+ nullOutputTraces: number;
42
+ toolInventory: ToolStat[];
43
+ eventTaxonomy: Record<string, number>;
44
+ /** the per-stage I/O topology (GENERATION observations). */
45
+ stages: StageIO[];
46
+ }
47
+
48
+ function isGeneration(o: TraceObservation): boolean {
49
+ return typeof o.type === "string" && o.type.toUpperCase() === "GENERATION";
50
+ }
51
+
52
+ /** Distinct object keys of a value, or [] when it is not a plain object. */
53
+ function objectKeys(value: unknown): string[] {
54
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return [];
55
+ return Object.keys(value as Record<string, unknown>);
56
+ }
57
+
58
+ interface StageAcc {
59
+ inputKeys: Set<string>;
60
+ outputKeys: Set<string>;
61
+ traceIds: Set<string>;
62
+ }
63
+
64
+ /**
65
+ * Build the source-map from a trace batch. Reuses `profileSubject` for the
66
+ * subject/topology fields and derives the per-stage I/O from the GENERATION
67
+ * observations. PURE + deterministic.
68
+ */
69
+ export function buildSourceMap(traces: EvalTrace[]): SourceMap {
70
+ const profile = profileSubject(traces);
71
+
72
+ const stages = new Map<string, StageAcc>();
73
+ let nullOutputTraces = 0;
74
+
75
+ for (const t of traces) {
76
+ if (t.output === null || t.output === undefined) nullOutputTraces += 1;
77
+ for (const o of t.observations) {
78
+ if (!isGeneration(o)) continue;
79
+ const id = typeof o.name === "string" && o.name.length > 0 ? o.name : "generation";
80
+ const acc = stages.get(id) ?? { inputKeys: new Set(), outputKeys: new Set(), traceIds: new Set() };
81
+ for (const k of objectKeys(o.input)) acc.inputKeys.add(k);
82
+ for (const k of objectKeys(o.output)) acc.outputKeys.add(k);
83
+ acc.traceIds.add(t.id);
84
+ stages.set(id, acc);
85
+ }
86
+ }
87
+
88
+ const stageList: StageIO[] = [...stages.entries()]
89
+ .map(([id, acc]) => ({
90
+ id,
91
+ inputKeys: [...acc.inputKeys].sort(),
92
+ outputKeys: [...acc.outputKeys].sort(),
93
+ count: acc.traceIds.size,
94
+ }))
95
+ .sort((a, b) => (b.count - a.count !== 0 ? b.count - a.count : a.id.localeCompare(b.id)));
96
+
97
+ return {
98
+ subjectName: profile.subjectName,
99
+ platform: profile.platform,
100
+ traceCount: profile.traceCount,
101
+ nullOutputTraces,
102
+ toolInventory: profile.toolInventory,
103
+ eventTaxonomy: profile.eventTaxonomy,
104
+ stages: stageList,
105
+ };
106
+ }
@@ -0,0 +1,134 @@
1
+ /**
2
+ * scripts/subject-profile.ts — §9.4.4 M1: the JUDGE-PACKET subject profile builder.
3
+ * ---------------------------------------------------------------------------
4
+ * M1 says the judge must know WHO the agent is BEFORE it judges — identity ·
5
+ * purpose · tools · skill · scope. This is the SMALL, judge-facing profile that
6
+ * rides in the `MatrixPacket` (distinct from the heavier trace-exploration
7
+ * `SubjectProfile` in `profile-subject.ts`, which drives `*audit` / discover).
8
+ *
9
+ * Two construction paths, both PURE + deterministic:
10
+ * - GIVEN — code/metadata access: caller passes identity/purpose/scope/
11
+ * skill/harness/version; tools default to the reconstructed
12
+ * inventory when not given.
13
+ * - RECONSTRUCTED — no access: identity/tools are reconstructed from the trace
14
+ * batch (tool inventory via `inferToolInventory`); purpose/scope
15
+ * are best-effort from the trace name + the prompts; the harness
16
+ * is MARKED `unknown` (never confabulated), and every inferred
17
+ * field is listed in `inferredFields` (honesty about provenance).
18
+ *
19
+ * NEVER confabulates: a field the inputs cannot establish is set to PROFILE_UNKNOWN,
20
+ * not guessed. No clock / random / network.
21
+ */
22
+ import {
23
+ PROFILE_UNKNOWN,
24
+ SubjectProfileProvenance,
25
+ type SubjectProfile,
26
+ } from "./contracts/eval-matrix.ts";
27
+ import { inferToolInventory, inferSystemPrompt } from "./profile-subject.ts";
28
+ import type { EvalTrace } from "./contracts/eval-types.ts";
29
+
30
+ /** The GIVEN facts a caller with code/metadata access can supply (M1). Any field
31
+ * left absent is RECONSTRUCTED from the trace batch or MARKED `unknown`. */
32
+ export interface GivenSubjectFacts {
33
+ identity?: string;
34
+ /** the KIND of subject (autonomous-agent · skill · tool). MARKED unknown when absent. */
35
+ entityType?: string;
36
+ purpose?: string;
37
+ tools?: string[];
38
+ skill?: string;
39
+ scope?: string;
40
+ harness?: string;
41
+ version?: string;
42
+ /** the agent's system prompt (code access). Rendered COLLAPSED; never confabulated. */
43
+ systemPrompt?: string;
44
+ }
45
+
46
+ export interface BuildSubjectProfileParams {
47
+ subjectName: string;
48
+ traces: EvalTrace[];
49
+ /** GIVEN facts (code access). ABSENT ⇒ a fully RECONSTRUCTED profile. */
50
+ given?: GivenSubjectFacts;
51
+ }
52
+
53
+ /** The first non-empty prompt across the batch (a best-effort purpose anchor). */
54
+ function firstPrompt(traces: EvalTrace[]): string {
55
+ for (const t of traces) {
56
+ const p = t.input?.prompt;
57
+ if (typeof p === "string" && p.trim().length > 0) return p.trim();
58
+ }
59
+ return "";
60
+ }
61
+
62
+ /**
63
+ * M1 — build the judge-packet `SubjectProfile`. When `given` is supplied (code
64
+ * access) those facts WIN and provenance is `given`; the remaining fields are
65
+ * reconstructed from the traces. When `given` is absent the whole profile is
66
+ * `reconstructed` and the harness is MARKED `unknown` (never confabulated). PURE.
67
+ */
68
+ export function buildSubjectProfile(params: BuildSubjectProfileParams): SubjectProfile {
69
+ const { subjectName, traces, given } = params;
70
+ const hasGiven = given !== undefined && Object.keys(given).length > 0;
71
+
72
+ // tools: GIVEN inventory wins; else reconstruct from observations[].type==="TOOL".
73
+ const reconstructedTools = inferToolInventory(traces).map((t) => t.name);
74
+ const tools = given?.tools && given.tools.length > 0 ? given.tools : reconstructedTools;
75
+
76
+ // purpose/scope: GIVEN wins; else a best-effort from the trace name + a prompt.
77
+ const promptAnchor = firstPrompt(traces);
78
+ const inferredFields: string[] = [];
79
+
80
+ const identity = given?.identity ?? subjectName;
81
+ if (given?.identity === undefined) inferredFields.push("identity");
82
+
83
+ let purpose = given?.purpose;
84
+ if (purpose === undefined) {
85
+ purpose =
86
+ promptAnchor.length > 0
87
+ ? `Reconstructed from the trace batch — handles inputs of the form: "${promptAnchor.slice(0, 120)}".`
88
+ : `Reconstructed from the trace batch — purpose not stated in the traces (${PROFILE_UNKNOWN}).`;
89
+ inferredFields.push("purpose");
90
+ }
91
+
92
+ let scope = given?.scope;
93
+ if (scope === undefined) {
94
+ scope =
95
+ tools.length > 0
96
+ ? `Reconstructed scope — observed to operate over: ${tools.slice(0, 8).join(", ")}.`
97
+ : `Scope not establishable from the traces (${PROFILE_UNKNOWN}).`;
98
+ inferredFields.push("scope");
99
+ }
100
+
101
+ if (given?.tools === undefined || given.tools.length === 0) inferredFields.push("tools");
102
+
103
+ // harness: GIVEN wins; else MARKED unknown — NEVER confabulated.
104
+ const harness = given?.harness ?? PROFILE_UNKNOWN;
105
+ if (given?.harness === undefined) inferredFields.push("harness");
106
+
107
+ // entityType: GIVEN-only (no trace reconstruction). ABSENT ⇒ omitted (the renderer
108
+ // marks it `unknown`), and listed as inferred so the hero honesty signal stays accurate.
109
+ if (given?.entityType === undefined) inferredFields.push("entityType");
110
+
111
+ // systemPrompt (UI-14): GIVEN (code access) WINS; else RECONSTRUCT from the trace
112
+ // batch — every LLM call's GENERATION observation carries the message list whose
113
+ // `role:"system"` entry IS the prompt. Found ⇒ populate it (still listed as inferred
114
+ // so the hero shows "RECONSTRUCTED · from traces"); NOT found ⇒ omit it (renderer
115
+ // marks UNAVAILABLE). NEVER confabulated.
116
+ let systemPrompt = given?.systemPrompt;
117
+ if (systemPrompt === undefined) systemPrompt = inferSystemPrompt(traces);
118
+ if (given?.systemPrompt === undefined) inferredFields.push("systemPrompt");
119
+
120
+ const profile: SubjectProfile = {
121
+ identity,
122
+ purpose,
123
+ tools,
124
+ scope,
125
+ harness,
126
+ provenance: hasGiven ? SubjectProfileProvenance.Given : SubjectProfileProvenance.Reconstructed,
127
+ ...(given?.entityType !== undefined ? { entityType: given.entityType } : {}),
128
+ ...(given?.skill !== undefined ? { skill: given.skill } : {}),
129
+ ...(given?.version !== undefined ? { version: given.version } : {}),
130
+ ...(systemPrompt !== undefined ? { systemPrompt } : {}),
131
+ ...(inferredFields.length > 0 ? { inferredFields } : {}),
132
+ };
133
+ return profile;
134
+ }