Question: what is the meaning of the idiom keep it under your hat?
Answer: Preserve the secrecy of something, as in I'll tell you about it if you promise to keep it under your hat. This usage alludes to hiding a secret in one's head, covered by a hat. [