Is there any documentation for vz modules (or a sample module I can look at the source for)?

I need a hook to run on the HN after a VE is started. It seems there is in-built support to run a script in the newly started VE, but not on the HN. Looking at the source of vzctl, it appears that writing a module might be a way forward.

Many thanks for any help.