Chaperones are protein complexes that help to fold and disaggregate a cell's proteins. It is not understood how four major chaperone systems of Escherichia coli work together in proteostasis: the recognition, sorting, folding, and disaggregating of the cell's many different proteins. Here, we model this machine. We combine extensive data on chaperoning, folding, and aggregation rates with expression levels of proteins and chaperones measured at different growth rates. We find that the proteostasis machine recognizes and sorts a client protein based on two biophysical properties of the client's misfolded state (M state): its stability and its kinetic accessibility from its unfolded state (U state). The machine is energy-efficient (the sickest proteins use the most ATP-expensive chaperones), comprehensive (it can handle any type of protein), and economical (the chaperone concentrations are just high enough to keep the whole proteome folded and disaggregated but no higher). The cell needs higher chaperone levels in two situations: fast growth (when protein production rates are high) and very slow growth (to mitigate the effects of protein degradation). This type of model complements experimental knowledge by showing how the various chaperones work together to achieve the broad folding and disaggregation needs of the cell.