Manage your Gmail inbox from Claude Code. List, read, triage, reply, send, and create filters.
Read, triage, reply, and send emails from your Gmail inbox via Claude Code.
The Gmail CLI reads credential paths from environment variables, loaded from the AIOS .env via AIOS_DIR. Every command MUST use this prefix:
AIOS_DIR="/Users/nikoatlija/Claude Code/liam_ottley_aios"
Your .env should contain:
GOOGLE_CREDS_PATH=~/.config/gmail/credentials.json
GMAIL_TOKEN_PATH=~/.config/gmail/token.json
If these aren't set, the script falls back to ~/.config/gmail/credentials.json and ~/.config/gmail/token.json.
AIOS_DIR="/Users/nikoatlija/Claude Code/liam_ottley_aios" ~/.venv/bin/python3 ~/.config/gmail/gmail.py list --all
Returns JSON array grouped by thread. Each entry has: id, threadId, from, subject, date, snippet, unread, thread_count. If thread_count > 1, also includes all_ids.
This is the default command. Always use --all unless the user specifically asks for a time-filtered view.
AIOS_DIR="/Users/nikoatlija/Claude Code/liam_ottley_aios" ~/.venv/bin/python3 ~/.config/gmail/gmail.py list --hours 48
AIOS_DIR="/Users/nikoatlija/Claude Code/liam_ottley_aios" ~/.venv/bin/python3 ~/.config/gmail/gmail.py read <msg_id>
AIOS_DIR="/Users/nikoatlija/Claude Code/liam_ottley_aios" ~/.venv/bin/python3 ~/.config/gmail/gmail.py move <msg_id> "Label Name"
AIOS_DIR="/Users/nikoatlija/Claude Code/liam_ottley_aios" ~/.venv/bin/python3 ~/.config/gmail/gmail.py labels
AIOS_DIR="/Users/nikoatlija/Claude Code/liam_ottley_aios" ~/.venv/bin/python3 ~/.config/gmail/gmail.py reply <msg_id> "Your reply body here"
AIOS_DIR="/Users/nikoatlija/Claude Code/liam_ottley_aios" ~/.venv/bin/python3 ~/.config/gmail/gmail.py reply <msg_id> "Your reply body here" --attachments "/path/to/file1.pdf,/path/to/file2.png"
AIOS_DIR="/Users/nikoatlija/Claude Code/liam_ottley_aios" ~/.venv/bin/python3 ~/.config/gmail/gmail.py send "[email protected]" "Subject here" "Body here"
AIOS_DIR="/Users/nikoatlija/Claude Code/liam_ottley_aios" ~/.venv/bin/python3 ~/.config/gmail/gmail.py send "[email protected]" "Subject" "Body" --attachments "/path/to/file.pdf"
AIOS_DIR="/Users/nikoatlija/Claude Code/liam_ottley_aios" ~/.venv/bin/python3 ~/.config/gmail/gmail.py filter --from "[email protected]" --label "LabelName" --archive --read
--from / --to / --subject / --query for criteria--label to apply a label, --archive to skip inbox, --read to mark as read, --trash to trashAIOS_DIR="/Users/nikoatlija/Claude Code/liam_ottley_aios" ~/.venv/bin/python3 ~/.config/gmail/gmail.py filters
AIOS_DIR="/Users/nikoatlija/Claude Code/liam_ottley_aios" ~/.venv/bin/python3 ~/.config/gmail/gmail.py auth
list --all to show all inbox emailsmove for each, confirm resultsUse a proper markdown table for the inbox:
| # | Unread | From | Subject | Replies | Time |
|---|---|---|---|---|---|
| 1 | * | [email protected] | Re: Project update | 3 | 2h ago |
| 2 | [email protected] | Your weekly digest | 1 | 5h ago |
thread_count (1 = single message, 2+ = thread)If credentials.json is missing:
~/.config/gmail/credentials.jsonauth command (see above)credentials.json missing, show setup instructions abovetoken.json missing, run auth automatically