@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.
- package/.claude/skills/mutagent-helix/SKILL.md +113 -0
- package/.claude/skills/mutagent-helix/scripts/cli/codex-transcode.ts +143 -0
- package/.claude/skills/mutagent-helix/scripts/cli/doctor.ts +111 -0
- package/.claude/skills/mutagent-helix/scripts/cli/init.ts +382 -0
- package/.claude/skills/mutagent-helix/scripts/cli/run.sh +61 -0
- package/CLAUDE.md +193 -0
- package/LICENSE +201 -0
- package/NOTICE +22 -0
- package/README.md +209 -0
- package/assets/adl-loop.svg +162 -0
- package/assets/system-status.svg +422 -0
- package/bin/mutagent-cli.mjs +9950 -0
- package/bin/mutagent-helix.mjs +78 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/CLAUDE.md +28 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/SKILL.md +138 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/assets/templates/agentspec.yaml.tpl +247 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/references/frameworks/doc-pins.md +53 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/references/principles.md +91 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/references/requirements.yaml +295 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/references/workflows/orchestrator-protocol.md +302 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/cli/doctor.ts +116 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/cli/init.ts +230 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/cli/run.sh +60 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/config/resolve-spec-dir.ts +199 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/contract/agentspec.schema.ts +455 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/setup/detect.ts +67 -0
- package/mutagent-agentspec/.claude/skills/mutagent-agentspec/scripts/validate/validate-spec.ts +93 -0
- package/mutagent-agentspec/LICENSE +201 -0
- package/mutagent-agentspec/NOTICE +19 -0
- package/mutagent-agentspec/README.md +44 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/SKILL.md +100 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/assets/agents/ai-architect.md +312 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/assets/agents/ai-engineer.md +357 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/assets/templates/build-report.md.tpl +39 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/references/principles.md +31 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/references/workflows/build-protocol.md +61 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/references/workflows/improve-handoff.md +23 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/scripts/cli/run.sh +60 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/scripts/handoff/validate-build-input.ts +72 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/scripts/sync-spec/check-sync-spec.ts +499 -0
- package/mutagent-builder/.claude/skills/mutagent-builder/scripts/verify/spec-impl-coverage.ts +182 -0
- package/mutagent-builder/CLAUDE.md +25 -0
- package/mutagent-builder/README.md +26 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/README.md +192 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/SKILL.md +352 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/agents/ai-architect.md +256 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/agents/ai-engineer.md +344 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/agents/diagnostics-analyzer.md +576 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/agents/discovery.md +425 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/audit.json.tpl +24 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/audit.md.tpl +49 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/config.yaml.tpl +100 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/pr-body.md.tpl +56 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/report.html.tpl +327 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/README.md +27 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/iter-N-handover.md.tpl +125 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/self-diagnosis-contract.v0.1.0.yaml.tpl +234 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/spec.yaml.tpl +152 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/team.yaml.tpl +127 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/templates/shared/wave-N-dashboard.html.tpl +1712 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.1-nl-query.md +59 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.2-tier0-progress.md +58 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.3-analysis-progress.md +44 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.4-html-report.md +61 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.5-rca-detail.md +69 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/diagnostics/WF-2.6-stale-warning.md +53 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.1-welcome.md +60 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.2-source-platform-picker.md +41 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.3-source-auth.md +75 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.4-target-picker.md +48 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.5-ask-tool.md +43 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.6-config-review.md +57 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.7-filter-defaults.md +52 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/assets/wireframes/onboarding/WF-1.8-first-run.md +59 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/examples/sample-findings.json +92 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/examples/sample-meta.json +47 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/adapter-strategy.md +75 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/config-migration.md +84 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/config.md +159 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/filter-search-matrix.md +66 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/harness-knowledge.md +22 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/memory-format.md +78 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/onboarding-decisions.yaml +187 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/operation-inventory.md +59 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/overview.md +167 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/reference.md +119 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/script-index.md +101 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-adapter-contract.md +93 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/claude-code-transcripts.md +66 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/codex-transcripts.md +78 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/codex.md +145 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/install-paths.md +57 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/langfuse.md +178 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/local-jsonl.md +55 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/openobserve.md +102 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/source-platforms/otel.md +63 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/cloud-rest.md +84 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-claude.md +65 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-cloud-agent-sdk.md +92 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-codex.md +72 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-cursor.md +108 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-mastra.md +77 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/target-platforms/local-opencode.md +70 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/apply-pr-comment-format.md +82 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/diagnostics.md +35 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/handover-contract.md +247 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/onboarding.md +300 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/orchestrator-protocol.md +1861 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/rca.md +331 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/rendering-anatomy.md +314 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/schedule-prep.md +100 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/scope-model.md +128 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/references/workflows/verification-methodology.md +174 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/aggregate/sort-findings.ts +0 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/awareness/blind-spots.ts +167 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/awareness/llm-sample.ts +681 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/cli/doctor.ts +215 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/cli/init.ts +1013 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/cli/install-agents.ts +350 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/cli/run.sh +61 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/cli/shared-templates.ts +79 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/config/load.ts +392 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/config/resolve-credential.ts +120 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/config/schema.ts +641 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/config/validate.ts +134 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/context/build-diagnosis-context.ts +417 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/context/load-context.ts +105 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/contract/types.ts +166 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/enrich/build-render-input.ts +1964 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/enrich/corpus-severity.ts +172 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/enrich/dismissal-match.ts +270 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/enrich/rank-remedies.ts +75 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/hooks/install-hooks.sh +46 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/hooks/pre-push.sh +78 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/invocation/parse-brief.ts +188 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/library/match.ts +114 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/library/paths.ts +95 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/library/store.ts +535 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/library/types.ts +181 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/lint/template-inline-js.ts +267 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/memory/append.ts +188 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/memory/read.ts +218 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/normalize/platforms/entity-context.ts +686 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/normalize/read-unitf.ts +267 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/normalize/trace.ts +1078 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/normalize/unitf-adapter.ts +0 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/normalize/unitf-types.ts +213 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/report/persist-selections.ts +174 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/report/render.ts +3254 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/run/diagnose.ts +64 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/run/session.ts +167 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/sample/caps.ts +345 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/sample/deep-read-gate.ts +424 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/sample/representative.ts +584 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/scan/objection.ts +224 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/scan/trajectory.ts +489 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/self-diagnostics/dispatch.ts +135 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/self-diagnostics/probe.ts +170 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/setup/detect.ts +307 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/setup/ensure-cli.ts +315 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/setup/reconfigure.ts +77 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/setup/verify-agents.ts +207 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/slicer.ts +166 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/adapters/claude-code.ts +17 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/adapters/codex.ts +11 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/adapters/langfuse.ts +17 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/adapters/local-jsonl.ts +12 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/adapters/otel.ts +12 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/index.ts +54 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/registry.ts +45 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/source/types.ts +86 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/stale-detector.ts +74 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/test/render-playwright.cli.ts +477 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/tier0/claude-code.ts +133 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/tier0/langfuse.ts +143 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/tier0-scan.ts +423 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/completeness-check.ts +436 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/doc-refs.ts +190 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/finalize-gate.ts +417 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/findings-contract.ts +628 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/render-js-syntax.ts +188 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/report-checklist.yaml +217 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/trace-shape.ts +262 -0
- package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/validate/wave6-checklist.ts +326 -0
- package/mutagent-diagnostics/CLAUDE.md +41 -0
- package/mutagent-diagnostics/LICENSE +201 -0
- package/mutagent-diagnostics/NOTICE +18 -0
- package/mutagent-diagnostics/README.md +343 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/SKILL.md +548 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/agents/audit-executor.md +169 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/agents/dataset-builder.md +160 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/agents/discovery.md +425 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/agents/evaluator.md +1108 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/brand/theme.css +213 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/assets/brand/wordmark.html +9 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/lenses/context-flow-lens.md +85 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/lenses/data-lens.md +47 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/lenses/decision-lens.md +48 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/lenses/methodology-critic-lens.md +53 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/lenses/trajectory-lens.md +44 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/build-review-interface.md +83 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/edd-loop.md +134 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/error-analysis.md +113 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/eval-audit.md +154 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/eval-stage.md +168 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/generate-synthetic-data.md +81 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/grounded-adjudication.md +221 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/memory-format.md +65 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/methodology.md +201 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/operation-inventory.md +197 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/validate-evaluator.md +125 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/workflows/orchestrator-protocol.md +300 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/references/write-judge-prompt.md +123 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/behavior-tree.schema.yaml +73 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/dataset.schema.yaml +66 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/edd-change-request.schema.yaml +114 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/eval-matrix.schema.yaml +74 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/flow-graph.schema.yaml +69 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/flow-profile.schema.yaml +49 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/methodology-review.schema.yaml +40 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/schemas/scorecard.schema.yaml +85 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/agent-dispatch.ts +0 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/aggregate-discover.ts +543 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/artifact-paths.ts +115 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/assemble-scorecard.ts +172 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/build-dataset.ts +186 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/build-evals.ts +93 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/build-review-ui.ts +393 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/check-method-router.ts +170 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/aggregate.ts +112 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/audit-run.ts +182 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/doctor.ts +211 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/dogfood.ts +133 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/init.ts +601 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/methodology-review.ts +122 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/prep.ts +295 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/profile-subject.ts +165 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/run.sh +56 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cli/variance-check.ts +105 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/code-eval.ts +248 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/code-quality-verdict.ts +285 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/codegen-evals.ts +173 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cold-start-project.ts +151 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/cold-start-sampler.ts +267 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/config/load.ts +343 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/config/schema.ts +380 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/agentspec-evals.ts +85 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/dataset.ts +149 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/eval-engine.ts +118 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/eval-matrix.ts +577 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/eval-types.ts +1074 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/flow-graph.ts +194 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/types.ts +303 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/contracts/validation.ts +193 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/derive-dataset.ts +152 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/determine-outcome.ts +219 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/diff-discriminate.ts +160 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/discover-criteria.ts +348 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/edd/change-request.ts +232 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/edd/edd-types.ts +210 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/edd/variance-gate.ts +186 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/emit-completeness.ts +111 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/eval-engine.ts +160 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/evaluate.ts +333 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/flow-graph.ts +230 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/judge-prompt-template.ts +253 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/judge-provider.ts +135 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/lint-grounding.ts +229 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/lint-uniformity.ts +168 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/living-suite.ts +109 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/load-bundle.ts +203 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/load-profile-vocab.ts +64 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/load-profile.ts +106 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/mask.ts +138 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/materialize-dataset.ts +113 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/matrix-judge.ts +750 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/memory/append.ts +215 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/memory/read.ts +168 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/persist-eval-criteria.ts +232 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/prep-tasks.ts +125 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/profile-subject.ts +310 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/publish-report.ts +131 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/read-unitf-traces.ts +81 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/render-build-cards.ts +195 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/render-discover-report.ts +1640 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/render-eval-report.ts +3838 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/render-report.ts +212 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/resolve-credential.ts +110 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/resolve-ref.ts +98 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/result-verify.ts +129 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/route-failures.ts +330 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/run-deterministic.ts +367 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/run-evaluate.ts +719 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/run-judge.ts +155 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/run-pipeline.ts +175 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/sample-traces.ts +210 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/self-audit.ts +387 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/source-map.ts +106 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/subject-profile.ts +134 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/substrate.ts +162 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/sync-eval-criteria.ts +244 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/ui-slots.ts +119 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/unitf-to-evaltrace.ts +284 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/validate-judge.ts +358 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/scripts/variance-compare.ts +177 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/subjects/mutagent-diagnostics/behavior-tree.yaml +140 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/subjects/mutagent-diagnostics/eval-matrix.yaml +1270 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/subjects/mutagent-diagnostics/methodology-review.yaml +105 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/workflows/audit.workflow.js +82 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/workflows/data-leak.workflow.js +236 -0
- package/mutagent-evaluator/.claude/skills/mutagent-evaluator/workflows/variance.workflow.js +163 -0
- package/mutagent-evaluator/CLAUDE.md +45 -0
- package/mutagent-evaluator/LICENSE +201 -0
- package/mutagent-evaluator/NOTICE +23 -0
- package/mutagent-evaluator/README.md +88 -0
- package/mutagent-optimize/.claude/skills/mutagent-optimize/SKILL.md +287 -0
- package/mutagent-optimize/.claude/skills/mutagent-optimize/scripts/contracts/amend-request.ts +503 -0
- package/mutagent-optimize/.claude/skills/mutagent-optimize/scripts/improve-loop-run.ts +304 -0
- package/mutagent-optimize/.claude/skills/mutagent-optimize/scripts/loop-state-cli.ts +300 -0
- package/mutagent-optimize/.claude/skills/mutagent-optimize/scripts/loop-state.ts +440 -0
- package/mutagent-optimize/CLAUDE.md +49 -0
- package/mutagent-optimize/README.md +26 -0
- package/mutagent-orchestrator/CLAUDE.md +102 -0
- package/mutagent-orchestrator/README.md +20 -0
- package/mutagent-orchestrator/assets/agents/discovery.md +425 -0
- package/mutagent-orchestrator/assets/agents/dogfood-monitor.md +266 -0
- package/mutagent-orchestrator/assets/agents/monitor.md +258 -0
- package/mutagent-orchestrator/orchestrator.md +782 -0
- package/mutagent-orchestrator/references/MONITORING.md +209 -0
- package/mutagent-orchestrator/references/config-fields.md +132 -0
- package/mutagent-orchestrator/references/config-migration.md +132 -0
- package/mutagent-orchestrator/references/index-registry.md +92 -0
- package/mutagent-orchestrator/routing.yaml +391 -0
- package/mutagent-orchestrator/scripts/config-schema.ts +1010 -0
- package/mutagent-orchestrator/scripts/dispatch.ts +439 -0
- package/mutagent-orchestrator/scripts/dogfood/extract-feedback.ts +203 -0
- package/mutagent-orchestrator/scripts/dogfood/reconstruct-trajectory.ts +327 -0
- package/mutagent-orchestrator/scripts/dogfood/render-dogfood-report.ts +347 -0
- package/mutagent-orchestrator/scripts/dogfood/resolve-subagents.ts +160 -0
- package/mutagent-orchestrator/scripts/dogfood/run-report.ts +264 -0
- package/mutagent-orchestrator/scripts/dogfood/slack-thread.ts +106 -0
- package/mutagent-orchestrator/scripts/dogfood/types.ts +257 -0
- package/mutagent-orchestrator/scripts/eval-routing.ts +753 -0
- package/mutagent-orchestrator/scripts/gate.ts +219 -0
- package/mutagent-orchestrator/scripts/handover-contract.ts +362 -0
- package/mutagent-orchestrator/scripts/index/build-index.ts +351 -0
- package/mutagent-orchestrator/scripts/index/render-index.ts +110 -0
- package/mutagent-orchestrator/scripts/monitor/slack-notify.ts +111 -0
- package/mutagent-orchestrator/scripts/monitor/triggers.ts +162 -0
- package/mutagent-orchestrator/scripts/onboarding-check.ts +369 -0
- package/mutagent-orchestrator/scripts/render-roster.ts +308 -0
- package/mutagent-orchestrator/scripts/resolve-credential.ts +185 -0
- package/mutagent-orchestrator/scripts/resolve-paths.ts +114 -0
- package/mutagent-orchestrator/scripts/slack/format.ts +63 -0
- package/mutagent-orchestrator/scripts/slack/post.ts +115 -0
- package/mutagent-orchestrator/scripts/sync-index.ts +311 -0
- package/package.json +64 -0
package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/enrich/corpus-severity.ts
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/enrich/corpus-severity.ts
|
|
3
|
+
* ② Corpus-relative severity calibration — the G-2 over-alarming fix (SL-8 / DS-02).
|
|
4
|
+
* Type A — Pure Script (deterministic numeric scoring, no LLM calls, no I/O).
|
|
5
|
+
*
|
|
6
|
+
* PROBLEM (SL-8, run SL-8-diag-dual-…14-34-32): on the all-clean control dataset DS-02,
|
|
7
|
+
* `*diagnose` raised 2 CRIT + 3 HIGH on 50 certified-clean traces because a numeric
|
|
8
|
+
* anomaly's SEVERITY was assigned by ABSOLUTE thresholds, not corpus-relative norms — a
|
|
9
|
+
* latency that IS the corpus baseline got escalated to CRIT.
|
|
10
|
+
*
|
|
11
|
+
* FIX — reuse the proven FI-LAT rubric recipe (do NOT invent a model): a numeric anomaly's
|
|
12
|
+
* SEVERITY is scored against the corpus's OWN distribution. Concretely:
|
|
13
|
+
* • compare each span ONLY against spans of the SAME name;
|
|
14
|
+
* • band(name) = BAND_MULTIPLIER (3) × that name's p90, with an absolute FLOOR;
|
|
15
|
+
* • a value is a SPIKE (→ high/crit severity) ONLY if it exceeds BOTH its name-band AND
|
|
16
|
+
* the floor. Below either bound it is corpus-normal → med/info, never crit/high.
|
|
17
|
+
*
|
|
18
|
+
* The floor guards a FAST corpus: a 50ms value that is 5× a 10ms p90 is a relative outlier
|
|
19
|
+
* but not a real latency problem, so the absolute floor keeps it out of crit/high.
|
|
20
|
+
*
|
|
21
|
+
* PROPOSED principle (operator-locked constitution): see
|
|
22
|
+
* .meta/prd.yaml key_problems → KP-023 (proposed PR-056).
|
|
23
|
+
* `.meta/design-principles.md` is operator-LOCKED and is NOT edited here.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/** Severity grades a numeric anomaly can resolve to (subset of Finding.severity). */
|
|
27
|
+
export type NumericSeverity = "crit" | "high" | "med" | "info";
|
|
28
|
+
|
|
29
|
+
/** band(name) = BAND_MULTIPLIER × p90(name). FI-LAT rubric = 3×. */
|
|
30
|
+
export const BAND_MULTIPLIER = 3;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Absolute latency floor (ms). Nothing below this is ever a spike, regardless of how far
|
|
34
|
+
* it sits above its name-band. Mirrors tier0-scan.ts HIGH_LATENCY_MS (10_000) for parity.
|
|
35
|
+
*/
|
|
36
|
+
export const DEFAULT_LATENCY_FLOOR_MS = 10_000;
|
|
37
|
+
|
|
38
|
+
/** A (name, value) sample — the numeric metric grouped by its span/agent name. */
|
|
39
|
+
export interface NameValue {
|
|
40
|
+
/** Span / agent / operation name the value is compared WITHIN. */
|
|
41
|
+
name: string;
|
|
42
|
+
/** The numeric metric (e.g. latency in ms). */
|
|
43
|
+
value: number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** The corpus's own distribution, computed once per run and reused per finding. */
|
|
47
|
+
export interface CorpusBaseline {
|
|
48
|
+
/** p90 of the metric per span name. */
|
|
49
|
+
p90ByName: Map<string, number>;
|
|
50
|
+
/** p90 across ALL values — fallback when a finding's name is unseen in the corpus. */
|
|
51
|
+
overallP90: number;
|
|
52
|
+
/** Absolute floor below which nothing is a spike. */
|
|
53
|
+
floor: number;
|
|
54
|
+
/** Multiplier applied to a name's p90 to get its spike band. */
|
|
55
|
+
bandMultiplier: number;
|
|
56
|
+
/** How many samples fed the baseline (0 = no corpus data → callers should skip). */
|
|
57
|
+
sampleCount: number;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** The verdict for a single value scored against the corpus. */
|
|
61
|
+
export interface SpikeVerdict {
|
|
62
|
+
/** True iff value > name-band AND value > floor. */
|
|
63
|
+
isSpike: boolean;
|
|
64
|
+
/** Corpus-relative severity grade. */
|
|
65
|
+
severity: NumericSeverity;
|
|
66
|
+
/** The evaluated value. */
|
|
67
|
+
value: number;
|
|
68
|
+
/** bandMultiplier × p90(name) — the relative spike threshold. */
|
|
69
|
+
nameBand: number;
|
|
70
|
+
/** The absolute floor applied. */
|
|
71
|
+
floor: number;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Nearest-rank percentile over a numeric array (deterministic). Identical semantics to
|
|
76
|
+
* build-render-input.ts `percentile` — kept local so this module stays dependency-light
|
|
77
|
+
* (build-render-input imports THIS file, so importing back would create a cycle).
|
|
78
|
+
*/
|
|
79
|
+
export function percentile(values: number[], p: number): number {
|
|
80
|
+
if (values.length === 0) return 0;
|
|
81
|
+
const sorted = values.slice().sort((a, b) => a - b);
|
|
82
|
+
const rank = Math.max(0, Math.ceil((p / 100) * sorted.length) - 1);
|
|
83
|
+
return sorted[rank];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Rank a severity for MAX-severity aggregation across a finding's source spans. */
|
|
87
|
+
const SEVERITY_RANK: Record<NumericSeverity, number> = { info: 0, med: 1, high: 2, crit: 3 };
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Compute the corpus baseline (per-name p90 + overall p90) from a batch of (name, value)
|
|
91
|
+
* samples. Deterministic. sampleCount === 0 signals "no corpus data" so callers can skip
|
|
92
|
+
* calibration rather than fabricate a baseline from nothing.
|
|
93
|
+
*/
|
|
94
|
+
export function computeCorpusBaseline(
|
|
95
|
+
samples: NameValue[],
|
|
96
|
+
opts?: { floor?: number; bandMultiplier?: number }
|
|
97
|
+
): CorpusBaseline {
|
|
98
|
+
const floor = opts?.floor ?? DEFAULT_LATENCY_FLOOR_MS;
|
|
99
|
+
const bandMultiplier = opts?.bandMultiplier ?? BAND_MULTIPLIER;
|
|
100
|
+
|
|
101
|
+
const byName = new Map<string, number[]>();
|
|
102
|
+
const all: number[] = [];
|
|
103
|
+
for (const s of samples) {
|
|
104
|
+
if (!Number.isFinite(s.value)) continue;
|
|
105
|
+
all.push(s.value);
|
|
106
|
+
const arr = byName.get(s.name);
|
|
107
|
+
if (arr) arr.push(s.value);
|
|
108
|
+
else byName.set(s.name, [s.value]);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const p90ByName = new Map<string, number>();
|
|
112
|
+
for (const [name, vals] of byName) p90ByName.set(name, percentile(vals, 90));
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
p90ByName,
|
|
116
|
+
overallP90: percentile(all, 90),
|
|
117
|
+
floor,
|
|
118
|
+
bandMultiplier,
|
|
119
|
+
sampleCount: all.length,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Score ONE (name, value) against the corpus. A value is a spike ONLY if it clears BOTH
|
|
125
|
+
* its name-band (3× the name's p90) AND the absolute floor. Spikes grade high, or crit
|
|
126
|
+
* when extreme (≥ 2× the name-band); non-spikes are med (absolutely slow but corpus-normal)
|
|
127
|
+
* or info (below the floor). A baseline-normal value therefore never grades crit/high.
|
|
128
|
+
*/
|
|
129
|
+
export function corpusRelativeSeverity(
|
|
130
|
+
name: string,
|
|
131
|
+
value: number,
|
|
132
|
+
baseline: CorpusBaseline
|
|
133
|
+
): SpikeVerdict {
|
|
134
|
+
const p90 = baseline.p90ByName.get(name) ?? baseline.overallP90;
|
|
135
|
+
const nameBand = baseline.bandMultiplier * p90;
|
|
136
|
+
const floor = baseline.floor;
|
|
137
|
+
const isSpike = value > nameBand && value > floor;
|
|
138
|
+
|
|
139
|
+
let severity: NumericSeverity;
|
|
140
|
+
if (isSpike) {
|
|
141
|
+
severity = value >= 2 * nameBand ? "crit" : "high";
|
|
142
|
+
} else if (value > floor) {
|
|
143
|
+
// above the absolute floor but within its cohort's norms → notable, not alarming.
|
|
144
|
+
severity = "med";
|
|
145
|
+
} else {
|
|
146
|
+
severity = "info";
|
|
147
|
+
}
|
|
148
|
+
return { isSpike, severity, value, nameBand, floor };
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Calibrate a finding's numeric-anomaly severity from its source spans. Evaluates EACH
|
|
153
|
+
* (name, value) against the corpus and returns the MAX-severity verdict (a single genuine
|
|
154
|
+
* spike dominates; if none of the finding's spans spike, the finding is corpus-normal).
|
|
155
|
+
* Returns null when there are no scorable spans, so the caller leaves severity untouched.
|
|
156
|
+
*/
|
|
157
|
+
export function calibrateFromSpans(
|
|
158
|
+
spans: NameValue[],
|
|
159
|
+
baseline: CorpusBaseline
|
|
160
|
+
): SpikeVerdict | null {
|
|
161
|
+
const scorable = spans.filter((s) => Number.isFinite(s.value));
|
|
162
|
+
if (scorable.length === 0 || baseline.sampleCount === 0) return null;
|
|
163
|
+
|
|
164
|
+
let worst: SpikeVerdict | null = null;
|
|
165
|
+
for (const s of scorable) {
|
|
166
|
+
const v = corpusRelativeSeverity(s.name, s.value, baseline);
|
|
167
|
+
if (worst === null || SEVERITY_RANK[v.severity] > SEVERITY_RANK[worst.severity]) {
|
|
168
|
+
worst = v;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return worst;
|
|
172
|
+
}
|
package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/enrich/dismissal-match.ts
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/enrich/dismissal-match.ts
|
|
3
|
+
* DISMISSAL FINAL-CHECK — semantic suppression of previously-dismissed findings.
|
|
4
|
+
* Type A — Pure Script (deterministic; the reasoning VERDICT is INJECTED, not computed here).
|
|
5
|
+
*
|
|
6
|
+
* THE MATCH (operator decision): a new finding is the SAME failure mode as a dismissed
|
|
7
|
+
* one when BOTH hold:
|
|
8
|
+
* 1. entitySlug EXACT match (same diagnosed entity), AND
|
|
9
|
+
* 2. SEMANTIC OVERLAP of the (what, why, where) failure-mode triple.
|
|
10
|
+
*
|
|
11
|
+
* The (what, why, where) prose is LLM-generated and will NEVER string-match run-to-run,
|
|
12
|
+
* so it is NOT exact-matched. Instead a PINNED host-runtime reasoning check (temperature 0,
|
|
13
|
+
* C-PIN) compares the triples and returns { overlap, confidence }. That reasoning runs
|
|
14
|
+
* OUTSIDE this module (the orchestrator dispatches it at the enrich final-check step — see
|
|
15
|
+
* references/workflows/orchestrator-protocol.md), keeping build-render-input's "no LLM, no
|
|
16
|
+
* network, no random" contract intact. This module owns the DETERMINISTIC half:
|
|
17
|
+
* - buildSemanticMatchRequest() — the pinned, reproducible request the orchestrator sends;
|
|
18
|
+
* - decideSuppress() — the ONE deterministic decision fed by the reasoning verdict;
|
|
19
|
+
* - partitionByDismissal() — splits findings into active / suppressed, applying the
|
|
20
|
+
* severity-escalation HARD GUARD *before* the semantic match.
|
|
21
|
+
*
|
|
22
|
+
* CONSERVATIVE / FAIL-SAFE: suppress ONLY on high-confidence overlap. When the reasoning
|
|
23
|
+
* check is unsure (missing verdict, low/medium confidence, or overlap:false) the finding is
|
|
24
|
+
* NOT suppressed — it shows. A dismissed finding is hidden only when we are confident it is
|
|
25
|
+
* the same not-an-issue; otherwise the operator sees it.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import type { Finding } from "../normalize/trace.ts";
|
|
29
|
+
import type { VerdictLedgerEntry, VerdictSeverity } from "../library/types.ts";
|
|
30
|
+
|
|
31
|
+
// ── Pinned reasoning envelope (RC-LLM-PIN parity) ────────────────────────────
|
|
32
|
+
//
|
|
33
|
+
// Mirrors the analyzer/orchestrator inference pin (orchestrator-protocol.md §W13-C):
|
|
34
|
+
// model claude-sonnet-4-6 default, temperature 0 unconditional. The C-PIN string binds
|
|
35
|
+
// {promptVersion, model, temperature} so the request is byte-identical run-to-run →
|
|
36
|
+
// reproducible verdicts. Honors feedback_model_intent_sacred — declared intent, no swap.
|
|
37
|
+
|
|
38
|
+
/** Default pinned model for the semantic-match reasoning check. */
|
|
39
|
+
export const SEMANTIC_MATCH_MODEL = "claude-sonnet-4-6";
|
|
40
|
+
/** Temperature is PINNED to 0 (deterministic sampling) — never overridden. */
|
|
41
|
+
export const SEMANTIC_MATCH_TEMPERATURE = 0;
|
|
42
|
+
/** Prompt version — bump to invalidate cached verdicts when the prompt changes. */
|
|
43
|
+
export const SEMANTIC_MATCH_PROMPT_VERSION = "v1";
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* C-PIN — the reproducibility tag binding the pinned inference envelope. A stable,
|
|
47
|
+
* human-readable string so two runs with the same inputs produce byte-identical requests.
|
|
48
|
+
*/
|
|
49
|
+
export function semanticMatchCPin(model: string = SEMANTIC_MATCH_MODEL): string {
|
|
50
|
+
return `dismissal-semantic-match@${SEMANTIC_MATCH_PROMPT_VERSION}|${model}|t${SEMANTIC_MATCH_TEMPERATURE}`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** A single failure-mode triple (what / why / where) + optional narration. */
|
|
54
|
+
export interface FailureTriple {
|
|
55
|
+
what: string;
|
|
56
|
+
why: string;
|
|
57
|
+
where: string;
|
|
58
|
+
whatHappened?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** The pinned, reproducible request the orchestrator sends to the host-runtime reasoning check. */
|
|
62
|
+
export interface SemanticMatchRequest {
|
|
63
|
+
/** Pinned model (RC-LLM-PIN). */
|
|
64
|
+
model: string;
|
|
65
|
+
/** PINNED to 0. */
|
|
66
|
+
temperature: number;
|
|
67
|
+
/** Reproducibility tag (binds prompt-version + model + temperature). */
|
|
68
|
+
cPin: string;
|
|
69
|
+
/** The new finding's failure-mode triple. */
|
|
70
|
+
candidate: FailureTriple;
|
|
71
|
+
/** The dismissed ledger entry's failure-mode triple. */
|
|
72
|
+
dismissed: FailureTriple;
|
|
73
|
+
/** The entity slug both must share (EXACT-match half of the check). */
|
|
74
|
+
entitySlug: string;
|
|
75
|
+
/** The critique-before-verdict instruction (deterministic given the triples). */
|
|
76
|
+
prompt: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** The verdict the reasoning check returns — overlap yes/no + confidence. */
|
|
80
|
+
export interface SemanticMatchVerdict {
|
|
81
|
+
/** True when the reasoning check judges the two failure modes the SAME. */
|
|
82
|
+
overlap: boolean;
|
|
83
|
+
/** How confident that judgment is. Only "high" + overlap suppresses. */
|
|
84
|
+
confidence: "high" | "medium" | "low";
|
|
85
|
+
/** Optional critique/rationale (audit — not used by the deterministic decision). */
|
|
86
|
+
rationale?: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Build the deterministic critique-before-verdict prompt for one triple pair. */
|
|
90
|
+
function buildPrompt(candidate: FailureTriple, dismissed: FailureTriple, entitySlug: string): string {
|
|
91
|
+
const fmt = (t: FailureTriple): string =>
|
|
92
|
+
` what: ${t.what}\n why: ${t.why}\n where: ${t.where}` +
|
|
93
|
+
(t.whatHappened ? `\n whatHappened: ${t.whatHappened}` : "");
|
|
94
|
+
return [
|
|
95
|
+
`You are comparing two agent-diagnostics findings for the SAME entity (${entitySlug}).`,
|
|
96
|
+
`A prior finding was DISMISSED by the operator as "not an issue". A new finding was just produced.`,
|
|
97
|
+
`Decide whether the NEW finding describes the SAME underlying failure mode as the DISMISSED one.`,
|
|
98
|
+
``,
|
|
99
|
+
`DISMISSED finding (failure-mode triple):`,
|
|
100
|
+
fmt(dismissed),
|
|
101
|
+
``,
|
|
102
|
+
`NEW finding (failure-mode triple):`,
|
|
103
|
+
fmt(candidate),
|
|
104
|
+
``,
|
|
105
|
+
`First CRITIQUE the comparison (what matches, what differs — surface wording differs run-to-run,`,
|
|
106
|
+
`so judge the MEANING, not the phrasing). Then return a verdict:`,
|
|
107
|
+
`- overlap: true ONLY if it is the same failure mode (same what happening for the same reason at the same place).`,
|
|
108
|
+
`- confidence: "high" | "medium" | "low".`,
|
|
109
|
+
`Be CONSERVATIVE: reserve "high" for an unambiguous same-failure-mode match. When unsure, do NOT claim high.`,
|
|
110
|
+
].join("\n");
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Build the pinned, reproducible semantic-match request for one (candidate, dismissed) pair.
|
|
115
|
+
* Deterministic — same inputs ⇒ byte-identical request (the reproducibility guarantee).
|
|
116
|
+
*/
|
|
117
|
+
export function buildSemanticMatchRequest(
|
|
118
|
+
candidate: FailureTriple,
|
|
119
|
+
dismissed: FailureTriple,
|
|
120
|
+
entitySlug: string,
|
|
121
|
+
model: string = SEMANTIC_MATCH_MODEL
|
|
122
|
+
): SemanticMatchRequest {
|
|
123
|
+
return {
|
|
124
|
+
model,
|
|
125
|
+
temperature: SEMANTIC_MATCH_TEMPERATURE,
|
|
126
|
+
cPin: semanticMatchCPin(model),
|
|
127
|
+
candidate,
|
|
128
|
+
dismissed,
|
|
129
|
+
entitySlug,
|
|
130
|
+
prompt: buildPrompt(candidate, dismissed, entitySlug),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* THE ONE deterministic decision fed by the reasoning verdict. CONSERVATIVE / fail-safe:
|
|
136
|
+
* suppress ONLY on high-confidence overlap. Anything else (no verdict, overlap:false,
|
|
137
|
+
* medium/low confidence) → do NOT suppress (the finding shows).
|
|
138
|
+
*/
|
|
139
|
+
export function decideSuppress(verdict: SemanticMatchVerdict | undefined): boolean {
|
|
140
|
+
if (!verdict) return false;
|
|
141
|
+
return verdict.overlap === true && verdict.confidence === "high";
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// ── Severity-escalation HARD GUARD ───────────────────────────────────────────
|
|
145
|
+
|
|
146
|
+
/** Severity rank (crit > high > med > info) — same order the renderer's badges use. */
|
|
147
|
+
const SEVERITY_RANK: Readonly<Record<VerdictSeverity, number>> = {
|
|
148
|
+
crit: 3,
|
|
149
|
+
high: 2,
|
|
150
|
+
med: 1,
|
|
151
|
+
info: 0,
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
/** Rank a severity; an unknown/undefined severity ranks lowest (info). */
|
|
155
|
+
export function severityRank(sev: VerdictSeverity | undefined): number {
|
|
156
|
+
return sev ? (SEVERITY_RANK[sev] ?? 0) : 0;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* True when a finding's CURRENT severity materially EXCEEDS the severity it was dismissed
|
|
161
|
+
* at — a dismissed-but-now-worse finding. When escalated, the finding is NEVER suppressed
|
|
162
|
+
* (it re-surfaces) regardless of any semantic overlap. This is the HARD GUARD and it runs
|
|
163
|
+
* BEFORE the semantic match.
|
|
164
|
+
*/
|
|
165
|
+
export function isSeverityEscalated(
|
|
166
|
+
current: VerdictSeverity | undefined,
|
|
167
|
+
atDismissal: VerdictSeverity
|
|
168
|
+
): boolean {
|
|
169
|
+
return severityRank(current) > severityRank(atDismissal);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// ── VerdictLookup — the injected reasoning-verdict map ────────────────────────
|
|
173
|
+
|
|
174
|
+
/** Stable key identifying one dismissed ledger entry (matches store.ts verdictKey). */
|
|
175
|
+
export function dismissalEntryKey(entry: VerdictLedgerEntry): string {
|
|
176
|
+
return `${entry.verdict}:${entry.runId}:${entry.findingId}`;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** Lookup key for the verdict of (this new finding × this dismissed entry). */
|
|
180
|
+
export function verdictLookupKey(findingId: string, entry: VerdictLedgerEntry): string {
|
|
181
|
+
return `${findingId}::${dismissalEntryKey(entry)}`;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** The injected map of reasoning verdicts, keyed by verdictLookupKey(). */
|
|
185
|
+
export type VerdictLookup = Readonly<Record<string, SemanticMatchVerdict>>;
|
|
186
|
+
|
|
187
|
+
// ── The partition (pure, deterministic) ──────────────────────────────────────
|
|
188
|
+
|
|
189
|
+
/** One suppressed finding + the dismissed entry + verdict that suppressed it (audit). */
|
|
190
|
+
export interface SuppressionRecord {
|
|
191
|
+
finding: Finding;
|
|
192
|
+
matchedEntry: VerdictLedgerEntry;
|
|
193
|
+
verdict: SemanticMatchVerdict;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export interface DismissalPartitionResult {
|
|
197
|
+
/** Findings that SHOW in the report (not suppressed). */
|
|
198
|
+
active: Finding[];
|
|
199
|
+
/** Findings REMOVED from the report (matched a valid dismissal at high confidence). */
|
|
200
|
+
suppressed: SuppressionRecord[];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface PartitionOptions {
|
|
204
|
+
/** The diagnosed entity's slug — the EXACT-match gate for the final-check. */
|
|
205
|
+
entitySlug: string;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Split findings into active (shown) vs suppressed (removed from the report), applying the
|
|
210
|
+
* dismissal final-check DETERMINISTICALLY given the injected reasoning verdicts.
|
|
211
|
+
*
|
|
212
|
+
* Per finding, for each dismissed entry of the SAME entity (entitySlug EXACT):
|
|
213
|
+
* 1. HARD GUARD FIRST — if the finding's current severity escalated beyond the entry's
|
|
214
|
+
* severityAtDismissal, this entry can NEVER suppress it (skip the entry). A
|
|
215
|
+
* dismissed-but-now-worse finding always re-surfaces, regardless of overlap.
|
|
216
|
+
* 2. else consult the injected reasoning verdict; suppress iff decideSuppress() (high-
|
|
217
|
+
* confidence overlap). The FIRST qualifying entry suppresses the finding.
|
|
218
|
+
*
|
|
219
|
+
* Fail-safe: `dismissedEntries` empty (no library / no dismissals) ⇒ every finding is
|
|
220
|
+
* active (a no-op). Deterministic: input order is preserved; no clock, no random.
|
|
221
|
+
*/
|
|
222
|
+
export function partitionByDismissal(
|
|
223
|
+
findings: Finding[],
|
|
224
|
+
dismissedEntries: VerdictLedgerEntry[],
|
|
225
|
+
verdicts: VerdictLookup,
|
|
226
|
+
opts: PartitionOptions
|
|
227
|
+
): DismissalPartitionResult {
|
|
228
|
+
const candidates = dismissedEntries.filter((e) => e.entitySlug === opts.entitySlug);
|
|
229
|
+
const active: Finding[] = [];
|
|
230
|
+
const suppressed: SuppressionRecord[] = [];
|
|
231
|
+
|
|
232
|
+
for (const finding of findings) {
|
|
233
|
+
let hit: SuppressionRecord | undefined;
|
|
234
|
+
for (const entry of candidates) {
|
|
235
|
+
// 1. Severity-escalation HARD GUARD — runs BEFORE the semantic match.
|
|
236
|
+
if (isSeverityEscalated(finding.severity, entry.severityAtDismissal)) continue;
|
|
237
|
+
// 2. Semantic overlap (injected reasoning verdict), conservative decision.
|
|
238
|
+
const verdict = verdicts[verdictLookupKey(finding.findingId, entry)];
|
|
239
|
+
if (decideSuppress(verdict)) {
|
|
240
|
+
// decideSuppress guarantees verdict is defined here.
|
|
241
|
+
hit = { finding, matchedEntry: entry, verdict: verdict as SemanticMatchVerdict };
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (hit) suppressed.push(hit);
|
|
246
|
+
else active.push(finding);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return { active, suppressed };
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/** Extract a finding's failure-mode triple (for building a match request). */
|
|
253
|
+
export function findingTriple(finding: Finding): FailureTriple {
|
|
254
|
+
return {
|
|
255
|
+
what: finding.failureOrigin.what,
|
|
256
|
+
why: finding.failureOrigin.why,
|
|
257
|
+
where: finding.failureOrigin.where,
|
|
258
|
+
whatHappened: finding.failureOrigin.whatHappened,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/** Extract a dismissed ledger entry's failure-mode triple. */
|
|
263
|
+
export function entryTriple(entry: VerdictLedgerEntry): FailureTriple {
|
|
264
|
+
return {
|
|
265
|
+
what: entry.what,
|
|
266
|
+
why: entry.why,
|
|
267
|
+
where: entry.where,
|
|
268
|
+
whatHappened: entry.whatHappened,
|
|
269
|
+
};
|
|
270
|
+
}
|
package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/enrich/rank-remedies.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/enrich/rank-remedies.ts
|
|
3
|
+
* W13-C (D-1): deterministic remedy-rank derivation.
|
|
4
|
+
*
|
|
5
|
+
* The orchestrator protocol (§8) states "Remedies: ranked by cost × correctness",
|
|
6
|
+
* but no code implemented it — so `remedy.rank` reached the renderer as `undefined`
|
|
7
|
+
* (one leg of the D-1 contract-triad desync). This module finally implements that
|
|
8
|
+
* rule in code: `rank` is DERIVED here from the analyzer's `cost` + `correctness`
|
|
9
|
+
* categoricals, never analyzer-supplied. That:
|
|
10
|
+
* 1. guarantees every remedy carries a `rank` before render (no `RANK undefined`);
|
|
11
|
+
* 2. removes an agent-discretion variance source — ranking is now reproducible
|
|
12
|
+
* (honors the variance program: deterministic, no LLM judgment on rank).
|
|
13
|
+
*
|
|
14
|
+
* `cost`/`correctness` themselves are analyzer-emitted and contract-required
|
|
15
|
+
* (findings-contract.ts REQUIRED_REMEDY_FIELDS) — so they are guaranteed present
|
|
16
|
+
* by the time this runs (Step 8.5 enricher, post Step-7.1 gate).
|
|
17
|
+
*
|
|
18
|
+
* Type A — Pure Script (deterministic, no I/O, no clock, no random).
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import type { Remedy } from "../normalize/trace.ts";
|
|
22
|
+
|
|
23
|
+
/** Categorical → ordinal weight. Higher correctness and LOWER cost are better. */
|
|
24
|
+
const CORRECTNESS_WEIGHT: Record<Remedy["correctness"], number> = {
|
|
25
|
+
high: 3,
|
|
26
|
+
medium: 2,
|
|
27
|
+
low: 1,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const COST_WEIGHT: Record<Remedy["cost"], number> = {
|
|
31
|
+
// Lower cost is better, so it contributes MORE priority when cheaper.
|
|
32
|
+
low: 3,
|
|
33
|
+
medium: 2,
|
|
34
|
+
high: 1,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Priority score for a remedy — HIGHER means a better (higher-priority) remedy.
|
|
39
|
+
*
|
|
40
|
+
* Correctness is weighted to dominate cost: a correct-but-pricey fix outranks a
|
|
41
|
+
* cheap-but-weak one. We achieve strict dominance by scaling correctness above the
|
|
42
|
+
* cost range (cost ∈ [1..3] can never overturn a correctness step):
|
|
43
|
+
*
|
|
44
|
+
* score = correctnessWeight * 10 + costWeight
|
|
45
|
+
*
|
|
46
|
+
* Deterministic: same inputs → same score, every run.
|
|
47
|
+
*/
|
|
48
|
+
export function remedyPriorityScore(remedy: Pick<Remedy, "cost" | "correctness">): number {
|
|
49
|
+
return CORRECTNESS_WEIGHT[remedy.correctness] * 10 + COST_WEIGHT[remedy.cost];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Assign a 1-based `rank` to every remedy by descending priority score
|
|
54
|
+
* (lower rank = higher priority, per the canonical Remedy.rank contract).
|
|
55
|
+
*
|
|
56
|
+
* Pure: returns a new array of new remedy objects; the input is not mutated.
|
|
57
|
+
* Stable + reproducible: score ties are broken deterministically by `remedyId`
|
|
58
|
+
* ascending, so parallel-analyzer output ranks identically on every run.
|
|
59
|
+
*/
|
|
60
|
+
export function rankRemedies(remedies: readonly Remedy[]): Remedy[] {
|
|
61
|
+
// Index-tag first so the sort is fully deterministic even on duplicate ids.
|
|
62
|
+
const ordered = remedies
|
|
63
|
+
.map((remedy, index) => ({ remedy, index }))
|
|
64
|
+
.sort((a, b) => {
|
|
65
|
+
const scoreDelta = remedyPriorityScore(b.remedy) - remedyPriorityScore(a.remedy);
|
|
66
|
+
if (scoreDelta !== 0) return scoreDelta;
|
|
67
|
+
// Tie-break 1: remedyId ascending (stable, content-addressed).
|
|
68
|
+
const idDelta = a.remedy.remedyId.localeCompare(b.remedy.remedyId);
|
|
69
|
+
if (idDelta !== 0) return idDelta;
|
|
70
|
+
// Tie-break 2: original input order (never relies on Array.sort stability).
|
|
71
|
+
return a.index - b.index;
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
return ordered.map(({ remedy }, i) => ({ ...remedy, rank: i + 1 }));
|
|
75
|
+
}
|
package/mutagent-diagnostics/.claude/skills/mutagent-diagnostics/scripts/hooks/install-hooks.sh
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# =============================================================================
|
|
3
|
+
# install-hooks.sh — mutagent-diagnostics skill-local git hook installer
|
|
4
|
+
# =============================================================================
|
|
5
|
+
# Installs the skill's pre-push hook into the shared .git/hooks (works from a
|
|
6
|
+
# worktree via --git-common-dir). Idempotent. Standalone usage from the skill
|
|
7
|
+
# package root: bun run setup:hooks
|
|
8
|
+
#
|
|
9
|
+
# Scope discipline: this installer belongs to the mutagent-diagnostics package
|
|
10
|
+
# and ONLY installs the diagnostics pre-push hook. It does NOT touch the
|
|
11
|
+
# monorepo-root scripts/install-hooks.sh (which manages pre-commit/post-commit/
|
|
12
|
+
# post-checkout). If a root pre-push hook is later added, this installer should
|
|
13
|
+
# be folded into it; until then it is self-contained per feedback_infra_changes_last.
|
|
14
|
+
# =============================================================================
|
|
15
|
+
|
|
16
|
+
set -euo pipefail
|
|
17
|
+
|
|
18
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
19
|
+
|
|
20
|
+
GIT_COMMON="$(git rev-parse --git-common-dir 2>/dev/null || true)"
|
|
21
|
+
if [ -z "$GIT_COMMON" ]; then
|
|
22
|
+
echo "[mdiag install-hooks] not inside a git repo — skipping" >&2
|
|
23
|
+
exit 0
|
|
24
|
+
fi
|
|
25
|
+
HOOKS_DIR="$GIT_COMMON/hooks"
|
|
26
|
+
mkdir -p "$HOOKS_DIR"
|
|
27
|
+
|
|
28
|
+
SRC="$SCRIPT_DIR/pre-push.sh"
|
|
29
|
+
DST="$HOOKS_DIR/pre-push"
|
|
30
|
+
|
|
31
|
+
if [ ! -f "$SRC" ]; then
|
|
32
|
+
echo "[mdiag install-hooks] source hook missing: $SRC" >&2
|
|
33
|
+
exit 1
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# Guard: if a DIFFERENT pre-push hook already exists (not ours), do not clobber.
|
|
37
|
+
if [ -f "$DST" ] && ! grep -q "mdiag pre-push" "$DST" 2>/dev/null; then
|
|
38
|
+
echo "[mdiag install-hooks] a non-diagnostics pre-push hook already exists at $DST" >&2
|
|
39
|
+
echo "[mdiag install-hooks] NOT overwriting — integrate the diagnostics T2 manually:" >&2
|
|
40
|
+
echo "[mdiag install-hooks] bash $SRC" >&2
|
|
41
|
+
exit 0
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
cp "$SRC" "$DST"
|
|
45
|
+
chmod +x "$DST"
|
|
46
|
+
echo "[mdiag install-hooks] pre-push hook installed → $DST"
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# =============================================================================
|
|
3
|
+
# pre-push.sh — mutagent-diagnostics on-demand Langfuse integration gate (T2)
|
|
4
|
+
# =============================================================================
|
|
5
|
+
# Runs the T2 LIVE Langfuse integration (verify:langfuse) before a push, ONLY
|
|
6
|
+
# for contributors who have a local Langfuse stack + creds. It SKIPS LOUDLY and
|
|
7
|
+
# exits 0 when the stack/creds are absent (CI + keyless contributors stay green).
|
|
8
|
+
# This mirrors the repo's "on-demand local verification" pattern (see the
|
|
9
|
+
# Wave-5.1 coverage matrix spec).
|
|
10
|
+
#
|
|
11
|
+
# This hook is INTENTIONALLY skill-local (installed by `bun run setup:hooks`
|
|
12
|
+
# from THIS package) — it does NOT modify the monorepo-root install-hooks.sh.
|
|
13
|
+
# It is heavier than pre-commit, so it runs at push time, not on every commit.
|
|
14
|
+
#
|
|
15
|
+
# To enable for this clone:
|
|
16
|
+
# cd mutagent-system/mutagent-diagnostics && bun run setup:hooks
|
|
17
|
+
# To bypass intentionally (e.g. offline): the hook self-skips when no stack —
|
|
18
|
+
# you should NOT need --no-verify. Never use --no-verify to hide a real failure.
|
|
19
|
+
# =============================================================================
|
|
20
|
+
|
|
21
|
+
set -euo pipefail
|
|
22
|
+
|
|
23
|
+
# This hook runs as the INSTALLED copy at .git/hooks/pre-push, so it cannot use
|
|
24
|
+
# its own location to find the package — it discovers the package via the git
|
|
25
|
+
# worktree toplevel. Works from the root checkout AND from any worktree.
|
|
26
|
+
TOP="$(git rev-parse --show-toplevel 2>/dev/null || true)"
|
|
27
|
+
if [ -z "$TOP" ]; then
|
|
28
|
+
echo "[mdiag pre-push] not inside a git worktree — skipping" >&2
|
|
29
|
+
exit 0
|
|
30
|
+
fi
|
|
31
|
+
PKG_DIR="$TOP/mutagent-system/mutagent-diagnostics"
|
|
32
|
+
|
|
33
|
+
if [ ! -f "$PKG_DIR/package.json" ]; then
|
|
34
|
+
# The diagnostics package is not present in this worktree (e.g. a checkout that
|
|
35
|
+
# predates the skill). Nothing to verify — skip cleanly.
|
|
36
|
+
echo "[mdiag pre-push] diagnostics package not found at $PKG_DIR — skipping" >&2
|
|
37
|
+
exit 0
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
# Source local Langfuse creds if present. The hook never prints or commits keys.
|
|
41
|
+
# Absence is fine — verify:langfuse self-skips loudly. Prefer creds already in
|
|
42
|
+
# the environment; otherwise try the worktree's mutagent/.env (post-checkout hook
|
|
43
|
+
# copies it) then the root checkout's mutagent/.env.
|
|
44
|
+
if [ -z "${LANGFUSE_HOST:-}" ] || [ -z "${LANGFUSE_PUBLIC_KEY:-}" ] || [ -z "${LANGFUSE_SECRET_KEY:-}" ]; then
|
|
45
|
+
GIT_COMMON="$(git rev-parse --git-common-dir 2>/dev/null || true)"
|
|
46
|
+
ROOT_CHECKOUT="$(cd "$GIT_COMMON/.." 2>/dev/null && pwd || true)"
|
|
47
|
+
for envf in "$TOP/mutagent/.env" "$ROOT_CHECKOUT/mutagent/.env"; do
|
|
48
|
+
if [ -f "$envf" ]; then
|
|
49
|
+
set -a
|
|
50
|
+
# shellcheck disable=SC1090
|
|
51
|
+
source "$envf"
|
|
52
|
+
set +a
|
|
53
|
+
break
|
|
54
|
+
fi
|
|
55
|
+
done
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
echo "[mdiag pre-push] running T2 Langfuse integration (verify:langfuse) …" >&2
|
|
59
|
+
if ! command -v bun >/dev/null 2>&1; then
|
|
60
|
+
echo "[mdiag pre-push] bun not found — skipping T2 (install bun to enable)" >&2
|
|
61
|
+
exit 0
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
# Enter the package dir defensively. If the dir is inaccessible (e.g. a sandboxed
|
|
65
|
+
# / restricted worktree path), skip loudly rather than fail the push — an
|
|
66
|
+
# unreachable package is an ENVIRONMENT problem, not a test failure. This keeps
|
|
67
|
+
# the hook aligned with its "skip when you can't actually run" philosophy and
|
|
68
|
+
# never forces a --no-verify bypass.
|
|
69
|
+
if ! cd "$PKG_DIR" 2>/dev/null; then
|
|
70
|
+
echo "[mdiag pre-push] cannot enter $PKG_DIR — skipping T2 (restricted/unavailable path)" >&2
|
|
71
|
+
exit 0
|
|
72
|
+
fi
|
|
73
|
+
# Verify the package script exists before invoking (guards against partial checkouts).
|
|
74
|
+
if ! grep -q '"verify:langfuse"' package.json 2>/dev/null; then
|
|
75
|
+
echo "[mdiag pre-push] verify:langfuse script not present here — skipping T2" >&2
|
|
76
|
+
exit 0
|
|
77
|
+
fi
|
|
78
|
+
bun run verify:langfuse
|