In his six o'clock newscast, Kent Brockman announces that a solar eclipse will appear in Springfield, exciting the Simpson family. After Homer's camera obscura breaks due to Bart's pushing Homer off of the dog house, Marge gives hers to Homer. As the family expresses delight at seeing the eclipse, an envious Marge peeks at the solar eclipse, which blinds her. After the Simpson family takes Marge to the hospital, Dr. Hibbert informs the family that Marge's eyes must be covered for two weeks, and she must not be put under any stress. In order to deal with a sudden rat infestation, Homer takes Maggie and Santa's Little Helper to the store so he can get rat poison. Bickering between the baby and the dog causes the family's car to fall off a bridge on the way back home. Homer tries to get all three and the poison across a lake in a small boat (a reference to the fox, goose and bag of beans puzzle). He first takes Maggie across and puts her on the doorstep of a convent before rowing back to pick up the poison. In a twisted turn of events, the nuns at the convent take Maggie in and refuse to give her back to Homer.
While Homer and Bart attempt to trick Marge into believing the girls are still at home, Lisa goes undercover as a nun and infiltrates the convent. When Mother Superior refuses to tell her where Maggie is, Lisa discovers that they are seeking a jewel. Another nun informs Lisa of an ancient quest for the mystic gem. Lisa's first clue is to "seek God with heart and soul," which she correctly interprets as playing a few measures of the song by the same name on the convent's organ, activating a Rube Goldberg contraption. She next is told to find the "biggest man-made ring" in Springfield; at first, she assumes it is circular rings, but she learns the biggest ring is the Springfield Bell Tower. Arriving there, she meets Comic Book Guy and Principal Skinner, who tell her that St. Teresa of Ávila had a deathbed vision of a jewel that would bring peace and harmony to the world. She sent a group of nuns to the New World to search for it. They landed in Philadelphia and started a convent, but word of the jewel got to the Freemasons, and Benjamin Franklin, George Washington, and King George III banded together to stage a fake revolutionary war to cover their search for the gem, so the nuns fled the colonies and moved to Springfield. Comic Book Guy tells her that the gem will be revealed on the first full moon after a solar eclipse, which is that night. However, the bell is actually papier-mâché, as the real one was melted down during World War II and made into Civil War chess sets. Lisa and Comic Book Guy conclude that the biggest "ring" in Springfield is the RING in the Springfield Sign. Skinner pretends to have concluded it too, but only realizes upon their arrival at the Sign.
At the Springfield Sign, they are met by Mr. Burns and Smithers, who (due to Burns' long-standing membership in the Freemasons) are also aware of the gem. Lisa finds writing on the letters of Springfield (together saying "Great crimes kill holy sage") and unscrambles a message that reads "Regally, the rock gem is Lisa". Mr. Burns takes the others back to the convent where Lisa announces that she is the gem child. A nun however tells her that the gem child is Maggie and rearranges her message to say "It's really Maggie, Sherlock". Upset, Lisa points out that she would have to get it wrong first for it to make sense. Nevertheless, Maggie is put on a throne, causing a light to hit her which makes a rainbow that brings peace all over Springfield. Marge, however, inexplicably bursts in and takes Maggie back. Her eyes are healed upon seeing Maggie. She refuses to give up Maggie for the peace of Springfield saying that "I'm sorry, but I know God would never ask a mother to sacrifice her child for the good of the world... again". On the way home she asks Homer if she was being selfish, but he says that he found a replacement for Maggie; Bart assumes the role of the "gem child", but due to the reflections of his unruly personality, he turns it into a living Hell.