David Torno adds another installment to his Free Function Friday series walking through creating a function that will retrieve all primary compositions in an after-effects project file. Designated compassion can contain a variety of other elements other than just layers, such as other compositions, or as we know them, preComps.
The function will look for and return any composition that is not a preComp. David cites an example: if you happen to be working on a feature, the individual shot comps themselves could be primary compositions depending on your workflow.
You could use retrieve primary composition to track down the main commission timelines in an unorganized project, collect them all into a master folder, or even flag the master compositions for rendering at a later time.
Check out the complete article and tutorial for creating an after effects function to retrieve primary compositions.