If there is an agreement between the parties that would be one way to have the clause. The definition of living with someone is tricky. As far as you not living with someone or having an overnight guest that is you choice even if there is no agreement. As far as the court ordering the restrictions that you want that is another question and varies with the courts.
If this answer is helpful, then please mark the helpful button. If this is the best answer, then please indicate it. Thanks. For further information you should see an attorney and discuss the matter completely. If you are in the New York City area, then you can reach me during normal business hours at 718 329 9500 or www.mynewyorkcitylawyer.com.
If you come to an agreement that is fine. However, it is very unlikely that the court would impose such a clause as it infringes upon peoples rights.
I hope you found this answer helpful and if so, please let me know by clicking the "Mark as Helpful" button at the bottom of this answer. It’s easy and appreciated. You can also choose a "best answer" if you wish. This is easy to do and greatly appreciated.
* This post and all others I make on Internet are for informational purposes only. None of the information or materials I post are legal advice. Nothing I post as comments, answers, or other communications should be taken as legal advice for any individual case or situation. This information is not intended to create, and receipt or viewing of this information does not constitute, an attorney-client relationship. While I try to be accurate, I do not guarantee accuracy.
This advice is not meant to create an attorney-client relationship and is a general anwer to the question posed.