A multitude of factors affect the assemblies of complex microbial communities associated with animal hosts, with implications for community flexibility, resilience, and long-term stability; however, their relative effects have rarely been deduced. Here, we use a tractable lab model to quantify the relative and combined effects of parental transmission (egg case microbiome present/reduced), gut inocula (cockroach versus termite gut provisioned), and varying diets (matched or unmatched with gut inoculum source) on gut microbiota structure of hatchlings of the omnivorous cockroach Shelfordella lateralis using 16S rRNA gene (rDNA) amplicon sequencing. We show that the presence of a preexisting bacterial community via vertical transmission of microbes on egg cases reduces subsequent microbial invasion, suggesting priority effects that allow initial colonizers to take a strong hold and which stabilize the microbiome. However, subsequent inoculation sources more strongly affect ultimate community composition and their ecological networks, with distinct host-taxon-of-origin effects on which bacteria establish. While this is so, communities respond flexibly to specific diets in ways that consequently impact predicted community functions. In conclusion, our findings suggest that inoculations drive communities toward different stable states depending on colonization and extinction events, through ecological host-microbe relations and interactions with other gut bacteria, while diet in parallel shapes the functional capabilities of these microbiomes. These effects may lead to consistent microbial communities that maximize the extended phenotype that the microbiota provides the host, particularly if microbes spend most of their lives in host-associated environments.
IMPORTANCE When host fitness is dependent on gut microbiota, microbial community flexibility and reproducibility enhance host fitness by allowing fine-tuned environmental tracking and sufficient stability for host traits to evolve. Our findings lend support to the importance of vertically transmitted early-life microbiota as stabilizers, through interactions with potential colonizers, which may contribute to ensuring that the microbiota aligns within host fitness-enhancing parameters. Subsequent colonizations are driven by microbial composition of the sources available, and we confirm that host-taxon-of-origin affects stable subsequent communities, while communities at the same time retain sufficient flexibility to shift in response to available diets. Microbiome structure is thus the result of the relative impact and combined effects of inocula and fluctuations driven by environment-specific microbial sources and digestive needs. These affect short-term community structure on an ecological time scale but could ultimately shape host species specificities in microbiomes across evolutionary time, if environmental conditions prevail.