Documentation

The Duel Engine

The cognitive core of LearnLock. Located in duel.py.

Philosophy

Traditional learning apps ask: "Do you know X?"

LearnLock asks: "What do you believe about X, and where is it wrong?"

Architecture

YouTube
Article
PDF
GitHub
LLM Extract → 8-12 Concepts + Claims
Generate
Garbage Filter
Sharpness Filter
Duel Engine
Belief ModelContradiction DetectInterrogate
HUD (Rich)
SM-2 Scheduler
SQLite

Pipeline

  1. Belief Modeling — Infers what the user thinks from their response
  2. Contradiction Detection — Compares belief against claims, finds violations
  3. Interrogation — Generates attack question targeting highest-severity error
  4. Snapshot — Records belief state for trajectory tracking

Behaviors

  • Vague answers trigger mechanism probes
  • Wrong answers trigger claim-specific attacks
  • "I don't know" triggers guiding questions (not punishment)
  • Correct answers pass after verification
  • 3 turns exhausted triggers reveal with full trajectory

Graded Harshness

The engine gets progressively stricter:

TurnBehavior
Turn 1Forgiving — only clear violations flagged
Turn 2Moderate — violations plus omissions
Turn 3Strict — all violations surfaced

Error Types

TypeDescription
wrong_mechanismIncorrect explanation of how something works
missing_mechanismOmitted critical mechanism
boundary_errorWrong about limitations or scope
conflationConfused two distinct concepts
superficialSurface-level understanding without depth

Claim Pipeline

Claims are the epistemic foundation. The duel is only as fair as the claims.

Three-Pass Verification

Pass 1: Generation

LLM generates claims with explicit instructions to produce conceptual truths, not transcript parroting. Demands falsifiable statements about WHY and HOW.

Pass 2: Garbage Filter

Pattern matching rejects stateful claims ("is running"), tautologies ("processes requests"), and vague claims ("is useful").

Pass 3: Sharpness Filter

Rejects blurry truths that are technically correct but unfalsifiable ("handles security", "manages data").

Claim Types

  • definition — What the concept is
  • mechanism — How it works internally
  • requirement — What it needs to function
  • boundary — What it cannot do or where it fails

Good vs Bad Claims

❌ Bad (rejected)

  • "The server processes requests" (tautology)
  • "It handles security" (blurry)
  • "Must be running to work" (stateful)

✓ Good (survives)

  • "Validates request payloads against a JSON schema"
  • "Enforces authentication via JWT token verification"
  • "Uses Python type hints for automatic request validation"