Ecosystem engineers are organisms that modify their environment. They increase biodiversity by creating habitat for species other than themselves. The oak apple, caused by a tiny wasp called Biorhiza pallida, is just such an engineered environment.
The female wasp lays her eggs in the new-growing stem of an oak tree. The eggs’ chemistry hacks into the tree’s growth pattern and causes it to make a spherical gall: an oak apple. The oak apple grows around the eggs, forming many chambers in which the gall wasp larvae develop.
 Oak apple gall and  an oak cherry gall with a newly emerged Cynips quercusfolii
The gall attracts lodgers: wasps very like gall wasps that cannot create their own galls. So they do the next best thing and occupy somebody else’s gall. Biologists call such lodger-species inquilines, which comes from inquilinus: ‘lodger’ in Latin. Some inquiline species happily share the gall but others grow in the same chamber as the gall wasp larvae, eventually outgrowing and smothering their landlord.
Then come the parasitoid flies and wasps that try to penetrate the gall with their long ovipositors in order to lay an egg inside the growing larvae of either the original occupant or the lodger. The parasitoid’s larva will eat the wasp larva from the inside, leaving the vital organs until last, like some science fiction horror, ready to burst out of its host at any minute.
 An oak tree in spring, when it is forming oak apples and  squirrels avoid the bitter tannin rich galls
The ecosystem engineers are prepared for the parasitoids though: the shape of the oak apple puts at least some of the gall wasp larvae at the centre of the sphere, out of reach of the longest ovipositor, and the tree’s hacked growth system has been instructed to toughen the outer shell of the mature gall with lignin, the same compound that toughens the rest of the twig as it ages.
It’s not over yet. Woodland is full of fungi and if a fungus invades and decomposes the oak apple, none of the occupants will survive. The ecosystem engineers arrange a concentration in the oak apple of tannins, bitter chemicals that repel fungi and the many creatures that might eat the gall or break it open in search of the larvae inside.
An oak tree supports many different engineered micro-ecosystems, each as fragile and as important as the last.