Many of our decision are made on autopilot or habitually. For example, choosing a route to work initially happens by comparing different options’ travel times (goal-directed choice). But with extensive repetition, travel time is no longer considered; the choice is made out of habit. Habits are more efficient than goal-directed choices, but this comes at a cost: habits are hard to break. Due to this inflexibility, habits are often presented as inferior to goal-directed choice: a fall-back option when there is not enough time or cognitive capacity to think things through. But I argue that this reputation is undeserved. Thanks to their speed and reliability, habits usually result in superior performance, as long as the environment remains stable. Moreover, people are generally quite good at using habits to their advantage. Therefore, this project looks at habits as optimal in certain contexts. I propose a computational model that emphasizes the role of context, and that combines speed and accuracy to assess optimal behaviour. Importantly, habit-promoting or habit-blocking features of the context are learnt and applied to new choices in the same context. With this framework, we can account for effects in the literature that current models cannot. Hypotheses derived from this computational model will be tested using our novel habit training paradigm, and the neural substrate of these processes will be captured using cutting-edge neurostimulation and neuroimaging techniques.