See https://archivesspace.atlassian.net/wiki/spaces/ADC/blog/2015/03/15/18088140/Customizing+your+ArchivesSpace+EAD+importers+and+exporters for a nice overview about how to customize both the exporters and importers. This is just a simple example that shows how to add the ASpace database IDs to the archdesc and component elements, by way of the altrender attribute, during the EAD2002 export process.