Engagement of the costimulatory molecule ICOS in tissues promotes establishment of CD8+ tissue-resident memory T cells.