Large-scale cosmic filaments connect galaxies, clusters, and voids. They are permeated by magnetic fields with a variety of topologies. Cosmic rays with energies up to 1020eV can be produced in astrophysical environments associated with star-formation and AGN activities. The fate of these cosmic rays in filaments, which cannot be directly observed on Earth, are rarely studied. We investigate the high-energy processes associated with energetic particles (cosmic rays) in filaments, adopting an ecological approach that includes galaxies, clusters/superclusters, and voids as key cosmological structures in the filament ecosystem. We derive the phenomenology for modelling interfaces between filaments and these structures, and investigate how the transfer and fate of energetic cosmic ray protons are affected by the magnetism of the interfaces. We consider different magnetic field configurations in filaments and assess the implications for cosmic ray confinement and survival against hadronic pion-producing and photo-pair interactions. Our analysis shows that the fate of the particles depends on the location of their origin within a filament ecosystem, and that filaments act as ‘highways’, channelling cosmic rays between galaxies, galaxy clusters, and superclusters. Filaments can also operate as cosmic ‘fly paper’, capturing cosmic ray protons with energies up to 1018eV from cosmic voids. Our analysis predicts the presence of a population of ∼1012–1016eV cosmic ray protons in filaments and voids accumulated continually over cosmic time. These protons do not suffer significant energy losses through photo-pair or pion production, nor can they be cooled efficiently. Instead, they form a cosmic ray fossil record of the power generation history of the Universe.