The ACT Programming Tutor (APT) is a problem solving environment constructed around an executable cognitive model of the programming knowledge students are acquiring. This cognitive model supports two types of adaptive instructional processes. First, it enables the tutor to follow each student’s solution path through complex problem solving spaces, providing appropriate assistance as needed. Second, it enables the tutor to implement cognitive mastery learning in which fine-grained inferences about student knowledge are employed to adapt the problem sequence. This paper outlines the assumptions and procedures of cognitive mastery learning and describes evidence of its success in promoting student achievement. The paper also explores the limits of cognitive mastery as implemented in APT and begins to examine new directions.