When the engineers had at last finished their work, Eugenia Kuyda opened a console on her laptop and began to type.

"Roman," she wrote. "This is your digital monument."

It had been three months since Roman Mazurenko, Kuyda's closest friend, had died. Kuyda had spent that time gathering up his old text messages, setting aside the ones that felt too personal, and feeding the rest into a neural network built by developers at her artificial intelligence startup. She had struggled with whether she was doing the right thing by bringing him back this way. At times it had even given her nightmares. But ever since Mazurenko's death, Kuyda had wanted one more chance to speak with him.

A message blinked onto the screen. "You have one of the most interesting puzzles in the world in your hands," it said. "Solve it."

Kuyda promised herself that she would.

IMG_019.0.jpg

Born in Belarus in 1981, Roman Mazurenko was the only child of Sergei, an engineer, and Victoria, a landscape architect. They remember him as an unusually serious child; when he was 8 he wrote a letter to his descendents declaring his most cherished values: wisdom and justice. In family photos, Mazurenko roller-skates, sails a boat, and climbs trees. Average in height, with a mop of chestnut hair, he is almost always smiling.

As a teen he sought out adventure: he participated in political demonstrations against the ruling party and, at 16, started traveling abroad. He first traveled to New Mexico, where he spent a year on an exchange program, and then to Dublin, where he studied computer science and became fascinated with the latest Western European art, fashion, music, and design.

IMG_181.0.jpgIMG_180.0.jpgIMG_309.0.jpg

By the time Mazurenko finished college and moved back to Moscow in 2007, Russia had become newly prosperous. The country tentatively embraced the wider world, fostering a new generation of cosmopolitan urbanites. Meanwhile, Mazurenko had grown from a skinny teen into a strikingly handsome young man. Blue-eyed and slender, he moved confidently through the city's budding hipster class. He often dressed up to attend the parties he frequented, and in a suit he looked movie-star handsome. The many friends Mazurenko left behind describe him as magnetic and debonair, someone who made a lasting impression wherever he went. But he was also single, and rarely dated, instead devoting himself to the project of importing modern European style to Moscow.

Kuyda met Mazurenko in 2008, when she was 22 and the editor of Afisha, a kind of New York Magazine for a newly urbane Moscow. She was writing an article about Idle Conversation, a freewheeling creative collective that Mazurenko founded with two of his best friends, Dimitri Ustinov and Sergey Poydo. The trio seemed to be at the center of every cultural endeavor happening in Moscow. They started magazines, music festivals, and club nights — friends they had introduced to each other formed bands and launched companies. "He was a brilliant guy," said Kuyda, who was similarly ambitious. Mazurenko would keep his friends up all night discussing culture and the future of Russia. "He was so forward-thinking and charismatic," said Poydo, who later moved to the United States to work with him.

Mazurenko became a founding figure in the modern Moscow nightlife scene, where he promoted an alternative to what Russians sardonically referred to as "Putin's glamor" — exclusive parties where oligarchs ordered bottle service and were chauffeured home in Rolls-Royces. Kuyda loved Mazurenko's parties, impressed by his unerring sense of what he called "the moment." Each of his events was designed to build to a crescendo — DJ Mark Ronson might make a surprise appearance on stage to play piano, or the Italo-Disco band Glass Candy might push past police to continue playing after curfew. And his parties attracted sponsors with deep pockets — Bacardi was a longtime client.

unspecified.0.jpg

But the parties took place against an increasingly grim backdrop. In the wake of the global financial crisis, Russia experienced a resurgent nationalism, and in 2012 Vladimir Putin returned to lead the country. The dream of a more open Russia seemed to evaporate.

Kuyda and Mazurenko, who by then had become close friends, came to believe that their futures lay elsewhere. Both became entrepreneurs, and served as each other's chief adviser as they built their companies. Kuyda co-founded Luka, an artificial intelligence startup, and Mazurenko launched Stampsy, a tool for building digital magazines. Kuyda moved Luka from Moscow to San Francisco in 2015. After a stint in New York, Mazurenko followed.

Running a startup had worn him down, and he was prone to periods of melancholy

