Sprint 0+1: Package restructure, source tiers, verdicts, multi-variant editions

- New oracle/ package (11 modules) with unified CLI (python -m oracle)
- Source tiers: Tier 1 (arxiv/github/hf), Tier 2 (rss/hn), Tier 3 (reddit)
- Composite verdicts: PUBLISH/WATCH/ARCHIVE/DROP based on signal score + age
- Content-hash dedup: SHA-256[:16] normalized, atomic at insert time
- Multi-variant editions: 4 YAML configs (default/research/devops/brief)
- Variant engine: filter → rank → render (HTML + JSON, themed)
- Per-adapter timeout (10s) + threading fallback
- Consolidated 12 root scripts → thin wrappers + oracle/ package
- Archived stale scripts (_engagement, _live_compare, reddit_proof)
- Updated .gitignore, README.md, schema.sql
This commit is contained in:
Epictetus
2026-07-22 13:32:15 +00:00
parent 9f72ff4d6a
commit 07c5f9a5c2
38 changed files with 3195 additions and 3234 deletions
+8 -78
View File
@@ -1,81 +1,11 @@
#!/usr/bin/env python3
"""
Write batch summaries back to oracle.db.
"""Thin wrapper — delegates to oracle.cli summarize subcommand."""
import sys, os
sys.path.insert(0, os.path.dirname(__file__))
Reads /tmp/athena_summarize_batch.json (array of entry dicts with 'summary' key added by sub-agent),
writes each summary JSON to entries.summary column.
args = sys.argv[1:]
cli_args = ["summarize"] + args
Usage:
python3 write_summaries.py /tmp/athena_summarize_batch_result.json
"""
import json
import sqlite3
import sys
def main():
if len(sys.argv) < 2:
print("Usage: python3 write_summaries.py <result_json_file>", file=sys.stderr)
sys.exit(1)
result_path = sys.argv[1]
try:
with open(result_path) as f:
results = json.load(f)
except (FileNotFoundError, json.JSONDecodeError) as e:
print(f"Error reading {result_path}: {e}", file=sys.stderr)
sys.exit(1)
db_path = '/home/vpsadmin/oracle/oracle.db'
conn = sqlite3.connect(db_path)
cur = conn.cursor()
written = 0
skipped = 0
errors = 0
for item in results:
eid = item.get('id')
summary = item.get('summary')
if not eid or not summary:
skipped += 1
continue
# Validate summary has expected keys
if not all(k in summary for k in ('one_liner', 'key_technical_point', 'potential_use_case', 'confidence')):
print(f" ⚠ ID {eid}: missing required keys, skipping", file=sys.stderr)
skipped += 1
continue
# Quality gate: reject low-confidence or generic summaries
ol = summary.get('one_liner', '')
if len(ol) < 20:
print(f" ⚠ ID {eid}: one_liner too short ({len(ol)} chars), skipping", file=sys.stderr)
skipped += 1
continue
if any(generic in ol.lower() for generic in ('this article discusses', 'this paper presents', 'see full')):
print(f" ⚠ ID {eid}: generic one_liner, skipping", file=sys.stderr)
skipped += 1
continue
try:
cur.execute("UPDATE entries SET summary = ? WHERE id = ?",
(json.dumps(summary), eid))
written += 1
print(f" ✓ ID {eid}: {ol[:70]}...")
except Exception as e:
print(f" ✗ ID {eid}: {e}", file=sys.stderr)
errors += 1
conn.commit()
# Verify
cur.execute("SELECT COUNT(*) FROM entries WHERE summary IS NOT NULL")
total = cur.fetchone()[0]
conn.close()
print(f"\nResults: {written} written, {skipped} skipped, {errors} errors")
print(f"Total entries with summary: {total}")
return 0 if errors == 0 else 1
if __name__ == "__main__":
sys.exit(main())
from oracle.cli import main as cli_main
sys.argv = ["oracle"] + cli_args
cli_main()