Normalize agent, and fix mkdir concurrency.
Rename export to xml.
Multiple improvements; separate cli/server

- Addition of usage as library (uses /server)
- Separation of cli and server.
- Format detection using slicing.
Rename src to lib