Skip to content

Agent Engines Core — Chess AI Infrastructure - #1094

Merged
chinweobtagaz merged 5 commits into
OpenKnight-Foundation:mainfrom
ayshadogo:feature/agent-engines-core
Aug 26, 2026
Merged

Agent Engines Core — Chess AI Infrastructure#1094
chinweobtagaz merged 5 commits into
OpenKnight-Foundation:mainfrom
ayshadogo:feature/agent-engines-core

Conversation

@ayshadogo

Copy link
Copy Markdown
Contributor

Summary
Implements four foundational modules for the chess AI engine system: move validation, multi-engine consensus, player personality training, and high-performance FEN tokenization.

Changes
TASK 1: MoveGuardrail (nl_intent_parser.py) — 24 tests
Closes #1071

Regex parsers for SAN, UCI, and piece-to-square notation
Legality validation via python-chess, best-effort hallucination correction
Prompt injection detection and blocking
TASK 2: EnsembleEvaluator (pool.py) — 16 tests
Closes #1072

Async parallel engine dispatcher for Stockfish, LCZero, Berserk
Consensus score + neural vs classical divergence detection
Crash resilience per-engine, timeout controls
TASK 3: LoRA Training Pipeline (training_pipeline.py) — 27 tests
Closes #1073

PGN ingestion → tokenization → LoRA fine-tuning → adapter save/load
Compact adapters (<20MB), dynamic loading at inference time
TASK 4: FEN Tokenizer & Tensor Cache (batch.py) — 37 tests
Closes #1074

ayshadogo and others added 4 commits August 26, 2026 11:30
Implement deterministic guardrails that intercept and validate every
chess move mention in LLM response text using python-chess. Includes:
- Regex parsers for SAN, UCI, and piece-to-square coordinate notation
- Legality validation against current board state
- Best-effort correction of hallucinated moves
- Prompt injection detection and blocking
- Full pytest suite (24 tests) with <5ms per-response overhead

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Implement async parallel engine dispatcher that queries Stockfish, LCZero,
and Berserk concurrently. Includes:
- Non-blocking concurrent engine execution with semaphore controls
- Consensus score calculation (best-move agreement + eval delta)
- Neural vs classical divergence detection (>100 cp delta flagging)
- Crash resilience — individual engine failures don't abort the request
- Process timeout controls per engine instance
- Full pytest suite (16 tests) with mocked engine processes

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
…onalities

Implement end-to-end PGN-to-adapter pipeline for player-customized chess
AI companions. Includes:
- PGN ingestion with move tokenization and vocabulary building
- Lightweight LoRA model with low-rank adaptation matrices
- Training loop with cross-entropy loss and gradient updates
- Compact adapter weight saving/loading (< 20MB npz files)
- Dynamic adapter loading for inference at game runtime
- Full pytest suite (27 tests) covering vocab, dataset, model, and pipeline

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Implement high-performance vectorised FEN-to-bitboard tensor converter
and LRU evaluation cache for batch inference. Includes:
- Direct FEN string parser bypassing python-chess Board (>100k FENs/s)
- 8×8×14 binary tensor representation (12 piece + EP + side-to-move)
- Vectorised board-to-tensor via piece_map for Board objects
- LRU cache with hit-rate tracking and eviction for deduplication
- BatchEvaluator that ties tokenizer + cache for concurrent games
- Position hash ignoring move counters for equivalence
- Full pytest suite (37 tests) including throughput benchmark

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

@ayshadogo Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Resolved 7 conflicted files:
- __init__.py: updated imports for new modules (MoveGuardrail, EnsembleEvaluator, etc.)
- batch.py, nl_intent_parser.py, pool.py, training_pipeline.py: kept our tested implementations
- pyproject.toml: merged dependencies from both branches
- tests/test_batch.py: kept our tested suite

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@chinweobtagaz
chinweobtagaz merged commit 5afc0c2 into OpenKnight-Foundation:main Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants