feat: market regime, self-learning journal, AI investment committee

- regime.py: computed SPY/VIX/sector-momentum snapshot injected into every kickoff
- journal.py: each agent sees its own past picks marked-to-market (learns from wins/losses)
- committee.py: Chief-Risk-Officer LLM pass over the whole book — approve/reduce/veto
  per pick with reasons; memo lands in reports; executor enforces verdicts at open

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016DvdRZkyCy9NJpHYDdPqmS
This commit is contained in:
Aryan SinghandClaude Opus 4.8 committed 2026-07-02 12:27:05 -05:00
1 parent 6b1c461a80
commit 4beee3dc82
6 files changed
+323 -2

No files matched your search

+19 -1
View File
@@ -30,8 +30,11 @@ from orchestration.budget import ( # noqa: E402
next_deadline,
next_market_trade_date,
)
from orchestration import committee as committee_mod # noqa: E402
from orchestration.checkpoint import Checkpointer # noqa: E402
from orchestration.regime import market_regime # noqa: E402
from reporting import report_writer # noqa: E402
from reporting.journal import lessons_for # noqa: E402
def main(compressed: bool = False) -> int:
@@ -73,7 +76,13 @@ def main(compressed: bool = False) -> int:
min_steps = 4 if compressed else s.per_agent_min_steps
min_seconds = 60 if compressed else s.per_agent_min_minutes * 60
# shared ground truth for all agents tonight (computed, deterministic)
regime = market_regime()
if regime:
logger.info("regime: {}", regime[:140])
outputs = []
records: dict[str, str] = {}
for i, persona in enumerate(PERSONAS):
now = time.time()
if now >= hard_stop:
@@ -85,9 +94,12 @@ def main(compressed: bool = False) -> int:
if not server.server_up(): # recover if a prior agent left oMLX unresponsive
logger.warning("oMLX unreachable before {}; recovering...", persona.id)
server.ensure_ready(warm=False)
lessons = lessons_for(persona.id) # self-learning: past picks marked to market
records[persona.id] = lessons
blurb = "\n\n".join(x for x in (regime, lessons) if x)
out = run_agent(persona, deadline_ts=deadline, step_budget=step_budget,
min_steps=min_steps, min_seconds=min_seconds,
checkpointer=cp, model_name=model_name)
context_blurb=blurb, checkpointer=cp, model_name=model_name)
cp.write(out)
outputs.append(out)
manifest.agents.append(persona.id)
@@ -96,6 +108,12 @@ def main(compressed: bool = False) -> int:
except Exception as e:
logger.warning("agent report failed for {}: {}", persona.id, e)
# Investment Committee: risk-officer pass over the whole book (verdicts enforce at open)
try:
committee_mod.run_committee(outputs, trade_date, regime, records)
except Exception as e:
logger.warning("committee failed (fail-open): {}", e)
# combined daily report (execution results appended in the morning by run_market_open)
try:
daily = report_writer.write_daily_report(trade_date, outputs)