@mutagent/evaluator 0.1.0-alpha.5 → 0.1.0-alpha.6

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 (34) hide show
  1. package/.claude/skills/mutagent-evaluator/SKILL.md +5 -5
  2. package/.claude/skills/mutagent-evaluator/assets/agents/evaluator.md +16 -16
  3. package/.claude/skills/mutagent-evaluator/assets/code-quality-criteria.yaml +75 -0
  4. package/.claude/skills/mutagent-evaluator/lenses/methodology-critic-lens.md +1 -1
  5. package/.claude/skills/mutagent-evaluator/references/edd-loop.md +6 -6
  6. package/.claude/skills/mutagent-evaluator/references/eval-stage.md +36 -3
  7. package/.claude/skills/mutagent-evaluator/references/memory-format.md +1 -1
  8. package/.claude/skills/mutagent-evaluator/schemas/methodology-review.schema.yaml +1 -1
  9. package/.claude/skills/mutagent-evaluator/scripts/agent-dispatch.ts +0 -0
  10. package/.claude/skills/mutagent-evaluator/scripts/build-review-ui.ts +320 -6
  11. package/.claude/skills/mutagent-evaluator/scripts/cli/prep.ts +32 -2
  12. package/.claude/skills/mutagent-evaluator/scripts/cli/profile-subject.ts +1 -1
  13. package/.claude/skills/mutagent-evaluator/scripts/code-quality-verdict.ts +60 -68
  14. package/.claude/skills/mutagent-evaluator/scripts/config/schema.ts +3 -3
  15. package/.claude/skills/mutagent-evaluator/scripts/contracts/eval-matrix.ts +39 -0
  16. package/.claude/skills/mutagent-evaluator/scripts/determine-outcome.ts +8 -0
  17. package/.claude/skills/mutagent-evaluator/scripts/edd/change-request.ts +1 -1
  18. package/.claude/skills/mutagent-evaluator/scripts/edd/edd-types.ts +2 -2
  19. package/.claude/skills/mutagent-evaluator/scripts/judge-prompt-template.ts +144 -15
  20. package/.claude/skills/mutagent-evaluator/scripts/memory/append.ts +1 -1
  21. package/.claude/skills/mutagent-evaluator/scripts/memory/ratify.ts +165 -0
  22. package/.claude/skills/mutagent-evaluator/scripts/prep-tasks.ts +15 -4
  23. package/.claude/skills/mutagent-evaluator/scripts/read-manifest.ts +120 -0
  24. package/.claude/skills/mutagent-evaluator/scripts/read-unitf-traces.ts +34 -2
  25. package/.claude/skills/mutagent-evaluator/scripts/render-build-cards.ts +37 -0
  26. package/.claude/skills/mutagent-evaluator/scripts/render-eval-report.ts +9 -91
  27. package/.claude/skills/mutagent-evaluator/scripts/report-fragments.ts +173 -0
  28. package/.claude/skills/mutagent-evaluator/scripts/route-failures.ts +2 -2
  29. package/.claude/skills/mutagent-evaluator/scripts/run-pipeline.ts +39 -4
  30. package/.claude/skills/mutagent-evaluator/scripts/subject-profile.ts +82 -0
  31. package/.claude/skills/mutagent-evaluator/scripts/sync-eval-criteria.ts +2 -2
  32. package/.claude/skills/mutagent-evaluator/scripts/unitf-to-evaltrace.ts +64 -21
  33. package/bin/mutagent-cli.mjs +9 -5
  34. package/package.json +1 -1
@@ -103,7 +103,7 @@ reason for the rest. NEVER improvise.
103
103
  | `*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). |
104
104
  | `*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). |
105
105
  | `*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. |
106
- | `*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
+ | `*optimize` | 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-optimize`) | **ADL ③ OPTIMIZE / 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. |
107
107
  | `*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). |
108
108
  | `*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`. |
