I don't know enough about how ActivityPub works to be sure, but I suspect the right way to archive a Lmy instance would be to create software that acts like another instance, federates with the one you want to archive, and saves the raw stream of ActivityPub packets.