Agent Engines Core — Chess AI Infrastructure - #1094
Merged
chinweobtagaz merged 5 commits intoAug 26, 2026
Merged
Conversation
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>
|
@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! 🚀 |
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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