agentleFS
readdlereaddle/spark-cli-skills/skills/recipe-unsubscribe-audit/SKILL.md

spark-recipe-unsubscribe-audit

Skill149 starsChanged 7 months agoMITView on GitHub

Full unsubscribe audit: scan inbox, archive, and GateKeeper for newsletter senders, classify by volume and engagement, detect phishing and duplicate subscriptions, then unsubscribe via spark action or extracted footer links.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Prerequisite: Read the use-spark base skill for command reference and filter syntax.

    line 19
  2. Distinctive:

    When the same newsletter arrives 2+ times, do NOT assume two subscriptions:

    line 60
  3. Very specific:

    If the command is unavailable in the installed CLI version or the sender has no List-Unsubscribe mechanism, fall back to footer-link …

    line 74
  4. Distinctive:

    Run this recipe quarterly.

    line 110

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Recipe: Unsubscribe Audit

Audit every newsletter pool, recommend unsubscribe candidates backed by engagement data, and execute only after the user approves the list. Spark supplies the data (senders, volumes, read flags, bodies); the agent owns classification, duplicate verification, and execution.

Prerequisite: Read the use-spark base skill for command reference and filter syntax.

Access level required: triage.

Steps

Step 1: Scan all three pools

An inbox-only scan misses most of the volume. Check all three:

# Unified inbox, all accounts (paginate to get everything)
spark emails Inbox --filter "category:newsletter newer_than:30d" --page-size 100

# Auto-archived mail — Gmail filters/automations often skip the inbox
# entirely; repeat per Gmail-backed account. This pool can be the largest.
spark emails "user@gmail.com:Archive" --filter "category:newsletter newer_than:14d" --page-size 100

# GateKeeper queue — new senders held outside the inbox view
spark emails Inbox --new-senders --page-size 50

Step 2: Aggregate and classify

Count per sender: emails per 30 days and unread rate (from the Flags column). Classify into tiers:

TierSignalAction
UnsubscribePure marketing/drip, ~100% unreadRecommend removal
ConsiderHigh volume, partial engagementUser's call; suggest digest or auto-summary
KeepMostly readLeave alone
TransactionalInvoices, PINs, order/security noticesExclude from the audit
PhishingSee belowMark as spam — NEVER unsubscribe
App-nagInstagram/LinkedIn-style notification mailFix in the app's notification settings

Phishing tripwire: brand name in the display name but an unrelated sender domain (e.g. "SpotifyUS" from mail@jhbuilder.com), urgent billing/security subjects. Clicking anything — including unsubscribe — confirms the address is live. Flag prominently; recommend mark-as-spam instead. The same applies to everything already in the Spam folder: never unsubscribe there.

Present the classification and wait for the user to confirm or amend the list before acting. Expect them to rescue a few senders.

Step 3: Verify duplicate copies before acting

When the same newsletter arrives 2+ times, do NOT assume two subscriptions:

  1. Compare To: headers of the copies via spark thread <id>. Different addresses → genuinely separate subscriptions; unsubscribe the unwanted copy using the link from that specific copy (tokens are per-subscription).
  2. Substack: decode the https://substack.com/redirect/2/<base64url-JSON> unsubscribe link; the payload's u field is the subscription ID. Same u in both copies → one subscription delivered twice (alias/forward). Unsubscribing kills it entirely — report instead of acting.
  3. Same To:, same account (e.g. Patreon) → same situation; skip and report.

Step 4: Unsubscribe approved senders

For each approved sender, try Spark's built-in mechanism first:

spark action unsubscribe <id>

If the command is unavailable in the installed CLI version or the sender has no List-Unsubscribe mechanism, fall back to footer-link extraction:

spark thread <id> > /tmp/unsub/<id>.txt
grep -i -o 'https://[^][ )(>"<]*' /tmp/unsub/<id>.txt | grep -i 'unsub\|optout\|opt-out\|preference\|darse de baja'

Then complete each link in a browser (agent-driven browser automation or hand the list to the user). Browser rules: one-click confirmations are common; preference centers need "unsubscribe from all marketing" + save; never type personal data (pre-filled email fields are fine); login walls, captchas, and errors → record as blocked and move on. Footers vary by language and ESP — if the pattern misses, read the last ~25 lines of the body and pick the actual unsubscribe link, not adjacent tracking links.

For senders that should be blocked entirely (cold outreach, spam-adjacent):

spark contact-action blockContact spammer@example.com
spark contact-action blockDomain example.com

Step 5: Tame the keepers

For high-volume senders the user keeps:

spark contact-action enableAutosummaryForContact newsletter@example.com
spark contact-action groupEmailsFromContact sender@example.com

Step 6: Report

Summarize: senders removed, emails/month saved, blocked items with manual next steps, app-nag senders to fix in-app, phishing marked as spam, and duplicates that need account-level fixes (e.g. Substack account settings, forwarding rules).

Tips

  • Engagement data makes recommendations credible: "30 emails/month, 100% unread" beats "looks like marketing".
  • Shell loops abort on a failing grep — dump pages to temp files first, parse second, and append || true.
  • Click-tracker redirect links (SendGrid, Braze, e.zoom.us, klclick, webengage) are fine — the browser follows them to the real unsubscribe page.
  • Sendy footers contain both /l/... (tracking) and /unsubscribe/... links — pick the latter.
  • unsubscribe via the mailing list's own mechanism is cleaner than blocking; reserve blockContact/blockDomain for senders that ignore unsubscribes.
  • Run this recipe quarterly; subscriptions regrow.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.