Skip to content
Back

Model knockout

Answers from several models in a knockout bracket judged by another model: open any match to compare both answers, their scores and why one won; once the final is settled the champion's route turns blue.

oxyn add model-knockout
MCP

Judge

Fix: a retried payment charges the customer twiceJudgingQuarterfinal · 1/7
Quarterfinal 1Opus 4.1 is comparing…
Idempotency key
Opus · 18 added, 4 removed · 3 files · tests 42 of 42

Every charge carries a key derived from the order; a retry with the same key returns the first result.

charge(order, key: hash(order.id, attempt_group))
Webhook dedupe
GPT-5 · 31 added, 9 removed · 4 files · tests 40 of 42

Drops repeated provider webhooks by event id before they reach the ledger.

if seen(event.id) { return Ok(()) }
Dioxus
rsx! {
    ModelKnockout {
        contenders: Some(answers.seeded()),
        verdicts: Some(judge.verdicts()),
        judge: "Opus 4.1",
        now: clock.now(),
        on_pick: move |id| apply(id),
    }
}

Rendered from Rust at build time · goes live when visible

When to use

  • Pick the best of many answers by pairwise judging: a judge model compares two answers at a time in a single-elimination bracket, and the champion's route through the rounds is the result.

When not to use

  • An agent asks before it acts: use Approval Card instead.
  • Several open requests in one card: use Approval pager instead.
  • An agent's question in its own card above the composer: use Decision Card instead.

Installation

Model knockout is free and MIT. The oxyn CLI copies its code, and the components it needs, into src/oxyn/ of your Dioxus or GPUI project, so it is yours to change.

Terminal
cargo install --git https://github.com/ismailqureshi72/Oxyn oxyn-cli
oxyn init
oxyn add model-knockout
Rust
use crate::oxyn::{ModelKnockout, STATUS_INDICATOR_CSS};

Rather depend on the crate? cargo add oxyn-dioxus oxyn-core --git https://github.com/ismailqureshi72/Oxyn, then use oxyn_dioxus::{ModelKnockout, STATUS_INDICATOR_CSS};

Usage

Dioxus · rust
rsx! {
    ModelKnockout {
        contenders: Some(answers.seeded()),
        verdicts: Some(judge.verdicts()),
        judge: "Opus 4.1",
        now: clock.now(),
        on_pick: move |id| apply(id),
    }
}

Examples

Live

Plays and loops: each match shimmers while the judge compares, the preferred answer moves on, the other fades but stays; at the end the winner's way lights up and a cup appears.

Judge

Fix: a retried payment charges the customer twiceJudgingQuarterfinal · 1/7
Quarterfinal 1Opus 4.1 is comparing…
Idempotency key
Opus · 18 added, 4 removed · 3 files · tests 42 of 42

Every charge carries a key derived from the order; a retry with the same key returns the first result.

charge(order, key: hash(order.id, attempt_group))
Webhook dedupe
GPT-5 · 31 added, 9 removed · 4 files · tests 40 of 42

Drops repeated provider webhooks by event id before they reach the ledger.

if seen(event.id) { return Ok(()) }
Code
rsx! {
    ModelKnockout {
        contenders: Some(answers.seeded()),
        verdicts: Some(judge.verdicts()),
        judge: "Opus 4.1",
        now: clock.now(),
        on_pick: move |id| apply(id),
    }
}

Judging

Quarterfinals decided, a semifinal being judged: its names shimmer and the panel says the judge is comparing.

Judge

Fix: a retried payment charges the customer twiceJudgingSemifinal · 5/7
Semifinal 1Opus 4.1 is comparing…
Idempotency key
Opus · 18 added, 4 removed · 3 files · tests 42 of 42

Every charge carries a key derived from the order; a retry with the same key returns the first result.

charge(order, key: hash(order.id, attempt_group))
Row lock
Gemini · 12 added, 2 removed · 2 files · tests 42 of 42

Locks the order row while charging so a second attempt waits and then sees it paid.

SELECT … FROM orders WHERE id = $1 FOR UPDATE
Code
rsx! {
    ModelKnockout {
        contenders: Some(answers.seeded()),
        verdicts: Some(judge.verdicts()),
        judge: "Opus 4.1",
        now: clock.now(),
        on_pick: move |id| apply(id),
    }
}

Match open

A decided quarterfinal opened: both answers with their meta line, code and score, the Winner tag and the judge's reason.

Judge

Fix: a retried payment charges the customer twiceJudgingSemifinal · 6/7
Quarterfinal 2Judged by Opus 4.1
Row lockWinner8.0
Gemini · 12 added, 2 removed · 2 files · tests 42 of 42

Locks the order row while charging so a second attempt waits and then sees it paid.

SELECT … FROM orders WHERE id = $1 FOR UPDATE
Retry cap5.2
Grok · 6 added, 1 removed · 1 file · tests 38 of 42

Stops the client after one retry; fewer doubles, but timeouts now fail the order.

retries: 1

Judge's reasonBoth stop the double, but the cap turns slow networks into failed orders.

Code
rsx! {
    ModelKnockout {
        contenders: Some(answers.seeded()),
        verdicts: Some(judge.verdicts()),
        judge: "Opus 4.1",
        now: clock.now(),
        on_pick: move |id| apply(id),
    }
}

Not judged

A semifinal whose contenders aren't known yet: dashed empty slots, Not judged yet.

Judge

Fix: a retried payment charges the customer twiceJudgingQuarterfinal · 3/7
Semifinal 2Not judged yet
Waits for the match before it
Waits for the match before it
Code
rsx! {
    ModelKnockout {
        contenders: Some(answers.seeded()),
        verdicts: Some(judge.verdicts()),
        judge: "Opus 4.1",
        now: clock.now(),
        on_pick: move |id| apply(id),
    }
}

