Summarize:

If you have children or pets together, work together, or share a social circle, there will likely be times that contact is unavoidable. Make a clear plan that you can both agree to for how to handle those times.  Take control of the situation by clearly stating your needs. Keep in mind though, that you may need to negotiate. For example, you may never want to see your ex again, but if you work together, you may need to say something like, “I understand that you need to keep working here, so we’ll have to interact occasionally. I can do that, but I won’t be engaging with you socially at work, and please don’t visit my department unless it’s unavoidable.” If you have children together, you’ll need to establish boundaries around custody, holidays, milestones (such as graduations), and family gatherings. If you feel strongly averse to interacting with your ex at all, you may need to seek the help of a family counselor or lawyer. Write down the guidelines you’ve both established so you have something to reference if there’s a misunderstanding later. This may be difficult, particularly if you still don’t feel closure, or if you’re deeply heartbroken. It’s natural to want to reach out or to find reasons to contact your ex. However, do your best to cut off all contact until you’ve had time to heal.  It can help to delete their number from your phone. This can help prevent impulsive calling or texting. If you feel the need to contact them, spend some time writing in a journal instead. You can write them an imaginary letter, or write out out how you’re feeling. This can help you process feelings without actually reaching out to them. If you feel the urge to contact your ex, call a friend instead and tell them how you’re feeling. Avoid going to places you know you might run into them. Stay away from the bars and coffee shops they frequent, even if it means changing your usual routine. Don’t walk home using the route that goes right by their house. Your ex may reach out to you, even if you’ve explicitly asked them not to. They may even send flirtatious messages or indicate that they’re still interested in you. Do not respond to this. It’s disrespectful of the boundaries you’ve established and to your healing process.  Your ex may use flirtation as a way to manipulate you to reestablish contact. Unless they have explicitly said that they want try to get back together on terms that you could agree to, do not respond to their messages. If you're afraid that your ex might stalk, harass, or threaten you, seek support from a domestic violence shelter. You also may want to contact law enforcement or file a restraining order. Remember that “friends with benefits” has the word “friends” in it.
Create guidelines for unavoidable contact. Refrain from contacting them. Ignore flirtation or mixed signals.