It's usually calves people get problems with. Why
there for you I don't know. It may be linked to some activity you do
Magnesium helps with cramping. But the problem seems to be further up the chain. Have a look at Jack Kruses's Brain-Gut 12:
BRAIN GUT 12: DARE TO DISAGREE? | Living an Optimized Life
That's the maverick doctor telling a few (well-deserved) home truths to the paleosphere.
The basic point here is that brain chemistry (this guy is a neurosurgeon) tells us that we evolved around water
not on the savannah. (And that does fit the geographical situation in the Rift Valley, too.) Modern people are dangerously lacking in some nutrients that you can get from river-food ,and particularly seafood, including most importantly DHA and iodine. (700 million people worldwide are thought to be clinically iodine-deficient and that's with many governments having made the iodination of salt compulsory. What would the figure be otherwise?)
I would take a magnesium supplement, probably magnesium malate or magnesium glycerinate is best absorbed, but the powder you make into a drink is OK -- Naturalcalm.
But I would also up your consumption of seafood, i.e., fish and shellfish, quite a lot. You might also add some seaweed into the mix.