It's a hacky shell script for OSX to make the process almost invisible to the user without using in-house mail servers or writing network facing daemons. When users launch their mail app it also launches the script (and mail console applescript) that command line fetches mail, decrypts and inserts into mail.app db, looks through msgs for new public keys and extracts them, updates contacts automatically with GoogleCL and gpgtools, then starts offline mail client to view/reply as they normally would. The script then fetches outgoing mail, gpgtools encrypts it according to destination, verifies it and sends.
GPG key ID is automatically inserted into contacts https://code.google.com/p/googlecl/ so when the user deletes a contact the script reads the KeyID and removes it from the keyring as well. It had to be Google contacts it wasn't my decision. Nobody wanted to change their mail app workflow and they couldn't figure out gpgtools/gpg suite so this poor scheme was devised but it works.
The janky part comes when the script checks mail console logs to detect no connection errors when users req to fetch new mail (and suppress popup notifications of this) so they don't have to push a second button to do it outside set intervals that fetch automatically. For some reason it was important that no other buttons existed to fetch new mail. There's probably a Claws Mail plugin that can be written to accomplish all this too if users were willing to switch apps, mutt will do most of it automatically and can be abstracted to make it invisible, or script OpenSMTPD to do this.
I was thinking the opposite--most shell scripts seem to exist to show off arcane knowledge rather than document a task in the most straightforward way possible.