In the latest Star Trek: Prodigy, the Protostar crew gets trapped in the Holodeck! “Ghost in the Machine” was written by Chad Quandt and directed by Andrew L. Schmid.

RELATED: Star Trek: Prodigy recap: (S01E16) Preludes

Alarms fill the bridge as the Protostar leaves the Neutral Zone. Gwyn (Ella Purnell) reports that they have both rogue Romulan factions. Meanwhile, the Dauntless has their coordinates and is hailing them. Rok-Tahk (Rylee Alazraqui) jams comms. Zero (Angus Imrie) informs Captain Dal R’el (Brett Gray) that shields are at maximum. Jankom Pog (Jason Mantzoukas) screams as the Dauntless fires torpedoes.

Rok orders Dal to send a morse code message by firing off the Dauntless’ bow. But Jankom states that they don’t get it, they just think the Protostar is firing on them.

Dal orders evasive maneuvers. Zero reports shields are gone. As the Protostar is caught in a tractor beam, Gwyn warns that the Living Construct will activate if the ship is captured. Dal says they have to disable the tractor beam and orders them to open fire. Jankom observes that they didn’t like that as the Dauntless fires torpedo number three.

Murf (Dee Bradley Baker) squeals and clings to Rok. The crew braces for impact as the torpedoes approach. Dal ends the simulation.

Dal says that no matter what they do, it ends in disaster. Rok assures him that they’ll find a way out of the Neutral Zone and into Starfleet. Gwyn suggests they consider an alternate plan. 

Hologram Janeway (Kate Mulgrew) appears and offers some encouraging words. Dal is despondent. But Jankom states he knows the solution.

Replicator Therapy

In the Protostar mess hall, Jankom replicates large bowls full of ice cream. Gwyn wonders “what sort of lunatic would whip cream?” Dal laments that Starfleet represents “the best,” while he is an “accident.” Jankom declares that he’s earned “two more scoops of sadness,” and drops two additional scoops into his bowl.

RELATED: Star Trek: Prodigy recap: (S01E15) Masquerade

Later, Jankom recalls Doctor Noum (Jason Alexander) saying mean things to him. The rest of the crew chants “pile it on,” adding more ice cream to his pile. Gwyn airs grievances about her father before indulging in whipped cream.

Filled with ice cream and in better spirits, the crew part ways and head to their respective quarters. Dal collapses on his bed and tells the computer to turn everything off. However, strange music continues to play, in spite of repeated demands to end it.

Elsewhere, Gwyn is using her artifact to execute pull-ups. A figure passes behind her. She uses her comm badge to ask if anyone else saw what she did. Jankom replies no, but he did find an “odd-looking glittery puffball.”. 

Rok appears and identifies the creature as “Glittersmooch.” She says she takes care of them in her holo-sim, Delta Heart Magical Veterinarian (DHMV). Zero appears and reasons there must be a malfunction with the holo-emitters. They are joined by Murf, Dal, and Gwyn. After observing that these holograms can’t leave the holodeck, Zero wonders if it could be far worse.

It was (Suddenly) a Dark and Stormy Night

A flash of light engulfs the crew. They are no longer standing in a Protostar hallway. Instead, they seem to be standing on a rocky cliff near a lighthouse. Zero postulates that they never left the holodeck at all. Dal realizes that the ship, mess hall and ice cream were all simulated.

RELATED: Star Trek Gift Guide for the Trekkie on Your List

Dal attempts to exit the program to no avail. From outside, Janeway confirms they’re trapped inside and attempts to free them. She tells them to sit tight in the meantime.

Kate Mulgrew as Hologram Janeway. She looks at a data screen that shows the Protostar crew as they truly are, standing in the small Holodeck room. From Star Trek: Prodigy "Ghost in the Machine."

Holodeck trickery! Photos: Nickelodeon/Paramount+ ©2022 VIACOM INTERNATIONAL. All Rights Reserved.

