Email monitor

From aAAaqwq/AGI-Super-Team · View interactive version

Email monitor is an AI agent skill from the GitHub repository aAAaqwq/AGI-Super-Team. AI inbox classification + Telegram notification

How to use this skill

Skill file

Email Monitor

Automatic pipeline: Gmail -> AI classification -> CRM activities -> PM tasks -> draft replies -> Telegram

When to use

Pipeline

email_monitor.py          → Gmail API, extracts full body
    ↓ JSON (stdout)
email_agent.py            → AI classification (claude CLI haiku)
    ↓ actionable emails JSON (stdin)
email_action_agent.py     → CRM + PM + drafts + git commit + Telegram

Paths

| What | Path |

|------|------|

| Monitor tool | $GOOGLE_TOOLS_PATH/email_monitor.py |

| Classify agent | $GOOGLE_TOOLS_PATH/email_agent.py |

| Action agent | $GOOGLE_TOOLS_PATH/email_action_agent.py |

| State | $GOOGLE_TOOLS_PATH/data/email_monitor_state.json |

| Summaries | $GOOGLE_TOOLS_PATH/data/email_summaries/ |

| Drafts | $GOOGLE_TOOLS_PATH/data/email_drafts/ |

| Agent log | $GOOGLE_TOOLS_PATH/data/email_agent_log.json |

| LaunchAgent | ~/Library/LaunchAgents/com.yourcompany.email-monitor.plist |

How to run

Full pipeline

# Everything automatic: check → classify → CRM → tasks → drafts → notify
$GOOGLE_TOOLS_PATH/.venv/bin/python3 $GOOGLE_TOOLS_PATH/email_agent.py

# Dry-run (classification without writing records or notifications)
$GOOGLE_TOOLS_PATH/.venv/bin/python3 $GOOGLE_TOOLS_PATH/email_agent.py --dry-run

# Without AI (rule-based classification)
$GOOGLE_TOOLS_PATH/.venv/bin/python3 $GOOGLE_TOOLS_PATH/email_agent.py --no-ai

Monitor only (without classification)

# JSON with full body of each email
$GOOGLE_TOOLS_PATH/.venv/bin/python3 $GOOGLE_TOOLS_PATH/email_monitor.py

# Human-readable
$GOOGLE_TOOLS_PATH/.venv/bin/python3 $GOOGLE_TOOLS_PATH/email_monitor.py --pretty

# Reset state (reprocess last 20)
rm $GOOGLE_TOOLS_PATH/data/email_monitor_state.json

# Emails from the last N hours
$GOOGLE_TOOLS_PATH/.venv/bin/python3 $GOOGLE_TOOLS_PATH/email_monitor.py --since 2h

Action agent only (with prepared JSON)

# From file
$GOOGLE_TOOLS_PATH/.venv/bin/python3 $GOOGLE_TOOLS_PATH/email_action_agent.py --file input.json

# Dry-run (shows what it will do, without writing records)
echo '<json>' | $GOOGLE_TOOLS_PATH/.venv/bin/python3 $GOOGLE_TOOLS_PATH/email_action_agent.py --dry-run

# Without drafts
echo '<json>' | $GOOGLE_TOOLS_PATH/.venv/bin/python3 $GOOGLE_TOOLS_PATH/email_action_agent.py --no-draft

View results

# Summary for today
cat $GOOGLE_TOOLS_PATH/data/email_summaries/$(date +%Y-%m-%d).md

# Draft replies
ls $GOOGLE_TOOLS_PATH/data/email_drafts/
cat $GOOGLE_TOOLS_PATH/data/email_drafts/2026-02-09_task-055.txt

# launchd status
launchctl list | grep email-monitor

Classification

| Category | Action Agent action |

|----------|---------------------|

| URGENT | Activity + draft |

| REPLY_NEEDED | Activity + draft |

| INFO | Activity only |

| SPAM | Skipped |

Note (2026-03-02): Task creation is DISABLED. Sales follow-ups are tracked in leads.csv via next_action. pm_tasks is for dev/project tasks only. To re-enable task creation, uncomment the block in email_action_agent.py around line 420.

Action Agent: what it does

  1. Match contact -- looks up the sender in people.csv (email), fallback by domain in companies.csv
  2. Log activity -- adds a row to activities.csv (type: email, direction: inbound)
  3. ~~Create task~~ -- DISABLED. Was: adds a row to pm_tasks_master.csv
  4. Draft reply -- generates a draft via claude -p --model haiku, saves to data/email_drafts/
  5. Git commit -- auto-commits in $PROJECT_ROOT (activities only)
  6. Telegram notify -- summary with drafts to Saved Messages

Unknown contacts are tagged with unknown-contact -- need to be added to CRM.

CRM files (read/write)

Related skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.