Project: C9 ChronoDraft · Live Demo: dagou1028.github.io/c9-chronodraft
Event: Cloud9 × JetBrains: Sky's The Limit Hackathon 2026 (Category 2 + Best AI-Powered Workflow Story)
When League of Legends adopted Hard Fearless Draft in Best-of-3 and Best-of-5 series, every champion played in Game 1 through Game 4 became permanently locked out for both teams for the rest of the series. By Game 3, coach spreadsheets collapse—not because coaches lack tier lists, but because tracking individual player comfort-pool exhaustion, Flex-pick ambiguity, and first-14-minute macro trade-offs across 20+ burned champions exceeds what manual tables can compute inside a 30-second draft clock.
To build C9 ChronoDraft, I had to process 745 compressed GRID .jsonl.zst esports series across LCS, LCK, LEC, and LTA (2025–2026), train a calibrated win-probability model with zero future leakage, and ship a <8ms client-side 2-Ply Minimax War Room on GitHub Pages—all while obeying a strict license redline forbidding raw GRID files from ever entering Git.
Treating an AI coding assistant as a blind autocomplete box on raw esports telemetry fails fast. Here is the exact contract-first workflow—combining shared .junie/guidelines.md + AGENTS.md rules with PyCharm 2026.1.1 Run Configurations and automated CI verification—and the Before vs. After quantitative evidence that prevented silent data corruption at every layer.
1. Contract-First Guardrails: Why .junie/guidelines.md Came Before Code
Before writing a single line of ETL or React UI, I codified the non-negotiable data and domain invariants inside .junie/guidelines.md (paired with AGENTS.md) and wired three one-click Run Configurations under .idea/runConfigurations/:
-
Build_LoL_Aggregates.xml— 16-core streaming.jsonl.zstETL + causal L2 model calibration -
Pytest_Suite.xml— synthetic GRID edge-case & compliance unit tests (tests/test_etl_and_compliance.py) -
Verify_No_Data_Leak.xml— pre-commit Git guardrail scanning tracked, staged, and untracked files (scripts/verify_no_data_leak.py)
By encoding explicit GRID stream invariants up front—for AI coding agents during implementation and inside PyCharm 2026.1.1 during IDE verification (keeping the repository natively Junie-ready via .junie/guidelines.md)—every generated and reviewed function respected GRID's stream semantics from the start:
# Excerpt from .junie/guidelines.md - Stream .zst files line-by-line via zstandard.open(..., "rt", encoding="utf-8"). Never decompress to disk. - Check session_valid / final seriesState.valid before including match results (18 LoL series are marked invalid). - Handle multi-session files (e.g., series 2885343) where sequenceNumber resets at grid-started-feed. - Honor !-prefixed rollback events (e.g., series-!started-game, team-!picked-character). - NEVER commit stl-hackathon-2026-grid-starter/, *.zst, *.jsonl, meta/*.csv, or *.duckdb. 2. Five Real GRID Data & Modeling Traps (Before vs. After)
Trap 1: Unordered team.players Arrays, Trailing Whitespace & Stage Test Accounts (LECTest1)
Before (Naive Prototype):
Assuming game.teams[0].players[0..4] maps to [TOP, JUNGLE, MID, BOT, SUPPORT]. In real GRID feeds—such as LCS 2026 Playoffs series 3000374—the Support player sits at index 0 and Top sits at index 3, player names contain trailing whitespace (e.g., "Loki "), and an emergency Riot tournament-realm test account ("LECTest1", pid=123346) even evicted G2 Esports's starter BrokenBlade during naive recency roster resolution!
After (3-Stage Telemetry Classifier + Placeholder Starter Guard in etl/grid_parser.py & etl/analytics.py):
Guided by our .junie/guidelines.md contract against inspected Cloud9 Kia and LEC feeds, infer_team_roles() classifies every player strictly from in-game telemetry (neutralMinion kills, minion kills, visionScore, and 0–9m map coordinates from player-completed-increaseLevel), stabilized by cross-game player majority vote, while _is_placeholder_player() filters out tournament-realm test accounts (LECTest1) during active starter selection—restoring BrokenBlade (32 unique champs, 22 comfort depth) on G2 Esports:
- Jungle: Highest
neutralMinionkills (230+vs0–5for laners). - Support: Lowest
minionkills among the remaining four players, tie-broken by highestvisionScore. - Top / Mid / Bot: Sorted by descending median
(y - x)on Summoner's Rift (TOPin the upper-left corner has the largesty - x,MIDclusters near the diagonal0,BOTsits at the lowesty - x).
Every edge case—including a shuffled [SUPPORT, BOT, JUNGLE, MID, TOP] array, "Loki " whitespace trimming, and LECTest1 filtering—is locked down in test_role_inference_handles_arbitrary_slot_order() and test_placeholder_stage_account_filter().
Trap 2: Abandoned Game Rollbacks, Multi-Session Resets & Invalid Tails
Before (Naive Prototype):
Reading every series-ended-game or game-state-tick blindly without session boundary tracking. Across the 745 LoL .jsonl.zst files (1,741 game rows in meta/games.csv: 1,697 session_valid=True and 44 session_valid=False), remakes emit series-!started-game, multi-session series (like 2885343) reset sequenceNumber on a second grid-started-feed, and 18 LoL series include invalid sessions (728 valid series, 1 multi-session overlap). Naive aggregation yields inflated or phantom match counts instead of the true corpus count.
After (parse_envelopes() in etl/grid_parser.py):
parse_envelopes() splits every file into explicit grid-started-feed sessions, merges partial seriesState snapshots only against the latest includesFullState: true frame, discards rolled-back ! targets, and enforces session_valid. Across all 745 .jsonl.zst series streamed in parallel across 16 CPU cores (29.5s, 0 errors), the parser converges to the exact 728 valid series / 1,697 validated games / 44 teams / 156 champions verified in meta_summary.json—and test_parse_envelopes_handles_rollback_multisession_and_invalid() reproduces the rollback + invalid-tail pattern in 0.01s without needing the 1.4 GB raw dataset on CI.
Trap 3: Small-Sample 1-0 Win-Rate Illusions, Un-Decayed Team Strength & Non-Causal Leakage
Before (Naive Prototype):
Ranking picks by raw player win rate (1-0 = 100% WR), using un-decayed team win rates that treat beating a bottom-tier squad the same as beating Gen.G, and fitting draft weights on full-dataset averages (leaking future tournament outcomes into earlier games).
After (Causal Online Elo + Empirical Bayes + Strictly Causal L2 Logistic & Pro Alignment Backtest in etl/analytics.py):
First, empirical_bayes_rate(wins, games, prior_mean, prior_strength) shrinks small-sample champion and player records toward the Beta-Binomial prior (k = 12.0 global, k = 8.0 player comfort). Second, calibrate_draft_win_model() sorts all games chronologically by (scheduled_start, series_id, game_number), accumulates Causal Online Elo (with off-season mean reversion and +25 Elo Blue-side expected edge), exponentially decayed 14m Gold Diff (decay=0.90), side priors, champion EB, player mastery, synergy, and role-aware same-lane counters (1.45×) strictly before observing each match—matching browser inference 1-to-1 with zero train–serve skew. L2 regularization (L2=0.04) is selected via an internal chronological split of the 1,229-game training set only, then evaluated strictly out-of-sample on the final 308 future pro games:
Strictly Causal OOS Ablation (308 Future Pro Games) | Accuracy | ROC-AUC | Brier Score |
|---|---|---|---|
| Blue-Side Base Rate | 55.8% | 0.500 | 0.2485 |
| Team WR + Side (v1 Prior) | 62.0% | 0.651 | 0.2308 |
| + Causal Elo & Decayed 14m Macro | 64.6% | 0.686 | 0.2203 |
| + Full Draft (EB + Mastery + Syn + Lane Counter) | 66.2% | 0.688 | 0.2198 (-11.5% error, ECE 0.0335) |
To verify recommendation fidelity (not just outcome prediction), we also ran a strictly causal Pro Coach Pick Alignment Backtest across all 3,080 real pro picks inside those 308 future holdout games under live Hard Fearless burnouts:
Pro Pick Alignment (3,080 Future Pro Picks) | Meta-Only Baseline | C9 ChronoDraft Causal Engine | Gain |
|---|---|---|---|
| Top-5 Recall (All Games) | 35.0% | 46.8% | +11.8 pp (+33.7% rel) |
| Top-10 Recall (All Games) | 54.7% | 65.8% | +11.1 pp |
| Mean Reciprocal Rank (MRR) | 0.210 | 0.294 | +40.0% rel |
Game 3+ Hard Fearless Top-5 (900 picks) | 36.9% | 50.1% | +13.2 pp |
The fitted weights (eloDiff: 0.3194, earlyMacro: 0.0552, champStrength: 0.0147, sidePrior: 0.0122, mastery: 0.0071, counter: 0.0006, synergy: 0.0005) ship inside web/public/data/meta_summary.json (~1.4 KB) and power the live War Room's Calibrated Win Probability Meter and per-card +X.X% WP shift pills.
Trap 4 & 5: Greedy Flex-Pick Trapping, 1-Ply Myopia & Score-Blind Series Regret
Before (v1 Greedy Heuristic):
Assigning roles greedily in pick order (Aurora locks MID and traps Orianna), leaving Bans #2–#6 without a counterfactual ΔWP, ignoring consecutive Snake Double-Pick turns (R1+R2, B2+B3, B4+B5), and treating Bo5 Game 3 identically whether the series is 1-1 or 2-0 match point.
After (solveOptimalRoles + recommendDraftOptions + Markov expectedFutureGames in web/src/engine/fearlessEngine.ts):
- Exact Maximum-Weight Bipartite Role Assignment (
solveOptimalRoles): Exhaustively evaluates up to5! = 120role permutations in<0.05ms, slidingAuroracleanly toTOPwhenOriannalocksMID, while trackingflexOptions(lane disguise). - True 2-Ply Adversarial Minimax + Softmax/VORP Ban
ΔWP+ Snake Double-Pick Lookahead: Simulates the opponent's optimal counter-reply across the top 14 candidates in<8msclient-side, computes counterfactual Softmax + Role-VORP+X.X% WPacross every threatening Ban card, and previews Snake Pair combos onR1,B2, andB4. - Score-Aware Markov Hard Fearless Series Regret: Computes exact recursive
E[rem | wB, wR]—so Bo5 Game 3 at1-1(E[rem] = 1.50g) applies twice the future depth protection of2-0match point (E[rem] = 0.75g), decaying to0on Map 5! - 10/10
VitestProofs (web/src/engine/fearlessEngine.test.ts): Every invariant—fromAurora + Oriannabipartite reassignment to Ban Phase 2 wasted-ban penalties,1-1 vs 2-0Markov regret, Softmax BanΔWP, andR1Snake Pairs—runs in ~23ms.
3. Zero-Data-Leak CI Pipeline: Structural Trust
Instead of relying on manual pre-push discipline, PyCharm Run Configurations and GitHub Actions (.github/workflows/deploy-pages.yml) share the exact same enforcement chain:
python scripts/verify_no_data_leak.py # [PASS] Checked 38 candidate/tracked files. Zero GRID data leaks. python -m pytest -v # 7 passed in 0.36s cd web && npm test && npm run build # 10 passed in 23ms · vite build -> GitHub Pages Even if a developer accidentally drops a .zst, .jsonl, meta/*.csv, .sqlite, .parquet, or .duckdb file into the working tree without staging it, verify_no_data_leak.py inspects git ls-files, git diff --cached, and git ls-files --others --exclude-standard and aborts the build before any commit or Pages deployment can succeed.
Try It Live
- Interactive War Room (Zero Installs, Zero API Keys): https://dagou1028.github.io/c9-chronodraft/
- MIT Open-Source Repository: https://github.com/dagou1028/c9-chronodraft
Built with PyCharm 2026.1.1, .junie/guidelines.md, Python 3.13, React 19, TypeScript, Vite, pytest, and Vitest for the Cloud9 × JetBrains: Sky's The Limit Hackathon 2026.




