keep your pocket clean
Go Makefile Shell


Build Status Coverage Status Code Climate Packagecloud GoDoc MIT license


This is a utility to keep your Pocket list small and manageable. It will archive all items in your list except for the newest n items.

WARNING: This will archive items. Something you can't just undo.


pocketcleaner keeps your pocket clean

  pocketcleaner [-d | --debug] [--keep=<keepCount>]
  pocketcleaner -h | --help | -v | --version

  -h --help          Show this screen.
  -d --debug         Show debug information.
  -v --version       Show version.
  --config=<config>  Config file to use
  --keep=<keepCount> Count of items to keep


Get auth tokens to use with pocketcleaner

Pocketcleaner doesn't come with any auth keys, so you will have to get your own. The following steps are taken from here.

1. Create an app in the developer portal

Make sure it has at least the retrieve and modify permissions.

2. Get a request token

curl -X POST \
-H "Content-Type: application/json" -H "X-Accept: application/json" \
-d '{"consumer_key":"your-key-here","redirect_uri":""}'

3. Authorize the app

Visit the following URL in your browser and authorize the app.

4. Convert request token to access token

curl -X POST \
-H "Content-Type: application/json" -H "X-Accept: application/json" \
-d '{"consumer_key":"your-key-here","code":"request-token"}'

5. Make sure the token works by getting a list of your saved items

curl -X POST -H "Content-Type: application/json" \
-H "X-Accept: application/json" \
-d '{"consumer_key":"your-key-here", "access_token":"access-token"}'

Install pocketcleaner

There are packages for linux up on but you can also just clone the repo and build the binary yourself.

go get
cd $GOPATH/src/


There is also a docker image on docker hub which you can use to run pocketcleaner like this:

docker pull mrtazz/pocketcleaner
docker run -i -e "POCKETCLEANER_CONSUMER_SECRET=your_secret" -e "POCKETCLEANER_ACCESS_TOKEN=your_token" --rm mrtazz/pocketcleaner


pocketcleaner reads the configuration file $HOME/.pocketcleaner.ini to get consumer key, access token, and the number of items to keep. The format looks like this:

consumer_key      = consumer-key
access_token      = access-token
keep_count        = 100