In a book by Ursula K. LeGuin, a man who knows his memory will be wiped sets up clues he will find and use to gradually recover his memory.
As I recall, the book begins as he “wakes up” and is recalling a poem or lines he has repeated over and over before the wiping. He may find clues in a book he has been allowed to keep, where he has written something to further jog his memory.
I’ve looked through all my paperbacks of hers, but can’t find it.