What is the grammar of : 除非，你堅持躲在潮濕的甲殼裡更快樂。 I recently encountered: 除非，你堅持躲在潮濕的甲殼裡更快樂。in an email.

The context is that the writer was telling me to cheer up.

I can recognize some of these words.

It seems to start off with "unless you persist", but beyond that I'm not very sure what to make of it.

"Unless you persist in making yourself sad, you will become more cheerful" is one guess, but I can't make that out of the remaining words.

"Unless you persist in trying to be happy, you can't hope to be happy" would be another reasonable guess, but again I don't see how to get that from the remaining words.

It's quite possible that both of the above guesses are completely misguided.
First off, this is not well written Chinese since it could lead to different interpretations.
One:

除非，你堅持(認為)躲在潮濕的甲殼裡更快樂。
Unless, you insist that hiding in a moist carapace is happier.

Two:

除非，你堅持躲在潮濕的甲殼裡更（讓你）快樂。
Unless, keeping your self hidden in a moist carapace (makes) you happier.

Although the essential meaning is similar. There are different interpretations because 堅持 used in the sentence is not clear enough.
堅持 could have two different meanings in the sentence:

persist in: Basically, it means keep doing something persistently.

insist (that.../on):
In this case, it's actually means 堅持（認為）、堅持（覺得）、堅持（要）and the words in the brackets can be omitted if there is no ambiguity.


With appropriate pauses in speaking, this ambiguity can be avoid. In written, normally, such ambiguity is avoided by proper punctuation. However in this case, additional words might be necessary to avoid misinterpretation.