Edward Snowden doesn’t share new state secrets in his memoir, Permanent Record, which The Daily Beast obtained a copy of ahead of its release Tuesday. But he does offer some personal ones, from his transformation into America’s most famous secret-spiller, to the news that he was married, two years ago, to Lindsay Mills, the girlfriend he left behind when he fled the U.S. for Hong Kong with a virtual library of top secret files detailing America’s global electronic spying apparatus.

After enlisting in the Army at 21, Snowden writes that he was on a track called “18 X-Ray”, with a chance to come out of training as a Special Forces sergeant, before breaking his leg at Fort Benning and receiving an administrative separation.

“I had hoped to serve my country,” he writes, as his family had before him, “but instead I went to work for it” as a contractor for the intelligence community. That was effectively a cover, in his telling, as “the agencies were hiring tech companies to hire kids, and then giving them the keys to the kingdom because… no one else knew how the keys, or the kingdom worked.” He elaborates: “Here is one thing that the disorganized CIA didn’t quite understand at the time, and that no major American employed outside of Silicon Valley understood, either: The computer guy knows everything, or rather can know everything.”

Eventually, Snowden, having attained the security clearances necessary for his tech work, “went govvy” and signed up for a straight CIA job. He joined class 6-06 of the BTTP, or the Basic Telecommunications Training Program that “disguises one of the most classified and unusual curricula in existence… to train TISOs (Technical Information Security Officers),” who work under State Department cover to “manage the technical infrastructure for CIA operations, most commonly hidden at stations inside American missions, consulates, and embassies.” “[T]he worst-kept secret in modern diplomacy is that the primary function of an embassy nowadays is to serve as a platform for espionage,” he writes.

After being stationed in Vienna, Snowden moved to Tokyo in 2009 to work as a systems analyst for the NSA, he writes, though nominally as an employee of Dell. “Two things about the NSA stunned me right off the bat: how technologically sophisticated it was compared with the CIA, and how much less vigilant it was about security in its every iteration,” he writes, noting that the NSA “hardly bothered to encrypt anything.”

While working there on a project called EPICSHELTER—“a backup and storage system that would act as a shadow NSA: a complete, automated, and constantly updating copy of all the agency’s most important material, which would allow the agency to reboot and be up and running again, with all its archives intact, even if Fort Meade were reduced to smoldering rubble”—Snowden began researching China’s domestic surveillance system, which led to his first inkling that if such systems were possible, the U.S. might be using them too, given “perhaps the fundamental rule of technological progress:. if something can be done, it probably will be done, and possibly already has been.”

That same summer, the U.S. released its Unclassified Report on the President’s Surveillance Program, following the New York Times’ reporting on the Bush-era warrantless wiretapping program. Eventually, Snowden writes, he found the classified version, “filed in an Exceptionally Controlled Information (ECI) compartment, an extremely rare classification used to make sure something would remain hidden even from those holding top secret clearance… The report’s full classification designation was TOP SECRET//STLW//HCS//COMINT//ORCORN//NOFORN, which translates to: pretty much only a few dozen people in the world are allowed the read this.”

Snowden found it only because the STLW classification—for STELLARWIND—had raised a red flag for him as a system administrator, meaning he had to examine the file to determine what it was and how best to scrub it from the system where it wasn’t supposed to have been placed.

“It was clear that the unclassified version I was already familiar with wasn’t a redaction of the classified report, as would usually be the practice,” he writes. “Rather, it was a wholly different document, which the classified version immediately exposed as an outright and carefully concocted lie” to hide the transformation of the NSA’s mission “from using technology to defend America to using technology to control it by redefining citizens’ private Internet communications as potential signals intelligence.”

STELLARWIND, the classified report revealed, had been collecting communications in the U.S. since 2001, and continued even after Justice Department lawyers secretly objected to it in 2004. It’s longevity owed everything to a kafkaesque legal position adopted by the Bush administration, “that the NSA could collect whatever communication records it wanted to, without having to get a warrant, because it could only be said to have acquired or obtained them, in the legal sense, if and when the agency ‘searched and retrieved’ them from its database.”

Having found the big secret, set up so that no one else knew it was there to even start asking questions, Snowden writes, he began using his access as a systems engineer and administrator to ask those questions, while keeping the knowledge a secret from his girlfriend and his family, and considering what to do about it.

Back in the US in 2011, Snowden experienced his first epileptic seizure. The following year on a contract with Dell again, he returned to the NSA, at its Kunia Regional Security Operations Center in Hawaii. There, he writes, “my active searching out of NSA abuses began not with the copying of documents, but with the reading of them.”

As the sole employee of the Office of Information Sharing, he was developing an automated “readboard” to scan the IC’s own internal internet and create a custom digital magazine for each employee, based on his or her interests and security clearances. He called the system Heartbeat, and its servers stored a copy of each scanned document, “making it easy for me to perform the kind of deep interagency searches that the heads of most agencies could only dream of.” Heartbeat, he writes, “was the source of nearly all of the documents that I later disclosed to journalists.”

Snowden mentions a rare public speech Ira “Gus” Hunt, the CIA’s chief technology officer, delivered a week after then-Director of National Intelligence James Clapper had lied to Congress about the NSA’s collection of bulk communications. In the speech, covered only by the Huffington Post, Hunt flatly declared that we “try to collect everything and hang on to it forever.” “You’re already a walking sensor platform,” he said. “It is nearly within our grasp to be able to compute on all human generated information”). As Snowden notes, a video of the talk has less than 1,000 views.

After that, Snowden recounts his efforts to reach out to journalists, and to carefully hide his digital breadcrumbs by encrypting data and distributing the keys to it, while perhaps hiding his findings on SD cards inside of Rubik’s Cube cubes to get them out of the NSA’s underground tunnel in Hawaii.

He then took what he saw as a less prestigious new position to gain access to the XKEYSCORE system, which he’d learned about but not used himself, and, he writes, is “perhaps best understood as a search engine that lets an analyst search through the records of your life.”

“It was, simply put, the closest thing to science fiction I’ve ever seen in science fact,” he writes, allowing users to put in someone’s basic information and then go through their online history, even playing back recordings of their online settings and watching people as they searched, character by character. “Everyone’s communications were in the system—everyone’s,” including the president’s, he writes. The potential for abuse was obvious. NSA workers even had a word, “LOVEINT” for “love intelligence,” to describe analysts cyber-stalking current, former and prospective lovers, while among male analysts “intercepted nudes were a kind of informal office currency,” Snowden writes. “This was how you knew you could trust each other: you had shared in one another’s crimes.”

Finally, Snowden recounts his trip to Hong Kong, after taking a medical leave, his efforts to reach Ecuador, and his exile in Russia, where he was finally reunited with Lindsay (whose diary entries recounting his disappearance, and the pressure then placed on her by U.S. authorities are given a full, moving chapter.

Snowden speaks well of a very different leaker, Wikileaks founder Julian Assange, writing that while “people have long ascribed selfish motives to Assange’s desire to give me aid, I believe he was genuinely motivated in one thing above all—helping me evade capture… It’s true that Assange can be self-interested and vain, moody, and even bullying—after a sharp disagreement just a month after our first, text-based communication, I never communicated with him again—but he also sincerely conceives of himself as a fighter in a historic battle for the public’s right to know, a battle he will do anything to win.”

“Most important to [Assange],” writes Snowden, ”was the opportunity to establish a counter-example to the case of the organization’s most famous source, US Army Private Chelsea Manning, whose thirty-five-year prison sentence was historically unprecedented and a monstrous deterrent to whistleblowers everywhere.”