This chess knowledge base now includes comprehensive Lichess integration for advanced game analysis, providing:
- 🎯 Computer Analysis: Accuracy metrics, blunder/mistake detection
- ⚔️ Tactical Patterns: Recognition of forks, pins, skewers, and more
- 📚 Opening Database: Performance comparison with global statistics
- 📖 Study Generation: Interactive Lichess studies for training
- 📈 Improvement Plans: Personalized recommendations based on weaknesses
- Go to https://lichess.org/account/oauth/token
- Create a new personal access token
- Select the following scopes:
Read preferences(required)Create, update, and read studies(for study generation)Read game playing(optional)
Add to .env file:
LICHESS_TOKEN=lip_YourTokenHereAdd as repository secret:
- Go to Settings → Secrets → Actions
- Add new secret:
LICHESS_TOKEN - Paste your token value
python scripts/main.pypython scripts/main.py --skip-lichesspython scripts/main.py --months 3Analyzes games using Lichess's Stockfish engine:
- Game accuracy percentage
- Blunder detection (>300 centipawn loss)
- Mistake detection (>100 centipawn loss)
- Inaccuracy detection (>50 centipawn loss)
- Move-by-move evaluations
- Best move suggestions
Output: knowledge/lichess_accuracy.md, knowledge/lichess_mistakes.md
Identifies tactical themes in your games:
- Forks: Attacking multiple pieces simultaneously
- Pins: Absolute and relative pins
- Skewers: Forcing valuable pieces to move
- Discovered Attacks: Revealing hidden threats
- Double Attacks: Attacking two targets
- Sacrifices: Material sacrifices for advantage
- Back Rank Threats: Exploiting weak back ranks
Output: knowledge/lichess_tactics.md
Compares your openings with Lichess database:
- Win rate comparison with expected rates
- Opening popularity at your rating level
- Performance differential analysis
- Repertoire diversity metrics
- New opening suggestions based on rating
Output: knowledge/lichess_openings.md
Creates interactive studies on Lichess:
- Opening Repertoire Study: Your most played openings with statistics
- Improvement Study: Games with most mistakes for learning
- Tactical Patterns Study: Positions demonstrating tactical themes
Output: knowledge/lichess_studies.md (contains study links)
Generates actionable recommendations:
- Priority areas based on weaknesses
- Weekly training schedule
- Progress tracking metrics
- Specific exercises for improvement
Output: knowledge/lichess_improvement.md
After running with Lichess integration, you'll have:
knowledge/
├── summary.md # Basic statistics
├── openings.md # Opening repertoire
├── weaknesses.md # Areas for improvement
├── recent_games.md # Recent game list
├── lichess_accuracy.md # Computer analysis report
├── lichess_mistakes.md # Mistake analysis
├── lichess_tactics.md # Tactical patterns found
├── lichess_openings.md # Opening recommendations
├── lichess_improvement.md # Personalized training plan
└── lichess_studies.md # Links to Lichess studies
data/
├── games_cache.json # Chess.com games cache
├── analysis_results.json # Basic analysis results
├── lichess_analysis_cache.json # Lichess analysis cache
└── opening_database.json # Opening statistics cache
The integration respects Lichess API rate limits:
- Automatic delays between requests
- Caching to avoid repeated analysis
- Limited to 20 games for computer analysis (configurable)
Edit lichess_analyzer.py:
# Analyze more games (default is 20)
games[:50] # Analyze 50 games insteadFor faster analysis without engine evaluation:
python scripts/main.py --skip-lichessRun just the Lichess analysis on existing cache:
from scripts.lichess_analyzer import LichessAnalyzer
analyzer = LichessAnalyzer(token)
# ... analyze games- Check your internet connection
- Verify your Lichess token is valid
- Ensure the PGN format is correct
- Lichess servers might be busy
- Try again later or reduce number of games
- Ensure LICHESS_TOKEN is in .env file
- Check environment variable is loaded
Planned features:
- Puzzle generation from your mistakes
- Tournament performance analysis
- Time management analysis
- Opponent preparation tools
- Endgame pattern recognition
- Pawn structure analysis
Feel free to suggest improvements or report issues: https://github.com/sergi039/sschess/issues
- Your games are already public on Chess.com
- Lichess analysis is done via their public API
- No personal data beyond chess games is processed
- Studies created are unlisted by default
Powered by Lichess API and Chess.com API