Twelve-year-old Cass is a survivalist. Her room is decorated with clippings about natural disasters and potential disasters so she will be prepared for the possibility. She made a toy monster for herself after dreaming about a strange creature. The monster is a troll-like doll made from scraps of socks, fabric and shoe tongues. She carries the "sock monster" everywhere.
Cass dreams she's in a graveyard with eerie sounds. She awakens to her mother calling her for school. Cass and her best friend, Max-Ernest, are trying to become members of the Terces Society, a secret society dedicated to defeating another group known as the Midnight Sun, and to protecting a secret that remains a mystery even to Cass and Max-Ernest. Owen, who is a master of disguise and an agent of the Terces Society, rescued them from the Midnight Sun in a previous story. Pietro Bergamo is the magician leader of the Terces Society.
Cass and Max-Ernest worry that they will never hear from the Terces Society and sometimes wonder whether the Society is actually real. They decode a strange note found in Cass' lunch and decide to ditch Mr. Needleman's science class for what they think is a meeting with the Terces Society. Yo-Yoji, a new kid from Japan, almost foils their plan; instead of turning them in to their teacher, he assists them by keeping a lookout for Mr. Needleman. Cass and Max-Ernest manage to board a ship, only to discover that they are captives of the Midnight Sun instead of guests of the Terces Society.
Ms. Mauvais and Dr. L, leaders of the Midnight Sun, demand to know where the homunculus is, but Cass and Max-Ernest don't know what a homunculus is.
The Skelton Sisters are twin teenage girls. They're members of the Midnight Sun and also rock music stars. They steal Cass' sock monster. Cass and Max-Ernest are then tied up below deck. They manage to escape and discover the ship's hold is full of stolen treasures: books, medieval weapons, old laboratory equipment and The Dictionary of Alchemy. From the book, they learn that a homunculus is a living being created through alchemy. The illustration of the homunculus looks exactly like Cass' sock monster.
Cass and Max-Ernest mysteriously hear Dr. L and Ms. Mauvais talking about a "sound prism," although the kids can't see either adult. They deduce that voices are coming from a nearby trunk, but the only thing in the trunk looks like a white ball. Cass impulsively puts the ball in her backpack.
Night has fallen, so they sneak onto the deck to escape. They are surprised to see Mr. Needleman climbing on deck from a smaller boat. Mr. Needleman reveals himself as Owen of the Terces Society and takes the kids home. On the way, he tells them about the sound prism and asks them to contact the Terces Society at the Magic Museum if anything comes up. Cass does not tell him that she has the white ball.
Instead of going into their homes, Cass and Max-Ernest immediately take a bus to the Magic Museum. A host of strange magic-show posters, paraphernalia and automatons clutters the museum. The kids also see the empty pedestal from which Ms. Mauvais and Dr. L stole the sound prism that they now understand is the white ball in Cass' backpack. Max-Ernest goes into a box from a magic act and disappears. Cass goes after him, and they land in the basement.
There, they meet Pietro and other members of the Society. Cass reveals the sound prism. The kids learn that the Midnight Sun is searching for the grave of the creator of the homunculus, Lord Pharaoh. They are given a mission to find the homunculus using the sound prism because Cass is the only one who can use it. She isn't given instructions on how to use it.
That night at home, Cass has a dream where she sees a boy taken from a campsite near a lake. Cass awakens to a fight with her mom and is grounded for leaving school the day before. Despite being grounded, she sneaks out of the house later that night to bury the prism in the backyard and discovers that it plays a song she recognizes from her dreams.
At school, Cass and Max-Ernest are put in detention for the rest of the year. Yo-Yoji visits them. Cass asks if he can identify the notes of the tune she hears in her dreams, but she doesn't reveal the source. Yo-Yoji has nearly perfect pitch, so he listens and names the notes: C-A-B-B-A-G-E-F-A-C-E. Max-Ernest is jealous of Yo-Yoji's interest in Cass and doesn't want Cass to share any of their secrets with the new boy.
Max-Ernest discovers a bag of magic tricks on his desk at home. He finds the history of the homunculus hidden in the wand. He contacts Cass with a series of phone rings so she knows to sneak out to meet him that night.
In the 500-year-old story of the homunculus, Cass and Max-Ernest learn about an unhappy doctor who created an immortal homunculus. He called himself Lord Pharaoh and was cruel to the homunculus. After being displayed before a king, the homunculus was put in a pen with pigs. A jester with a magic, singing ball brought food for the neglected creature and freed him from the pen. In honor of the jester, the homunculus promised to always answer someone who called him with the musical ball. Years later, the homunculus killed Lord Pharaoh and buried all of his notes, recipes and diaries with his remains.
Cass dreams of a little boy walking across bones in a forest glade. Cass relates the dream to her desire to find the homunculus and an article clipping of a boy who was temporarily lost near Whisper Lake. She decides the dream is telling her to go to that lake. She instigates a camping trip with her grandpas, Max-Ernest and Yo-Yoji.
On the trail to their camping spot, they pass a graveyard that Cass recognizes from her dreams. They camp next to a lake, as the boy in her dream did. When the grandpas and Yo-Yoji are asleep, Cass and Max-Ernest toss the sound prism in the air. They attempt to summon the homunculus by its music. Yo-Yoji catches them doing this, so they explain what they are doing.
The homunculus, called Cabbage Face, shows up moments later. The kids explain the situation and ask him to accompany them to the Magic Museum. The creature demands to know the original jester's name as proof of their story. After some sleuthing, they discover the jester's name was Hermes. Cabbage Face realizes the Midnight Sun wants to find him because he guards Lord Pharaoh's grave, which contains secrets to immortal life.
The kids convince him to go to the Magic Museum to meet the Terces Society. There, they discover that Yo-Yoji is a member of the Terces Society also. Cabbage Face disappears. A few nights later, Cass tries to call him with the sound prism, but he doesn't come. While the sound prism is playing music, Amber, a popular girl from Cass' school who idolizes the Skelton Sisters, secretly records the sound prism music.
At school, Amber has a copy of Cass' sock monster, which the Skelton Sisters gave her. Cass eavesdrops on Amber and her friends, overhearing plans to attend a concert, and decides that she, Max-Ernest and Yo-Yoji should go.
At the concert, the musicians play a new song that includes the recording of the sound prism. Cabbage Face appears at the concert and goes on stage, expecting to find Cass. From the audience, Cass tries to stop him, but Midnight Sun bodyguards stop her. When they threaten to hurt Cass, the homunculus promises to lead the Midnight Sun to Lord Pharaoh's gravesite. They take Cass along as a hostage. Yo-Yoji and Max-Ernest witness everything from the audience and leave to find Pietro.
Cass is tied to a tree while members of the Midnight Sun dig up the grave. Pietro and the Terces Society gallop in on horseback and battle the Midnight Sun on the field. Max-Ernest and Yo-Yoji create a sonic boom with a whip. The boom causes a rockslide and seals Cabbage Face and the coffin under the rocks. The Midnight Sun is defeated.
The three kids take an oath to join the Terces Society.