@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,25 @@
1
+ # mutagent-builder — skill nav map
2
+
3
+ `mutagent-builder` is the **ADL ② BUILD** stage. It consumes a validated `agentspec.yaml`, target root,
4
+ chosen framework or harness, pinned `build.runtime`, and pinned docs from `appendix.framework_docs`,
5
+ then implements the spec through the builder-owned `ai-engineer` / `ai-architect` pair.
6
+
7
+ ## Where everything lives
8
+
9
+ | You want… | Read |
10
+ |---|---|
11
+ | The skill surface and command map | `.claude/skills/mutagent-builder/SKILL.md` |
12
+ | The authoritative `*build` protocol | `.claude/skills/mutagent-builder/references/workflows/build-protocol.md` |
13
+ | The IMPROVE / EDD handoff contract | `.claude/skills/mutagent-builder/references/workflows/improve-handoff.md` |
14
+ | Operative BUILD principles | `.claude/skills/mutagent-builder/references/principles.md` |
15
+ | The write-capable BUILD Actor | `.claude/skills/mutagent-builder/assets/agents/ai-engineer.md` |
16
+ | The read-only BUILD Verifier and sync-spec analyst | `.claude/skills/mutagent-builder/assets/agents/ai-architect.md` |
17
+ | Spec-sync freshness probe | `.claude/skills/mutagent-builder/scripts/sync-spec/check-sync-spec.ts` |
18
+ | Spec implementation coverage gate | `.claude/skills/mutagent-builder/scripts/verify/spec-impl-coverage.ts` |
19
+
20
+ ## Boundary
21
+
22
+ - SPEC (`mutagent-agentspec`) emits and validates `agentspec.yaml`; it also owns the `*sync-spec` command (reconcile spec↔target), delegating the code-read to this package's `ai-architect #sync-spec`.
23
+ - BUILD (`mutagent-builder`) implements it; its `ai-architect #sync-spec` mode is the single implementation-reader — agentspec's `*sync-spec` delegates to it, and `*build` reuses it build-internally when code/content drifted ahead.
24
+ - EVALUATE judges; DIAGNOSE performs RCA; IMPROVE gates remedies and delegates agentspec-backed implementation work back here.
25
+ - ADL BUILD ownership stays in this package; no legacy builder delegation path is used.
@@ -0,0 +1,26 @@
1
+ # @mutagent/builder
2
+
3
+ > **ADL ② BUILD stage.** Implements a validated `agentspec.yaml` into a target framework or harness.
4
+
5
+ `mutagent-builder` owns the executable BUILD boundary in the Agentic Development Lifecycle:
6
+ `spec → build → evaluate → diagnose → improve`. `mutagent-agentspec` emits and validates the
7
+ Definition; `mutagent-builder` consumes that Definition, updates a stale brownfield spec when gated,
8
+ and produces the implementation plus build report that EVALUATE judges.
9
+
10
+ ## Commands
11
+
12
+ | Command | Purpose |
13
+ |---|---|
14
+ | `*build` | Implement a schema-valid `agentspec.yaml` into the target framework or harness. |
15
+ | `*sync-spec` | Compare implementation freshness with `agentspec.yaml`; derive/update the spec when code drifted ahead. |
16
+
17
+ ## What ships
18
+
19
+ | Surface | Purpose |
20
+ |---|---|
21
+ | `assets/agents/ai-engineer.md` | Write-capable BUILD Actor and EDD amendment implementer. |
22
+ | `assets/agents/ai-architect.md` | Read-only BUILD Verifier and `*sync-spec` drift analyst. |
23
+ | `scripts/sync-spec/check-sync-spec.ts` | Deterministic freshness probe used before brownfield BUILD. |
24
+ | `scripts/verify/spec-impl-coverage.ts` | Deterministic spec→implementation coverage gate. |
25
+
26
+ `mutagent-builder` is the ADL BUILD owner. Internal skill-construction loops are separate and not used for Helix BUILD routing.
@@ -0,0 +1,192 @@
1
+ # mutagent-diagnostics — Skill Bundle
2
+
3
+ > **Audience: skill maintainers working inside this bundle.**
4
+ > For the end-user / install guide see the package-level
5
+ > [`mutagent-system/mutagent-diagnostics/README.md`](../../../README.md).
6
+
7
+ ---
8
+
9
+ ## What lives here
10
+
11
+ This directory is the skill bundle — the self-contained artifact published to GitHub Packages
12
+ as `@mutagent/diagnostics`. It is structured as an [agentskills.io](https://agentskills.io)
13
+ compliant skill, installable into any Claude Code, Codex, Cursor, or OpenCode session via
14
+ `pnpx @mutagent/diagnostics init`.
15
+
16
+ The canonical spec is `SKILL.md` (§0-§9, incl. §3.1 gold-standard report shape + §3.2 structured
17
+ contract mode). Everything else in this bundle is referenced from it.
18
+
19
+ ---
20
+
21
+ ## Bundle layout
22
+
23
+ ```
24
+ mutagent-diagnostics/ ← this directory
25
+
26
+ ├── SKILL.md ← operational contract §0-§9 (≤500 lines per PR-007)
27
+ ├── .npmignore ← strips internal/ + *.test.ts on publish
28
+
29
+ ├── scripts/ ← Type A: pure bun scripts (deterministic, no agent reasoning)
30
+ │ ├── tier0-scan.ts ← static scan — free cost gate before LLM (PR-001)
31
+ │ ├── tier0-scan.test.ts ← unit tests [stripped on publish]
32
+ │ ├── slicer.ts ← dynamic-cluster slicing, cap-of-5 (PR-005, PR-017)
33
+ │ ├── stale-detector.ts ← hash compare before any write (PR-011)
34
+ │ ├── cli/
35
+ │ │ ├── init.ts ← pnpx entrypoint + runtime detection (PR-021)
36
+ │ │ ├── install-agents.ts ← idempotent agent .md installer
37
+ │ │ └── run.sh ← bun → pnpm → npm → npx fallback (R-014-A)
38
+ │ ├── config/
39
+ │ │ ├── schema.ts ← TypeBox schema — single source of truth (PR-009)
40
+ │ │ ├── load.ts ← YAML parse + env-ref resolution
41
+ │ │ └── validate.ts ← typed validation errors
42
+ │ ├── fetch/
43
+ │ │ ├── langfuse.ts ← Langfuse trace fetch + filter
44
+ │ │ ├── claude-code-transcripts.sh ← transcript discovery (bash, R-014-A)
45
+ │ │ └── assemble-meta.ts ← meta-context assembly
46
+ │ ├── normalize/
47
+ │ │ ├── trace.ts ← canonical types + EntityContext/SizedText/ToolInventoryEntry/Assumption (Wave-5)
48
+ │ │ └── platforms/ ← per-platform shape mappers (PR-016)
49
+ │ │ └── entity-context.ts ← shared deterministic EntityContext extractors (Wave-5 R1.7, no LLM)
50
+ │ ├── enrich/
51
+ │ │ └── build-render-input.ts ← Wave-5 R1.4 enricher → fully-populated RenderInput (Step 8.5, fail-loud)
52
+ │ ├── contract/
53
+ │ │ └── types.ts ← TypeBox SelfDiagnosisContract schema (Wave-4 structured-report mode)
54
+ │ ├── report/
55
+ │ │ ├── render.ts ← enriched RenderInput → gold-standard multi-tab HTML (PR-014/PR-029)
56
+ │ │ └── persist-selections.ts ← persist operator copy-back selections from the HITL gate
57
+ │ ├── lint/
58
+ │ │ └── template-inline-js.ts ← R-007-B: reject TS in HTML <script> blocks
59
+ │ ├── setup/
60
+ │ │ ├── detect.ts ← config presence + completeness check (§0)
61
+ │ │ └── reconfigure.ts ← re-onboarding handler
62
+ │ ├── tier0/
63
+ │ │ ├── langfuse.ts ← Langfuse-specific tier-0 patterns
64
+ │ │ └── claude-code.ts ← Claude Code-specific tier-0 patterns
65
+ │ ├── validate/ ← finding shape validators
66
+ │ └── self-diagnostics/ ← [INTERNAL] probe.ts · dispatch.ts
67
+
68
+ ├── assets/
69
+ │ ├── agents/
70
+ │ │ └── diagnostics-analyzer.md ← Type B: pure_subagent_executor
71
+ │ │ dispatched by parent at Step 6
72
+ │ │ # diagnostics-apply-worker.md RETIRED (M9) — apply delegates to the shared
73
+ │ │ # mutagent-cli apply transport + a spawned ai-engineer (WRITE actor)
74
+ │ ├── templates/ ← interpolated at runtime (shipped to users)
75
+ │ │ ├── report.html.tpl ← gold-standard multi-tab report template (DO NOT add TS logic)
76
+ │ │ ├── config.yaml.tpl ← onboarding config skeleton
77
+ │ │ ├── pr-body.md.tpl ← apply PR description
78
+ │ │ ├── audit.json.tpl ← structured audit trail (PR-013)
79
+ │ │ └── audit.md.tpl ← human-readable audit trail (PR-013)
80
+ │ └── wireframes/ ← picker-UX wireframe prompts
81
+ │ ├── onboarding/ ← WF-1.x onboarding flows
82
+ │ ├── diagnostics/ ← WF-2.x diagnostics flows
83
+ │ └── optimization/ ← WF-3.x optimization flows
84
+
85
+ ├── references/ ← load-on-demand docs (not pre-loaded in SKILL.md)
86
+ │ ├── reference.md ← entry point + architecture + full dependency graph
87
+ │ ├── principles.md ← PR-001..PR-043 — the audit surface for every PR
88
+ │ ├── operator-feedback-log.md ← append-only operator feedback on the report shape (Wave-5 R1.6)
89
+ │ ├── config.md ← full config schema with doc strings
90
+ │ ├── operation-inventory.md ← Type A/B/C classification of every operation
91
+ │ ├── adapter-strategy.md ← adapter Q1-Q6 locked decisions
92
+ │ ├── filter-search-matrix.md← per-platform Filter/Search coverage matrix
93
+ │ ├── harness-knowledge.md ← platform knowledge table (expandable)
94
+ │ ├── onboarding-decisions.yaml ← phase decisions log
95
+ │ ├── open-questions.md ← OQ-1..OQ-10 all resolved
96
+ │ ├── workflows/
97
+ │ │ ├── onboarding.md ← 8-phase onboarding procedure
98
+ │ │ ├── orchestrator-protocol.md ← inline protocol (parent session = orchestrator)
99
+ │ │ ├── diagnostics.md ← full diagnostic procedure + NL→filter translation
100
+ │ │ ├── apply-dispatch.md ← apply mechanic per target class
101
+ │ │ ├── apply-pr-comment-format.md ← PR-023 Diagnostic Apply PR Comment format
102
+ │ │ ├── rca.md ← RCA procedure + 3-dim taxonomy (WHAT/WHY/WHERE)
103
+ │ │ └── schedule-prep.md ← wiring scheduling post-v0.1
104
+ │ ├── source-platforms/ ← CLI fetch + filter examples per platform
105
+ │ ├── target-platforms/ ← apply recipe + hyperlinks per target type
106
+ │ └── internal/
107
+ │ └── self-diagnostics.md ← [INTERNAL] PR-022 self-RCA playbook
108
+
109
+ ├── examples/
110
+ │ └── sample-findings.json ← example RCA output for reference
111
+
112
+ └── internal/ ← [stripped on publish via .npmignore]
113
+ └── templates/review/
114
+ ├── README.md ← decision tree for choosing a template
115
+ ├── _brand-shell.html ← empty branded scaffold (all primitives)
116
+ ├── iteration-template.html ← rich multi-phase approval
117
+ ├── review-template.html ← per-section lock-in + clipboard export
118
+ ├── status-template.html ← scroll-layout progress dashboard
119
+ └── skill-overview-template.html ← 9-tab SKILL.md walkthrough
120
+ ```
121
+
122
+ ---
123
+
124
+ ## Key invariants for contributors
125
+
126
+ | Principle | Rule |
127
+ |-----------|------|
128
+ | **PR-001** | `tier0-scan.ts` must run before any LLM call |
129
+ | **PR-004** | apply must always use a git worktree; never edit operator's checkout (now enforced by the shared `mutagent-cli apply` worktree-PR adapter; the apply-worker is retired, M9) |
130
+ | **PR-007** | `SKILL.md` must stay under 500 lines |
131
+ | **PR-009** | Config shape is owned by `scripts/config/schema.ts` (TypeBox); do not define it elsewhere |
132
+ | **PR-014** | `report.html.tpl` is the primary review surface; do not add destructive-action gates to the HTML itself |
133
+ | **PR-029** | The gold-standard report IS the product surface — `render.ts` panel functions must keep matching the `report.html.tpl` structure (CSS-class contract); template-stamp over procedural rendering |
134
+ | **R1 §9.3** | Fail-loud render contract — `render.ts` AND `build-render-input.ts` REFUSE (throw) when ≥3 of 4 internal shapes (`diagnosedEntity` / `bigStat` / `hourlyHeatmap` / `signalCensus`) are missing; never call the renderer on raw findings — always run the Step 8.5 enricher first |
135
+ | **R1.7** | Every normalizer emits a deterministic `EntityContext` at ingest (no LLM); the operator never hand-fills the entity card. Fields > 1 KB render as collapsed `ExpandableSection`; system prompt always collapsed (PII) |
136
+ | **R-014-A** | `.sh` scripts invoked via `exec bash`; no TS runtime required for shell operations |
137
+
138
+ ---
139
+
140
+ ## Orchestrator architecture
141
+
142
+ The orchestrator is **NOT a sub-agent** — it is the parent coding-agent session following
143
+ `references/workflows/orchestrator-protocol.md` inline.
144
+
145
+ Sub-agents are only the leaf workers:
146
+ - `diagnostics-analyzer.md` — dispatched per cluster (Step 6)
147
+ - apply (Step 11) spawns **ai-engineer** (the WRITE actor) which shells the shared
148
+ `mutagent-cli apply` transport — the bespoke `diagnostics-apply-worker` is retired (M9)
149
+
150
+ This design exists because sub-agents in Claude Code/Codex cannot dispatch further sub-agents
151
+ or invoke `AskUserQuestion` — the parent session retains those capabilities.
152
+
153
+ ---
154
+
155
+ ## Publish
156
+
157
+ ```bash
158
+ # Verify .npmignore correctly strips internal/
159
+ npm pack --dry-run | grep internal # should be empty
160
+
161
+ # Lint + typecheck
162
+ bun run lint && bun run typecheck
163
+
164
+ # Test scripts
165
+ bun test ./.claude/skills/mutagent-diagnostics/scripts/
166
+ ```
167
+
168
+ Registry: GitHub Packages (restricted). Not published to public npmjs.org.
169
+ Version: see `../../package.json` (`metadata.version` in SKILL.md frontmatter mirrors it).
170
+
171
+ ---
172
+
173
+ ## Brand tokens
174
+
175
+ All internal review templates share the MUTAGENT brand (from `internal/templates/review/`):
176
+
177
+ ```css
178
+ --p: #a78bfa; /* primary purple */
179
+ --c: #06b6d4; /* cyan secondary */
180
+ --g: #10b981; /* status green */
181
+ --y: #f59e0b; /* status yellow */
182
+ --r: #ef4444; /* status red */
183
+ --m: #f0abfc; /* magenta accents */
184
+ ```
185
+
186
+ Logotype gradient: `linear-gradient(135deg, #a78bfa 0%, #06b6d4 100%)`.
187
+ Fonts: Space Grotesk (display) + IBM Plex Mono (code). Mermaid dark theme.
188
+
189
+ ---
190
+
191
+ > For end-user documentation, see the package-level README at
192
+ > [`mutagent-system/mutagent-diagnostics/README.md`](../../../README.md).
@@ -0,0 +1,352 @@
1
+ ---
2
+ name: mutagent-diagnostics
3
+ description: |
4
+ Diagnostics-on-Tap for AI agents. Pull evidence from your agent traces, translate user feedback
5
+ into evidence-grounded root-cause records, surface ranked remedies, and apply approved fixes via
6
+ PR (local agents) or REST (cloud). First invocation: auto-detects setup and guides you through
7
+ onboarding (source platform, target platform, trigger rules). Subsequent invocations: dispatch
8
+ Orchestrator + N parallel Analyzers (≤5) against your traces, produce a gold-standard HTML report
9
+ (Methodology [INTERNAL] · Overview · one tab per finding · Decisions) with a rich auto-extracted
10
+ entity card, 6-tile big-stat row, 24h latency heatmap, signal census, per-finding assumptions
11
+ block, and ★-recommended remedies, let you review and copy-back markdown approval, then spawn a
12
+ Background agent on a Worktree to apply fixes branch-hygiene-safe. Supports
13
+ Langfuse, OpenTelemetry, local JSONL, Claude Code session transcripts, and Codex session
14
+ transcripts as sources. Apply targets (the shipped `target` enum): local coding-agent markdown
15
+ targets — Claude (.claude/agents/*.md), Codex, Cursor, OpenCode; local code-construct targets —
16
+ Mastra and Cloud Agent SDK; cloud REST; and report-only (produce the report, skip the apply gate).
17
+ LangGraph is a planned target (roadmap — not yet implemented). Tier 0 static
18
+ scan runs before LLM to bound token cost. 3-dimensional WHAT/WHY/WHERE failure taxonomy. Score
19
+ thresholds discovered dynamically from platform. Fully platform-portable: native AskUserQuestion
20
+ on Claude Code, chat-based multi-choice fallback elsewhere.
21
+ When the target declares a self-diagnosis-contract.yaml, diagnostics produces a STRUCTURED
22
+ 10-category report against the declared success criteria (operational / onboarding / behavioral /
23
+ hitl / output / methodology / tier-performance / source-platform / target-platform / maintenance);
24
+ otherwise it falls back to the standard open-ended pattern-match report.
25
+ license: Proprietary. LICENSE.txt has complete terms.
26
+ compatibility: Designed for Claude Code, Codex, Cursor, OpenCode and similar coding-agent runtimes; works with git, gh CLI, jq, curl, and Bun/pnpm/npm runtimes.
27
+ metadata:
28
+ author: mutagent
29
+ version: "0.1.0-alpha.8"
30
+ # allowed-tools: OMITTED — agent uses all native tools per host runtime (operator iter-7 T5)
31
+ ---
32
+
33
+ # mutagent-diagnostics
34
+
35
+ Diagnostics-on-Tap for AI agents. Invoke this skill to run a full diagnostic cycle on your agent traces.
36
+
37
+ ## §0 — Setup Detection (ALWAYS runs first)
38
+
39
+ > **CWD matters.** `detect.ts` (and every other `scripts/cli/run.sh`-dispatched
40
+ > script) MUST be invoked from the operator's PROJECT ROOT, NOT from inside the
41
+ > skill install path. `detect.ts` defensively rejects invocations from any path
42
+ > containing `.claude/skills/` to avoid mis-detecting the skill's own
43
+ > `.mutagent/diagnostics/` as the operator's project config. Use absolute paths
44
+ > in the `Bash()` call if your shell is anywhere else.
45
+
46
+ **Lean install (W9-10):** `pnpx @mutagent/diagnostics init` installs the skill AND
47
+ its sub-agents in one step. Onboarding (`references/workflows/onboarding.md`)
48
+ configures **platforms only** — agent install is NOT a mandatory onboarding step.
49
+ Onboarding checks whether agents are present (skip-if-present) and offers install
50
+ only if missing — it never mandates or auto-installs them. Agents already present
51
+ → silently skipped.
52
+
53
+ ```typescript
54
+ // PSEUDOCODE — actual execution is agent-native
55
+ const config = await Bash("bun scripts/cli/run.sh scripts/setup/detect.ts");
56
+ if (!config.complete) {
57
+ // → Onboarding branch (references/workflows/onboarding.md)
58
+ } else {
59
+ // → Diagnostics: load orchestrator-protocol.md and follow inline
60
+ // DO NOT dispatch a coordinator sub-agent (operator voice-stamp T1)
61
+ }
62
+ ```
63
+
64
+ Load `references/workflows/onboarding.md` if config missing or `--reconfigure` flag present.
65
+
66
+ **Source-platform CLI gate (onboarding, PR-021):** source platforms (Langfuse,
67
+ Codex, …) are usually driven via a CLI, and most clients will NOT have it
68
+ installed. During onboarding the skill (a) links the platform's **official CLI
69
+ docs** and (b) when the CLI is missing, **offers an install that the user must
70
+ explicitly approve first — it NEVER auto-installs**. The reusable
71
+ `ensure-cli(platform)` helper (`scripts/setup/ensure-cli.ts` →
72
+ `scripts/cli/init.ts` `ensureSourceCli`) probes PATH, shows docs + the install
73
+ command, then gates the install behind the platform-portable ASK (AskUserQuestion
74
+ on Claude Code; chat y/N fallback elsewhere). On decline → REST/file fallback +
75
+ record CLI absent. File-only / backend-specific sources (local-jsonl, claude-code,
76
+ otel) report `not-required` — nothing to install. See
77
+ `references/workflows/onboarding.md` Phase 2.
78
+
79
+ If config complete: load `references/workflows/orchestrator-protocol.md` and follow inline.
80
+ **Do NOT dispatch a coordinator sub-agent.** The parent session IS the orchestrator.
81
+ (Reason: sub-agents cannot dispatch other sub-agents or invoke AskUserQuestion — operator T1.)
82
+
83
+ ### §0.1 — Star-commands (W9-05)
84
+
85
+ `*command` tokens are this skill's internal semantic map. `@shortcut` tokens are the
86
+ architech resolver (external). Never mix them.
87
+
88
+ **Resolution contract:** when you encounter a `*<name>` token, look it up in the
89
+ `commands:` table below. `kind: script` → call the bound script. `kind: agent-chain`
90
+ → load the bound workflow file/section and run steps in order. `kind: hybrid` → call
91
+ script(s) for deterministic parts, reason for the rest. NEVER improvise.
92
+
93
+ | Command | Kind | Binds (relative) | Purpose |
94
+ |---------|------|-------------------|---------|
95
+ | `*diagnose` | hybrid | `orchestrator-protocol.md#step-1..11` | Full diagnostic pipeline |
96
+ | `*read-traces` | script | `scripts/normalize/read-unitf.ts` | Read the handed-over UniTF JSONL (+ manifest) → `TraceMetadata[]` + `EntityContext` — never fetch, never hand-parse |
97
+ | `*library-match` | script | `scripts/library/match.ts` | Best-effort prior consult (de-mandated W9-02; empty library → proceed fresh) |
98
+ | `*dispatch-analyzers` | agent-chain | `orchestrator-protocol.md#step-6 + handover-contract.md` | Fan-out ≤5 analyzers via handover contract |
99
+ | `*render-report` | script | `scripts/report/render.ts` | Stamp gold-standard HTML — never hand-build |
100
+ | `*self-diagnose` | hybrid | `references/internal/self-diagnostics.md` | Diagnose skill's own traces (PR-022) |
101
+
102
+ Full resolution contract verbatim:
103
+ ```
104
+ When you encounter a *<name> token:
105
+ 1. RESERVED — `*` marks a command. NOT prose, NOT a file path, NOT an @shortcut.
106
+ *command = THIS skill's semantic map (internal). @shortcut = architech resolver (external). Never mixed.
107
+ 2. RESOLVE — look up <name> in the `commands:` block. Not found => ERROR + ask. NEVER improvise.
108
+ 3. BINDING — read kind: + binds::
109
+ kind: script => binds: <relative script path> => CALL the script. Do NOT re-implement in prose.
110
+ kind: agent-chain => binds: <workflow file#section> => load + run the steps in order.
111
+ kind: hybrid => binds: both => call script(s) for deterministic parts, reason for the rest.
112
+ 4. PRE-GATE — load any pre_gate.loads:.
113
+ 5. EXECUTE — run compresses:/workflow steps IN ORDER. Invent nothing.
114
+ 6. purpose:/impact: explain WHY (not executed). compresses: MAY reference other *commands (composition).
115
+ ```
116
+
117
+ ## §1 — Triggers
118
+
119
+ Invoke me with:
120
+ - `mutagent-diagnostics` / `diagnose my agents` / `/mutagent-diagnostics`
121
+ - `diagnose <agent-name>` / `why did <agent> fail` / `analyze traces`
122
+ - `--reconfigure` to re-enter onboarding
123
+ - `pnpx @mutagent/diagnostics init` — manual CLI entry point (install + first-time setup)
124
+
125
+ ## §2 — Quick-Start
126
+
127
+ ```bash
128
+ pnpx @mutagent/diagnostics init # first-time: installs skill + runs onboarding
129
+ ```
130
+
131
+ After init, invoke naturally in your coding-agent chat.
132
+
133
+ ## §3 — Architecture Overview
134
+
135
+ ```mermaid
136
+ flowchart TD
137
+ SKILL -->|§0 detect| BRANCH{config?}
138
+ BRANCH -->|missing| ONB[Onboarding]
139
+ BRANCH -->|present| PROTOCOL[Load orchestrator-protocol.md\nParent session follows inline]
140
+ PROTOCOL --> TIER0[Tier 0 static scan]
141
+ TIER0 --> SLICER[Dynamic-cluster slicer]
142
+ SLICER --> ANL[N Analyzers ≤5]
143
+ ANL --> RCA[RCA Layer — WHAT/WHY/WHERE]
144
+ RCA --> ENRICH[Step 8.5 — Build Render Input\nscripts/enrich/build-render-input.ts\ndeterministic · fail-loud]
145
+ ENRICH --> REPORT[Gold-standard HTML Report + copy-back]
146
+ REPORT --> APPLY[Spawn BG agent on Worktree]
147
+ ```
148
+
149
+ Full DAG: `references/reference.md`
150
+
151
+ ### §3.1 — Report shape (Wave-5 gold-standard renderer)
152
+
153
+ `scripts/report/render.ts` + `assets/templates/report.html.tpl` emit the operator-approved
154
+ **gold-standard** report — NOT a generic 4-layer dump. Tab layout:
155
+
156
+ | Tab | Content |
157
+ |-----|---------|
158
+ | **Methodology [INTERNAL]** (`t0`) | Mermaid sequence (orchestrator → scripts → analyzers) + graded decision log + signal census. NODE-STRIPPED when `--audience client` (FU-INT-1). |
159
+ | **Overview** (`t1`) | Auto-extracted entity card · 6-tile big-stat row (latency p50/p95/max · cost · traces · errors) · headline callout · signal census · scan-coverage funnel · 24h latency heatmap (colour = avg latency, number = trace count) · findings summary table. |
160
+ | **F-NNN** (`t2..tN+1`) | One tab per finding — severity-badged story-led title · WHAT/WHY/WHERE taxonomy · Problem · Evidence · Why-chain (origin marker) · **Assumptions block** (verified / unverified / hypothesis-pending pills) · ranked remedies (★ rank-1 = green-glow `.recommended`, pre-checked). |
161
+ | **Decisions** (`tdecisions`) | Recommended-bundle callout + general speech-to-text feedback box + copy-decisions markdown export. |
162
+
163
+ The renderer is **fail-loud (R1 §9.3)**: it REFUSES (throws, non-zero) when ≥3 of the 4 internal
164
+ render shapes (`diagnosedEntity` / `bigStat` / `hourlyHeatmap` / `signalCensus`) are missing — no
165
+ silent placeholder. Always run the **Step 8.5 enricher** (`scripts/enrich/build-render-input.ts`)
166
+ first; never call the renderer on raw findings.
167
+
168
+ **Rich `EntityContext` at ingest (R1.7):** the UniTF reader
169
+ (`scripts/normalize/read-unitf.ts` → `unitf-adapter.ts`) projects an `EntityContext` (name · model
170
+ · system prompt · tool inventory with per-tool stats · input sample) from the handed-over trace's
171
+ `ext.agent` block alongside its `TraceBody[]` — deterministically, no LLM. (The per-tool /
172
+ system-prompt extractors live in the kept `scripts/normalize/platforms/entity-context.ts`; the
173
+ per-platform fetch/normalize adapters that USED to feed them now live in `@mutagent/tools`.)
174
+ The operator never hand-fills the entity card. Any field > 1 KB renders
175
+ inside a default-collapsed **`ExpandableSection`** (`<details class="expand">`); the system prompt is
176
+ ALWAYS collapsed regardless of size (PII — explicit click to view).
177
+
178
+ **Self-diagnosis report mode (PR-022/PR-025):** when `config.self_diagnostics.enabled`, the SAME
179
+ renderer produces a meta-report — findings cluster-grouped by `failureOrigin.what` (one tab per
180
+ cluster), a forced `⚙ SELF-DIAGNOSIS` banner, a skill-typed entity card (built from the skill's own
181
+ SKILL.md + `scripts/`), `[INTERNAL]` session prefix, and it REFUSES `--audience client` (self-diag
182
+ is always internal). See `references/internal/self-diagnostics.md`.
183
+
184
+ ### §3.2 — Structured contract mode (Wave-4)
185
+
186
+ When the diagnosed target declares a `self-diagnosis-contract.yaml`, the renderer switches to a
187
+ **structured 10-category report** (`renderStructuredReport`) scoring findings against the declared
188
+ success criteria (pass / fail / not-applicable / pending). Targets without a contract get the
189
+ open-ended gold-standard report unchanged. Schema: `scripts/contract/types.ts`.
190
+
191
+ ## §4 — Bill of Materials (scripts/ — Type A pure scripts)
192
+
193
+ | Script | Purpose |
194
+ |--------|---------|
195
+ | `scripts/tier0-scan.ts` | Static pattern scan — route-guess + signal count |
196
+ | `scripts/slicer.ts` | Dynamic-cluster slicing, cap-of-5 |
197
+ | `scripts/stale-detector.ts` | Hash compare for target freshness |
198
+ | `scripts/config/schema.ts` | TypeBox schema — config.yaml source of truth |
199
+ | `scripts/config/load.ts` | YAML parse + env-ref resolution |
200
+ | `scripts/config/validate.ts` | Schema validation + typed errors |
201
+ | `scripts/normalize/trace.ts` | Canonical types: TraceMetadata + TraceBody + Finding + Remedy + `EntityContext` / `SizedText` / `ToolInventoryEntry` / `Assumption` (Wave-5 R1.7/R1.3) |
202
+ | `scripts/normalize/read-unitf.ts` | **Trace intake** — reads the handed-over UniTF JSONL (+ manifest) from `HandoverBundle.inputs[]` → `TraceMetadata[]` + `EntityContext`; tolerant-but-visible bad-line drops; manifest warnings never abort. The skill NEVER fetches (fetch/normalize lives in `@mutagent/tools`, run via `mutagent-cli trace fetch`) |
203
+ | `scripts/normalize/unitf-adapter.ts` | Projects one `UnifiedTrace` → `{ metadata: TraceMetadata, messages, entity }` — the thin adapter that keeps the RCA/enrich/gate/render layer unchanged across the UniTF flip |
204
+ | `scripts/normalize/unitf-types.ts` | Local `UnifiedTrace` / `UnitfTraceManifest` type mirrors (+ `isUnifiedTraceLike` guard) — read-side shape contract for the JSONL |
205
+ | `scripts/normalize/platforms/entity-context.ts` | Shared deterministic `EntityContext` extractors (system-prompt, tool-inventory, input-sample, majority-vote name) + `buildSkillSelfEntityContext` (self-diag) — content-derived, NO LLM (Wave-5 R1.7) |
206
+ | `scripts/enrich/build-render-input.ts` | Deterministic enricher — (tier0, slice-plan, findings, metadata) → fully-populated `RenderInput`; aggregates 24h heatmap + big-stat + signal census; fail-loud on starved input (Wave-5 R1.4 — orchestrator Step 8.5) |
207
+ | `scripts/report/render.ts` | Renders the gold-standard multi-tab report (Methodology · Overview · one tab per finding · Decisions — tab count is dynamic, N findings → N tabs) from an enriched `RenderInput` (`--findings <p> --output <p> [--template <p>] [--audience client\|internal]`). Fail-loud when ≥3 of 4 internal shapes missing (R1 §9.3) |
208
+ | `scripts/report/persist-selections.ts` | Persist operator copy-back selections from the report HITL gate |
209
+ | `scripts/contract/types.ts` | TypeBox `SelfDiagnosisContract` schema — opt-in structured 10-category report mode (Wave-4) |
210
+ | `scripts/lint/template-inline-js.ts` | R-007-B: Walk `assets/templates/*.html`, reject TypeScript patterns in executable `<script>` blocks |
211
+ | `scripts/setup/detect.ts` | Config presence + completeness check; `--cli <plat>` probes a source platform's CLI via `ensure-cli` |
212
+ | `scripts/setup/ensure-cli.ts` | Source-platform-general CLI gate (PR-021): per-platform `CLI_SPECS` (binary + install cmd + official docs link), `planCliEnsure` decision (pure — never installs), `runCliInstall` (caller-gated — assumes approval). NEVER auto-installs |
213
+ | `scripts/setup/reconfigure.ts` | Re-onboarding handler |
214
+ | `scripts/cli/init.ts` | CLI entrypoint + runtime detection; `ensureSourceCli` approve-to-install gate + `--ensure-cli <plat>` mode (platform-portable ASK; install only on explicit approval) |
215
+ | `scripts/cli/doctor.ts` | Runtime probe + env validate + JSON health report (`{ runtime, env, version, errors[] }`) |
216
+ | `scripts/cli/run.sh` | bun→pnpm→npm fallback selector (fully portable — zero `Bun.*` API surface in scripts/cli/) |
217
+ | `scripts/self-diagnostics/probe.ts` | [INTERNAL] Host + session path detector |
218
+ | `scripts/self-diagnostics/dispatch.ts` | [INTERNAL] Self-trace → RCA dispatch |
219
+
220
+ Invoke scripts via: `Bash("scripts/cli/run.sh scripts/<name>.{ts|sh} [args]")`
221
+ — `.ts` files: dispatched via bun→pnpm-tsx→npx-tsx fallback chain
222
+ — `.sh` files: dispatched via `exec bash` (no TS runtime needed — R-014-A)
223
+
224
+ ### §4.1 — Wave-6 methodology layer (R2.1–R2.6 + D1/D2)
225
+
226
+ Wave-6 fixes the diagnostic **methodology** (the renderer was already Wave-5 gold).
227
+ The methodology layer below is the operative surface; its design rationale is
228
+ maintained internally (not shipped).
229
+
230
+ | Script | Remedy | Purpose |
231
+ |--------|--------|---------|
232
+ | `scripts/sample/representative.ts` | R2.5 / R2.1 | Shared 4-bucket sampler (worst·median·best·random, 15-floor, worst-weighted) + 4-dim coverage proof (latency·score·temporal·tool-trajectory) + population-bias stats. Per-finding `coverageConfidence` (90/70 → high/med/low), WARN-only, `--accept-low-confidence`. Deterministic (no clock/random). |
233
+ | `scripts/sample/caps.ts` | R2.1 / D1 / PR-048 | Multi-cap `{active,value}` + **dip→ramp deep-read**: escalation rungs `50·100·250·500·1000` (50 = cheap DIP first-rung, NOT a hard ceiling), per-tier time `50:300→1000:1800` (hard ceiling 1800s), default ceiling `min(N,1000)`. max-trace + time caps ACTIVE, **cost(10) INACTIVE by default (D1)**. **Operator override:** `computeCeiling(N, override)` / CLI `--max-trace <N>` raises the ceiling ABOVE 1000 ON COMMAND (operator-explicit only, never auto). `enforceCaps` first-to-trip, SKIPS inactive caps; cap → STOP + emit + banner. Clock injected. |
234
+ | `scripts/sample/deep-read-gate.ts` | R2.1 | HARD-REFUSE `llmReadCount===0 && !priorSignalsRef`; priors downgrade; `--focus` does NOT exempt; auto-expand decision (<70% coverage). |
235
+ | `scripts/awareness/llm-sample.ts` | R2.2 | 5-trace LLM mini-sample BEFORE primary-signal pick (measurement-layer fix; NO severity weights). Fresh-only; SKIP on priors. Deterministic trace selection. |
236
+ | `scripts/awareness/blind-spots.ts` | R2.2 | Tier-0-measurable vs blind-spot taxonomy → Methodology Step 1.5 table (Signal·Measurable?·Checked by·Result). |
237
+ | `scripts/library/{paths,types,store,match}.ts` | R2.3 / D2 | Class-memory library — INDEX.md + `by-entity/<e>/{journal.md,entity.json,patterns/}`. Approved-only write, 3× prior weight, library-first Tier-0 match, `runs[].operatorInvocation` (D2). **Per-host + gitignored** (`.mutagent/diagnostics/library/` — never committed). |
238
+ | `scripts/invocation/parse-brief.ts` | R2.6 / W11-06 | Defensive regex parser: NL brief → `{agent?,timeWindow?,focus?,residual,scopeType,entity?}`. Never throws/drops. W11-06: adds `scopeType:'skill'\|'agent'\|null` + `entity` + `focus:` colon form + article guard. |
239
+ | `scripts/run/diagnose.ts` | R2.6 / D2 | ⚠️ Zone-1.5 CLI: `/mutagent-diagnostics "<brief>"` single positional arg. Stores verbatim + parsed invocation. No-focus → neutral survey; focus → 🎯 Guided. |
240
+
241
+ Methodology tab (render.ts) gains: **Step 0** (verbatim operator invocation, D2) ·
242
+ **Step 1.5** (awareness layer + blind-spots, R2.2) · **3 widgets** (SVG tier pie,
243
+ selection-rule cards, mermaid signal-selection trace, R2.4). Per-finding sampling
244
+ **coverage proof** (R2.5) renders below the why-chain. Focus → 🎯 Guided tab REPLACES
245
+ Overview (R2.6).
246
+
247
+ > ⚠️ **Zone 1.5 surfaces (Wave-6):** R2.6 adds the single-arg slash-command CLI;
248
+ > D1 changes the caps config to `{active,value}`. See PR description for the diff.
249
+
250
+ ## §5 — Agents (assets/agents/ — Type B agent definitions)
251
+
252
+ | Agent | Class | Load |
253
+ |-------|-------|------|
254
+ | `diagnostics-analyzer.md` | pure_subagent_executor | Dispatched by parent session (Step 6 of orchestrator-protocol.md) |
255
+
256
+ Note: `diagnostics-orchestrator.md` (P2 pivot) and `diagnostics-apply-worker.md` (M9/DC-6)
257
+ have both been RETIRED. The orchestrator procedure is now an inline protocol loaded by the
258
+ parent session (`references/workflows/orchestrator-protocol.md`). Apply no longer runs a
259
+ bespoke worker: at the Step-11 gate the parent spawns **ai-engineer** (the WRITE actor;
260
+ Helix-provided from builder, vendored for standalone) which shells the SHARED
261
+ `mutagent-cli apply` transport (`@mutagent/tools` — worktree-PR · REST · vendor-CLI;
262
+ non-destructive + audited). The analyzer remains a diagnostics-owned leaf sub-agent.
263
+
264
+ ## §6 — References (load on demand)
265
+
266
+ **Start here (first reading):** [`references/overview.md`](references/overview.md) — what the skill does, when to use it, quick-start, and glossary. Link to anatomy doc.
267
+
268
+ ```
269
+ references/
270
+ overview.md # START HERE — What/when/quick-start/glossary (PRD-SO-01)
271
+ reference.md # Entry point + architecture + dependency graph
272
+ operation-inventory.md # Type A/B/C classification
273
+ adapter-strategy.md # Adapter Q1-Q6 locked answers
274
+ filter-search-matrix.md # Per-platform Filter/Search coverage matrix
275
+ harness-knowledge.md # Platform Knowledge Table (expandable)
276
+ config.md # Schema with doc strings
277
+ workflows/
278
+ onboarding.md # 8-phase onboarding
279
+ orchestrator-protocol.md # Inline orchestrator protocol (parent session); Step 8.5 builds the render input
280
+ diagnostics.md # Full diagnostic procedure + NL→filter translation
281
+ apply-dispatch.md # Apply mechanic (local-agent/local-code-construct/remote)
282
+ apply-pr-comment-format.md # PR-023/PR-030 Diagnostic Apply PR Comment format
283
+ rca.md # RCA layer procedure + 3-dim taxonomy
284
+ rendering-anatomy.md # Canonical per-finding + per-remedy panel anatomy (PRD-CC-12)
285
+ schedule-prep.md # How to wire scheduling post-v0.1
286
+ source-platforms/ # CLI fetch + filter examples per platform
287
+ langfuse.md # -> CLI-first explainer + empirical filter-coverage matrix (no native agent-ID; name/tags proxy) + CLI-vs-REST fallback
288
+ target-platforms/ # Apply recipe + hyperlinks per target type
289
+ internal/
290
+ self-diagnostics.md # [INTERNAL] PR-022 playbook
291
+
292
+ internal/ # [INTERNAL] — stripped on publish (.npmignore)
293
+ templates/review/ # Internal dev review templates (Kanban / Audit / skill-overview / brand-shell)
294
+ ```
295
+
296
+ **Trace intake (post-flip):** the skill no longer owns any fetch/normalize code.
297
+ Traces are fetched + normalized **upstream** by `mutagent-cli trace fetch`
298
+ (`@mutagent/tools`), which writes a UniTF JSONL + `manifest.json`; those ride
299
+ into the skill via `HandoverBundle.inputs[]` and are read at Step 3.7 by
300
+ `scripts/normalize/read-unitf.ts`. **Standalone runs (no handover) acquire via
301
+ delegate-or-artifact (protocol Step 3.6, V3-9): consume a pre-staged
302
+ `.mutagent/traces/<id>/` artifact if present, else SPAWN the vendored
303
+ `discovery` sub-agent — the stage itself NEVER runs `trace fetch`/`export`
304
+ inline.** Run `mutagent-cli trace --help` to discover
305
+ the fetch/count/export surface. The `source-platforms/*` docs are now
306
+ platform reference material (filter coverage, quirks) for *shaping the upstream
307
+ CLI query* — the skill itself sees only the resulting UniTF. See
308
+ [`references/source-platforms/langfuse.md`](references/source-platforms/langfuse.md)
309
+ for the empirical **filter-coverage matrix** (Langfuse has **no native
310
+ agent-ID** — `trace.name` + `tags` are the agent proxy).
311
+
312
+ ## §7 — Config
313
+
314
+ Config lives at: `<host>/.mutagent/config.yaml`
315
+ Secrets at: `<host>/.mutagentrc` (gitignored, never committed)
316
+
317
+ Load config: `Bash("scripts/cli/run.sh scripts/config/load.ts")`
318
+
319
+ Full schema: `references/config.md` and `scripts/config/schema.ts`
320
+
321
+ Key fields: `source.platform`, `target.platform`, `ask_tool.runtime`, `schedule.mode`, `trigger_rules[]`, `self_diagnostics.enabled`
322
+
323
+ **W11-07 — Scope + agent-ID identity**: `parse-brief.scopeType` ("skill"|"agent"|null) determines whether the operator named a scope directly (use it) or not (AskUserQuestion picker). `config.agents[]` is an optional cross-platform identity map that resolves a code-level agent name to its Langfuse/OTel identifiers — see `references/workflows/scope-model.md`.
324
+
325
+ ## §8 — Design Principles (55 — operative subset)
326
+
327
+ Design principles + the decision log that grounds them are maintained internally
328
+ (Design/Build artifacts, not shipped). The principles that shape runtime behavior
329
+ are operative through the workflows and gates referenced above. Key ones for execution:
330
+ - **PR-001**: Tier 0 before LLM — run `scripts/tier0-scan.ts` before any LLM call
331
+ - **PR-004**: Branch hygiene — BG worktree + PR; never touch operator's checked-out branch
332
+ - **PR-007**: SKILL.md ≤ 500 lines — load references on demand
333
+ - **PR-014**: HITL via HTML copy-back primary; AskUserQuestion only for final apply gate
334
+ - **PR-019**: Scripts vs agent ops — see operation-inventory.md for classification
335
+ - **PR-022**: Self-Diagnostics [INTERNAL] — gated by `self_diagnostics.enabled: false`
336
+ - **PR-023**: Clipboard payloads = self-contained actionable plans (v0.3+) — every remedy embeds ActionablePlan; apply PR follows Diagnostic Apply PR Comment format (see `references/workflows/apply-pr-comment-format.md`)
337
+ - **PR-024**: Orchestration runs in the parent session, never a coordinator sub-agent
338
+ - **PR-025**: Self-diagnosis == client diagnosis — one engine, only the subject differs
339
+ - **PR-029**: The report IS the product surface — template-stamp over procedural rendering (the gold-standard `report.html.tpl` + `render.ts` panel functions)
340
+ - **PR-033**: Each finding tagged `audience: PRODUCT|META|CORE`; `--audience client` NODE-STRIPs internal nodes
341
+ - **PR-035**: Fresh runs MUST LLM-deep-read; caps bound the read, never skip it (`scripts/sample/deep-read-gate.ts` HARD-REFUSES `llmReadCount===0 && !priorSignalsRef`)
342
+ - **PR-049**: Primary signal MUST be selected by the reconciled 5-step process (failure-validity gate → impact×prevalence → deep-read corroboration); drives ONE `runMeta.primarySignal` for census·heatmap·funnel (never a frequency artifact)
343
+
344
+ ## §9 — Failure Taxonomy (3 dimensions — v1 locked)
345
+
346
+ `(WHAT, WHY, WHERE)` — see `references/workflows/rca.md` for full taxonomy and finding shape.
347
+
348
+ WHAT: `wrong-output`, `missing-output`, `loop`, `latency-spike`, `cost-overshoot`, `format-violation`, `hallucination`, `user-complaint`, `low-score`, `missing-context`
349
+
350
+ WHY: `prompt-underspec`, `prompt-overspec`, `tool-misuse`, `tool-missing`, `context-overflow`, `provider-limit`, `data-staleness`, `handoff-loss`, `dependency-failure`
351
+
352
+ WHERE: `system-prompt`, `tool-definition`, `agent-config`, `routing-config`, `upstream-data`, `provider-side`, `harness-side`, `user-input`