Cognitive abilities can vary dramatically among species. The relative importance of social and ecological challenges in shaping cognitive evolution has been the subject of a long-running and recently renewed debate, but little work has sought to understand the selective dynamics underlying the evolution of cognitive abilities. Here, we investigate recent selection related to cognition in the paper wasp Polistes fuscatus-a wasp that has uniquely evolved visual individual recognition abilities. We generate high quality de novo genome assemblies and population genomic resources for multiple species of paper wasps and use a population genomic framework to interrogate the probable mode and tempo of cognitive evolution. Recent, strong, hard selective sweeps in P. fuscatus contain loci annotated with functions in long-term memory formation, mushroom body development, and visual processing, traits which have recently evolved in association with individual recognition. The homologous pathways are not under selection in closely related wasps that lack individual recognition. Indeed, the prevalence of candidate cognition loci within the strongest selective sweeps suggests that the evolution of cognitive abilities has been among the strongest selection pressures in P. fuscatus' recent evolutionary history. Detailed analyses of selective sweeps containing candidate cognition loci reveal multiple cases of hard selective sweeps within the last few thousand years on de novo mutations, mainly in noncoding regions. These data provide unprecedented insight into some of the processes by which cognition evolves.