  The X-ray transient IGR J18245-2452 in the globular cluster M28 contains the
first neutron star (NS) seen to switch between rotation-powered and
accretion-powered pulsations. We analyse its 2013 March-April 25d-long outburst
as observed by Swift, which had a peak bolometric luminosity of ~6% of the
Eddington limit (L$_{E}$), and give detailed properties of the thermonuclear
burst observed on 2013 April 7. We also present a detailed analysis of new and
archival Chandra data, which we use to study quiescent emission from IGR
J18245-2452 between 2002 and 2013. Together, these observations cover almost
five orders of magnitude in X-ray luminosity (L$_X$, 0.5-10 keV). The Swift
spectrum softens during the outburst decay (photon index $\Gamma$ from 1.3
above L$_X$/L$_{E}$=10$^{-2}$ to ~2.5 at L$_X$/L$_{E}$=10$^{-4}$), similar to
other NS and black hole (BH) transients. At even lower luminosities, deep
Chandra observations reveal hard ($\Gamma$=1-1.5), purely non-thermal and
highly variable X-ray emission in quiescence. We therefore find evidence for a
spectral transition at L$_X$/L$_{E}$~10$^{-4}$, where the X-ray spectral
softening observed during the outburst decline turns into hardening as the
source goes to quiescence. Furthermore, we find a striking variability pattern
in the 2008 Chandra light curves: rapid switches between a high-L$_X$ "active"
state (L$_X\simeq$3.9x10$^{33}$ erg/s) and a low-L$_X$ "passive" state
(L$_X\simeq$5.6x10$^{32}$ erg/s), with no detectable spectral change. We put
our results in the context of low luminosity accretion flows around compact
objects and X-ray emission from millisecond radio pulsars. Finally, we discuss
possible origins for the observed mode switches in quiescence, and explore a
scenario where they are caused by fast transitions between the magnetospheric
accretion and pulsar wind shock emission regimes.