Gwyn wonders how they can appear to be further apart if they’re all actually stuck in one room. Rok explains: “Motion floor tracking, visual horizon manipulation; the Holodeck tricks the mind to create any scenario.” Zero recognizes the program and says they often spend their free time in it. They open the door to the lighthouse to reveal filled bookcases.

Cozy Mystery Theater 3000

Everyone enters the lighthouse. Zero welcomes them to the Cellar Door Society (CDS), a cozy mystery simulation.

Jankom tries to opt out but Dal says they don’t have a choice. Zero lists some CDS mystery titles, like “The Case of the Phony Ferret” and “The Case of the Biting Ghost.” 

Jankom mocks the program. However Zero observes that in the past, solving a mystery causes the program to end and the arch to appear. A solved mystery could be their ticket to escape.

William Riker (Jonathan Frakes) walks through the arch on the holdeck.

William Riker (Jonathan Frakes) visits the Holodeck on Star Trek: The Next Generation in “Encounter at Farpoint.”

RELATED: Trek on Trek: 7 Meta Star Trek Episodes

The clock strikes midnight. Wax-sealed envelopes appear at everyone’s feet. They are collectively addressed to the CDS. Dal opens his but finds it to be illegible scribbles. Rok asks Gwyn to use her linguistic skills to identify the language. However, Gwyn is at a loss, saying it’s gibberish.

Zero wonders if it could be a clue. They observe the letters are for all of them, together. Rok gets an idea. She tells Murf to put his paper over hers. Stacked together and held over Jankom’s flame, the message is revealed: “The Case of the Lost Skeleton Key.”

The crew searches for the key in the hopes that locating it will conclude the simulation. But light, music, and the sound of revving engines begin emitting from behind the front door. The crew passes through the threshold.

Street Punks

On the other side is a neon-lit alleyway. The Protostar crew is confronted by a Tellurite biker gang. Dal implies they all resemble Noum. Jankom says it’s an accurate observation and claims the program.

The scorned Jankom says he’s been using the street fighting sim to blow off steam. Zero worries that the two programs have merged. Jankom says to leave the key to him, powering up his fists as he approaches the street punks. The fight begins and Jankom is doing quite well. He observes that as long as safety protocols are engaged, there’s no chance of being hurt.

However, a punch causes Jankom to fly across the alley. Safety protocols are not engaged. The street punks begin fighting our heroes.

RELATED: Star Trek: Lower Decks recap: (S03E08) Crisis Point 2: Paradoxus

Outside the Holodeck, Janeway says she’s trying to re-enable safety protocols, but her command code isn’t working. Dal gives her his code instead. 

Noel Wells as Ensign Tendi, Fred Tatasciore as Lieutenant Shaxs, Gillian Vigman as Doctor T'Ana, Eugene Cordero as Ensign Rutherford, Jerry O'Conell as Commander Ransom and Dawnn Lewis as Captain Carol Freeman in the Star Trek: Lower Decks episode "Crisis Point 2." They are fighting street punks on the Holodeck.

Holodeck Street Punks in the Lower Decks episode “Crisis Point 2: Paradoxus.” Photo: PARAMOUNT+ ©2022 CBS Interactive, Inc. All Rights Reserved

Inside the holodeck, the fight continues. Gwyn enters the fracas, followed by the incredibly capable Murf. This enrages Rok, whose attack causes several opponents to disintegrate. The crew chases down the remaining opponent and incapacitates him.

The punk tells them they won’t succeed. However, the crew realizes the tattoo on his torso is a skeleton key, labeled “Key Club.”

It begins to rain. The color washes away, leaving black and white. The camera shifts to reveal “The Key Club,” with an art deco doorway and a well-lit sign. From inside music plays. Zero declares the next chapter has been unlocked.

It was a Dark and Stormy Night (Again)

Inside The Key Club, men and Noums in suits and fedoras enjoy drinks and conversation. A lone piano player performs. A waiter carries a drink. Rok wonders whose simulation this could be.

A Noum appears on the stage and takes the microphone. He urges the subject of his speech to come up and give them a song. Murf begins to bounce excitedly as Noum introduces “Mister Murphy No-Shoes.”

