@mutagent/evaluator 0.1.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/.claude/skills/mutagent-evaluator/SKILL.md +538 -0
  2. package/.claude/skills/mutagent-evaluator/assets/agents/audit-executor.md +169 -0
  3. package/.claude/skills/mutagent-evaluator/assets/agents/dataset-builder.md +160 -0
  4. package/.claude/skills/mutagent-evaluator/assets/agents/discovery.md +425 -0
  5. package/.claude/skills/mutagent-evaluator/assets/agents/evaluator.md +1044 -0
  6. package/.claude/skills/mutagent-evaluator/assets/brand/theme.css +213 -0
  7. package/.claude/skills/mutagent-evaluator/assets/brand/wordmark.html +9 -0
  8. package/.claude/skills/mutagent-evaluator/lenses/context-flow-lens.md +85 -0
  9. package/.claude/skills/mutagent-evaluator/lenses/data-lens.md +47 -0
  10. package/.claude/skills/mutagent-evaluator/lenses/decision-lens.md +48 -0
  11. package/.claude/skills/mutagent-evaluator/lenses/methodology-critic-lens.md +53 -0
  12. package/.claude/skills/mutagent-evaluator/lenses/trajectory-lens.md +44 -0
  13. package/.claude/skills/mutagent-evaluator/references/build-review-interface.md +83 -0
  14. package/.claude/skills/mutagent-evaluator/references/edd-loop.md +134 -0
  15. package/.claude/skills/mutagent-evaluator/references/error-analysis.md +113 -0
  16. package/.claude/skills/mutagent-evaluator/references/eval-audit.md +154 -0
  17. package/.claude/skills/mutagent-evaluator/references/eval-stage.md +168 -0
  18. package/.claude/skills/mutagent-evaluator/references/generate-synthetic-data.md +81 -0
  19. package/.claude/skills/mutagent-evaluator/references/grounded-adjudication.md +221 -0
  20. package/.claude/skills/mutagent-evaluator/references/memory-format.md +65 -0
  21. package/.claude/skills/mutagent-evaluator/references/methodology.md +201 -0
  22. package/.claude/skills/mutagent-evaluator/references/operation-inventory.md +196 -0
  23. package/.claude/skills/mutagent-evaluator/references/validate-evaluator.md +125 -0
  24. package/.claude/skills/mutagent-evaluator/references/workflows/orchestrator-protocol.md +287 -0
  25. package/.claude/skills/mutagent-evaluator/references/write-judge-prompt.md +123 -0
  26. package/.claude/skills/mutagent-evaluator/schemas/behavior-tree.schema.yaml +73 -0
  27. package/.claude/skills/mutagent-evaluator/schemas/dataset.schema.yaml +66 -0
  28. package/.claude/skills/mutagent-evaluator/schemas/edd-change-request.schema.yaml +114 -0
  29. package/.claude/skills/mutagent-evaluator/schemas/eval-matrix.schema.yaml +74 -0
  30. package/.claude/skills/mutagent-evaluator/schemas/flow-graph.schema.yaml +69 -0
  31. package/.claude/skills/mutagent-evaluator/schemas/flow-profile.schema.yaml +49 -0
  32. package/.claude/skills/mutagent-evaluator/schemas/methodology-review.schema.yaml +40 -0
  33. package/.claude/skills/mutagent-evaluator/schemas/scorecard.schema.yaml +85 -0
  34. package/.claude/skills/mutagent-evaluator/scripts/agent-dispatch.ts +0 -0
  35. package/.claude/skills/mutagent-evaluator/scripts/aggregate-discover.ts +543 -0
  36. package/.claude/skills/mutagent-evaluator/scripts/artifact-paths.ts +99 -0
  37. package/.claude/skills/mutagent-evaluator/scripts/assemble-scorecard.ts +172 -0
  38. package/.claude/skills/mutagent-evaluator/scripts/build-dataset.ts +186 -0
  39. package/.claude/skills/mutagent-evaluator/scripts/build-evals.ts +93 -0
  40. package/.claude/skills/mutagent-evaluator/scripts/build-review-ui.ts +393 -0
  41. package/.claude/skills/mutagent-evaluator/scripts/check-method-router.ts +170 -0
  42. package/.claude/skills/mutagent-evaluator/scripts/cli/aggregate.ts +112 -0
  43. package/.claude/skills/mutagent-evaluator/scripts/cli/audit-run.ts +175 -0
  44. package/.claude/skills/mutagent-evaluator/scripts/cli/doctor.ts +211 -0
  45. package/.claude/skills/mutagent-evaluator/scripts/cli/dogfood.ts +133 -0
  46. package/.claude/skills/mutagent-evaluator/scripts/cli/init.ts +601 -0
  47. package/.claude/skills/mutagent-evaluator/scripts/cli/methodology-review.ts +122 -0
  48. package/.claude/skills/mutagent-evaluator/scripts/cli/prep.ts +279 -0
  49. package/.claude/skills/mutagent-evaluator/scripts/cli/profile-subject.ts +165 -0
  50. package/.claude/skills/mutagent-evaluator/scripts/cli/run.sh +56 -0
  51. package/.claude/skills/mutagent-evaluator/scripts/cli/variance-check.ts +105 -0
  52. package/.claude/skills/mutagent-evaluator/scripts/code-eval.ts +248 -0
  53. package/.claude/skills/mutagent-evaluator/scripts/codegen-evals.ts +173 -0
  54. package/.claude/skills/mutagent-evaluator/scripts/cold-start-project.ts +151 -0
  55. package/.claude/skills/mutagent-evaluator/scripts/cold-start-sampler.ts +267 -0
  56. package/.claude/skills/mutagent-evaluator/scripts/config/load.ts +307 -0
  57. package/.claude/skills/mutagent-evaluator/scripts/config/schema.ts +325 -0
  58. package/.claude/skills/mutagent-evaluator/scripts/contracts/agentspec-evals.ts +85 -0
  59. package/.claude/skills/mutagent-evaluator/scripts/contracts/dataset.ts +149 -0
  60. package/.claude/skills/mutagent-evaluator/scripts/contracts/eval-engine.ts +118 -0
  61. package/.claude/skills/mutagent-evaluator/scripts/contracts/eval-matrix.ts +577 -0
  62. package/.claude/skills/mutagent-evaluator/scripts/contracts/eval-types.ts +1074 -0
  63. package/.claude/skills/mutagent-evaluator/scripts/contracts/flow-graph.ts +194 -0
  64. package/.claude/skills/mutagent-evaluator/scripts/contracts/types.ts +303 -0
  65. package/.claude/skills/mutagent-evaluator/scripts/contracts/validation.ts +193 -0
  66. package/.claude/skills/mutagent-evaluator/scripts/derive-dataset.ts +152 -0
  67. package/.claude/skills/mutagent-evaluator/scripts/determine-outcome.ts +219 -0
  68. package/.claude/skills/mutagent-evaluator/scripts/diff-discriminate.ts +160 -0
  69. package/.claude/skills/mutagent-evaluator/scripts/discover-criteria.ts +348 -0
  70. package/.claude/skills/mutagent-evaluator/scripts/edd/change-request.ts +232 -0
  71. package/.claude/skills/mutagent-evaluator/scripts/edd/edd-types.ts +210 -0
  72. package/.claude/skills/mutagent-evaluator/scripts/edd/variance-gate.ts +186 -0
  73. package/.claude/skills/mutagent-evaluator/scripts/emit-completeness.ts +111 -0
  74. package/.claude/skills/mutagent-evaluator/scripts/eval-engine.ts +160 -0
  75. package/.claude/skills/mutagent-evaluator/scripts/evaluate.ts +333 -0
  76. package/.claude/skills/mutagent-evaluator/scripts/flow-graph.ts +230 -0
  77. package/.claude/skills/mutagent-evaluator/scripts/judge-prompt-template.ts +253 -0
  78. package/.claude/skills/mutagent-evaluator/scripts/judge-provider.ts +135 -0
  79. package/.claude/skills/mutagent-evaluator/scripts/lint-grounding.ts +229 -0
  80. package/.claude/skills/mutagent-evaluator/scripts/lint-uniformity.ts +168 -0
  81. package/.claude/skills/mutagent-evaluator/scripts/living-suite.ts +109 -0
  82. package/.claude/skills/mutagent-evaluator/scripts/load-bundle.ts +203 -0
  83. package/.claude/skills/mutagent-evaluator/scripts/load-profile-vocab.ts +64 -0
  84. package/.claude/skills/mutagent-evaluator/scripts/load-profile.ts +106 -0
  85. package/.claude/skills/mutagent-evaluator/scripts/mask.ts +138 -0
  86. package/.claude/skills/mutagent-evaluator/scripts/materialize-dataset.ts +113 -0
  87. package/.claude/skills/mutagent-evaluator/scripts/matrix-judge.ts +750 -0
  88. package/.claude/skills/mutagent-evaluator/scripts/memory/append.ts +215 -0
  89. package/.claude/skills/mutagent-evaluator/scripts/memory/read.ts +168 -0
  90. package/.claude/skills/mutagent-evaluator/scripts/prep-tasks.ts +125 -0
  91. package/.claude/skills/mutagent-evaluator/scripts/profile-subject.ts +310 -0
  92. package/.claude/skills/mutagent-evaluator/scripts/publish-report.ts +131 -0
  93. package/.claude/skills/mutagent-evaluator/scripts/read-unitf-traces.ts +81 -0
  94. package/.claude/skills/mutagent-evaluator/scripts/render-build-cards.ts +195 -0
  95. package/.claude/skills/mutagent-evaluator/scripts/render-discover-report.ts +1640 -0
  96. package/.claude/skills/mutagent-evaluator/scripts/render-eval-report.ts +3823 -0
  97. package/.claude/skills/mutagent-evaluator/scripts/render-report.ts +212 -0
  98. package/.claude/skills/mutagent-evaluator/scripts/resolve-credential.ts +110 -0
  99. package/.claude/skills/mutagent-evaluator/scripts/resolve-ref.ts +98 -0
  100. package/.claude/skills/mutagent-evaluator/scripts/result-verify.ts +129 -0
  101. package/.claude/skills/mutagent-evaluator/scripts/route-failures.ts +320 -0
  102. package/.claude/skills/mutagent-evaluator/scripts/run-deterministic.ts +271 -0
  103. package/.claude/skills/mutagent-evaluator/scripts/run-evaluate.ts +715 -0
  104. package/.claude/skills/mutagent-evaluator/scripts/run-judge.ts +155 -0
  105. package/.claude/skills/mutagent-evaluator/scripts/run-pipeline.ts +175 -0
  106. package/.claude/skills/mutagent-evaluator/scripts/sample-traces.ts +210 -0
  107. package/.claude/skills/mutagent-evaluator/scripts/self-audit.ts +387 -0
  108. package/.claude/skills/mutagent-evaluator/scripts/source-map.ts +106 -0
  109. package/.claude/skills/mutagent-evaluator/scripts/subject-profile.ts +134 -0
  110. package/.claude/skills/mutagent-evaluator/scripts/substrate.ts +162 -0
  111. package/.claude/skills/mutagent-evaluator/scripts/ui-slots.ts +119 -0
  112. package/.claude/skills/mutagent-evaluator/scripts/unitf-to-evaltrace.ts +284 -0
  113. package/.claude/skills/mutagent-evaluator/scripts/validate-judge.ts +358 -0
  114. package/.claude/skills/mutagent-evaluator/scripts/variance-compare.ts +177 -0
  115. package/.claude/skills/mutagent-evaluator/subjects/mutagent-diagnostics/behavior-tree.yaml +140 -0
  116. package/.claude/skills/mutagent-evaluator/subjects/mutagent-diagnostics/eval-matrix.yaml +1270 -0
  117. package/.claude/skills/mutagent-evaluator/subjects/mutagent-diagnostics/methodology-review.yaml +105 -0
  118. package/.claude/skills/mutagent-evaluator/workflows/audit.workflow.js +82 -0
  119. package/.claude/skills/mutagent-evaluator/workflows/data-leak.workflow.js +236 -0
  120. package/.claude/skills/mutagent-evaluator/workflows/variance.workflow.js +163 -0
  121. package/LICENSE +201 -0
  122. package/NOTICE +23 -0
  123. package/README.md +90 -0
  124. package/bin/mutagent-cli.mjs +9263 -0
  125. package/bin/mutagent-evaluator.mjs +96 -0
  126. package/package.json +52 -0
