The APE (Adaptive Programming Environment) project focuses on applying Machine Learning techniques to embed a software assistant into the VisualWorks Smalltalk interactive programming environment. The assistant is able to learn user’s habits and to automatically suggest to perform repetitive tasks on his behalf. This paper describes our assistant and focuses more particularly on the learning issue. It explains why state-of-the-art Machine Learning algorithms fail to provide an efficient solution for learning user’s habits, and shows, through experiments on real data that a new algorithm we have designed for this learning task, achieves better results than related algorithms. Keywords Learning Interface Agents, Programming by Demonstration, Machine Learning, Interactive Programming Environments.