Gmail unsubscribe sweep
Louie marks senders Unsubscribe or Keep on a triage page (an artifact
whose database holds his choices). Each run acts on those choices, sweeps the
past week for new senders, sorts them into tiers, and republishes the page.
All the mechanics run in unsub, never by hand in context: Gmail search
paging, raw headers, unsubscribe requests, state. Once per conversation, after
session-init:
bash "$(ls -1dt /mnt/skills/*/gmail-unsub ~/.claude/skills/synced/*/gmail-unsub 2>/dev/null | head -1)/setup.sh"
That lookup is deliberate: chat keeps skills under /mnt/skills/, Cowork and
cloud Claude Code under ~/.claude/skills/synced/<bucket>/. It puts unsub on
PATH. Never re-derive the path. Run every unsub command from the same
directory, since its working files go in ./unsub-work/.
Louie's rules come first
cfs read /drafts/gmail-unsub/README.md and read it in full before anything
else. Its standing rules override anything here. As of writing:
- Never send a mailto unsubscribe. Only one-click and header web links.
- Never unsubscribe from recruiters, and never list them.
- Skip anything that needs a login, a form or a click. Don't chase it.
- Keep isn't permanent. A kept sender that mails again shows under
"Previously kept" so he can flip it.
When he states a new rule, add it there, dated.
The run
unsub state pull downloads the newest snapshot from
/drafts/gmail-unsub/state/<date>/ and prints the last run date and the
page's artifact URL.
Read his choices. Use ArtifactData list, with that artifact URL,
collection decisions, query: {"limit": 1000}, and
out_dir: "<cwd>/unsub-work/dec". The choices land as files, not in
context.
unsub sweep --after <last run minus 3 days, YYYY-MM-DD>. The 3-day
overlap covers a late or missed run; senders it has already seen cost
nothing. If the sweep reports failed header fetches, rerun it once.
unsub plan prints how many unsubscribes are due, then one line per
new sender to judge (key, count, address, recent subjects).
Judge the new senders. Write unsub-work/tiers.json as
{"<key>": {"tier": "...", "why": "..."}}, with an entry for every listed
key:
junk: promos, sale blasts, surveys, onboarding drips, win-backs. No
account role.
maybe: depends on whether he uses the product, holds the account or
wants the content. Product news for tools he uses, loyalty programs,
alumni and community lists. When unsure, use maybe.
keep: transactional, security or account mail that landed in
Promotions. Refunds, login alerts, statements, prescription refills.
exclude: recruiters and anything else a rule says never to list.
Judge from the name, address and subjects alone; don't open the emails.
why is one plain line, shown under the sender on the page. A sender sent
from a random domain that impersonates a brand gets junk with a why that
says so. To re-tier a sender he says is misfiled, add its key here too.
unsub act sends the due unsubscribes (4 at a time) and prints every
one that didn't go through, with the reason. No approval is involved.
One-click results are mechanical: a 2xx response means accepted. A header
web link was only visited, so it prints REVIEW with the page's text. Read
each one and record your verdict:
unsub resolve <key> accepted # the page says it's done
unsub resolve <key> skipped "needs a button click" # anything still to do
It counts as accepted only when the page itself confirms the unsubscribe
and nothing is left to click. A button, a form, a login, a preferences page,
or an empty JavaScript shell all mean skipped. Never click through.
finalize refuses to run while any page is unresolved.
unsub finalize --artifact <url> writes the new state to
unsub-work/new/ and the page to unsub-work/triage.html.
Message Louie (SendUserMessage in a scheduled run). Keep it short:
- how many unsubscribed, plus any failures and skips by name with the
reason;
- any senders under "Still mailing";
- how many new senders are waiting, by tier.
If nothing happened and nothing is new, say so in one line.
unsub state push saves the snapshot to state/<today>/. It never
overwrites, so each run is a dated record (the attempt log is log.jsonl
inside it).
Republish the page last. It is an artifact from another conversation,
so first Artifact read it with url and path: "index.html" (that
counts as reading it, and saves the page to a file instead of context).
Then publish unsub-work/triage.html with that url. Omit icon and
capabilities so the page keeps its database.
How state works
- His choices live in the page's database (
decisions/<key> =
{d: "kill"|"keep"}). Only he writes them.
- Everything else lives in the store, one dated folder per run:
registry.json (every sender seen: tier, why, unsubscribe method, newest
URL), status.json (what was done to each: unsubscribed / failed / skipped,
when, and with which URL), the sweep, a decisions snapshot, the log, and the
page data.
- Retries are deliberate. A failed sender is retried only when a newer
email brings a different URL. A skipped one is never retried. An
unsubscribed sender still mailing more than 14 days later gets exactly one
retry with the newest URL. After that it stays on the page under "Still
mailing" for him to deal with.
- Unsubscribed senders drop off the page. One that keeps mailing past the
grace period comes back under "Still mailing".
The key for a sender is its lowercased address as Gmail reports it. For
SimpleLogin reverse aliases that is the alias address, and the page shows the
real sender.
What not to do
- Don't open emails or paste raw headers into context.
unsub keeps them on
disk.
- Don't mark mail as spam, create filters or send anything. This skill only
sends unsubscribe requests.
- Don't redo a whole sweep's tiers. Existing tiers stand unless he asks.
- If a Gmail read comes back needing approval (
unsub stops and says so),
stop and report it. The connector's read tools have to be always-allow.
1---2name: gmail-unsub3description: "Weekly Gmail unsubscribe sweep for Louie: act on the choices he made on his triage page with one-click unsubscribes, sweep Promotions and Social for new senders, judge them into tiers, and republish the page. Use for the Monday scheduled run, or when he asks to run the unsubscribe sweep, unsubscribe from what he picked, or refresh the unsubscribe page."4metadata:5 source: https://skillmd.com/skills/louietyj/gmail-unsub6---78# Gmail unsubscribe sweep910Louie marks senders **Unsubscribe** or **Keep** on a triage page (an artifact11whose database holds his choices). Each run acts on those choices, sweeps the12past week for new senders, sorts them into tiers, and republishes the page.1314All the mechanics run in `unsub`, never by hand in context: Gmail search15paging, raw headers, unsubscribe requests, state. Once per conversation, after16`session-init`:1718```bash19bash "$(ls -1dt /mnt/skills/*/gmail-unsub ~/.claude/skills/synced/*/gmail-unsub 2>/dev/null | head -1)/setup.sh"20```2122That lookup is deliberate: chat keeps skills under `/mnt/skills/`, Cowork and23cloud Claude Code under `~/.claude/skills/synced/<bucket>/`. It puts `unsub` on24PATH. **Never re-derive the path.** Run every `unsub` command from the same25directory, since its working files go in `./unsub-work/`.2627## Louie's rules come first2829`cfs read /drafts/gmail-unsub/README.md` and read it in full before anything30else. Its standing rules override anything here. As of writing:3132- **Never send a mailto unsubscribe.** Only one-click and header web links.33- **Never unsubscribe from recruiters**, and never list them.34- **Skip anything that needs a login, a form or a click.** Don't chase it.35- **Keep isn't permanent.** A kept sender that mails again shows under36 "Previously kept" so he can flip it.3738When he states a new rule, add it there, dated.3940## The run41421. **`unsub state pull`** downloads the newest snapshot from43 `/drafts/gmail-unsub/state/<date>/` and prints the last run date and the44 page's artifact URL.45462. **Read his choices.** Use `ArtifactData` `list`, with that artifact URL,47 collection `decisions`, `query: {"limit": 1000}`, and48 `out_dir: "<cwd>/unsub-work/dec"`. The choices land as files, not in49 context.50513. **`unsub sweep --after <last run minus 3 days, YYYY-MM-DD>`**. The 3-day52 overlap covers a late or missed run; senders it has already seen cost53 nothing. If the sweep reports failed header fetches, rerun it once.54554. **`unsub plan`** prints how many unsubscribes are due, then one line per56 new sender to judge (key, count, address, recent subjects).57585. **Judge the new senders.** Write `unsub-work/tiers.json` as59 `{"<key>": {"tier": "...", "why": "..."}}`, with an entry for every listed60 key:61 - `junk`: promos, sale blasts, surveys, onboarding drips, win-backs. No62 account role.63 - `maybe`: depends on whether he uses the product, holds the account or64 wants the content. Product news for tools he uses, loyalty programs,65 alumni and community lists. **When unsure, use `maybe`.**66 - `keep`: transactional, security or account mail that landed in67 Promotions. Refunds, login alerts, statements, prescription refills.68 - `exclude`: recruiters and anything else a rule says never to list.6970 Judge from the name, address and subjects alone; don't open the emails.71 `why` is one plain line, shown under the sender on the page. A sender sent72 from a random domain that impersonates a brand gets `junk` with a why that73 says so. To re-tier a sender he says is misfiled, add its key here too.74756. **`unsub act`** sends the due unsubscribes (4 at a time) and prints every76 one that didn't go through, with the reason. No approval is involved.77 One-click results are mechanical: a 2xx response means accepted. A header78 web link was only visited, so it prints `REVIEW` with the page's text. Read79 each one and record your verdict:8081 ```bash82 unsub resolve <key> accepted # the page says it's done83 unsub resolve <key> skipped "needs a button click" # anything still to do84 ```8586 It counts as accepted only when the page itself confirms the unsubscribe87 and nothing is left to click. A button, a form, a login, a preferences page,88 or an empty JavaScript shell all mean skipped. Never click through.89 `finalize` refuses to run while any page is unresolved.90917. **`unsub finalize --artifact <url>`** writes the new state to92 `unsub-work/new/` and the page to `unsub-work/triage.html`.93948. **Message Louie** (`SendUserMessage` in a scheduled run). Keep it short:95 - how many unsubscribed, plus any failures and skips by name with the96 reason;97 - any senders under "Still mailing";98 - how many new senders are waiting, by tier.99100 If nothing happened and nothing is new, say so in one line.1011029. **`unsub state push`** saves the snapshot to `state/<today>/`. It never103 overwrites, so each run is a dated record (the attempt log is `log.jsonl`104 inside it).10510610. **Republish the page last.** It is an artifact from another conversation,107 so first `Artifact` `read` it with `url` and `path: "index.html"` (that108 counts as reading it, and saves the page to a file instead of context).109 Then publish `unsub-work/triage.html` with that `url`. Omit `icon` and110 `capabilities` so the page keeps its database.111112## How state works113114- **His choices** live in the page's database (`decisions/<key>` =115 `{d: "kill"|"keep"}`). Only he writes them.116- **Everything else** lives in the store, one dated folder per run:117 `registry.json` (every sender seen: tier, why, unsubscribe method, newest118 URL), `status.json` (what was done to each: unsubscribed / failed / skipped,119 when, and with which URL), the sweep, a decisions snapshot, the log, and the120 page data.121- **Retries are deliberate.** A failed sender is retried only when a newer122 email brings a different URL. A skipped one is never retried. An123 unsubscribed sender still mailing more than 14 days later gets exactly one124 retry with the newest URL. After that it stays on the page under "Still125 mailing" for him to deal with.126- **Unsubscribed senders drop off the page.** One that keeps mailing past the127 grace period comes back under "Still mailing".128129The key for a sender is its lowercased address as Gmail reports it. For130SimpleLogin reverse aliases that is the alias address, and the page shows the131real sender.132133## What not to do134135- Don't open emails or paste raw headers into context. `unsub` keeps them on136 disk.137- Don't mark mail as spam, create filters or send anything. This skill only138 sends unsubscribe requests.139- Don't redo a whole sweep's tiers. Existing tiers stand unless he asks.140- If a Gmail read comes back needing approval (`unsub` stops and says so),141 stop and report it. The connector's read tools have to be always-allow.