Abigail Willard meets herself coming and going.

Literally. The heroine of Debra Jo Immergut’s second novel, “You Again,” keeps colliding with her younger self in New York. At first Abigail, a married, middle-aged mother of two, assumes she’s seeing a freakishly similar look-alike. But the girl with her hairstyle is wearing her shoes and raincoat, and she is making out with Abigail’s dangerous addict ex-boyfriend on a street corner: It is, maybe, Abigail herself. And her younger self must be warned.

“You Again” is an alluring mystery from Immergut, whose first novel, “The Captives,” was nominated for an Edgar Award. It’s also an elegant literary puzzle. The novel’s epigraph is from Jorge Luis Borges’s “Labyrinths,” and Immergut has constructed her tale as an ingenious maze. Is Abigail, a talented painter who abandoned her art for marriage, parenthood and a dull job as an art director, experiencing a typical midlife crisis, “hallucinating about my lost youth, the road not taken, etc.,” as she muses in her diary? She’s certainly checking things off the midlife crisis to-do list, including an infidelity. On the other hand, “surely the most confused person on the planet” may have something seriously wrong with her: psychiatrically, neurologically.

Trying to crack the Abigail case is the job of the novel’s secondary cast. Police detective Jameson Leverett meets her when her budding-activist teenage son is arrested for an antifa action. The detective has funneled her file to a neurologist in Montreal, and to a physics professor in California. It isn’t giving away too much to reveal that their research focuses on an accident that occurred when Abigail was exactly the age of her Manhattan doppelganger. Emails between this trio to discuss their hypotheses on her bizarre behavior are scattered throughout the novel, along with some enigmatic therapists’ notes on both Abigail and her mysterious double, known only as “A.”

“You Again” offers a sophisticated argument about the nature of time and memory: “Although we experience time as unidimensional – as a unidirectional sequence of events – physicists have known this to be an illusion since Einstein.” But Immergut doesn’t dismiss the more workaday concerns of her Brooklyn couple as they try to be good parents and citizens of a New York that, like Abigail and her husband, Dennis, has irretrievably changed. The gallery that hosted Abigail’s first art show is now a fancy grocery store; a Village East tenement where she once lived is now a 20-story condo building. “There are no junkies sleeping in the stairwell, and no cumbia music wafting up the fire escapes. There are no fire escapes.” Like Abigail’s addled brain, “New York City is full of ghosts.” The young Abigail was a self-professed “experience junkie,” who brought herself nearly to ruin, yet her middle-aged self feels nostalgic for the wildness of those days.

Balancing the kinetic plot — which involves, among other things, a beheaded pigeon, a fire and an international ring of thieves — with a realistic portrait of an ordinary marriage is no mean feat. But Immergut writes well about the kind of weary, inchoate longing that can grow to define a long-term marriage. Their marriage, Immergut writes, “seemed to have entered a different phase. Call it an afterlife. . . . We would let the edges remain indistinct, softened by a layer of cool quiet, like snow.” Abigail and Dennis met in art school, and as the subplots race along, both attempt to return to their studios. An old chum of theirs, now world-famous, claims to be eager to help them stage comebacks. Who will be successful first, and will the pair reclaim their relationship amid all the furious changes?

It’s quite common for writers to transform their protagonists into painters to avoid the autobiographical cliche of writers writing about writers. But that feint doesn’t always succeed, because the painters still talk and think like writers. One of the pleasures of “You Again” is how capably Immergut captures her visual artist’s thought process. Abigail thinks in color, in texture. “Standing at my easel,” Abigail says, “I feel like an open bucket, a rain barrel. I like to imagine the top of my head open, and the colors pouring in from some higher plane, some great source. Not God, not the sky. Instead, it’s the bright storm of energy that clangs and sloshes over and around every existing thing. . . . In my best moments, I can almost feel it burgeoning, primed to release its bounty, to make life richer, and deepen into art.”

Immergut, who like her heroine toiled at a soul-killing day job for many years, writes with clarity and compassion about “ambitions that refused to be thwarted.” Think of “You Again” as “A Portrait of the Artist as a Not-so-Young Woman,” on a shelf that would include Claire Messud’s “The Woman Upstairs” — but with the addition of a mystery as a compelling chaser.

Lisa Zeidner’s most recent novel is “Love Bomb.” Her book of criticism, “Who Says?: Mastering Point of View in Fiction,” is forthcoming.

YOU AGAIN

By Debra Jo Immergut

Ecco Press. 304 pp. $27.99