I feel your pain. I'm the stepmother of a wonderful 17 yr. old young lady whom I've raised since she was 5. Her mother chose to leave and for years I had to deal with her trying to interfere in both my relationship with my daughter (we no longer use the term step in there) and my husband. There are a couple of suggestions I can give you.
1- document everything. I used to keep a word doc. on my desktop so that it was easy to open and add to. I just added the date and the incident, I listed both good and bad just to keep a reliable record.
2- be sweet! this will be exactly what she doesn't want. Kill'er with kindness, as much as it irritates you to do, imagine how much it aggravates her to try and piss you off and still get the nice ness!
3- get your husband involved. But you must make sure that you two are in agreement about everything. This will help to avoid issues between you and him.
4- have a family meeting and be sure that the boys know that they cannot disrespect you. Even if their mother says bad things, that doesn't give them the right to act out on them. Never talk down about her in front of them, that will only give them justification of anything that she has said. They must realize that she may be their Mom, but you are their step Mom and by marriage their guardian, and they need to respect that. Being their guardian means that you have as much rights as their mother.
5- this being the most important. If the agreement that you have is not legal,, make it so. If he has custody, then having thing done legally will help resolve all issues and will allow you the ability to tell her the next time she has a problem, to take it up in court!
On a final note, have patience, this will come to an end. In doing things the right way, you are only protecting yourself and your family, boys included. One day you will look back and say, all that, it's a shame people can be so vindictive as to try and ruin what they want and what you have.
If ya need to talk, I can be reached at ____@____.com big thing is not to stress about it, stress definitely doesn't help.