During multicellular development, spatial position and lineage history play powerful roles in controlling cell fate decisions. Using a serine integrase–based recording system, we engineered cells to record lineage information in a format that can be read out in situ. The system, termed integrase-editable memory by engineered mutagenesis with optical in situ readout (intMEMOIR), allowed in situ reconstruction of lineage relationships in cultured mouse cells and flies. intMEMOIR uses an array of independent three-state genetic memory elements that can recombine stochastically and irreversibly, allowing up to 59,049 distinct digital states. It reconstructed lineage trees in stem cells and enabled simultaneous analysis of single-cell clonal history, spatial position, and gene expression in Drosophila brain sections. These results establish a foundation for microscopy-readable lineage recording and analysis in diverse systems.