My idea is that you should punish them if they are the kind of person that before they do a crime, consider whether they could have avoided any past punishments by being the kind of person that doesn't do the crime.
EDIT: Changed my answer.
Doesn't this mean that everyone has to be punished because at some point they might consider this? Also, who doesn't commit crimes? What constitutes a crime is completely subjective. Following through on this would cause a lot of punishment for opposing reasons. You might be punished and consider to precommit to not doing something, but what? Maybe the communist punished you so that you don't support democracy...I really don't get it.
Here's an edited version of a puzzle from the book "Chuck Klosterman four" by Chuck Klosterman.
When should you punish someone for a crime they will commit in the future? Discuss.