system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: Why is it that baked good containing eggs like cookies don’t have to be refrigerated when eggs themselves or hard boiled eggs do?
gpt
Bacteria needs a specific environment to grow the following 6 things contribute to its growth
1. Food
2. Acid
3. Time
4. Temperature 
5. Oxygen
6. Moisture

Take away any of these factors (or add to much in the case of acid and temperature) and bacteria cannot grow. 
So a fresh egg has food (the egg itself), low ph level,  moisture (whether from humidity in the air or the egg itself) , and if sitting out oxygen and temperature also acting against it to help create a perfect environment for bacteria to grow.

Add that egg to a dough and bake it. For a cookie to rise you either use baking soda or baking powder, baking powder has a leavening agent as well as an acid to make it rise, baking soda needs to react with an acid to cause it to rise (usually cocoa powder in cookies but can also be numerous other ingredients) acid will help kill the bacteria although these small amounts aren't enough to make it safe. Baking does something else to that cookie it heats it up. Most bacteria die around 160 degrees feirnheight you bake your cookies at 350 feirnheight this kills any bacteria that may have been present in that egg/dough mixture. The baking process also takes away moisture and dry out the dough significantly. So we have added acid, added temperature and removed moisture. These 3 things inhibate the growth of that bacteria and allow you to keep your baked goods sitting on your counter.