Oathkeeper is one of two Valyrian steel longswords made from Ice, the greatsword of House Stark, under orders of Lord Tywin Lannister. While initially given to Jaime Lannister by Lord Tywin with the intention of making it an heirloom of their house, Jaime instead gave it to Brienne of Tarth for the task of rescuing Sansa Stark. Its sister blade is Widow's Wail.
Tywin gives the sword to his son Jaime, intending for him to be released from his vows as Lord Commander of the Kingsguard and rule over Casterly Rock in his stead. When Jaime refuses, Tywin lets him keep the sword anyway and tells him that a one-handed man without family (implying Jaime had been disowned) needs all the help possible.
Following King Joffrey's death, Jaime tasks Brienne with finding Sansa Stark and get her somewhere safe before Cersei locates her. As a parting gift, he gives her the sword, as he knows it was reforged from Ice, so she can protect Ned Stark's daughter with Ned's own blade. She considers a name for a few moments, before choosing "Oathkeeper".
When Brienne and Podrick encounter Arya Stark and Sandor Clegane, Oathkeeper's obvious Lannister qualities (the hilt is a golden lion with ruby eyes) prompt Arya and Sandor to be suspicious of Brienne. When the situation turns hostile, Brienne uses Oathkeeper in combat for the first time against Sandor. However, she wins the duel by knocking Sandor off a cliff after brutal hand-to-hand combat.
Still in the Vale, Oathkeeper remains in Brienne's possession. She and Podrick encounter Sansa Stark and Petyr Baelish at an inn, and Brienne tries to pledge her service to Sansa. Littlefinger, however, is successful at causing Sansa to doubt Brienne, and she dismisses her. When Baelish suggests Brienne spend the night at the inn, she recognizes the trap and fights her way out with Podrick right behind her. Brienne releases all the horses and kills three of the guards that attempt to pursue them with Oathkeeper. The Valyrian steel sword is strong enough to slice through the sword of one of the guards. Brienne later uses Oathkeeper to execute Stannis Baratheon when she finds him after the Battle of Winterfell.
Brienne and Podrick arrive at the Wolfswood in time to rescue Theon Greyjoy and Sansa Stark from the Bolton soldiers sent by Ramsay Bolton after they escaped from Winterfell. Brienne uses Oathkeeper to slay several soldiers while Podrick and Theon dispatch the rest. After the battle, Brienne lays Oathkeeper at Sansa's feet and pledges fealty to her. This time, Sansa accepts Brienne's service.
Brienne later accompanies Sansa to the ruins of Mole's Town to meet with Petyr Baelish, who is delighted to see Sansa again, but less so to see Brienne. Sansa confronts Baelish with his treatment of her by giving her in marriage to Ramsay Bolton, and when he fails to answer when she asks him "Do you know what he did to me?", Brienne takes hold of Oathkeeper's hilt and calmly says, "Lady Sansa asked you a question," prompting Littlefinger to reply. When Sansa asks why she shouldn't have Brienne strike him down, Brienne seems to be in agreement, even when Baelish tells Sansa that her mother's family has retaken their ancestral home of Riverrun from the Freys, and could possibly help her retake Winterfell from the Boltons.
At Sansa's request, Brienne and Podrick travel to Riverrun, which Sansa's great-uncle the Blackfish has recently retaken, to persuade him to join Sansa and Jon in their quest to retake Winterfell for the Starks. They find Jaime Lannister and his army encamped around the castle, and Brienne meets with him to bargain for a meeting with the Blackfish, in hopes she can convince him to leave Riverrun peacefully to aid Sansa in the North. She offers Oathkeeper back to Jaime, saying it was given to her for a purpose (to get Sansa to safety), and now that the purpose has been achieved, it should go back to him. Jaime replies: "It's yours. It will always be yours."
Brienne and Podrick are granted safe passage and entry to Riverrun and present Sansa's letter to Brynden Tully, who refuses to read it at first and accuses Brienne of being in league with Jaime Lannister, noting her "sword with the gold lion on the pommel". Brienne counters that Jaime gave her the sword so she might fulfill the vow he made to Catelyn to get her daughters to safety. After giving in and reading Sansa's letter, Brynden tells Brienne he cannot help Sansa if it means losing his ancestral home again. Brienne has Podrick send a raven to Winterfell to let Sansa know of the Blackfish's refusal to help. When Edmure Tully is used by Jaime Lannister to open the gates of Riverrun to the Lannister and Frey forces, the Blackfish sneaks Brienne and Podrick into a boat to safety. As they row away, Brienne sees Jaime watching from the battlements. He waves farewell, and she waves back.
Sansa sends Brienne and Podrick to King's Landing in her place to meet with Queen Cersei Lannister, King in the North Jon Snow, and Queen Daenerys Targaryen at the armistice meeting in the Dragonpit. As she discusses Arya with Sandor Clegane, Oathkeeper can be seen at her side. She stands on Jon Snow's platform, and exchanges uneasy glances with Jaime Lannister as he walks by with Cersei's entourage; she is also careful to keep Oathkeeper hidden under her cape to avoid Cersei's notice. She sits to the left of Jon Snow during the meeting. After Cersei refuses to help the North battle the oncoming army of the dead, Brienne follows after Jaime and begs him to talk to the Queen. He replies, "And tell her what?"
Later, after Tyrion Lannister speaks with his sister, she returns with her entourage to announce her agreement to help fight the White Walkers. Brienne is among the visibly relieved, not realizing Cersei was lying.
In the books
In the A Song of Ice and Fire novels, the sword is forged by Tobho Mott along with Widow's Wail. The sword has black and red ripples through the steel. Its scabbard glitters gold and is decorated with a row of lion's heads and smoldering red rubies. The pommel has a golden lion's head with ruby eyes that shine like two red stars.
Jaime is angry when the sword is given to him, thinking that it is a cruel joke of his father and uncle given that such a blade would be wasted on him, since he has lost his right hand (akin to giving expensive boots to a legless man). Kevan is upset to hear how Jaime feels about the sword, saying the gift was heartfelt, but Jaime is not mollified.
After returning to King's Landing, a short time after the Purple Wedding, Jaime and Brienne are stopped by Ser Loras Tyrell, who believes that Brienne was responsible for Renly's death. Jaime orders Brienne to be locked up for her own protection, thus when Jaime gives her sword she is in a tower cell, not the White Sword Tower. He also suggests the name "Oathkeeper" to her, claiming it is appropriate that she will be defending Ned Stark's daughter with Ned Stark's own steel.
Oathkeeper proves to be very useful at two bloody encounters between Brienne and the Brave Companions. Unfortunately, it makes people blame Brienne incorrectly that she serves the Lannisters.