The concept of memory is traditionally associated with organisms possessing a nervous system. However, even very simple organisms store information about past experiences to thrive in a complex environment—successfully exploiting nutrient sources, avoiding danger, and warding off predators. How can simple organisms encode information about their environment? We here follow how the giant unicellular slime mold Physarum polycephalum responds to a nutrient source. We find that the network-like body plan of the organism itself serves to encode the location of a nutrient source. The organism entirely consists of interlaced tubes of varying diameters. Now, we observe that these tubes grow and shrink in diameter in response to a nutrient source, thereby imprinting the nutrient’s location in the tube diameter hierarchy. Combining theoretical model and experimental data, we reveal how memory is encoded: a nutrient source locally releases a softening agent that gets transported by the cytoplasmic flows within the tubular network. Tubes receiving a lot of softening agent grow in diameter at the expense of other tubes shrinking. Thereby, the tubes’ capacities for flow-based transport get permanently upgraded toward the nutrient location, redirecting future decisions and migration. This demonstrates that nutrient location is stored in and retrieved from the networks’ tube diameter hierarchy. Our findings explain how network-forming organisms like slime molds and fungi thrive in complex environments. We here identify a flow networks’ version of associative memory—very likely of relevance for the plethora of living flow networks as well as for bioinspired design.