@@ -0,0 +1,538 @@
1
+ ---
2
+ name: mutagent-evaluator
3
+ description: |
4
+ Evaluation-development engine for AI agents and skills. Turns a subject (a skill/agent +
5
+ its traces) into a TRUSTWORTHY eval suite: deep-reads traces to determine success/failure
6
+ (even when nothing is user-marked), mines emergent BINARY ACTIONABLE criteria from the
7
+ ✓/✗ split, builds one critique-before-verdict LLM-judge (or code-check) per criterion,
8
+ validates each judge against human labels (TPR/TNR · Rogan-Gladen · bootstrap CI), then
9
+ runs the suite against a target → per-criterion binary+confidence → severity-gated GATE
10
+ verdict + agent-variance view. A judge is ONLY a judge: failures are flagged and ROUTED to
11
+ diagnostics, never fixed here (EV-051). First invocation auto-detects the subject + the
12
+ framework-substrate choice (DEFAULT agent-dispatch — host-runtime subagents, no provider ·
13
+ in-house AI-SDK judge optional · code-based · user's framework export).
14
+ Subsequent invocations dispatch the parent session + MASS-PARALLEL evaluator
15
+ sub-agents (one cell, discover / judge modes; host runtime, harness-capped) against the subject's traces. ALSO surfaces the existing v1 4-tab static-auditor
16
+ (eval-matrix · data-leak · variance · methodology) via *audit. Pinned judge model + temp=0
17
+ for byte-identical reruns (C-PIN). Usable standalone OR borrowed by mutagent-skill-builder's
18
+ SIMULATE phase as the SimVerifier.
19
+ license: Proprietary. LICENSE.txt has complete terms.
20
+ compatibility: Designed for Claude Code, Codex, Cursor, OpenCode and similar coding-agent runtimes; works with git, gh CLI, jq, curl, and Bun/pnpm/npm runtimes.
21
+ metadata:
22
+ author: mutagent
23
+ version: "0.1.0-alpha.2"
24
+ # allowed-tools: OMITTED — agent uses all native tools per host runtime
25
+ ---
26
+
27
+ # mutagent-evaluator
28
+
29
+ Evaluation-development-on-Tap for AI agents/skills. Invoke this skill to build a trustworthy
30
+ eval suite for a subject and run it to a GATE verdict.
31
+
32
+ > **DRAFT — NOT YET PUBLISHED.** Operator tags `evaluator-v*` only after real-run verification.
33
+
34
+ ## §0 — Setup Detection (ALWAYS runs first)
35
+
36
+ > **CWD matters.** Every `scripts/cli/run.sh`-dispatched script MUST be invoked from the
37
+ > operator's PROJECT ROOT, NOT from inside the skill install path. Scripts defensively reject
38
+ > invocations from any path containing `.claude/skills/` so the skill never mis-reads its own
39
+ > install dir as the subject. Use absolute paths in the `Bash()` call if your shell is elsewhere.
40
+
41
+ Two things are detected before any eval work:
42
+
43
+ 1. **Subject** (EV-049) — what is being evaluated. The subject profile is AUTO-GENERATED from
44
+ code / platform / trace exploration, **never hand-authored**. `*discover-evals` infers the subject's
45
+ tool inventory + event-type taxonomy by scrolling traces (`observations[].type=="TOOL"`).
46
+ *Worked example:* the sample-email-agent profile is a 35-tool talent-opportunity agent on the
47
+ Vercel AI SDK — inferred, not declared (see sample-findings).
48
+ 2. **Framework-substrate** (EV-050) — HOW judges run. The **DEFAULT is agent-dispatch**:
49
+ verdicts are produced by parent-session-dispatched `evaluator` (judge / discover modes) leaf
50
+ subagents reasoning on the **HOST runtime** (Claude Code, diagnostics-style MASS-DISPATCH for
51
+ throughput) and read back from verdict FILES — the default path calls NO provider SDK
52
+ (`scripts/agent-dispatch.ts` · `references/workflows/orchestrator-protocol.md`). The other
53
+ onboarding choices remain a real fork: **in-house AI-SDK / LiteLLM judge** (`@langchain/google-genai`
54
+ shape, temp=0, model-intent-sacred) is KEPT but **DEMOTED to OPTIONAL** (a provider-call path
55
+ for CI / code-based export) · **code-based** checks for objective criteria · **user's framework**
56
+ (Vitest / promptfoo / Braintrust) as an EXPORT target. Temperature is pinned 0 on every
57
+ transport (C-PIN); the host's pinned model is the judge under agent-dispatch.
58
+
59
+ ```typescript
60
+ // PSEUDOCODE — actual execution is agent-native
61
+ const setup = await Bash("scripts/cli/run.sh scripts/profile-subject.ts --detect");
62
+ if (!setup.complete) {
63
+ // → Onboarding: subject auto-gen + substrate choice (references/error-analysis.md Step 1)
64
+ } else {
65
+ // → Eval-dev: parent session follows the *command spine inline.
66
+ // DO NOT dispatch a coordinator sub-agent — the parent session IS the orchestrator.
67
+ }
68
+ ```
69
+
70
+ **Do NOT dispatch a coordinator sub-agent.** The parent session orchestrates; only leaf workers
71
+ (the `evaluator` cell, any mode) are sub-agents. (Sub-agents cannot dispatch sub-agents or invoke
72
+ AskUserQuestion.)
73
+
74
+ ### §0.1 — Star-commands
75
+
76
+ `*command` tokens are this skill's internal semantic map. `@shortcut` tokens are the architech
77
+ resolver (external). Never mix them.
78
+
79
+ **Resolution contract:** when you encounter a `*<name>` token, look it up in the `commands:`
80
+ table below. `kind: script` → call the bound script. `kind: agent-chain` → load the bound
81
+ workflow/agent and run steps in order. `kind: hybrid` → call script(s) for deterministic parts,
82
+ reason for the rest. NEVER improvise.
83
+
84
+ > **Default mechanism = agent-dispatch.** `*discover-evals` / `*build-evals` / `*evaluate` run the
85
+ > parent-session dispatch FSM in `references/workflows/orchestrator-protocol.md`: PREP
86
+ > (`scripts/prep-tasks.ts` → task-spec files) → DISPATCH leaf subagents MASS-PARALLEL on the host
87
+ > runtime (they write verdict files) → AGGREGATE (`scripts/run-pipeline.ts` reads the verdict files
88
+ > via `scripts/agent-dispatch.ts`). The in-house provider judge is the OPTIONAL substrate fallback.
89
+
90
+ > **Code/agent hybrid at the command level (GA — mirrors diagnostics).** Each command is a
91
+ > DETERMINISTIC SKELETON with an LLM LEAF only where judgement is irreducible — exactly the
92
+ > slicer/tier0 (code) + analyzers (LLM) split diagnostics uses. The **code skeleton** owns sample ·
93
+ > `resolve-ref` · `lint-grounding` · `diff-discriminate` · aggregate · gate · code-class criteria;
94
+ > the **LLM leaf** owns determine · critique · adjudicate · verify · localize · judge-class criteria.
95
+ > The split is named per-command in the `code:` / `LLM:` column intent below. **`*evaluate` may now
96
+ > return `incomplete`** — the one caller-visible GA delta: a CRIT/HIGH criterion that adjudicated
97
+ > indeterminate no longer silently passes (the gate is `fail ▸ incomplete ▸ pass`). See
98
+ > `references/grounded-adjudication.md`.
99
+
100
+ | Command | Kind | Binds (relative) | Purpose |
101
+ |---------|------|-------------------|---------|
102
+ | `*discover-evals` | hybrid | `references/workflows/orchestrator-protocol.md` + `scripts/prep-tasks.ts` + `scripts/determine-outcome.ts` + `scripts/discover-criteria.ts` + `assets/agents/evaluator.md` (`#mode-discover`) | PREP determiner tasks → fan out `evaluator` (`#mode-discover`, mass-parallel) → AGGREGATE ✓/✗ → mine emergent BINARY ACTIONABLE criteria (EV-041/042/052) **+ T6 failure/uncertain DATASET CANDIDATES** (`collectDatasetCandidates`, reuses the derive-dataset selectors → `*build-dataset`). **GA split** — **code:** sample (broken+healthy) · aggregate · `diff-discriminate` · ground-gate · dataset-candidates; **LLM leaf:** determine + 3 detectors + cite refs + typed assumptions (root-not-symptom). |
103
+ | `*build-evals` | hybrid | `references/workflows/orchestrator-protocol.md` + `scripts/eval-engine.ts` + `scripts/codegen-evals.ts` + `scripts/prep-tasks.ts` + `scripts/build-evals.ts` + `assets/agents/evaluator.md` (`#mode-judge-criterion`) + `scripts/render-build-cards.ts` | **ENGINE-FORK FIRST (ADL F7/F9/F14).** ASKS the eval implementation mode via `chooseEvalEngineOptions(target)` — Path A `native-matrix` (eval-matrix + LLM-judge SUB-AGENTS; SURFACES the Claude-Code + log-sink dependency up front) vs Path B `code-written` (`codegen-evals.ts` emits a portable bun/TS suite — runs WITHOUT Claude Code, F14). Target-conditional: a code framework offers BOTH, a `harness:*` target is native-only. **Path A** then PREPs judge tasks (criterion × trace-slice) → fan out `evaluator` (`#mode-judge-criterion`, mass-parallel) → one binary+confidence judge per criterion (EV-043). **GA split** — **code:** engine-resolve · spec render · `lint-grounding` · `resolve-ref` (BIND) · codegen; **LLM leaf:** judge + VERIFY (cite refs · note assumptions · abstain). Streams progress + a verbose evals entity card (F13/F16/F22). |
104
+ | `*evaluate` | hybrid | `references/workflows/orchestrator-protocol.md` + `scripts/matrix-judge.ts` + `scripts/contracts/eval-matrix.ts` + `assets/agents/evaluator.md` (`#mode-judge-trajectory`) + `scripts/evaluate.ts` | **DEFAULT (headline):** **T1 TIER-0 deterministic pre-pass** (code-method rows run first, zero judge tokens) → PREP one matrix packet per RESIDUAL judge trajectory (**T5 adaptive-K guard, default 1:1**) → fan out `evaluator` (`#mode-judge-trajectory` — one judge/trajectory scoring the WHOLE matrix, emitting the **T2 Judge DAG v2 walk** = `judge_steps[]` + dense na-explicit map + confidence band + early-INCOMPLETE + node-2.5 candidates) → AGGREGATE: fold code+judge verdicts → **T3 independent verifier** refutes GATING fails (downgrade-only) → **T4 consolidate-by-locus + walk-derived health** → GATE verdict + variance view (EV-048). **GA split** — **code:** tier-0 · prep · `lint-grounding` · `resolve-ref` · `assemble-scorecard` (gate `fail ▸ incomplete ▸ pass`) · consolidate-by-locus · route-failures; **LLM leaf:** trajectory judge (DAG v2 walk: BIND · GROUND[absence-split] · cite · abstain) + independent VERIFY. **MAY now return `incomplete`** (indeterminate → calibrate). **ADL F20:** the rollup ALSO renders a SCORECARD DASHBOARD wireframe (`renderScorecardDashboard` — per-criterion pass/fail bar + variance + samples), not a flat terminal dump. Under a **Path B** engine, `*evaluate` instead runs the portable `codegen-evals.ts` suite (no Claude Code) and reads back its scorecard JSON from the discoverable sink. |
105
+ | `*improve` | hybrid | `references/edd-loop.md` + `scripts/edd/variance-gate.ts` + `scripts/edd/change-request.ts` + `scripts/edd/edd-types.ts` + `schemas/edd-change-request.schema.yaml` + `assets/agents/evaluator.md` (`#mode-improve`) | **ADL ③ IMPROVE / EDD loop (F18+F19).** **F19 VARIANCE-FIRST:** repeat-N (default 5) the SAME cases → `evaluateVarianceGate` → accuracy is entered ONLY when the variance gate passes (`assertVarianceStableBeforeAccuracy` THROWS otherwise — "accuracy over big samples is wasted on a flapping verdict"). **F18 CLOSURE:** still JUDGE-ONLY (EV-051), the evaluator emits a grounded `EddChangeRequest` (failing cases + `ref{obs,path,value}` + remedy target `agentspec`\|`impl`) to the `mutagent-builder ai-engineer` over **SendMessage**, consumes the `ChangeRequestResponse`, and re-evals on `amended`. **Bounded terminator** (`decideEddLoop`, afkloop-legal): `full-green` ▸ DONE \| `max-swings`\|`max-wallclock`\|`no-improvement-streak` ▸ STOPPED + convergence delta. **GA split** — **code:** variance gate · request/response validate · loop terminator (all PURE, injected wall-clock); **LLM leaf:** localize the flap/fail to its root + author the grounded request + decide remedy target. |
106
+ | `*validate` | hybrid | `scripts/validate-judge.ts` + `references/validate-evaluator.md` + `assets/agents/evaluator.md` (`#mode-judge-criterion`) | **ENGINED (EV-044)** — calibrate a judge vs `*review` labels: confusion matrix → TPR/TNR · split-disjointness + test-once · Rogan-Gladen θ · deterministic bootstrap CI; `<MIN_LABELS` stays `unvalidated`+bias-corrected. **GA split** — **code:** entire path is deterministic (filter EXCLUDES indeterminate · confusion · RG · assumption-agreement). |
107
+ | `*review` | hybrid | `scripts/build-review-ui.ts` + `references/build-review-interface.md` | **ENGINED (EV-045)** — CODE renders a browser annotation UI (one trace/screen · Pass/Fail/Defer · keyboard · auto-save · labels export); **HITL**: a human labels → `mergeLabels` persists → feeds `*validate`. |
108
+ | `*eval` | agent-chain | `references/eval-stage.md` + `scripts/eval-engine.ts` + `scripts/materialize-dataset.ts` + `scripts/render-build-cards.ts` | **THE ADL EVAL-STAGE ENTRY (F15).** Called after `*build` hands a freshly-built agent + its agentspec. INTERACTIVELY offers `*build-dataset` / `*build-evals` derived from `agentspec.definition.evals`, and lets the user PICK THE EVAL ENGINE (mutagent native eval-matrix [Path A] vs code-written-in-target-lang [Path B]) via the target-conditional menu (`chooseEvalEngineOptions`). Surfaces Path A's Claude-Code + log-sink dependency UP FRONT (F7/F9). Streams wireframe progress + entity cards (F13/F16/F22). Parent-session only (AskUserQuestion). |
109
+ | `*build-dataset` | hybrid | `scripts/materialize-dataset.ts` + `scripts/build-dataset.ts` + `assets/agents/dataset-builder.md` + `schemas/dataset.schema.yaml` + `references/generate-synthetic-data.md` + `scripts/render-build-cards.ts` | **ENGINED (EV-046) + ADL F8.** Now MATERIALIZES real items first: `materializeFromAgentspec` seeds ≥1 REAL DatasetCase per `dataset_category` + one per `edge_case` (seed → actual items, not definitions) → then the 3-way: HITL seed interview (~10) → `dataset-builder` agent (tuples → NL queries → realism filter) → CODE cartesian-expand + near-dup drop + monotonic merge. Streams wireframe progress cards (F13/F16) + a verbose dataset entity card (F22). |
110
+ | `*discover-dataset` | script | `scripts/derive-dataset.ts` | **ENGINED (EV-047) · re-fronts the old `*derive-dataset`** — distill a living regression set from labeled ✓/✗ traces (reuses `sample-traces.ts` EV-052 selectors + `build-dataset.ts` merge). Code-only. **P-B:** consumes the `discovery` agent's curated `SelectionManifest` handoff — **scenario-balanced** (`ext.classification.scenario`), **edge-cases first** (`ext.classification.edgeCase.is`), worthiness-prioritized (`ext.signals.worthinessScore`). |
111
+ | `*audit` | agent-chain | `assets/agents/audit-executor.md` + `workflows/{audit,data-leak,variance}.workflow.js` + `scripts/{flow-graph,ui-slots}.ts` + `lenses/context-flow-lens.md` | SURFACES the v1 4-tab static-auditor (EV-001..027, KEEP) **+ now the agent context-flow audit**: tool-result threading + sub-agent handoff completeness (EV-028/029, over the `flow-graph` EV-032 + expected-flow EV-037) and the first-class **HTML-artifact missing-data** dimension (computed-but-not-rendered / orphan / faithfulness, EV-039/040, subject-agnostic). |
112
+ | `*self-audit` | hybrid | `scripts/self-audit.ts` + `assets/agents/audit-executor.md` (Mode D) + `references/eval-audit.md` | **EVAL-OF-THE-EVAL (EV-055)** — the evaluator audits its OWN eval-dev artifacts via the eval-audit six-area diagnostic: PREP `self-audit.ts` (deterministic threshold checks over the REUSED `*validate`/`*review`/`*discover-evals`/living-suite outputs → impact-ordered finding DATA) → dispatch `audit-executor` Mode D for the nuanced reads + overall verdict. Reuses `*audit` + `*validate`; rebuilds nothing. **On-demand only** (no cron/monitor/auto-fire). |
113
+
114
+ Full resolution contract verbatim:
115
+ ```
116
+ When you encounter a *<name> token:
117
+ 1. RESERVED — `*` marks a command. NOT prose, NOT a file path, NOT an @shortcut.
118
+ *command = THIS skill's semantic map (internal). @shortcut = architech resolver (external). Never mixed.
119
+ 2. RESOLVE — look up <name> in the `commands:` block. Not found => ERROR + ask. NEVER improvise.
120
+ 3. BINDING — read kind: + binds::
121
+ kind: script => binds: <relative script path> => CALL the script. Do NOT re-implement in prose.
122
+ kind: agent-chain => binds: <workflow/agent file> => load + run the steps in order.
123
+ kind: hybrid => binds: both => call script(s) for deterministic parts, reason for the rest.
124
+ 4. PRE-GATE — load any pre_gate.loads:.
125
+ 5. EXECUTE — run compresses:/workflow steps IN ORDER. Invent nothing.
126
+ 6. purpose:/impact: explain WHY (not executed). compresses: MAY reference other *commands (composition).
127
+ ```
128
+
129
+ ## §1 — Triggers
130
+
131
+ Invoke me with:
132
+ - `evaluate skill <name>` / `evaluate agent <name>` / `/mutagent-evaluator`
133
+ - `*discover-evals` (mine criteria) · `build evals for <x>` · `validate judge <x>` · `*audit <subject>`
134
+ - `*improve` (the ADL ③ EDD loop — variance-first then request-amend-reeval to full green, bounded)
135
+ - `*self-audit` (the eval-of-the-eval — audit my OWN eval-dev; on-demand only)
136
+ - borrowed by `mutagent-skill-builder` SIMULATE (SimVerifier role)
137
+ - `--reconfigure` to re-enter onboarding (subject + substrate)
138
+
139
+ ## §2 — Quick-Start
140
+
141
+ Minimal eval-dev spine (build order — do NOT reorder):
142
+
143
+ ```
144
+ *discover-evals → deep-read traces, determine ✓/✗, mine 5-10 binary actionable criteria
145
+ *build-evals → one critique-before-verdict judge (or code-check) per criterion
146
+ *evaluate → run vs target → per-criterion binary+confidence → GATE verdict + variance
147
+ *improve → ADL ③ EDD loop: F19 variance-first (stabilize per-case spread, repeat-N)
148
+ BEFORE accuracy, then F18 closure (judge-only REQUESTS the ai-engineer to
149
+ amend agentspec|impl over SendMessage → re-eval) → full green OR bounded STOP
150
+ ```
151
+
152
+ `*validate` (calibrate the judge) and `*audit` (the v1 4-tab static report) layer on top.
153
+ `*improve` is the IMPROVE stage — it runs AFTER an initial `*build` + `*evaluate` and is **bounded**
154
+ (never infinite): full-green ⇒ DONE; else max-swings / max-wallclock / no-improvement ⇒ STOP + delta.
155
+
156
+ **ADL EVAL-stage entry (`*eval`).** When `*build` hands over a freshly-built agent +
157
+ its agentspec, `*eval` is the entry: it interactively offers `*build-dataset` /
158
+ `*build-evals` derived from `agentspec.definition.evals` (F15), MATERIALIZES real
159
+ dataset items per category + edge-case (F8), lets the user PICK THE EVAL ENGINE
160
+ (Path A native eval-matrix vs Path B code-written — surfacing Path A's Claude-Code +
161
+ log-sink dependency up front, F7/F9/F14), streams wireframe progress + entity cards
162
+ (F13/F16/F22), and renders the scorecard as a dashboard (F20). See
163
+ `references/eval-stage.md` for the full flow + success gates.
164
+
165
+ **Implemented eval-dev reality (ADL P1–P5, see §4 BoM).** The spine now runs end-to-end on real data:
166
+ - **Ingest** — traces arrive as a **pre-produced UniTF JSONL handover** (one `UnifiedTrace` record per line, written by `mutagent-cli trace fetch --export`). The skill NEVER fetches: fetch + normalize live in `mutagent-cli` (run `mutagent-cli trace --help` to discover the surface). `*discover-evals`/`*evaluate` read the handed-over `.jsonl` path via `read-unitf-traces.ts` (`parseUnitfJsonl` / `readUnitfAsEvalTraces`), which projects each UniTF record → the in-package `EvalTrace` shape (`unitf-to-evaltrace.ts`, migration doc §3.2). Zero downstream contract change — sample / profile / discover / judge / scorecard consume `EvalTrace[]` unchanged.
167
+ - **Source SELECTION (run start)** — the source is bound BY ROLE from `global.sources[]` (`config/load.ts` `bindSourceByRole`). Precedence: an explicit `--source <name>` WINS · one source auto-binds · with >1, exactly one `default:true` binds silently. When >1 source exists and **none** is `default:true`, the loader returns `needs-selection` and `prep.ts` SURFACES the candidate names on stdout — the **PARENT session must PROMPT the operator to pick one** via the platform ask mechanism (**AskUserQuestion** on Claude Code · chat multi-choice elsewhere), then re-run with `--source <name>`. `default:true` or `--source` skip the prompt. `needs-selection` is **NON-fatal for gating** — the source exists; only `*discover-evals` needs a pick (code/dataset runs need no source). `>1 default:true` ⇒ `multiple-defaults` (operator fixes the config); an unmatched `--source` ⇒ `unknown-name`.
168
+ - **`*discover-evals`** — mines criteria from real leaf verdicts (`aggregate-discover.ts`), maps source topology first (`source-map.ts`), and stamps EVERY criterion with the §5b unified metadata + the §5c **DR-2 discovery rationale** (evidence-first: OBSERVED ⇔ a failure was seen with real refs + honest k/n — never inferred-as-observed). Grows an append-only living suite (saturation-stop). **T6:** also emits failure/uncertain **DATASET CANDIDATES** (`collectDatasetCandidates`) + accepts the `*evaluate` judge's node-2.5 **unmatched-detection handoff** (`unmatchedDetectionCandidates`) → both consumable by `*build-dataset`.
169
+ - **Curated Discovery handoff (P-B)** — when the traces arrive from the `discovery` SYSTEM AGENT under a PURPOSED intent (`*discover-evals` → `operationIntent: evals` · `*discover-dataset` → `operationIntent: dataset`), the handover is a **curated, classified** set: a `SelectionManifest` (`mutagent-tools` `selection.ts` — `byScenario` · `byWorthiness` · labeled/unlabeled counts) alongside `traces.jsonl` where each kept record carries `ext.signals` (deterministic worthiness from `trace select`) + `ext.classification` (`scenario` · `edgeCase` · `outcome` · `worthiness`, from the agent's LLM classify). BOTH evaluator commands READ this handoff (skills never fetch) and consume the labels: **`*discover-evals`** STRATIFIES criteria-mining by `ext.classification.scenario` and PRIORITIZES by `ext.signals.worthinessScore` (unlabeled/low-worthiness traces are kept for coverage but down-weighted); **`*discover-dataset`** distills a **scenario-balanced** regression set, **edge-cases first** (`ext.classification.edgeCase.is`), reusing the `derive-dataset.ts` selectors + `build-dataset.ts` merge. A generic `fetch` handoff (no `ext.signals`/`ext.classification`) degrades gracefully to the pre-P-B behavior. The judge/mining internals are unchanged — only the sampling/stratification READS the new curated fields.
170
+ - **Code-before-judge (EX-2)** — the §5b `check_method` routes each metric: `deterministic`→a runnable code-eval the agent executes via Bash (zero judge tokens, byte-identical), `llm-judge`→the host judge, `hybrid`→code pre-filter that gates the judge (`check-method-router.ts` + `code-eval.ts`).
171
+ - **`*evaluate`** — the real spine (`run-evaluate.ts`): **T1 tier-0** code-method pre-pass (`tier0Plan` — code rows decided deterministically, only residual judge rows dispatched) → PREP packet (**T5 `adaptivePacketPlan`** overload guard, default 1:1) → dispatch `#mode-judge-trajectory` (emits the **T2 DAG v2 walk**) → fail-loud readiness gate → fold code+judge → **T3 independent verifier** (downgrade-only on gating fails) → **T4 `consolidateByLocus` + `deriveWalkHealth`** → GATE + variance → EV-051 route-to-diagnostics; the masked scorecard is byte-identical across reruns (C-PIN).
172
+ - **Report** — terminal eval-cards + the operator-APPROVED 5-tab HTML eval-report (`render-eval-report.ts`): §1 Overview (KPIs · coverage-contract · gating table · top-findings) · §2 Trajectory‖Judge per-trace ledger + click-row Target-Agent‖Judge side-by-side · §3 Eval Scorecard cohort heatmap + nested subcards + inline calibration · §4 Findings verbatim-evidence + judge chain + agree/revise/refute · §5 Self-Eval [INTERNAL, stripped on publish]. `run-evaluate.ts` renders `report.html` post-aggregate; consumes the §9.4 judge-walk (dense na-explicit map + `judge_steps[]`) when present, degrades to the per-trajectory scorecard otherwise.
173
+
174
+ ## §3 — Architecture Overview
175
+
176
+ ```mermaid
177
+ flowchart TD
178
+ SKILL -->|§0 detect| BRANCH{subject + substrate?}
179
+ BRANCH -->|missing| ONB[Onboarding: subject auto-gen + substrate fork]
180
+ BRANCH -->|present| SPINE[Parent session follows *command spine inline]
181
+ SPINE --> DET[determine-outcome — success/failure per trace\n'inaction can be success']
182
+ DET --> DISC[*discover-evals — emergent BINARY ACTIONABLE criteria\nevaluator #mode-discover sub-agents, mass-parallel host dispatch]
183
+ DISC --> BUILD[*build-evals — one judge/code-check per criterion\ncritique-before-verdict · few-shot from TRAIN only]
184
+ BUILD --> EVAL[*evaluate — suite vs target → binary+confidence]
185
+ EVAL --> GATE{GATE — binary, severity-gated}
186
+ GATE -->|fail| ROUTE[route-failures → mutagent-diagnostics\nEV-051: judge-only, never fix]
187
+ GATE -->|pass| SCORE[Verdict + scorecard + variance view]
188
+ ```
189
+
190
+ **Two foundations.** (1) *Success/failure determination* (EV-042) — the determiner reads the
191
+ event + tool trajectory + terminal state and decides goal-attainment; criteria can only be mined
192
+ once ✓/✗ labels exist, and real exports usually carry NONE (sample: 0 scores / 0 tags on all
193
+ 1946 traces). (2) *Judge validation* (EV-043/W2) — a judge is trusted only after it aligns with
194
+ human labels. The evaluator is a **reviewer, never an executor**: it never grades a run it
195
+ produced, and it never fixes — it routes failures to diagnostics.
196
+
197
+ ### §3.1 — Output shape (verdict + scorecard)
198
+
199
+ `*evaluate` emits a two-part artifact under `.mutagent/evaluator/{runId}/`:
200
+
201
+ | Part | Content |
202
+ |------|---------|
203
+ | **`scorecard.json`** | Per-criterion `{criterionId, class, verdict: pass\|fail\|indeterminate, confidence, critique, refs[], assumptions[], blockedBy?, sourceTraceIds[], severity}` + the rolled-up GATE (`componentPass[]` → `runVerdict`) + the agent-variance block (`scoreVariance` across reruns · `trajectoryVariance` per behavior-tree node). The pinned `judgeModel` + `temperature` are stamped at the top (C-PIN provenance). |
204
+ | **verdict report** | Human-readable rollup — headline GATE pass/incomplete/fail, the per-criterion ✓/✗/⏸ table (indeterminate shows its `blockedBy.kind`), the routed-to-diagnostics handoff list (EV-051 failures), the calibration-loop queue (indeterminate criteria), and the validation provenance (TPR/TNR + Rogan-Gladen corrected rate + CI per judge, once `*validate` has run). |
205
+
206
+ **GA verdict shape (the three new per-criterion fields + the ternary).** Grounded Adjudication
207
+ binds every verdict to its evidence (`references/grounded-adjudication.md`):
208
+
209
+ | Field | Shape | Meaning |
210
+ |-------|-------|---------|
211
+ | `verdict` | `pass \| fail \| indeterminate` | The **ternary**. `indeterminate` reuses `OutcomeVerdict.Uncertain` (NOT a 4th enum) — the verdict is underdetermined by the inputs, so the judge ABSTAINS. |
212
+ | `refs` | `DiscoveryRef[]` = `{obs, path, value}` | STRUCTURED, RE-RESOLVABLE grounding — *where* a value lives (`obs` = trace/observation id, `path` = field path) and the EXACT cited `value` (re-resolved by whitespace-normalized exact match). Replaces prose-only evidence pointers (GA-1 · L2). |
213
+ | `assumptions` | `DiscoveryAssumption[]` = `{text, status, kind?}` | TYPED assumptions the judge surfaced. `kind ∈ {factual-intent, normative, scope}`; `status ∈ {hypothesis, unverified, verified, eliminated}` (the calibration lifecycle). `kind` is optional for grandfathered legacy assumptions (GA-3). |
214
+ | `blockedBy` | `{kind, text}` | Present iff `verdict === indeterminate` AND the abstain is assumption-driven. `kind` routes the calibration loop: `factual-intent` → re-ground · `normative` → operator-ratify · `scope` → re-scope. Makes the indeterminate ROUTABLE (GA-4). |
215
+
216
+ **Run-level GATE = `fail ▸ incomplete ▸ pass`** (`RunVerdict`, distinct from the per-criterion
217
+ `OutcomeVerdict`). A component is **incomplete** iff a CRIT/HIGH criterion adjudicated
218
+ `indeterminate` (and none failed); **fail** iff a CRIT/HIGH criterion failed; **pass** otherwise.
219
+ The run takes the worst component state. This is the one intentional GA behavior delta — it kills
220
+ the latent **false-green** where a CRIT/HIGH `uncertain` used to silently pass. `*evaluate` may now
221
+ return `incomplete`; indeterminate criteria route to the calibration loop, never to the gate.
222
+
223
+ The scorecard is **deterministic given a pinned judge** — `mask.ts` strips `runId`/timestamps/
224
+ abs-paths so two runs on one bundle produce a byte-identical scorecard (the C-PIN invariant the v1
225
+ auditor already enforces; the v2 engine inherits it).
226
+
227
+ **Validation gates trust.** A judge's verdicts are only reported once `*validate` shows TPR/TNR
228
+ > 90% on the dev split (test-once on the held-out set); below that the criterion is marked
229
+ `unvalidated` in the scorecard and its aggregate rate is bias-corrected (Rogan-Gladen) with a
230
+ bootstrap CI rather than reported raw.
231
+
232
+ ## §4 — Bill of Materials (scripts/)
233
+
234
+ Two engines live in one package: the **NEW v2 eval-development engine** (built by the parallel
235
+ engine wave) and the **EXISTING v1 4-tab static-auditor** (~2400L on disk, EV-001..027 already
236
+ implemented — surfaced by `*audit`, never rebuilt).
237
+
238
+ **v2 eval-development engine** (binding contract for the `*command` table above; full TDD gate
239
+ applies, EV-053/EQ5):
240
+
241
+ | Script | Req | Kind | Purpose |
242
+ |--------|-----|------|---------|
243
+ | `scripts/contracts/eval-types.ts` | — | code | Shared v2 type contracts (TraceLabel · Category · CriterionSpec · JudgeVerdict · Scorecard). |
244
+ | `scripts/determine-outcome.ts` | EV-042 | hybrid | Deep-read one trace (event + trajectory + outputs) → binary goal-reached + confidence. **Encodes "inaction can be success"** (a guard-hold is a Pass; never use "called a tool" as a success proxy). |
245
+ | `scripts/sample-traces.ts` | EV-052 | code | Balanced ✓/✗ sampling: random + outlier + failure-driven + uncertainty + stratified. Re-implements the diagnostics filtering PATTERN (sealed-sibling: never imports it). |
246
+ | `scripts/profile-subject.ts` | EV-049 | hybrid | Auto-gen subject profile from code / platform / trace exploration — never hand-authored. For sample: infer the 35-tool inventory + event taxonomy from `observations[].type=="TOOL"`. |
247
+ | `scripts/discover-criteria.ts` | EV-041 | hybrid | Over a labeled ✓/✗ batch: segment + emergent-category clustering → 5-10 binary actionable criteria; saturation stop; **flag fixable-vs-eval-worthy, do NOT fix (EV-051)**. |
248
+ | `scripts/build-evals.ts` | EV-043 | hybrid | THE `*build-evals` engine — one binary+confidence judge per criterion (4-component, critique-before-verdict, few-shot from TRAIN split only). The verdict comes from the injected `JudgeInvoke` seam (DEFAULT = agent-dispatch verdict files; in-house provider optional). Borrows the C-PIN judge-call discipline from the v1 `scripts/run-judge.ts` + `scripts/mask.ts` (same package, not sealed-sibling). |
249
+ | `scripts/agent-dispatch.ts` | EV-050 | code | **THE DEFAULT judge transport.** Verdict-file-backed `JudgeInvoke` + the PREP/AGGREGATE primitives (`promptHash` content key · `writeJudgeTask` · `createAgentDispatchJudge` · `missingVerdictKeys`). Verdicts come from host-runtime dispatched subagents — NO provider SDK on this path. |
250
+ | `scripts/prep-tasks.ts` | EV-050 | code | The deterministic PREP: `prepDeterminerTasks` (stage A) + `prepJudgeTasks` (stage B, replays the pipeline with a capturing judge for byte-identical prompts). Emits task-spec files the parent dispatches. |
251
+ | `scripts/evaluate.ts` | EV-048 | hybrid | Run suite vs subject → per-criterion binary+confidence → **GATE** (binary, severity-gated) + **agent-variance view** (EV-054: eval-score variance across reruns + trajectory variance). |
252
+ | `scripts/route-failures.ts` | EV-051 | code | Judge-only: emit a diagnostics-handoff bundle for failures (incl. infra-class C4 dead-channel). NEVER fixes. |
253
+ | `scripts/substrate.ts` + `scripts/judge-provider.ts` | EV-050 | code | Judge-runtime selection (`resolveJudgeRuntime`/`judgeForRuntime`) — **DEFAULT agent-dispatch** (host-runtime subagents, no provider) · in-house provider judge (`@langchain/google-genai` shape, OPTIONAL/demoted, lazy import · temp 0 · model = `global.models.judge_model`/`global.models.default`/`--model` · THROW on missing creds) · code-based · user-framework export. |
254
+ | `scripts/config/{schema.ts,load.ts}` | v0.2.0 | code | The evaluator's config-loader — reads the unified `.mutagent/config.yaml`: binds a SOURCE by role from `global.sources[]` (single auto-binds), resolves the judge model from `global.models.{judge_model,default}`, reads `lifecycle.evaluator.{context,judge_runtime}`, loads `global.context[]`. Legacy config → `migration-required`. PARITY PORT of the orchestrator's source/target schema (never cross-imported). |
255
+ | `scripts/memory/{read,append}.ts` | v0.2.0 | code | Project-level AutoMemory — read `.mutagent/memory/` filtered by `lifecycle ∈ {evaluate, general}` at run start; append dated + classified entries on operator feedback (injected `now`). Claude-Code AutoMemory format (`references/memory-format.md`). |
256
+ | `scripts/validate-judge.ts` | EV-044 | code | **`*validate` stats (W2 — live).** Confusion matrix → TPR/TNR · split-disjointness + test-once guards · Rogan-Gladen θ=(p_obs+TNR−1)/(TPR+TNR−1) (clip + invalid-when denom≈0) · DETERMINISTIC seeded-LCG bootstrap CI (no `Math.random`) · `<MIN_LABELS` → `unvalidated`+bias-corrected. Pure math, no LLM. |
257
+ | `scripts/self-audit.ts` | EV-055 | code | **`*self-audit` core (W4 — eval-of-the-eval).** The eval-audit six-area diagnostic as PURE threshold checks over the evaluator's OWN eval-dev artifacts (REUSES `*validate` `ValidationResult[]` · `*review` `HumanLabel[]` · `*discover-evals` `DiscoveredCriterion[]` · living-suite provenance). Emits impact-ordered finding DATA; NO judge prose, NO subjective verdict. The nuanced reads are `audit-executor` Mode D (agent-dispatch). On-demand only. |
258
+
259
+ **ADL P1–P5 engine extensions** (the implemented eval-dev reality — UniTF-handover ingest ·
260
+ `*discover-evals` metadata + DR-2 · code-track · `*evaluate` spine · reporting; full TDD gate):
261
+
262
+ | Script | Phase | Kind | Purpose |
263
+ |--------|-------|------|---------|
264
+ | `scripts/read-unitf-traces.ts` | P1 (intake) | code | THE trace-intake entry point. Reads the handed-over UniTF `.jsonl` (`mutagent-cli trace fetch --export` output) → `EvalTrace[]`. `parseUnitfJsonl(text)` is PURE (one `UnifiedTrace` record/line; blank lines skipped; malformed/non-UniTF lines skipped + COUNTED, never swallowed); `readUnitfAsEvalTraces(path)` is the effectful file read. The skill NEVER fetches — fetch + normalize live in `mutagent-cli`. |
265
+ | `scripts/unitf-to-evaltrace.ts` | P1 (intake) | code | The projection adapter (migration doc §3.2). `projectUnitfToEvalTrace(ut)` PURE-maps one `UnifiedTrace` → the in-package `EvalTrace` (id/name/input/output/observations/scores/tags/latency/cost + the §9.4.2 `incomplete` fidelity marker from `ext.eval`). UniTF shape is a PORTED structural subset — never a source-import of `mutagent-tools` (the JSONL file on disk is the boundary; no cross-package cycle). Zero downstream contract change. |
266
+ | `scripts/source-map.ts` | P2 (§5a) | code | `buildSourceMap(traces)` → the topology artifact (entity/feature/stage topology + per-stage I/O from GENERATION observations). SV-1 tolerant (null trace-output → GENERATION obs; counts null-output traces). GENERIC — data-derived stages, no client topology. Drives the report's adaptive Findings branch. |
267
+ | `scripts/aggregate-discover.ts` | P2 (§5a) + §9.4 (T6) | code | The real `*discover-evals` AGGREGATE half: parse the leaf's per-trace verdict files + per-batch mining report → `TraceAnnotation[]` (FAIL-LOUD via `missingVerdictKeys`; THROW on an undispatched-trace category ref) → `deriveMinedCriteria` (§5b metadata + §5c DR-2) → `growLivingSuite` (append-only, monotonic, saturation-stop). **T6:** `collectDatasetCandidates` (failure/uncertain → `DatasetCase[]` via the derive-dataset selectors) + `unmatchedDetectionCandidates` (the `*evaluate` judge's node-2.5 handoff) → consumable by `*build-dataset`. `DiscoverMiningReport` contract. No hand-rolled annotations. |
268
+ | `scripts/code-eval.ts` | P3 (EX-2) | code | The v2 CODE-track primitive library — generic PURE `(trace) → {result, detail}` checks: presence · string-equality · format-validity · schema-conformance · ref-integrity (cross-stage). SV-1 dotted-path read incl. `obs:<name>.<path>`. Exhaustive `runCodeEval` (unknown primitive → THROW). NO LLM, byte-identical. Disjoint from the v1 `run-deterministic.ts` audit world. |
269
+ | `scripts/check-method-router.ts` | P3 (EX-2) | hybrid | THE load-bearing §5b `check_method` router: `deterministic`→CODE-EXEC (judge NEVER called) · `llm-judge`→JUDGE seam · `hybrid`→code pre-filter that GATES the judge. Unknown → THROW (exhaustive). `RoutedCriterionVerdict` = `CriterionVerdict` + provenance `{producedBy, codeResult, judgeReached}` (structural superset → `evaluate.ts` rollup unchanged). `extractCodeEval(registry)` fail-loud (a code-class criterion with no spec THROWS — never silently judge). "Code before judge" lives INSIDE the agent. |
270
+ | `scripts/run-evaluate.ts` | P5 + §9.4 (T1·T3·T4·T5) | hybrid | The real-engine `*evaluate` end-to-end COMPOSER: `tier0Plan` (T1 — code rows decided in the pre-pass, residual judge rows only in packets) → `prepMatrixPackets` (residual-only) → `adaptivePacketPlan` (T5 overload guard, default 1:1) → [dispatch #mode-judge-trajectory] → `aggregateEvaluate` (FAIL-LOUD readiness gate over DISPATCHED ids → `aggregateMatrixScorecard` folding code+judge + T3 `independentVerify` downgrade-only on gating fails → GATE + variance → T4 `consolidateByLocus` lociClusters → EV-051 `routeFailures`→validated HandoverBundle). `maskedScorecard` = the C-PIN byte-identity artifact. |
271
+ | `scripts/render-eval-report.ts` | P4 (D-1/2/3) | code | The v2 reporting (v1 `render-report.ts` untouched): `renderEvalCards` (D-1 terminal per-criterion cards) + `buildEvalReportInput` (derives the rich tabs from real run data — ledger · coverage · cohorts · gating rolls · top-findings · judge-health) + `renderEvalReport` (the operator-APPROVED 5 tabs: ① Overview KPIs+coverage+gating-table+top-findings · ② Trajectory‖Judge ledger + click-row Target-Agent‖Judge side-by-side · ③ Eval Scorecard cohort heatmap + nested subcards + inline calibration · ④ Findings verbatim-evidence + judge chain + agree/revise/refute · ⑤ Self-Eval [INTERNAL, strip-marked]). Consumes the §9.4 judge-walk (`judge_steps[]` + dense map) when present, degrades to the per-trajectory scorecard otherwise. Tabs are `<button>` (no `<s>` strikethrough). Unified design-system tokens (`assets/brand/theme.css`). byte-identical after the `generatedAt` mask. `autoOpenCommand` cross-platform helper (orchestrator fires it). |
272
+ | `scripts/contracts/eval-types.ts` *(extended)* | P2/P2b | code | + `MinedCriterion` (additive subtype of `DiscoveredCriterion`) carrying the §5b `MetricMetadata` (generality·dimension·level·check_method [3-value SF-2 router]·substrate·applies_to·severity·judge_inputs·flag) + the §5c `DiscoveryRationale` (DR-2: targets·why·evidence{grounding observed\|inferred·prevalence k/n·refs}·assumptions·expected_impact). `parseMinedCriterion` enforces the evidence-first gate (OBSERVED ⇒ refs + k>0). |
273
+
274
+ **ADL EVAL-stage engine** (F7–F22 — the `*eval` lifecycle entry; full TDD gate):
275
+
276
+ | Script | Finding | Kind | Purpose |
277
+ |--------|---------|------|---------|
278
+ | `scripts/contracts/eval-engine.ts` | F7/F9/F14 | code | The ENGINE FORK contract — `EvalEngine` (`native-matrix` Path A · `code-written` Path B) + `EngineTargetInput` (the minimal agentspec.build slice) + `EvalEngineOption` (the menu, with `requiresClaudeCode`/`requiresLogSink`/`portable` SURFACED) + `EvalEnginePlan` (the resolved choice incl. discoverable `outputSink`). |
279
+ | `scripts/eval-engine.ts` | F7/F9/F14 | code | The target-conditional resolver — `isFrameworkTarget` · `chooseEvalEngineOptions` (framework→BOTH · harness→native-only) · `resolveEvalEngine` (surfaces CC + log-sink deps) · `assertEngineMatchesTarget` (code-written⊥harness, fail-loud) · `defaultOutputSink`. PURE. |
280
+ | `scripts/contracts/agentspec-evals.ts` | F8 | code | The MINIMAL `agentspec.definition.evals` slice (`success_criteria[]` · `scenarios[]` · `dataset_categories[]`) — local re-declaration (standalone: NEVER imports the agentspec skill). `parseAgentspecEvals` guarded. |
281
+ | `scripts/materialize-dataset.ts` | F8 | code | MATERIALIZE real dataset items from the agentspec — `materializeFromAgentspec` (≥1 real item/category + one/edge_case, seed→actual) · `dimensionsFromAgentspec` · `materializeToDataset` (monotonic). Reuses `build-dataset.ts` ids/dedup/merge. PURE. |
282
+ | `scripts/codegen-evals.ts` | F14 (Path B) | code | Emit a PORTABLE code-written eval suite source (bun/TS) — `codegenEvalSuite` (code-checks + SDK judge + criteria → gate-bearing scorecard to a discoverable sink). NO CC dispatch. Fail-loud, deterministic. PURE. |
283
+ | `scripts/render-build-cards.ts` | F13/F16/F20/F22 | code | The wireframe terminal surface — progress cards (`renderBuildDatasetProgressCard`/`renderBuildEvalsProgressCard`, F13/F16) · entity cards (`renderDatasetEntityCard`/`renderEvalsEntityCard`, F22) · the scorecard DASHBOARD (`renderScorecardDashboard` — pass/fail bar + variance + samples, F20, not a flat dump). PURE. |
284
+
285
+ **W2 trust + data engine** (full TDD gate):
286
+
287
+ | Script | Req | Kind | Purpose |
288
+ |--------|-----|------|---------|
289
+ | `scripts/build-review-ui.ts` | EV-045 | code | The `*review` Code half — `renderReviewUi` emits a DETERMINISTIC browser annotation UI (one trace/screen, native render, Pass/Fail/Defer, notes, keyboard, localStorage auto-save, labels export) + `mergeLabels` (dedup by traceId). Holds no judge prompt; the HUMAN decides. |
290
+ | `scripts/build-dataset.ts` | EV-046 | code | The `*build-dataset` Code half — cartesian dimension×value expand · deterministic token-Jaccard near-dup removal · content-derived id · `mergeCases` MONOTONIC merge. Agent proposes realism; script enforces non-redundancy. |
291
+ | `scripts/derive-dataset.ts` | EV-047 | code | `*discover-dataset` — distill a living regression set from past ✓/✗ (reuses `sample-traces.ts` selectors + `build-dataset.ts` merge); trace→`DatasetCase`. Append-only, no new decision. |
292
+ | `scripts/living-suite.ts` | EV-053 | code | Generic append-only writer (`appendOnly` + `assertMonotonicGrowth`) shared by datasets + criteria — a living artifact NEVER shrinks. Pure-counter provenance (no clock → C-PIN byte-identity). |
293
+ | `scripts/contracts/dataset.ts` | EV-046 | code | TypeBox `Dimension`/`DatasetTuple`/`DatasetCase`/`Dataset` (companion to `schemas/dataset.schema.yaml`). NEW W2-OWN file; disjoint from shared `eval-types.ts`. |
294
+ | `scripts/contracts/validation.ts` | EV-044 | code | TypeBox `HumanLabel` (`*review`→`*validate`) + confusion-matrix / validation-result shapes. NEW W2-OWN file. |
295
+
296
+ **W3 scale + context-flow / UI audit engine** (full TDD gate):
297
+
298
+ | Script | Req | Kind | Purpose |
299
+ |--------|-----|------|---------|
300
+ | `scripts/flow-graph.ts` | EV-032 | code | **THE FOUNDATION** — deterministic `EvalTrace` → subject-agnostic information-flow graph (producer/consumer nodes · data-handoff edges) + `diffExpectedFlow`. Lets the evaluator SEE an agent's context-flow. Threading = verbatim content-overlap signal; sub-agent vocab supplied via opts (EV-049/037). Pure. |
301
+ | `scripts/ui-slots.ts` | EV-039/040 | code | HTML-artifact missing-data audit (`auditUiSlots`) — cross-refs a profile-supplied `expectedUiSlots` (EV-037, not v1 hardcoded names) vs computed values + published HTML → computed-but-not-rendered (039) · orphan · faithful. Works on the HTML-only path. Flags verbatim presence/absence; nuanced faithfulness (040) → judge. |
302
+ | `scripts/contracts/flow-graph.ts` | EV-032/037 | code | TypeBox info-flow-graph + expected-flow profile shapes + `FlowEdgeKind`. NEW W3-OWN file; disjoint from shared `eval-types.ts` + v1 `types.ts`. |
303
+ | `scripts/profile-subject.ts` *(extended)* | EV-037 | hybrid | + the `expectedFlow` / `expectedUiSlots` auto-gen section (EV-049, never hand-authored) the context-flow + UI audits diff against. |
304
+ | `scripts/evaluate.ts` *(deepened)* | EV-054 | hybrid | + agent-appropriate variance: N-rerun `evalScoreVariance` + `trajectoryVariance` = observed-decision vs **expected-flow** (EV-037) per behavior-tree/flow node (supersedes the blind 15-dim trend). |
305
+ | `scripts/route-failures.ts` *(extended)* | EV-051 | code | + mask-on-handoff: serialize the diagnostics-handoff bundle through `mask.ts` (`maskedCanonicalJson`) — masks `produced_at` + abs paths. Dogfoods the data-leak audit on the evaluator's OWN output (C-PIN byte-identity). |
306
+
307
+ All scripts dispatched via `scripts/cli/run.sh` (bun→pnpm→npm fallback).
308
+
309
+ **EXISTING v1 4-tab static-auditor (KEEP + surface under `*audit` — EV-001..027, do NOT rebuild).**
310
+ A subject-profile-driven auditor: it loads a generated `subjects/<name>/` profile + a run-bundle and
311
+ composes a 4-tab master-audit report (Tab-1 eval-matrix · Tab-2 data-leak · Tab-3 variance trend ·
312
+ Tab-4 methodology) with a two-track rollup (severity-gated GATE + 15-dim variance TREND).
313
+
314
+ | Surface | On disk | Role |
315
+ |---------|---------|------|
316
+ | Subject profiles | `subjects/<name>/{eval-matrix,behavior-tree,methodology-review}.yaml` | The audited criteria as DATA (zero subject logic in code). `subjects/mutagent-diagnostics/` is the first profile (eval-matrix.yaml ~87KB). |
317
+ | Shape contracts | `schemas/{eval-matrix,behavior-tree,methodology-review,scorecard}.schema.yaml` | The 4 profile/scorecard shapes. |
318
+ | Judging lenses | `lenses/{decision,data,trajectory,methodology-critic}-lens.md` | Per-dimension pinned-judge rubrics. |
319
+ | Orchestration | `workflows/{audit,data-leak,variance}.workflow.js` | Self-contained 4-tab composition. `data-leak.workflow.js` now carries a **context-flow dimension** (EV-028/029, reasons over `flow-graph` EV-032 + expected-flow EV-037 via `lenses/context-flow-lens.md`) and **subject-agnostic, de-hardcoded ui-render + data-correctness dims** (EV-039/040, `expectedUiSlots`-driven — the first-class HTML-artifact missing-data case). |
320
+ | Scorers | `scripts/{assemble-scorecard,render-report,run-judge,run-deterministic,variance-compare,mask,load-bundle,load-profile}.ts` + `scripts/cli/{audit-run,methodology-review,profile-subject,variance-check}.ts` | Two-track scorecard · 4-tab HTML · pinned-judge + deterministic rows (checkMethod split) · 15-dim variance · run-meta masking (C-PIN) · profile/bundle loaders. |
321
+
322
+ ## §5 — Agents (assets/agents/ — pure_subagent_executor)
323
+
324
+ | Agent | Class | Load |
325
+ |-------|-------|------|
326
+ | `evaluator.md` | pure_subagent_executor | **The unified eval-DEVELOPMENT cell — ONE agent, three dispatch modes** (MASS-PARALLEL, host-runtime, NO provider key). **`#mode-judge-trajectory`** (HEADLINE, `*evaluate`): scores ONE agent TRAJECTORY against the WHOLE eval MATRIX → per-criterion verdicts for that trajectory (per-TRAJECTORY fan-out; bridges v1 `subjects/<name>/eval-matrix.yaml`). **`#mode-judge-criterion`** (ALTERNATE, `*build-evals`/`*validate`): runs ONE binary+confidence judge per criterion across a trace-slice (4-component). **`#mode-discover`** (`*discover-evals`): reads determiner task-specs → pass/fail + first-thing-that-went-wrong → emergent categories. All modes: critique-before-verdict, binary, inaction-can-be-success, pinned host model + C-PIN → write verdict files |
327
+ | `dataset-builder.md` | pure_subagent_executor | The `*build-dataset` GENERATOR (EV-046) — generates dimension tuples → NL queries → realism quality-filter (generate-synthetic-data Steps 1-5). A generator, NOT a judge (host leaf, no provider key); the deterministic expand/dedup/merge is `scripts/build-dataset.ts`. |
328
+ | `audit-executor.md` | reviewer_not_executor | The v1 `*audit` surface executor (re-homed from the package root). 4-tab master-audit (Modes A/B/C) **+ the new context-flow + HTML-artifact missing-data dims** (EV-028/029/039/040) via `lenses/context-flow-lens.md` — distinct from the v2 eval-dev roster above |
329
+
330
+ The unified `evaluator` cell (three dispatch modes — `#mode-judge-trajectory` [headline],
331
+ `#mode-judge-criterion`, `#mode-discover`) is the eval-DEVELOPMENT roster; `audit-executor` is the
332
+ v1 static-audit surface. The default `*evaluate` judging cell is **`evaluator` `#mode-judge-trajectory`**
333
+ (per-TRAJECTORY: one judge scores the whole matrix for one session); `#mode-judge-criterion` is the
334
+ alternate per-CRITERION axis (one judge per criterion across a slice). The `evaluator` cell reasons
335
+ on the **HOST runtime** (Claude Code) with **no external provider key** — the default agent-dispatch
336
+ transport. It is fanned out **MASS-PARALLEL** by the parent session; the real concurrency bound is
337
+ the host harness's own cap (documented in the protocol, never hardcoded to 5). The parent session
338
+ orchestrates (no coordinator sub-agent; sub-agents can't dispatch sub-agents or call
339
+ AskUserQuestion — so a dogfood re-run must run from a TOP-LEVEL parent to fan out the leaves). The
340
+ `dataset-builder` agent (EV-046) is the `*build-dataset` GENERATOR — host
341
+ leaf, NOT a judge; `*discover-dataset` (EV-047) is pure code (`derive-dataset.ts`, no agent).
342
+
343
+ > **Placement (FIXED, EQ6):** all agents live at `.claude/skills/mutagent-evaluator/assets/agents/`
344
+ > (mirroring diagnostics). The former mis-placed package-root `.claude/agents/mutagent-evaluator.md`
345
+ > (v1 generic auditor) was RE-HOMED here as `audit-executor.md` — it is the `*audit` surface
346
+ > executor, NOT the v2 engine roster. The empty `.claude/agents/` dir was removed.
347
+
348
+ ## §6 — References (load on demand)
349
+
350
+ ### §6.0 — Path convention (dual-root — read before resolving any path)
351
+
352
+ This SKILL.md lives at `.claude/skills/mutagent-evaluator/SKILL.md`. Both the repo and the
353
+ published npm tarball have **two roots**, and every path token below resolves against one of them
354
+ — NOT against SKILL.md's own directory:
355
+
356
+ | Path token in SKILL.md | Resolves from | Why |
357
+ |------------------------|---------------|-----|
358
+ | `references/…` · `scripts/…` · `workflows/…` · `lenses/…` · `schemas/…` · `subjects/…` | **PACKAGE ROOT** (the npm install dir = repo `mutagent-evaluator/`) | These dirs live at the package root; the npm `files` allowlist ships them from there. |
359
+ | `assets/agents/…` | **SKILL DIR** (`.claude/skills/mutagent-evaluator/`) | The agents ship INSIDE the SKILL.md wrapper (EQ6 placement, mirroring diagnostics); `files` ships `.claude/skills/mutagent-evaluator/assets/`. |
360
+
361
+ So `references/validate-evaluator.md` is `<pkg-root>/references/validate-evaluator.md`, while
362
+ `assets/agents/evaluator.md` is `<pkg-root>/.claude/skills/mutagent-evaluator/assets/agents/evaluator.md`.
363
+ (`assets/brand/` is package-root — the SKILL-dir `assets/` holds only `agents/`.) When loading a
364
+ ref from inside this skill dir, walk up to the package root first.
365
+
366
+ ```
367
+ # PACKAGE ROOT — references/
368
+ references/
369
+ workflows/
370
+ orchestrator-protocol.md # the parent-session DISPATCH FSM (default agent-dispatch): PREP → fan out
371
+ # evaluator (discover/judge modes) MASS-PARALLEL → collect verdict files → AGGREGATE
372
+ error-analysis.md # *discover-evals — 7-step error analysis → emergent criteria; 5 sampling strategies; fix-vs-eval decision
373
+ write-judge-prompt.md # *build-evals — 4 judge components · critique-before-verdict · BINARY not Likert · few-shot from TRAIN only
374
+ validate-evaluator.md # *validate — 8-step calibration · TPR/TNR · test-once · Rogan-Gladen · bootstrap CI · pin model
375
+ generate-synthetic-data.md # *build-dataset — dimension tuples → NL queries → realism filter (5 steps, EV-046); cites CORE source
376
+ build-review-interface.md # *review — browser annotation UI spec: native render · Pass/Fail/Defer · keyboard · auto-save (EV-045); cites CORE source
377
+ eval-audit.md # *audit / *self-audit — the eval-audit 6-area diagnostic (S16) + the eval-of-the-eval meta-skill (S17, EV-055); cites CORE source
378
+ eval-stage.md # *eval — the ADL EVAL-stage flow: engine fork (F7/F9/F14) · materialize dataset (F8) · wireframe cards (F13/F16/F22) · scorecard dashboard (F20) · success gates
379
+ operation-inventory.md # LLM-only / Code-only / Hybrid classification of EVERY op (Type A/B/C) — the script-austerity audit surface
380
+ methodology.md # v1 auditor scoring methodology (two requirement families · MR-1..9 · severity · C-PIN) — under *audit
381
+ principles.md # → .meta/design-principles.md (the Constitution; operator-locked; STRIPPED on publish)
382
+
383
+ # PACKAGE ROOT — lenses/ (per-dimension *audit judging rubrics)
384
+ lenses/
385
+ context-flow-lens.md # *audit — EV-028 tool-result threading + EV-029 sub-agent handoff completeness + EV-040 faithfulness, over the flow-graph (EV-032) + expected-flow (EV-037)
386
+ {decision,data,trajectory,methodology-critic}-lens.md # the v1 4-tab dimension lenses
387
+ ```
388
+
389
+ Each v2 ref cites its CORE eval-skills source in a header line, load-on-demand.
390
+
391
+ All six methodology refs are now AUTHORED: the three CORE (`error-analysis` · `write-judge-prompt` ·
392
+ `validate-evaluator`) + `generate-synthetic-data` + `build-review-interface` (W2) +
393
+ `eval-audit.md` (W4 — the eval-audit 6-area diagnostic + eval-of-the-eval meta-skill, drives
394
+ `*self-audit`). EQ2 complete.
395
+
396
+ ## §7 — Config
397
+
398
+ Config lives at: `<host>/.mutagent/config.yaml` (unified local config, **v0.2.0**). The evaluator reads
399
+ its own `lifecycle.evaluator` section + the shared `global` block (`scripts/config/{schema.ts,load.ts}`).
400
+ Secrets resolve via `credential_ref` env-var NAMEs — `<host>/.env` then `<host>/.mutagentrc`
401
+ (gitignored, never committed); only key NAMES live in config, never raw secret values. A legacy
402
+ (pre-v0.2.0) config is DETECTED and routed to `migration-required` (never parsed at runtime).
403
+
404
+ Key fields: `lifecycle.evaluator.context[]` (stage-specific context links), `lifecycle.evaluator.judge_runtime`
405
+ (**renamed from `substrate`** in v0.2.0 — `agent-dispatch` [DEFAULT] | `in-house` | `code-based` |
406
+ `user-framework`), `global.models.judge_model` (**renamed from `pinned_judge`**) ?? `global.models.default`
407
+ (the pinned judge model id), and the SOURCE bound BY ROLE from `global.sources[]` (single auto-binds;
408
+ multiple ⇒ disambiguation deferred). The evaluator is a source-CONSUMER; it binds `global.sources`,
409
+ never a `source_ref`.
410
+
411
+ **Judge model resolution (model-intent-sacred):** the judge model is exactly
412
+ `--model` ?? `config.models.default`, else REFUSE — no silent swap, no retry-on-failure
413
+ alternate-model fallback. Temperature is **pinned at 0** unconditionally; the model id is recorded
414
+ to the scorecard (C-PIN) so reruns are byte-identical and any model change forces re-validation.
415
+ Under the DEFAULT **agent-dispatch** substrate the judge IS the **host runtime's pinned model**
416
+ (no provider key; if unresolved → THROW). Under the OPTIONAL **in-house** substrate the judge is a
417
+ provider call: unsupported provider → THROW, missing `GOOGLE_API_KEY` → THROW (the
418
+ `@langchain/google-genai` `ChatGoogleGenerativeAI` shape, lazy-imported only on that path).
419
+
420
+ ## §8 — Design Principles (operative subset)
421
+
422
+ - **Binary, not Likert** — every criterion is one Pass/Fail; capture severity via multiple binary
423
+ judges, never an ordinal scale (scores that sound precise but can't be calibrated).
424
+ - **Critique-before-verdict** — the judge writes its critique FIRST, then the verdict; forces
425
+ articulated reasoning before commitment. Structured output `{critique, result}`.
426
+ - **Few-shot from TRAIN split only** — examples in a judge prompt come from the 10-20% train
427
+ split; using dev/test examples is data leakage.
428
+ - **Judge-only, never fix (EV-051)** — a judge is only a judge. Flag failures; route fixes to
429
+ `mutagent-diagnostics` (infra-class failures too). The evaluator never mutates the subject.
430
+ - **Reviewer ≠ executor** — the evaluator never grades a run it produced.
431
+ - **C-PIN** — pin judge model id + temperature=0; record both; re-validate on any model change.
432
+ - **Subject is generated, not authored (EV-049)** — behavior lives in the generated profile, never
433
+ hard-coded.
434
+ - **Code before judge** — exhaust objective code-checks (regex / schema / tool-output flags) before
435
+ reaching for an LLM judge; many "subjective" criteria reduce to deterministic checks.
436
+ - **Eval-of-the-eval, on demand (EV-055)** — reviewer-discipline applies to the evaluator itself: it
437
+ audits its OWN eval-dev (judges validated? dataset balanced? criteria grounded? suite living?) via
438
+ `*self-audit`, the eval-audit six-area diagnostic over its own output. **On-demand only** — no
439
+ cron / monitor / auto-fire (`feedback_self_diagnostics_on_demand_only`). Reuses `*audit` +
440
+ `*validate`; the deterministic checks are Type-A code, the nuanced reads are agent-dispatched.
441
+
442
+ > The full constitution (the locked **EV-PR-001..024** pillars, grouped into the
443
+ > REVIEWER-NOT-EXECUTOR / DETERMINISM-PIN / NO-FALSE-PASS / MECE-COVERAGE / TWO-TRACK-ROLLUP /
444
+ > NDA-MASKING blocks) lives in `.meta/design-principles.md` §4 — the audit surface the principles
445
+ > govern (stripped on publish; the operative subset above is what ships).
446
+
447
+ ## §9 — Eval / Failure Taxonomy + Criterion Classes + GATE / Variance
448
+
449
+ > The evaluator's taxonomy is the structural analog of diagnostics' WHAT/WHY/WHERE.
450
+ > Two axes: **(A) the audit DIMENSIONS** it inspects (the eval surfaces, *what gets
451
+ > checked*) and **(B) the criterion CLASSES** (the substrate, *how it gets checked*).
452
+ > Design principles that govern both are §8 (operative subset) + `.meta/design-principles.md`
453
+ > §4 (the locked EV-PR pillars).
454
+
455
+ ### §9.0 — Audit dimensions (Axis A — the eval/failure surfaces)
456
+
457
+ Every failure the evaluator can surface lives in exactly one dimension, each with its own
458
+ surface + the failure modes it detects. The **context-flow / data-leak** dimension is the W3
459
+ addition; **eval-of-the-eval** is the W4 addition (the evaluator turned on itself).
460
+
461
+ | Dimension | Surface | Failure modes it detects |
462
+ |-----------|---------|--------------------------|
463
+ | **Conformance** (eval-matrix) | `*evaluate` · `*audit` Tab-1 | a criterion's observed Pass/Fail ≠ expected — operation-correctness (R1) · data-correctness (R2) · operational-deviation (R3), MECE per component (EV-PR-018) |
464
+ | **Context-flow / data-leak** (W3) | `*audit` Tab-2 + `flow-graph.ts` (EV-032) + `lenses/context-flow-lens.md` | tool-result NOT threaded at step N+k / dropped (EV-028) · sub-agent dispatch brief misses context the child needs (EV-029) · HTML-artifact computed-but-not-rendered / orphan (EV-039) · rendered-but-altered/truncated faithfulness (EV-040) |
465
+ | **Variance** (EV-054) | `*evaluate` (N reruns) | eval-score flaps across reruns (`evalScoreVariance`) · trajectory shape flaps (`trajectoryShapeVariance`) · trajectory diverges from expected information-flow (`trajectoryFlowDivergence`, EV-037) |
466
+ | **Methodology** (MR-1..9) | `*audit` Tab-4 + `lenses/methodology-critic-lens.md` | wrong/inefficient methodology choice — signal-selection / confidence-derivation / focus (MR-7/8/9). **Advisory** — never gates (EV-PR-021) |
467
+ | **Eval-of-the-eval** (EV-055, W4) | `*self-audit` + `scripts/self-audit.ts` + `references/eval-audit.md` | the SIX eval-audit areas over the evaluator's OWN output: ungrounded criterion (1) · over-reliance on judges (2) · unvalidated / low-TPR-TNR judge (3) · no human ground truth (4) · imbalanced labels (5) · shrunk suite / stale pin (6) |
468
+
469
+ **Infra-class routing (orthogonal, EV-051).** A failure whose root cause is a dependency / provider
470
+ fault (e.g. sample C4 send-failure, dead-channel) is NOT a model judgment — it is FLAGGED and
471
+ ROUTED to `mutagent-diagnostics` (WHY=`dependency-failure`, WHERE=`provider-side`), never fixed here.
472
+ Latency (sample p95 127s) + cost are diagnostics signals too, not eval criteria.
473
+
474
+ ### §9.1 — Criterion classes (Axis B — drives the substrate)
475
+
476
+ **Criterion class** (drives the substrate):
477
+ - **objective → code** — deterministic over tool outputs/structure. *Sample C4 (send-failure
478
+ recovery): `sendMessage success:false` + presence of `scheduleRetryAfterTransientFailure`.*
479
+ - **subjective → LLM-judge** — a judgment call. *Sample C1 (outbound-guard compliance): when
480
+ `<outbound_guard>` is present and the event is non-critical, the agent does NOT `sendMessage`
481
+ — criticality is a judgment.* *C2 (goal-attainment): "inaction can be success".*
482
+ - **hybrid** — code detects the trigger, judge confirms intent. *Sample C3 (manager-override
483
+ honored): code finds `approved:false` → later send; judge confirms "same rejected content".*
484
+
485
+ **The 8 sample criteria** (the concrete `*discover-evals` output, candidates from a 1946-trace sample):
486
+ C1 outbound-guard compliance (judge) · C2 goal-attainment (judge — the foundation) · C3
487
+ manager-override honored (hybrid) · C4 send-failure recovery (code) · C5 channel discipline
488
+ (hybrid) · C6 draft→send integrity (hybrid) · C7 escalation appropriateness (judge) · C8 memory
489
+ hygiene (judge). C4 + dead-channel are partly infra → route to diagnostics (WHY=`dependency-failure`,
490
+ WHERE=`provider-side`), not a model judgment.
491
+
492
+ **GATE** (`*evaluate` rollup) — severity-gated **ternary** `fail ▸ incomplete ▸ pass` (GA): a
493
+ component **fails** iff a CRIT/HIGH criterion failed; is **incomplete** iff a CRIT/HIGH criterion
494
+ adjudicated `indeterminate` (and none failed) — the GA fix that kills the latent false-green; and
495
+ **passes** otherwise. The run takes the worst component state (`RunVerdict`). Advisory.
496
+
497
+ **Agent-variance** (EV-054) — two tracks, never merged: *eval-score variance* across N reruns of
498
+ the same suite, and *trajectory variance* (expected-decision vs observed-decision per behavior-tree
499
+ node). Latency (sample p95 127s) and cost are **diagnostics signals**, not eval criteria — the
500
+ evaluator notes and routes them, never "fixes".
501
+
502
+ ### §9.2 — Grounding · assumption kinds · observed-eligibility (GA)
503
+
504
+ Grounded Adjudication adds an evidence-honesty layer on top of the dimensions and classes above —
505
+ the discipline that keeps a verdict bound to what was actually seen (`references/grounded-adjudication.md`).
506
+
507
+ **Grounding tiers** (`evidence.grounding` — the OBSERVED-vs-INFERRED honesty cut, the per-criterion
508
+ `Grounding` enum):
509
+
510
+ | Tier | Meaning | Gate-eligible? |
511
+ |------|---------|----------------|
512
+ | **observed** | a failure was ACTUALLY seen in traces — cites non-empty `refs` + honest k/n `prevalence` (`k > 0`). | yes |
513
+ | **inferred** | a good-practice guard with no observed failure yet (the grandfather default for legacy criteria). | no — guard, not gate |
514
+ | **hypothesis-pending** | a hypothesis awaiting evidence (the weakest tier). | no |
515
+
516
+ **Assumption kinds** (`assumption.kind` — routes the calibration loop when an assumption blocks a
517
+ verdict, i.e. the `blockedBy.kind`):
518
+
519
+ | `kind` | The assumption is… | Routes to |
520
+ |--------|--------------------|-----------|
521
+ | **factual-intent** | a fact / intent missing from the trace | re-ground from the trace (calibrate) |
522
+ | **normative** | a value judgment the operator owns | operator ratification |
523
+ | **scope** | out-of-scope for this route | re-scope / narrow / retire |
524
+
525
+ (Assumption `status` lifecycle: `hypothesis → unverified → verified` graduate, **or** `→ eliminated`
526
+ — the calibration-loop terminal state: disproven / retired, not merely verified.)
527
+
528
+ **Observed-eligibility (GA-11 — the diff-discriminate cut).** A criterion qualifies as **observed**
529
+ only when it DISCRIMINATES: it fires on a BROKEN trace ∧ does NOT fire on a HEALTHY one. This stops
530
+ a good-practice guard from being laundered into an "observed" failure.
531
+
532
+ | Situation | Result |
533
+ |-----------|--------|
534
+ | fires on broken ∧ not on healthy | **observed** — gate-eligible (refs + honest k/n) |
535
+ | no healthy trace available | **graceful single-trace fallback** — diff SKIPPED, honest prevalence, TAGGED; never a hard fail |
536
+ | no discriminating diff | **inferred** — kept as a guard, not gate-eligible |
537
+
538
+ The evidence-first gate (`parseMinedCriterion`) enforces it: OBSERVED ⇒ non-empty `refs` ∧ `k > 0`.