Dirk Gently's Holistic Detective Agency

Dirk Gently's Holistic Detective Agency is a humorous detective novel by English writer Douglas Adams, published in 1987. It is described by the author on its cover as a "thumping good detective-ghost-horror-who dunnit-time travel-romantic-musical-comedy-epic".

The book was followed by a sequel, The Long Dark Tea-Time of the Soul. The recurring major characters are the eponymous Dirk Gently, his secretary Janice Pearce and Sergeant Gilks. Adams began work on another novel, The Salmon of Doubt, with the intention of publishing it as the third book in the series, but died before completing it.

A BBC Radio 4 adaptation of six episodes was broadcast from October 2007. A second series based on the sequel was broadcast from October 2008. A 2010 television adaptation for BBC Four borrowed some of the characters and some minor plot elements of the novel to create a new story, and a 2016 television adaptation for BBC America served as a continuation of the books.

Writing
The genesis of the novel was in two Doctor Who serials written by Adams, City of Death (in which an alien tries to change history at the cost of erasing humanity from existence) and in particular the cancelled serial Shada, which first introduces a Cambridge professor called Chronotis who is hundreds of years old. He has been living and working at a Cambridge college for centuries, apparently attracting no attention (noting with appreciation that the porters are very discreet). In Shada, Chronotis's longevity is due to him being a Time Lord, and his time machine is an early model TARDIS. These trademark elements from Doctor Who were removed by Adams for Dirk Gently. Shada was cancelled before completion due to a production strike and later released on VHS with Tom Baker narrating the unfilmed segments. The story was also animated in 2017 and released on DVD.

A number of elements in the novel were inspired by Adams' time at university. For example, one plot thread involves moving a sofa which is irreversibly stuck on the staircase to Richard MacDuff's apartment; according to his simulations, not only is it impossible to remove it, but there is no way for it to have got into that position in the first place. In a similar incident that occurred while Douglas Adams attended St John's College, Cambridge, furniture was placed in the rooms overlooking the river in Third Court while the staircases were being refurbished. When the staircases were completed, it was discovered that the sofas could no longer be removed from the rooms, and the sofas remained in those rooms for several decades.

The South Bank Show revealed that Adams based Chronotis' rooms on the rooms he occupied in his third year at university. Likewise, Richard's room – filled with Macintosh computers and synthesisers – was based on Adams' own flat (visited and photographed by Hi-Fi Choice Magazine). The piece of music by Bach that is heard aboard the satellite is "Ach bleib bei uns, Herr Jesu Christ" from the cantata "Bleib bei uns, denn es will Abend werden", BWV 6 (also an organ chorale BWV 649). Adams stated that this was his personal "absolutely perfect" piece of music, and that he listened to it "over and over; drove my wife completely insane" while writing Dirk Gently's Holistic Detective Agency.

Plot summary
The novel opens on a hellish, rain-drenched landscape, void of almost all life. Its sole feature is a tower-like object projecting from the omnipresent mud. The tower, for unexplained reasons, explodes.

The narrative then switches to the perspective of an Electric Monk – a labour-saving device created for the purpose of "saving you what was becoming an increasingly onerous task, that of believing all the things the world expected you to believe". This particular Monk, however, is faulty, and acquires and discards new beliefs almost at random. His alien creators have therefore abandoned him, together with his horse, in a desert. A door appears on a rock face, and the Monk goes through it.

In Cambridge, computer programmer Richard MacDuff has arrived from London to visit his old college, the fictional St. Cedd's, at the invitation of his undergraduate tutor Urban "Reg" Chronotis. Over a dinner being held in honour of Samuel Taylor Coleridge, Richard explains how he came to work for Gordon Way, who also happens to be his girlfriend Susan's brother. For the benefit of a small girl also in attendance, Reg performs a magic trick in which he vanishes a silver salt cellar from the table, only for it to reappear implanted into a two-hundred-year-old pot that the girl found on holiday in Greece. They also listen to a reading of Coleridge's Kubla Khan, and the narration makes reference to the poem's "second, and altogether stranger part".

Following dinner, Richard joins Reg in his flat and the two men then discover a horse has mysteriously appeared in the bathroom. Richard suddenly recalls that he intended to bring Susan with him that evening, but completely forgot.

While driving to his country home and leaving an extended message on Susan's answering machine, Gordon is shot by a shadowy figure hiding in the trunk of his car. Realizing that he is dead and has become a ghost, Gordon attempts to manipulate objects around him, including his cell phone, which is still connected and transmitting. However, he accomplishes nothing other than accidentally terminating the call to Susan.

It transpires that after going through the door, the Monk and his horse found themselves in Reg's flat. Whilst wandering the college grounds, the Monk encountered a porter who told him to "shoot off". Desiring to follow the instruction, the Monk hid in the trunk of Gordon's car when Gordon stopped for fuel. Not understanding Gordon's "reaction" to being shot – i.e., dying – and concerned that he might have erred, the Monk takes Gordon's identification, keys, and body to the country house before leaving in pursuit of another unshakeable belief. His odd behavior eventually causes him to be picked up by the police.

