A cleaner wrasse cleans out the mouth of a cod.Rand McMeins / Getty Images

It’s not easy for fish to clean themselves, without limbs or digits to scrub those hard-to-reach places. Fortunately for them, coral reefs come with cleaning stations.

At particular sites, an itchy individual can attract the attention of the bluestreak cleaner wrasse—a slender fish, with blue and yellow markings and a prominent black stripe. On seeing these colors, the itchy “client” strikes a specific pose, allowing the wrasse to snake across its body, mouth, and gills, picking off parasites and dead skin along the way. The wrasse gets a meal. The client gets exfoliated. A single wrasse works for around four hours a day, and in that time, it can inspect more than 2,000 clients.

The wrasse are remarkably savvy about how they perform their services. Redouan Bshary, from the University of Neuchâtel, has shown that they sometimes cheat their clients by taking illicit bites of the protective mucus covering their skin. If the clients are watching, the wrasse restrain themselves from such shenanigans, in an effort to maintain their reputation. If disgruntled clients chase them, they try to make amends by offering a complementary fin massage. If high-status clients pop by—large, visiting predators like sharks or groupers—the cleaners prioritize them over smaller fish that live in the area. They’re surprisingly intelligent for fish.

And it seems that, by removing parasites, they also make other fish more intelligent.

We know this because, in 2000, Alexandra Grutter, from the University of Queensland, started removing cleaner wrasse from patches of reef around Australia’s Lizard Island. Every three months, she and her team would net every cleaner in these areas and move them elsewhere. The other small fish in these patches won’t cross the large tracts of open sand between them. So, for entire generations, Grutter deprived them of the cleaners’ attentions.

On the de-wrassed reefs, the total number of fish species halved, and their numbers fell by three-quarters. Some damselfish remained, but they were smaller than usual—a clear sign that their physical health depends on regular cleaning.

Sandra Binning, who’s also from the University of Neuchâtel, has shown that the damsels’ mental prowess is also influenced by the cleaners. Working with Grutter and Bshary, she captured damselfish from various reefs and put them through a series of challenges. First, she put square plates on either side of their tank. One of these hid a chunk of food that the fish could smell but not reach, while the other hid a more accessible morsel. The damselfish had to learn which plate to swim up to—a simple spatial-memory test, and one that every individual passed. Next, Binning swapped the location of the correct plate; again, all the fish learned to change their behavior.

Things changed when she gave them a more difficult task. This time, they had to approach the correct plate based not on its location, but on its appearance. This skill—visual discrimination—is vitally important to a damselfish. “They have to learn very quickly, on the basis of color and pattern, which fish are safe to be around, and what competitors or friends look like,” says Binning. “They’re very good at that.”

But not all of them. The fish that had been serviced by cleaners solved the task faster, and in greater numbers, than those without a history of such services, even when the two groups were matched for size.

“It’s easy to imagine how that would work,” says Isabelle Côté, a researcher from Simon Fraser University who wasn’t involved in the study. “Imagine having an itch that you just can’t scratch, no matter what you do. Ultimately, it drives you to distraction. That might well be similar to what these fish that can’t visit cleaners are feeling. It means that these cleaning interactions are even more important than we had anticipated.”

Without the cleaners, the damselfish might also not have enough energy to fully fuel their demanding brains. They’re targeted by parasitic, bloodsucking crustaceans, which makes them “anemic, sluggish, and weak,” Binning says. When cleaners remove these parasites, the distressed damsels can divert their energies toward other matters—like thinking. Binning confirmed this idea by collecting fish that had grown up in the presence of cleaners, and deliberately infecting them with the bloodsucking parasites. Sure enough, they performed badly in the visual test, just like their peers from cleaner-free reefs.

It’s too easy to see the parasites as the villains of this story, however. In many ways, they’re the glue that cements the relationship between the cleaners and their clients, says the disease ecologist Carrie Cizauskas. “Take them away, and it’s debatable whether the cleaner wrasses would be able to survive on client skin detritus alone,” she says.

And the cleaners, through their ministrations, could shape the intellectual development of an entire ecosystem. After all, “there are many other species of clients, like parrotfish and groupers, that are way more parasitized and get much higher priority,” Binning says. “The hierarchy of service is so complex, and our damselfish get cleaned when there’s no one else around.”