Yeah, it is a terrible work , as you have to combine Magento and Modx.
Besides hacking the core of both application , it is a good start to establish which application should be the master. I would nominate Magento as master , but there are a lot of issues that should be discussed. Anyway , please free to discuss about the matter as this is a snippet would be a major improvement for both applications.
Both systems have a clean and defined API, so its not that terrible.
The main stumbling block for me was how to marry the two session managements together so they both work and don’t interfere or cancel out each other. I had issues with the order how objects are instantiated and registered and when sessions are registered and started.
I believe MODx needs to provide hooks and an API to allow 3rd party sessions to be integrated into the session management (eg loading classes of session variables).