Lisa participates on an Alternative Energy Derby with a car moved powered by solar energy, but the Duff Blimp passes over making her car stop inches from the finish line. She is mocked because of this, and the Old Jewish Man comments about Amelia Vanderbuckle, a Springfieldian inventor of the 19th century who was committed to the Springfield Asylum, where she continued to make her inventions. Lisa realizes that the only way to bring her reputation back is to break into the asylum with Bart and find one of her inventions.
At the asylum, Bart finds the diary of Nathan Little, a sociopath who lived there. He decides to take the diary to school and show it to his friends, terrorizing Ralph Wiggum, who later tells about the diary to his father Chief Wiggum. Wiggum informs Marge that Bart is a sociopath, making her and Homer worried. They decide to do a sociopath test with him, disguised as a "Jet Ski Dude or Motocross Maestro" test, but the label falls off and Bart discovered his parents' intentions and decides to answer all the questions as if he was the worst sociopath that ever existed. This makes Homer and Marge even more worried, and they decide to take Bart to an asylum. As all the children there have no reactions, so an army general says that they are perfect to test U.S. Air Force Drone Simulators. Bart manages to destroy all targets, but later the USAF General informs the children that they were actually controlling a real drone, killing real people. Bart is horrified by this news and tearfully says he didn't, and doesn't, want to kill anyone; the General and a civilian staffer tell Bart he has shown he is a good person with genuine emotions, and that he will be sent home because that makes him completely useless for their project. After Bart leaves, the kids are told that they were lied to all along and that the program is a simulation—but they have "passed" the test and can expect work in the future.
Meanwhile, Lisa pairs up with Milhouse to find Amelia's invention, that is buried under a former feminist club, that is now a Knockers restaurant. They ask Groundskeeper Willie to help them drill the building's basement and find her invention. They are successful and find what at first glimpse looks like a loom, but is actually the first computational device ever invented. Lisa accomplishes her objective and Amelia's invention is donated to the museum, even though nobody but Lisa is interested in seeing it.
During the credits, Homer uses the loom to view Internet pornography when Marge walks in on him and he tries to get rid of it to no avail.