Businesses often need to face the problem of providing incentives for employees to work together effectively on projects that develop over time. This paper derives the optimal contract in an intertemporal model with three-sided moral hazard. The optimal timing of compensation reflects the timing of effort with compensation for up-front effort preceding compensation for effort over time. Deferring compensation for agents exerting effort over time improves their incentives without impairing incentives for up-front effort. The exact pattern of compensation depends on the relative severity of the agents' incentive problems. JEL classification: D82, M52