| name | gmail-ai-draft |
| description | Draft Gmail replies in Fanani's real email style using Gog CLI + OpenClaw. Uses thread-aware triage, no extra Gmail labels, and mandatory Telegram notification after draft creation. |
Gmail AI Draft
Use this skill when Fanani wants help drafting replies to incoming Gmail messages.
This skill is for drafting only, not auto-send.
Core Rules
- Draft only. Never auto-send.
- Email tone is not blog tone.
- Use Fanani's real sent-mail style as the reference.
- Telegram notify is mandatory after every successful draft creation.
- Do not add extra Gmail labels by default.
- High-risk emails must be drafted conservatively and explicitly flagged in the summary.
Tone Rules
Observed style from real sent items:
- formal business-email tone
- direct and calm
- concise unless escalation is needed
- English for English support/business threads
- Indonesian for local vendor/client threads
- common openers:
Dear Pak ..., Dear Xendit Team, or equivalent formal opener
- closers:
Regards, / Best Regards,
- signature follows existing business signature style when relevant
- do not use blog-style first-person rules as a blanket requirement
- do not use AI fluff like
I hope this email finds you well
- never invent pricing, delivery time, commitments, or timelines
Risk Rules
Treat these as high-risk:
- pricing / quotation
- legal / contract
- bank / payment / transfer
- vendor disputes
- HR-sensitive or hiring-sensitive threads
- any email that requires facts not present in the thread
High-risk output behavior:
- still create draft if appropriate
- keep the draft conservative
- include explicit review note in Telegram summary
No-Reply Rules
Usually skip drafting for:
- newsletters
- OTP / receipt / no-reply senders
- pure system notifications
- promotional blasts
- threads already waiting on the other side after Fanani replied
Files in this skill
scripts/list-unread.sh
- list unread inbox candidates
scripts/thread_context.py
- normalize a Gmail thread into drafting context JSON
scripts/create_draft.sh
- create a Gmail draft reply from a body file
scripts/render_telegram_summary.py
- generate Telegram-ready summary text after draft creation
config/rules.json
references/sent-tone-notes.md
- tone notes captured from real sent items
Standard Workflow
1. List candidate emails
bash skills/gmail-ai-draft/scripts/list-unread.sh
2. Build thread context
python3 skills/gmail-ai-draft/scripts/thread_context.py --thread-id <THREAD_ID>
This returns normalized JSON with:
- latest inbound message id
- sender
- subject
- language guess
- company context guess
- risk guess
- recent thread snippets
3. Draft the reply with the assistant
Use the JSON context plus the tone rules in this skill.
Draft requirements:
- reply directly to the latest inbound message
- match thread language
- keep it concise
- include signature only when appropriate
- no hallucinated facts
4. Save the draft body to a temp file
Example:
cat > /tmp/reply.txt <<'EOF'
Dear Pak Anang,
Terima kasih atas informasinya.
...
Regards,
Zainul Fanani
EOF
5. Create Gmail draft in the same thread
bash skills/gmail-ai-draft/scripts/create_draft.sh \
--reply-to-message-id <MESSAGE_ID> \
--to "recipient@example.com" \
--subject "Re: Original Subject" \
--body-file /tmp/reply.txt
6. Send Telegram notification
After draft creation, render summary:
python3 skills/gmail-ai-draft/scripts/render_telegram_summary.py \
--context /tmp/thread-context.json \
--draft /tmp/draft-result.json
Then send that summary with the message tool.
Mandatory Telegram Summary Fields
Every successful draft notification should include:
- sender
- subject
- needs reply or not
- language
- risk level
- draft created status
- brief note if manual review is important
Implementation Notes
- Prefer Gog CLI for Gmail draft creation.
- Do not mutate Gmail labels unless Fanani explicitly asks.
- Keep the skill reusable for manual runs, heartbeat-triggered triage, or future cron jobs.
- If the thread is ambiguous, draft a short clarifying response instead of inventing specifics.
Safety
Never auto-send.
Never fabricate:
- prices
- delivery schedules
- legal positions
- payment confirmations
- technical commitments not already present in the thread