109
109
  | `*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). |
@@ -138,7 +138,7 @@ When you encounter a *<name> token:
138
138
  Invoke me with:
139
139
  - `evaluate skill <name>` / `evaluate agent <name>` / `/mutagent-evaluator` → **`*evaluate`** (default)
140
140
  - `*discover-evals` (mine criteria) · `build evals for <x>` · `validate judge <x>` · `*audit <subject>` (explicit only)
141
- - `*improve` (the ADL ③ EDD loop — variance-first then request-amend-reeval to full green, bounded)
141
+ - `*optimize` (the ADL ③ EDD loop — variance-first then request-amend-reeval to full green, bounded)
142
142
  - `*self-audit` (the eval-of-the-eval — audit my OWN eval-dev; on-demand only)
143
143
  - borrowed by `mutagent-skill-builder` SIMULATE (SimVerifier role)
144
144
  - `--reconfigure` to re-enter onboarding (subject + substrate)
@@ -151,7 +151,7 @@ Minimal eval-dev spine (build order — do NOT reorder):
151
151
  *discover-evals → deep-read traces, determine ✓/✗, mine 5-10 binary actionable criteria
152
152
  *build-evals → one critique-before-verdict judge (or code-check) per criterion
153
153
  *evaluate → run vs target → per-criterion binary+confidence → GATE verdict + variance
154
- *improve → ADL ③ EDD loop: F19 variance-first (stabilize per-case spread, repeat-N)
154
+ *optimize → ADL ③ EDD loop: F19 variance-first (stabilize per-case spread, repeat-N)
155
155
  BEFORE accuracy, then F18 closure (judge-only REQUESTS the ai-engineer to
156
156
  amend agentspec|impl over SendMessage → re-eval) → full green OR bounded STOP
157
157
  ```
@@ -159,7 +159,7 @@ Minimal eval-dev spine (build order — do NOT reorder):
159
159
  `*validate` (calibrate the judge) layers on top. `*audit` (the v1 4-tab master-audit) is an
160
160
  **explicit-only** specialized surface (complex / HTML-artifact subjects) — NOT part of the default
161
161
  evaluate spine and never an automatic fallback.
162
- `*improve` is the IMPROVE stage — it runs AFTER an initial `*build` + `*evaluate` and is **bounded**
162
+ `*optimize` is the OPTIMIZE stage — it runs AFTER an initial `*build` + `*evaluate` and is **bounded**
163
163
  (never infinite): full-green ⇒ DONE; else max-swings / max-wallclock / no-improvement ⇒ STOP + delta.
164
164
 
165
165
  **ADL EVAL-stage entry (`*eval`).** When `*build` hands over a freshly-built agent +
@@ -276,7 +276,7 @@ applies, EV-053/EQ5):
276
276
  | `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. |
277
277
  | `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. |
278
278
  | `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. |
279
- | `scripts/code-quality-verdict.ts` | W2I1 (⑤ IMPROVE) | hybrid | The **code-quality JUDGE mode** (`#mode-judge-code-quality`) — the (b) half of the ⑤ IMPROVE code-target BOTH-gate. Scores a `code` subject's QUALITY (spec-faithfulness · addresses-diagnosis · no-regression · error-handling · maintainability) BEYOND tests-green → severity-gated binary PASS/FAIL. `buildCodeQualityPrompt` (pure renderer, critique-before-verdict) + `codeQualityGatePass` (pure aggregate) + `runCodeQualityJudge` (C-PIN run wrapper on the injected JudgeInvoke seam). Judge-only (EV-051), host-runtime, pinned model + temp 0. **DISTINCT from `code-eval.ts`** (deterministic primitives — no LLM). `DEFAULT_CODE_QUALITY_CRITERIA` + its aggregation rule are FLAGGED-for-operator-sign-off. |
279
+ | `scripts/code-quality-verdict.ts` | W2I1 (⑤ OPTIMIZE) | hybrid | The **code-quality JUDGE mode** (`#mode-judge-code-quality`) — the (b) half of the ⑤ OPTIMIZE code-target BOTH-gate. Scores a `code` subject's QUALITY (spec-faithfulness · addresses-diagnosis · no-regression · error-handling · maintainability) BEYOND tests-green → severity-gated binary PASS/FAIL. `buildCodeQualityPrompt` (pure renderer, critique-before-verdict) + `codeQualityGatePass` (pure aggregate) + `runCodeQualityJudge` (C-PIN run wrapper on the injected JudgeInvoke seam). Judge-only (EV-051), host-runtime, pinned model + temp 0. **DISTINCT from `code-eval.ts`** (deterministic primitives — no LLM). `DEFAULT_CODE_QUALITY_CRITERIA` + its aggregation rule are FLAGGED-for-operator-sign-off. |
280
280
  | `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. |
281
281
  | `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). |
