Commit Graph

5 Commits

Author SHA1 Message Date
dtarkent2-sys ac17d98974 fix: aggressive JSON fallback for LLMs that don't support structured output
- Use SystemMessage forcing JSON-only responses (no markdown)
- Provide concrete example JSON from schema fields
- Better JSON extraction: handles nested braces, code blocks, prose wrappers
- Fixes nemotron/minimax/other Ollama models returning prose instead of JSON

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 15:39:08 -04:00
dtarkent2-sys 1d3f5e9c86 fix: 10 reliability and observability fixes for trading pipeline
invoke_structured() catches ValidationError with safe defaults, ticker validation
(empty/length), 60s per-LLM-call timeout, event buffer capped at 5000, recursion
limit 50→25, tier 2 low-confidence DataFlags, tier 3 upstream confidence checks,
heartbeat JSON every 15s, data source attribution in all prompts, structured logging
replaces print()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 21:08:01 +00:00
dtarkent2-sys 5e8c81e738 fix: 6 audit issues — missing await, regime range, pct_out scaling, ticker validation, dead code, flag merge
1. app.py: await _update_in_progress (coroutine was silently dropped)
2. models.py + tier1.py: regime_score_adjustment range ±2→±10 (was negligible on 0-100 scale)
3. y_finance.py: pct_out * 100 (was fraction, displayed as percent)
4. app.py: ticker validation accepts dots/hyphens (BRK.B, BF-B)
5. portfolio.py: wire _fetch_peer_basics into theme substitution (was dead code)
6. setup.py: accumulate global_flags across parallel agents (dict.update was dropping them)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 21:56:38 +00:00
dtarkent2-sys ee80a42971 feat: add regime awareness, smart-money tracking, theme substitution & position replacement
- MacroRegimeOutput: risk_appetite, liquidity_regime, regime_score_adjustment (-2 to +2)
- InstitutionalFlowOutput: 13F holders, insider transactions, short interest trend, smart_money_signal
- Scoring node applies regime adjustment to master score
- Theme Substitution Engine: identifies best expression of theme, ranks peers, flags overlap
- Position Replacement Agent: compares candidate to theme alternatives, flags replacements
- Pipeline: Scoring → Portfolio Analysis → Debate → Decision
- Final decision narrative includes theme context and replacement flags

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 21:46:03 +00:00
dtarkent2-sys 7ad9e1d1ce feat: rebuild as structured Pydantic equity ranking engine
Replace generic LLM debate system with a tiered, macro-aware equity
ranking pipeline where every agent returns Pydantic structured output
and scoring is deterministic Python — no prose drives downstream decisions.

Architecture: Validation → Tier 1 (Macro+Liquidity parallel) →
Tier 2 (8 agents parallel) → Scoring (Archetype+MasterScore) →
Tier 3 (Bull/Bear debate + Risk + FinalDecision) → END

Master Score: 25% business_quality + 20% macro + 15% institutional_flow
+ 10% valuation + 10% entry_timing + 10% earnings_revisions + 5% backlog
+ 5% crowding. Hard veto gates, confidence penalties, position role
assignment all computed deterministically.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 21:30:46 +00:00