# Moklovin build-pattern profiles

CourtEdge can enforce **elite build-pattern shapes** during Moklovin pool generation and when filtering **800 → top 150** (MME) or picking **SE #1** after sim rank.

Patterns are **archetypes** (chalk count, salary bands, CPT own caps) — not copies of any one person's exact lineups.

## Where it lives

| File | Purpose |
|------|---------|
| `data/pga-moklovin-pattern.json` | Presets: `moklovin_mme_150`, `moklovin_se` |
| `js/pga-dk-engine.js` | `lineupMeetsBuildPattern`, batch + export filters |
| `pga-dk-lineup-lab.html` | **Elite build pattern** panel + Moklovin workflow wiring |

Play boards may set `"build_pattern_preset": "moklovin_mme_150"` (see `data/pga-showdown-r4-play-board.json`).

## Presets (Rick / field proxy)

### Moklovin 150-max MME (`moklovin_mme_150`)

Target composition **in every lineup**:

- **2–4 chalk FLEX** (own ≥ 12%)
- **2–3 $5.8k–$6.6k FLEX** (“$6k guys”)
- **≥1 sub-8% lever**
- **CPT** ideally ≤ 28% own (ceiling/leverage)
- **Cumulative own** ~48–92% (sum of six own%)

Used by: **Moklovin MME · 800 → top 150**, **500/1000 MME** workflows.

### Moklovin SE (`moklovin_se`)

- **1–2 chalk** anchors
- **2+ sub-10% levers**
- **1–2 $6k flex**
- **CPT** ≤ 18% own preferred

Used by: **Moklovin SE · 200/300 → Top 1% → #1**.

## How the lab applies patterns

1. **Pool build (800+ lineups)** — `rules.buildPattern` rejects lineups that miss min/max chalk, salary bands, levers, CPT own, or cum-own band. Worker stats show `pattern` rejections in GPP summary.
2. **800 → 150 export** — ranked pool is scanned **pattern-first**; top 150 that match the preset, then backfill if needed.
3. **SE #1 export** — first **pattern-matching** lineup in rank order (not raw #1 if it breaks shape).

Toggle preset in the lab: **Elite build pattern · MME 150-max / SE GPP**.

## Data we have vs need

### Already in repo

- Slate **salary**, **projection**, **ownership_pct** (FTN/DataGolf overlays)
- Play-board **chalk anchors**, **CPT pivots**, **low-owned value**
- Compare script: `scripts/compare-pga-showdown-r2-portfolios.mjs` (CE vs FTN 150 proxy)

### Rick data we do **not** have yet

- Moklovin **historical DK CSV exports** (150-max or SE)
- RickRunGood **live cheat sheet** (members-only SG momentum layer)
- Automated **portfolio histogram** from pasted elite builds

### Rick data we **have** (Holy Grail)

- `data/pga-schwab-holy-grail.json` — Colonial TOT / Win% / fades (17 golfers, May 2026)
- `data/imports/rick-holy-grail-schwab-2026.txt` — paste source
- Lab panel **Rick Holy Grail · Colonial** on R4 showdown preset
- Play-board + GPP scoring boosts — see `docs/PGA-RICKRUNGOOD-INTEGRATION.md`

## What to paste from Rick (or DK)

### Option A — DK upload CSV (best)

Standard DK format:

```text
G,G,G,G,G,G
Ludvig Aberg (CPT),Zach Bauchou,Davis Thompson,...
```

Save as e.g. `data/imports/moklovin-r4-150.csv`.

### Option B — Tab paste (quick audit)

One lineup per row:

```text
lineup_id	cpt	flex1	flex2	flex3	flex4	flex5	salary_used	cum_own
1	Hubbard	Bauchou	Aberg	Henley	Fishburn	Rodgers	49800	72.4
```

### Deriving pattern counts

For each golfer in export, tag:

- **Chalk** if own ≥ 12% (from loaded slate)
- **$6k flex** if FLEX salary 5800–6600
- **Lever** if own ≤ 8%

Aggregate across N lineups → set `min_count` / `max_count` in `pga-moklovin-pattern.json`.

Example Rick note: *“2 chalky guys + 2 $6k guys in all lineups”* → MME preset chalk `min_count: 2`, `$6k flex` band `min_count: 2`.

## Roadmap — beat field patterns

1. **Import analyzer** — `node scripts/analyze-pga-build-pattern.mjs --csv data/imports/moklovin-r4-150.csv` → suggested JSON patch (future).
2. **Overlap vs CE pool** — extend `compare-pga-showdown-r2-portfolios.mjs` for R3/R4 + user CSV (same as FTN flow).
3. **Pattern-aware sim** — boost ROI rank for lineups that match preset *and* beat field duplication (pair exposure caps already in Moklovin MME).
4. **Contest-specific presets** — Milly vs $4 150-max different chalk/lever bands from Rick notes.
5. **Live slate sync** — recompute chalk threshold from slate top-6 own% each week.

## Manual tune (today)

Edit `data/pga-moklovin-pattern.json` → reload lab → run **Moklovin MME · 800 → top 150** → check **Last build: X% match pattern** in the pattern panel.

If match % is low, widen bands (e.g. `$6k` max 6800) or lower chalk `min_count` until pool fills, then tighten after Rick CSV confirms.
