Skip to content
Proyek

Tentang

An evidence-first Dota 2 post-match coach — web, JSON API, CLI and MCP. 拿证据说话的 Dota 2 赛后教练。

AI dan pembelajaran mesin

Cara angka ini diukur

Pertumbuhan bintang terukur

dalam 24 jam
Mengumpulkan riwayat
dalam 7 hari
Mengumpulkan riwayat
dalam 15 hari
Mengumpulkan riwayat
dalam 1 bulan
Mengumpulkan riwayat

Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.

README.md

Asli

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:
    1. 5v5 Blueprint — post-draft matchup strengths/weaknesses, win condition, 10 hero jobs, and 5v5 teamfight execution order.
    2. 10 Players & Benchmarks — all 10 heroes with visible 6-item icon builds, expandable full stats table, and same-bracket percentiles.
    3. Phase Timeline — chronological walkthrough from draft and laning through midgame, macro, and pro/bracket item builds.
    4. 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×900 Battle-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 s stun → 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_windows on the 30:26–30:48 turning 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 Bar 914 units away and dealt 8,524 hero damage while Dire's only BKB-piercing stun had 66 s left on cooldown (spent on Necrophos 9.1 s earlier at 30: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=beastmaster

Or open it live at dota2.ai/r/9100904020?hero=beastmaster (and compare Match #9091400302 Tidehunter).


How It Works & Engineering Invariants

dota2.ai architecture: Valve/Perfect World .dem replay distilled into a ~250 KB trace, investigated by 23 lookup tools, gated by deterministic verifyReview code checks, and rendered as trace-recomputed evidence
  1. Replay Trace (packages/review-engine/src/trace): Source 2 .dem replays 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 through linkHeroNames.
  2. 23 Fact & Mechanics Lookup Tools (lib/agent): Tools return facts, patch-verified mechanics references, and explicit gaps — 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.
  3. Code-Enforced Verification (lib/agent/review/verify.js): Every timestamp, stat, item share, and ref is verified against that run's actual tool outputs. Unsupported sentences get 1 repair round, then are dropped. Unknown is never false (missing data stays null + 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.
  4. 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):

  1. Download & open DeepSeek Harness (macOS / Windows) and sign in or add your DeepSeek API Key.
  2. Paste this one message into any chat (auto-installs @qianhaoq/dsh-dota2ai from 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.
    
  3. Click dota2.ai in 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:


Open Source, Feedback & Contact

A fan project, not affiliated with or endorsed by Valve Corporation or Perfect World. Dota, Dota 2, and Steam are trademarks of Valve Corporation.

Jelajahi proyek terkait

Memuat…