Back to skills
SKILL.md
Aqven Evaluate
ASecurityDesigns and interprets AQVEN evaluations, metrics, coverage invariants, Golden comparisons, and repeated-run stability matrices (pass@1, pass^m, gap, flaky items, fieldStability, partition ARI/F1, runOnlyLinked). Use whenever writing probe.evaluate or probe.stability, reading CLI/MCP run or matrix reports, comparing two runs or variants, or managing datasets and Golden benchmarks.
- 5 stars
- 0 votes
- 0 copies
- 0 views
- Added December 3, 2026
Works with
Security analysis
100/100npx -y skills add lastonoga/AQVEN --skill aqven-evaluate --agent claude-codeAre you the author of Aqven Evaluate?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/lastonoga-aqven-evaluate)---
name: aqven-evaluate
description: Designs and interprets AQVEN evaluations, metrics, coverage invariants, Golden comparisons, and repeated-run stability matrices (pass@1, pass^m, gap, flaky items, fieldStability, partition ARI/F1, runOnlyLinked). Use whenever writing probe.evaluate or probe.stability, reading CLI/MCP run or matrix reports, comparing two runs or variants, or managing datasets and Golden benchmarks.
---
# Evaluation, Metric Semantics, Coverage & Stability (`aqven-evaluate`)
Assume zero prior context: this skill explains **what every AQVEN metric means, how it is computed, how metrics interact, and how to decide whether a change actually improved the probe**.
## MUST
1. **Evaluate across all 3 orthogonal axes — never declare success from 1 number:**
- **Coverage / Conservation** (*Was every input processed and accounted for without ID loss/invention?*)
- **Correctness** (*Do outputs match ground truth / Golden and pass semantic review?*)
- **Repeatability / Stability** (*Does the probe produce the same answer across $m$ identical runs?*)
- *Trap 1:* `100%` coverage can coexist with `50%` semantic hallucinations.
- *Trap 2:* `pass^m = 1.0` (or `ARI = 1.0`) proves **zero variance**, NOT correctness — a model can be *consistently wrong* 10/10 times!
- *Trap 3:* A `+2` item gain on a single run (`n=1`) on items that normally flip `5/10` times is **sampling noise**, not an improvement.
2. **Golden datasets are evaluation references only — NEVER inference input** and never a hidden list of allowed names in prompts.
3. **Golden benchmarks are immutable once approved:** Never edit an approved Golden set in place; always use `aqven golden fork` with human sign-off.
4. **Never hardcode caps (`slice(0, 25)`) or domain enum literals in evaluation code:** 100–200+ items must evaluate without truncation.
5. **Check report `state` (`"fresh"` vs `"stale"` vs `"not_computed"`) before reading numbers:** If a Golden or Stability report is `"stale"` (probe matcher, embedder, or Golden changed), run its `recomputeCommand` first.
6. **Instrument observed failure modes BEFORE editing prompts or workflows:** After the first single-call `--smoke` run, inspect raw output items for repetition, child bloat, field echo, optional-field over-filling, verbosity, loops, ungrounded quotes, and category skew. Wire the matching `metric.*` / `check.*` primitives in `probe.ts` with explicit `polarity`, `target`, and `desc`, then run `$0` `aqven evaluate recompute <runId>` so the baseline defect rate is measured *before* your first fix.
---
## 1. The Four Kinds of "Coverage" (Never Conflate Them)
| Coverage Type | Formula / Source | Target & How to Interpret |
|---|---|---|
| **1. Execution Coverage** (`check.coverage()`) | `succeeded / total` batch items (`status === "ok"`). Fails loudly if `total === 0` (`"no items collected"`). | **Target: `100%`** (`errorRate = 0`). If `< 100%`, inspect `details.failedItems` (`{ itemKey, error }`) — this is an infra, schema-exhaustion, or wiring failure. |
| **2. ID Conservation / Set Cover** (`check.setCover`, `withCompleteness`) | Set relation between `expected` IDs and `observed` IDs (`mode: "bijection"` asserts `missing = 0`, `unknown = 0`, `duplicates = 0`). | **Target: `100%` (`0` violations).** Mandatory whenever every input record/candidate must be classified, kept/dropped, or merged into output clusters (`0` lost IDs, `0` invented IDs, `0` duplicate assignments). |
| **3. Keyed Subset Coverage** (`check.coverage({ expect, cover })` or `check.setCover` `superset`) | Every key in `expect(ctx)` appears at least once in `cover(item)` (`details.uncovered = []`). | **Target: `100%` of expected keys**, when duplicates are allowed (unlike `mode: "bijection"`). |
| **4. Source Citation Rate** (`cited / input`) | Unique input item/record IDs referenced in output / total inputs. | **NOT a 100% target!** Many real inputs contain zero target entities. Forcing `cited/input -> 100%` causes hallucinations. Only verify uncited inputs were *processed* (`attempt.prompt`), not silently dropped. |
### Built-In `@aqven/runtime` Evaluate Helpers (`probe.ts`)
Import `{ check, metric }` from `@aqven/runtime` rather than hand-rolling `pass()`/`fail()` loops:
- **Relational `check.*` algebra:**
- `check.coverage()` / `check.coverage({ expect, cover })` — batch execution or keyed coverage check.
- `check.everyItem({ name, items, key, where, onEmpty? })` — per-item tuple predicate (`where(item, ctx)` returns `boolean` or `{ ok, reason?, details? }`).
- `check.cardinality({ name, items, of?, key?, min?, max?, onEmpty? })` — collection or per-item child count bounds (`[min, max]`).
- `check.uniqueBy({ name, items, key | keys, itemId?, nullish? })` — scalar, composite, or fan-out (`keys`) cross-item disjointness.
- `check.foreignKey({ name, from, fromId?, ref | refs, to, toKey, consistent?, nullish? })` — referential integrity (`from -> to`) plus optional equi-join `consistent(child, parent, ctx)` predicate.
- `check.functionalDependency({ name, items, determinant, dependent, itemId?, nullish? })` — Codd FD (`determinant(a) = determinant(b) => dependent(a) = dependent(b)`).
- `check.implication({ name, items, key?, when, then, onEmpty? })` — conditional field coupling / co-nullability (`when(x) => then(x)`).
- `check.groundedQuote({ name, items, key?, quote, sourceText, minContainment?, onEmpty? })` — verifies verbatim `quote` grounding against `sourceText`.
- `check.setCover({ name, mode, observed, expected, onEmptyExpected? })` — universal set relation (`"bijection" | "setEqual" | "subset" | "superset" | "disjoint"`).
- `check.attempts({ name?, maxFailed?, maxRunaway?, maxRetries? })` — journaled attempt invariant (defaults to `maxFailed: 0`; add `maxRunaway: 0` to fail on `finish_reason === "length"`).
- **Typed `metric.*` algebra (core shapes + `$0` reference-free LLM noise/quality detectors):**
- `metric.errorRate()` — `{ value: failed / total, total, failed }`; `metric.retryRate()` — `{ value: retries / total, numerator, denominator }`.
- `metric.scalar({ name, primary?, unit?, polarity?, target?, value | (items, of?, reduce) })` — direct numeric value or collection reduction (`"count" | "sum" | "mean" | "min" | "max"`).
- `metric.ratio({ name, primary?, (numerator, denominator) | (over, where) })` — `{ value: denominator === 0 ? null : numerator / denominator, numerator, denominator }`.
- `metric.distribution({ name, primary?, items, by, domain? })` — `{ total, counts }`, preserving `0`-count categories when `domain` (e.g. `myEnum.values`) is supplied.
- `metric.funnel({ name, primary?, stages: [{ stage, value }] })` — ordered stage counts `{ stages }`.
- `metric.stats({ name, primary?, values | items, of?, bins? })` — `{ count, sum, mean, min, p50, p95, max, bins? }`.
- `metric.violationRate(check | { name?, check, ...meta })` — soft violation rate (`failed / applicable`) of any `check.*` before promoting it to a hard gate.
- `metric.redundancy({ name, items, groupBy?, key?, matcher?, nullSubsumes? })` — intra-run / per-parent duplicate, `@aqven/matching` near-duplicate, or `nullSubsumes` partial-record redundancy.
- `metric.fieldEcho({ name, items, target, sources, minOverlap?, includeNumbers? })` — flags text fields echoing numbers or stems from sibling structured `sources`.
- `metric.fillRate({ name, items, of })` & `metric.verbosity({ name, items, text, measure? })` — optional-field bloat rate and text length quantiles (`words` | `chars` | `bytes`).
- `metric.degeneration({ name, items, text, n?, maxRepN?, maxCompressionRatio? })` — repetition loop (`rep-n`) and `node:zlib` compressibility detector.
- `metric.categoryEntropy({ name, items, by, domain? })` — normalized Shannon entropy $H / \ln K \in [0, 1]$ (`0` = enum/mode collapse, `1` = uniform).
- `metric.quoteGrounding({ name, items, quote, sourceText, minContainment? })` — share of citations verified against `sourceText`.
- **`$0` Evaluate Recompute:** After adding or editing `probe.evaluate`, refresh persisted runs/matrices without new LLM calls via `aqven evaluate recompute --probe <id>` (`--all`), `aqven run <id> --recompute`, `aqven stability recompute <matrixId>`, or Studio's **Recompute** button.
- Always mark **one** headline business metric with `primary: true`, and verify every new check **can fail** on a broken fixture before trusting green.
### Mapping First-Smoke Noise & Defects to Built-In Primitives
| What you observe in raw smoke items | Built-in `probe.evaluate` primitive to attach first | Typical `polarity` / `target` |
|---|---|---|
| Duplicate items, split child records, or `null`-stub siblings alongside populated entries | `metric.redundancy({ groupBy?, key \| matcher, nullSubsumes? })` + `check.uniqueBy` | `polarity: "lower"`, `target: { max: 0 }` |
| Free-text notes repeating numbers/words from sibling structured fields (`price`, `name`, `unit`) | `metric.fieldEcho({ target, sources, includeNumbers: true })` | `polarity: "lower"`, `target: { max: 0 }` |
| Nullable/optional commentary fields over-populated with filler text | `metric.fillRate({ items, of })` + `metric.verbosity({ items, text, measure: "words" })` | `polarity: "lower"` |
| Co-nullability / conditional field coupling violated (`price === null` yet `unit !== null`) | `check.implication({ when, then })` (or soft `metric.violationRate(check.implication(...))`) | `passed` / `target: { max: 0 }` |
| Looping phrases or repetitive boilerplate in rationales/descriptions | `metric.degeneration({ items, text })` | `polarity: "lower"`, `target: { max: 0 }` |
| Paraphrased or fabricated `quote` citations | `metric.quoteGrounding({ quote, sourceText })` / `check.groundedQuote` | `polarity: "higher"`, `target: { min: 0.98 }` |
| Model collapsing most items into 1 default enum bucket or burning repair retries | `metric.distribution` + `metric.categoryEntropy` + `metric.retryRate()` | `entropy` monitored; `retryRate` `max: 0` |
---
## 2. Reading Run-vs-Golden Reports (`aqven_run_get` / `aqven run <id> --golden --json`)
Persisted in `stability_reports` (`scope: "run_golden"`). Read via MCP `aqven_run_get({ runId, selectors: ["golden"], goldenSlice: "summary" | "missing" | "runOnly" | "matched" | "fields" | "partition" | "confusion", limit?, offset? })` or `aqven_run_conclude({ runId })`, or CLI `aqven run <runId> --golden --json` (recompute if stale: `--golden --recompute`):
### `comparison.totals` & `confusionMatrices` — Precision, Recall & Near-Miss Diagnosis
- `golden`: reference item count; `runItems`: candidate items extracted by `probe.stability.items(result)`.
- `matched`: 1-to-1 bipartite matches where **every** declared field passed its threshold (**Recall** $= \text{matched} / \text{golden}$).
- `missing`: unmatched Golden items (`golden - matched`); `runOnlyClusters`: unmatched extra items produced by the run.
- `precision` ($\text{matched} / (\text{matched} + \text{runOnlyClusters})$) and `f1` (harmonic mean of precision & recall): computed automatically on `totals`.
- **`runOnlyLinked` vs `unlinkedRunOnly` (Critical Near-Miss vs Hallucination Split!):**
- `runOnlyLinked`: `runOnly` items that are the `nearestOf` a `missing` Golden item (near-misses!).
- `unlinkedRunOnly` (`runOnlyClusters - runOnlyLinked`): extra items unattached to any `missing` Golden item (pure false positives, hallucinations, or duplicate splits).
- **`confusionMatrices[]` (`{ field, labels, matrix }`):** generated automatically over matched pairs for every non-identity categorical `exact` field — inspect directly to spot systematic class-pair swaps.
**How to interpret `missing` + `runOnlyLinked` + `unlinkedRunOnly` together:**
1. **`missing > 0` AND `runOnlyLinked` is high:** Open `runOnly[].nearestOf[].failedFields` and `rows[].fieldScores`! The model **found the entity**, it was *not* missed — either one field failed (e.g. wrong category/number, over-specific rename) or `stability.fields` matcher is too strict (`exactMatcher` where `identifierSafeEmbeddingMatcher` is needed).
2. **`missing > 0` AND `nearestScore` is low/`null`:** True **recall miss** (or `wrongDrop` in a clean/dedup stage).
3. **`unlinkedRunOnly > 0` (especially when `missing === 0`):** Pure **false-positive / hallucination / duplicate split**. Audit whether any `runOnly` item is actually right in the source text -> if so, propose `golden fork` to the owner!
### `comparison.partition` (When Grouping / Clustering Entities)
When `probe.stability.partition: { clusterBy, of?, discriminatorField? }` is declared (omit `of` for homogeneous item sets; set `of` + optional `discriminatorField` when filtering mixed item kinds):
- `ari` (**Adjusted Rand Index** $\in [-1, 1]$): label-invariant clustering agreement (`1.0` = identical grouping even if group names changed; `0.0` = random; `< 0` = worse than random).
- `f1`: pairwise co-membership F1 (*do items that belong together stay together?*).
- `moved[]`: matched entities placed in the wrong group (`runCluster` vs `goldenCluster`) — your exact list of mis-grouped items!
- `degenerate: true`: warning that all items collapsed into 1 cluster or all singletons.
---
## 3. Reading Repeatability / Stability Matrices (`aqven_matrix_get` / `stabilize`)
Launched via `aqven stabilize <probeId> --dataset <path> -n 10` (**only after owner approves smoke!**). Read via MCP `aqven_matrix_get({ matrixId, selectors: ["summary", "metrics", "flaky", "intraRunSplits"], match?, minPresent?, maxPresent?, limit?, offset? })` (compact multi-dimensional slices, plus legacy `infra`/`report`/`items` selectors, or stream raw slices via `aqven_matrix_content` with `encoding: "utf8"` + `jsonPath`) or CLI.
Always read the **3 layers in order**:
### Layer 1: `infra` (Check First!)
`{ done, error, retries, errorAttempts, runawayAttempts, totalCost, durationMs: { min, avg, max } }`
- `runawayAttempts`: attempts where `finish_reason === "length"` (output/reasoning hit `max_tokens`).
- **Rule:** If `infra.error > 0` or `runawayAttempts > 0`, **stop semantic analysis** and fix provider routing, concurrency (`aqven.config.ts`), or `maxOutputTokens` (`aqven-models`). Never tune prompts to fix provider storms.
### Layer 2: Item Repeatability (`passAt1`, `passAtM`, `gap`, `flaky`)
- **`passAt1` (`pass@1` $\in [0, 1]$):** average fraction of aligned universe items present in one run (optimistic single-run expectation).
- **`passAtM` (`pass^m` $\in [0, 1]$):** fraction of items present across **ALL $m$ runs** (`stableCount / itemsTotal` — pessimistic production consistency guarantee).
- **`gap` (`pass@1 - pass^m`):** **the pure instability / flakiness score.**
- `gap <= 0.05`: highly repeatable.
- `gap > 0.15`: major run-to-run churn (ambiguous prompt boundary, unpinned backend, `temperature > 0`, or `int4` quantization drift).
- **`flaky[]` (`{ id, text, present, runs }`, $0 < \text{present} < m$):** sorted most unstable first:
- `present = 1..2 / 10`: sporadic hallucination or rare duplicate split -> tighten negative criteria or merge rule.
- `present = 4..6 / 10`: genuine boundary ambiguity -> add 1 explicit rule to `promptedEnum` / `prompt.ts` (or move to Golden edge cases).
- `present = 8..9 / 10`: occasional recall drop (check batch length / tail attention or `llm_retry`).
- **`intraRunSplits[]` (`{ entityId, text, runsWithDuplicates, totalRuns, examples }`):** detects when a **single run** emits 2+ items collapsing into the same aligned entity cluster (duplicate entity splits hidden inside one run even if `pass^m` looks high!).
### Layer 3: Where Does Instability Live? (`fieldStability` & `meanPairwiseSimilarity`)
- `meanPairwiseSimilarity` $\in [0, 1]$: U-statistic mean similarity across all $\binom{m}{2}$ run pairs.
- **`fieldStability[]` (`{ field, type, mean, majorityAgreement?, goldenPassRate? }`):** isolates *which field* flips!
- Example: `category.mean = 0.99`, `label.mean = 0.54` -> classification is rock-solid; only wording varies!
- **Preventing Embedding Numeric Blindness & Alias Misses (`@aqven/matching`):**
- Raw embeddings score `"Item 1"` vs `"Item 2"` (or `"Plan A"` vs `"Plan B"`) at `0.97` cosine! Use `identifierSafeEmbeddingMatcher({ threshold: 0.85 })` (composite `identifierStemExtractor -> embeddingMatcher` + `identifiersExtractor -> exactSetMatcher` AND-veto) and `aliasField({ primary, aliases, matcher?, nullish? })` for `[primary, ...aliases]` best-pair matching:
```ts
label: identifierSafeEmbeddingMatcher({ threshold: 0.85 }),
entityName: aliasField({ primary: (x) => x.name, aliases: (x) => x.aliases, nullish: "skip" }),
```
- **Progressive Field Scoping & Stage-by-Stage Attribution:**
- On multi-field outputs, lock and optimize **primary entity identity** (plus equivalent surface forms via `aliasField`) first; re-enable secondary attributes (categories, links, numeric fields) only after identity recall/precision are solid so attribute noise does not mask identity progress.
- On multi-stage matrices (`extract -> merge -> critic` or `divergent -> converge -> critic`), measure recall/precision **before and after each stage** to pinpoint whether losses come from upstream recall, bucket/shard sizing, or critic self-preference bias — and run deterministic EDA on structural input features (length, evidence count, cluster size) vs `present/m` before inventing new rules.
---
## 4. How to Compare Run A vs Run B or Matrix A vs Matrix B (Decision Rules)
Before claiming Variant B beat Baseline A (use MCP `aqven_run_compare({ runA, runB })` for single runs, `aqven_matrix_compare({ matrixA, matrixB })` for stability/variant matrices, or CLI `aqven conclude <runB>`):
1. **Verify Baseline Compatibility:** Same `datasetRef`, `inputHash`, Golden version, and pinned provider. If any changed, establish a fresh baseline run first.
2. **Check Precision–Recall Coupling (Never Optimize One Blindly):**
- `matched ↑` while `runOnlyClusters ↑↑` -> **Rejected / Needs refinement:** prompt became too loose and flooded output with false positives.
- `runOnlyClusters ↓` while `matched ↓` -> **Rejected (`wrongDrop`):** cleanup rule deleted valid entities; inspect newly `missing` Golden rows.
- `matched ↑` AND `runOnlyClusters <=` AND `checks` green AND `cost/latency` within budget -> **Valid improvement.**
3. **Check Critic / Loop Repeatness (on `andCriticLoop` probes):**
- Inspect loop iterations (`#1`, `#2`, `#3`): track `meanRepairIterations` and `exit.outcome` (`"approved"` vs `"stalled"` / `"exhausted"`). If the critic repeats the same complaint across turns (`repeatness` / overloop) or oscillates `keep <-> drop`, more iterations will not help — align critic instructions with schema invariants or add repeat-critique stopping in `shouldStop`.
4. **Choose Repeat Count ($m$) & Equal-Budget Baselines:**
- Exploration / screening (`--matrix` on dev slice): `m = 1` to `3` repeats.
- Confirming a subtle prompt/quantization change or production gate: `m = 8` to `12` repeats (typically `-n 10`). An accuracy gain only counts if `pass^m` (and `ARI`) did not regress!
- **Equal-budget fairness:** A multi-call workflow (`andDivergent`, `andCriticLoop`, split pipeline) can beat a single call simply because it spent `3x` more tokens. Compare multi-call designs against an equal-budget control (or explicit cost-per-correct-item target) before crediting the architecture.
---
## 5. Golden Dataset Design (4 Buckets) & Judge Calibration
### The 4 Mandatory Golden Buckets
*60 distinct boundary cases beat 500 random easy records.* Cover all 4 buckets without benchmark leakage:
1. **Production sample:** messy real-world inputs at native quality/length.
2. **Decision-boundary / edge cases:** items sitting right between adjacent `promptedEnum` classes, multi-entity collisions, numbered siblings (`"Unit 1"` vs `"Unit 2"`).
3. **Negative controls / empty / OOD:** inputs with **zero** valid matches (tests the `[]` empty-array pathology!), unreadable/cut-off inputs (`cannot_tell`), and out-of-scope records (`other`).
4. **Failure replays:** every confirmed production or smoke failure promoted into a regression case.
### Testing by Node Archetype & Calibrating Judges
- **Extractor:** deterministic ID/span conservation + bipartite Golden recall/precision (`runOnlyLinked` + `failedFields`).
- **Classifier / Router:** per-class confusion pairs + OOD/`cannot_tell` handling + downstream route accuracy.
- **Critic / LLM-as-a-Judge:** a judge is itself a model with **position bias**, **verbosity bias**, and **self-preference bias**:
- Require `rationale` *before* `verdict`, prefer cross-family judges over self-judging, and test the critic itself against **planted defects** (recall) + **clean negative controls** (false-alarm rate). Human inter-rater agreement is the ceiling: if humans disagree on labels, fix the rubric definition before tuning models.
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.