The asymptotic giant branch star R Sculptoris is surrounded by a detached shell of dust and gas 1,2 . The shell originates from a thermal pulse during which the star undergoes a brief period of increased mass loss 3,4 . It has hitherto been impossible to constrain observationally the timescales and mass-loss properties during and after a thermal pulse − parameters that determine the lifetime on the asymptotic giant branch and the amount of elements returned by the star. Here we report observations of CO emission from the circumstellar envelope and shell around R Sculptoris with an angular resolution of 1.3". What was hitherto thought to be only a thin, spherical shell with a clumpy structure, is revealed to contain a spiral structure. Spiral structures associated with circumstellar envelopes have been seen previously, from which it was concluded that the systems must be binaries 5,6,7,8 . Using the data, combined with hydrodynamic simulations, we conclude that R Sculptoris is a binary system that underwent a thermal pulse ≈1800 years ago, lasting ≈200 years. About 3×10 !3 M ! of mass was ejected at a velocity of 14.3 km s −1 and at a rate ≈30 times higher than the prepulse mass-loss rate. This shows that ≈3 times more mass is returned to the interstellar medium during and immediately after a pulse than previously thought. The detached shell around R Sculptoris was observed in CO(J = 3 − 2) emission at 345 GHz using the Atacama Large Millimeter/submillimeter Array (ALMA) during Cycle 0 operations (Fig.1, and supplementary information). The data clearly show the well-centered detached shell with a radius of 18.5", and reveal a spiral structure extending from the central star outwards to the shell. Previous observations of R Sculptoris show structure in the form of clumps. However, this was interpreted as clumpy material within the shell itself, and not as a structure interior to the shell 2 . Until now no clear signs of binary companions have been observed in the detached shell sources (with a possible exception for the detached shell around TT Cyg 9 ). The observed structure around R Sculptoris, however, indicates the presence of a companion, shaping the stellar wind into a spiral shell structure 8 . Smoothed particle hydrodynamics (SPH) models show that a wide binary companion can have a significant effect in the shaping of the wind, leading to elliptical and spiral structures (e.g. as observed in the case of the envelope of AFGL 3068) 5,6 . The observed shapes of the circumstellar envelopes (CSEs) around binary AGB stars depend on the physical parameters of the binary system (e.g., separation and mass ratio 10 ), the density contrasts imprinted on the wind, the temperatures in the CSE, the viewing angle, and, in the case of the gas, the chemistry and excitation 11 . The temporal variations of the mass-loss-rate and the expansion velocity further affect the structure of the CSE. Hence, the observed spiral structure and detached shell allow us to measure these important properties, and to directly link them to th...