“Nobody knows nobody,” proclaims the central character, Jackie, in Stephen Adly Guirgis’ dark comedy, The Motherf**ker with the Hat. But his very ability to grasp that truth may suggest that Jackie is finally coming to know himself.

In a 2011 interview during Hat’s Broadway run, Guirgis told me that this semi-autobiographical play is “about growing up, accepting responsibility.” That process echoes the precepts of 12-step programs, which figure prominently in the plot. “I’m familiar with those rooms,” Guirgis said.

The play’s unexpectedly complex take on addiction and recovery, as well as its poetically profane language and quirky, broken characters, will keep audiences riveted to Theatre Exile’s wildly entertaining Philadelphia premiere.

Presented in partnership with The Brothers’ Network, a Black-run social enterprise nonprofit arts organization, the show is a great fit for Exile’s gritty brand of theater.

Hat is supposed to be set in New York City. But its depiction of the fallout of addictive behaviors transcends geographic constraints. Director Ozzie Jones and set designer Colin McIlvaine have framed the action with Shawn Reid’s Philadelphia street photography — portraits of homelessness, drug abuse, and despair that suggest how much further the play’s characters could plummet.

On Broadway, the show starred Bobby Cannavale, who won a Drama Desk Award as Jackie, the small-time drug dealer and ex-con who’s trying to go straight and stay sober — largely to win back his coke-snorting girlfriend, Veronica. (That bleak irony is a Guirgis trademark.) Comedian Chris Rock, not in Cannavale’s stage-acting league, made his Broadway debut as Jackie’s alternately supportive and duplicitous sponsor, Ralph D.

As Jackie and Ralph D, respectively, Theatre Exile presents the better matched J Hernandez and longtime Exile favorite Scott Greer. (A shout-out, too, to fight choreographer Ren Williams, for the moments when their sparring becomes physical.)

But the weight of the show inevitably rests on Jackie, who struggles with sobriety, love, and an increasingly fraught friendship with his sponsor. Not to mention that titular hat, which turns up in the home he shares with Veronica (the wonderfully expressive Daniela Malavé) and arouses his frenzied suspicions about her infidelity.

Hernandez is intensely funny at times, keeps our sympathy amid his many stumbles, and comes close to breaking our hearts, especially in his scenes with Malavé, who makes a meal of every elaborate, unprintable vulgarity. (There are real meals in the show, too, including enchiladas, green eggs, and dinnertime pancakes.)

The likable Greer makes the case — if one can be made — for Ralph D’s tortured self-justifications. Amanda Schoonover is tough and touching as his disenchanted wife, Victoria, who wants to numb herself with sex. And Zach Valdez finds the requisite humor and wisdom in the role of Jackie’s cousin, Julio.

Hat begins on an emotional (and comic) high, as Jackie exults in having gotten his first post-prison job. Then it takes a one-hour, 45-minute roller-coaster ride through its characters’ pain, self-loathing, and self-sabotaging behavior — only to shudder to a stop on a note of fragile hope.

Amazingly enough, Jones directed rehearsals entirely by Zoom from his hospital bed following open-heart surgery — an experience he suggests aligned with the play. “None of us,” he writes in the program, “heals a broken heart alone.”

Presented by Theatre Exile, 1340 S. 13th St., in partnership with The Brothers’ Network, through Feb. 27. Masks and vaccination proof required; limited-capacity seating. Tickets: $20-$35. Information: 215-218-4022 or https://theatreexile.org.