Hey everyone! π
I wanted to share a project Iβve been working on recently: Knight - Chess Helper. Itβs an advanced browser extension designed to assist and analyze chess games on Chess.com entirely locally and in real-time.
Building a tool like this within the constraints of modern browser security policies (Manifest V3) was a massive technical challenge, and Iβd love to walk you through how I solved it.
π Check out the full repository here: https://github.com/physicalaff/Knight-Chess-Helper
π οΈ The Technical Challenge: Bypassing CSP & Sandboxing
Modern platforms like Chess.com use very strict Content Security Policies (CSP). You cannot simply inject an external engine script or make third-party server calls to evaluate a board position without triggering security blocks.
To solve this, Knight runs entirely offline and locally using a multi-layered Manifest V3 messaging system:
The Core Logic: Powered by an optimized local Stockfish WebAssembly (WASM) engine.
The Bridge: Since Manifest V3 background service workers don't support heavy WASM environments directly in some configurations, the extension utilizes Chrome's Offscreen Document API (and native background workers in Firefox) to run the engine inside an isolated, secure offline process.
The UI Layer: A premium, custom glassmorphic dashboard panel injected directly into the active tab that updates hints instantly on click with zero cooldown.
π§ Emulating Human-Like Behavior
One of the most interesting parts of this project was moving away from "robotic" engine play. To make the assistant truly feel like a human companion, I implemented mathematical models to simulate organic human flaws and constraints:
Mouse Movement 2.0: Generates smooth Bezier curves with simulated physical hand micro-tremors.
Emulated Fatigue: Thinking times automatically scale and slow down by 2.5% per turn as the game progresses past move 15, mimicking natural mental exhaustion.
Calculated Misclicks: A built-in small percentage chance to click a neighboring square first, pause in hesitation, cancel, and then correct the move.
Opening Book Integration: Automatically fetches and executes the first 14 half-moves smoothly using the Lichess Masters Database.
π¨ Advanced Presets & ELO Scaling
The extension features a mathematically calibrated preset matrix. Users can manually scale the assistant from 1000 to 1500 ELO, which dynamically adjusts engine depth, mistake chances, blunder rates, and average thinking variance in real-time.
There is even a hidden ZXC / Shadow Fiend Mode that overhauls the entire UI into a dark-matte neon-red design, complete with an active animated avatar and audio synchronization.
π Source Code & Feedback
The project is completely open-source and licensed under the MIT License. If you are interested in Chrome Extension development, WebAssembly integration, or advanced content script messaging, feel free to check out the codebase!
β Repository: https://github.com/physicalaff/Knight-Chess-Helper
I would highly appreciate your feedback, code reviews, or a β on GitHub if you find the architecture interesting! What do you think about running heavy WASM engines directly inside browser extensions? Let's discuss in the comments!

Top comments (0)