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
Pipeline
- Belief Modeling — Infers what the user thinks from their response
- Contradiction Detection — Compares belief against claims, finds violations
- Interrogation — Generates attack question targeting highest-severity error
- 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:
| Turn | Behavior |
|---|---|
| Turn 1 | Forgiving — only clear violations flagged |
| Turn 2 | Moderate — violations plus omissions |
| Turn 3 | Strict — all violations surfaced |
Error Types
| Type | Description |
|---|---|
| wrong_mechanism | Incorrect explanation of how something works |
| missing_mechanism | Omitted critical mechanism |
| boundary_error | Wrong about limitations or scope |
| conflation | Confused two distinct concepts |
| superficial | Surface-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"
Next:
Study Sessions