Commit Graph

12 Commits

Author SHA1 Message Date
Youssef Aitousarrah 7ffbadca09 fix(hypotheses): prune concluded entries from active.json after each run
Concluded hypotheses already live in concluded/ — keeping them in active.json
causes the registry to grow unboundedly. Runner now removes them at the end
of each cycle. Also cleaned up the existing social_dd concluded entry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 13:47:21 -07:00
Youssef Aitousarrah 662fdb5753 feat(hypotheses): uncap statistical hypotheses from max_active limit
Statistical hypotheses now conclude immediately on the next runner cycle
without counting toward max_active. Only implementation hypotheses occupy
runner slots. Added conclude_statistical_hypothesis() for instant analysis
against existing performance data with Gemini LLM enrichment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 12:40:33 -07:00
Youssef Aitousarrah 615107cada feat(hypotheses): use gemini-3-flash-preview for LLM analysis
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 17:40:01 -07:00
Youssef Aitousarrah 43fb186d0e feat(hypotheses): switch LLM analysis from Anthropic to Gemini
Uses google-genai SDK with gemini-2.5-flash-lite — same model already
used by the discovery pipeline, so no new secret needed (GOOGLE_API_KEY).
Removed ANTHROPIC_API_KEY from hypothesis-runner.yml.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 17:37:12 -07:00
Youssef Aitousarrah e2c3ae14c1 fix(hypotheses): skip weekends to avoid counting non-trading days
days_elapsed counts entries in picks_log, so running on weekends would
inflate the counter with noise picks. Exit early on Saturday/Sunday.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 15:48:17 -07:00
Youssef Aitousarrah 91311ad69d feat(hypotheses): detect baseline drift when scanner changes on main mid-experiment
Before concluding a hypothesis, check if the scanner's source file
changed on main since created_at. If it did, the baseline picks in
performance_database.json reflect the updated code for the later part
of the experiment, which can confound the comparison.

When drift is detected, a warning is embedded in:
- the concluded .md doc (blockquote below Decision)
- the PR comment (blockquote in the conclusion body)

The programmatic decision is not overridden — the warning is purely
informational, allowing the reviewer to judge whether the result is
trustworthy.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 15:42:21 -07:00
Youssef Aitousarrah 9e1c800f01 fix(hypotheses): symlink .env into worktree for local dev
load_dotenv() in tradingagents/config.py searches the cwd for .env.
Worktrees in /tmp/ don't have one, so symlink the main repo's .env
into the worktree root before running discovery.

In CI, secrets are passed as env vars directly — symlink is a no-op.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 11:12:36 -07:00
Youssef Aitousarrah 26df957e37 feat(hypotheses): add LLM analysis to hypothesis conclusion
When ANTHROPIC_API_KEY is set, conclude_hypothesis now:
- Loads the scanner domain file for context
- Calls claude-haiku-4-5-20251001 for a 3–5 sentence interpretation
- Embeds the analysis in the concluded .md doc and PR comment

The LLM enriches the conclusion with sample-size caveats, market
context, and a follow-up hypothesis suggestion — without overriding
the programmatic accept/reject decision.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 10:57:52 -07:00
Youssef Aitousarrah 49175e3b0a feat(hypotheses): post conclusion as PR comment instead of auto-merging 2026-04-10 10:52:00 -07:00
Youssef Aitousarrah 9562bb7cc0 fix(hypotheses): id validation, worktree prune, safe loop, 14d enrichment cutoff
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 09:56:22 -07:00
Youssef Aitousarrah fe5b8886c0 fix(hypotheses): only count successful discovery days in picks_log 2026-04-10 09:50:37 -07:00
Youssef Aitousarrah 1b782b1cd6 feat(hypotheses): add daily hypothesis runner workflow 2026-04-10 09:49:10 -07:00