how to create a new type of "group"

Hello experts,

I am trying to create a new 'group' on elgg. It should have similar functions like the existing 'group', but with small variations.

I read the Elgg document and it recomments to use the ElggGroup entity. I am adding a new group type, for example 'new_group' as a pluggin. However, I noticed that there are certain functions defined for the original group, such as group_gatekeeper under lib/group.php.

My question is: what is the recommended practice to create a new  type of 'grouup'? Should I add my new_group.php under the engine/lib/ in addition to a new pluggin under /mod/?

 

Many thanks for your help!