To achieve immune and microbial homeostasis during adulthood, the developing immune system must identify which microbes to tolerate and which to defend against. We synthesize the existing literature to develop a mechanistic mathematical model representing the interplay between gut ecology and adaptive immunity in early life. Our results indicate that the inflammatory tone of the microenvironment is the mediator of information flow from pre- to post-weaning periods, addressing an enduring open question in the field. Our model also allows us to evaluate the power of postnatal fecal samples for predicting immunological trajectories; and to explore breastfeeding scenarios when maternal immunological conditions affect breastmilk composition. Our work establishes a quantitative basis to the concept of 'immune education', offering insights into questions of applied relevance.