@HasanCAD:
As I have mentioned before, the file bloat is caused by layerstates. As these are not exactly hidden from the user, there is no need for a special tool to remove them. But if you want to develop Lisp code: they are stored in the extension dictionary of the layers object.