phase: Skill for Claude Code

.claude/skills/retrain-ai-weights/SKILL.md

retrain-ai-weights is a skill for Claude Code from phase-rs/phase. It costs 49 tokens per session (2,184 once invoked), scanned A, original, Apache-2.0.

A workflow for retraining the game’s artificial-intelligence evaluation settings from 17Lands replay data, a public source of anonymized Magic: The Gathering gameplay records. It covers adding datasets, running CMA-ES optimization, and updating learned Rust values.

In plain words
What is it for?
Use it when retraining evaluation weights, policy penalties, keyword bonuses, deck-archetype settings, or AI profiles from replay data.
Why use it?
It keeps training data, optimization groups, and the resulting AI parameters organized when improving how the AI evaluates game positions.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is phase-rs/phase's own configuration. It tells Claude Code how to work on phase itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything phase configures →

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is rtk python3 scripts/train_eval_weights.py --data-dir data/17lands --output data/learned-weights.json.

Reuse

Borrowing it

Nothing to install: this file belongs to phase-rs/phase. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/phase-rs/phase/main/.claude/skills/retrain-ai-weights/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/phase-rs/phase

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for retrain-ai-weights

README.md
[![agentmods](https://agentmods.dev/badge/skills/phase-rs/phase/retrain-ai-weights/github.svg)](https://agentmods.dev/skills/phase-rs/phase/retrain-ai-weights)
Your own site
<a href="https://agentmods.dev/skills/phase-rs/phase/retrain-ai-weights"><img src="https://agentmods.dev/badge/skills/phase-rs/phase/retrain-ai-weights/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for retrain-ai-weights

Your own site · 80×15
<a href="https://agentmods.dev/skills/phase-rs/phase/retrain-ai-weights"><img src="https://agentmods.dev/badge/skills/phase-rs/phase/retrain-ai-weights.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,184 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00049 $0.02184
Opus 5.5 $0.00020 $0.00874
Sonnet 5.5 $0.00010 $0.00437
Haiku 4.5 $0.00005 $0.00218

Measured 2mo ago against content hash 6cfe32185271, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

retrain-ai-weights scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/retrain-ai-weights/SKILL.md · 178 lines

How it starts

The opening of the file, as written. The whole thing — 178 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Retrain AI Evaluation Weights

Use when the user wants to retrain AI weights from 17Lands data, add new training datasets, update learned weight values in Rust, or run CMA-ES optimization.

Architecture Overview

The AI weight system has 4 layers:

  1. Base weights (EvalWeightSet in crates/phase-ai/src/eval.rs) — 9 weights × 3 game phases (early T1-3, mid T4-7, late T8+). Learned from 17Lands replay data.
  2. Archetype multipliers (ArchetypeMultipliers in crates/phase-ai/src/deck_profile.rs) — 5 archetypes × 9 multipliers. Scale base weights per deck type.
  3. Keyword bonuses (KeywordBonuses in crates/phase-ai/src/eval.rs) — 10 params for creature evaluation.
  4. Policy penalties (PolicyPenalties in crates/phase-ai/src/config.rs) — tactical policy score knobs.
  5. AiProfile (crates/phase-ai/src/config.rs) — 3 params (risk_tolerance, interaction_patience, stabilize_bias).

All stored in AiConfig. The CMA-ES optimizer tunes one parameter group per run via --group eval|penalties|keywords|archetype:

  • eval: 9 late-game EvalWeights plus 3 AiProfile values. Early/mid weights are derived from the 17Lands phase ratios.
  • penalties: every field listed in ACTIVE_POLICY_PENALTY_FIELDS.
  • keywords: all KeywordBonuses fields.
  • archetype: 5 archetypes x 9 ArchetypeMultipliers.

Do not mix groups in one run. Compare and validate one group artifact at a time so regressions can be attributed to a specific surface.

Training Data Setup

Data location: data/17lands/ (gitignored)

Required files from 17Lands (https://www.17lands.com/public_datasets):

  • replay_data_public.{SET}.PremierDraft.csv — Per-turn board state snapshots. Premier Draft (Bo1) is best: largest dataset, no sideboard confounds, human-drafted decks.
  • cards.csv — Arena card ID to mana value mapping.

To add new sets: Download CSVs and symlink or copy into data/17lands/:

ln -s ~/Downloads/replay_data_public.FDN.PremierDraft.csv data/17lands/
ln -s ~/Downloads/replay_data_public.DSK.PremierDraft.csv data/17lands/
# cards.csv only needed once (shared across sets)
ln -s ~/Downloads/cards.csv data/17lands/

Read the full file on GitHub · 178 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 178 lines · 49 tokens per session scan A 6cfe32185271

Subscribe to this mod's changes

retrain-ai-weights is a skill published in the GitHub repository phase-rs/phase (312 stars, last pushed today), licensed Apache-2.0. It adds 49 tokens to every session and 2,184 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

rust-standards

Rust/Tauri backend standards — L0–L3 layers, centralized platform/net/error ownership, Rust-first business logic, registries, error handling. Load for changes under apps/desktop/src-tauri/src/.

saeedkolivand/ai-job-hunter-app · 48 tokens

tauri-standards

Tauri shell standards — the IPC 5-step capability flow, command implementation pattern, and capability/permission wiring. Load for new IPC capabilities and changes to commands.rs / tauri-client.ts / capabilities/.

saeedkolivand/ai-job-hunter-app · 47 tokens

anarlog

Query Anarlog meetings, notes, summaries, transcripts, participants, action items, and recurring history, or import a local recording. Use when a user asks about their Anarlog meeting data or needs meeting context for another task.

fastrepl/anarlog · 50 tokens

graphify-windows

Turn any folder of files into a navigable knowledge graph with community detection, an honest audit trail, and three outputs: interactive HTML, GraphRAG-ready JSON, and a plain-language GRAPHREPORT.md.

saeedkolivand/ai-job-hunter-app · 75 tokens

lessons

How to propose and query distilled lessons (the experiential memory). Only project-steward persists; every other agent proposes/queries. Use when you discover a durable lesson or need prior experience for the current task.

saeedkolivand/ai-job-hunter-app · 45 tokens

tauri-expert

Expert in Tauri framework, Rust backend, web frontend integration, and lightweight desktop applications. Use when the user mentions desktop, Rust, web, cross platform, or performance, or when the task involves Tauri Architecture, Tauri vs Electron, Core Components, or Security Features.

personamanagmentlayer/pcl · 61 tokens