A) Schematic of behavioural experiment to test whether cocaine-context pairing leads to a measurable conditioned response in the conditioned context. Mice were administered cocaine or saline immediately prior to exposure to a novel context. The following day, they were returned to the conditioned context off-drug for recall. B) Mice that received cocaine locomoted significantly more than saline controls during encoding (t18 = 5.07, p = 0.00008) (Cocaine, n = 9 mice; Saline, n = 9 mice). C) Mice that received cocaine locomoted significantly more than saline controls during recall in the conditioned context the day following encoding (t16 = 2.92, p = 0.010) (Cocaine, n = 9 mice; Saline, n = 9 mice). D) Schematic of behavioural experiment to test whether the conditioned response observed in Extended Data Fig. 2a–c is context-specific. Mice were administered cocaine or saline immediately prior to exposure to a novel context. The following day, they were placed in a novel context. E) Mice that received cocaine locomoted significantly more than saline controls during encoding (t18 = 5.64, p = 0.000024) (Cocaine, n = 10 mice; Saline, n = 10 mice). F) Mice that received cocaine locomoted no differently than saine controls during recall of a novel context (t18 = 1.35, p = 0.20) (Cocaine, n = 10 mice; Saline, n = 10 mice). G) Schematic of behavioural experiment to test for retrospective memory-linking with cocaine. Mice were exposed to a neutral context, and two days later they were administered either cocaine or saline immediately prior to being placed in a separate context. In the subsequent days, mice were tested in Neutral and Novel contexts, counterbalanced, and then in the cocaine-paired context last. H) Left: Mice locomoted no differently in the Neutral encoding context (t54 = 1.96, p = 0.056). Right: Mice that received cocaine locomoted more than mice that received saline during Cocaine encoding (t54 = 9.36, p = 6.72e-13) (Cocaine, n = 28 mice; Saline, n = 28 mice). I) Left: There is a strong trend that mice that received cocaine locomoted more during Neutral recall than mice that received saline (t54 = 2.85, p = 0.01). Right: Mice that received cocaine or saline locomoted no differently in Novel recall (t54 = 1.83, p = 0.07) (Cocaine, n = 28 mice; Saline, n = 28 mice).