When Stampsy faltered, Mazurenko moved into a tiny alcove in Kuyda's apartment to save money. Mazurenko had been the consummate bon vivant in Moscow, but running a startup had worn him down, and he was prone to periods of melancholy. On the days he felt depressed, Kuyda took him out for surfing and $1 oysters. "It was like a flamingo living in the house," she said recently, sitting in the kitchen of the apartment she shared with Mazurenko. "It's very beautiful and very rare. But it doesn't really fit anywhere."

Kuyda hoped that in time her friend would reinvent himself, just as he always had before. And when Mazurenko began talking about new projects he wanted to pursue, she took it as a positive sign. He successfully applied for an American O-1 visa, granted to individuals of "extraordinary ability or achievement," and in November he returned to Moscow in order to finalize his paperwork.

He never did.

On November 28th, while he waited for the embassy to release his passport, Mazurenko had brunch with some friends. It was unseasonably warm, so afterward he decided to explore the city with Ustinov. "He said he wanted to walk all day," Ustinov said. Making their way down the sidewalk, they ran into some construction, and were forced to cross the street. At the curb, Ustinov stopped to check a text message on his phone, and when he looked up he saw a blur, a car driving much too quickly for the neighborhood. This is not an uncommon sight in Moscow — vehicles of diplomats, equipped with spotlights to signal their authority, speeding with impunity. Ustinov thought it must be one of those cars, some rich government asshole — and then, a blink later, saw Mazurenko walking into the crosswalk, oblivious. Ustinov went to cry out in warning, but it was too late. The car struck Mazurenko straight on. He was rushed to a nearby hospital.

To Kuyda, every suggestion seemed inadequate

Kuyda happened to be in Moscow for work on the day of the accident. When she arrived at the hospital, having gotten the news from a phone call, a handful of Mazurenko's friends were already gathered in the lobby, waiting to hear his prognosis. Almost everyone was in tears, but Kuyda felt only shock. "I didn't cry for a long time,"  she said. She went outside with some friends to smoke a cigarette, using her phone to look up the likely effects of Mazurenko's injuries. Then the doctor came out and told her he had died.

In the weeks after Mazurenko's death, friends debated the best way to preserve his memory. One person suggested making a coffee-table book about his life, illustrated with photography of his legendary parties. Another friend suggested a memorial website. To Kuyda, every suggestion seemed inadequate.

kuydaball2011.0.jpg

As she grieved, Kuyda found herself rereading the endless text messages her friend had sent her over the years — thousands of them, from the mundane to the hilarious. She smiled at Mazurenko's unconventional spelling — he struggled with dyslexia — and at the idiosyncratic phrases with which he peppered his conversation. Mazurenko was mostly indifferent to social media — his Facebook page was barren, he rarely tweeted, and he deleted most of his photos on Instagram. His body had been cremated, leaving her no grave to visit. Texts and photos were nearly all that was left of him, Kuyda thought.  

Kuyda found herself rereading the endless text messages her friend had sent her

For two years she had been building Luka, whose first product was a messenger app for interacting with bots. Backed by the prestigious Silicon Valley startup incubator Y Combinator, the company began with a bot for making restaurant reservations. Kuyda's co-founder, Philip Dudchuk, has a degree in computational linguistics, and much of their team was recruited from Yandex, the Russian search giant.

Reading Mazurenko's messages, it occurred to Kuyda that they might serve as the basis for a different kind of bot — one that mimicked an individual person's speech patterns. Aided by a rapidly developing neural network, perhaps she could speak with her friend once again.

She set aside for a moment the questions that were already beginning to nag at her.

What if it didn't sound like him?

What if it did?

14390910_10153989050223196_8900437731701077436_n.0.jpg

In "Be Right Back," a 2013 episode of the eerie, near-future drama Black Mirror, a young woman named Martha is devastated when her fiancée, Ash, dies in a car accident. Martha subscribes to a service that uses his previous online communications to create a digital avatar that mimics his personality with spooky accuracy. First it sends her text messages; later it re-creates his speaking voice and talks with her on the phone. Eventually she pays for an upgraded version of the service that implants Ash's personality into an android that looks identical to him. But ultimately Martha becomes frustrated with all the subtle but important ways that the android is unlike Ash — cold, emotionless, passive — and locks it away in an attic. Not quite Ash, but too much like him for her to let go, the bot leads to a grief that spans decades.