The eradication of biofilms remains an unresolved challenge across disciplines. Furthermore, in biomedicine, the sampling of spatially heterogeneous biofilms is crucial for accurate pathogen detection and precise treatment of infection. However, current approaches are incapable of removing highly adhesive biostructures from topographically complex surfaces. To meet these needs, we demonstrate magnetic field-directed assembly of nanoparticles into surface topography-adaptive robotic superstructures (STARS) for precision-guided biofilm removal and diagnostic sampling. These structures extend or retract at multilength scales (micro-to-centimeter) to operate on opposing surfaces and rapidly adjust their shape, length, and stiffness to adapt and apply high-shear stress. STARS conform to complex surface topographies by entering angled grooves or extending into narrow crevices and "scrub" adherent biofilm with multiaxis motion while producing antibacterial reagents on-site. Furthermore, as the superstructure disrupts the biofilm, it captures bacterial, fungal, viral, and matrix components, allowing sample retrieval for multiplexed diagnostic analysis. We apply STARS using automated motion patterns to target complex three-dimensional geometries of ex vivo human teeth to retrieve biofilm samples with microscale precision, while providing "toothbrushing-like" and "flossing-like" action with antibacterial activity in real-time to achieve mechanochemical removal and multikingdom pathogen detection. This approach could lead to autonomous, multifunctional antibiofilm platforms to advance current oral care modalities and other fields contending with harmful biofilms on hard-to-reach surfaces.