Yes, you may make such an agreement. Make sure you do have your own legal representation during any negotiations and signing for such an agreement. Also keep in mind that often other assets or support issue are exchanged for such interest in real property. Make sure you understand all you may be due through support or equitable distribution before entering such an agreement. Further, if the agreement is not being done in contemplation of divorce you will have to follow all legal requirements for it to be enforceable because courts heavily scrutinize such agreements.
Since you are not seeking to sell the house you do not need a real estate attorney. You need a divorce attorney. You can make an agreement before or during your marriage to provide for the distribution of property acquired during the marriage which is subject to distribution. Gifts and inheritance is not a part of the marital estate.
Mid-marriage agreements are difficult to enforce because a contract requires Consideration from trom the party giving up their rights. So what is your spouse getting in return? Best to consult a family law attorney to understand your rights.
If you and your spouse can come to a mutually acceptable agreement regarding such terms and conditions, the same can be placed into a "binding agreement."
Whether such an Agreement will be enforceable in the future will depend on many additional facts and circumstances, i.e. was the agreement "fair and reasonable," etc...
For a reliable opinion you should consult with an experienced family law attorney who can take the time to review with you "all" relevant facts and circumstances.
Kenneth A. White, Esq.