In Virginia, as part of a plea agreement, the ability to appeal a decision can be waived. However, the right to habeas the defense attorney for ineffective assistance of counsel cannot be waived. Consequently, a prosecutor added language to her plea agreement waiving appeals, but not wanting to make the plea agreement overly broad (and therefore potentially voidable) used language something like this: "Defendant waives all possible appeals except petition for a writ of habeas corpus for ineffective assistance of counsel."
Defense counsel looked at this plea agreement with a bit of incredulity. The question asked over and over again was "Why are you trying to get my client to file a habeas against me?"
When a few of them griped to me about it, I created the following paragraph and offered to include it in any plea agreement if they wanted it:
I hereby recognize that ALL defense attorneys are incompetent and provide ineffective assistance prior to, during, and after trial. They are biased, provide improper advice, do not know the law, and do not have my best interest in mind when they recommend that I plead guilty, no contest or that I should go to trial. Despite all this, every bit of which I agree that I knew before this plea agreement was entered, I plead guilty by my own decision, agree to this plea agreement without paying any attention to any advice from my attorney, waive all direct appeals, and waive any habeas corpus actions based upon any grounds and specifically upon the grounds of ineffective assistance of counsel, because I have chosen to entirely ignore any advice counsel has given me.
Surprisingly, no one has asked for it to be inserted in any of their plea agreements yet.