5
A couple of concepts introduced into X3 might suit for your requirements: event, plugin, service, module API
In terms of profile, the features are available in /usr/apps/user/class/gateway.php
Action que, done by service/event
Furthermore, X3 supports multi-engine and multi-library, Thus if you build your own libraries or engines, you can just add them without "hacking".