Streptococcus pneumoniae becomes competent for genetic transformation when exposed to an autoinducer peptide named CSP. This peptide was originally described as a quorum-sensing (QS) signal, enabling individuals to regulate competence in response to population density. However, recent studies suggest that CSP may instead serve as a probe for sensing environmental cues, such as antibiotic stress or environmental diffusion. Here, we show that competence induction depends simultaneously on cell density, external pH, antibiotic-induced stress and cell history. Our experimental data is explained by a mathematical model where the environment and cell history modify how cells produce or sense CSP. Taken together, model and experiments indicate that autoinducer concentration can function as a reliable indicator of cell density across environmental conditions, while also incorporating information on environmental factors or cell history, allowing cells to integrate cues such as antibiotic stress into their QS response. This unifying perspective may also apply to other debated QS systems.