Documentation
¶
Overview ¶
Package pokearena lives only to embed the curated dataset so a single physical copy of data/*.json can be reached by go:embed. go:embed cannot escape its own package directory, so before this file existed the agent binary kept a hand-synced duplicate under cmd/pokearena-agent/data/. By putting the embed at the module root — the one place that already contains data/ — every binary that wants the embedded dataset can import it from here.
Services that read data/ from disk (battle-worker, ai-service, gateway, data-sync, data-validate) don't use this package; they keep their existing DATA_DIR-based loading. Only binaries that need a no-clone-required standalone build (pokearena-agent today) embed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DataFS ¶
DataFS returns the embedded data directory rooted at "data/" — i.e. the caller sees pokedex.json / moves.json / typechart.json / items.json / natures.json at the top level, which is the shape domain.LoadDexFS expects.
benchmark-teams.json and _provenance.json ride along so that cmd/bench is self-contained too: the benchmark is the project's zero-setup entry point, and "go run github.com/shaumik/PokeArena/cmd/bench@latest" runs from a module cache directory with no data/ anywhere near it.
ai-teams.json rides along for pokearena-mcp's offline mode, where the built-in opponent needs a roster and there is no gateway to ask for one.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
ai-service
command
Command ai-service consumes AI-decision jobs for live battles, runs the agent harness against the battle state in Redis, and publishes the chosen action.
|
Command ai-service consumes AI-decision jobs for live battles, runs the agent harness against the battle state in Redis, and publishes the chosen action. |
|
battle-session
command
Command battle-session owns the coordinator for live battles (mode=live and mode=live_pvp).
|
Command battle-session owns the coordinator for live battles (mode=live and mode=live_pvp). |
|
battle-worker
command
Command battle-worker consumes quicksim jobs and simulates whole AI-vs-AI battles.
|
Command battle-worker consumes quicksim jobs and simulates whole AI-vs-AI battles. |
|
bench
command
Command bench runs the PokéArena battle benchmark: a round-robin of agents over a fixed seed set, writing a JSONL trace and a human-readable summary.
|
Command bench runs the PokéArena battle benchmark: a round-robin of agents over a fixed seed set, writing a JSONL trace and a human-readable summary. |
|
bench-history
command
Command bench-history reads the persisted run index and renders the benchmark's timeline: one row per run, each contestant's Elo over time, and the cumulative token spend.
|
Command bench-history reads the persisted run index and renders the benchmark's timeline: one row per run, each contestant's Elo over time, and the cumulative token spend. |
|
bench-report
command
Command bench-report turns a saved run record into a standalone HTML report: a leaderboard with confidence-interval bars, the per-team Elo breakdown, cost, and full provenance — one self-contained file, no network or assets.
|
Command bench-report turns a saved run record into a standalone HTML report: a leaderboard with confidence-interval bars, the per-team Elo breakdown, cost, and full provenance — one self-contained file, no network or assets. |
|
data-sync
command
Command data-sync is the Go ETL orchestrator: it reads the upstream Showdown snapshot from tools/data-sync/upstream/, runs the species through the filter chain, transforms to our schema, stages the result under data/.staging/, validates it via domain.LoadDexFS, and atomically swaps the staged files over data/*.json.
|
Command data-sync is the Go ETL orchestrator: it reads the upstream Showdown snapshot from tools/data-sync/upstream/, runs the species through the filter chain, transforms to our schema, stages the result under data/.staging/, validates it via domain.LoadDexFS, and atomically swaps the staged files over data/*.json. |
|
data-validate
command
Command data-validate loads a dataset directory through domain.LoadDexFS and exits 0 on success, non-zero on any schema or referential-integrity violation.
|
Command data-validate loads a dataset directory through domain.LoadDexFS and exits 0 on success, non-zero on any schema or referential-integrity violation. |
|
db-replay
command
Command db-replay reconstructs a watchable Replay from a live battle's persisted turns.
|
Command db-replay reconstructs a watchable Replay from a live battle's persisted turns. |
|
gateway
command
Command gateway is the PokéArena edge service: REST API, WebSocket live battles, SSE spectating, and the static SPA.
|
Command gateway is the PokéArena edge service: REST API, WebSocket live battles, SSE spectating, and the static SPA. |
|
leaderboard-worker
command
Command leaderboard-worker consumes battle-completed events and recomputes Elo ratings.
|
Command leaderboard-worker consumes battle-completed events and recomputes Elo ratings. |
|
mcp-smoke
command
mcp-smoke is a one-shot integration test for pokearena-mcp: it spawns the binary over stdio (as a real MCP client would), creates a live_pvp battle on the running gateway, and plays one full turn through the MCP tool surface.
|
mcp-smoke is a one-shot integration test for pokearena-mcp: it spawns the binary over stdio (as a real MCP client would), creates a live_pvp battle on the running gateway, and plays one full turn through the MCP tool surface. |
|
pokearena-agent
command
Command pokearena-agent is the reference agent harness for PokéArena.
|
Command pokearena-agent is the reference agent harness for PokéArena. |
|
pokearena-env
command
Command pokearena-env exposes the PokéArena battle engine as a line-oriented JSON environment over stdin/stdout — one JSON request object per line in, one JSON response object per line out.
|
Command pokearena-env exposes the PokéArena battle engine as a line-oriented JSON environment over stdin/stdout — one JSON request object per line in, one JSON response object per line out. |
|
pokearena-mcp
command
pokearena-mcp is the MCP server that lets an external agent (Claude Code first; the protocol is agent-agnostic) play a PokéArena battle.
|
pokearena-mcp is the MCP server that lets an external agent (Claude Code first; the protocol is agent-agnostic) play a PokéArena battle. |
|
pvp-smoke
command
pvp-smoke is a one-shot integration test that exercises the live_pvp path end-to-end against a running gateway: creates a battle, opens both WS slots, runs the picker phase (submit_team on both sides), plays one turn, and validates the frame shapes both clients receive.
|
pvp-smoke is a one-shot integration test that exercises the live_pvp path end-to-end against a running gateway: creates a battle, opens both WS slots, runs the picker phase (submit_team on both sides), plays one turn, and validates the frame shapes both clients receive. |
|
royale
command
Command royale is the tournament broker for a PokéArena battle royale: a file-backed, two-seat match director that lets two independent agent processes play a full battle against the real engine with no server, no websocket, and no shared memory between them.
|
Command royale is the tournament broker for a PokéArena battle royale: a file-backed, two-seat match director that lets two independent agent processes play a full battle against the real engine with no server, no websocket, and no shared memory between them. |
|
showdown-triage
command
Command showdown-triage turns a run of the Showdown port into the ledger it should have been reconciled against.
|
Command showdown-triage turns a run of the Showdown port into the ledger it should have been reconciled against. |
|
spread-impact
command
Command spread-impact measures how much the v2 training spreads change the games they are played in, by replaying every benchmark team in a heuristic mirror twice: once as shipped, once with EVs, IVs and Nature stripped back to the engine defaults.
|
Command spread-impact measures how much the v2 training spreads change the games they are played in, by replaying every benchmark team in a heuristic mirror twice: once as shipped, once with EVs, IVs and Nature stripped back to the engine defaults. |
|
team-validate
command
Command team-validate measures whether the competitive team library is balanced.
|
Command team-validate measures whether the competitive team library is balanced. |
|
internal
|
|
|
agentloop
Package agentloop is the reusable agent loop that plays a PokéArena battle as a trainer client: it dials the gateway, renders each turn's fog-of-war view into a prompt, asks an LLM for a decision, parses the reply, and submits the action — until the battle ends.
|
Package agentloop is the reusable agent loop that plays a PokéArena battle as a trainer client: it dials the gateway, renders each turn's fog-of-war view into a prompt, asks an LLM for a decision, parses the reply, and submits the action — until the battle ends. |
|
ai
Package ai is the agent harness — a switchable strategy interface plus a timeout-and-fallback runtime.
|
Package ai is the agent harness — a switchable strategy interface plus a timeout-and-fallback runtime. |
|
cache
Package cache is the Redis layer.
|
Package cache is the Redis layer. |
|
config
Package config loads service configuration from the environment.
|
Package config loads service configuration from the environment. |
|
domain
Package domain holds the static Pokémon reference data — species, moves, the type chart, items, and natures — loaded once from the curated JSON dataset.
|
Package domain holds the static Pokémon reference data — species, moves, the type chart, items, and natures — loaded once from the curated JSON dataset. |
|
engine
Package engine is the Pokémon battle engine.
|
Package engine is the Pokémon battle engine. |
|
engine/showdown
Package showdown holds the PokeArena engine's port of Pokémon Showdown's simulator test suite (`test/sim/**` in smogon/pokemon-showdown).
|
Package showdown holds the PokeArena engine's port of Pokémon Showdown's simulator test suite (`test/sim/**` in smogon/pokemon-showdown). |
|
eval
Package eval drives headless agent-vs-agent battles and records a per-decision trace.
|
Package eval drives headless agent-vs-agent battles and records a per-decision trace. |
|
gwclient
Package gwclient is a thin WebSocket client to the gateway's live_pvp slot endpoint.
|
Package gwclient is a thin WebSocket client to the gateway's live_pvp slot endpoint. |
|
httpapi
Package httpapi is the gateway: the REST API, the WebSocket live-battle endpoint, the SSE spectator endpoint, and the static SPA.
|
Package httpapi is the gateway: the REST API, the WebSocket live-battle endpoint, the SSE spectator endpoint, and the static SPA. |
|
livebattle
Package livebattle owns the coordinator for a single live battle — whether that's "live" (one human WS + one in-process AI) or "live_pvp" (two human or agent WS clients).
|
Package livebattle owns the coordinator for a single live battle — whether that's "live" (one human WS + one in-process AI) or "live_pvp" (two human or agent WS clients). |
|
llm
Package llm holds provider adapters that satisfy agentloop.LLMClient — the Complete(ctx, system, user) boundary — so any binary (the live agent, the benchmark) can drive a model without re-implementing the transport.
|
Package llm holds provider adapters that satisfy agentloop.LLMClient — the Complete(ctx, system, user) boundary — so any binary (the live agent, the benchmark) can drive a model without re-implementing the transport. |
|
mcpserver
Package mcpserver is pokearena-mcp's core: a Server that registers the agent-facing tools (join/view/wait/act/leave) and bridges them to a running gateway over WebSocket.
|
Package mcpserver is pokearena-mcp's core: a Server that registers the agent-facing tools (join/view/wait/act/leave) and bridges them to a running gateway over WebSocket. |
|
messages
Package messages defines the versioned contract carried over RabbitMQ: the work jobs, the domain events, and the topology names.
|
Package messages defines the versioned contract carried over RabbitMQ: the work jobs, the domain events, and the topology names. |
|
mq
Package mq is the RabbitMQ layer: topology declaration, publishers, and consumers.
|
Package mq is the RabbitMQ layer: topology declaration, publishers, and consumers. |
|
protocol
Package protocol defines the on-the-wire shapes for the gateway↔client WebSocket protocol used by live_pvp battles.
|
Package protocol defines the on-the-wire shapes for the gateway↔client WebSocket protocol used by live_pvp battles. |
|
session
Package session is the battle-session tier: it owns the coordinator for live battles (mode=live and live_pvp).
|
Package session is the battle-session tier: it owns the coordinator for live battles (mode=live and live_pvp). |
|
specs
Package specs holds the engine's vocabulary — the slugs that name every volatile, side condition, weather, terrain, status, flag, and boost stat the engine understands.
|
Package specs holds the engine's vocabulary — the slugs that name every volatile, side condition, weather, terrain, status, flag, and boost stat the engine understands. |
|
store
Package store is the PostgreSQL persistence layer — the system of record for species, trainers, battles, turns, and ratings.
|
Package store is the PostgreSQL persistence layer — the system of record for species, trainers, battles, turns, and ratings. |
|
usage
Package usage is the token-accounting substrate for LLM contestants: a small leaf package (no dependencies) that both the provider adapters and the agent loop import, so token counts flow out of every model call as structured data rather than log text.
|
Package usage is the token-accounting substrate for LLM contestants: a small leaf package (no dependencies) that both the provider adapters and the agent loop import, so token counts flow out of every model call as structured data rather than log text. |


