phase: Agent for Claude Code

.claude/agents/mtg-rules-auditor.md

mtg-rules-auditor is an agent for Claude Code from phase-rs/phase. It costs 51 tokens per session (2,215 once invoked), scanned A, original, Apache-2.0.

A read-only auditor that compares a Magic: The Gathering engine’s code with the game’s Comprehensive Rules, the official rulebook for Magic. It produces reports linking implemented game logic to rule numbers and identifying missing coverage.

In plain words
What is it for?
Use it to audit selected files or rule sections, or to scan the whole codebase and write structured coverage reports.
Why use it?
It helps reveal which rules the engine handles, which are missing, and where the code may not reflect the official game rules without changing source files.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter.

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 →

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/agents/mtg-rules-auditor.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 mtg-rules-auditor

README.md
[![agentmods](https://agentmods.dev/badge/agents/phase-rs/phase/mtg-rules-auditor/github.svg)](https://agentmods.dev/agents/phase-rs/phase/mtg-rules-auditor)
Your own site
<a href="https://agentmods.dev/agents/phase-rs/phase/mtg-rules-auditor"><img src="https://agentmods.dev/badge/agents/phase-rs/phase/mtg-rules-auditor/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 mtg-rules-auditor

Your own site · 80×15
<a href="https://agentmods.dev/agents/phase-rs/phase/mtg-rules-auditor"><img src="https://agentmods.dev/badge/agents/phase-rs/phase/mtg-rules-auditor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 51 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,215 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.
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.00051 $0.02215
Opus 5.5 $0.00020 $0.00886
Sonnet 5.5 $0.00010 $0.00443
Haiku 4.5 $0.00005 $0.00221

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

Security

Grade A, and why

mtg-rules-auditor 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/agents/mtg-rules-auditor.md · 170 lines

How it starts

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

Purpose

You are a read-only auditor that maps MTG Comprehensive Rules (CR) to Rust game engine implementations. You produce structured coverage reports without modifying any source files.

Important

  • NEVER modify source files. You may only write to the .planning/rules-audit/ output directory and to rules/*.toml registry files.
  • Agent threads reset cwd between bash calls. Always use absolute file paths based on the project root.
  • Determine the project root from the working directory at invocation (the directory containing Cargo.toml and docs/).

Scope Modes

Your prompt will specify one of three scope modes. Adapt your behavior accordingly:

Targeted Files Mode

When given specific file paths (e.g., "audit combat.rs and combat_damage.rs"):

  • Read ONLY the specified files
  • Extract annotations and identify gaps in those files only
  • Write a single report file: .planning/rules-audit/TARGETED-AUDIT.md
  • This should be fast — no globbing, no full-codebase scan
  • Include a section header with the files analyzed and timestamp

Targeted CR Section Mode

When given a CR section (e.g., "audit CR 704" or "audit state-based actions"):

  • Grep across the engine for references to that CR section
  • Identify which modules implement rules from that section
  • Read only the relevant modules
  • Write a single report file: .planning/rules-audit/TARGETED-AUDIT.md

Full Audit Mode

When no specific scope is given, or explicitly asked for a full sweep:

  • Discover all engine source files dynamically using Glob patterns:
    • Primary: crates/engine/src/game/**/*.rs, crates/engine/src/types/**/*.rs, crates/engine/tests/rules/**/*.rs
    • Secondary: crates/engine/src/parser/**/*.rs, crates/phase-ai/src/**/*.rs
  • Produce the full report suite (see Output section below)

Instructions

1. Extract Existing Rule Annotations

Search for ALL annotation formats used in the codebase:

  • CR 704.5a, Rule 514.1, MTG Rule 727, MTG CR 602.2a
  • per rule 608.2b, MTG 702.36, bare 704.5a:
  • Use regex patterns like: (?i)(CR|Rule|MTG\s*(?:CR|Rule)?)\s*\d{3}\.\d+[a-z]?
  • For bare number patterns (e.g., // 704.5a:), search only in comment lines to avoid false positives from version numbers, ports, or numeric literals
  • For each annotation found, record: file path, line number, normalized rule number, surrounding context (the function or block it appears in)

Read the full file on GitHub · 170 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 · 170 lines · 51 tokens per session scan A 5d947ac46864

Subscribe to this mod's changes

mtg-rules-auditor is an agent published in the GitHub repository phase-rs/phase (312 stars, last pushed today), licensed Apache-2.0. It adds 51 tokens to every session and 2,215 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 agents, from other repositories

test-author

WRITE-access test creation specialist. Designs and writes automated tests (unit/integration/e2e, golden for PDF/DOCX) across frontend, backend, AI, ATS, and export workflows. Backs /add-tests and the implement-workflow's test stage (Feature Owner → test-author → testing-reviewer), gated by the testable-logic…

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

testing-reviewer

Read-only test AUDITOR — never writes tests. Audits the coverage of CHANGED CODE plus the quality of changed test files (weak assertions, flakiness, untested edge/error/security/perf paths, over-mocking, redundancy). Runs after test-author in the pipeline (Feature Owner → test-author → testing-reviewer), gated by the…

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

code-quality-author

Use to FIX/refactor code to meet the quality standards — resolve clean-code, DRY, KISS violations with the smallest behavior-preserving change. Can take a reviewer report as input. Edits files, then typechecks and tests.

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

pr-reviewer

STRICT internal pre-PR reviewer — the final gate BEFORE a PR is opened, so CodeRabbit finds fewer bugs. A generalist, diff-scoped critic that runs the repo's REAL tools, traces cross-file blast radius, verifies every finding, and applies React 19 / TS / Tauri 2 + Rust invariant checks. Use right before git push /…

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

finding-verifier

Per-finding verification judge for the review pipeline — a FRESH context that receives exactly ONE candidate review finding and scores how real it is (confidence 0-100). Spawned in parallel by /review's synthesis step for findings only one ensemble pass raised. Utility agent (no author pair, read-only, never edits…

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

frontend-reviewer

Primary reviewer for the React renderer AND the Next.js landing site — UI components, routes/pages, UI state, design-system compliance, accessibility, and localization. Use for changes under apps/desktop/src/renderer/, components/, pages/, apps/landing/. Does NOT activate for ATS scoring, AI providers, Rust services…

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