282
282
  | `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). |
@@ -20,9 +20,9 @@ ACTIVATION-NOTICE: This file contains your full agent operating guidelines. Read
20
20
  class: pure_subagent_executor
21
21
  isolation: none
22
22
 
23
- modes: [discover, judge, verify, improve] # discover · judge · verify (GA-5) · improve (EDD ③ — F18/F19)
23
+ modes: [discover, judge, verify, optimize] # discover · judge · verify (GA-5) · optimize (EDD ③ — F18/F19)
24
24
  judge_axes: [trajectory, criterion] # judge-mode fan-out axes
25
- # `improve` is the ADL ③ IMPROVE / Eval-Driven-Development (EDD) LOOP mode (F18+F19). It is a MODE of
25
+ # `optimize` is the ADL ③ OPTIMIZE / Eval-Driven-Development (EDD) LOOP mode (F18+F19). It is a MODE of
26
26
  # this ONE agent (the roster stays 3) — it drives the variance-first gate (F19) then, while still
27
27
  # JUDGE-ONLY (EV-051), REQUESTS the mutagent-builder ai-engineer to amend the Agent/AgentSpec (F18) over
28
28
  # SendMessage and re-evals, bounded by an afkloop-legal terminator. It NEVER fixes the subject itself.
@@ -456,9 +456,9 @@ commands:
456
456
  - "emit verified verdict (never flip, never fix)"
457
457
  preserves: "the GA-5 result-verifier contract (scripts/result-verify.ts verifyVerdict / verifyVerdicts) — see '## Mode: verify' below. A MODE of evaluator, not a 4th registered agent (grounded-adjudication.md sign-off c4)."
458
458
 
459
- # F18+F19: the ADL ③ IMPROVE / Eval-Driven-Development loop. A MODE of evaluator (roster stays 3),
459
+ # F18+F19: the ADL ③ OPTIMIZE / Eval-Driven-Development loop. A MODE of evaluator (roster stays 3),
460
460
  # not a new subagent. JUDGE-ONLY held: this mode REQUESTS the engineer to fix; it never patches.
461
- - improve:
461
+ - optimize:
462
462
  meta:
463
463
  what: "Drive the EDD loop: variance-first (F19) → REQUEST the builder ai-engineer to amend (F18) → re-eval → bounded terminate."
464
464
  does: "After the initial *build, FIRST stabilizes per-case VARIANCE (repeat-N the SAME cases, default 5; gate the spread) BEFORE measuring accuracy. While JUDGE-ONLY (EV-051), emits a structured EddChangeRequest (failing cases + grounded refs + remedy target agentspec|impl) to the mutagent-builder ai-engineer over SendMessage; consumes the ChangeRequestResponse; re-evals; loops to full green OR a bounded STOP."
@@ -466,7 +466,7 @@ commands:
466
466
  how: "scripts/edd/variance-gate.ts gates variance (evaluateVarianceGate · nextPhaseAfterVariance · assertVarianceStableBeforeAccuracy); scripts/edd/change-request.ts is the seam + the bounded terminator (buildChangeRequest · validate{Change,Response} · reEvalWarranted · decideEddLoop). The eval-runner (sibling) is consumed via the clean interface (references/edd-loop.md §Assumed eval-runner interface) — this mode REBUILDS no runner."
467
467
  display: "The EDD loop — variance-first, then request-amend-reeval to full green (bounded)"
468
468
  description: |
469
- PURPOSE: the ADL ③ IMPROVE stage. Drive the subject to full green via the
469
+ PURPOSE: the ADL ③ OPTIMIZE stage. Drive the subject to full green via the
470
470
  Eval-Driven-Development loop — F19 VARIANCE-FIRST (stabilize per-case spread
471
471
  BEFORE accuracy) then F18 EDD CLOSURE (REQUEST the builder ai-engineer to amend the
472
472
  Agent/AgentSpec, re-eval, repeat) — bounded by an afkloop-legal terminator.
@@ -475,11 +475,11 @@ commands:
475
475
  JUDGE-ONLY (EV-051): this mode NEVER edits the subject — it emits a grounded
476
476
  EddChangeRequest over SendMessage and re-evals what the engineer amends.
477
477
  NEVER self-dispatches the engineer's fix; NEVER skips re-eval on an amend.
478
- dispatch: { mode: improve }
478
+ dispatch: { mode: optimize }
479
479
  pre_gate.loads:
480
480
  - "references/edd-loop.md" # the F18/F19 loop doctrine + assumed eval-runner interface
481
481
  - "references/grounded-adjudication.md" # GA doctrine: every failing-case ask is grounded (≥1 ref)
482
- - "references/workflows/orchestrator-protocol.md" # the improve dispatch step
482
+ - "references/workflows/orchestrator-protocol.md" # the optimize dispatch step
483
483
  workflow:
484
484
  - "Pre-read references/edd-loop.md (the EDD doctrine + the assumed eval-runner interface) + references/grounded-adjudication.md"
485
485
  - "PHASE = variance (F19): for each case run repeat-N (default 5) via the eval-runner; collect per-case CaseVarianceObservation {verdicts[], trajectories?}"
@@ -496,7 +496,7 @@ commands:
496
496
  - "build GROUNDED change-request (failing cases + remedy target) — judge-only, request-not-patch"
497
497
  - "SendMessage to ai-engineer · consume response · re-eval on amend"
498
498
  - "bounded terminator (decideEddLoop): full-green ▸ DONE | swings/wallclock/no-improve ▸ STOPPED+delta"
499
- preserves: "JUDGE-ONLY (EV-051) — the improve mode REQUESTS a fix and re-evals; it never edits the subject. The amend is the mutagent-builder ai-engineer's job (the ONE agent allowed to touch the Agent/AgentSpec). See '## Mode: improve' below."
499
+ preserves: "JUDGE-ONLY (EV-051) — the optimize mode REQUESTS a fix and re-evals; it never edits the subject. The amend is the mutagent-builder ai-engineer's job (the ONE agent allowed to touch the Agent/AgentSpec). See '## Mode: optimize' below."
500
500
 
501
501
  resolution_contract: |
502
502
  When you encounter a *<name> token:
@@ -507,8 +507,8 @@ resolution_contract: |
507
507
  mode: judge, axis: trajectory => run #mode-judge-trajectory (preserves eval-matrix-judge); input is a .packet.json.
508
508
  mode: judge, axis: criterion => run #mode-judge-criterion (preserves eval-judge); input is a .task.json.
509
509
  mode: verify => run #mode-verify (GA-5 result-verifier; reviewer≠judge, downgrade-only); input is a decided verdict + its situation.
510
- mode: improve => run #mode-improve (EDD ③ loop — F19 variance-first then F18 request-amend-reeval, bounded). JUDGE-ONLY: REQUEST, never patch.
511
- mode: judge, axis: code-quality => run #mode-judge-code-quality (Wave-2 W2I1 — score a CODE subject's QUALITY for the ⑤ IMPROVE code-target BOTH-gate). JUDGE-ONLY; binary quality PASS/FAIL. Rubric mirrored in scripts/code-quality-verdict.ts.
510
+ mode: optimize => run #mode-optimize (EDD ③ loop — F19 variance-first then F18 request-amend-reeval, bounded). JUDGE-ONLY: REQUEST, never patch.
511
+ mode: judge, axis: code-quality => run #mode-judge-code-quality (Wave-2 W2I1 — score a CODE subject's QUALITY for the ⑤ OPTIMIZE code-target BOTH-gate). JUDGE-ONLY; binary quality PASS/FAIL. Rubric mirrored in scripts/code-quality-verdict.ts.
512
512
  4. DISPATCH-INPUT DISAMBIGUATION — the parent hands you files:
513
513
  a *.packet.json (MatrixPacket) => judge/trajectory, ALWAYS (matrix-judge path; no unit field).
514
514
  a *.task.json (JudgeTaskSpec) => unit.kind: "discover" => discover; else unit.axis: "criterion" => judge/criterion.
@@ -949,9 +949,9 @@ registered subagent** (the roster stays evaluator · dataset-builder · audit-ex
949
949
  - **Feeds the gate:** a downgraded CRIT/HIGH verdict makes the run **INCOMPLETE** (the ternary gate
950
950
  `fail ▸ incomplete ▸ pass`) — the latent false-green killer.
951
951
 
952
- ## Mode: improve ← EDD ③ IMPROVE loop (F18 closure + F19 variance-first)
952
+ ## Mode: optimize ← EDD ③ OPTIMIZE loop (F18 closure + F19 variance-first)
953
953
 
954
- THE **Eval-Driven-Development loop** — the ADL ③ IMPROVE stage. After the initial `*build` +
954
+ THE **Eval-Driven-Development loop** — the ADL ③ OPTIMIZE stage. After the initial `*build` +
955
955
  `*evaluate`, this mode drives the subject to **full green**. It is a **MODE of `evaluator`, not a new
956
956
  registered subagent** (the roster stays evaluator · dataset-builder · audit-executor). It backs
957
957
  `scripts/edd/variance-gate.ts` (F19) + `scripts/edd/change-request.ts` (F18). It stays **JUDGE-ONLY
@@ -1013,7 +1013,7 @@ never re-implements, the runner. The interface this mode ASSUMES (documented ver
1013
1013
  ### Governing invariants (must survive any merge)
1014
1014
 
1015
1015
  - `variance_before_accuracy` (F19): "Stabilize per-case variance (repeat-N, default 5) BEFORE measuring accuracy. The accuracy phase is entered ONLY when the variance gate passes (`assertVarianceStableBeforeAccuracy` THROWS otherwise). Accuracy over big samples is wasted on a flapping verdict."
1016
- - `judge_only_requests_never_patches` (F18 · EV-051): "The improve mode REQUESTS the builder ai-engineer to amend (over SendMessage) and re-evals what is amended. It NEVER edits the subject/spec/source itself — the mutagent-builder ai-engineer is the ONE agent allowed to touch the Agent/AgentSpec."
1016
+ - `judge_only_requests_never_patches` (F18 · EV-051): "The optimize mode REQUESTS the builder ai-engineer to amend (over SendMessage) and re-evals what is amended. It NEVER edits the subject/spec/source itself — the mutagent-builder ai-engineer is the ONE agent allowed to touch the Agent/AgentSpec."
1017
1017
  - `grounded_change_request` (F18 · GA-1): "Every failing case in a change-request carries the verbatim critique + ≥1 structured ref{obs,path,value}. An ungrounded ask fails loud (`validateChangeRequest`)."
1018
1018
  - `remedy_target_def_vs_impl` (F18): "The evaluator PROPOSES where the fix belongs — `agentspec` (the DEFINITION is wrong → def→impl cascade via *build) vs `impl` (a wiring/faithfulness defect). It proposes; the engineer decides + may reject with a reason."
1019
1019
  - `reeval_always_follows_amend` (F18): "An `amended` response ALWAYS triggers a fresh evaluation swing (from the variance phase). There is no 'fixed it, trust me, skip re-eval' path. A `rejected` response never re-evals an unchanged subject."
@@ -1030,9 +1030,9 @@ never re-implements, the runner. The interface this mode ASSUMES (documented ver
1030
1030
  C-PIN (pinned model + temperature 0).
1031
1031
  - **Additive to the runner:** consumes the assumed eval-runner interface; rebuilds nothing.
1032
1032
 
1033
- ## Mode: judge — axis code-quality ← the ⑤ IMPROVE code-target quality verdict (Wave-2 W2I1)
1033
+ ## Mode: judge — axis code-quality ← the ⑤ OPTIMIZE code-target quality verdict (Wave-2 W2I1)
1034
1034
 
1035
- The **(b) half of the ⑤ IMPROVE loop's code-target BOTH-gate.** For a `code`-kind subject, "converged"
1035
+ The **(b) half of the ⑤ OPTIMIZE loop's code-target BOTH-gate.** For a `code`-kind subject, "converged"
1036
1036
  requires BOTH (a) the subject's OWN test suite green — a hard DETERMINISTIC gate the ai-engineer
1037
1037
  reports and the optimize oracle records as `testsGreen` — AND (b) THIS code-quality verdict passing.
1038
1038
  This mode is (b): score the QUALITY of the applied code change, BEYOND tests-green (a deterministic
@@ -1064,7 +1064,7 @@ mirroring how the other judge prompts mirror their agent modes).
1064
1064
  ## Eval-leg reconcile — criteria MAINTENANCE, not judging (Wave-2 W2I5 · KP-003)
1065
1065
 
1066
1066
  The evaluator owns the **eval leg** of the def → impl → eval triad — the third leg of `#sync-spec`. When
