Minimizing the costs that others impose upon oneself and upon those in whom one has a fitness stake, such as kin and allies, is a key adaptive problem for many organisms. Our ancestors regularly faced such adaptive problems (including homicide, bodily harm, theft, mate poaching, cuckoldry, reputational damage, sexual aggression, and the infliction of these costs on one's offspring, mates, coalition partners, or friends). One solution to this problem is to impose retaliatory costs on an aggressor so that the aggressor and other observers will lower their estimates of the net benefits to be gained from exploiting the retaliator in the future. We posit that humans have an evolved cognitive system that implements this strategy – deterrence – which we conceptualize as a revenge system. The revenge system produces a second adaptive problem: losing downstream gains from the individual on whom retaliatory costs have been imposed. We posit, consequently, a subsidiary computational system designed to restore particular relationships after cost-imposing interactions by inhibiting revenge and motivating behaviors that signal benevolence for the harmdoer. The operation of these systems depends on estimating the risk of future exploitation by the harmdoer and the expected future value of the relationship with the harmdoer. We review empirical evidence regarding the operation of these systems, discuss the causes of cultural and individual differences in their outputs, and sketch their computational architecture.