Insects in and around your compost are considered normal. The help breakdown compost. Fruit flies/gnats have a 1–3-month breeding season and are attracted to compost for a food source and breeding environment. They will disappear after that. It’s a normal part of aerobic composting. You can make the compost inaccessible to fruit flies/gnats by covering the top layer of compost with about 1″ of grass clippings or by using some old towels. Leave the cover off for 10 minutes or so to allow them to leave because they can’t access the food source.