- "Perhaps I wanted to atone for events of the past, even if no apology can undo the harm I have wrought. I felt... that I ought to leave at least something behind. So I digitized myself and my research, and hid them within Sora."
- —data Ansem the Wise, to Riku
Between Kingdom Hearts Chain of Memories and Kingdom Hearts II
While Naminé works to repair Sora's scattered memories, she uncovers memories that don't belong to Sora himself, but to people he is connected to. However, she concludes that they still belong in his heart, and so she does not remove them. Ansem the Wise, under his alternate persona DiZ, is intrigued and researches the boy's heart further.
After Roxas returns to Sora, DiZ begins to feel remorse for the harm he had done to Naminé and Roxas. DiZ makes a digital copy of himself as well as his research, called Ansem's Code, and hides it within Sora's heart in hopes that it can one day be used for atonement. He informs Naminé of this, but does not elaborate on the Code's contents.
Sometime after the Code has been inserted, Naminé also adds a data copy of herself for a similar purpose.
One year later, after being transported to the Realm of Darkness following the explosion of his Kingdom Hearts Encoder, Ansem the Wise encounters Aqua at the Dark Margin. While speaking with her, he reflects on his past misdeeds, and mentions hiding Ansem's Code within Sora.
When Data-Sora encounters Data-Naminé in the datascape's Castle Oblivion, she explains her finding of the memories that don't belong to Sora, but warns that the memories are all painful. Data-Sora and King Mickey accept the memories, where they see visions of Axel, Roxas, Xion, Naminé herself, Terra, Ventus, and Aqua. Finally, Data-Naminé informs them of the existence of Ansem's Code within Sora.
Afterwards, Mickey writes a bottled letter to the real Sora to inform him of the extra memories, and to call him to action in rescuing the people he saw in the visions.
After Riku dives into Sora's heart and frees him from Ventus's possessed Keyblade Armor, he arrives on a digital projection of the Destiny Islands within Sora's heart. Here, he speaks to the three people whose hearts lay dormant within Sora's: Roxas, Ventus, and Xion. Riku picks up a message in a bottle that washes up on the beach, and is approached by Ansem the Wise's data copy, who explains that the bottle contains Ansem's Code.
Between Kingdom Hearts 3D: Dream Drop Distance and Kingdom Hearts III
Riku gives Ansem's Code to King Mickey, who then gives it to Chip and Dale, but they find that the Code is encrypted and needs to be deciphered. Having learned of the recompletion of Ansem's apprentices from Lea, Mickey contacts Ienzo at Radiant Garden for assistance.
Kingdom Hearts III
While Sora visits various worlds in hopes of regaining his lost power of waking, he is contacted by Ienzo and frequently updated on the process of deciphering Ansem's Code.
Initially Ienzo has not made much progress, but gains inspiration after speaking to Sora about his shared heart with Roxas. Ienzo is able to progress further after collaborating with Pence to connect Radiant Garden's computer with Ansem the Wise's computer in the Twilight Town mansion's basement.
After Sora visits Monstropolis and encounters Vanitas, Ienzo contacts Sora once more with an entire passage recovered from the data. Some time after this, but before Sora arrives at the Keyblade Graveyard, Ienzo records his findings in Secret Reports 9 and 10.
One of the subjects inside the data is about the three compartmentalized "boxes" inside Sora, each one containing the heart of another person: one box holds Roxas's heart; another one holds Xion's heart, and the third one, which has been with Sora for a much longer time, holds Ventus's heart. These three hearts have melded with Sora's and no longer have voices of their own; as such, attempting to manually extract them from Sora's heart can be just as deadly as becoming a Heartless.
Notes and references
- Kingdom Hearts III, Ienzo: "As for Ansem the Wise's data, we've discovered a very interesting passage. I'll read you exactly what he wrote. "I have discovered three unique hearts inside of Sora's. One is Roxas. The second has been with Sora for nearly as long. And a third has resided in Sora's heart for even longer—most of his life, in fact. This is a truly astonishing discovery. While these hearts have now melded with Sora—grown silent and indistinct—Sora retains the memories of all three. The memories have been compartmentalized—each placed in its own 'box,' so to speak. I surmise the hearts can be awoken, provided that each of them is returned to the box that contains the correct memories. Unite the heart with its memories, and provide it a suitable body within which it may flourish, and I believe any or all three of these people can be made real again.""
- Kingdom Hearts III, Secret Report 9: "Within Sora's heart are three compartmentalized "boxes," each containing the heart of another. One box holds Roxas. Another holds a second heart that has been with Sora nearly as long. The third has held its heart for much longer. These hearts have melded with Sora's and no longer have voices of their own. Any attempt to mechanically extract them could prove as dire for Sora as what caused him to become a Heartless in the first place."