Kindlegen, Kindle Comic Creator and Kindle Previewer add the source files used in compiling the kindle ebook as one of the (invisible) records in the kindle ebook.

So I wrote a python script that strips out the sources record from Kindle format ebooks. And for those on Macs I wrote a nice Applescript wrapper and also put the python script in the AppleScript bundle to make things easy.

Kevin Hendricks has since updated the code to handle files from KindleGen 2.x, and I've also tweaked a bit more to handle KindleGen 2.7.

If you're going to upload to the Amazon store, this script is usually unnecessary, as Amazon will strip the sources before delivery anyway.

Do not use this script to make files to be uploaded to KDP, unless you have to because of size constraints on uploaded

Kindlegen now includes the option to not add the source files to the end of the generated book. So if you're using Kindlegen and want a file without the sources added, don't use KindleStrip, but specify this option in Kindlegen to get guaranteed correctly formatted books.

If you're on a Mac you only need the Applescript, as it includes the Python script in it. The Applescript is a simple drag&drop operation — drag your KindleGen generated file onto it, and it creates one named [oldname]_stripped.mobi.