Anterior cingulate cortex is important in monitoring action for new challenges. We recorded neuron activity in the anterior cingulate sulcus of macaques while they performed a sequential problem-solving task. By trial and error, animals determined the correct sequence for touching three fixed spatial targets. After the sequence was repeated three times, we then changed the correct solution order, requiring a new search. Irrespective of component movements or their kinematics, task-related neurons encoded the serial order of the sequence. Neurons activated with sequence components (68%) differed in activity between search and repetition. Search-related activity occurred when behavioral flexibility was required and ended as soon as the animal accumulated enough information to infer the solution, but had not yet tested it. Repetition-related activity occurred in a regime of memory-based motor performance in which attention to action is less necessary.