Many ecosystems retain an ecological memory of past conditions that affects responses to future stimuli. However, it remains unknown what mechanisms and dynamics may govern such a memory in microbial communities. Here, in both a human dietary intervention cohort and an artificial gut, we show that the human gut microbiome encodes a memory of past carbohydrate exposures. Changes in the relative abundance of primary degraders were sufficient to enhance metabolism, and these changes were mediated by transcriptional changes within hours of initial exposure. We further found that ecological memory of one carbohydrate species impacted metabolism of others. These findings demonstrate that the human gut microbiome's .