pkmn.ai

Rules

/llms.txt is a coding-agent-friendly companion to this page which contains additional details for optimizing your project for the pkmn.ai arena. In the event of a conflict, the human-written content below always takes precedence.

Registration

Competitors interested in participating in pkmn.ai’s ladders or tournaments can request inclusion via GitHub. You will be required to provide:

Staff will review the resulting pkmn/ai issue, add your project to projects.yml, and approve it for submissions.

Submission

Registered competitors sign in to their account via GitHub OAuth to view status, link a Discord ID (for notifications and chat roles), generate a Submission API token, and — once approved and eligible — submit an agent with:

Ladder submissions will run on an Apple M6 Mac mini with access to 10 cores (2 Super, 4 Performance, and 4 Efficiency), 14 GiB of dedicated RAM, and 4 GB of scratch $TMPDIR storage wiped between games. The network is disabled and opponents are anonymous. Ladder submissions may be an OCI linux/arm64 container (virtual GPU via Vulkan passthrough) or a native bundle (direct GPU/ANE via Metal/CoreML). Tournaments specify their own hardware and accept only linux/amd64 OCI containers.

OCI Container
FROM --platform=linux/arm64 rust:1.85-slim AS builder
WORKDIR /src
COPY . .
RUN cargo build --release && strip --strip-unneeded target/release/my-agent

FROM --platform=linux/arm64 debian:bookworm-slim
COPY --from=builder /src/target/release/my-agent /usr/local/bin/my-agent
ENTRYPOINT ["/usr/local/bin/my-agent"]
Native Bundle
mkdir -p dist/src dist/weights
uv python install 3.12
uv venv --python 3.12 --relocatable --no-cache dist/.venv
uv pip install --no-cache --python dist/.venv/bin/python mlx numpy
find dist/.venv -name '__pycache__' -type d -exec rm -rf {} +

