AGENT SKILL

email-inbox-briefing

Pull Ibrahim's email and deliver a triaged inbox briefing.

License 许可
MIT
最近更新
2026-08-16
Stars
★ 0
Forks
0

01 前言 Front Matter

name
email-inbox-briefing
author
Hermes curator
license
MIT
version
1.0.0
metadata
{ "hermes": { "tags": [ "Email", "Gmail", "Briefing", "Triage", "OAuth" ] } }
platforms
[ "linux" ]
description
Pull Ibrahim's email and deliver a triaged inbox briefing.

02 资源文件 2

03 SKILL.md 正文

Email Inbox Briefing

Pull the user's Gmail and produce a fast, triaged briefing (action items first). Recurring task on this machine — expect it as a daily-protocol-style request ("update me on my email", "check my inbox", "any mail?").

Backend discovery (this machine)

  • Email account: abdullibrahim733@gmail.com
  • Working backend: google-workspace skill (OAuth token at ~/.hermes/google_token.json).
  • himalaya CLI is installed but NOT configured (no ~/.config/himalaya/config.toml); it errors with "Cannot find configuration" — don't attempt it.
  • Common search queries: see references/common_queries.md

Shorthands (from the google-workspace skill):

GSETUP="python ${HERMES_HOME:-$HOME/.hermes}/skills/productivity/google-workspace/scripts/setup.py"
GAPI="python ${HERMES_HOME:-$HOME/.hermes}/skills/productivity/google-workspace/scripts/google_api.py"

1. Check auth first

$GSETUP --check
  • AUTHENTICATED → go to step 2.
  • TOKEN_REVOKED / expired → re-auth below.

Re-auth flow (token expired/revoked)

  1. $GSETUP --auth-url → returns a long URL. Send it to the user as a single line.
    • PITFALL: the installed setup.py REJECTS --services all and --format json ("unrecognized arguments") even though the skill docs show them. Use BARE flags.
  2. User approves in browser, lands on http://localhost/?code=... ("can't connect" is EXPECTED).
  3. User pastes the full redirect URL back. Exchange it: $GSETUP --auth-code "<entire pasted URL>"
  4. Confirm: $GSETUP --check → AUTHENTICATED.

2. Pull + triage inbox

$GAPI gmail search "is:unread" --max 30

Pipe through python3 json parse for a compact table: date | from | subject plus CATEGORY label per row. Bucket into 🔴 ACTION (person-to-person, security, deadlines) / 🟡 worth knowing / ⚪ noise (CATEGORY_PROMOTIONS, CATEGORY_UPDATES).

High-signal searches for this user:

  • from:arushasecondary62@gmail.com — school/study materials (sends .docx attachments)
  • from:github.com newer_than:10d — token expiry warnings (the "hermes" PAT)
  • newer_than:3d -category:promotions -category:updates — recent non-noise

PITFALL: $GAPI gmail search prints the literal string "No messages found." (not JSON) when there are zero hits — guard json.loads against it.

3. Read important mail — multipart messages

PITFALL: $GAPI gmail get MSG_ID returns an EMPTY body for multipart/mixed messages (e.g. attachment-only mail from Arusha Secondary, Sahara Sparks). The CLI wrapper only surfaces top-level text parts.

FIX: use the bundled extractor script (walks payload parts recursively, prints from/subject/date/body, downloads attachments):

python3 ~/.hermes/skills/email/email-inbox-briefing/scripts/gmail_full_extract.py MSG_ID
python3 ~/.hermes/skills/email/email-inbox-briefing/scripts/gmail_full_extract.py MSG_ID --download-dir ~/Downloads/email-attachments

PITFALL: if plain python3 lacks googleapiclient, run it with the Hermes venv: ~/.hermes/hermes-agent/venv/bin/python.

4. Transient API errors

googleapiclient can throw OSError: [Errno 101] Network is unreachable spuriously. Verify reachability (curl -s -o /dev/null -w '%{http_code}' https://www.googleapis.com/ → 404 means reachable) and RETRY once. Do not conclude the token is broken.

5. Deliver the briefing

Format: three buckets (🔴 / 🟡 / ⚪) with dates and key facts; quote details for action items. Save attachments to ~/Downloads/email-attachments/ and report the absolute path (user asks "where is the file"). End with 2–3 offered next actions (calendar invite, regenerate token, open attachment). Never send/modify anything without approval.

Rules

  • Never send, delete, or modify mail without user approval (google-workspace rules apply).
  • Report attachment paths explicitly; offer the file via MEDIA: link.

04 同仓库更多 Skills