How can I tidy up an auto increment field in a table from within a module?
You should never do that since the IDs are important for addressing to that specific row in other tables. You would never know which modules are also indexed this row with its id. So if you change the ID of a row, you will encounter unexpected things in your installation.