The chaos problem comes from me turning off view_in_darkroom if there are multiple images and they aren’t xmp files. I turn it back on for the last image and just display that in darkroom. The problem was that it was a mixed batch of images and xmp files. The solution is just to get rid of the xmp file lines earlier in the process so that I don’t have to deal with them and try and work around them.
I’ll make some changes and send an update.