I did something similiar on OpenClaw running on a Mac Mini. The script uses Applescript to check Apple Mail for new emails and summarize them, and also add the summary to Sqlite. Not quite smart yet to uncover and track large mail threads, with context.