Robert Hunter gave the Grateful Dead’s psychedelic sound quicksilver conceptual coherence and old-timey cred. Photograph by Ed Perlstein / Redferns / Getty

April Fools’ Day, 1986. I had just turned seventeen and was on the floor of the Providence Civic Center. The Grateful Dead. I’d worked my way up to a spot about twenty feet from the lip of the stage and found myself within winking distance of Jerry Garcia, an immensity in a red T-shirt that hung halfway to his knees. (“Trouble ahead, Jerry in red,” the Deadheads liked to say.) I’d never stood so close. I could see the pearl inlay in the frets of his guitar neck and the ghostly pallor of his skin. Three months later, ravaged by opiates and ill health, he would fall into a diabetic coma, an experience that he’d later recall as being “one of furious activity and tremendous struggle in a sort of futuristic, space-ship vehicle with insectoid presences.” But on this night, despite the power of his guitar, and of his growling tenor and still palpable charisma, it seemed that he might die any minute.

He was playing a song called “Black Peter,” a bluesy dirge from the band’s 1970 album “Workingman’s Dead.” It is a first-person account of a hard-luck pauper on his deathbed: “One more day I find myself alive / Tomorrow maybe go beneath the ground.” Garcia, though only forty-three, had deteriorated into the title role, so that a song that had once seemed evocative, almost actorly—an imagined character conveyed by a man of prodigious gifts—now seemed downright real. Jerry was Peter. The song ends by shifting into the point of view of people thronging to watch him die. In Providence, Garcia sang, with some gruff delicacy, in my apparent direction: “Take a look at poor Peter / He’s lying in pain / Now let’s go run and see.” After moaning the words “run and see” a few times, he turned away from the microphone with something like disgust. So this is what we were doing, all of us who’d crammed into that arena, antic with chemicals and adulation: we’d run to see poor Peter, to gawk at the pain. This may seem melodramatic to you now, but the moment was more than a callow teen-ager, mostly unacquainted with death or real pain, could bear. I was transfixed, and ashamed.

The song’s lyrics, like those to most of the band’s original songs (and certainly the best ones), had been written by Robert Hunter, who died last week, at the age of seventy-eight. He never performed with the band but provided it with the universe of images, ideas, and tales—and all the one-liners, couplets, anthems, and puzzlers—that gave some quicksilver conceptual coherence and old-timey cred to the Dead’s shambling psychedelic Dixieland. He grounded it, if you can say that, in a phantasmagoric reiteration of American folk legend: drifters, thieves, rounders, jailbirds, horndogs, vigilantes, and roustabouts. “Truckin’,” “Ripple,” “Friend of the Devil,” “Stella Blue,” “Uncle John’s Band”—all written by Hunter. There were very few conventional, charting hits but lots of home runs.

Hunter, who had known Garcia since their late teens, gave the singer a songbook that would come to suit or even re-create him, as he evolved and then went to pieces—and that somehow also involved or even implicated the audience in its ever more suffocating relationship with the singer they’d come running to see. The songs were about Garcia, and they were about you. (“It belongs to you, honey,” the singer Donna Jean Godchaux says, when she speaks of the songbook in Amir Bar-Lev’s documentary “Long Strange Trip,” from 2017.) Garcia was in his twenties when he first sang “Black Peter.” An old soul already, but still young. By 1986, he had the bearing of an oracle, a voice from beyond the grave. This effect was in many ways an invention of Hunter’s, though it’s never been clear to me how intentional it was. It may have been that Hunter’s poetry just happened to speak to (and for) Garcia. Garcia often said that he felt silly singing lines that were too preachy, too on-the-nose. Hunter’s elliptical, allusive style suited him. “Hunter’s very good about writing into my beliefs,” Garcia said. “He understands the way I think.”

