There are two parts: the innate immune system and the humoral (also called acquired, because it has exposure memory) immune system. The innate immune system leaps into play as soon as a virus (or other antigen) enters the body. It attacks the virus immediately and tries to disable it and basically dissolve it. It also primes the humoral (or memory) immune system so that if another virus of the same kind enters the body, it is swarmed on immediately by the humoral system. This is called natural immunity.
The humoral immune system is composed of B-cells and two types of T-cells. There are killer T-cells and helper T-cells. The B-cells produce specific antibodies to the specific virus for which they have been primed. The killer T-cells attack, kill, and dispose of any human cells that have been infected with the virus, thus the killer part of their name. The helper T-cells “help” by serving up the virus to the B-cells, which then crank out antibodies like crazy that end up marking the virus for destruction by macrophages.
Once the immune system has been primed by a previous encounter with the virus (an infection), it is ready to roll instantly when it encounters the same virus again. The virus doesn’t stand a chance against this immediate onslaught, so the naturally immune person beats the virus down before even experiencing any symptoms.
The important thing to understand is that the antibodies generated by the first attack ultimately wane, but the memory remains. The humoral immune system is always at the ready. So the fact that the antibodies go away or lessen in concentration don’t really have any bearing on how much natural immunity one has. They can be generated in moments upon exposure to the virus, because the programmed T-cells (both types) and B-cells are already in the circulation. Instead of measuring antibodies–which wane–to determine natural immunity, labs should be measuring programmed T-cells, which they can do. It’s just expensive as compared to measuring antibodies.
As I’ve mentioned many times in my office, the way the virus evades the surveillance system described above is by mutating to the point at which it is no longer recognized as the original virus causing the first infection.
And which is why there has never been an effective vaccine for coronaviruses (including the current ones), which are the cause of a ton of common colds. They mutate too rapidly. And the part that mutates is the spike protein, which is what the current vaccines are designed to produce to generate the immune response described above. All other adverse-reaction-issues aside, they would have been better, longer lasting, more effective in terms of waning immunity had they been designed to force the body to produce the nucleocapsid, which hasn’t mutated much at all in the last 20 years.