
Douglas Quail wants to visit Mars and visits Recal to have memories of a trip implanted, along with mementoes and keepsakes provided as physical proof. He also opts for the Secret Agent module. During the procedure it becomes apparent that these memories already exist as he was a secret agent on Mars.
The whole reason why he was reconfigured and whether his wife is really his wife or an agency plant is briefly hinted at but is not gone into, as this isn't the story Dick wants to tell.
Recal send him home with his memories and half his fee re-imbursed and hope for the best, but Doug smells a rat and returns to Recal almost immediately. In order to write over the programme errors in his brain, Recal find another childhood fantasy about Doug saving the planet from invading aliens. They arrive to destroy the planet, but due to Doug's kindness, they vow to leave the planet alone until Doug is dead. Of course, this turns out not to be a fantasy either and we are left with the looming destruction of the planet..