A plethora of studies in humans, non-human primates and rodents implicate the medial frontal cortex (mFC) in executing sequences of actions, encoding transitions between goals and representing abstract task states. Our empirical findings directly reveal a single algorithm, down to the cellular level, that unifies these disparate mFC functions. We designed a new behavioural paradigm for mice, the ABCD task, which allows simultaneously investigating action sequences (one-step transitions in a spatial maze), goal sequences (transitions between rewarded locations) and abstract task structure (…ABCDABCD…).
Neuronal firing in mFC was primarily determined by the phase of the animal’s progress between any two goals. Intriguingly, we discovered a new class of neurons that build upon this basic phase scaffold to represent the animal’s latent position in task space. Individual mFC neurons tracked position in task space relative to a specific spatial goal or subgoal. At the population level, these neurons were organised into modules of programmable CANs: new tasks were mapped by activating a subset of pre-formed CANs in a task-specific order. Such CANs were internally organised, maintaining their sequential relationships during sleep, in analogy to ring and toroidal attractors in the head direction and grid cell system respectively. Moreover, the activity bumps along these CANs predicted the animals’ subsequent behavioural choices in a manner that revealed the underlying algorithm. The movement of an activity bump along some CANs tracked task progress relative to a given goal location, allowing zero-shot inference on new tasks without needing new plasticity. Other CANs tracked progress relative to an intermediate action. These collectively allowed mice to rapidly converge on long action sequences without the need for continual planning. Programmable frontal CANs therefore provide a biological algorithm for optimally encoding new sequences.