One of the features I like about Mastodon is automated post deletion, where posts you make are removed after a set period of time. You can add exceptions, such as pinned posts or those that reached a certain level of engagement. I don't actually use the feature, but I understand why it exists. We're living in a time where privacy and social media could not be farther apart. Every quip we make on the internet is fodder for future employers or, in certain circumstances, the general public to analyze and cherry pick. Mastodon's philosophy is that you can choose whether to have those posts live on, or to remain ephemeral.[1]

Bluesky appears to be the chosen successor after Twitter's[2] collapse into an echo chamber for bots, scammers, right-wing personalities, and those too afraid of change to admit it is dominated by those other three groups. User created content is an asset, so they don't exactly want to provide a means to periodically delete it. They use it to capture more eyeballs for (eventual) advertisers, and discovering old posts keeps the engagement numbers up.

A friend of mine had tried to get various other third-party projects to fill in the gap without much success. She really wanted to reduce her digital footprint these days. Having previously worked with Twitter's API to do something similar, I wrote my own in Go.

Using the script

Set up is straightforward. You'll need golang installed on the machine that you'll use to run the cleanup script.

Step 1: Clone the repository

git clone https://github.com/stephenyeargin/bskycleanup.git
cd bskycleanup

Step 2: Create the configuration

cp example.config.json config.json

Step 3: Update the configuration with the correct values[3]

{
  "handle": "your-handle",
  "password": "your-app-password",
  "baseURL": "https://bsky.social/xrpc",
  "dayCount": 30
}
  • handle is your login to Bluesky. Likely either <username>@bsky.social or your domain name
  • password is that app password rather than your login password. See Privacy and Security > App passwords to create one.
  • baseUrl is most likely the default value above, https://bsky.social/xrpc
  • dayCount is how many days worth of posts you want to keep

Step 4: Run the script

go run bskycleanup.go

If everything works correctly, you should see something like:

Deleted record: at://did:plc:sm6y24btbwbevwgw3umxm6nc/app.bsky.feed.post/3lnodoyrtkk2b
Total posts deleted: 1
Total posts skipped (newer than 30 days): 4

Step 5: (Optional) Automate with GitHub Actions

  1. Fork the repository
  2. Set the following GitHub Action Secrets with the same values from above. The action creates a config.json file on the fly.
    • BSKY_BASE_URL: The base URL for the Bluesky API (e.g., https://bsky.social/xrpc).
    • BSKY_HANDLE: Your Bluesky handle.
    • BSKY_PASSWORD: Your Bluesky app password.
    • BSKY_DAY_COUNT: Number of days to keep.
  3. Run the Workflow manually via Actions > Daily Cleanup > Run workflow to verify the above settings work correctly

Closing thoughts

Maybe Bluesky will add its own version of post deletion (or at least, ephemeral posts). Until then, this is a straightforward way to accomplish that goal. Everyone, myself included, should be cautious of what all we're leaving on the Internet.

Future ideas that aren't implemented yet:

  • Dry-run mode to see what would be deleted
  • A way to set a threshold for keeping a post (number of likes, re-posts, etc.)
  • Interactive mode to pick and choose posts to keep

  1. I will note here that deleting something from the internet does not make it go away because archiving tools do a decent job of grabbing content from even the quiet corners of the web. ↩︎

  2. I refuse to acknowledge the name ever changed. ↩︎

  3. See notes on third-party tools to create an App Password. ↩︎