KoalaTrapLord
83502ce726
feat: Phase 3/5 deep analysis + Quick Digest endpoint (issue #108 ) ( #119 )
...
* feat(coach): Phase 3/5 JSON schema + QUICK_DIGEST prompt (issue #108 )
- Append removalCoverage, rampQuality, drawEngineProfile, winConditions,
antiSynergyFlags, podPresence, tempoAssessment, metaMatchups to schema
- Add 8 new RULES for Phase 3/5 analysis
- Add QUICK_DIGEST_SYSTEM_PROMPT constant
- Add build_quick_system_prompt() function
* feat(coach): Phase 3/5 JSON parsing + run_quick_digest() (issue #108 )
* feat(routes): add POST /api/coach/decks/{deck_id}/quick endpoint (issue #108 )
* feat(coach): Phase 3/5 parsing + run_quick_digest() (issue #108 )
* feat(coach): Phase 3/5 parsing + run_quick_digest() (issue #108 )
- Import RemovalCoverage, RampQuality, DrawEngineProfile, WinCondition,
AntiSynergyFlag, PodPresence, TempoAssessment, MetaMatchup
- Add Phase 3/5 blocks to _populate_session_from_json()
- Add run_quick_digest() method
* feat(ui): Top Priority card + Quick/Deep buttons in coach.html (issue #108 )
* feat(coach): Phase 3/5 parsing + run_quick_digest() (issue #108 )
* feat(ui): wire Quick Digest button + displayTopPriority() (issue #108 )
2026-03-27 07:51:01 -04:00
KoalaTrapLord
8df5900ff9
feat(rag): Phase 1 — Scryfall bulk offline card database (SQLite FTS5) ( #117 )
...
* feat(rag): add scryfall_bulk.py — offline SQLite FTS5 card database (RAG Phase 1)
* feat(rag): wire ensure_bulk_db() into startup and add /api/rag/status endpoint (RAG Phase 1)
* fix: migrate on_event to lifespan handler, fix /api/rag/status route ordering
2026-03-27 07:16:55 -04:00
KoalaTrapLord
864cefb8d1
feat(coach): Phase 5 - add PodPresence, TempoAssessment, MetaMatchup models + isQuickDigest flag ( #108 )
2026-03-27 04:22:23 -04:00
KoalaTrapLord
6c03e56794
fix( #116 ): dual card_records fallback JOIN, card_type/card_category fields, simulator land detection
...
- deck_service._compute_deck_analysis: add LEFT JOIN card_records with COALESCE on all fields
- deck_service: add _classify_card_category() with oracle-text keyword matching
- deckbuilder.GET /api/decks/{id}/cards: add card_records fallback JOIN + COALESCE, emit card_type/card_category per card
- deepseek._fetch_deck_card_data: add card_records fallback JOIN so lands get correct type_line before enrich_card()
Closes #116
2026-03-27 04:10:17 -04:00
KoalaTrapLord
4b92a5f364
Update models.pyfeat(coach): Phase 3 - add RemovalCoverage, RampQuality, DrawEngineProfile, WinCondition, AntiSynergyFlag models ( #108 )
2026-03-27 04:01:25 -04:00
KoalaTrapLord
da0193eb11
Update coach_service.pyfeat(coach): Phase 2 - parse upgradePriority, commanderDependency, mulliganAnalysis in coach_service ( #108 )feat(coach): Phase 2 - parse new fields in coach_service ( #108 )
2026-03-27 03:45:32 -04:00
KoalaTrapLord
71e0db4985
feat(coach): Phase 2 - add upgradePriority, commanderDependency, mulliganAnalysis to prompt schema ( #108 )
2026-03-27 03:32:03 -04:00
KoalaTrapLord
825946ae75
fix(deckgen): Phase 1 - non-destructive smart substitution + 99-card guarantee ( #111 )
...
- Add SubstitutionMethod enum to track how each card was resolved
- smart_substitute() now always returns a valid card string (never None/drops)
fallback chain: exact -> fuzzy -> functional analog -> original kept -> basic land
- apply_substitutions() loop no longer silently drops cards on failure
- _pad_to_99() circuit breaker added before BuildResult validation
- Pre-validation count logging per category for fast regression diagnosis
- Startup assertion: sum(SLOT_BUDGET) == 99 raises on app boot if misconfigured
- Prompt injection: slot budget + exact card count requirement sent to LLM
- run_substitution() anthropic fallback failure now pads with basic land instead of leaving slot missing
- SubstitutionBatchResult gains padded_slots field (> 0 = circuit breaker fired)
2026-03-27 03:27:52 -04:00
KoalaTrapLord
bd4df0c263
Update models.pyfeat(coach): Phase 2 - add UpgradePriority, CommanderDependency, MulliganAnalysis models ( #108 )
2026-03-27 02:52:01 -04:00
KoalaTrapLord
113b5c63f0
docs: rewrite README to reflect full current feature set ( #115 )
2026-03-27 02:51:12 -04:00
KoalaTrapLord
3f6d71ecbc
fix(coach): switch all Anthropic calls to streaming to prevent 10-min timeout error ( closes #109 )
...
- anthropic_client.py: all 4 methods (chat_structured, chat_plain, achat_structured, achat_plain) now use .messages.stream() context manager
- coach_service.py: inline aclient.messages.create() replaced with async streaming via aclient.messages.stream()
- _parse_response() updated to accept pre-extracted text string (since stream gives us text directly)
- check_status() left as non-streaming (max_tokens=10, safe from the 10min rule)
2026-03-27 02:36:22 -04:00
KoalaTrapLord
4246555228
feat: auto-run update_weights.py after overnight sims ( #114 )
...
Completes the sim → weights → deck builder feedback loop.
- Add run_update_weights() to overnight-run.py
- Add auto_update_weights config key (default True)
- Add --no-update-weights, --weights-min-games, --weights-lr CLI flags
- Runs before neural net training so both pipelines get fresh data
2026-03-27 02:35:08 -04:00
KoalaTrapLord
8dd9623417
feat: inject simulation-learned weights into deck builder LLM prompts ( #113 )
...
Closes #112
- Add sim_insights.py to translate learned_weights.json into LLM prompt text
- Add sim_context param to suggest_cards() and enforce_deck_ratios() in ollama_client.py
- Wire get_sim_insights() into build_deck pipeline (Steps 4 & 6)
- Fully backwards compatible — no-op until real sim data exists
2026-03-27 02:27:42 -04:00
KoalaTrapLord
817b71f69d
feat(ui): add tip-icon tooltips to distillation, simulator, coach, deckgenerator pages
...
- distillation.html: tooltips on all 10 params + ELO Ratings header
- simulator.html: tooltips on Opponent, Games, Record logs, API Endpoint, Model, Temp, Timeout
- coach.html: tooltips on Power Level, Meta Focus, Budget, Focus Areas, Similar Cards Results
- deckgenerator.html: tooltips on Target Bracket, Use my collection, Smart Substitution, AI Model
- All pages now share tooltip styles from global.css (no per-page duplication needed)
2026-03-27 02:06:58 -04:00
KoalaTrapLord
e71cac9dd1
feat(ui): add tooltips to all pages — distillation, simulator, coach, deckgenerator
...
- Move .tip-icon tooltip CSS from training.css into global.css so all pages share it
- distillation.html: 8 param tooltips (Max Generations, Convergence Window, Supervised Epochs, Supervised LR, PPO Iterations, PPO Episodes/Iter, PPO LR, Min Win Rate Gate, Opponent, Playstyle) + ELO Ratings header
- simulator.html: tooltips on Opponent, Games, Record turn logs, API Endpoint, Model, Temp, Timeout
- coach.html: tooltips on Target Power Level, Meta Focus, Budget, Focus Areas, Find Similar Cards Results
- deckgenerator.html: tooltips on Target Bracket, Use my collection, Smart Substitution, AI Model
2026-03-27 01:57:37 -04:00
KoalaTrapLord
cb38081a8b
fix: add top_n cutoff to ELO tournament (default top 10 generations)
2026-03-27 01:48:10 -04:00
KoalaTrapLord
cd9d2eebd8
feat(coach): Phase 1 - pass richer card stats to Claude prompt ( #108 )
...
- _format_underperformers: add synergyScore, clunkinessScore, avgTurnCast, keptInOpeningHandRate
- _format_top_cards: add synergyScore and avgTurnCast
- _format_matchups: append perArchetypeWinRates block from DeckMeta
- USER_PROMPT_TEMPLATE: add ### Archetype Win Rates section placeholder
2026-03-27 01:32:51 -04:00
KoalaTrapLord
e6f18d4a61
feat(training): add intro banner and parameter tooltips to ML Training page
2026-03-27 00:18:21 -04:00
KoalaTrapLord
4e90337f54
feat: extend card hover preview to all card names in coach UI
2026-03-26 23:48:27 -04:00
KoalaTrapLord
a01a70f725
Use DEFAULT_MAX_TOKENS config for Anthropic max_tokens
2026-03-26 22:50:10 -04:00
KoalaTrapLord
4da58681a4
Enhance coach prompt for more detailed reports
2026-03-26 22:41:23 -04:00
KoalaTrapLord
224b4b5d5b
feat: increase coach detail limits (MAX_UNDERPERFORMERS=8, MAX_TOKENS=16384)
2026-03-26 22:33:18 -04:00
KoalaTrapLord
1a34f00574
Update .env.examplefix: correct model ID in .env.example (claude-opus-4-0 -> claude-opus-4)
2026-03-26 15:50:53 -04:00
KoalaTrapLord
8ec7db1612
fix: correct malformed string literals in config.py model defaults
2026-03-26 15:42:34 -04:00
KoalaTrapLord
e0a75e2d04
fix: correct Anthropic model ID from claude-opus-4-0 to claude-opus-4
2026-03-26 15:36:23 -04:00
KoalaTrapLord
15bd6f42bb
fix: resolve all ruff linting errors across coach module
2026-03-26 15:30:27 -04:00
KoalaTrapLord
0aa57ab7d2
fix: remove duplicate resp token on line 284 in run_coaching_session ( #105 )
2026-03-26 14:23:52 -04:00
KoalaTrapLord
9f5eb4a99f
fix: add missing resp= assignment on line 284 ( #105 )
2026-03-26 14:11:35 -04:00
KoalaTrapLord
a9f18f53da
fix: correct indentation of try/except/else block in run_coaching_session ( #105 )
2026-03-26 14:06:27 -04:00
KoalaTrapLord
c9e932ef43
fix: correct try: block indentation in run_coaching_session ( #105 )
2026-03-26 13:44:33 -04:00
KoalaTrapLord
cb99388e3c
fix: correct indentation of total_steps in collect_rollouts
2026-03-26 13:14:34 -04:00
KoalaTrapLord
2e316548e7
fix: repair resp= assignment and _re.sub typo in coach_service.py ( #105 )
2026-03-26 13:11:55 -04:00
KoalaTrapLord
b46e1e0877
fix: remove stray string literal in init_coach_service ( #105 )
2026-03-26 12:31:52 -04:00
KoalaTrapLord
e17b877dcc
fix: repair syntax errors in coach_status and init_coach_service ( #105 )
2026-03-26 12:18:07 -04:00
KoalaTrapLord
6ce21908d3
Update coach.py
2026-03-26 11:53:39 -04:00
KoalaTrapLord
15495483f3
fix: remove _coach_init_error reference from status endpoint ( #105 )
2026-03-26 11:36:33 -04:00
KoalaTrapLord
540fbbf1b3
fix: remove broken _coach_init_error lines from coach.py ( #105 )
2026-03-26 10:52:41 -04:00
KoalaTrapLord
a5cc7736b4
feat: update thread dropdown to 1,2,4,8,16,24,32
2026-03-25 23:15:38 -04:00
KoalaTrapLord
8c6248cf84
feat: increase max threads from 16 to 32
2026-03-25 21:37:21 -04:00
KoalaTrapLord
22d63fd15e
Update coach.py
2026-03-25 21:29:24 -04:00
KoalaTrapLord
2dc0ba2d25
Update coach.py
2026-03-25 21:18:27 -04:00
KoalaTrapLord
8f180820f9
fix: add missing _DEFAULT_ORIGINS definition in lab_api.py ( #105 )
2026-03-25 21:00:34 -04:00
KoalaTrapLord
b283418879
fix: correct indentation in _call_anthropic_api else-block ( #105 )
2026-03-25 20:43:11 -04:00
KoalaTrapLord
61be42ea6d
fix: resolve IndentationError on line 882 in routes/deckgen.py ( #105 )
2026-03-25 20:18:19 -04:00
KoalaTrapLord
3906b93c6a
feat: add WebSocket support for Unity game state streaming ( #107 )
...
* feat: add ws/ package for WebSocket game state streaming
* feat: add WebSocket ConnectionManager with per-game broadcasting
* feat: add GameStateTracker with deep-diff delta engine
* feat: add WebSocket route with delta push and REST bridge endpoints
* feat: register ws_game_router in lab_api.py
2026-03-25 19:51:15 -04:00
KoalaTrapLord
af2a71d1a5
fix: eliminate event-loop-blocking sync calls in async FastAPI routes ( #106 )
...
* feat: add async DB wrapper and eliminate event-loop blocking
* fix: rewrite llm_client.py with native async httpx - removes urlopen and run_in_executor
* fix: rewrite routes/coach.py - replace all sync DB/HTTP with async (aiosqlite + httpx)
* fix: add async DB shutdown hook to lab_api.py
* feat: add aiosqlite>=0.19.0 to requirements
2026-03-25 19:17:41 -04:00
KoalaTrapLord
cf7c872e12
feat: update test mock from pplx_client to anthropic_client ( #105 )
2026-03-25 16:43:11 -04:00
KoalaTrapLord
c9227dac70
Update substitution_prompt.pyfeat: update substitution_prompt.py docstring from Perplexity to Claude Opus ( #105 )
2026-03-25 16:41:47 -04:00
KoalaTrapLord
34b1ea2e30
feat: update deck_gen_user.py docstring from Perplexity to Claude Opus ( #105 )
2026-03-25 16:41:24 -04:00
KoalaTrapLord
1c6454dce5
feat: update substitution_schema.py source field from perplexity to anthropic ( #105 )
2026-03-25 16:39:16 -04:00
KoalaTrapLord
464dd732d5
feat: update deck_schema.py docstring from Perplexity to Claude Opus ( #105 )
2026-03-25 16:36:22 -04:00
KoalaTrapLord
f481243c4e
feat: replace Perplexity AI with Claude Opus in deckgenerator.html ( #105 )
2026-03-25 16:33:00 -04:00
KoalaTrapLord
f49b6cbea5
feat: replace Perplexity AI spinner text with Claude Opus in deckbuilder.html ( #105 )
2026-03-25 16:30:00 -04:00
KoalaTrapLord
71f316a220
feat: update status label from Perplexity to Claude Opus in coach.html ( #105 )
2026-03-25 16:26:31 -04:00
KoalaTrapLord
9556f9d7d0
feat: replace Perplexity with Anthropic Claude in lab_api.py ( #105 )
2026-03-25 15:18:14 -04:00
KoalaTrapLord
9de0965c78
feat: replace Perplexity with Anthropic Claude in routes/deckgen.py ( #105 )
2026-03-25 15:09:46 -04:00
KoalaTrapLord
38bfa51d85
feat: replace Perplexity with Anthropic Claude in routes/coach.py ( #105 )
2026-03-25 14:41:34 -04:00
KoalaTrapLord
c58f561df4
feat: replace PerplexityClient with AnthropicClient in deck_generator.py ( #105 )
2026-03-25 14:34:18 -04:00
KoalaTrapLord
6cf1e58018
feat: replace Perplexity with Anthropic Claude in coach_service.py ( #105 )
2026-03-25 14:30:40 -04:00
KoalaTrapLord
1382d25e46
feat: update clients __init__.py comment to reference Anthropic ( #105 )
2026-03-25 12:25:56 -04:00
KoalaTrapLord
d8f7105471
feat: replace PPLX_API_KEY with ANTHROPIC_API_KEY in install script ( #105 )
2026-03-25 12:25:01 -04:00
KoalaTrapLord
071088715f
feat: replace PPLX_API_KEY with ANTHROPIC_API_KEY in start-lab.bat ( #105 )
2026-03-25 12:23:43 -04:00
KoalaTrapLord
95429d9f35
feat: replace PPLX_API_KEY with ANTHROPIC_API_KEY in .env.example ( #105 )
2026-03-25 12:21:40 -04:00
KoalaTrapLord
55379a98ef
feat: replace Perplexity config with Anthropic Claude settings ( #105 )
2026-03-25 12:20:33 -04:00
KoalaTrapLord
173dee6ccc
feat: add anthropic>=0.40.0 and openai>=1.0.0 to requirements ( #105 )
2026-03-25 12:17:52 -04:00
KoalaTrapLord
34dee24399
feat: add AnthropicClient as drop-in replacement for PerplexityClient ( closes #105 phase 1)
2026-03-25 12:16:14 -04:00
KoalaTrapLord
88f1022d0e
fix: deduplicate card names globally before Scryfall batch lookup
...
enforce_deck_ratios can return the same card name under multiple
categories (e.g. Teferi's Protection in both protection + synergy).
all_card_names had no cross-category dedup, so get_cards_by_names
returned duplicate CardEntry objects that then failed the singleton
validator in CommanderDeck.
Fix: build all_card_names with dict.fromkeys() across all categories
so each name appears exactly once. Also deduplicate after Scryfall
lookup by name as a second safety net.
2026-03-25 11:23:06 -04:00
KoalaTrapLord
737863c55d
fix: .env.example default COACH_PROVIDER to perplexity
2026-03-25 10:43:42 -04:00
KoalaTrapLord
e710287c35
fix: run_coaching_session respects COACH_PROVIDER for Perplexity API
...
The coaching pipeline in coach_service.py was always calling self.llm (Ollama) regardless of COACH_PROVIDER setting. Now branches on COACH_PROVIDER == 'perplexity' to call the Perplexity API directly via httpx, matching the pattern used in routes/coach.py coach_chat endpoint.
2026-03-25 10:42:49 -04:00
KoalaTrapLord
2e3c1ec0f1
fix: startup logs and DeckBuilderAdapter respect COACH_PROVIDER/DECK_GEN_PROVIDER instead of hardcoding Ollama
2026-03-25 10:34:04 -04:00
KoalaTrapLord
21f032d32e
fix: set DECK_GEN_PROVIDER default to perplexity and DECK_GEN_MODEL to sonar-pro
2026-03-25 10:29:54 -04:00
KoalaTrapLord
2881309d41
fix: set COACH_PROVIDER default to perplexity, remove stale DeepSeek comment
2026-03-25 10:13:58 -04:00
KoalaTrapLord
e162d50608
feat: bulk quantity edit for collection table
2026-03-25 10:12:03 -04:00
KoalaTrapLord
49bab7fb0a
fix: set FORGE_DIR to repo root so cardsfolder path resolves correctly
2026-03-25 10:09:10 -04:00
KoalaTrapLord
34e88a3a14
fix: correct indentation of commander_keywords and oracle overlap scoring in deckgen.py
2026-03-25 08:45:51 -04:00
KoalaTrapLord
f199bcfa34
feat: column visibility toggle UI for collection table
2026-03-25 08:31:12 -04:00
KoalaTrapLord
77c92d569d
fix: correct indentation of elif/else branches in _run_sim_thread_deepseek
2026-03-25 08:24:21 -04:00
KoalaTrapLord
f24bd05be8
feat: collection stats dashboard (CMC curve, color/type/rarity/value)
2026-03-25 07:51:09 -04:00
KoalaTrapLord
e7ffccf3e8
feat: persist coach sessions to SQLite with disk fallback
2026-03-24 23:44:20 -04:00
KoalaTrapLord
64a65ca2f6
feat: auto-fill deck name with Auto - {CommanderName} on select
2026-03-24 23:19:17 -04:00
KoalaTrapLord
3ba44f68d9
feat: oracle-text keyword overlap scoring in _generate_deck
2026-03-24 22:56:30 -04:00
KoalaTrapLord
f851df6dbf
fix: add getBaseUrl(), PolicyDecision record, and decide(String,int) to PolicyClient
...
GameSession.java references these APIs which were missing from
PolicyClient, causing 3 compilation errors. Added:
- getBaseUrl() getter
- PolicyDecision record (action, confidence)
- decide(String, int) overload that delegates to decide(JsonObject)
2026-03-24 22:46:45 -04:00
KoalaTrapLord
ded79bfde1
feat: add omit_cards chips styles to deck generator CSS
2026-03-24 22:20:10 -04:00
KoalaTrapLord
411e40e46e
feat: add omit_cards chips panel to deck generator HTML
2026-03-24 22:17:25 -04:00
KoalaTrapLord
a4e49daf49
feat: add omit_cards chips/tags input to deck generator JS
2026-03-24 22:11:36 -04:00
KoalaTrapLord
675c64029b
feat: add progress bar + ETA to deck generation UI
2026-03-24 21:20:47 -04:00
KoalaTrapLord
4c47b9d5e2
fix: add V3 result cache to avoid re-generating deck on export
2026-03-24 21:07:59 -04:00
KoalaTrapLord
8903432d67
fix: add missing export filter params (rarity, setCode, power, toughness, keyword, edhrec, qty)
2026-03-24 21:01:35 -04:00
KoalaTrapLord
b1e473397f
fix: shopping list field name + scan-add refresh function name
2026-03-24 20:53:19 -04:00
KoalaTrapLord
07b2c9d5a9
fix: add missing LLM_TIMEOUT constant in coach.py
...
LLM_TIMEOUT was referenced but never defined, causing a NameError
in the Ollama streaming SSE code path when COACH_PROVIDER != 'perplexity'.
2026-03-24 20:43:36 -04:00
KoalaTrapLord
58bbb514ad
fix: skip ML decision flush when brain not connected (heuristic fallback guard)
2026-03-24 20:27:02 -04:00
KoalaTrapLord
d70d74d753
feat: add Scryfall on-the-fly embedding fallback for unknown cards
2026-03-24 20:09:27 -04:00
KoalaTrapLord
475849e477
fix: prevent double-flush of ML decisions in deepseek sim thread
...
_run_sim_thread_deepseek was manually calling engine.flush_ml_decisions()
and writing the .jsonl, then passing engine=engine to _finish_sim which
called flush_ml_decisions() a second time — returning an empty list and
producing empty training data files.
Fix: pass engine=None to _finish_sim when the deepseek thread has already
flushed manually, so _finish_sim skips the second flush entirely.
2026-03-24 19:19:45 -04:00
KoalaTrapLord
b2d1078ca9
fix: disable quiet mode when ML logging is enabled in createWorker
...
DecisionExtractor requires verbose Forge output to reconstruct board
states. When quiet=true, Forge runs with -q which strips the verbose
log lines, causing 0 decisions to be extracted. This change passes
quiet=false to BatchRunner when mlLogEnabled is true.
2026-03-24 18:45:36 -04:00
KoalaTrapLord
9bce919690
fix: replace non-existent ForgeEpisodeGenerator import with actual exports
2026-03-24 13:45:48 -04:00
KoalaTrapLord
41b711c17e
fix: normalize deck report slug matching (spaces/hyphens/underscores)
2026-03-24 13:31:52 -04:00
KoalaTrapLord
a6940ca61a
fix: update get_status() to check Perplexity connection when COACH_PROVIDER=perplexity
2026-03-24 13:29:16 -04:00
KoalaTrapLord
a65daaf801
fix: update Deck Coach status label from LM Studio to Perplexity
2026-03-24 13:26:41 -04:00
KoalaTrapLord
c475f5998b
docs: add COACH_PROVIDER to .env.example
2026-03-24 12:54:30 -04:00
KoalaTrapLord
456ef927f9
feat: add Perplexity deep research support to coach chat endpoint
2026-03-24 12:53:42 -04:00