feat: Phase 1 — delta temporel + decay news + cycle_meta dans prompts IA

- database.py: get_last_completed_cycle_ts() pour mesurer le delta entre cycles
- auto_cycle.py: calcul delta_minutes + cycle_meta dict transmis aux fonctions IA
- ai_analyzer.py: apply_news_decay() (halflife par catégorie), partition_news_by_age()
  (3 buckets: inter_cycle / recent_24h / older), _build_temporal_news_block() pour
  le prompt suggestion; cycle_meta injecté aussi dans score_patterns_with_context()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OpenSquared
2026-06-20 16:36:54 +02:00
parent fff0c15316
commit d5e31bc897
3 changed files with 211 additions and 5 deletions

View File

@@ -1212,6 +1212,16 @@ def reset_journal_history():
conn.close()
def get_last_completed_cycle_ts() -> Optional[str]:
"""Return ISO timestamp of the last successfully completed cycle, or None."""
conn = get_conn()
row = conn.execute(
"SELECT completed_at FROM cycle_runs WHERE status='completed' ORDER BY completed_at DESC LIMIT 1"
).fetchone()
conn.close()
return row["completed_at"] if row else None
def add_cycle_run(run_id: str, trigger: str = "auto") -> None:
conn = get_conn()
conn.execute(