Skip to main content
Glama

Measure where two judges disagree, and who was right

compute_divergence

Compare automated and human judgments on the same items to count disagreements and, when outcomes settle them, report engineRight and humanRight separately. See if human overrides earn their keep.

Instructions

Computes how often two independent judges (e.g. an automated engine and a human override) rated the same object differently, and -- where a later outcome exists to settle it -- reports engineRight and humanRight as two SEPARATE counts, never combined into one blended accuracy number (a system can be right most of the time overall and still wrong every single time a human bothers to overrule it, and that second fact is the one worth acting on). Divergence needs BOTH a count floor (minDivergentCount) and a rate floor (minDivergentRate) before it's 'reportable' -- either alone lets noise through. Calibration (who was right) carries its own separate floor (minResolvedDivergent) and its own status, so a population can legitimately have reportable divergence and refused calibration at the same time: plenty of disagreements, not enough of them settled by a later outcome yet. Supply group on each pair (or a custom config.groupBySource) to also get a sorted per-group breakdown alongside the overall report. Use this whenever a system has both an automated judgment and a human override/correction recorded for the same objects, to find out whether overruling the system is actually earning its keep. For grading one recommendation's own before/after outcome window instead of a whole population of engine-vs-human calls, use grade_decision.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pairsYesEvery occasion both judges could have spoken on. Pairs missing one judgment are still counted, just not comparable.
configNoFloors, thresholds, and optional custom grouping, every field optional with a library default (see advice-ledger-kit's DEFAULT_DIVERGENCE_CONFIG). Omit entirely to use the library's defaults.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does so richly: it discloses that engineRight/humanRight are never blended, that divergence requires BOTH a count and rate floor, that calibration has its own separate floor and status (so divergence can be reportable while calibration is refused), and that groupBySource runs in a worker thread with a bounded timeout and a code-trust caveat.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

It is front-loaded with the core computation, but the body is dense with nested parentheticals and run-on sentences that carry multiple ideas each. For a complex statistical tool the length is partly justified, yet several clauses could be trimmed without losing meaning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema and no annotations, the description must carry the load; it explains the computed counts, the floor semantics, the separate calibration status, and the grouping behavior. It stops short of describing the report's full shape (e.g. examples, overall structure), which is the one remaining gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds conceptual meaning beyond the per-field text: why two separate counts exist (system can be right overall yet wrong on every overrule) and why both floors must clear together. Some of this overlaps the schema's own phrasing, keeping it below a 5.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource ('computes how often two independent judges rated the same object differently') and even names the two output counts (engineRight/humanRight). It explicitly distinguishes itself from the sibling grade_decision by scope (population of engine-vs-human calls vs one recommendation's window).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives an explicit trigger ('use this whenever a system has both an automated judgment and a human override/correction recorded for the same objects') and an explicit alternative with its own condition ('for grading one recommendation's own before/after outcome window ... use grade_decision'). Nothing is left to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.