Create a simulacrum chain, generating an unbounded sequence of copies of you.

These simulacrums then create magic jars (500 gp ornate scroll cases), and transfer to true-polymorph created mimics.  (note: if you have a separate collection of mimics, that can also work)

These mimics transform into scrolls of paper.  You scribe the spell on these scrolls.

If the spell is used in any way you don't want it to, the simulacrum-mimics simply transform to a different form (say, a blank scroll), then abandon their mimic back into the scroll case.  The mimic is no longer the spell, and it attacks the violator of the contract.

The simulacrum survives in the scroll case, from which it can continue on the usual way one does (possessing creatures for the rest of eternity).

Using this technique you can enforce any contract you want, so long as a simulacrum of it can detect violation while soul jared into a mimic shape-changed into a scroll that is.

Of course, this is similar to using a nuclear bomb to kill an ant in that we broke D&D 3 times before breakfast when creating this MRM, costs 2000 gp and multiple castings of a 9th level spell (unless you find a herd of mimics you can abuse).