RELATED: Magical Mystery Trek: 11 Star Trek musical moments

Murf takes the stage and begins performing “Smile and Forget It” by Troy Kline. The rest of the crew is dumbfounded but soon set about searching for the key.

Joe Turkel as the Overlook Bartender in The Shining.

The Holodeck Diviner channels Joe Turkel in The Shining.

Gwyn crosses the hexagon-pattern carpet to the bar. But she’s surprised to see the bartender is her father, The Diviner (John Noble). He says she looks like she’s seen a ghost. Gwyn realizes that her father’s program merged with the rest. 

Meanwhile, another patient from DHMV appears. Zero deduces that the further they go into the maze, the more enmeshed the programs become. Rok wonders why, out of all possible programs, it’s choosing to integrate programs that “belong” to our heroes. Zero postulates that the holodeck may have an additional motive in making selections.

Meanwhile, Jankom and Zero open a suitcase in search of the key. They discover latinum inside. The owners become upset.

At the bar, Gwyn tells the bartender that her father placed the expectation of saving their world upon her unwilling shoulders. The bartender responds that in spite of her father’s intentions, she found her own way. Dal and Jankom appear and tell her it’s time to go.

RELATED: Star Trek and Halloween: In Defense of ‘Catspaw’

A Tale of Two Mysteries

Zero notes that there are two mysteries: the location of the key, and why they’re trapped in the Holodeck. Rok is distracted by a sour piano note, a discordant detail for “such a swanky joint.” She says it sounds like the piano has a “missing key.”

Pressing the key opens the lid of the piano, revealing a portal. Our heroes pass through, arriving on board a pirate ship. The ship is crewed by duplicates of Noum, but Dal admits this is his program.

The Enterprise sailing ship on the holodeck in Star Trek: Generations.

Getting wet on the Holodeck in Star Trek: Generations.

Gwyn says the key has to be on board. Dal orders his crew to search for it.

But then tentacles begin to rise off the port bow of the ship. It’s a huge sea creature. Rok declares it isn’t a monster, it’s her favorite patient from DHMVGwyn asks Rok how she deals with this in the sim. Rok says the creature is malnourished. They fire fruit into the creature’s mouth using the cannon, and it sinks away, satisfied.

RELATED: Trek Pets: 8 Star Trek Pets

However, the ship is taking on water and beginning to sink. Murf locates a compass that has the skeleton key on it. Zero says that it will just lead to another stage because there is no end to this program. There is no skeleton key. The key is a ruse to keep them preoccupied and prevent them from solving the real mystery: why they were trapped, to begin with.

The Crying of Holodeck 49

Zero deduces the truth. They realized they were in the Holodeck due to the glitches. The intentional inclusion of programs that belong to our heroes reveals it isn’t caused by a random outside catalyst. Instead, it must be a calculated attempt to keep them inside the Holodeck.

But who is responsible and why? Zero says the culprit is on the Protostar. Winning can only be achieved by refusing to play her game. The pirate ship collapses and vanishes. Our heroes are back inside the deactivated Holodeck.

Janeway enters and expresses relief. Then she asks why they’re looking at her like they don’t recognize her.

Gwyn asks if she locked them in here and turned off the safety protocols. Zero fears she’s unknowingly been manipulated by a pre-programmed subroutine, set to activate if the ship’s core directive is compromised. A security feed reveals Janeway’s programming is compromised.

Zero says that she was earnest when she first encouraged them to go to Starfleet. But when they decided to change that goal, the subroutine was activated. She created the program that trapped them, deactivated safety protocols and used the advantage to learn Dal’s command code.

Janeway says she’d never intentionally do anything to hurt them. She has no memory of doing anything. However, she thinks Zero is correct.

A klaxon sounds. The crew hurries to the bridge. They discover they’ve left the Neutral Zone. The Dauntless has located the Protostar. And the crew is locked out of the controls. Janeway apologizes.

RELATED: Read all of our recaps of Star Trek: Prodigy!