Enhance your chess performance with a cutting-edge real-time move analysis and strategy assistance system
OmniChess Userscript
OmniChess is a modular, high-performance chess assistance userscript that provides real-time strategy visualization, move analysis, and automated move-playing capabilities. It overlays assistance directly on major chess platforms (such as Chess.com and Lichess) and interacts with a centralized engine backend.
Unlike the original monolithic userscript, our fork introduces several key structural and functional improvements:
~2000 line script into clean ES6 modular folders under src/ (e.g. core/, adapters/, utils/, drawing/) built and compiled using the ultra-fast Bun bundler.@require library dependencies. The cross-origin communication coordinator is now fully local and embedded in src/core/comm.js with parallelized storage reads (Promise.all), increasing speed, safety, and offline stability.40ms and 110ms to mimic natural key release times.fast-flicker, slow-steady, tired-drag) to randomize drags.e.isTrusted to ignore programmatic inputs and prevent infinite loops.crypto.randomUUID().OmniChess uses a distributed, client-backend architecture split into two main components: the Frontend Userscript Client and the Engine Backend GUI.
flowchart LR
subgraph Browser Tab 1: Chess Site [e.g., Chess.com / Lichess]
A[Chess Board DOM] <-->|DOM MutationObserver| B[OmniChess Userscript]
B -->|UniversalBoardDrawer| C[Overlay Graphics / SVGs]
end
subgraph Browser Tab 2: OmniChess GUI [quantavil.github.io/OmniChess]
F[OmniChess Orchestrator] <-->|Worker / HTTP| G[Chess Engine \nStockfish / Lc0]
end
B <-->|Cross-Origin IPC via GM Storage| F
The userscript runs directly on the active chess tab. Its main responsibilities include:
src/adapters/).MutationObserver on the board container and a fallback polling routine.UniversalBoardDrawer overlay.The engine runs inside the OmniChess GUI tab (defaulting to the hosted quantavil.github.io/OmniChess/app/ page or localhost during development).
CommLink)Because the chess tab (e.g., chess.com) and the OmniChess backend tab (quantavil.github.io) are hosted on different domains, browser sandboxing prevents them from calling each other directly.
OmniChess bypasses this using Userscript Storage (Greasemonkey API) as a shared IPC (Inter-Process Communication) channel:
commlink-packet- (containing the current FEN, orientation, variant, etc.) into Greasemonkey storage (GM_setValue).GM_openInTab) to initialize the engine.src/: Modular source code files.
src/core/: Orchestration logic (main controller index.js, automation handler autoMove.js, and comm.js for the GM Storage IPC handler).src/adapters/: Platform-specific selectors (supporting chess.com, lichess.org, playstrategy.org, pychess.org, worldchess.com, gameknot.com).src/drawing/: Screen rendering overlays and SVGs (drawing.js).src/utils/: Configuration managers (config.js), coordinate transformation math (coordinates.js), and helper utilities.dist/main.js: Compiled single-file userscript that gets loaded by Tampermonkey/Violentmonkey.tests/: Unit tests verifying geometric coordinate conversions.build.js: Bundling script utilizing the fast Bun bundler.Make sure you have Bun installed.
Installs dev dependencies (e.g. dependency-cruiser for tracking import boundaries):
bun install
Bundle the modular source files under src/ and prepend the userscript metadata:
bun run build
This output is written to dist/main.js. Copy this file into your userscript manager (Tampermonkey, Violentmonkey) to use or test changes.
Verify coordinate conversions:
bun test
Analyze circular dependencies and check import safety boundaries:
bun run lint:imports
This project is a modularized, optimized, and heavily enhanced fork of the original ACAS Userscript by HKR/Psyyke.