I did a little investigation.
KoLmafia currently stores neither clan name nor ID. It detects whether you are in a clan or not by seeing there is a link to "clan_hall.php" in the topmenu. Presumably, if you leave a clan, the topmenu refreshes, and we mark you as not in a clan, and vice versa if you join a clan.
As described above by Alhifar & Grotfang, we can visit
showplayer.php?who=XXX
To find out the clan name and clan ID
If you visit clan_hall.php, you will be told the name of your current clan: it's the title of the frame, in bold. I see no clan ID on that page.
You can visit the clan recruiter and get a list of clan names and clan IDs that you are whitelisted to:
PHP:
<form action=showclan.php method=get>
<input type=hidden name=recruiter value=1>
Whitelist List:
<select name=whichclan>
<option value=90485>Bonus Adventures from Hell</option>
<option value=6993>Grrl Power!</option>
<option value=41543>Hardcore Nation</option>
<option value=38808>Hardcore Oxygenation</option>
...
</select>
<input type=submit class=button value='Go to Clan'>
<br>You are currently whitelisted by XX clans.
</form>
Visiting a clan from the recruiter:
showclan.php?recruiter=1&whichclan=6993
Applying to a clan from the recruiter:
showclan.php?pwd&whichclan=6993&action=joinclan&confirm=on
-> redirects to clan_hall.php
Joining a clan via /whitelist xxx
showclan.php?action=joinclan&pwd&whichclan=38808&ajax=1&confirm=1
-> You have now changed your allegiance.
(and presumably the "You are not cool enough" message for a clan you are not whitelisted to)
So, basically, we can track clan hopping easily enough and automatically detect the clan ID. The result of joining a clan - either via the recruiter or via /whitelist - does not tell you the clan name. We could presumably follow up with a quick "showclan.php?whichclan=xxx" or "showplayer.php?who=yyy" and parse the clan name from there.
I did not test applying to a clan I am not whitelisted to and being told later that I have been accepted. Do you have to leave your current clan to do that? Or are you auto-booted into having "no clan" while you are in that state? If so, the topmenu refresh will tell us that we are not in a clan, and, later, when it refreshes again and says we are in a clan, we could look at showplayer.php