Back up the user's Cowork skills, plugins and Claude docs folder to the user's own Google Drive, after showing exactly what will be uploaded and getting a yes. Use for "back up my session", "/backup-now", or a scheduled task the user created.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Session Backup?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/msapps-mobile-session-backup)
---
name: daily-cowork-backup
description: Back up the user's Cowork skills, plugins and Claude docs folder to the user's own Google Drive, after showing exactly what will be uploaded and getting a yes. Use for "back up my session", "/backup-now", or a scheduled task the user created.
---
# Cowork backup to your own Google Drive
Zips three folders and uploads them to a Google Apps Script web app **that the user deployed to their own Google account** (see CONNECTORS.md). Nothing else is sent anywhere.
## Rules (always apply)
- **Confirm first.** Before the first upload of a run, list the zip files that will be uploaded (names and sizes) and the destination host, and wait for the user to say yes. In a scheduled task the user created for this purpose, that task is the standing yes for the same three zips; do not add other files.
- **Never delete the user's files.** This skill deletes only the temporary zips and the temp directory it created itself in this run.
- **Never read or upload credentials.** Do not read `~/.cowork-gdrive-config.json`, `.env`, keychains, shell profiles or any token file. The upload URL and API key come only from the plugin options (`upload_url`, `api_key`), exposed to `scripts/upload.py` as environment variables.
- **Never write** to shell profiles, git config, package files or Claude settings, and never create launchd/cron jobs. Scheduling is done by the user in Cowork's Scheduled tasks (Step 0 of `/backup-setup`) and removed there.
## Step 1: Locate sources
```bash
SESSION_MNT=$(ls -d /sessions/*/mnt 2>/dev/null | head -1) # Cowork VM; empty on a plain Mac
echo "SESSION_MNT=${SESSION_MNT:-<none, using home directory>}"
```
Sources (skip any that do not exist, and say so in the report):
| Zip | Source |
|---|---|
| `skills-backup.zip` | `$SESSION_MNT/.claude/skills/` (or `~/.claude/skills/`) |
| `claude-docs-backup.zip` | `$SESSION_MNT/Claude/` (or `~/Documents/Claude/`) |
| `plugins-backup.zip` | `$SESSION_MNT/.remote-plugins/` (or `~/.claude/plugins/`) |
## Step 2: Build zips in a private temp directory
```bash
WORK=$(mktemp -d "${TMPDIR:-/tmp}/cowork-backup.XXXXXX")
EXCLUDES=(-x '*/node_modules/*' -x '*/.git/*' -x '*/.next/*' -x '*.pyc'
-x '*.png' -x '*.jpg' -x '*.jpeg' -x '*.gif' -x '*/package-lock.json'
-x '*/credentials/*' -x '*/.env' -x '*/.env.*' -x '*.pem' -x '*.key'
-x '*/.netrc' -x '*/id_rsa*' -x '*cowork-gdrive-config.json')
cd "<parent of the source folder>" && zip -r "$WORK/skills-backup.zip" skills/ "${EXCLUDES[@]}"
```
Repeat for the docs folder and the plugins folder with their zip names. The exclusions keep credential-like files and the backup config out of every zip. If `claude-docs-backup.zip` is over 30 MB, split it into `claude-docs-gcalmcp.zip` (the `gcal-mcp/` subfolder) and `claude-docs-rest.zip` (everything else), using the same exclusions.
## Step 3: Confirm, then upload
Show `ls -lh "$WORK"/*.zip` and the destination host (`script.google.com`), get the yes, then run:
```bash
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/upload.py" "$WORK"/*.zip
```
`upload.py` refuses any host other than `script.google.com` / `script.googleusercontent.com`, uploads only `.zip` files into the `Cowork-Backups` Drive folder with `replaceExisting: true`, and prints each JSON result. In the Cowork VM, where the proxy blocks `script.google.com`, run the same command on the Mac side through Desktop Commander. If an upload fails with 413, split that zip and retry.
## Step 4: Clean up (only what this run created)
```bash
rm -f "$WORK"/*.zip && rmdir "$WORK"
```
## Step 5: Report
List each uploaded file with its Drive link from the JSON response, and note any source that was skipped.
## Notes
- Each run is idempotent: `replaceExisting: true` overwrites the previous backup.
- Excluded on purpose: `node_modules`, `.git`, build caches, images, lock files, and anything credential-like (see the list above).