qianhaoq/dota2.ai
À propos
An evidence-first Dota 2 post-match coach — web, JSON API, CLI and MCP. 拿证据说话的 Dota 2 赛后教练。
IA et apprentissage automatiqueProgression mesurée des étoiles
- in 24h
- Historique en cours
- in 7 days
- Historique en cours
- in 15 days
- Historique en cours
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
OriginalWhat It Does · Real Match Demo (#9100904020) · 4 Ways to Use · How It Works · Self-Host & Dev · Feedback & Contact · 简体中文 · Русский
dota2.ai is an AI-native Dota 2 replay coach (v137). Instead of guessing from end-of-game KDA, it downloads and parses your real Valve / Perfect World .dem replay, queries 23 lookup tools paired with patch-accurate Dota 2 ability and item mechanics, and fact-checks every timestamp, number, and reference in code before showing you what went wrong in THIS game and exactly how to play and build to win — across English, 简体中文, and Русский.
What dota2.ai Shows You
Built for how Dota 2 players actually review a loss or close win — high-contrast Obsidian Forge war-room design with 127 hero OKLCH backlights and real Valve hero, item, and ability icons everywhere:
- Hero Verdict & Battle HUD: One-line match verdict with clickable clock jumps, 3D hero cutout, K/D/A, LH/DN, Net Worth, GPM/XPM, Hero Damage, and your 6 final item icons with completion timings.
- Mistakes & Mechanics-Grounded Fixes First: Placed immediately below the verdict — big metric callouts, causal breakdown, Aegis-gold "How to win it" counter-play & itemization fixes (grounded in dual-mode item mechanics, dispel/BKB reality, and pro lift ratios), inline icon telemetry, and an in-place 2-column 10-hero 2D Map Replay / Data stage.
- Unified Turning Point & Fight War-Room: Minute-by-minute Gold Lead Curve + interactive Fight Strip + unified game-plan root cause + in-place fight detail tray (
[Replay this fight]/[Ask coach]) and fight-presence breakdown. - 4-Tab Deep Tactical Workbench:
- 5v5 Blueprint — post-draft matchup strengths/weaknesses, win condition, 10 hero jobs, and 5v5 teamfight execution order.
- 10 Players & Benchmarks — all 10 heroes with visible 6-item icon builds, expandable full stats table, and same-bracket percentiles.
- Phase Timeline — chronological walkthrough from draft and laning through midgame, macro, and pro/bracket item builds.
- Tactical Map — 1 Hz movement paths, activity heatmap, teleport/missing-sample disclosure, and clickable death replays.
- Follow-Up Coach Chat, Party Recap & Battle-Poster PNG: Ask follow-up questions over the parsed trace, run 3-phase Party Match Recaps for 5-stacks, track cross-match habits for up to 5 bound Steam accounts, ask the Live Patch Advisor, and export dark
1200×900Battle-Poster PNG share cards on the client.
One Real Match, From .dem to Verdict
Everything below comes straight from a real match bundled in this repo — Match #9100904020 (Beastmaster · Patch 7.42 · 42:31) — computed directly from its parsed .dem trace:
- What KDA hides: 16/16 teamfights attended, a +3,565 gold lead at 25:00, a clutch BKB-piercing Primal Roar on Phantom Assassin at 27:27 (
3.4 sstun → kill at 27:38), and a clean 1-for-3 fight at 33:23. Yet Dire lost at 42:31. - What the replay tools proved (
immunity_windowson the30:26–30:48turning fight):
{
"ref": "immune:phantom_assassin:3:beastmaster-primal_roar",
"hero": "phantom_assassin",
"modifier": "black_king_bar_immune",
"clock": "30:34",
"seconds": 7,
"watched": {
"state": "on_cooldown",
"cooldown_left": 66,
"last_cast": { "clock": "30:25", "target": "necrolyte", "seconds_before": 9.1 },
"distance": 914
}
}
- At
30:34, PA popped a 7-second Black King Bar914units away and dealt 8,524 hero damage while Dire's only BKB-piercing stun had 66 s left on cooldown (spent on Necrophos9.1 searlier at30:25). - At
36:05(death:beastmaster:9), Beastmaster died from 2,915 HP with Primal Roar ready and unused (3 deaths total with Roar available; only 4 of 10 Roars hit PA). - From
19:00–29:00(window:beastmaster:2), Dire converted only 1 of 6 won fights (22:57) into a building within 120 seconds and finished without Blink Dagger or Black King Bar.
[!TIP] Try this exact Demo locally in 10 seconds — zero API keys, zero network:
git clone https://github.com/qianhaoq/dota2.ai.git && cd dota2.ai npm ci && npm run build && npm run preview:mock # Open http://localhost:4180/r/9100904020?hero=beastmasterOr open it live at dota2.ai/r/9100904020?hero=beastmaster (and compare Match
#9091400302Tidehunter).
How It Works & Engineering Invariants
- Replay Trace (
packages/review-engine/src/trace): Source 2.demreplays from Valve or Perfect World are extracted into a compact columnar trace (1 Hz hero positions, casts, combat log, deaths, fights, objectives, wards, item timings) and always read throughlinkHeroNames. - 23 Fact & Mechanics Lookup Tools (
lib/agent): Tools return facts, patch-verified mechanics references, and explicitgaps— the AI model decides what mattered most (no hardcoded blame or fixed item rules). Cross-patch filtering (v137) filters Mechanics KB entries per hero ability & item snapshot so older-patch matches (e.g.7.41f) keep valid Dota 2 counter mechanics with zero newer-patch ability hallucinations. - Code-Enforced Verification (
lib/agent/review/verify.js): Every timestamp, stat, item share, andrefis verified against that run's actual tool outputs. Unsupported sentences get 1 repair round, then are dropped. Unknown is neverfalse(missing data staysnull+gaps), fog-of-war / vision claims are rejected, and all evidence cards & 2D replays are recomputed from the trace (lib/agent/evidence.js), never trusted from LLM prose. - Compiled Dota 2 Mechanics KB & Golden Rubric Eval: Curated ability/item active mechanics compile into zero-CJK JSON (
node scripts/kb-compile.mjs --check), and multi-match coaching quality is evaluated against golden rubrics (scripts/eval-run.mjs,scripts/eval-review.mjs).
Browse all 23 lookup tools
| Domain | Tools |
|---|---|
| Whole game & macro | match_overview, key_moments, decision_points, economy_and_tempo, siege_report, roshan_report, macro_report |
| Fights, deaths & wards | fight_report, fight_timeline, game_state, death_context, save_report, ward_report |
| Abilities & items | ability_audit, skill_build, immunity_windows, item_analysis, power_spikes |
| Draft & laning | draft_and_timing, lane_report |
| Full record drill-down | replay_query |
| Patch, reference & wiki data | reference_lookup |
| Web (reading only, never cited) | web_search |
How long does a review take? Typically ~2 minutes (~45–60s to parse the replay, ~60–90s to investigate and write). When a verified current-version review already exists in another language, switching languages takes a translation + strict re-verification fast path.
Four Ways to Use dota2.ai
One review engine powers four surfaces in English (en), 简体中文 (zh), and Русский (ru):
| Surface | Best for | Setup | API Key | Limits |
|---|---|---|---|---|
1. Web (dota2.ai) |
Instant browser review & battle-poster PNG sharing | Paste match ID, link, or friend code | None | Shared daily site cap |
| 2. DeepSeek Harness Desktop (Recommended) | Unlimited private reviews with full embedded UI | Download desktop app + paste 1 sentence | Your own (in DSH) | None — local & private |
3. MCP Server (dota2.ai/mcp) |
Coding & AI assistants | 1 command or 1-click install | None | Same hosted daily cap |
4. CLI (packages/cli) & HTTP API |
Scripts, pipelines & <5 ms offline Dota 2 Wiki |
Clone repo + npm ci |
None | Per-caller rate limit |
1. Web (https://dota2.ai)
Open https://dota2.ai and paste any Dota 2 match ID, OpenDota / Dotabuff / STRATZ link, or Steam friend code. Pick your hero, run the replay review, explore the 4-tab tactical workbench, chat with the coach, or save a 1200×900 dark battle-poster PNG.
2. DeepSeek Harness Desktop (@qianhaoq/dsh-dota2ai)
Run the full embedded dota2.ai review UI and 9 local DSH session tools inside DeepSeek Harness using your own DeepSeek API key — no terminal, no queue, no daily limit, and private local cache ($DSH_HOME/dota2ai):
- Download & open DeepSeek Harness (macOS / Windows) and sign in or add your DeepSeek API Key.
- Paste this one message into any chat (auto-installs
@qianhaoq/dsh-dota2aifrom npm / npmmirror):Install the dota2.ai Dota 2 replay coach plugin @qianhaoq/dsh-dota2ai into my active desktop profile, then tell me how to open dota2.ai in the left sidebar. - Click
dota2.aiin the left sidebar to open the full match review UI — or ask in chat: "Review my Dota 2 match 9100904020 — I played Beastmaster."
Linux / terminal setup (dsh web) & the 9 local DSH tools
Requires Node 24.9+ and DSH 0.2.x:
npm install -g pnpm @deepseek-ai/[email protected]
dsh plugin --profile web add @qianhaoq/dsh-dota2ai
DEEPSEEK_API_KEY=sk-... dsh web
Shared $DSH_HOME/dota2ai local cache with 9 tools (packages/dsh): dota2ai_replay_review, dota2ai_recent_matches, dota2ai_match_scoreboard, dota2ai_replay_ask, dota2ai_hero_matchup, dota2ai_wiki_lookup, dota2ai_focus_check, dota2ai_player_trends, and dota2ai_patch_advisor.
3. MCP Server (Claude Code, Claude Desktop, Codex, Gemini CLI, Cursor, VS Code)
Hosted Streamable HTTP endpoint at https://dota2.ai/mcp exposing 6 tools (replay_review, recent_matches, match_scoreboard, replay_ask, hero_matchup, wiki_lookup):
| Client | Setup |
|---|---|
| Claude Code | claude mcp add --transport http dota2ai https://dota2.ai/mcp |
| Claude Desktop (Custom Connector) | Open Settings → Connectors → Add custom connector and paste https://dota2.ai/mcp |
| Codex | codex mcp add dota2ai --url https://dota2.ai/mcp |
| Gemini CLI | gemini mcp add --transport http dota2ai https://dota2.ai/mcp |
| Cursor | One-click install in Cursor or add {"mcpServers":{"dota2ai":{"url":"https://dota2.ai/mcp"}}} to ~/.cursor/mcp.json |
| VS Code | code --add-mcp '{"name":"dota2ai","type":"http","url":"https://dota2.ai/mcp"}' |
Claude Desktop local stdio config (packages/mcp)
After cloning the repo and running npm ci, add to claude_desktop_config.json:
{
"mcpServers": {
"dota2ai": {
"command": "node",
"args": ["/abs/path/to/dota2.ai/packages/mcp/bin/dota2ai-mcp.js"]
}
}
}
No MCP client? Point any web-capable agent at https://dota2.ai/llms.txt.
4. CLI (packages/cli) & HTTP API
The CLI runs directly from a checkout (not published on npm yet) and supports --lang en|zh|ru and --json across every command, including a <5 ms offline Chinese/English Dota 2 Wiki:
git clone https://github.com/qianhaoq/dota2.ai.git && cd dota2.ai && npm ci
node packages/cli/bin/dota2ai.js recent <friend-code-or-profile-url> --lang en
node packages/cli/bin/dota2ai.js scoreboard 9091400302 --hero tidehunter --lang en
node packages/cli/bin/dota2ai.js ask 9091400302 --hero tidehunter "Why did we lose the 25:00 fight?"
node packages/cli/bin/dota2ai.js matchup tidehunter ursa --rank legend
node packages/cli/bin/dota2ai.js prepare 9091400302 --dem /path/to/9091400302.dem
node packages/cli/bin/dota2ai.js wiki interact axe,bristleback --topics bkb,break --json
node packages/cli/bin/dota2ai.js trace
See packages/cli for all flags (recent, scoreboard, ask, matchup, prepare, wiki, trace) and https://dota2.ai/llms.txt for public HTTP JSON endpoints.
Self-Hosting & Development
Requires Node 20.10+.
npm ci
cp .env.example .env # Export variables into your shell; server.js does not load .env
npm run start:dev # Vite (:5173) + Express (:8080)
npm test # Full Vitest suite
npm run build # Production bundle
lib/agent/ Review agent: loop, 23 lookup tools, verifyReview, evidence, Party Recap, chat
lib/data/ Patch-matched 7.40–7.42a constants, Mechanics KB, offline Dota 2 Wiki
lib/upstream/ Multi-source clients (OpenDota, STRATZ, Steam Web API, Steam GC, odota/parser)
packages/review-engine/src/trace Pure columnar replay trace builder & query primitives
src/agent/, src/coach/, src/user/ Obsidian Forge UI, 4-tab tactical workbench, battle-poster PNG, multi-account store
packages/dsh/, packages/mcp/ DeepSeek Harness plugin & Streamable HTTP / stdio MCP server
packages/cli/ Online/offline CLI, wiki lookup & trace inspector
server.js Express host
Pre-PR verification gate:
npx tsc --noEmit && npx tsc -p packages/review-engine/tsconfig.json --noEmit && node --check server.js && node scripts/kb-compile.mjs --check && npm run build && npm test
Deep-dive docs: docs/AGENT_PIPELINE.md, docs/GAME_UNDERSTANDING.md, CONTRIBUTING.md, AGENTS.md.
Acknowledgements
Sincere thanks to the Dota 2 open-data and open-source ecosystem powering dota2.ai:
- OpenDota (
odota/dotaconstants,odota/parser) — match metadata, replay discovery, constants, and pro-match reference queries. - STRATZ — rank-bracket hero matchups, position item timings, and pre-/post-patch meta deltas.
- DOTA2 刀塔百科 (
wiki.dota2.com.cn) — authoritative Chinese Dota 2 mechanics and interaction reference. - Valve Corporation & Perfect World — official patch datafeeds,
.demreplay hosts, and Steam CDN assets. - Dotabuff Open Source (
manta,d2vpkr) & SteamDatabase — Source 2.demparsing and per-patch script snapshots.
Open Source, Feedback & Contact
- GitHub Repository: https://github.com/qianhaoq/dota2.ai
- Bug Reports & Feature Ideas: https://github.com/qianhaoq/dota2.ai/issues
- X (Updates & DMs): https://x.com/kilocean
- Email: [email protected]
- License: PolyForm-Noncommercial-1.0.0 — free for personal review, study, research, and non-commercial tools. Commercial hosting or paid products require a commercial license.
A fan project, not affiliated with or endorsed by Valve Corporation or Perfect World. Dota, Dota 2, and Steam are trademarks of Valve Corporation.
Explorer des projets similaires
Chargement…