Once you and your ex have reached a final agreement on all issues regarding who's going to live where, what happens to the house, how you're going to split assets (and debts) and any other issues, it's a good idea to prepare a clearly written document covering all the details of your separation. Be as specific and clear as possible and list each key provision (Who gets the car? The piano? The cat?) separately.
Be sure you both date and sign your settlement agreement and each keep a copy. It's a good idea to have your signed agreement notarized, just in case there's a future need (in court or arbitration) to prove that the signatures on the agreement are not forged.
Your signed agreement is enforceable in court in the same way as is any other binding agreement—assuming the agreement doesn't call for an illegal action.
Be sure to have an experienced attorney review your agreement, especially if you have substantial assets.