Co-founder conflict is among the most common causes of startup failure, more common than competition or market, and the agreements that prevent it are almost always made too late, after the conflict has already arrived.
Why it arrives late
At the start of a company, the relationship is good and the questions that would cause conflict, who owns what, who decides what, what happens if one leaves, feel unnecessary and uncomfortable. The founders who raise the questions early are treated as pessimistic, and the questions go unasked. The conflict arrives later, when the stakes are higher and the relationship is weaker, and the questions are then much harder to answer.
The agreements that prevent it
The agreements are: a vesting schedule so a departing founder does not keep their full equity; a clear decision-making structure so a disagreement does not become a deadlock; and a written understanding of what each founder's role is and how it changes as the company grows. Each of these is uncomfortable to negotiate at the start and impossible to negotiate during a conflict, which is exactly why they have to be done at the start.
The honest advice
If you cannot have the difficult conversation about what happens if one of you leaves, do not start the company together. The conversation is the test. The founders who can have it, and who write down the answer, are the ones whose companies survive the conflict that would otherwise have killed them.