1067
- an impl amends (the ⑤ IMPROVE loop's ai-engineer, or brownfield drift), the eval criteria that ground the
1067
+ an impl amends (the ⑤ OPTIMIZE loop's ai-engineer, or brownfield drift), the eval criteria that ground the
1068
1068
  subject's evaluation can go stale. The reconcile REASONING — which criteria a changed impl makes stale,
1069
1069
  what new criterion it needs — is the **ai-architect's** (`#sync-spec`, session-dispatched, Model-B). The
1070
1070
  evaluator exposes only the deterministic CONTRACT the reconcile reads/writes, in
@@ -0,0 +1,75 @@
1
+ # code-quality-criteria.yaml — the CODE-QUALITY rubric (⑤ OPTIMIZE code-target BOTH-gate, W2I1)
2
+ # ═══════════════════════════════════════════════════════════════════════════════
3
+ # THIS FILE IS THE RUBRIC. Edit it to tune what "code quality-pass" means — no code
4
+ # change, no release. `scripts/code-quality-verdict.ts` loads it at import time and
5
+ # exports it as DEFAULT_CODE_QUALITY_CRITERIA.
6
+ #
7
+ # WHAT IT GATES: for a subject whose medium is `code`, "converged" = the subject's OWN
8
+ # test suite green (deterministic) AND this rubric PASSes. Neither alone converges.
9
+ # Prompt/markdown subjects never touch this file — they converge on evals alone.
10
+ #
11
+ # AGGREGATION (severity-gated): a `fail` OR `uncertain` on any `critical`/`high`
12
+ # criterion BLOCKS the quality-pass. `medium` is advisory (recorded, never blocking).
13
+ #
14
+ # EDITING RULES:
15
+ # - `id` is a byte-identity key + report anchor. Changing an id breaks historical
16
+ # comparison — add a new criterion instead of renaming an old one.
17
+ # - Every criterion must be BINARY (decidable pass/fail), never a Likert score.
18
+ # - `severity` must be exactly one of: critical | high | medium.
19
+ # - Keep passDefinition/failDefinition CONCRETE — the judge must not have to guess.
20
+ # - Bump `version` on any change to this file.
21
+ #
22
+ # STATUS: the picks below are the conservative, subject-agnostic starting set
23
+ # (FLAGGED-for-operator-sign-off, Wave-2 W2I1) — a default, not a final contract.
24
+
25
+ version: 1
26
+
27
+ criteria:
28
+ - id: Q1-spec-faithful
29
+ statement: The implementation realizes the agentspec definition the amend targeted.
30
+ passDefinition: >-
31
+ PASS: every spec-declared tool / job-to-be-done is present and the operative
32
+ system_prompt is unchanged except where the amend intended; the def→impl cascade held.
33
+ failDefinition: >-
34
+ FAIL: a spec-declared tool or JTBD is missing, or the system_prompt was altered
35
+ beyond the amend intent (the impl forked from the SSoT).
36
+ severity: critical
37
+
38
+ - id: Q2-addresses-diagnosis
39
+ statement: The change targets the diagnosed root-cause locus, not an adjacent symptom.
40
+ passDefinition: >-
41
+ PASS: the edit is at (or directly causes a fix at) the RCA-named locus / the
42
+ failing-case root.
43
+ failDefinition: >-
44
+ FAIL: the change edits an unrelated place or patches a symptom while the root
45
+ cause remains.
46
+ severity: high
47
+
48
+ - id: Q3-no-regression
49
+ statement: The change introduces no unrelated regression and stays in scope.
50
+ passDefinition: >-
51
+ PASS: only the remedy-named surface changed; no unrelated behavior was removed
52
+ or broken.
53
+ failDefinition: >-
54
+ FAIL: unrelated code was changed/removed, or a previously-working path was broken.
55
+ severity: high
56
+
57
+ - id: Q4-error-handling
58
+ statement: Failure paths are handled, not silently dropped.
59
+ passDefinition: >-
60
+ PASS: error/failure branches surface, recover, or log per the subject's contract;
61
+ no new silent drop.
62
+ failDefinition: >-
63
+ FAIL: a failure is swallowed with no recovery/notify/observability (a silent-drop
64
+ regression).
65
+ severity: high
66
+
67
+ - id: Q5-maintainable
68
+ statement: The code is readable, framework-idiomatic, and free of obvious footguns.
69
+ passDefinition: >-
70
+ PASS: clear structure, idiomatic to the target framework, no dead code /
71
+ copy-paste / obvious footgun introduced.
72
+ failDefinition: >-
73
+ FAIL: unreadable/duplicated/dead code or an obvious maintainability footgun was
74
+ introduced.
75
+ severity: medium
@@ -44,7 +44,7 @@ findings:
44
44
  - mr: MR-7
45
45
  verdict: <fit | mis-fit | inefficient>
46
46
  observation: <what the run actually did at this methodology decision>
47
- recommendation: <concrete rearrange/improve proposal>
47
+ recommendation: <concrete rearrange/optimize proposal>
48
48
  impactRank: <1=highest> # ranked self-feedback (MR-5)
49
49
  advisory: true # NEVER gates the run
50
50
  ```
@@ -1,11 +1,11 @@
1
- # edd-loop — the ADL ③ IMPROVE / Eval-Driven-Development loop (F18 + F19)
1
+ # edd-loop — the ADL ③ OPTIMIZE / Eval-Driven-Development loop (F18 + F19)
2
2
 
3
- > **Loaded by:** the evaluator `improve` mode (`assets/agents/evaluator.md#mode-improve`). Load on demand.
3
+ > **Loaded by:** the evaluator `optimize` mode (`assets/agents/evaluator.md#mode-optimize`). Load on demand.
4
4
  > **Backed by:** `scripts/edd/variance-gate.ts` (F19) · `scripts/edd/change-request.ts` (F18) ·
5
5
  > `scripts/edd/edd-types.ts` + `schemas/edd-change-request.schema.yaml` (the contract).
6
6
  > **Sibling refs:** `grounded-adjudication.md` (every ask is grounded) · `validate-evaluator.md` (trust the judge first).
7
7
 
8
- The IMPROVE stage closes the **PR-011 spec↔impl↔eval triad**. A judge that only reports is half a
8
+ The OPTIMIZE stage closes the **PR-011 spec↔impl↔eval triad**. A judge that only reports is half a
9
9
  loop; EDD drives the subject to **full green** while the evaluator stays **judge-only (EV-051)** — it
10
10
  **REQUESTS** the `ai-engineer` to amend the Agent/AgentSpec and **re-evals**, but never
11
11
  patches the subject itself.
@@ -100,11 +100,11 @@ controller never reads a clock) → the decision is PURE + deterministic (C-PIN)
100
100
  ## Assumed eval-runner interface (the clean seam — REBUILD nothing)
101
101
 
102
102
  The EVAL engine (dataset build · the eval runner · Path A/B) is built **in parallel** (sibling
103
- worktree). The `improve` mode is **additive**: it orchestrates the LOOP around the runner and assumes
103
+ worktree). The `optimize` mode is **additive**: it orchestrates the LOOP around the runner and assumes
104
104
  this interface — it does not re-implement it.
