It's possible to have a unit that has a permanent cloak (meaning they always have a cloak unless they use a decloaking skill (eg, they might be set so that when they attack, they become uncloaked) or are within the sights of a detector unit of the same cloak group). I had an interesting idea about having a unit that can only decloak by attacking, however, there was one slight issue: the moment they stopped attacking, they would instantly become "invisible" again. I propose a "cooldown" period for these decloak skills.
This would be XML specified, such as with <cooldown value="10" />, which would specify the time in seconds before the unit will be cloaked again once it finishes using that skill. So with that tag, for example, a unit that decloaks on attack will not be cloaked again for 10 seconds, so they cannot take out an entire base single handedly by letting the cloak resume after the attack, as well as it would work well with units that are meant to attack infrequently, eg, every 5 seconds.
Relatedly, another feature would be to prevent these cloaking units from regaining their cloak if under attack, and require a cooldown period of which they cannot be attacked in to cloak again. This could use <no-attacked-cloak value="true" length="10" />. The value would enable this (if false, they can regain their cloak even if under attack; if true, they cannot regain their cloak until they are no longer under attack). The length would be a cooldown period, in seconds, in which they cannot be attacked within in order to become cloaked again. If they get attacked, the timer restarts.
For example, a unit might have a decloaking skill on attack, so when it attacks, it's suddenly visible. The enemy will attack this unit, so even if it stops attacking, it will not regain it's cloak while under attack. If it kills the attacking enemy, it would have to wait ten seconds to regain that cloak.
Without this, cloaking without a detector will be hampered. I plan to make use of such a feature, if implemented, in Apocalyptic Dawn by having a sniper that has very potent cloaking and cannot be seen until he attacks (though I may have to give the short-sighted Headquarters a detector to prevent the abuse of them for spying on bases). The entire point of snipers is to remain hidden until after they snipe. Of course, once he pulls that trigger, he's vulnerable (the US, if I recall, has a system that can locate a sniper instantly based on the sound waves). This could also be applied to a sniper perch defensive structure, allowing them to be hidden until they decide to pull the trigger (it is a camouflaged post).