[[caption-width-right:248:Without a doubt, [[OverlyNarrowSuperlative the best time-traveling romantic detective ghost comedy ever written.]]]]

''Dirk Gently's Holistic Detective Agency'' is a 1987 novel by Creator/DouglasAdams, the first in the ''Literature/DirkGently'' series.

Dirk is a small-scale con artist whose latest scheme is working as a "Holistic Detective", who believes in the "fundamental interconnectedness of all things" and how that means that ''anything'' might prove useful in solving the ''whole'' cases of his clients -- which, the way he sees it, means that he can do anything he likes, even take a three-week tropical vacation, and still charge it to the client as an expense. Of course, by FinaglesLaw, ''somehow'' every mundane little job he starts off working on in each novel is somehow actually connected to the main plot, and ''he's'' the one who has to solve everything.

In this novel, while (supposedly) investigating the disappearance of an old woman's cat, Dirk stumbles into a plot by an [[NinjaPirateZombieRobot extraterrestrial ghost]] to undo his death with a TimeMachine. Too bad that would undo the creation of life on Earth! (It all MakesSenseInContext. Even the robot created to be religiously faithful in place of its creators.)

The novel started as a RecycledScript of Creator/DouglasAdams' ''Series/DoctorWho'' story [[Recap/DoctorWhoS17E6Shada "Shada"]], which got stuck in DevelopmentHell -- several characters and locations are recycled from the episode wholesale. It also borrows heavily from Adams' ''Doctor Who'' story [[Recap/DoctorWhoS17E2CityOfDeath "City of Death"]].

There is a second Dirk Gently novel, ''Literature/TheLongDarkTeaTimeOfTheSoul''.

!!This novel provides examples of:

* AbsentMindedProfessor: Professor Chronotis.
* ArbitrarySkepticism: Lampshaded. Richard expresses doubt at Dirk's theory involving ghosts. Dirk points out that he'd also doubted the time travel aspect until that was proven to him.
* BavarianFireDrill: Dirk's favorite way of getting places he shouldn't be.
* BeethovenWasAnAlienSpy: [[Creator/SamuelTaylorColeridge Coleridge]]'s poetry [[spoiler:contains alien messages]] and [[Music/JohannSebastianBach Bach]]'s music [[spoiler:is transcribed from an alien instrument that synthesized music from the motion of the universe itself]].
* BerserkButton: Michael Wenton-Weekes is described as "one of those dangerous people who are soft, squidgy and cowlike provided they have what they want." [[spoiler: When the magazine he edited is taken away from him and given a successful ReTool, he surprises himself by punching a fist through a window. And later, he kills the new editor in revenge[[note]]it takes place offstage, but as Richard points out, Michael is the only person with a motive for murdering the guy[[/note]] which allows the [[NinjaPirateZombieRobot extraterrestrial ghost]] to take control of his body and use him in his plot...]]
* BewareOfHitchhikingGhosts: The driver of a car is horrified when he sees the ghost of his boss appear in front the car. The ghost, on the other hand, is horrified to see another ghost ''in the car's passenger seat''.
* BlueAndOrangeMorality: The malfunctioning Electric Monk, that believes in rapidly changing non-sequiturs. [[spoiler:One of them being that shooting someone in the chest with a shotgun is a form of greeting.]]
* CaptainErsatz: Because of the first book's RecycledScript from [[Recap/DoctorWhoS17E6Shada "Shada"]], an abandoned ''Series/DoctorWho'' episode, [[spoiler:Reg is essentially a retired Time Lord with an unusual TARDIS]]. Richard and Susan are little more than re-named versions of Chris and Claire, respectively.
* ChekhovsArmoury: Dirk isn't wrong--''everything'' that happens in these books is ultimately important. The ''Dirk Gently'' books embody this trope really because they are all about the interconnectedness of everything. Chekov's Armoury isn't just a device Adams used, it's what he based the whole book on. A poem, a conjuring trick, and a ''stuck couch'' in the first few chapters are all linked by the end.
* ClusterFBomb: Dirk and Richard both encounter a little boy with a swearword-to-sentence ratio approaching 1:1.
* TheEeyore: Michael is convinced he's being treated unfairly by the entire universe. [[spoiler:Which makes him the ideal host for the alien ghost.]]
* ETGaveUsWifi: [[spoiler:The works of Johann Sebastian Bach are the sounds made by the computers on an alien flying saucer. Oh, and the long-lost second half of Kubla Khan was written while Samuel Taylor Coleridge was possessed by the ghost of an alien from said flying saucer, and was designed to subtly convince the reader to give themselves up to possession by said ghost.]]
* TheFogOfAges: [[spoiler:Professor Chronotis]] suffers from this.
* FromTheMouthsOfBabes: After announcing despairingly that the mystery must have a solution that even a child could see, Dirk goes out and asks a child, who immediately gives him what turns out to be the correct solution.
--> '''Child Selected At Random:''' [[spoiler: It's obvious, 'e must 'ave a time machine.]]
* GagNose: The dean of St. Cedd's College has an enormous nose. Richard is the first person who ever talked to him in seventeen years, three months and two days, five hours, nineteen minutes and twenty seconds (he counted) because everyone else was afraid of laughing right in his face.
* GenreBusting: ''DGHDA'' is described by its author as a "detective-ghost-horror-who dunnit-time travel-romantic-musical-comedy-epic".
* GhostlyGoals: [[spoiler:Gordon is able to move on after finishing his phone call to his sister Susan that he was killed in the middle of.]]
* HistoricalInJoke: The novel ties together the origins of life on earth, Creator/SamuelTaylorColeridge's epic poem "Kubla Khan", the extinction of the dodo, the career of Buxtehude, and dozens of other epochal or trivial events into an excellent approximation of a coherent plot.
* ImpersonatingAnOfficer: Used by Dirk as part of his BavarianFireDrill.
* IrrevocableMessage: While leaving an apologetic message on his girlfriend's answering machine, Richard makes a promise that he immediately realises he can't keep and will only make the situation worse. Which he attempts to revoke by [[spoiler:breaking into his girlfriend's apartment (while possessed by a ghost). And he ultimately ''succeeds'', for altogether more convoluted reasons ...]]
* LaserGuidedKarma: Whatever Dirk claims to believe in order to extract cash from gullible people invariably turns out to really be true, but always in such a way that he looks bad, sometimes in such a way that he suffers physical or emotional trauma, and never in such a way that he gets the money.
* LiteralMinded: The Electric Monk killed someone [[spoiler:named Gordon Way]] after misinterpreting a porter telling him to "shoot off".
* LiteraryWorkOfMagic: Creator/SamuelTaylorColeridge's poems contain secret messages conveyed to him while he was under the influence of [[spoiler:an alien ghost, as part of plan to wipe out the human race]].
* MagiciansAreWizards: Reg performs an impossible magic trick to entertain a restless little girl at a formal dinner. Nobody but Dirk realizes that it's genuinely impossible, and he decides to investigate.
* MikeNelsonDestroyerOfWorlds: [[spoiler:The extinction of the dodos was caused by Reg trying to prevent the extinction of the coelacanth.]]
* MisappliedPhlebotinum: Reg has a [[spoiler:time machine]] and he uses it to catch television shows that he missed.
-->'''Dirk:''' You have a [[spoiler:time machine]] and you use it for... watching television?\\
'''Reg:''' Well, I wouldn't use it at all if I could get the hang of the video recorder.
* NoBadgeNoProblem: Dirk does this as part of the workings of his Holistic Detective Agency when he has a mystery that actually interests him rather than one that involves tricking old ladies into letting their cats loose. The local inspector Sergeant Gilks takes a rather dim view of this... along with Dirk's tendencies to be involved in highly peculiar situations that Gilks does not like very much in the first place, as well as his habits of removing or obscuring evidence...
* NoCelebritiesWereHarmed: Gordon Way and [=WayForward=] Technologies are thinly-disguised spoofs of Sir Clive Sinclair and Sinclair Research respectively.
* NotSoPhonyPsychic: When he was in university, Dirk [[PhonyPsychic posed as a psychic]], was uncannily right, and got arrested for it. He now spends a lot of time insisting to people who were there that he's ''not'' psychic. Usually they don't believe him and his reputation often precedes him. Played with, as Dirk built his reputation for being a psychic at university by repeatedly and publicly insisting he ''was not'', in any way, shape, or form, a psychic. [[SuspiciouslySpecificDenial Which nobody had ever actually suspected him of being until he started denying it]].
** This is LampShaded in the radio dramatization when Dirk astonishes another character by making a prediction that almost immediately comes true.
--->'''Dirk:''' It's just my depressingly accurate powers of prediction.\\
'''Police Officer:''' You could clean up betting on the ponies with that.\\
'''Dirk:''' That's the depressing part -- I can't!
* OneSteveLimit: Averted with Gordon's sister Susan and secretary Susan at the office.
* OnlySaneMan: Richard [=Macduff=]. Richard is the only one who finds a horse randomly appearing in Reg's bathroom a bit peculiar. He's also the only one who notices that the way his sofa is stuck in his staircase is geometrically impossible. He fails to notice that Reg's magic trick is impossible though, preferring to assume there's a more mundane explanation.
* OurGhostsAreDifferent: A ghost's intangibility (along with its visibility) flickers in and out, allowing them to manipulate objects only at certain times.
* OurTimeMachineIsDifferent: [[spoiler:Reg's time machine is his entire office. The controls are an abacus, and the whole thing stops working after he hired someone to fix the phone.]]
* {{Oxbridge}}: Features St. Cedd's College, a fictional college at the real Cambridge University.
* PeekabooCorpse: A ghost discovers ''his own'' corpse in a cupboard. And faints.
* PerpetualPoverty: Dirk never seems to have much money -- a RunningGag is his secretary quitting over not getting paid -- and most certainly never gets paid by ''his'' clients. He manages to stay in his office, flat, etc, through arranging the situation so that it would be more inconvenient to actually eject him or force him to pay than just let him be and hope that he'll pay some day.
* PhoneCallFromTheDead: A guy makes a car phone call and starts talking into the answering machine, then gets killed. Just later his ghost tries to communicate by talking through the phone, which is recorded on the answering machine as well.
* PlugNPlayTechnology: The [[spoiler:time machine]] can automatically adapt itself to give information and receive instructions from any appropriate device connected to it, or even placed near it. Its owner says that this feature probably comprises more of the device's workings than those required to perform its actual function.
* ReligiousRobot: The Electric Monks, which were designed as a labour-saving device that would believe things so that their owners didn't need to; a malfunctioning one ends up involved in the plot.
* RippleEffectProofMemory: More prevalent here than usual; you have to lead a very sheltered life to never notice little discrepancies between your memories and reality.
* RubberBandHistory: Creator/SamuelTaylorColeridge finished writing "Kubla Khan" and nobody's ever heard of Music/JohannSebastianBach's music. By the end of the novel, both of these have become our familiar versions of history. There's also a cautionary anecdote about inadvertent time travel resulting in the extinction of the dodo.
* SanDimasTime: There's a telephone in the time machine, which can be used to straightforwardly communicate with the present. (On the other hand, there's a sequence where a character goes on a six-week trip into the past, and returns moments after he left.)
* SchmuckBait: Dirk ''told'' his fellow students he wasn't psychic, no matter how much money they offered him to predict the upcoming exam questions. [[spoiler:Subverted, because he unintentionally predicted ''exactly'' what the questions would be.]]
* ShoutOut: A few to [[Franchise/TheHitchhikersGuideToTheGalaxy Adams' other series]]:
** Richard asks Dirk if he always carries a [[Franchise/TheHitchhikersGuideToTheGalaxy towel]] around.
** Reg says that moving through time and space is closer than going to the chemist's--the opposite comparison that the ''Guide'' makes, "I mean, you may think it's a long way down the road to the chemist, but that's just peanuts to space, listen..."
* StarfishAliens: [[spoiler:Living members of]] the alien race never appear, but the description in the opening scene reveals they have purple crinkly skin, a single eye but multiple mouths and noses, and a variable number of legs, but always a prime. The reason the Electric Monk looks exactly like a Caucasian human is so that no-one could possibly mistake it for a real person.
* StevenUlyssesPerhero: [[spoiler:Albert Ross]]
* SuspiciouslySpecificDenial: Deliberately invoked by Dirk at university. By carefully denying the most extraordinary things, he convinces his fellow students that he's a psychic, mystic, telepathic, clairvoyant, psychosassic, vampire bat.
-->What did "psychosassic" mean?\\
[[PerfectlyCromulentWord It was his own word and he vigorously denied it meant anything at all.]]
* TakeThat: The Electric Monk is a deliberate slap in the face to all organized religion.[[note]]Adams had become something of a born-again atheist shortly before writing this book.[[/note]] The deluxe model in particular is "capable of believing things they wouldn't believe in [[{{UsefulNotes/Mormonism}} Salt Lake City]]."
* TalkingInYourSleep: How Dirk's supposed psychic powers manifested.
* ThisIsAWorkOfFiction: ''Holistic Detective Agency'' disclaims any resemblance to real people "living, dead, or wandering the night in ghostly torment".
* TimeAbyss: [[spoiler:The alien ghost has been around since before life on Earth began. He is understandably unhinged.]]
* TriggerPhrase: "my maiden aunt from Winnipeg"
* ViewersAreGeniuses: Unless you are quite familiar with the works of [[spoiler:Creator/SamuelTaylorColeridge ("Literature/KublaKhan" and the story of the "Person from Porlock" in particular)]], you will not understand the ending ''at all''. To make perfect sense, the novel also requires you to remember minor details from early in the book that eventually become major plot points (as mentioned above under ChekhovsArmoury), and several clues are left to the reader to connect themselves.
* WhatHaveWeEar: One of the conjuring tricks Reg does.
* WhoWantsToLiveForever: Or, technically, be dead and floating around as a ghost forever.