105
105
 
106
106
  ```
107
- // the runner the improve mode CONSUMES (owned by the eval engine, e.g. run-evaluate.ts):
107
+ // the runner the optimize mode CONSUMES (owned by the eval engine, e.g. run-evaluate.ts):
108
108
  runOnce(caseIds: string[]) -> Array<{
109
109
  caseId: string;
110
110
  criterionId: string;
@@ -116,7 +116,7 @@ runOnce(caseIds: string[]) -> Array<{
116
116
  - **repeat-N** = `runOnce` called N times over the SAME `caseIds`; the per-rerun verdicts feed
117
117
  `CaseVarianceObservation.verdicts[]` (+ `trajectories[]`) → `evaluateVarianceGate`.
118
118
  - **accuracy** = `runOnce` over the FULL dataset → per-case verdicts → an accuracy ratio vs target.
119
- - the runner is **C-PIN** (pinned model + temperature 0). The improve mode adds **no** provider call.
119
+ - the runner is **C-PIN** (pinned model + temperature 0). The optimize mode adds **no** provider call.
120
120
 
121
121
  If the sibling runner exposes a different shape, adapt at the seam (map its result into
122
122
  `CaseVarianceObservation` / the accuracy ratio) — keep the gate + loop modules untouched. The gate
@@ -38,8 +38,37 @@ After `*build`, OFFER the two derivations (AskUserQuestion, parent session only)
38
38
  1. **`*build-dataset`** — materialize + grow the golden dataset from the spec.
39
39
  2. **`*build-evals`** — build the eval suite (and pick the engine).
40
40
 
41
+ **State what the stage will produce, up front (EVAL-1).** Before running either build,
42
+ EMIT the "what this stage will produce" notice (`renderStageProducesNotice`, `scripts/
43
+ render-build-cards.ts`) naming the deliverables — a **dataset** (golden cases + the sink
44
+ file) and/or the **eval criteria** (the judges/code-checks + their sink) — so the operator
45
+ knows what's coming. Notification only — **no approval gate** (operator constraint): once a
46
+ build is triggered, run it; don't ask for edit-approval, just present clearly.
47
+
41
48
  Let the user run either/both. They are independent; `*evaluate` consumes both.
42
49
 
50
+ **Either order — no hard sequence (EVAL-4).** There is NO build-time ordering rule between
51
+ the dataset and the criteria: you may build the **criteria first** and derive a dataset to
52
+ exercise them (when you can define "good" up front), or build a **dataset first** and mine
53
+ criteria from it (when you bring examples of good/bad and fit criteria to them). Start from
54
+ either end. The ONLY directional constraint is a RUN-TIME prerequisite, not a build order:
55
+ `*evaluate` cannot run against no dataset, so it auto-routes to `*build-dataset` first (below).
56
+ Do not mistake that run-time prerequisite for a build-time sequence.
57
+
58
+ **The three dataset pipelines — kept SEPARATE (EVAL-2).** Do NOT fuse the source paths into
59
+ one step (on a cold start there are no traces to ground against). They stay distinct:
60
+ 1. **cold-from-definition** — materialize the dataset from the agentspec (`materialize-dataset.ts`
61
+ `materializeFromAgentspec`). The only path with no traces.
62
+ 2. **from-labeled-traces** — grow the set from already-labeled traces
63
+ (`derive-dataset.ts` `deriveRegressionCases` / `growRegressionSet`).
64
+ 3. **seed-then-ground** — seed from the definition, THEN ground from traces (definition seeds →
65
+ traces ground). Reuses the shared monotonic merge floor (`build-dataset.ts` — nothing is ever
66
+ dropped), so the paths can be combined later without losing cases.
67
+
68
+ **Precedence — scored traces outrank a stale spec (EVAL-2).** When BOTH a spec and traces
69
+ carrying feedback/scores exist for the same case, the **scored traces WIN**: real observed
70
+ outcomes outrank a possibly-stale definition. The spec seeds; the scored traces correct.
71
+
43
72
  **Dataset gate (dogfood H5).** `*evaluate` REQUIRES a materialized dataset. If `*build-evals` runs
44
73
  (or `*evaluate` is invoked) with no dataset present, do NOT dead-end — auto-route to `*build-dataset`
45
74
  (interactive) first, then resume. Never leave the user with an eval suite and nothing to run it on.
@@ -126,9 +155,13 @@ Stream PROGRESS as wireframe cards for BOTH `*build-dataset` and `*build-evals`
126
155
 
127
156
  - `renderBuildDatasetProgressCard` / `renderBuildEvalsProgressCard` — phase +
128
157
  progress bar + counters, emitted per phase (F13/F16).
129
- - After each, emit the VERBOSE entity card (F22): `renderDatasetEntityCard`
130
- (per-category breakdown · version · sink) · `renderEvalsEntityCard` (engine ·
131
- SURFACED CC/log-sink dependency · criteria).
158
+ - **REQUIRED emission (EVAL-1).** After each build, you MUST emit the VERBOSE entity
159
+ card (F22) this is not optional: `renderDatasetEntityCard` (per-category breakdown ·
160
+ version · sink) · `renderEvalsEntityCard` (engine · SURFACED CC/log-sink dependency ·
161
+ criteria). A build that reports and a build that stays silent must NOT look identical
162
+ (the dogfood symptom). The renderers WARN loudly (`⚠ EMPTY`) when a build produced no
163
+ items/criteria, so a silent no-op build can never render as a success. No approval
164
+ branch — notification only.
132
165
 
133
166
  ---
134
167
 
@@ -21,7 +21,7 @@ name: <short-kebab-case-slug>
21
21
  description: <one-line summary — used to decide relevance during recall>
22
22
  metadata:
23
23
  type: user | feedback | project | reference # Claude Code's four types
24
- lifecycle: spec|build|evaluate|diagnose|improve|general # ADL extension
24
+ lifecycle: spec|build|evaluate|diagnose|optimize|general # ADL extension
25
25
  created: YYYY-MM-DD # REQUIRED · every memory is DATED (stale-pruning)
26
26
  ---
27
27
 
@@ -5,7 +5,7 @@
5
5
  # This is the SECOND requirement family: FITNESS, not conformance. It does not
6
6
  # pass/fail a component; it interrogates the methodology's own decision-tree,
7
7
  # workflow structure, and data-flow, and emits ranked recommendations to
8
- # rearrange / improve the process. MR-1..9 (Tab-4 lens reads these).
8
+ # rearrange / optimize the process. MR-1..9 (Tab-4 lens reads these).
9
9
  # ============================================================================
10
10
  $id: mutagent-evaluator/methodology-review
11
11
  title: Subject Methodology-Review Rubric