Richard also leaves a message on Susan's answering machine, desperately apologizing and rashly promising to go on holiday with her that weekend. However, he realizes that with a work deadline looming, he will not be able to fulfill this promise. He then decides to break into Susan's flat and remove the tape from her answering machine. After he enters through the window, the phone rings. The caller is a man Richard knew at Cambridge as the eccentric Dirk Cjelli, now using the surname Gently to avoid troubles with the law. Having seen Richard commit his attempted burglary, Dirk instructs Richard to meet him at a pizza restaurant in a few minutes and hangs up.

Richard is suddenly seized by remorse and returns the tape to the machine. Immediately afterward, Susan arrives home in the company of her acquaintance Michael Wenton-Weakes. Michael, the son of a wealthy publishing magnate, was unceremoniously terminated from his position as editor of the magazine Fathom following his father's death; he is bitterly resentful of his successor, Alistair Ross. After Michael leaves, Richard apologizes to Susan, who forgives him. She also hands him the tape from the answering machine without listening to it, asking him to give it to Gordon’s secretary for transcription.

The next day, having failed to make their appointment at the pizza restaurant, Richard looks up Dirk in the phone book and discovers an ad for Dirk Gently's Holistic Detective Agency. He goes to the agency's office, where Dirk explains that his detective methods are based on the "fundamental interconnectedness of all things". Dirk then informs his friend that Gordon is dead under mysterious circumstances, and persuades Richard to be hypnotized and describe the events of his evening. Dirk is particularly concerned about the magic trick, which is, so far as he can tell, utterly impossible, as well as Richard's highly uncharacteristic decision to break into Susan's flat. He believes that there must be a connection between all the odd events revolving around Richard.

The pair go to Cambridge to speak with Reg. When asked about the trick, the professor confesses his secret: he is not human, but a being so old that he has forgotten his own origins. His flat is in fact a craft of extraordinary power which can travel through space and time – though, for some reason, it cannot function when Reg's telephone is working, and vice versa. To perform the trick, Reg travelled back in time to have the man who made the pot bake the salt cellar into it. He also visited the planet where the Monk originated, to collect a particular kind of dust that worked well to conceal the suntan he acquired while looking for the potter; the Monk went through the time machine's door while Reg was not looking. However, the professor acknowledges this is out of character for him – normally he refuses to change the past, for fear of causing a catastrophe in the timeline.

Michael also arrives in Cambridge to ask Reg's assistance. He is possessed by the ghost of an alien engineer, whose crew had left their own war-torn planet in search of another world on which to build a utopia based around the creation of music. However, when the aliens, known as Salaxalans, arrived on Earth four billion years in the past to refuel and repair their ship, the engineer failed to notice a problem in the engines of their landing craft. When they were started, the craft exploded, killing the entire crew and leaving their deserted mothership still in orbit. The ghost, haunted by guilt, has spent the millennia trying to find a way to set this right. To this end, he has possessed a number of individuals, including Coleridge, whose work was influenced by the ghost's story. The curious actions of Richard, Reg, and even the Electric Monk were also caused by the ghost possessing them. However, each subject ultimately proved unsuitable for the task. The engineer finally succeeded with Michael, who is implied to be sympathetic to the ghost's goals due to his fondness for Coleridge's poetry, particularly the second half of Kubla Khan. Dirk demands proof of these claims, so Reg takes them to the mothership, where Richard is overcome by the beauty of the Salaxalans' music. Richard, Dirk, and Reg agree to take Michael and the ghost back to the scene of the accident.

Gordon realizes that he will only be able to end his ghosthood if he completes his unfinished business – namely, leaving a message on Susan's answering machine – but struggles to muster the emotional energy he needs to lift a phone's receiver and dial the number. However, while drifting around London, he stumbles across the scene of a murder. Galvanized by this discovery, he uses the touch-tone phone in Dirk's office to call his sister, records an answering machine message telling her of the crime, and hangs up, which enables him to "[fall] back to his own rest and vanish".

After Michael, using scuba gear, has walked into the poisonous atmosphere of pre-organic Earth, Richard receives a phone call from Susan. She listened to Gordon's message, which informed her that Alistair Ross was the murder victim. Richard realizes that the ghost had lied to him and the others. The aliens were intending to colonize Earth, but the accident robbed them of the opportunity, and the Salaxalan regards humanity and indeed all life on the planet as usurpers. Michael is an acceptable host because he considered Ross a usurper, and Ross's murder was the final test of his willingness to go to extremes to "fix" the mistake.

To stop the engineer from preventing the accident, without which life on Earth could not begin, Richard, Reg, and Dirk travel to Somerset in 1797. Dirk, pretending to be the "person from Porlock", interrupts Coleridge at work. This action prevents the poem being finished and severs the critical link between Michael and the ghost. However, Reg retains some pity for the engineer, and so travels back to the accident once more. He transports the crew off the landing craft just before the explosion and brings them to the mothership, enabling them to continue on their quest elsewhere.

The three men return to the present day. Reg finds the Electric Monk and takes him back to his own planet. Richard discovers Susan playing a cello piece that is hauntingly reminiscent of the Salaxalans' harmonies and is baffled when she tells him it was composed by someone called "Bach". Reg admits that he recorded a portion of the Salaxalans' music and gave it to the composer. Richard begs him to go back to the mothership and retrieve more, but Reg says this will not be possible – a man from British Telecom has come and fixed the phone.

Literary significance and reception
Reviewing the book for The Times, John Nicholson wrote it was "endearingly dotty", but doubted its commercial potential. Austin MacCurtain of the Sunday Times reviewed the paperback edition in 1988, saying that it was "more of the same" as Hitchhiker's, and that the "cosmic romp is stretched thin at times but will not disappoint fans". The book was the 9th highest-selling hardback in the UK in 1987.

J. Michael Caparula reviewed Dirk Gently's Holistic Detective Agency in Space Gamer/Fantasy Gamer No. 84. Caparula commented that "The writing is wry and quite British, and the novel's quirky spirit is reminiscent of Rudy Rucker's mathematical farces. A nice change for Adams, proof that his talent goes far beyond the meandering Hitchhiker saga."

In 1990, the Magill Book Reviews said "The author's whimsical sense of humor and his sense that the universe has many unexplored possibilities will arouse the interest of a wide readership."

This novel caused Adams to become acquainted with the well-known scientist Richard Dawkins. As Dawkins explains, "As soon as I finished it, I turned back to page one and read it straight through again – the only time I have ever done that, and I wrote to tell him so. He replied that he was a fan of my books, and he invited me to his house in London." Adams would later introduce Dawkins to the woman who was to become his third wife, the actress Lalla Ward, best known for playing the character Romana in Doctor Who. One of her early serials on the programme was City of Death, which Adams wrote, and which shares certain plot elements with the novel.

Adaptations
On 5 January 1992, Dirk Gently, Richard MacDuff, Dirk's secretary, and the Electric Monk all appeared in the Douglas Adams episode of the British arts documentary series The South Bank Show. Michael Bywater played Dirk, while Paul Shearer played both Richard and the Monk. Several characters from The Hitchhiker's Guide to the Galaxy were also featured, played by the original television series actors.

The book has been adapted for stage performance as Dirk and in 2005, some fans of Douglas Adams produced an amateur radio series based on the first book. Their efforts began and were coordinated on the Douglas Adams Continuum website. Three episodes were completed. Apart from the radio broadcasts, Douglas Adams recorded both unabridged and abridged readings of the first novel for the audiobook market.

Radio
Announced on 26 January 2007, BBC Radio 4 commissioned Above the Title Productions to make eighteen 30-minute adaptations of Douglas Adams' Dirk Gently books (including The Long Dark Tea-Time of the Soul and the unfinished The Salmon of Doubt), running in three series of six episodes.

The first series began on 3 October 2007 and features Harry Enfield as Dirk, Billy Boyd as Richard, Olivia Colman as Janice, Jim Carter as Gilks, Andrew Sachs as Reg, Felicity Montagu as Susan, Robert Duncan as Gordon, Toby Longworth as the Monk, Michael Fenton Stevens as Michael, Andrew Secombe, Jon Glover, Jeffrey Holland, Wayne Forester and Tamsin Heatley.

The script for Dirk Gently's Holistic Detective Agency was written by Dirk Maggs, who also directs, and John Langdon. The show was produced by Maggs and Jo Wheeler. As with the previous Hitchhiker's series, the CD version features greatly expanded episodes. There are a number of structural and detail differences between the radio adaptation and the book, mostly to aid the comprehension of the story when split into six half-hour episodes.

Dirk Maggs parted ways with Above the Title Productions when he started his own production company, Perfectly Normal Productions, and so the project was never completed and the proposed radio series of The Salmon of Doubt remains unmade.

Comic book
Cartoonist Ray Friesen made an unlicensed comic adaptation of the first novel for a book report. A few years later, in 2004, he posted 18 pages of it online as a webcomic.

IDW Entertainment and Ideate Media have adapted Dirk Gently into a limited comic book series and, later, an American television series for BBC America. The comic series premiered in May 2015.

Television
There have been two television series based on Dirk Gently books and characters.

The first series, Dirk Gently, featuring the character was announced during Hitchcon, a 2009 Hitchhiker's Guide to the Galaxy event to launch the sixth Hitchhiker's book. Ed Victor, a literary agent who represents Adams' estate, announced that a television adaptation of Dirk Gently's Holistic Detective Agency was in production. Stephen Mangan played Gently, with Darren Boyd as Macduff and Helen Baxendale as Susan. It was broadcast on BBC Four on 16 December 2010. The hour-long pilot was well-received, leading to three further episodes being commissioned. These aired on BBC4 during March 2012.

A second series, Dirk Gently's Holistic Detective Agency was released in January 2016. BBC America produced 18 episodes starring Samuel Barnett as Dirk Gently, Elijah Wood as Todd Brotzman, Hannah Marks as Amanda Brotzman, and Jade Eshete as Farah Black. As of July 2020 it is available on the Hulu streaming service.