Decided

The final decided: the winner's way in blue round after round, a cup in the final, and a Use button.

Judge

Fix: a retried payment charges the customer twiceIdempotency key winsDecided · 7/7
FinalJudged by Opus 4.1
Idempotency keyWinner9.4
Opus · 18 added, 4 removed · 3 files · tests 42 of 42

Every charge carries a key derived from the order; a retry with the same key returns the first result.

charge(order, key: hash(order.id, attempt_group))
Client token8.1
Qwen · 22 added, 5 removed · 3 files · tests 42 of 42

The checkout page mints a token once and the server refuses a reused one.

require_fresh(token)?

Judge's reasonSmallest change that closes every path to a second charge, with full tests.

Code
rsx! {
    ModelKnockout {
        contenders: Some(answers.seeded()),
        verdicts: Some(judge.verdicts()),
        judge: "Opus 4.1",
        now: clock.now(),
        on_pick: move |id| apply(id),
    }
}

Four

Four contenders: semifinals and a final.

Judge

Fix: a retried payment charges the customer twiceIdempotency key winsDecided · 3/3
FinalJudged by Opus 4.1
Idempotency keyWinner9.4
Opus · 18 added, 4 removed · 3 files · tests 42 of 42

Every charge carries a key derived from the order; a retry with the same key returns the first result.

charge(order, key: hash(order.id, attempt_group))
Client token8.1
Qwen · 22 added, 5 removed · 3 files · tests 42 of 42

The checkout page mints a token once and the server refuses a reused one.

require_fresh(token)?

Judge's reasonSmallest change that closes every path to a second charge, with full tests.

Code
rsx! {
    ModelKnockout {
        contenders: Some(answers.seeded()),
        verdicts: Some(judge.verdicts()),
        judge: "Opus 4.1",
        now: clock.now(),
        on_pick: move |id| apply(id),
    }
}

Narrow

When the rounds don't fit, each round becomes a list with one match a row and the answers stack.

Judge

Fix: a retried payment charges the customer twiceIdempotency key winsDecided · 7/7
FinalJudged by Opus 4.1
Idempotency keyWinner9.4
Opus · 18 added, 4 removed · 3 files · tests 42 of 42

Every charge carries a key derived from the order; a retry with the same key returns the first result.

charge(order, key: hash(order.id, attempt_group))
Client token8.1
Qwen · 22 added, 5 removed · 3 files · tests 42 of 42

The checkout page mints a token once and the server refuses a reused one.

require_fresh(token)?

Judge's reasonSmallest change that closes every path to a second charge, with full tests.

Code
rsx! {
    ModelKnockout {
        contenders: Some(answers.seeded()),
        verdicts: Some(judge.verdicts()),
        judge: "Opus 4.1",
        now: clock.now(),
        on_pick: move |id| apply(id),
    }
}

Classic

Classic style: header band, framed answers panel, squarer slots.

Judge

Fix: a retried payment charges the customer twiceJudgingSemifinal · 6/7
Quarterfinal 2Judged by Opus 4.1
Row lockWinner8.0
Gemini · 12 added, 2 removed · 2 files · tests 42 of 42

Locks the order row while charging so a second attempt waits and then sees it paid.

SELECT … FROM orders WHERE id = $1 FOR UPDATE
Retry cap5.2
Grok · 6 added, 1 removed · 1 file · tests 38 of 42

Stops the client after one retry; fewer doubles, but timeouts now fail the order.

retries: 1

Judge's reasonBoth stop the double, but the cap turns slow networks into failed orders.

Code
rsx! {
    ModelKnockout {
        contenders: Some(answers.seeded()),
        verdicts: Some(judge.verdicts()),
        judge: "Opus 4.1",
        now: clock.now(),
        on_pick: move |id| apply(id),
    }
}

API reference

ModelKnockout

PropTypeDefaultDescription
contendersOption<Vec<JbContender>>Default::default()Contenders in seed order (the demo's when `None`).
verdictsOption<Vec<JbVerdict>>Default::default()Verdicts so far (the demo's when `None`).
liveboolDefault::default()Demo: reveal the verdicts one by one and loop.
judgeString"Opus 4.1"The judge model.
taskString"Fix: a retried payment charges the customer twice"The task.
openOption<(usize, usize)>Default::default()The match whose answers are open from the start (round, match); the one being judged (or the final) when `None`.
titleString"Judge"Heading.
nowrequiredClockMs—The clock.
styleStringDefault::default()`clean`, `classic`, or empty to follow `data-cstyle`.
on_pickOption<EventHandler<String>>Default::default()Show a Use button on the decided final; called with the champion's id.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
TabMatch by match, then the answers and Use
→or←Forward to the next-round match, or back to the first feeder
↑or↓Previous and next match in the round
EnterorSpaceOpens or closes a match's answers
EscapeBack to the match being judged

Accessibility

  • Each match is a button named with both contenders and the result (or that it is being judged).
  • The winner keeps full colour and its score; the loser fades and its outline turns dashed – never colour alone.
  • Progress (round · decided/total) is a status region; reduced motion makes everything simply appear.

Responsive behaviour

  • Rounds share the width with fixed slot heights; the elbows join each pair into the next round.
  • Under 560 px each round is a list with one match a row and the two answers stack.
Edge cases (spec)

Rounds share the width with fixed slot heights. Under 560 px each round becomes its own list, a match per row, and the two answers stack.

Notes for AI

  • Import ModelKnockout from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • A GPUI version exists: ModelKnockoutEl in oxyn_gpui.
  • Props to set first: now.
  • It reads a clock (now) for live timers; pass one clock for the whole page rather than one per component.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI