In the quietly stirring drama “Marjorie Prime,” writer-director Michael Almereyda and a quartet of sensitive actors explore the idea of memory — and how much of who we are is based on what we remember about ourselves and what others remember about us.

Set in the near future, the story begins with Marjorie (Lois Smith), an 86-year-old woman in faltering health and diminished memory. She sits in her nicely appointed house on the ocean, talking to a handsome man (Jon Hamm). The man is the very image of Marjorie’s late husband, Walter, in his younger days.

(Jason Robinette | courtesy Sundance Institute) Jon Hamm plays a robot companion in director Michael Almereyda's drama "Marjorie Prime."

As they speak, the relationship between these two is made apparent: This man is a hologram, programmed to speak in Walter’s voice and mannerisms, to repeat Marjorie’s life stories back to her. The hologram, dubbed Walter Prime, is also programmed to learn, to adapt his behavior as he gathers more information about Walter.

The programmer is Jon (Tim Robbins), Marjorie’s son-in-law, who regularly feeds Walter Prime with background on Marjorie’s life. Marjorie’s daughter, and Jon’s wife, Tess (Geena Davis), reluctantly goes along with all this, and her objections point out the prickly relationship she has had with her mother over the years.

The characters talk about the malleability of memory and how when we remember, we’re recalling the last time we had that memory — and, like a copy of a copy of a copy, the memory fades and distorts. And memories can be altered, as Marjorie tries with Walter Prime when recalling how she and Walter became engaged after seeing a movie. Marjorie decides the story would be better if the movie were a classic, like “Casablanca,” rather than the actual movie they saw (“My Best Friend’s Wedding,” with Julia Roberts), and Walter Prime incorporates that change into his programming.

The complications of recalling memory become clearer as Almereyda’s script (adapted from Jordan Harrison’s stage play) jumps ahead in time. Here, Marjorie has died, and Tess copes with the loss by talking to a Marjorie Prime hologram.

Almereyda doesn’t stray far from the story’s stage roots — almost every scene is in the house, with characters talking to each other — so the emphasis is on dialogue and performance. The discussions are smart, sharp and insightful, raising important questions about the fragility of memory and our reliance on technology to fill the gaps. (At this year’s Sundance Film Festival, the movie won the Alfred P. Sloan Prize, given to movies with science and technology themes.)

In a quartet of great performances in “Marjorie Prime,” Smith’s stands out. The venerable character actor, whose career goes back to “East of Eden” and “Five Easy Pieces,” captures the cloudy forgetfulness of the aged Marjorie and the wide-eyed curiosity of her electronic doppelgänger, while hinting at the youthful spirit she once was.

* * * 1/2

Marjorie Prime

An old woman connects with a hologram of her dead husband in this thoughtful drama about memory and technology.

Where • Megaplex Jordan Commons (Sandy).

When • Opens Friday, Oct. 6.

Rating • Not rated, but probably R for one scene of nudity and some language.

Running time • 99 minutes.