Ski Station Predictor – Autonomous Agent Specification Project Goal Build a system that predicts next-day ski station conditions for the following stations in northern Spain: Valgrande-Pajares San Isidro Fuentes de Invierno Predictions must include: Probability that the station will open Estimated kilometers of skiable slopes Expected crowd level The prediction system must combine: Historical operational data Weather forecasts Rule-based logic Machine learning predictions The results must be accessible through a Telegram bot. This repository is designed to be developed collaboratively by AI coding agents. ### Mandatory Workflow: Git Worktrees **CRITICAL**: Agents MUST create a new **git worktree** for every new feature, major refactor, or non-trivial task. This ensures a clean workspace, allows for parallel research/development, and prevents context contamination. **Correct Workflow for Agents:** 1. Create a worktree: `git worktree add ../feature-name -b feature-branch` 2. Switch to the worktree: `cd ../feature-name` 3. Implement, test, and commit inside the worktree. 4. Merge back to `main` from the original directory. 5. Cleanup: `git worktree remove ../feature-name` and `git branch -d feature-branch`. Core System Philosophy Predictions must follow a hybrid architecture. ML predictions are useful but must never override physical constraints. Prediction pipeline concept: rules_engine → ml_model → hybrid_decision Rules always have priority when safety or physical conditions make the outcome deterministic. Example rule logic: If wind gust exceeds operational limits the station is assumed closed regardless of ML prediction. Development Stages Agents must implement the system incrementally. Phase 1 – Data Collection Goal: build a historical dataset. Required data sources: Weather data Station operational status Calendar features Outputs: Daily structured dataset stored locally. Phase 2 – Dataset Builder Goal: transform raw data into ML-ready features. Tasks: Normalize weather variables Aggregate daily features Encode categorical features Align timestamps Outputs: Processed dataset suitable for ML training. Phase 3 – ML Training Goal: train baseline predictive models. Target variables: station_open_probability km_open_prediction crowd_level_prediction Recommended algorithms: RandomForest GradientBoosting LightGBM Agents must prioritize: interpretability robustness small dataset performance Phase 4 – Hybrid Predictor Goal: combine rules with ML predictions. Example architecture: rules_engine ml_predictor hybrid_predictor Rules must handle obvious constraints such as extreme wind conditions. The ML model provides probabilistic refinement when rules are inconclusive. Phase 5 – Telegram Bot Goal: expose predictions to users. Commands must include: /pajares /sanisidro /fuentes The bot should respond with: open probability estimated ski kilometers predicted crowd level weather summary Example response structure: Station name Probability of opening Expected kilometers open Crowd level estimate Key weather factors Repository Structure The repository must follow this structure. ski-predictor data raw processed data_sources weather_api.py station_scraper.py webcam_collector.py pipeline build_dataset.py feature_engineering.py ml train_model.py evaluate_model.py models predictor rules.py ml_predictor.py hybrid_predictor.py bot telegram_bot.py config stations.yaml features.yaml scripts collect_daily_data.py retrain_model.py tests Agents must not deviate from this structure without justification. Data Sources Agents should prioritize reliable and free APIs. Preferred weather providers: Meteostat Open-Meteo AEMET (if accessible) Required weather variables: temperature snowfall precipitation wind_speed wind_gust wind_direction humidity pressure Forecast data must be supported for next-day predictions. Station Operational Data Agents must scrape official station sources to collect: open_status km_open lifts_open snow_depth Scrapers must be robust to layout changes and include basic failure handling. Optional Data Sources (Future Phase) Webcam analysis can later be used to estimate crowd levels. Potential signals: number_of_people number_of_cars queue density Computer vision may be used to extract these signals automatically. This phase is not required for the first working version. Feature Engineering Agents must construct meaningful features such as: snow_last_3_days snow_last_7_days avg_temperature max_wind_gust is_weekend is_holiday month_of_year Temporal alignment between weather and station data is critical. Machine Learning Constraints The dataset will initially be small. Agents must therefore prefer models that work well with limited data. Recommended techniques: tree-based models cross-validation feature importance inspection Deep learning is not appropriate for this project. Rule Engine The rule engine must capture known operational constraints. Examples include: Extreme wind automatically prevents operation. Rain at low altitude combined with high temperature reduces open slope probability. Snow depth below operational threshold reduces open kilometers. Rules must be configurable. Hybrid Prediction Strategy The final prediction is computed in three stages. Step 1: evaluate rule engine Step 2: compute ML prediction Step 3: combine outputs into final decision Rules may override ML outputs when conditions are physically impossible. Daily Data Pipeline The system must support a daily automated workflow. Daily pipeline concept: collect weather forecast collect station status append dataset generate prediction for tomorrow serve prediction through Telegram bot Automation scripts should support cron execution. Configuration All station-specific parameters must live in configuration files. Example configuration fields: station_name location_coordinates altitude wind_closure_threshold minimum_snow_depth Agents must not hardcode station parameters. Code Quality Requirements Agents must ensure: Readable Python code Clear function boundaries Minimal dependencies Logging for data collectors Basic unit tests for core components All modules must include docstrings. Priority Order for Agents Agents should work in the following order. 1 Build weather data collector 2 Build station status scraper 3 Implement dataset builder 4 Implement baseline ML training 5 Implement hybrid predictor 6 Implement Telegram bot The first milestone is a working prediction for tomorrow. Definition of Success A successful version of the system can: Collect weather data automatically Collect station operational data Train a baseline ML model Generate a next-day prediction Deliver the prediction through a Telegram bot All predictions must be reproducible.