KoalaTrapLord
aefd0cace6
feat(rag): Phase 1 — rewrite build_card_text to natural-language format ( #137 )
...
* feat(rag): Phase 1 — rewrite build_card_text to natural-language format
* feat(rag): Phase 2 — Forge-enriched ChromaDB RAG store (2a–2e)
Phase 2a: Forge lazy import guard (_try_import_forge_lookup)
Phase 2b: _build_document appends Forge trigger/replacement/static/keyword tags
Phase 2c: _build_metadata adds has_trigger, has_replacement, has_static, trigger_modes fields
Phase 2d: query_cards extended with require_trigger, require_replacement, require_static params + ChromaDB where clause support
Phase 2e: get_rag_stats reports forge_enriched and forge_coverage; _write_build_meta tracks coverage; build loop counts enriched cards
* feat(rag): Phase 3 — add mtgrules second ChromaDB collection
Adds build_rules_index() and query_rules() operating on a separate
'mtgrules' ChromaDB collection. Chunks MagicCompRules.txt by rule-number
boundaries, embeds each chunk, and exposes semantic search. Completely
independent from the mtg_oracle card collection.
* feat(coach): Phase 4 — behavior-aware RAG + rules context in coach_service
Phase 4a: run_coaching_session uses dual RAG query
- Primary: commander synergy (n=10)
- Secondary: require_replacement=True for graveyard/protection cards (n=5)
- Deduplicates by name before merging
Phase 4b: query_rules() fetches 3 Commander rules chunks to ground the prompt
- Passed as rules_context kwarg to build_user_prompt()
* feat(rag): Phase 5 — add /api/rag/build-rules and /api/rag/query-rules endpoints
2026-03-29 02:11:38 -04:00
KoalaTrapLord
22cf23b24d
fix: correct query_cards kwarg names in coach_service (n= -> n_results=, colors= -> color_identity=)
2026-03-27 20:17:14 -04:00
KoalaTrapLord
d0cdafa66a
feat(rag): Phase 3 — inject RAG cards into coach prompts ( #132 )
...
* feat(rag): add RAG card injection to prompt_template.py
* feat(rag): wire RAG query into coach_service.py
* test(rag): add Phase 3 RAG injection tests
2026-03-27 15:20:49 -04:00
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
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
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
a01a70f725
Use DEFAULT_MAX_TOKENS config for Anthropic max_tokens
2026-03-26 22:50:10 -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
2e316548e7
fix: repair resp= assignment and _re.sub typo in coach_service.py ( #105 )
2026-03-26 13:11:55 -04:00
KoalaTrapLord
6cf1e58018
feat: replace Perplexity with Anthropic Claude in coach_service.py ( #105 )
2026-03-25 14:30:40 -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
e7ffccf3e8
feat: persist coach sessions to SQLite with disk fallback
2026-03-24 23:44:20 -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
cb4b48e362
refactor: rename LMStudioClient to LLMClient in coach_service.py
2026-03-21 13:33:00 -04:00
KoalaTrapLord
2beab5cc91
Coach: build DeckReport from DB when no simulation report exists
...
Previously the coach required running simulations first to generate a
deck-reports/*.json file. Now if no simulation report is found, the
endpoint builds a lightweight DeckReport on the fly from the deck_cards
table — pulling card names, types, CMC, and color identity directly from
the DB. The LLM can still analyze composition and give advice, just
without simulation-derived performance metrics (impactScore, etc.).
Also removes the '[no report]' tag from the dropdown since all decks
can now be coached.
2026-03-12 16:36:19 +00:00
KoalaTrapLord
a5fe8cb3fa
v23: React + TypeScript SPA migration
...
Complete frontend rewrite from vanilla HTML/CSS/JS to React 19 + TypeScript + Tailwind CSS v4.
Frontend (frontend/commander-ai-lab-ui/):
- Vite + React 19 + TypeScript + Tailwind CSS v4 + React Router
- 7 pages: BatchSim, Collection, Decks, AutoGen, Simulator, Coach, Training
- Reusable components: Spinner, StatusBadge, CardImage, ManaSymbols, EmptyState
- Full typed API client layer (8 modules matching all backend endpoints)
- Recharts for mana curves, win rate charts, progress bars
- Lucide icons throughout
- Custom dark theme with MTG mana color tokens
- Code splitting (recharts + react in separate chunks)
Backend (lab_api.py):
- SPA-aware static file serving with catch-all for client-side routing
- Fallback to legacy ui/ folder if React dist not built
- Updated startup log with SPA route list
Build system:
- .gitignore added (was missing - removes pyc, db, node_modules, etc.)
- build-full-installer-v2.py: v23 with Node.js check + React build step
- Vite build config with manual chunks for optimal loading
Also includes: V3 deck generator fixes, coach improvements, DeepSeek sim modules
2026-03-12 01:12:02 +00:00
KoalaTrapLord
e6b5e0cedb
Initial commit
2026-03-10 12:13:56 -04:00