Bacteria can be engineered to function as diagnostics or therapeutics in the mammalian gut but commercial translation of technologies to accomplish this has been hindered by the susceptibility of synthetic genetic circuits to mutation and unpredictable function during extended gut colonization. Here, we report stable, engineered bacterial strains that maintain their function for 6 months in the mouse gut. We engineered a commensal murine Escherichia coli strain to detect tetrathionate, which is produced during inflammation. Using our engineered diagnostic strain, which retains memory of exposure in the gut for analysis by fecal testing, we detected tetrathionate in both infection-induced and genetic mouse models of inflammation over 6 months. The synthetic genetic circuits in the engineered strain were genetically stable and functioned as intended over time. The durable performance of these strains confirms the potential of engineered bacteria as living diagnostics.