The presence of immune memory at pathogen-entry sites is a prerequisite for protection. Nevertheless, the mechanisms that warrant immunity at peripheral interfaces are not understood. Here we show that the nonclassical major histocompatibility complex (MHC) class I molecule thymus leukemia antigen (TL), induced on dendritic cells interacting with CD8αα on activated CD8αβ(+) T cells, mediated affinity-based selection of memory precursor cells. Furthermore, constitutive expression of TL on epithelial cells led to continued selection of mature CD8αβ(+) memory T cells. The memory process driven by TL and CD8αα was essential for the generation of CD8αβ(+) memory T cells in the intestine and the accumulation of highly antigen-sensitive CD8αβ(+) memory T cells that form the first line of defense at the largest entry port for pathogens.