  Over recent decades, astronomy has entered the era of massive data and
real-time surveys. This is improving the study of transient objects - although
they still contain some of the most poorly understood phenomena in
astrophysics, as it is inherently more difficult to obtain data on them. In
order to help detect these objects in their brightest state, we have built a
quasi-real time transient detection system for the XMM-Newton pipeline: the
Search for Transient Objects in New detections using Known Sources (STONKS)
pipeline. STONKS detects long-term X-ray transients by automatically comparing
new XMM-Newton detections to any available archival X-ray data at this
position, sending out an alert if the amplitude of variability between
observations is over 5. This required an initial careful cross-correlation and
flux calibration of various X-ray catalogs from different observatories
(XMM-Newton, Chandra, Swift, ROSAT, and eROSITA). We also systematically
computed the XMM-Newton upper limits at the position of any X-ray source
covered by the XMM-Newton observational footprint, even without any XMM-Newton
counterpart. The behavior of STONKS was then tested on all 483 observations
performed with imaging mode in 2021. Over the 2021 testing run, STONKS provided
$0.7^{+0.7}_{-0.5}$ alerts per day, about 80% of them being serendipitous.
STONKS also detected targeted tidal disruption events, ensuring its ability to
detect other serendipitous events. As a byproduct of our method, the archival
multi-instrument catalog contains about one million X-ray sources, with 15% of
them involving several catalogs and 60% of them having XMM-Newton upper limits.
STONKS demonstrates a great potential for revealing future serendipitous
transient X-ray sources, providing the community with the ability to follow-up
on these objects a few days after their detection.
