Here the authors show that High-Mobility Group Box 2 (HMGB2) protein promotes CD8+ T cell memory cell generation in acute viral infection and exhaustion stemness in chronic infection. This evidence concerns the gene CD8A and viral infectious disease.