Generalizing aversive memories helps organisms avoid danger, whereas discriminating between dissimilar situations promotes opportunistic behaviors. We identified a novel pathway that controls the contextual specificity of memory consolidation of inhibitory avoidance learning. Optogenetic inhibition of the rostral medial prefrontal cortex (mPFC)-to-anteroventral bed nuclei of the stria terminalis (avBST) pathway after a single footshock exacerbated stress hormonal output, and 2 d later promoted generalization to a novel context. Rostral mPFC–avBST influences were directly mnemonic rather than associated with stress hormone increases, as adrenalectomy did not prevent such influences on generalization. We next observed that fear discrimination between novel and aversive contexts engaged activity along the rostral mPFC and avBST pathway. Finally, post-footshock optogenetic pathway excitation enhanced 2-d discrimination. These findings highlight a prefrontal pathway in which activity immediately after aversive experiences promotes mnemonic discrimination between threatening and non-threatening contexts and may be importance for understanding trauma generalization in psychiatric illnesses.