Kozilek's triggered ability checks to see if you have fewer than seven cards in hand when you cast it. Kozilek is on the stack at this time and not in your hand. If you don't, the ability won't trigger at all. If the ability does trigger, it will check again as it tries to resolve. If you have seven or more cards in hand at that time, the ability won't do anything.

Artwork
Loading artwork…
Kozilek, the Great Distortion
Commander Masters · #452 · EN
Nonfoil—Foil—Etched—
Card rules
When you cast this spell, if you have fewer than seven cards in hand, draw cards equal to the difference.
Menace
Discard a card with mana value X: Counter target spell with mana value X.
12/12
A void as cryptic as reality itself.
Mythic · Illustrated by Aleksi Briclot
Format legality
Brawl Legal
Commander Legal
Competitive Brawl Legal
Duel Legal
Gladiator Legal
Historic Legal
Legacy Legal
Modern Legal
Oathbreaker Legal
Penny Legal
Pioneer Legal
Timeless Legal
Vintage Legal
Alchemy Not Legal
Future Not Legal
Old School Not Legal
Pauper Not Legal
Pauper Commander Not Legal
PreDH Not Legal
Premodern Not Legal
Standard Not Legal
Standard Brawl Not Legal
Tlr Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions
If there's an X in the mana cost of the card you discard, that X is 0. Any X in the mana cost of the target spell will have whatever value was determined for it as the spell was cast.
The mana value of a spell doesn't change, even if it's been cast using an alternative cost (such as an awaken cost). For example, the mana value of a Sheer Drop (a spell with mana cost 2
) that's been cast for its awaken cost of 5
is 3.
To activate the last ability, there must be a legal target: a spell on the stack. That target will determine the value of X and the mana value of the card you discard. You can't activate the ability unless you can match the mana value of a spell on the stack to that of a card in your hand.