“The Assignment” is episode five of season five of Star Trek: Deep Space Nine.
Chief O’Brien is worried because Keiko is returning to the station after a few days away, and he and Julian have managed to kill her bonsai trees. Oddly, she doesn’t seem that bothered about it, but then she claims that she isn’t Keiko.
O’Brien thinks she is joking, but a demonstration briefly stops Keiko’s heart. She has been possessed by an entity who wants Miles to do things on the station for her.
O’Brien hears, from Odo and Jake, that the caves that Keiko visited are supposed to be haunted by a type of wraith, which leads him to believe that that is what has possessed Keiko. If Miles tells anyone, the wraith states that it will kill his wife.
With no other choice, and a time limit, Miles has to carry out the modifications to the station that the entity is demanding, with no clue as to what the modifications are for and with the constant problem that the rest of the crew will discover what he is doing. Rom, who had joined the station’s engineering staff in “Bar Association”, proves to be helpful, in more than one way.