Dylan Matthews

Case study · Owner-only hosted tool · recorded public builds

Commander Deck Generator

Grounded AI reasoning and deterministic constraints turn a strategy into a reviewable deck.

Flask and a SQLite job queue dispatch a Python DeckBuilder. DeepSeek via Hugging Face generates a cached profile. SQL filters, weighted CVAR and Pareto pruning reduce candidates; NumPy combines rules and MiniLM cosine similarity. K-means supplies reference-deck archetype inclusion rates when available. Greedy fill and local search assemble the deck, followed by batched DeepSeek review, Python validation, optional C++ mana trials, and SQLite persistence with web views and exports.
Open the full-size architecture diagram.

The problem

Building a Commander deck is a recommendation problem with hard constraints and subjective goals. A 99-card list must respect color identity, legality and budget while supporting a coherent strategy. The generator combines model interpretation with deterministic selection, then exposes the evidence and warnings behind the result. It is a practical experiment in making AI recommendations inspectable.

Contribution and AI assistance

Dylan owns and operates the project and approved its informed-generation plan. The product combines strategy input, background generation, saved results and deck exports. Public recorded builds expose warnings and rejected changes so visitors can assess the system beyond a polished output.

How AI contributed

Implementation and review were AI-assisted. Validation records document Cursor work on scoring, caching and evidence views, plus Claude and Cursor work on later draw-route analysis. The linked records describe review corrections and task boundaries.

  • Python
  • SQLite
  • NumPy
  • Hugging Face Inference Providers

Two consequential decisions

Decision 1

Let models interpret; let code enforce

The model produces a grounded commander profile and reviews risky selections. Code filters candidates, assembles the list and checks constraints. Conditional card analysis separates printed mana value from activation costs and prerequisites. Unsupported mechanics remain explicit, keeping a plausible explanation from becoming an unchecked rule.

Decision 2

Preserve function and investigate failed improvements

Swaps and budget repair check whether supported card functions survive a replacement. This protects engine pieces but can retain weak filler. Paired runs and candidate traces showed why: a budget-completion fallback admitted unscored cards. That finding gives the next iteration a concrete target rather than another scoring bonus.

Verification

  • The draw-route study records 2,304 passing tests and 21 skips. Eight paired offline builds across four commanders held data, profiles and embeddings constant; all passed mechanical validation. These are recorded results, not a fresh test run.
  • The October 2, 2026 gallery preserves five builds at revision cd414cd against a September 12 card snapshot. It is historical evidence, separate from the newer repository study.

Outcome and progression

2 false role assignments corrected

More accurate diagnostics; unchanged deck membership

The paired draw-route study removed two false draw assignments from Lathril. All four commander pairs retained the same cards; stronger decks and faster generation remain unproven.

5 legal lists; 3 still flagged

Public examples expose quality gaps

The October 2 gallery passed stored-catalog legality checks, with unresolved review flags in three builds. Rule compliance does not establish deck strength or current legality.

Milestones

  1. 2026-09-12Owner approved the informed-generation plan; its validation record shows 979 passing tests.
  2. 2026-09-13Revision cd414cd on the main branch, later used for the gallery.
  3. 2026-10-02Five gallery builds recorded and published as static pages.

What I would measure next

Repair the budget-completion fallback, then rerun fixed-input comparisons and add blind human deck ratings. Measure strategic quality alongside legality, unresolved flags, elapsed time and model cost.

Explore the evidence

  1. Open the Krenko recorded build and compare its warnings with the rejected swaps in Pipeline stages.
  2. Read the paired draw-route results to see what changed and what did not.

Evidence and further reading