Sprint 2: Hermes masterclass integration — brief + weekly review modules

- oracle/brief.py: Morning intelligence briefing (CyrilXBT format)
  THE ONE THING, WHAT HAPPENED, WHAT TO WATCH, FROM MEMORY, TODAY'S FOCUS
  Source cooldown (72h dedup), theme clustering, signal ranking

- oracle/weekly.py: Weekly review synthesis
  Signal summary, trending themes (WoW comparison), tier breakdown,
  auto-generated recommendations based on patterns

- oracle/cli.py: Wired brief/weekly commands
  python -m oracle brief [--max-items 8] [--max-age-h 48] [-o path] [--json]
  python -m oracle weekly [--days 7] [-o path] [--json]

Integrates patterns from Hermes Agent Masterclass:
  - Morning brief template structure
  - Content source cooldown (no repeats within 72h)
  - Weekly pattern synthesis with trend detection
  - Quality gate recommendations (score thresholds, diversity alerts)
  - Theme clustering for FROM MEMORY section
This commit is contained in:
Epictetus
2026-07-22 13:50:03 +00:00
parent 07c5f9a5c2
commit 3ec955e143
3 changed files with 650 additions and 0 deletions
+57
View File
@@ -361,6 +361,46 @@ def cmd_dedup(args):
print()
def cmd_brief(args):
"""Generate morning intelligence briefing."""
from oracle.brief import generate_brief, generate_brief_json, get_connection
db = args.db or str(DB_PATH)
conn = get_connection(db)
try:
brief = generate_brief_json(conn, max_items=args.max_items, max_age_h=args.max_age_h)
if args.json:
import json as _json
print(_json.dumps(brief, indent=2, default=str))
elif args.output:
generate_brief(conn, max_items=args.max_items, max_age_h=args.max_age_h, output_path=args.output)
print(f"Saved: {args.output}")
else:
print(brief.get("markdown", brief.get("error", "No brief generated")))
finally:
conn.close()
def cmd_weekly(args):
"""Generate weekly review."""
from oracle.weekly import generate_weekly, get_connection
db = args.db or str(DB_PATH)
conn = get_connection(db)
try:
review = generate_weekly(conn, days=args.days)
if args.json:
import json as _json
print(_json.dumps({k: v for k, v in review.items() if k != "markdown"}, indent=2, default=str))
elif args.output:
generate_weekly(conn, days=args.days, output_path=args.output)
print(f"Saved: {args.output}")
else:
print(review.get("markdown", "No review generated"))
finally:
conn.close()
def cmd_health(args):
"""System health check."""
print("=== System Health Check ===\n")
@@ -471,6 +511,21 @@ def main():
p_dedup.add_argument("--show-tiers", action="store_true", help="Show source tier config")
p_dedup.add_argument("--show-verdicts", action="store_true", help="Show verdict thresholds")
# brief
p_brief = sub.add_parser("brief", help="Generate morning intelligence briefing")
p_brief.add_argument("--db", default=None, help="Database path")
p_brief.add_argument("--max-items", type=int, default=8, help="Max items in brief")
p_brief.add_argument("--max-age-h", type=float, default=48, help="Max age in hours")
p_brief.add_argument("--output", "-o", help="Output path for markdown brief")
p_brief.add_argument("--json", action="store_true", help="Output as JSON")
# weekly
p_weekly = sub.add_parser("weekly", help="Generate weekly review")
p_weekly.add_argument("--db", default=None, help="Database path")
p_weekly.add_argument("--days", type=int, default=7, help="Days to review")
p_weekly.add_argument("--output", "-o", help="Output path for markdown review")
p_weekly.add_argument("--json", action="store_true", help="Output as JSON")
# health
sub.add_parser("health", help="System health check")
@@ -484,6 +539,8 @@ def main():
"archive": cmd_archive,
"themes": cmd_themes,
"dedup": cmd_dedup,
"brief": cmd_brief,
"weekly": cmd_weekly,
"health": cmd_health,
}