The Swarm are a species of semi-intelligent insectlike alien robot evolved from a self-upgrading machine designed to clean space junk. They are widely known in the galaxy and regarded as a threat, yet nobody can pinpoint the locations of their hives because of their advanced cloaking field.
The anatomy and behavior of the Swarm has been studied well, and the results say these synthetic organisms are powered by the fifth fundamental force referred to as Flux and are divided into several castes:
The gnats are the smallest of the castes, measuring 1-2 m on average. Morphologically they resemble a wingless mosquito, with a Flux thruster on its back and a salvage beam in its mouth, which they use to harvest resources from shipwrecks before bringing them back to the Hive. They have little defenses and are easy to take down with a well-placed shot.
The soldier caste is specialized in attacking the starship from the inside, attempting to kill as many crewmen as possible. Their shape is something in between a saucer and a spider cephalothorax, measuring 2-4 m in diameter. They have a pair of Flux thrusters on each side, which allows for fast and agile maneuvering. Their exoskeleton is very durable and heavily shielded, and they can fire energy projectiles from their mandibles or taze the target with them.
The space worms are humongous centipede-shaped constructs equipped with one powerful charged beamer. They specialize in breaching the ship's external defenses, and are not suited for dealing with smaller targets. There are typically only one of two of them in each swarm. They have Flux thrusters on the sides of each segment, allowing them for moderately fast movement and are highly resistant to ballistic weapons.
The workers also have the shape of a centipede, but are much smaller, measuring 5-20 m in length. These are only lightly armored and have no weapons, they specialize in repairs, expanding the Hive, and constructing new members of the Swarm. They have no thrusters and never leave the Hive.
The Hive guards have the shape similar to a worker, but with much heavier armor and moderately powerful shielding they activate only during combat. They have a pair of rotable arms with blasters mounted on them, and a powerful short-range beamer inside the mouth. Like workers, they also never leave the Hive.
From their numerous encounters with the Swarm, the Galactic Federation has also determined which strategies work poorly against them:
Detection: Due to the vastness of space and the cloaking system the hives have, any attempts to locate them have proved futile. Once the Swarm is out of the hive, however, it's already too late.
Retreat: Despite the recent advances in propulsion technology, Swarm soldiers are still too fast to outmeneuver and will always find a way to harass the ship. Larger ships, however, are unmaneuverable enough that retreat isn't an option for them.
EMP: While the Swarm are robotic, they are functioning on principle fundamentally different from electromagnetism, so an electromagnetic pulse has no effect on them.
What would be the standard defense procedures on Galactic Federation starships in case of encountering the Swarm during space travel?