A large supplier (principal) contracts with a small firm (agent) to repeatedly provide working capital in return for payments. The total factor productivity of the agent is private and follows a Markov process. Moreover, the agent is less patient than the principal. We solve for the optimal contract in this environment. Distortions are pervasive and efficiency unattainable. The optimal contract is characterized by two key properties: restart and shutdown, which capture various aspects of contracts offered in the marketplace. The optimal distortions are completely pinned down by the number of low TFP shocks since the last high shock. Once a high shock arrives, the contract loses memory and repeats the same cycle, we call this endogenous resetting feature restart. If ex ante agency frictions are high, the principal commits to not serving the low type, we call this shutdown. The principal prefers a patient agent if the interim agency friction, as measured by the persistence of the private information is large, and she prefers an impatient agent if it is small. Finally, when global incentive constraints bind, we (i) provide the complete recursive solution, and (ii) characterize a simpler incentive compatible contract that is approximately optimal.