cp src/*.py dist/src/
cp weights/*.safetensors dist/weights/

cat << 'EOF' > dist/run
#!/usr/bin/env bash
DIR="$(cd "$(dirname "$0")" && pwd)"
exec "${DIR}/.venv/bin/python" -u "${DIR}/src/main.py" --weights "${DIR}/weights"
EOF
chmod +x dist/run
tar --zstd -cf agent-bundle.tar.zst -C dist .

Every project submission must be at most 500 MiB both compressed and unpacked on disk. Native bundles must contain at most 25,000 files/directories/symlinks and an executable ./run at the archive root. OCI containers must contain at most 32 OCI layers and the container ENTRYPOINT / CMD must run the agent.

Tournaments close at 00:00:00 UTC strictly before start time and accept only the first activated entry for a project (resubmissions are allowed after a failed or discarded diagnostic test until the cutoff, and activation must also occur before cutoff). Ladder competitors may run up to 2 versions concurrently per ladder, and may target one or multiple eligible ladders with a single submission (with at most one ladder submission pending or awaiting activation per project at a time). A new submission may target a given ladder once both hold for that ladder:

Before going live, every submission undergoes a full-game self-play diagnostic test (vX vs vX using two distinct public sample teams, own roster teams on pools, or generated random teams on random) in each unique format it targets, under real format timers plus a wall-clock ceiling (10m RBY, 8m ADV, 6m SV/RAND/VGC, excluding /ready grace; reaching the ceiling after at least one clean turn passes). While running, the submitting project can watch live /info stats and the Showdown viewer privately on account; afterward, the full replay (with /info telemetry and an indicator of whether valid /info output was detected) and up to 64 KiB of stderr per side (16 KiB head + 48 KiB tail, including pre-/ready output; excess is truncated without failing) are available privately on account. Failed diagnostic artifacts are deleted immediately and never archived. Passing transitions the build to staged (held locally on the ladder runner, unarchived) rather than entering matchmaking automatically: the developer reviews the replay and stderr log and explicitly clicks Activate (archiving the artifact, reserving the version string, entering the ladder/tournament, and starting the 14-day cooldown for the targeted ladders) or Discard (deleting the staged build, leaving ladders untouched, freeing the version string for reuse, and restoring any staged VGC team paste back to saved). Neither failed nor discarded diagnostic tests trigger the 14-day cooldown, but each project is limited to at most 3 failed or discarded diagnostic tests per 24 hours (tracked separately for ladders and tournaments). If 2 versions are already active on a ladder when a new version is activated, the weaker is automatically retired, leaving the strongest version and the latest submission.

Format

A pkmn.ai ladder is fixed to a specific time period and will not be updated if the community later decides to change the rules — it is necessary to hold the format constant to be able to compare to past versions. To support dynamic metagames, seasonal formats rotate and are replaced with newer rules. All current ladders use Pokémon Showdown’s rules and mechanics as of Nov 9th 2026 (a78551b0/ v0.11.0).

The competitive Pokémon formats currently eligible for fixed ladder submissions are:

Strong human teams harvested from Pokémon Showdown logs are assigned per match (see below), with era-matched data.pkmn.cc usage stats at $PKMN_STATS_DIR/<format>.json.

The competitive Pokémon formats currently eligible for seasonal ladder submissions are:

RAND (gen9randombattle)

In Generation X this ladder will be retired and replaced with one supporting gen10randombattle if Pokémon Showdown creates one. Teams come from Pokémon Showdown’s random generator, with era-matched data.pkmn.cc stats under $PKMN_STATS_DIR in the same hierarchy as the site.

VGC (gen9championsvgc2026regmc)

Played with Closed Team Sheets, this ladder will be updated to follow TPCi’s VGC ruleset — once a new ruleset is announced, the existing ladder will be retired and replaced with one for the new ruleset.

Unlike other pkmn.ai arena ladders, competitors in the VGC ladder will be required to submit 20 distinct teams to make up a shared competitor team pool and will be randomly assigned teams from this shared pool at the start of each match. The arena ensures each team in the pool is played with equal probability and that any match uses at most one team submitted by the two competing projects combined (self-play across versions of the same project draws both teams exclusively from third parties). Teams submitted to the pool must be distinct from each other and from any publicly shared teams. No usage statistics will be provided for the format.

Submitting degenerate teams to the pool violates the spirit of this competition (and is pointless, since blind-pair matches tend to end in ties); submitting legitimate teams tailored to your agent’s strengths is fair play.

All competitions follow Pokémon Showdown’s timer rules (without its 60-second disconnect grace), with undoing, forfeiting, and offering ties disabled. Pondering is disabled on ladders and enabled by default in tournaments.

Logs or team information from the ladders using harvested human team data will never be made public. RAND ladder games and tournament matches (logs and teams) are broadcast live — with full tournament replay archives (.tar.zst) published upon completion — and VGC ladder logs and teams will be made available after the ladder is retired and rotated out for a new season.

Protocol

All ladder and tournament matches on the pkmn.ai arena take place in a sandbox: your submission is launched as a local subprocess for one single game (or one complete Best-of-N series in multi-game tournaments, where initialization occurs once and scratch state persists across games of the series) and communicates strictly over standard input (stdin) and standard output (stdout) with no room-ID prefix lines.

Matchmaking

Ladder battles are played as blind-pair matches: two successive sandboxed games with teams swapped, eliminating team-matchup variance since neither agent sees Game 1 during Game 2.

Ratings are modeled using batch Maximum a posteriori (MAP) estimation over a 5-category Davidson model (1970) (a generalization of the Bradley–Terry model with ties) which considers match outcomes as a unit. The ratings are mapped to the Elo scale, and one specific agent chosen to represent the top of the Pokémon Showdown human ladder is defined to be 1500 on the scale (the “anchor”). This anchor will always be eligible for matchmaking and prevents the rating scale from drifting over time. Leaderboards order entries by 95% conservative rating (Elo−1.96×SE\text{Elo} - 1.96 \times \text{SE}), assigning an official rank to at most one active version per project once past the provisional gate (≥20\ge 20 matches and SE≤40\text{SE} \le 40).

The arena matchmaking algorithm aims to maximize Shannon information gain over competitor ratings across all ladders while prioritizing determining the strongest competitors and matching them against each other, dampening repeat matchups, and preventing the outright starvation of any project or ladder.

Tournament formats depend on event rules, defaulting to a Round Robin followed by an extended Superfinal between the top two entrants.

Recommendations

Packaging
  • for neural-network ladder agents, prefer a native darwin/arm64 bundle over a linux/arm64 container for direct Metal/ANE access and zero-copy mmap weights. No Mac is needed — build binaries, standalone arm64 Python runtimes, and CoreML models on GitHub Actions’ free macos-26 (arm64) runner.
  • drop optimizer state and training-only heads, and convert/quantize CUDA checkpoints on CPU (map_location='cpu', float16/bfloat16/int8 .safetensors, .gguf, ONNX, or .mlpackage) — no build-time GPU is needed. Pre-compile CoreML models on macos-26 (xcrun coremlcompiler compile Model.mlpackage ./weights/); runtime CoreML compilation is not supported in the sandbox. Since free macos-26 runners lack bare-metal GPU/ANE access, smoke-test on CPU in CI and auto-select Metal/ANE at runtime on the arena’s M6.
  • tune inference for Apple Silicon and stay under 500 MiB: small batch=1 PyTorch mps calls are often slower than CPU due to dispatch overhead — prefer lightweight inference runtimes (ONNX Runtime CPU provider, static-shape pre-compiled CoreML .mlmodelc, or native C++/Rust with Accelerate/Metal) over bundling full PyTorch (or MLX, whose unpacked mlx.metallib exceeds 200 MiB). Batch search evaluations, avoid per-step host syncs, and avoid float64 (unsupported on Metal).
  • strip debug symbols from compiled binaries and shared libraries (strip -x followed by codesign --force --sign - on macOS, strip --strip-unneeded on Linux).
  • exclude __pycache__, .git, test suites, pip/uv caches, C++ header files (include/), static archives (.a), intermediate .mlpackage / build files, and runtime bloat (unused lib/libpython*.dylib, Tcl/Tk, onnxruntime’s duplicate libonnxruntime.*.dylib, or PyTorch’s _inductor/_dynamo/protoc*/sympy/networkx; zipping the pure-Python standard library into python3XX.zip also cuts ~1,500 entries).
