How do modifiers work (USB HID)?

I think you’re thinking of this code. This defines the bits used in the key state that is passed around in Kaleidoscope. In particular, plugins that use event handler hooks get passed this state, which tells them something about what modifiers are held. However, that’s separate from what the HID part of the code thinks is and isn’t held - it keeps track separately, in the places Jesse has pointed out.

https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs.h#L73