[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M77JT8SBZ7WSQGQ9AW01F134":3,"skill-same:01M77JT8SBZ7WSQGQ9AW01F134":86},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":64,"commitSha":65,"skillDirectory":66,"forksCount":67,"repositoryHtmlUrl":68,"repositoryHomepageUrl":69,"ownerHtmlUrl":70,"ownerBlogUrl":6,"ownerDescription":71,"updatedAt":72,"install":73,"resources":85},"01M77JT8SBZ7WSQGQ9AW01F134","iris",null,"Iris — Rainbow Messenger. Reads your Gmail inbox, scores every email by urgency and sender importance, drafts replies for the top 5, and produces a daily action list. Saves 45+ minutes per day. Works with any Gmail account via app password — no OAuth dance required.","Lord1Egypt\u002Fawesome-skill-forge","Lord1Egypt","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99746359?v=4","01M7592YDNT0XK9WJ0T2MQVPDN","Mohamed Mounir Ali AL Keshita","01M75GRFNHC8VZNWEB8DKDE433",3,"MIT","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fclawhub\u002Fi\u002Firis\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: iris\ndescription: \"Iris — Rainbow Messenger. Reads your Gmail inbox, scores every email by urgency and sender importance, drafts replies for the top 5, and produces a daily action list. Saves 45+ minutes per day. Works with any Gmail account via app password — no OAuth dance required.\"\nversion: \"1.0.4\"\nmetadata:\n  openclaw:\n    requires:\n      env: [GMAIL_ADDRESS, GMAIL_APP_PASSWORD]\n      bins: [python3, pip3]\n    primaryEnv: GMAIL_ADDRESS\n    emoji: \"🌈📬\"\n    homepage: https:\u002F\u002Fclawhub.ai\u002Foccupythemilkyway\u002Firis\n    tags: [email, gmail, inbox, triage, productivity, iris, ai-drafts, time-saving]\n    envVars:\n      - name: GMAIL_ADDRESS\n        required: true\n        description: Your Gmail address (e.g. you@gmail.com)\n      - name: GMAIL_APP_PASSWORD\n        required: true\n        description: \"Gmail app password — create at myaccount.google.com\u002Fapppasswords (NOT your regular password). Choose: Mail → Other\"\n      - name: SCAN_COUNT\n        required: false\n        description: \"Number of recent emails to scan (default: 50)\"\n        default: \"50\"\n      - name: VIP_SENDERS\n        required: false\n        description: \"Comma-separated list of important sender email addresses or domains that should always score high\"\n        default: \"\"\n      - name: YOUR_NAME\n        required: false\n        description: \"Your name for personalising draft replies (e.g. Alex)\"\n        default: \"\"\n      - name: YOUR_ROLE\n        required: false\n        description: \"Your role for context-aware replies (e.g. Product Manager)\"\n        default: \"\"\n---\n\n# Iris — Inbox Intelligence\n\nRead your last 50 emails, score every one by urgency, get draft replies for your top 5, and see a clean action list — all in under 2 minutes.\n\n## What you get\n\n- **Urgency scoring** (0-100) based on keywords, sender importance, age, and reply signals\n- **Priority inbox**: top 5 emails that need action today, with one-click draft replies\n- **Noise filter**: newsletters, no-reply addresses, and marketing email suppressed automatically\n- **VIP tracking**: set specific senders or domains that always score high\n- **Daily report saved** to markdown — reference it any time during the day\n\n## Setup (one-time, 2 minutes)\n\n1. Go to **myaccount.google.com\u002Fapppasswords**\n2. Create an app password — select **Mail** → **Other (Custom name)**\n3. Copy the 16-character password\n4. Set `GMAIL_APP_PASSWORD` to that password (not your Google login password)\n\n## 🔒 Security\n\nConnects to: `imap.gmail.com` (your credentials, read-only). No external services contacted.\nApp passwords only scope to the specific app — revoke them instantly in Google Account settings.\n\n---\n\n## Step 1 — Install\n\n```bash\npip3 install rich --break-system-packages --quiet\n```\n\n---\n\n\n---\n\n## ⚡ Upgrade to Iris Pro\n\n👉 **Get Iris Pro** → **ko-fi.com\u002Fs\u002Ff75940a0ce** — $9 one-time\n\n```bash\nopenclaw skills install iris-pro\n# Set LICENSE_KEY env var to your key from Ko-fi, then run\n```\n\n💰 **Bundle deal:** all 5 Pro skills for **$29** → **ko-fi.com\u002Fs\u002F7625accf3f** (save $16)\n\n## Step 2 — Triage your inbox\n\n```python\nimport os, imaplib, email, re\nfrom email.header import decode_header\nfrom email.utils import parsedate_to_datetime\nfrom datetime import datetime, timezone\nfrom rich.console import Console\nfrom rich.table import Table\nfrom rich.panel import Panel\nfrom rich import box\n\nFENCE = chr(96) * 3\n\nconsole = Console()\n\nGMAIL_ADDR = os.environ.get(\"GMAIL_ADDRESS\", \"\").strip()\nGMAIL_PASS = os.environ.get(\"GMAIL_APP_PASSWORD\", \"\").strip()\ntry:\n    SCAN_COUNT = int(os.environ.get(\"SCAN_COUNT\", \"50\"))\nexcept ValueError:\n    console.print(\"[yellow]⚠️  SCAN_COUNT must be a whole number — defaulting to 50[\u002Fyellow]\")\n    SCAN_COUNT = 50\nVIP_RAW    = os.environ.get(\"VIP_SENDERS\", \"\")\nVIP_LIST   = [v.strip().lower() for v in VIP_RAW.split(\",\") if v.strip()]\nYOUR_NAME  = os.environ.get(\"YOUR_NAME\", \"\").strip()\nYOUR_ROLE  = os.environ.get(\"YOUR_ROLE\", \"\").strip()\n\nif not GMAIL_ADDR or not GMAIL_PASS:\n    console.print(Panel(\n        \"[red]GMAIL_ADDRESS and GMAIL_APP_PASSWORD are both required.[\u002Fred]\\n\\n\"\n        \"How to create an app password:\\n\"\n        \"1. Go to [bold]myaccount.google.com\u002Fapppasswords[\u002Fbold]\\n\"\n        \"2. Select Mail → Other (Custom name)\\n\"\n        \"3. Copy the 16-character password\\n\"\n        \"4. Set GMAIL_APP_PASSWORD to that value\",\n        title=\"[bold red]⚙️  Setup Required[\u002Fbold red]\",\n        border_style=\"red\"\n    ))\n    raise SystemExit(1)\n\nURGENT_KEYWORDS = [\n    \"urgent\", \"asap\", \"deadline\", \"immediately\", \"action required\", \"time sensitive\",\n    \"overdue\", \"past due\", \"invoice\", \"payment due\", \"legal\", \"lawsuit\", \"critical\",\n    \"emergency\", \"final notice\", \"expires\", \"expiring\", \"last chance\",\n]\nREPLY_KEYWORDS = [\n    \"?\", \"question\", \"can you\", \"could you\", \"please\", \"request\",\n    \"following up\", \"follow-up\", \"reminder\", \"let me know\", \"thoughts\",\n]\nQUESTION_KW = [\"?\", \"question\", \"can you\", \"could you\", \"help\", \"assist\"]\nNOISE_PATTERNS = [\n    r\"unsubscribe\", r\"newsletter\", r\"no-reply@\", r\"noreply@\",\n    r\"marketing@\", r\"notifications?@\", r\"donotreply@\",\n    r\"@.*\\.(mailchim|sendgrid|constantcontact|klaviyo)\",\n]\nNOISE_SUBJECTS = [\n    \"sale\", \"% off\", \"deal\", \"offer\", \"promo\", \"subscribe\", \"newsletter\",\n    \"weekly digest\", \"monthly update\", \"announcement\",\n]\n\ndef decode_str(s):\n    if not s:\n        return \"\"\n    parts = decode_header(s)\n    result = []\n    for part, enc in parts:\n        if isinstance(part, bytes):\n            try:\n                result.append(part.decode(enc or \"utf-8\", errors=\"replace\"))\n            except Exception:\n                result.append(part.decode(\"utf-8\", errors=\"replace\"))\n        else:\n            result.append(str(part))\n    return \" \".join(result)\n\ndef is_noise(sender: str, subject: str) -> bool:\n    text = (sender + \" \" + subject).lower()\n    for pat in NOISE_PATTERNS:\n        if re.search(pat, text):\n            return True\n    for kw in NOISE_SUBJECTS:\n        if kw in subject.lower():\n            return True\n    return False\n\ndef score_email(subject: str, snippet: str, sender: str, age_hours: float, has_replied: bool) -> int:\n    score = 50\n    subj_low = subject.lower()\n    snip_low = snippet.lower()\n    # Urgency keywords\n    for kw in URGENT_KEYWORDS:\n        if kw in subj_low or kw in snip_low:\n            score += 20\n            break\n    # Reply needed\n    for kw in REPLY_KEYWORDS:\n        if kw in subj_low or kw in snip_low:\n            score += 10\n            break\n    # VIP sender\n    sender_low = sender.lower()\n    for vip in VIP_LIST:\n        if vip in sender_low:\n            score += 25\n            break\n    # Age penalty\u002Fboost\n    if age_hours \u003C 2:\n        score += 5\n    elif age_hours \u003C 24:\n        score += 0\n    elif age_hours > 48:\n        score -= 10\n    elif age_hours > 120:\n        score -= 20\n    # Has been replied to\n    if has_replied:\n        score -= 15\n    return max(0, min(score, 100))\n\n# ── Connect to Gmail ──────────────────────────────────────────────────────────\nconsole.print(Panel.fit(\n    f\"[bold cyan]🌈 Iris — Inbox Intelligence[\u002Fbold cyan]\\n\"\n    f\"Scanning [yellow]{SCAN_COUNT}[\u002Fyellow] recent emails from [green]{GMAIL_ADDR}[\u002Fgreen]\",\n    border_style=\"cyan\"\n))\n\ntry:\n    mail = imaplib.IMAP4_SSL(\"imap.gmail.com\", 993)\n    mail.login(GMAIL_ADDR, GMAIL_PASS)\n    mail.select(\"INBOX\", readonly=True)\nexcept imaplib.IMAP4.error as e:\n    console.print(Panel(\n        f\"[red]IMAP login failed:[\u002Fred] {e}\\n\\n\"\n        \"Checklist:\\n\"\n        \"• Is GMAIL_ADDRESS correct? (full email, not just username)\\n\"\n        \"• Is GMAIL_APP_PASSWORD a 16-char app password (not your Google password)?\\n\"\n        \"• Did you enable IMAP in Gmail Settings → See all settings → Forwarding and POP\u002FIMAP?\",\n        title=\"[bold red]Login Error[\u002Fbold red]\",\n        border_style=\"red\"\n    ))\n    raise SystemExit(1)\nexcept Exception as e:\n    console.print(f\"[red]Connection error: {e}[\u002Fred]\")\n    raise SystemExit(1)\n\n_, msg_ids = mail.search(None, \"ALL\")\nall_ids = msg_ids[0].split() if msg_ids and msg_ids[0] else []\nif not all_ids:\n    console.print(Panel(\"[yellow]Inbox is empty — nothing to triage.[\u002Fyellow]\", border_style=\"yellow\"))\n    raise SystemExit(0)\n\nrecent_ids = all_ids[-SCAN_COUNT:] if len(all_ids) > SCAN_COUNT else all_ids\nrecent_ids = list(reversed(recent_ids))  # newest first\n\n# ── Fetch and score emails ────────────────────────────────────────────────────\nemails_data = []\nnow = datetime.now(timezone.utc)\n\nconsole.print(f\"[dim]Fetching {len(recent_ids)} emails…[\u002Fdim]\")\nfor uid in recent_ids:\n    try:\n        _, raw = mail.fetch(uid, \"(RFC822.HEADER FLAGS)\")\n        if not raw or not raw[0]:\n            continue\n        raw_header = raw[0][1] if isinstance(raw[0], tuple) else raw[0]\n        msg = email.message_from_bytes(raw_header)\n        subject = decode_str(msg.get(\"Subject\", \"(no subject)\"))\n        sender  = decode_str(msg.get(\"From\", \"\"))\n        date_str = msg.get(\"Date\", \"\")\n        flags_raw = raw[0][0] if isinstance(raw[0], tuple) else b\"\"\n        has_replied = b\"\\\\Answered\" in flags_raw\n\n        # Parse date\n        try:\n            sent_dt = parsedate_to_datetime(date_str)\n            if sent_dt.tzinfo is None:\n                sent_dt = sent_dt.replace(tzinfo=timezone.utc)\n            age_hours = (now - sent_dt).total_seconds() \u002F 3600\n        except Exception:\n            age_hours = 0\n\n        # Fetch snippet\n        body_snippet = \"\"\n        try:\n            _, raw_body = mail.fetch(uid, \"(BODY[TEXT]\u003C0.300>)\")\n            if raw_body and raw_body[0] and isinstance(raw_body[0], tuple):\n                raw_b = raw_body[0][1]\n                if raw_b:\n                    body_snippet = raw_b.decode(\"utf-8\", errors=\"replace\").strip()[:200]\n        except Exception:\n            pass\n\n        noise = is_noise(sender, subject)\n        urgency = score_email(subject, body_snippet, sender, age_hours, has_replied)\n\n        # Extract sender name and email\n        sender_match = re.search(r'\"?([^\"\u003C]+)\"?\\s*\u003C([^>]+)>', sender)\n        if sender_match:\n            sender_name  = sender_match.group(1).strip()\n            sender_email = sender_match.group(2).strip()\n        else:\n            sender_name  = sender\n            sender_email = sender\n\n        emails_data.append({\n            \"uid\":          uid,\n            \"subject\":      subject,\n            \"sender\":       sender_name,\n            \"sender_email\": sender_email,\n            \"age_hours\":    age_hours,\n            \"snippet\":      body_snippet,\n            \"urgency\":      urgency,\n            \"is_noise\":     noise,\n            \"replied\":      has_replied,\n        })\n    except Exception:\n        continue\n\nmail.logout()\n\n# ── Sort and filter ───────────────────────────────────────────────────────────\nactionable = [e for e in emails_data if not e[\"is_noise\"]]\nnoise      = [e for e in emails_data if e[\"is_noise\"]]\nactionable.sort(key=lambda e: -e[\"urgency\"])\n\n# ── Display: Priority inbox ───────────────────────────────────────────────────\nconsole.print()\npriority_table = Table(\n    title=f\"📬 Priority Inbox — {len(actionable)} actionable emails\",\n    box=box.ROUNDED, border_style=\"cyan\"\n)\npriority_table.add_column(\"Score\",   style=\"red\",    width=7,  justify=\"right\")\npriority_table.add_column(\"From\",    style=\"yellow\", width=22)\npriority_table.add_column(\"Subject\", style=\"white\",  width=40)\npriority_table.add_column(\"Age\",     style=\"dim\",    width=8)\npriority_table.add_column(\"Status\",  style=\"green\",  width=10)\n\nfor e in actionable[:20]:\n    age_str = (f\"{int(e['age_hours'])}h\" if e[\"age_hours\"] \u003C 48\n               else f\"{int(e['age_hours'] \u002F\u002F 24)}d\")\n    status  = \"✅ replied\" if e[\"replied\"] else \"\"\n    score_colour = \"red\" if e[\"urgency\"] >= 70 else \"yellow\" if e[\"urgency\"] >= 50 else \"dim\"\n    priority_table.add_row(\n        f\"[{score_colour}]{e['urgency']}[\u002F{score_colour}]\",\n        e[\"sender\"][:20],\n        e[\"subject\"][:38],\n        age_str,\n        status,\n    )\n\nconsole.print(priority_table)\n\n# ── Display: Draft replies ────────────────────────────────────────────────────\nsig = f\"\\n\\n—\\n{YOUR_NAME or 'Best'}{', ' + YOUR_ROLE if YOUR_ROLE else ''}\"\ntop5 = [e for e in actionable if not e[\"replied\"]][:5]\n\nconsole.print()\nfor e in top5:\n    subj_low = e[\"subject\"].lower()\n    snip_low = e[\"snippet\"].lower()\n    greeting = f\"Hi {e['sender'].split()[0]},\"\n    if any(k in subj_low or k in snip_low for k in [\"urgent\", \"asap\", \"deadline\", \"overdue\"]):\n        body = \"Thank you for flagging this — I'll look into it right away and get back to you shortly.\"\n    elif any(k in subj_low or k in snip_low for k in QUESTION_KW):\n        body = \"Thanks for your message. To answer your question: [your answer here]\\n\\nLet me know if you need anything else.\"\n    elif \"re:\" in subj_low or \"fwd:\" in subj_low:\n        body = \"Thanks for the follow-up. Here's where things stand: [brief update]\\n\\nHappy to jump on a call if that's easier.\"\n    else:\n        body = \"Thanks for reaching out. I've reviewed your message and [your response here].\"\n    draft = f\"{greeting}\\n\\n{body}{sig}\"\n    console.print(Panel(\n        draft,\n        title=f\"[bold]📝 Draft: Re: {e['subject'][:45]}[\u002Fbold]  [dim](urgency: {e['urgency']})[\u002Fdim]\",\n        border_style=\"yellow\"\n    ))\n\n# ── Display: Stats ────────────────────────────────────────────────────────────\nconsole.print()\nconsole.print(Panel(\n    f\"📊 [bold]Summary[\u002Fbold]\\n\\n\"\n    f\"Scanned:    [yellow]{len(emails_data)}[\u002Fyellow] emails\\n\"\n    f\"Actionable: [cyan]{len(actionable)}[\u002Fcyan]  |  \"\n    f\"Noise: [dim]{len(noise)}[\u002Fdim]  |  \"\n    f\"Already replied: [green]{sum(1 for e in actionable if e['replied'])}[\u002Fgreen]\\n\"\n    f\"High priority (70+): [red]{sum(1 for e in actionable if e['urgency'] >= 70)}[\u002Fred]\",\n    border_style=\"cyan\"\n))\n\n# ── Save report ───────────────────────────────────────────────────────────────\ndate_str    = datetime.now().strftime(\"%Y-%m-%d\")\nreport_file = f\"inbox_report_{date_str}.md\"\nwith open(report_file, \"w\", encoding=\"utf-8\") as f:\n    f.write(f\"# 🌈 Iris — Inbox Report — {date_str}\\n\\n\")\n    f.write(f\"**Scanned:** {len(emails_data)}  **Actionable:** {len(actionable)}  **Noise:** {len(noise)}\\n\\n\")\n    f.write(\"## Priority Emails\\n\\n| Score | From | Subject | Age |\\n|-------|------|---------|-----|\\n\")\n    for e in actionable[:20]:\n        age_str = f\"{int(e['age_hours'])}h\" if e[\"age_hours\"] \u003C 48 else f\"{int(e['age_hours']\u002F\u002F24)}d\"\n        f.write(f\"| {e['urgency']} | {e['sender']} | {e['subject']} | {age_str} |\\n\")\n    f.write(\"\\n## Draft Replies\\n\\n\")\n    for e in top5:\n        subj_low = e[\"subject\"].lower()\n        snip_low = e[\"snippet\"].lower()\n        greeting = f\"Hi {e['sender'].split()[0]},\"\n        if any(k in subj_low or k in snip_low for k in [\"urgent\", \"asap\", \"deadline\"]):\n            body = \"Thank you for flagging this — I'll look into it right away.\"\n        elif any(k in subj_low or k in snip_low for k in QUESTION_KW):\n            body = \"Thanks for your message. To answer your question: [your answer here]\"\n        else:\n            body = \"Thanks for reaching out. [your response here]\"\n        f.write(f\"### Re: {e['subject']}\\n\\n{FENCE}\\n{greeting}\\n\\n{body}{sig}\\n{FENCE}\\n\\n\")\n\nconsole.print(Panel(\n    f\"[green]✅ Done![\u002Fgreen]  Report saved to [cyan]{report_file}[\u002Fcyan]\",\n    border_style=\"green\"\n))\n```\n","# Iris — Inbox Intelligence\n\nRead your last 50 emails, score every one by urgency, get draft replies for your top 5, and see a clean action list — all in under 2 minutes.\n\n## What you get\n\n- **Urgency scoring** (0-100) based on keywords, sender importance, age, and reply signals\n- **Priority inbox**: top 5 emails that need action today, with one-click draft replies\n- **Noise filter**: newsletters, no-reply addresses, and marketing email suppressed automatically\n- **VIP tracking**: set specific senders or domains that always score high\n- **Daily report saved** to markdown — reference it any time during the day\n\n## Setup (one-time, 2 minutes)\n\n1. Go to **myaccount.google.com\u002Fapppasswords**\n2. Create an app password — select **Mail** → **Other (Custom name)**\n3. Copy the 16-character password\n4. Set `GMAIL_APP_PASSWORD` to that password (not your Google login password)\n\n## 🔒 Security\n\nConnects to: `imap.gmail.com` (your credentials, read-only). No external services contacted.\nApp passwords only scope to the specific app — revoke them instantly in Google Account settings.\n\n---\n\n## Step 1 — Install\n\n```bash\npip3 install rich --break-system-packages --quiet\n```\n\n---\n\n\n---\n\n## ⚡ Upgrade to Iris Pro\n\n👉 **Get Iris Pro** → **ko-fi.com\u002Fs\u002Ff75940a0ce** — $9 one-time\n\n```bash\nopenclaw skills install iris-pro\n# Set LICENSE_KEY env var to your key from Ko-fi, then run\n```\n\n💰 **Bundle deal:** all 5 Pro skills for **$29** → **ko-fi.com\u002Fs\u002F7625accf3f** (save $16)\n\n## Step 2 — Triage your inbox\n\n```python\nimport os, imaplib, email, re\nfrom email.header import decode_header\nfrom email.utils import parsedate_to_datetime\nfrom datetime import datetime, timezone\nfrom rich.console import Console\nfrom rich.table import Table\nfrom rich.panel import Panel\nfrom rich import box\n\nFENCE = chr(96) * 3\n\nconsole = Console()\n\nGMAIL_ADDR = os.environ.get(\"GMAIL_ADDRESS\", \"\").strip()\nGMAIL_PASS = os.environ.get(\"GMAIL_APP_PASSWORD\", \"\").strip()\ntry:\n    SCAN_COUNT = int(os.environ.get(\"SCAN_COUNT\", \"50\"))\nexcept ValueError:\n    console.print(\"[yellow]⚠️  SCAN_COUNT must be a whole number — defaulting to 50[\u002Fyellow]\")\n    SCAN_COUNT = 50\nVIP_RAW    = os.environ.get(\"VIP_SENDERS\", \"\")\nVIP_LIST   = [v.strip().lower() for v in VIP_RAW.split(\",\") if v.strip()]\nYOUR_NAME  = os.environ.get(\"YOUR_NAME\", \"\").strip()\nYOUR_ROLE  = os.environ.get(\"YOUR_ROLE\", \"\").strip()\n\nif not GMAIL_ADDR or not GMAIL_PASS:\n    console.print(Panel(\n        \"[red]GMAIL_ADDRESS and GMAIL_APP_PASSWORD are both required.[\u002Fred]\\n\\n\"\n        \"How to create an app password:\\n\"\n        \"1. Go to [bold]myaccount.google.com\u002Fapppasswords[\u002Fbold]\\n\"\n        \"2. Select Mail → Other (Custom name)\\n\"\n        \"3. Copy the 16-character password\\n\"\n        \"4. Set GMAIL_APP_PASSWORD to that value\",\n        title=\"[bold red]⚙️  Setup Required[\u002Fbold red]\",\n        border_style=\"red\"\n    ))\n    raise SystemExit(1)\n\nURGENT_KEYWORDS = [\n    \"urgent\", \"asap\", \"deadline\", \"immediately\", \"action required\", \"time sensitive\",\n    \"overdue\", \"past due\", \"invoice\", \"payment due\", \"legal\", \"lawsuit\", \"critical\",\n    \"emergency\", \"final notice\", \"expires\", \"expiring\", \"last chance\",\n]\nREPLY_KEYWORDS = [\n    \"?\", \"question\", \"can you\", \"could you\", \"please\", \"request\",\n    \"following up\", \"follow-up\", \"reminder\", \"let me know\", \"thoughts\",\n]\nQUESTION_KW = [\"?\", \"question\", \"can you\", \"could you\", \"help\", \"assist\"]\nNOISE_PATTERNS = [\n    r\"unsubscribe\", r\"newsletter\", r\"no-reply@\", r\"noreply@\",\n    r\"marketing@\", r\"notifications?@\", r\"donotreply@\",\n    r\"@.*\\.(mailchim|sendgrid|constantcontact|klaviyo)\",\n]\nNOISE_SUBJECTS = [\n    \"sale\", \"% off\", \"deal\", \"offer\", \"promo\", \"subscribe\", \"newsletter\",\n    \"weekly digest\", \"monthly update\", \"announcement\",\n]\n\ndef decode_str(s):\n    if not s:\n        return \"\"\n    parts = decode_header(s)\n    result = []\n    for part, enc in parts:\n        if isinstance(part, bytes):\n            try:\n                result.append(part.decode(enc or \"utf-8\", errors=\"replace\"))\n            except Exception:\n                result.append(part.decode(\"utf-8\", errors=\"replace\"))\n        else:\n            result.append(str(part))\n    return \" \".join(result)\n\ndef is_noise(sender: str, subject: str) -> bool:\n    text = (sender + \" \" + subject).lower()\n    for pat in NOISE_PATTERNS:\n        if re.search(pat, text):\n            return True\n    for kw in NOISE_SUBJECTS:\n        if kw in subject.lower():\n            return True\n    return False\n\ndef score_email(subject: str, snippet: str, sender: str, age_hours: float, has_replied: bool) -> int:\n    score = 50\n    subj_low = subject.lower()\n    snip_low = snippet.lower()\n    # Urgency keywords\n    for kw in URGENT_KEYWORDS:\n        if kw in subj_low or kw in snip_low:\n            score += 20\n            break\n    # Reply needed\n    for kw in REPLY_KEYWORDS:\n        if kw in subj_low or kw in snip_low:\n            score += 10\n            break\n    # VIP sender\n    sender_low = sender.lower()\n    for vip in VIP_LIST:\n        if vip in sender_low:\n            score += 25\n            break\n    # Age penalty\u002Fboost\n    if age_hours \u003C 2:\n        score += 5\n    elif age_hours \u003C 24:\n        score += 0\n    elif age_hours > 48:\n        score -= 10\n    elif age_hours > 120:\n        score -= 20\n    # Has been replied to\n    if has_replied:\n        score -= 15\n    return max(0, min(score, 100))\n\n# ── Connect to Gmail ──────────────────────────────────────────────────────────\nconsole.print(Panel.fit(\n    f\"[bold cyan]🌈 Iris — Inbox Intelligence[\u002Fbold cyan]\\n\"\n    f\"Scanning [yellow]{SCAN_COUNT}[\u002Fyellow] recent emails from [green]{GMAIL_ADDR}[\u002Fgreen]\",\n    border_style=\"cyan\"\n))\n\ntry:\n    mail = imaplib.IMAP4_SSL(\"imap.gmail.com\", 993)\n    mail.login(GMAIL_ADDR, GMAIL_PASS)\n    mail.select(\"INBOX\", readonly=True)\nexcept imaplib.IMAP4.error as e:\n    console.print(Panel(\n        f\"[red]IMAP login failed:[\u002Fred] {e}\\n\\n\"\n        \"Checklist:\\n\"\n        \"• Is GMAIL_ADDRESS correct? (full email, not just username)\\n\"\n        \"• Is GMAIL_APP_PASSWORD a 16-char app password (not your Google password)?\\n\"\n        \"• Did you enable IMAP in Gmail Settings → See all settings → Forwarding and POP\u002FIMAP?\",\n        title=\"[bold red]Login Error[\u002Fbold red]\",\n        border_style=\"red\"\n    ))\n    raise SystemExit(1)\nexcept Exception as e:\n    console.print(f\"[red]Connection error: {e}[\u002Fred]\")\n    raise SystemExit(1)\n\n_, msg_ids = mail.search(None, \"ALL\")\nall_ids = msg_ids[0].split() if msg_ids and msg_ids[0] else []\nif not all_ids:\n    console.print(Panel(\"[yellow]Inbox is empty — nothing to triage.[\u002Fyellow]\", border_style=\"yellow\"))\n    raise SystemExit(0)\n\nrecent_ids = all_ids[-SCAN_COUNT:] if len(all_ids) > SCAN_COUNT else all_ids\nrecent_ids = list(reversed(recent_ids))  # newest first\n\n# ── Fetch and score emails ────────────────────────────────────────────────────\nemails_data = []\nnow = datetime.now(timezone.utc)\n\nconsole.print(f\"[dim]Fetching {len(recent_ids)} emails…[\u002Fdim]\")\nfor uid in recent_ids:\n    try:\n        _, raw = mail.fetch(uid, \"(RFC822.HEADER FLAGS)\")\n        if not raw or not raw[0]:\n            continue\n        raw_header = raw[0][1] if isinstance(raw[0], tuple) else raw[0]\n        msg = email.message_from_bytes(raw_header)\n        subject = decode_str(msg.get(\"Subject\", \"(no subject)\"))\n        sender  = decode_str(msg.get(\"From\", \"\"))\n        date_str = msg.get(\"Date\", \"\")\n        flags_raw = raw[0][0] if isinstance(raw[0], tuple) else b\"\"\n        has_replied = b\"\\\\Answered\" in flags_raw\n\n        # Parse date\n        try:\n            sent_dt = parsedate_to_datetime(date_str)\n            if sent_dt.tzinfo is None:\n                sent_dt = sent_dt.replace(tzinfo=timezone.utc)\n            age_hours = (now - sent_dt).total_seconds() \u002F 3600\n        except Exception:\n            age_hours = 0\n\n        # Fetch snippet\n        body_snippet = \"\"\n        try:\n            _, raw_body = mail.fetch(uid, \"(BODY[TEXT]\u003C0.300>)\")\n            if raw_body and raw_body[0] and isinstance(raw_body[0], tuple):\n                raw_b = raw_body[0][1]\n                if raw_b:\n                    body_snippet = raw_b.decode(\"utf-8\", errors=\"replace\").strip()[:200]\n        except Exception:\n            pass\n\n        noise = is_noise(sender, subject)\n        urgency = score_email(subject, body_snippet, sender, age_hours, has_replied)\n\n        # Extract sender name and email\n        sender_match = re.search(r'\"?([^\"\u003C]+)\"?\\s*\u003C([^>]+)>', sender)\n        if sender_match:\n            sender_name  = sender_match.group(1).strip()\n            sender_email = sender_match.group(2).strip()\n        else:\n            sender_name  = sender\n            sender_email = sender\n\n        emails_data.append({\n            \"uid\":          uid,\n            \"subject\":      subject,\n            \"sender\":       sender_name,\n            \"sender_email\": sender_email,\n            \"age_hours\":    age_hours,\n            \"snippet\":      body_snippet,\n            \"urgency\":      urgency,\n            \"is_noise\":     noise,\n            \"replied\":      has_replied,\n        })\n    except Exception:\n        continue\n\nmail.logout()\n\n# ── Sort and filter ───────────────────────────────────────────────────────────\nactionable = [e for e in emails_data if not e[\"is_noise\"]]\nnoise      = [e for e in emails_data if e[\"is_noise\"]]\nactionable.sort(key=lambda e: -e[\"urgency\"])\n\n# ── Display: Priority inbox ───────────────────────────────────────────────────\nconsole.print()\npriority_table = Table(\n    title=f\"📬 Priority Inbox — {len(actionable)} actionable emails\",\n    box=box.ROUNDED, border_style=\"cyan\"\n)\npriority_table.add_column(\"Score\",   style=\"red\",    width=7,  justify=\"right\")\npriority_table.add_column(\"From\",    style=\"yellow\", width=22)\npriority_table.add_column(\"Subject\", style=\"white\",  width=40)\npriority_table.add_column(\"Age\",     style=\"dim\",    width=8)\npriority_table.add_column(\"Status\",  style=\"green\",  width=10)\n\nfor e in actionable[:20]:\n    age_str = (f\"{int(e['age_hours'])}h\" if e[\"age_hours\"] \u003C 48\n               else f\"{int(e['age_hours'] \u002F\u002F 24)}d\")\n    status  = \"✅ replied\" if e[\"replied\"] else \"\"\n    score_colour = \"red\" if e[\"urgency\"] >= 70 else \"yellow\" if e[\"urgency\"] >= 50 else \"dim\"\n    priority_table.add_row(\n        f\"[{score_colour}]{e['urgency']}[\u002F{score_colour}]\",\n        e[\"sender\"][:20],\n        e[\"subject\"][:38],\n        age_str,\n        status,\n    )\n\nconsole.print(priority_table)\n\n# ── Display: Draft replies ────────────────────────────────────────────────────\nsig = f\"\\n\\n—\\n{YOUR_NAME or 'Best'}{', ' + YOUR_ROLE if YOUR_ROLE else ''}\"\ntop5 = [e for e in actionable if not e[\"replied\"]][:5]\n\nconsole.print()\nfor e in top5:\n    subj_low = e[\"subject\"].lower()\n    snip_low = e[\"snippet\"].lower()\n    greeting = f\"Hi {e['sender'].split()[0]},\"\n    if any(k in subj_low or k in snip_low for k in [\"urgent\", \"asap\", \"deadline\", \"overdue\"]):\n        body = \"Thank you for flagging this — I'll look into it right away and get back to you shortly.\"\n    elif any(k in subj_low or k in snip_low for k in QUESTION_KW):\n        body = \"Thanks for your message. To answer your question: [your answer here]\\n\\nLet me know if you need anything else.\"\n    elif \"re:\" in subj_low or \"fwd:\" in subj_low:\n        body = \"Thanks for the follow-up. Here's where things stand: [brief update]\\n\\nHappy to jump on a call if that's easier.\"\n    else:\n        body = \"Thanks for reaching out. I've reviewed your message and [your response here].\"\n    draft = f\"{greeting}\\n\\n{body}{sig}\"\n    console.print(Panel(\n        draft,\n        title=f\"[bold]📝 Draft: Re: {e['subject'][:45]}[\u002Fbold]  [dim](urgency: {e['urgency']})[\u002Fdim]\",\n        border_style=\"yellow\"\n    ))\n\n# ── Display: Stats ────────────────────────────────────────────────────────────\nconsole.print()\nconsole.print(Panel(\n    f\"📊 [bold]Summary[\u002Fbold]\\n\\n\"\n    f\"Scanned:    [yellow]{len(emails_data)}[\u002Fyellow] emails\\n\"\n    f\"Actionable: [cyan]{len(actionable)}[\u002Fcyan]  |  \"\n    f\"Noise: [dim]{len(noise)}[\u002Fdim]  |  \"\n    f\"Already replied: [green]{sum(1 for e in actionable if e['replied'])}[\u002Fgreen]\\n\"\n    f\"High priority (70+): [red]{sum(1 for e in actionable if e['urgency'] >= 70)}[\u002Fred]\",\n    border_style=\"cyan\"\n))\n\n# ── Save report ───────────────────────────────────────────────────────────────\ndate_str    = datetime.now().strftime(\"%Y-%m-%d\")\nreport_file = f\"inbox_report_{date_str}.md\"\nwith open(report_file, \"w\", encoding=\"utf-8\") as f:\n    f.write(f\"# 🌈 Iris — Inbox Report — {date_str}\\n\\n\")\n    f.write(f\"**Scanned:** {len(emails_data)}  **Actionable:** {len(actionable)}  **Noise:** {len(noise)}\\n\\n\")\n    f.write(\"## Priority Emails\\n\\n| Score | From | Subject | Age |\\n|-------|------|---------|-----|\\n\")\n    for e in actionable[:20]:\n        age_str = f\"{int(e['age_hours'])}h\" if e[\"age_hours\"] \u003C 48 else f\"{int(e['age_hours']\u002F\u002F24)}d\"\n        f.write(f\"| {e['urgency']} | {e['sender']} | {e['subject']} | {age_str} |\\n\")\n    f.write(\"\\n## Draft Replies\\n\\n\")\n    for e in top5:\n        subj_low = e[\"subject\"].lower()\n        snip_low = e[\"snippet\"].lower()\n        greeting = f\"Hi {e['sender'].split()[0]},\"\n        if any(k in subj_low or k in snip_low for k in [\"urgent\", \"asap\", \"deadline\"]):\n            body = \"Thank you for flagging this — I'll look into it right away.\"\n        elif any(k in subj_low or k in snip_low for k in QUESTION_KW):\n            body = \"Thanks for your message. To answer your question: [your answer here]\"\n        else:\n            body = \"Thanks for reaching out. [your response here]\"\n        f.write(f\"### Re: {e['subject']}\\n\\n{FENCE}\\n{greeting}\\n\\n{body}{sig}\\n{FENCE}\\n\\n\")\n\nconsole.print(Panel(\n    f\"[green]✅ Done![\u002Fgreen]  Report saved to [cyan]{report_file}[\u002Fcyan]\",\n    border_style=\"green\"\n))\n```\n",{"name":5,"version":24,"metadata":25,"description":7},"1.0.4",{"openclaw":26},{"tags":27,"emoji":35,"envVars":36,"homepage":58,"requires":59,"primaryEnv":38},[28,29,30,31,32,5,33,34],"email","gmail","inbox","triage","productivity","ai-drafts","time-saving","🌈📬",[37,41,44,48,52,55],{"name":38,"required":39,"description":40},"GMAIL_ADDRESS",true,"Your Gmail address (e.g. you@gmail.com)",{"name":42,"required":39,"description":43},"GMAIL_APP_PASSWORD","Gmail app password — create at myaccount.google.com\u002Fapppasswords (NOT your regular password). Choose: Mail → Other",{"name":45,"default":46,"required":20,"description":47},"SCAN_COUNT","50","Number of recent emails to scan (default: 50)",{"name":49,"default":50,"required":20,"description":51},"VIP_SENDERS","","Comma-separated list of important sender email addresses or domains that should always score high",{"name":53,"default":50,"required":20,"description":54},"YOUR_NAME","Your name for personalising draft replies (e.g. Alex)",{"name":56,"default":50,"required":20,"description":57},"YOUR_ROLE","Your role for context-aware replies (e.g. Product Manager)","https:\u002F\u002Fclawhub.ai\u002Foccupythemilkyway\u002Firis",{"env":60,"bins":61},[38,42],[62,63],"python3","pip3","master","4aa004da461d820f4ea5499e58eb8d196cf99016","community\u002Fclawhub\u002Fi\u002Firis",0,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge","https:\u002F\u002Fskill-explorer-rho.vercel.app","https:\u002F\u002Fgithub.com\u002FLord1Egypt","Unbreakable. Unstoppable. Unmatched⚡.\r\n Speaker of machine tongues 🤖  | World-builder of decentralized dreams 🌐 | Defender of the digital realm🛡️.","2026-06-10 08:21:01",{"source":8,"skillName":5,"commands":74,"prompt":84,"zipAvailable":39},[75,78,81],{"tool":76,"command":77},"npx","npx skills add Lord1Egypt\u002Fawesome-skill-forge --skill iris",{"tool":79,"command":80},"bunx","bunx skills add Lord1Egypt\u002Fawesome-skill-forge --skill iris",{"tool":82,"command":83},"pnpm","pnpm dlx skills add Lord1Egypt\u002Fawesome-skill-forge --skill iris","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fclawhub\u002Fi\u002Firis\u002FSKILL.md",[],[87,94,101,108,115,122],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M785WKJB99G3STR1NF9NRTJW","youtube-content","YouTube transcripts to summaries, threads, blogs.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fyoutube-content\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":19},"01M785WEFHB0G2S9YA6EPR3H0E","xurl","X\u002FTwitter via xurl CLI: post, search, DM, media, v2 API.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fxurl\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":19},"01M785W98EDN4EFJXJPMQEHCRC","touchdesigner-mcp","Control a running TouchDesigner instance via twozero MCP — create operators, set parameters, wire connections, execute Python, build real-time visuals. 36 native tools.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftouchdesigner-mcp\u002FSKILL.md",[],[],{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":19},"01M785W5S9FP3QBH2V191E025P","test-driven-development","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftest-driven-development\u002FSKILL.md",[],[],{"skillNo":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":119,"categories":120,"keywords":121,"publishedAt":19},"01M785W2AS08NSSH9YATCV6FJB","teams-meeting-pipeline","Operate the Teams meeting summary pipeline via Hermes CLI — summarize meetings, inspect pipeline status, replay jobs, manage Microsoft Graph subscriptions.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fteams-meeting-pipeline\u002FSKILL.md",[],[],{"skillNo":123,"name":124,"nameZh":6,"description":125,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":126,"categories":127,"keywords":128,"publishedAt":19},"01M785VXKW4T34BTP1SCHW1R7F","systematic-debugging","4-phase root cause debugging: understand bugs before fixing.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fsystematic-debugging\u002FSKILL.md",[],[]]