Hippocampal cognitive maps encode the relative locations of spatial cues in an environment and adapt their representation when boundaries geometrically change. Hippocampal cognitive maps can represent abstract knowledge, yet it's unclear whether the hippocampus is sensitive to changes to the extreme coordinates, boundaries, of abstract spaces. We create a memory-guided choice task to test whether the human hippocampus and medial prefrontal cortex (mPFC) flexibly learn abstract boundary representations in distinct two-dimensional (2D) knowledge spaces. Participants build up a 2D map-like representation of abstract boundaries, where the hippocampus and mPFC represent a decision cue's Euclidean distance to the closest boundary. Notably, mPFC distance representations selectively reflect individual performance improvements during the task. Testing for neural sensitivity to boundary-defined contextual changes, only the hippocampus flexibly represents abstract boundaries, which relates to choice behavior. These findings suggest that abstract knowledge retrieval within dynamically changing contexts is facilitated by generalized mPFC and flexible hippocampal boundary representations.