In the Commander format, a special replacement effect applies to your commander: whenever it would be put into your library, graveyard, or exile, you may instead put it into the command zone. This applies regardless of who caused the movement or how it happened — including if you yourself are the one tucking it (e.g., via Brainstorm, Temporal Cascade, or a shuffle effect).
This rule is defined in the Commander format rules, which are built on top of the Comprehensive Rules. CR 903.9 states that if a commander would be put into its owner's hand, library, graveyard, or exile from anywhere, its owner may put it into the command zone instead. This is a replacement effect the owner chooses to apply (or not).
The key point is that the choice is entirely yours as the commander's owner. If you want to keep it in your library for strategic reasons, you are free to let it go there. But if you'd prefer to preserve access to it via the command zone (and pay the commander tax later), you may redirect it there.
Concrete example: You cast Brainstorm, draw three cards, then must put two cards back on top. You choose to put your commander (say, Atraxa) back into your library. As that event would occur, you may instead place Atraxa into the command zone. If you do, it costs 2 more generic mana the next time you cast it from the command zone.
Note: The commander tax (CR 903.8) increases by 2 each time the commander is cast from the command zone, so repeated use of this replacement effect will make recasting more expensive over time.
Unofficial fan resource — not affiliated with or endorsed by Wizards of the Coast. Answers are AI-generated estimates grounded in the Comprehensive Rules and are not a substitute for an official judge. Verify anything match-critical.