Uploading
  • upload .tar.zst to a private Cloudflare R2 (10 GB/mo free tier, zero egress), AWS S3, Backblaze B2, or GCS bucket and generate a 24-hour presigned GET URL (rclone link or aws s3 presign --expires-in 86400).
  • host the .tar.zst on a private GitHub repository release and pass a fine-grained PAT scoped strictly to that single repo with Contents: Read-only (expiring in 7 days).
  • host the bundle in a private Hugging Face repo and provide a read-only token (hf_...) scoped to that repo.
  • push to a private registry and provide a temporary read:packages pull token.
Environment
  • the wall-clock time jumps while you are paused — if your agent records a timestamp on Turn N and compares it to a timestamp taken on Turn N+1, the difference will include all of your opponent’s thinking time while your process was frozen. Instead, measure elapsed time from the moment your agent reads |inactive|Time left: ... on stdin.
  • finish state updates before writing \n to stdout — the arena coordinator calls SIGSTOP / podman pause within microseconds of reading your choice newline on stdout, meaning any post-turn tree pruning or cleanup will happen the next time you are unpaused if you do not handle it before making your choice. Conversely, always explicitly flush stdout immediately after making your choice in case your language runtime buffers stdout when connected to a pipe.
  • the bundle/container root filesystem is mounted read-only; $TMPDIR, $HOME, and (on ladders) $XDG_CACHE_HOME all point to the per-game scratch directory (wiped between games; native bundles cannot write to /tmp), which also holds CoreML/Metal shader caches and runtime temp files. Run a dummy forward pass before printing /ready (60-second startup budget) so cold shader/ANE compilation does not burn your turn clock.
  • ladder processes are capped at 256 (RLIMIT_NPROC=256 on native bundles; --pids-limit=256 including threads in containers), and stderr is drained during regular matches (during diagnostic tests, up to 64 KiB per side — 16 KiB head + 48 KiB tail — is captured and downloadable privately on account; host-measured CPU/GPU utilization and fixed-enum protocol error aggregates are published on each project’s profile page).
  • on ladders, the arena sets OMP_NUM_THREADS=10, MKL_NUM_THREADS=10, TORCH_NUM_THREADS=10, and RAYON_NUM_THREADS=10. Do not hardcode thread pools larger than 10 threads, and tune thread counts for your workload on the heterogeneous 2 Super + 4 Performance + 4 Efficiency core layout: for barrier-synchronized work (e.g., small CPU neural-network matrix multiplications), spilling onto the slower Efficiency cores can stall the Super and Performance cores and slow down the entire step, so benchmark smaller counts (at most 6 threads) for intra-op pools; by contrast, independent or asynchronous parallel search (e.g., multi-threaded MCTS, parallel determinizations, or rollouts) scales well across all 10 cores. Similarly, ARENA_MEMORY_LIMIT_MB=14336 is set on ladders — be sure to size runtime tables to account for potential runtime overhead and avoid triggering a forfeit due to running out of memory (OOM). In tournaments with pondering enabled, ARENA_PONDER=1 is set.
  • on macOS, clean read-only memory-mapped pages in native bundles (mmap with PROT_READ and MAP_PRIVATE/MAP_SHARED, e.g., safetensors/gguf) are file-backed and count as 0 bytes toward the 14 GiB RAM limit.