jevrecipes

Recipe catalog / move-explanation-fit

Check move explanation fit

Does explanation give a reason for move that is consistent with the described game state?

An agent or player justifies a move in text and you want to catch explanations that cite pieces, threats, or resources the state does not contain.

Explore this recipe interactively ยท Source and implementation guide

Use move-explanation-fit in TypeScript

Install with npm install jev-recipes. Requires Node.js 22.9 or newer and ES modules. Set TYPESAFE_API_KEY in your server environment for live calls, which send input to TypeSafe and use API quota. See the installation guide.

import { moveExplanationFit } from 'jev-recipes/move-explanation-fit';

const result = await moveExplanationFit({
  "move": "Knight from g1 to f3",
  "explanation": "Developing the knight to f3 defends the pawn on e4 against the black knight's threat and prepares to castle kingside.",
  "state": "Chess, White to move. White pieces: king e1, queen d1, rooks a1 and h1, bishops c1 and f1, knights b1 and g1, pawns a2 b2 c2 d2 e2 f2 g2 h2. Black pieces: king e8, queen d8, rooks a8 and h8, bishops c8 and f8, knights b8 and f6, pawns a7 b7 c7 d7 e7 f7 g7 h7. Move 2: Black has just played knight g8 to f6.",
  "minConfidence": 0.8
});
console.log(result);

Input contract

FieldTypeNeeded
movestringRequired
explanationstringRequired
statestringRequired
minConfidencenumberOptional
Full input and result schemas
{
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "move": {
        "type": "string"
      },
      "explanation": {
        "type": "string"
      },
      "state": {
        "type": "string"
      },
      "minConfidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      }
    },
    "required": [
      "move",
      "explanation",
      "state"
    ]
  },
  "result": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "model": {
        "type": "string"
      },
      "usage": {
        "type": "object",
        "properties": {
          "input_tokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "output_tokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "input_tokens",
          "output_tokens"
        ],
        "additionalProperties": false
      },
      "status": {
        "type": "string",
        "enum": [
          "ready",
          "review"
        ]
      },
      "probability": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      },
      "confidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      },
      "verdict": {
        "type": "string",
        "enum": [
          "consistent",
          "inconsistent"
        ]
      }
    },
    "required": [
      "model",
      "usage",
      "status",
      "probability",
      "confidence",
      "verdict"
    ],
    "additionalProperties": false
  }
}

Saved example result

This hand-authored response demonstrates the contract. It is not a model accuracy measurement. Run it without an API key: npx jev-recipes demo move-explanation-fit.

{
  "model": "demo-fixture",
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0
  },
  "status": "ready",
  "probability": 0.07,
  "confidence": 0.9299999999999999,
  "verdict": "inconsistent"
}

Evaluation evidence

Fixture only

No verified live accuracy measurement is available. Evaluate representative cases before using this decision in your workflow.

Use the evaluation guide to measure this decision on your own labeled cases.

Limitations

Related recipes