T Cells have to make quick, sensitive and specific decisions to recognize not self from self. I will describe a coarse-grained modelling approach aimed at uncovering the basic principles of such immune recognition, that led us to a new "adaptive sorting" model. Adaptive sorting relies on a combination of kinetic proofreading and biochemical adaptation. A more refined model of immune recognition explains many puzzling features of early immune detection, such as antagonism and "digital" response when varying phosphatase concentrations, and was validated experimentally. Finally, I will recast this problem using decision theory and show how this mechanism is especially useful for detection in a fluctuating background of biochemically similar ligands. Adaptive sorting thus constitutes a generic model for "qualitative" sensing of biological signals.