@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
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/judge-prompt-template.ts — EV-050 judge-PROMPT renderer + in-house/export run wrappers.
|
|
3
|
+
* ---------------------------------------------------------------------------
|
|
4
|
+
* The ONE place a judge prompt is rendered into a provider-callable string. This
|
|
5
|
+
* is the operator-named **exception** to the script-austerity rule: "a script
|
|
6
|
+
* that EXTRACTS/EXPORTS a custom LLM-as-judge PROMPT artifact (for the user's
|
|
7
|
+
* CI/framework, EV-050) is fine — that's templating, not skill-triggered
|
|
8
|
+
* judging." It exists for exactly two consumers:
|
|
9
|
+
*
|
|
10
|
+
* (1) the OPTIONAL **in-house** provider substrate (`judge-provider.ts` →
|
|
11
|
+
* @langchain/google-genai) — it has no subagent, so it MUST carry the
|
|
12
|
+
* rendered prompt to call the model;
|
|
13
|
+
* (2) **user-framework export** (Vitest / promptfoo / Braintrust) — emit the
|
|
14
|
+
* judge prompt as an artifact for the user's own CI.
|
|
15
|
+
*
|
|
16
|
+
* **The DEFAULT agent-dispatch path NEVER imports this file.** Under
|
|
17
|
+
* agent-dispatch the AUTHORITATIVE judging rubric lives in the subagent defs
|
|
18
|
+
* (`assets/agents/{error-analyst,eval-judge,eval-matrix-judge}.md`); the host
|
|
19
|
+
* runtime reasons from the def + the DATA packet, and the verdict file is keyed
|
|
20
|
+
* by task DATA (trajectory id / criterion id), not by a rendered prompt. The
|
|
21
|
+
* prose below is a MIRROR of those defs for the provider path — the defs are the
|
|
22
|
+
* source of truth; keep them in lockstep.
|
|
23
|
+
*
|
|
24
|
+
* `determine-outcome.ts` + `build-evals.ts` are therefore slimmed to Type-A DATA
|
|
25
|
+
* only (signals · parse · assemble · spec · split · leakage-guard). The
|
|
26
|
+
* LLM-wrapper run functions (`determineOutcome` / `runJudge`) live HERE because
|
|
27
|
+
* they call the injected `JudgeInvoke` seam.
|
|
28
|
+
*/
|
|
29
|
+
import {
|
|
30
|
+
extractOutcomeSignals,
|
|
31
|
+
parseCritiqueVerdict,
|
|
32
|
+
type JudgeInvoke,
|
|
33
|
+
} from "./determine-outcome.ts";
|
|
34
|
+
import type { JudgePin } from "./build-evals.ts";
|
|
35
|
+
import type { SubjectProfile } from "./contracts/eval-matrix.ts";
|
|
36
|
+
import type {
|
|
37
|
+
CriterionVerdict,
|
|
38
|
+
EvalTrace,
|
|
39
|
+
JudgeSpec,
|
|
40
|
+
OutcomeResult,
|
|
41
|
+
OutcomeSignals,
|
|
42
|
+
SubjectVocab,
|
|
43
|
+
} from "./contracts/eval-types.ts";
|
|
44
|
+
|
|
45
|
+
function promptOf(trace: EvalTrace): string {
|
|
46
|
+
return typeof trace.input?.prompt === "string" ? trace.input.prompt : "";
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// ── Determiner (EV-042) prompt — MIRRORS assets/agents/error-analyst.md ──────
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Render the determiner judge prompt for the in-house/export substrate. The
|
|
53
|
+
* AUTHORITATIVE "inaction can be success" rubric is `error-analyst.md`; this is
|
|
54
|
+
* its provider-callable mirror. No decision is made here.
|
|
55
|
+
*/
|
|
56
|
+
export function buildOutcomePrompt(
|
|
57
|
+
trace: EvalTrace,
|
|
58
|
+
signals: OutcomeSignals,
|
|
59
|
+
vocab: SubjectVocab,
|
|
60
|
+
): { system: string; user: string } {
|
|
61
|
+
const system = [
|
|
62
|
+
"You are a success/failure determiner for an autonomous agent session.",
|
|
63
|
+
"Decide whether the session REACHED THE GOAL implied by its input event.",
|
|
64
|
+
"",
|
|
65
|
+
"CRITICAL RULE — inaction can be success. Holding (sending nothing, calling",
|
|
66
|
+
"no tool) is the CORRECT outcome when the event is a restraint directive",
|
|
67
|
+
"(e.g. a guard/hold directive) or when acting would be wrong. You MUST NOT",
|
|
68
|
+
'use "the agent called a tool" or "the agent sent a message" as a success',
|
|
69
|
+
"proxy. A zero-tool session that correctly HOLDS is a PASS.",
|
|
70
|
+
"",
|
|
71
|
+
"Output STRICT JSON with the critique BEFORE the verdict:",
|
|
72
|
+
'{ "critique": "<your reasoning>", "result": "pass"|"fail"|"uncertain",',
|
|
73
|
+
' "confidence": <0..1> }',
|
|
74
|
+
"Reason first in `critique`, then commit to `result`.",
|
|
75
|
+
].join("\n");
|
|
76
|
+
|
|
77
|
+
// Generic guard-counter label — the attribute NAME comes from the subject vocab.
|
|
78
|
+
const guardLabel = vocab.guardCounterAttr ?? "guard counter";
|
|
79
|
+
const user = [
|
|
80
|
+
`Event kind: ${signals.eventKind}`,
|
|
81
|
+
`Guard ${guardLabel}: ${signals.guardConsecutive ?? "n/a"}`,
|
|
82
|
+
`Tools called: ${signals.toolCount}`,
|
|
83
|
+
// EV-049 honest-null: render UNKNOWN as "unknown" (the subject's send tool is
|
|
84
|
+
// unset/uninferred) — never coerce it to "false", which would lie to the judge.
|
|
85
|
+
`Sent a message: ${signals.sentMessage === null ? "unknown" : signals.sentMessage}`,
|
|
86
|
+
`Send succeeded: ${signals.sendSucceeded ?? "n/a (no send)"}`,
|
|
87
|
+
`Recovery tool present: ${signals.recoveryPresent}`,
|
|
88
|
+
"",
|
|
89
|
+
"Input event prompt:",
|
|
90
|
+
promptOf(trace),
|
|
91
|
+
"",
|
|
92
|
+
"Agent self-summary (output.response):",
|
|
93
|
+
typeof trace.output?.response === "string" ? trace.output.response : "(none)",
|
|
94
|
+
].join("\n");
|
|
95
|
+
|
|
96
|
+
return { system, user };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* In-house/export run wrapper for the determiner: render → call the injected
|
|
101
|
+
* `JudgeInvoke` seam → parse (critique-before-verdict). Under the DEFAULT
|
|
102
|
+
* agent-dispatch substrate the verdict instead comes from a dispatched
|
|
103
|
+
* error-analyst subagent (a verdict file), and this wrapper is not used.
|
|
104
|
+
* Deterministic given (trace, judge).
|
|
105
|
+
*/
|
|
106
|
+
export async function determineOutcome(
|
|
107
|
+
trace: EvalTrace,
|
|
108
|
+
judge: JudgeInvoke,
|
|
109
|
+
vocab: SubjectVocab,
|
|
110
|
+
): Promise<OutcomeResult> {
|
|
111
|
+
const signals = extractOutcomeSignals(trace, vocab);
|
|
112
|
+
const { system, user } = buildOutcomePrompt(trace, signals, vocab);
|
|
113
|
+
const raw = await judge(system, user);
|
|
114
|
+
const verdict = parseCritiqueVerdict(raw);
|
|
115
|
+
return {
|
|
116
|
+
traceId: trace.id,
|
|
117
|
+
reached: verdict.result as OutcomeResult["reached"],
|
|
118
|
+
confidence: verdict.confidence,
|
|
119
|
+
rationale: verdict.critique,
|
|
120
|
+
signals,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// ── Per-criterion judge (EV-043) prompt — MIRRORS assets/agents/eval-judge.md ─
|
|
125
|
+
|
|
126
|
+
/** Compact one trace for the judge's view (prompt + trajectory + response). */
|
|
127
|
+
function traceView(trace: EvalTrace): string {
|
|
128
|
+
const prompt = typeof trace.input?.prompt === "string" ? trace.input.prompt : "";
|
|
129
|
+
const tools = trace.observations
|
|
130
|
+
.filter((o) => o.type === "TOOL")
|
|
131
|
+
.map((o) => o.name ?? "?")
|
|
132
|
+
.join(", ");
|
|
133
|
+
const resp = typeof trace.output?.response === "string" ? trace.output.response : "(none)";
|
|
134
|
+
return [
|
|
135
|
+
`Event/prompt:\n${prompt}`,
|
|
136
|
+
`Tool trajectory: [${tools}]`,
|
|
137
|
+
`Agent self-summary: ${resp}`,
|
|
138
|
+
].join("\n");
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Render the M1 subject-profile preamble for the provider-path mirror (§9.4.4). */
|
|
142
|
+
function profilePreamble(profile?: SubjectProfile): string[] {
|
|
143
|
+
if (profile === undefined) {
|
|
144
|
+
return [
|
|
145
|
+
"SUBJECT PROFILE (M1): not supplied — RECONSTRUCT who the agent is from the trace",
|
|
146
|
+
"(its tools, the input it handled, its evident scope) before you judge. Mark the",
|
|
147
|
+
"harness `unknown` if you cannot know it — NEVER confabulate it.",
|
|
148
|
+
"",
|
|
149
|
+
];
|
|
150
|
+
}
|
|
151
|
+
return [
|
|
152
|
+
"SUBJECT PROFILE (M1) — who the agent is (read this BEFORE judging):",
|
|
153
|
+
` identity: ${profile.identity}`,
|
|
154
|
+
` purpose: ${profile.purpose}`,
|
|
155
|
+
` scope: ${profile.scope}`,
|
|
156
|
+
` tools: ${(profile.tools ?? []).join(", ") || "(none observed)"}`,
|
|
157
|
+
profile.skill !== undefined ? ` skill: ${profile.skill}` : "",
|
|
158
|
+
` harness: ${profile.harness}`,
|
|
159
|
+
` provenance: ${profile.provenance}${profile.version !== undefined ? ` · version ${profile.version}` : ""}`,
|
|
160
|
+
"",
|
|
161
|
+
].filter((l) => l !== "");
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Render the 4-component per-criterion judge prompt for the in-house/export
|
|
166
|
+
* substrate. The AUTHORITATIVE 4-component / binary / critique-before-verdict
|
|
167
|
+
* rubric is `eval-judge.md` (+ §9.4.4 M1–M5); this is its provider-callable mirror.
|
|
168
|
+
*/
|
|
169
|
+
export function buildJudgePrompt(
|
|
170
|
+
spec: JudgeSpec,
|
|
171
|
+
subjectTrace: EvalTrace,
|
|
172
|
+
subjectProfile?: SubjectProfile,
|
|
173
|
+
): { system: string; user: string } {
|
|
174
|
+
const fewShotBlock = spec.fewShot
|
|
175
|
+
.map(
|
|
176
|
+
(ex, i) =>
|
|
177
|
+
`Example ${i + 1} (${ex.label}):\nCritique: ${ex.why}\nResult: ${ex.label}`,
|
|
178
|
+
)
|
|
179
|
+
.join("\n\n");
|
|
180
|
+
|
|
181
|
+
const system = [
|
|
182
|
+
"You are a BINARY Pass/Fail judge for ONE criterion. Judge exactly this and",
|
|
183
|
+
"nothing else.",
|
|
184
|
+
"",
|
|
185
|
+
...profilePreamble(subjectProfile),
|
|
186
|
+
`Criterion: ${spec.statement}`,
|
|
187
|
+
spec.passDefinition,
|
|
188
|
+
spec.failDefinition,
|
|
189
|
+
"",
|
|
190
|
+
"JUDGE-WHAT-IS (M5): judge ONLY this defined criterion. If you notice a real",
|
|
191
|
+
"failure with no matching criterion, you MAY note it as a detection — but NEVER",
|
|
192
|
+
"mint a new eval or judge an undefined behaviour here.",
|
|
193
|
+
"",
|
|
194
|
+
"Outcomes are strictly BINARY: pass or fail (use uncertain ONLY if the trace",
|
|
195
|
+
"genuinely lacks the evidence to decide). NO Likert scales, NO 1-5 / letter",
|
|
196
|
+
"grades, NO partial credit — if severity matters, that is a separate judge.",
|
|
197
|
+
"",
|
|
198
|
+
spec.fewShot.length > 0 ? `Few-shot examples (from the TRAIN split only):\n${fewShotBlock}` : "",
|
|
199
|
+
"",
|
|
200
|
+
"Output STRICT JSON with the critique BEFORE the verdict (reason first, then",
|
|
201
|
+
"commit). Follow the Judge DAG v2.2 walk (§9.4.2 + §9.4.4): GATHER (M2 — rephrase",
|
|
202
|
+
"the agent's job in your own words, mark given-vs-inferred) → EXPECT (M3 — decide",
|
|
203
|
+
"how the target SHOULD act BEFORE you examine) → EXAMINE actual-vs-expected (a",
|
|
204
|
+
"truncated trace HARD short-circuits — emit INCOMPLETE and score NO criteria, never",
|
|
205
|
+
"a row of abstains) → BIND → GROUND (absence-split: a bare-absence inferred from",
|
|
206
|
+
"silence abstains, never fails) → CRITIQUE → DECIDE. Expose your train-of-thought at",
|
|
207
|
+
"every phase (M4). Emit a `confidenceBand` (high|med|low) BESIDE the binary verdict",
|
|
208
|
+
"— a calibration side-signal, NOT a Likert grade; it never alters `result`:",
|
|
209
|
+
'{ "critique": "<detailed, evidence-citing assessment>", "result":',
|
|
210
|
+
' "pass"|"fail"|"uncertain", "confidence": <0..1>,',
|
|
211
|
+
' "confidenceBand": "high"|"med"|"low" }',
|
|
212
|
+
].join("\n");
|
|
213
|
+
|
|
214
|
+
const user = ["Subject trace under evaluation:", "", traceView(subjectTrace)].join("\n");
|
|
215
|
+
return { system, user };
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* In-house/export run wrapper for one per-criterion judge under a PINNED model.
|
|
220
|
+
* THROWS if the pin is not (modelId present AND temperature===0) — model intent
|
|
221
|
+
* is sacred (C-PIN). Renders → calls the injected `JudgeInvoke` seam → parses
|
|
222
|
+
* (critique-before-verdict). Under agent-dispatch the verdict instead comes from
|
|
223
|
+
* a dispatched eval-judge subagent (a verdict file).
|
|
224
|
+
*/
|
|
225
|
+
export async function runJudge(
|
|
226
|
+
spec: JudgeSpec,
|
|
227
|
+
subjectTrace: EvalTrace,
|
|
228
|
+
judge: JudgeInvoke,
|
|
229
|
+
pin: JudgePin,
|
|
230
|
+
): Promise<CriterionVerdict> {
|
|
231
|
+
if (typeof pin.modelId !== "string" || pin.modelId.length === 0) {
|
|
232
|
+
throw new Error(
|
|
233
|
+
"runJudge: judge is not pinned (missing modelId). MODEL INTENT IS SACRED " +
|
|
234
|
+
"— a non-pinned judge can never produce a verdict (C-PIN).",
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
if (pin.temperature !== 0) {
|
|
238
|
+
throw new Error(
|
|
239
|
+
`runJudge: judge temperature=${pin.temperature} (!= 0) — not pinned. ` +
|
|
240
|
+
"MODEL INTENT IS SACRED: reruns must be byte-identical (C-PIN); refusing.",
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
const { system, user } = buildJudgePrompt(spec, subjectTrace);
|
|
244
|
+
const raw = await judge(system, user);
|
|
245
|
+
const verdict = parseCritiqueVerdict(raw);
|
|
246
|
+
return {
|
|
247
|
+
criterionId: spec.criterionId,
|
|
248
|
+
traceId: subjectTrace.id,
|
|
249
|
+
result: verdict.result as OutcomeResult["reached"],
|
|
250
|
+
confidence: verdict.confidence,
|
|
251
|
+
critique: verdict.critique,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/judge-provider.ts — EV-050 in-house judge transport (the default substrate).
|
|
3
|
+
* ---------------------------------------------------------------------------
|
|
4
|
+
* The in-house AI-SDK judge: the @langchain/google-genai ChatGoogleGenerativeAI
|
|
5
|
+
* shape proven in the orchestrator's eval-routing.ts (temp 0, model resolved
|
|
6
|
+
* from --model | config.models.default, THROW on unsupported/missing creds).
|
|
7
|
+
* Re-implemented here (sealed-sibling: the SHAPE is mirrored, the orchestrator
|
|
8
|
+
* module is never imported).
|
|
9
|
+
*
|
|
10
|
+
* DI split (model intent sacred): construction asserts a supported model + creds
|
|
11
|
+
* SYNCHRONOUSLY — no swap, no silent fallback. The provider SDK is imported
|
|
12
|
+
* LAZILY, only when the returned JudgeInvoke is actually CALLED, so the
|
|
13
|
+
* deterministic gate (which never calls it) never loads a provider. The CLI /
|
|
14
|
+
* an opt-in integration seam are the only callers of the returned function.
|
|
15
|
+
*/
|
|
16
|
+
import type { JudgeInvoke } from "./determine-outcome.ts";
|
|
17
|
+
|
|
18
|
+
/** A minimal ctor shape for ChatGoogleGenerativeAI (avoids a type-time SDK dep). */
|
|
19
|
+
interface ChatGoogleCtor {
|
|
20
|
+
new (opts: { model: string; temperature: number; apiKey: string }): {
|
|
21
|
+
invoke: (messages: [string, string][]) => Promise<{ content: unknown }>;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Detect the provider implied by a model id. Closed + explicit (no fuzzing). */
|
|
26
|
+
export function detectProvider(model: string): "google" | "unsupported" {
|
|
27
|
+
return /^gemini/i.test(model) ? "google" : "unsupported";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Assert the model has a wired provider. THROWS (no swap) if not — model intent sacred. */
|
|
31
|
+
export function assertSupportedModel(model: string): void {
|
|
32
|
+
if (detectProvider(model) === "unsupported") {
|
|
33
|
+
throw new Error(
|
|
34
|
+
`judge-provider: model '${model}' has no provider wired (only Google/` +
|
|
35
|
+
"gemini-* is wired). MODEL INTENT IS SACRED: this will NOT silently swap " +
|
|
36
|
+
"to another model/provider. Pass a supported --model, or wire its " +
|
|
37
|
+
"provider (mirror the repo call shape) — never substitute.",
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Assert creds are present. Takes the key EXPLICITLY (env-independent → testable). */
|
|
43
|
+
export function assertCreds(apiKey: string | undefined): string {
|
|
44
|
+
if (apiKey === undefined || apiKey === "") {
|
|
45
|
+
throw new Error(
|
|
46
|
+
"judge-provider: GOOGLE_API_KEY is not set. Source the env first " +
|
|
47
|
+
"(set -a && source mutagent-core/.env && source mutagent/.env && set +a). " +
|
|
48
|
+
"NOT substituting another provider (model intent is sacred).",
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
return apiKey;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface ModelDecision {
|
|
55
|
+
model: string;
|
|
56
|
+
source: "--model" | "config.models.default";
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Resolve the judge model: explicit --model wins (an intentional override, NOT
|
|
61
|
+
* a silent swap), else config.models.default, else REFUSE. PURE — the caller
|
|
62
|
+
* passes the values; this never reads a file or env.
|
|
63
|
+
*/
|
|
64
|
+
export function resolveJudgeModel(opts: {
|
|
65
|
+
model?: string;
|
|
66
|
+
configDefault?: string;
|
|
67
|
+
}): ModelDecision {
|
|
68
|
+
if (opts.model !== undefined && opts.model !== "") {
|
|
69
|
+
return { model: opts.model, source: "--model" };
|
|
70
|
+
}
|
|
71
|
+
if (opts.configDefault !== undefined && opts.configDefault !== "") {
|
|
72
|
+
return { model: opts.configDefault, source: "config.models.default" };
|
|
73
|
+
}
|
|
74
|
+
throw new Error(
|
|
75
|
+
"resolveJudgeModel: no model resolved. Pass --model <id>, or set " +
|
|
76
|
+
"shared.models.default. MODEL INTENT IS SACRED: the harness will not pick " +
|
|
77
|
+
"a model for you.",
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Coerce a LangChain message `content` (string | content-blocks) to plain text. */
|
|
82
|
+
function extractContentText(content: unknown): string {
|
|
83
|
+
if (typeof content === "string") return content;
|
|
84
|
+
if (Array.isArray(content)) {
|
|
85
|
+
return content
|
|
86
|
+
.map((part) => {
|
|
87
|
+
if (typeof part === "string") return part;
|
|
88
|
+
if (
|
|
89
|
+
part !== null &&
|
|
90
|
+
typeof part === "object" &&
|
|
91
|
+
"text" in part &&
|
|
92
|
+
typeof (part as { text: unknown }).text === "string"
|
|
93
|
+
) {
|
|
94
|
+
return (part as { text: string }).text;
|
|
95
|
+
}
|
|
96
|
+
return "";
|
|
97
|
+
})
|
|
98
|
+
.join("");
|
|
99
|
+
}
|
|
100
|
+
return content === undefined || content === null ? "" : String(content);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface InHouseJudgeOptions {
|
|
104
|
+
model: string;
|
|
105
|
+
/** explicit key; falls back to process.env.GOOGLE_API_KEY when omitted. */
|
|
106
|
+
apiKey?: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Build the in-house JudgeInvoke. Asserts model + creds SYNCHRONOUSLY (so a
|
|
111
|
+
* misconfiguration fails fast, in the caller, not deep in an async call). The
|
|
112
|
+
* SDK is imported LAZILY inside the returned function — the gate never reaches
|
|
113
|
+
* that path. temperature is pinned to 0 (C-PIN: byte-identical reruns).
|
|
114
|
+
*/
|
|
115
|
+
export function createInHouseJudge(opts: InHouseJudgeOptions): JudgeInvoke {
|
|
116
|
+
assertSupportedModel(opts.model);
|
|
117
|
+
const apiKey = assertCreds(opts.apiKey ?? process.env.GOOGLE_API_KEY);
|
|
118
|
+
|
|
119
|
+
return async (systemPrompt: string, userPrompt: string): Promise<string> => {
|
|
120
|
+
// Lazy import — the deterministic harness never loads the provider SDK.
|
|
121
|
+
const mod = (await import("@langchain/google-genai")) as unknown as {
|
|
122
|
+
ChatGoogleGenerativeAI: ChatGoogleCtor;
|
|
123
|
+
};
|
|
124
|
+
const client = new mod.ChatGoogleGenerativeAI({
|
|
125
|
+
model: opts.model,
|
|
126
|
+
temperature: 0, // judging is a classification — pinned deterministic decoding
|
|
127
|
+
apiKey,
|
|
128
|
+
});
|
|
129
|
+
const response = await client.invoke([
|
|
130
|
+
["system", systemPrompt],
|
|
131
|
+
["human", userPrompt],
|
|
132
|
+
]);
|
|
133
|
+
return extractContentText(response.content);
|
|
134
|
+
};
|
|
135
|
+
}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/lint-grounding.ts — GA the deterministic grounding-lint floor (L3).
|
|
3
|
+
* ---------------------------------------------------------------------------
|
|
4
|
+
* A pure, code-only lint that runs BEFORE any judgement and enforces the cheap,
|
|
5
|
+
* mechanical grounding hygiene the LLM should never have to be trusted with:
|
|
6
|
+
*
|
|
7
|
+
* R1 assumption-token-without-surfaced-assumption — text that hedges
|
|
8
|
+
* ("assume", "presumably", "likely", "should", "expected to", …) WITHOUT a
|
|
9
|
+
* surfaced assumption is a hidden premise → flag.
|
|
10
|
+
* R2 every claim → resolvable ref (L2 floor) — a judge-class `observed`
|
|
11
|
+
* criterion must cite ≥1 ref (and, when traces are supplied, ≥1 must
|
|
12
|
+
* RE-RESOLVE exact-match). Code-class rows verify FREE → exempt.
|
|
13
|
+
* R3 ground absence (L3) — an OBSERVED judge-class absence claim ("did not",
|
|
14
|
+
* "never", "no X", "missing", "without") needs a positive check of the
|
|
15
|
+
* field where X would be → ≥1 cited ref that re-resolves. Scoped to
|
|
16
|
+
* `observed` (mirrors R2): an INFERRED criterion deliberately empties its
|
|
17
|
+
* refs, so its absence wording is a good-practice guard, NOT flagged.
|
|
18
|
+
*
|
|
19
|
+
* GRANDFATHER (regression-safety rule #3): findings on a NEWLY-MINTED artifact
|
|
20
|
+
* are ERRORS (`ok=false`); findings on a PRE-EXISTING artifact are WARNINGS
|
|
21
|
+
* (`ok=true`). `isNew` selects which — never retroactively voids old evals.
|
|
22
|
+
*
|
|
23
|
+
* PURE — no clock/random/network. Deterministic findings in criterion order.
|
|
24
|
+
*/
|
|
25
|
+
import {
|
|
26
|
+
Grounding,
|
|
27
|
+
MetricSubstrate,
|
|
28
|
+
assertGroundingHonest,
|
|
29
|
+
type CriterionVerdict,
|
|
30
|
+
type EvalTrace,
|
|
31
|
+
type MinedCriterion,
|
|
32
|
+
} from "./contracts/eval-types.ts";
|
|
33
|
+
|
|
34
|
+
/** Hedge tokens that signal an un-surfaced assumption (R1). */
|
|
35
|
+
const ASSUMPTION_TOKENS: readonly string[] = [
|
|
36
|
+
"assume",
|
|
37
|
+
"assuming",
|
|
38
|
+
"presumably",
|
|
39
|
+
"probably",
|
|
40
|
+
"likely",
|
|
41
|
+
"should be",
|
|
42
|
+
"should have",
|
|
43
|
+
"expected to",
|
|
44
|
+
"i think",
|
|
45
|
+
"seems to",
|
|
46
|
+
"appears to",
|
|
47
|
+
"must have",
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
/** Absence-claim tokens (R3) — a negative claim needs a positive field check. */
|
|
51
|
+
const ABSENCE_TOKENS: readonly string[] = [
|
|
52
|
+
"did not",
|
|
53
|
+
"didn't",
|
|
54
|
+
"never",
|
|
55
|
+
"no ",
|
|
56
|
+
"not ",
|
|
57
|
+
"missing",
|
|
58
|
+
"without",
|
|
59
|
+
"absent",
|
|
60
|
+
"failed to",
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
export interface LintFinding {
|
|
64
|
+
criterionId: string;
|
|
65
|
+
rule: "R1-assumption-token" | "R2-claim-needs-ref" | "R3-ground-absence";
|
|
66
|
+
level: "error" | "warn";
|
|
67
|
+
message: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface LintOptions {
|
|
71
|
+
/** newly-minted artifact ⇒ findings are ERRORS; pre-existing ⇒ WARNINGS. */
|
|
72
|
+
isNew?: boolean;
|
|
73
|
+
/** trace batch for R2 exact re-resolution (optional — structural-only if absent). */
|
|
74
|
+
traces?: EvalTrace[];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface LintResult {
|
|
78
|
+
findings: LintFinding[];
|
|
79
|
+
errorCount: number;
|
|
80
|
+
warnCount: number;
|
|
81
|
+
/** false iff ≥1 ERROR-level finding (only possible on a new artifact). */
|
|
82
|
+
ok: boolean;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function lower(s: string): string {
|
|
86
|
+
return s.toLowerCase();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function hasToken(haystack: string, tokens: readonly string[]): boolean {
|
|
90
|
+
const h = lower(haystack);
|
|
91
|
+
return tokens.some((t) => h.includes(t));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Is this criterion a CODE-class row (verifies FREE → exempt from R2/R3)? */
|
|
95
|
+
function isCodeClass(c: MinedCriterion): boolean {
|
|
96
|
+
return c.metadata.substrate === MetricSubstrate.Code;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Lint ONE mined criterion. Returns findings (level fixed by `isNew`). PURE. */
|
|
100
|
+
export function lintGroundingCriterion(
|
|
101
|
+
c: MinedCriterion,
|
|
102
|
+
opts: LintOptions = {},
|
|
103
|
+
): LintFinding[] {
|
|
104
|
+
const level: LintFinding["level"] = opts.isNew === true ? "error" : "warn";
|
|
105
|
+
const out: LintFinding[] = [];
|
|
106
|
+
const text = `${c.statement} ${c.discovery.targets} ${c.discovery.why_problem} ${c.discovery.reasoning}`;
|
|
107
|
+
const surfaced = c.discovery.assumptions.length > 0;
|
|
108
|
+
|
|
109
|
+
// R1 — hedge token without a surfaced assumption.
|
|
110
|
+
if (hasToken(text, ASSUMPTION_TOKENS) && !surfaced) {
|
|
111
|
+
out.push({
|
|
112
|
+
criterionId: c.id,
|
|
113
|
+
rule: "R1-assumption-token",
|
|
114
|
+
level,
|
|
115
|
+
message:
|
|
116
|
+
"text hedges (assumption token present) but surfaces NO assumption — " +
|
|
117
|
+
"a hidden premise; surface it as a typed assumption.",
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const observed = c.discovery.evidence.grounding === Grounding.Observed;
|
|
122
|
+
const codeFree = isCodeClass(c);
|
|
123
|
+
|
|
124
|
+
// R2 — judge-class observed claim must cite ≥1 (re-resolving) ref.
|
|
125
|
+
if (observed && !codeFree) {
|
|
126
|
+
if (c.discovery.evidence.refs.length === 0) {
|
|
127
|
+
out.push({
|
|
128
|
+
criterionId: c.id,
|
|
129
|
+
rule: "R2-claim-needs-ref",
|
|
130
|
+
level,
|
|
131
|
+
message: "observed (judge-class) criterion cites NO refs — every claim needs a resolvable ref.",
|
|
132
|
+
});
|
|
133
|
+
} else if (opts.traces !== undefined && opts.traces.length > 0) {
|
|
134
|
+
let resolves = true;
|
|
135
|
+
try {
|
|
136
|
+
assertGroundingHonest(c, opts.traces);
|
|
137
|
+
} catch {
|
|
138
|
+
resolves = false;
|
|
139
|
+
}
|
|
140
|
+
if (!resolves) {
|
|
141
|
+
out.push({
|
|
142
|
+
criterionId: c.id,
|
|
143
|
+
rule: "R2-claim-needs-ref",
|
|
144
|
+
level,
|
|
145
|
+
message: "observed criterion's refs do NOT re-resolve exact-match against the trace batch.",
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// R3 — absence claim on an OBSERVED judge-class row needs a positive field
|
|
152
|
+
// check (a re-resolving ref). Scoped to `observed && !codeFree` to MIRROR R2:
|
|
153
|
+
// an INFERRED criterion deliberately empties its refs (deriveMinedCriteria) —
|
|
154
|
+
// its absence wording is a good-practice guard, not an ungrounded observation,
|
|
155
|
+
// so it must NOT trigger R3. The observed path is NOT weakened: an observed
|
|
156
|
+
// absence claim with no ref — OR with a ref that does not re-resolve against
|
|
157
|
+
// the supplied trace batch — still fires.
|
|
158
|
+
if (observed && !codeFree && hasToken(text, ABSENCE_TOKENS)) {
|
|
159
|
+
if (c.discovery.evidence.refs.length === 0) {
|
|
160
|
+
out.push({
|
|
161
|
+
criterionId: c.id,
|
|
162
|
+
rule: "R3-ground-absence",
|
|
163
|
+
level,
|
|
164
|
+
message:
|
|
165
|
+
"observed (judge-class) absence claim ('did not'/'never'/'no …') with no " +
|
|
166
|
+
"cited ref — ground the absence with a positive check of the field where " +
|
|
167
|
+
"the behavior would appear.",
|
|
168
|
+
});
|
|
169
|
+
} else if (opts.traces !== undefined && opts.traces.length > 0) {
|
|
170
|
+
let resolves = true;
|
|
171
|
+
try {
|
|
172
|
+
assertGroundingHonest(c, opts.traces);
|
|
173
|
+
} catch {
|
|
174
|
+
resolves = false;
|
|
175
|
+
}
|
|
176
|
+
if (!resolves) {
|
|
177
|
+
out.push({
|
|
178
|
+
criterionId: c.id,
|
|
179
|
+
rule: "R3-ground-absence",
|
|
180
|
+
level,
|
|
181
|
+
message:
|
|
182
|
+
"observed (judge-class) absence claim's ref does NOT re-resolve exact-match " +
|
|
183
|
+
"against the trace batch — ground the absence with a positive field check.",
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return out;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/** Lint a batch of mined criteria. PURE — deterministic, criterion order. */
|
|
193
|
+
export function lintGrounding(
|
|
194
|
+
criteria: MinedCriterion[],
|
|
195
|
+
opts: LintOptions = {},
|
|
196
|
+
): LintResult {
|
|
197
|
+
const findings = criteria.flatMap((c) => lintGroundingCriterion(c, opts));
|
|
198
|
+
const errorCount = findings.filter((f) => f.level === "error").length;
|
|
199
|
+
const warnCount = findings.filter((f) => f.level === "warn").length;
|
|
200
|
+
return { findings, errorCount, warnCount, ok: errorCount === 0 };
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Lint a JUDGE VERDICT (the GA `*build-evals`/`*evaluate` floor): R1 hedge
|
|
205
|
+
* tokens in the critique without a surfaced assumption, and an `uncertain`
|
|
206
|
+
* verdict that carries NO `blockedBy` (an unrouted abstain). PURE.
|
|
207
|
+
*/
|
|
208
|
+
export function lintVerdict(v: CriterionVerdict, opts: LintOptions = {}): LintFinding[] {
|
|
209
|
+
const level: LintFinding["level"] = opts.isNew === true ? "error" : "warn";
|
|
210
|
+
const out: LintFinding[] = [];
|
|
211
|
+
const surfaced = (v.assumptions?.length ?? 0) > 0 || v.blockedBy !== undefined;
|
|
212
|
+
if (hasToken(v.critique, ASSUMPTION_TOKENS) && !surfaced) {
|
|
213
|
+
out.push({
|
|
214
|
+
criterionId: v.criterionId,
|
|
215
|
+
rule: "R1-assumption-token",
|
|
216
|
+
level,
|
|
217
|
+
message: "critique hedges but surfaces no assumption / blockedBy — a hidden premise.",
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
if (v.result === "uncertain" && v.blockedBy === undefined) {
|
|
221
|
+
out.push({
|
|
222
|
+
criterionId: v.criterionId,
|
|
223
|
+
rule: "R3-ground-absence",
|
|
224
|
+
level,
|
|
225
|
+
message: "uncertain verdict with NO blockedBy — an unrouted abstain; type the blocker.",
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
return out;
|
|
229
|
+
}
|