Hunter was born Robert Burns and had a peripatetic childhood, including some time in a foster home. He took the surname of a stepfather. He had a flirtation, in the sixties, with Scientology and a problem, for a while, with speed. He was a seeker, a restless soul, an outsider. A friend of mine, on hearing of Hunter’s passing, told me that, in some ways, by his reckoning, Hunter had been dead all along. The man seemed to know something about death. After Garcia awoke from his coma, in 1986, Hunter had a new song for him, called “Black Muddy River.” Hunter, who rarely explained where his songs came from, told the writer Steve Silberman, in 1992, that the inspiration for it was his recurring dream of a “black, lusterless, slow-flowing Stygian river. . . . It’s vast and it’s hopeless. It’s death, with the absence of the soul. It’s my horror vision, and when I come out of that dream I do anything I can to counter it.” The lone Grateful Dead hit to come out of the post-coma period was a deceptively jaunty number, composed a half-decade earlier, called “Touch of Grey,” which Hunter worked up while suffering a wicked cocaine hangover. Hunter knew that cocaine was diabolical, and identified its arrival on the scene (around the time he wrote “Black Peter”) as the forbidden fruit to their Eden, but he didn’t always abstain. It may be that some of the wistful we-had-something-special-but-now-it’s-gone undertones of Hunter’s post-sixties songs—the golden-era stuff of “Workingman’s Dead” and “American Beauty,” along with a slew of beloved songs the Dead never recorded in a studio, such as “Tennessee Jed,” “Brown-Eyed Women,” “Wharf Rat,” and “Ramble On Rose”—owe something to the regret that gnawed at Hunter over the effects of cocaine on the whole enterprise.

Hunter, who had a singular, awkward singing style, pursued a fitful career as a solo performer, too, and collaborated with other ace songwriters, including Jim Lauderdale and Bob Dylan. (And it’s not all darkness: he wrote a love song for Lauderdale and Ralph Stanley called “Joy, Joy, Joy.”) But it’s the ventriloquism with Garcia that earned him a place beside them. He and Garcia met in 1961—of all things at a performance of “Damn Yankees.” They were fellow-folkies who considered themselves beatniks, though they were too young to be beats and ultimately too old to be hippies. For a while, they performed together, as Bob and Jerry. When Garcia formed the Grateful Dead and began looking for original material, Hunter, who’d served as a guinea pig in the C.I.A.’s Bay Area experiments with LSD, sent him a few songs he’d written, acid-infused wordplay bordering on nonsense. The Dead used them (“China Cat Sunflower,” “St. Stephen,” “Alligator”) and then invited him to join the band as a lyricist. He gave them “Dark Star,” a launching pad for decades of improvisational exploration.

In “Long Strange Trip,” there’s a sequence in which Bar-Lev, after years of trying to get to Hunter, is granted an audience backstage after a solo gig. Hunter was always elusive and notoriously averse to discussing the meanings or sources of his compositions (though he was insistent about the songwriter’s claim to royalties and credit, as the Internet undermined each). In the film, Hunter recites the lyrics to “Dark Star” (“Dark star crashes, pouring its light into ashes / Reason tatters, the forces tear loose from the axis / Searchlight casting for faults in the clouds of delusion / Shall we go, you and I while we can / Through the transitive nightfall of diamonds?”) and says, “What’s unclear about that?” Then he kicks Bar-Lev out of his dressing room.

Last week, Bar-Lev, who had interviewed me for “Long Strange Trip,” sent me a link to a long reply that Hunter wrote, in 1996, to a scholarly essay that called his lyrics meaningless. “Meaning is often a subterfuge to distract the listener’s attention from a writer’s lack of multiple resources,” Hunter writes. Then he presents an exegesis of his 1975 song “Franklin’s Tower,” which became a great crowd-pleaser, in Garcia’s hands. Hunter cites, among some of his references, Ben Franklin, the Constitution, Pete Seeger, the Bible, E. E. cummings, Bonnie Dobson, an Eastertide anthem called “Roll Away the Stone,” and the birth of his son.

“Well, now that you know what I meant by it, it’s no great shakes, is it?” Hunter concludes. “Mystery gone, the magician’s trick told, the gluttony for ‘meaning’ temporarily satisfied, one can now take issue with my intent and avoid the song itself.” Run and see.