The Robot Worms or mostly referred to as Book Worms are giant, robotic, insect worms that are attracted to and feed on energy. They were living on a deserted ring-world that was actually an interstellar library and fed on the civilization that once inhabit it before them.
The worms are silicon-based lifeforms. They are entirely blind and could only 'see' energy from machines and technology to consume as their main source of food.
At some time in their history before the series, the worms infested and consumed the native inhabitants of the ring-world. When MEGAS and the group were training they got caught in a mine field near the ringworld and crash-landed. When Coop accidentally activated the power, Kiva wanted to use the knowledge they have for Glorft info and time travel knowledge for help in her mission.
The worms attacked MEGAS and a smaller worm got inside it. Kiva and Jamie went down to take care of it and fix MEGAS. Coop fought off most of the bugs, until the largest one of them appeared before them. It trapped MEGAS in a web and tried to eat it. Coop accidentally activated a hidden capability inside MEGAS that destroyed all of the bugs in the ring-world. In the episode ending/epilogue reveals only one survived and end up on Earth. It's fate remains unclear.