SRD:Spell Worm

On a failed save, the subject must spend a standard action each round abandoning his or her highest-level spell (or losing his or her highest-level unused spell slot). Each round, the subject eliminates another spell or spell slot, moving to lower-level spells once all the higher-level spells are gone. In the case of prepared spells, the subject decides which spells to abandon at each level. If the subject has more than one standard action allowed in the round, he or she may spend those actions as he or she desires. The subject doesn’t realize the spells or spell slots are gone until he or she tries to cast a spell and finds it unavailable. Abandoning a spell slot or losing a spell is a standard action, but it does not draw an attack of opportunity. It is a purely mental exercise not obvious to observers.