HK-47 was a Hunter-Killer assassin droid and Jedi hunter constructed by the Dark Lord of the Sith Darth Revan shortly after the end of the Mandalorian Wars in 3,960 BBY.
In the wake of widespread destruction caused by the Mass Shadow Generator, a superweapon used during the final battle of that conflict, Revan was inspired to seek more subtle methods of defeating his enemies. HK-47 was sent throughout the galaxy on his missions and successfully assassinated countless targets whom Revan had deemed threats to galactic stability and peace. However, HK-47 was badly crippled and captured on a mission in Mandalorian space shortly before Revan himself was captured by the Jedi Order. The assassin droid's memory core was damaged, causing him to forget about his master, and he went from owner to owner, many of whom he inadvertently slew personally.
Eventually, he ended up on the planet Tatooine, where he was sold to and unwittingly reunited with Revan, whose memory had been erased following his capture. The droid went on to aid Revan after his return to the Jedi Order in his campaign to find and destroy the Star Forge, an ancient factory that Revan had used during his reign as the Dark Lord of the Sith. HK-47 was also instrumental in the defeat of Revan's former Sith apprentice, who had since begun utilizing the Star Forge in an attempt to conquer the Galactic Republic.
HK-47 accompanied Revan to the edge of the Unknown Regions along with Revan's utility droid, T3-M4, before being left behind in Revan's starship, the Ebon Hawk, as the redeemed Jedi Knight journeyed on to face a threat he had remembered from his time as the Dark Lord. Sometime later, HK-47 was damaged and was left aboard the Ebon Hawk, which eventually ended up in the hands of one of Revan's allies from the Mandalorian Wars, Meetra Surik, also known as the Jedi Exile. During this period, HK-50 assassin droids, a newer version of HK that Revan had mass-produced, became active in the galaxy, working as bounty hunters and saboteurs. Surik repaired HK-47, who recognized her as his new master and accompanied her in order to find the source of the HK-50s, whose very existence he considered an insult to himself. HK-47 also aided Surik in her search for the Jedi Masters who survived the First Jedi Purge and even advised her on techniques to more efficiently kill Jedi so that Surik could better defend herself.
HK-47 eventually succeeded in finding the HK Manufacturing Plant, where the HK-50s were created. There, he convinced the HK-50s to join his and Surik's cause. This action eventually culminated in a final confrontation on Malachor V between HK-47, assisted by the HK-50s, and G0-T0, whose interests conflicted with that of Surik, and the latter droid was destroyed. Four millennia later, HK-47 was found on the planet Mustafar, where his memory core was preserved within the computer of a derelict starship. HK-47 manipulated a group of spacers who discovered him, having them create a new body for him and then subsequently turning on them with the help of several battle droids. The spacers were forced to disable HK-47's new droid army as well as the factory producing them. After a fierce battle, the spacers triumphed over the droids, although HK-47 managed to escape destruction.