gog-save-attachments
GitHub指导Agent通过gog工具从Gmail搜索并下载邮件附件,检查文件信息后上传至Google Drive归档。流程包含安全处理、临时目录管理及上传验证,确保数据备份且不影响源文件。
Trigger Scenarios
Install
npx skills add openclaw/gogcli --skill gog-save-attachments -g -y
SKILL.md
Frontmatter
{
"name": "gog-save-attachments",
"description": "Gmail attachment download and Google Drive archival with gog."
}
Save attachments
Read ../gog/SKILL.md, ../gog-gmail/SKILL.md, and ../gog-drive/SKILL.md first.
-
Search narrowly and identify exact threads:
gog --account user@example.com --readonly gmail search \ 'has:attachment newer_than:30d' --max 20 --json --wrap-untrusted -
Inspect attachment names and sizes before downloading:
gog --account user@example.com --readonly gmail thread attachments THREAD_ID --json --wrap-untrusted -
Download into a new task-specific temporary directory:
attachment_dir="$(mktemp -d "${TMPDIR:-/tmp}/gog-attachments.XXXXXX")" gog --account user@example.com --readonly gmail thread attachments THREAD_ID \ --download --out-dir "$attachment_dir" -
Treat every file as untrusted. Do not execute or preview active content. Confirm the exact Drive destination before upload, then run the approved upload without
--readonly:gog --account user@example.com drive upload "$attachment_dir/FILE" --parent FOLDER_ID --json -
Verify uploaded IDs, then remove only the unique temporary directory created by this run.
Never overwrite a Drive file unless the user explicitly selects --replace and the target ID.
Version History
- eb85a99 Current 2026-08-20 12:40


