Initial commit: Ten31 Signal Engine (ingest, scoring brain, corpus seeds)

This commit is contained in:
Keysat
2026-06-15 09:24:29 -05:00
commit a6aec77506
77 changed files with 6263 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
"""Autonomous sharpening pass: wait for the cross-cluster podcast claims to extract, re-embed, then
re-run the §7.1 backtest. Run in the background; writes logs/backtest2.log for review."""
import sqlite3
import subprocess
import sys
import time
DB = "data/signal.db"
PY = ".venv/bin/python"
def pending_podcast_extract() -> int:
return sqlite3.connect(DB).execute(
"SELECT COUNT(*) FROM backfill_jobs WHERE job_type='extract' AND state='pending' "
"AND target_id LIKE 'pod:%'"
).fetchone()[0]
for i in range(60): # up to ~2h
p = pending_podcast_extract()
print(f"[sharpen] iter {i}: podcast extract pending={p}", flush=True)
if p <= 2:
break
time.sleep(120)
print("[sharpen] embedding accumulated claims...", flush=True)
subprocess.run([PY, "-m", "signal_engine", "embed-claims"], stdout=sys.stdout, stderr=subprocess.STDOUT)
print("[sharpen] re-running backtest...", flush=True)
with open("logs/backtest2.log", "w") as f:
subprocess.run([PY, "-m", "signal_engine", "backtest", "--conviction", "K2023",
"--start", "2023-03-01", "--end", "2024-09-01", "--step-days", "90",
"--window-days", "90"], stdout=f, stderr=subprocess.STDOUT)
print("[sharpen] DONE — see logs/backtest2.log", flush=True)