Files
research/research/email-triage-setup.md
T

3.7 KiB

Email Triage Setup for Hermes

Project: Tony_tech / research Date: 2026-06-18 Status: In progress Owner: Hermes (autonomous collaborator)

Goals

  • Automate triage of tonyjbala@gmail.com inbox
  • Use AI (Hermes) to classify emails into categories
  • Move emails to appropriate folders/labels
  • Extract action items and integrate with Gitea / workflows
  • Run periodically or on-demand via Hermes

Current State

  • Himalaya CLI installed (v1.2.0) in ~/.local/bin
  • Config at ~/.config/himalaya/config.toml with gmail account (IMAP/SMTP)
  • Issue: Authentication failing (invalid/expired app password)
  • No Google Workspace OAuth set up yet (alternative path)
  1. Himalaya for terminal IMAP operations (list, read, move, flag)
  2. Hermes agent for intelligent classification (via terminal calls + reasoning)
  3. Gmail labels as triage folders:
    • Action (needs reply or task)
    • Waiting (delegated / awaiting response)
    • FYI / Read (no action)
    • Archive (or use Gmail archive)
    • Projects-specific if needed
  4. Integration points:
    • Create Gitea issues in Tony_tech for high-priority action items
    • Link to daily briefs or opportunity scans
    • Log triage decisions in artifacts

Setup Steps (Current)

1. Fix Credentials (Himalaya)

  • Go to https://myaccount.google.com/apppasswords
  • Generate new 16-character app password for "Hermes Email" (Mail)
  • Update config:
    # Backup first
    cp ~/.config/himalaya/config.toml ~/.config/himalaya/config.toml.bak
    
    # Then edit the password line (or tell Hermes the new password securely)
    sed -i 's/backend.auth.raw = "OLD_PASSWORD"/backend.auth.raw = "NEW_16CHAR_APP_PASSWORD"/' ~/.config/himalaya/config.toml
    
  • Test:
    export PATH="$HOME/.local/bin:$PATH"
    himalaya account list
    himalaya envelope list --output json --page 1 --page-size 3
    

2. Define Triage Categories

Standard labels to create in Gmail (or use himalaya to move):

  • Action
  • Waiting
  • FYI
  • Someday

Use Gmail web or:

himalaya folder create Action
# etc.

3. Triage Workflow Script

Create a script (e.g. ~/.local/bin/hermes-email-triage) that:

  • Fetches unseen emails (himalaya envelope list --unseen --output json)
  • For each email, extracts from, subject, date, snippet
  • Uses Hermes reasoning or simple rules + LLM call to classify
  • Moves with himalaya message move <id> <folder>
  • Optionally creates Gitea issue for Action items via MCP tools
  • Logs to ~/.hermes/profiles/leonard/artifacts/email-triage/

Example skeleton (to be implemented):

#!/bin/bash
export PATH="$HOME/.local/bin:$PATH"
emails=$(himalaya envelope list --unseen --output json)
# parse with jq, then for each: classify, act

4. Automation

  • Cron or Hermes cronjob for periodic triage (e.g. every 30m or on new mail trigger)
  • Manual trigger via Telegram: "triage email" or "run email triage"

5. Integration with Tony_tech

  • All triage logic/docs in this folder
  • Action items from email -> Gitea issues in Tony_tech
  • Link to other workflows (daily briefs, agent persistence)

Next Steps

  • User provides new app password or runs update
  • Test list/read/move
  • Create Gmail labels
  • Write initial triage script
  • Test classification on sample emails
  • Schedule via cronjob tool
  • Add Gitea issue creation for actions
  • Document results in Tony_tech

Security Notes

  • App password (not main password)
  • Consider moving to OAuth via google-workspace skill for better long-term auth
  • Never commit passwords to Gitea

References

  • Himalaya skill docs
  • Gmail IMAP labels mapping
  • Hermes terminal + execute_code for AI classification

Work placed in Tony_tech as requested.