Molecular barcoding has provided means to link genotype to phenotype, to individuate cells in single-cell analyses, to enable the tracking of evolving lineages, and to facilitate the analysis of complex mixtures containing phenotypically distinct lineages.To date, all existing approaches enable retrospective associations to be made between characteristics and the lineage harbouring them, but provide no path toward isolating or manipulating those lineages within the complex mixture. Here, we describe a strategy for creating functionalized barcodes that enable straightforward manipulation of lineages within complex populations of cells, either marking and retrieval of selected lineages, or modification of their phenotype within the population, including their elimination. These "SmartCodes" rely on a simple CRISPR-based, molecular barcode reader that can switch measurable, or selectable markers, on or off in a binary fashion. While this approach could have broad impact, we envision initial approaches to the study of tumour heterogeneity, focused on issues of tumour progression, metastasis, and drug resistance.