 "Demons" was written by R. W. Goodwin, an executive producer and director for the show.Goodwin was inspired to write the episode after reading "The Landscape of Dreams", an essay by the neurologist and best-selling author Oliver Sacks from the anthology book "An Anthropologist on Mars