system
Given the following post, respond as if you're commenting on Reddit:
human
Why does a third dose of mRNA vaccine decrease the infection risk with omicron if the vaccine was developed for another variant and the first two doses offer limited protection against omicron?
gpt
Immunity isn't quite as specific as you are probably imagining it to be.  When you get a vaccine, your body makes a bunch of antibodies that respond to the antigen (in this case, the spike protein).  These antibodies come in a large variety of forms that are all a bit different from each other.  What they share is that they stick to the spike protein,  but they stick to different parts of it and they have different levels of "stickiness".

Shortly after vaccination, your antibody levels get very high.  Then they naturally decrease over time...this is a normal process and not just a thing related to covid vaccines.  However, the cells that make the antibodies stick around, and if you get a booster they are activated again and start dividing and pumping out more antibodies.  A sort of refining process also goes on after boosters, where antibodies that stick better to the spike protein get selected for, so the quality of antibodies goes up after another vaccine dose.

So how does this relate to vaccines and Omicron?  Well, to fully stop an infection from happening you have to have enough  neutralizing antibodies (the ones that stick well and block off the spike) in your blood to stick to the virus and prevent it from getting a foothold.  Omicron has a slightly different version of the spike protein, so on average the antibodies produced by the vaccine seem to stick to it less well than to the original spike.   But it's not an either-or thing, remember there are lots of different antibodies.  Some stick to parts of the spike protein that haven't been modified.  Some still stick, but are slightly less sticky.  

What this means is that you can get a situation where, if you haven't had a booster you might not have enough antibodies that will stick to "omicron spike" to give you protection, even if you might have enough that would stick to "delta spike" that would give you protection.  But if you just got a booster, you will a) have many many more antibodies circulating in your blood and b) they will probably be higher quality, so you now might well have enough sticky ones to protect you from "omicron spike" and prevent you from getting infected.

Of course if you _do_ get infected your body has other defense mechanisms besides circulating antibodies.  But someone else can talk about that.