A cocoon is an item you can put in your inventory that will protect your stuff for a while if you should happen to die. Without a cocoon, your items are vulnerable to anyone or anything that comes along and takes a fancy to them, which includes players and NPCs.
If you die with a cocoon in your inventory, after you're re-cloned, run back to where you died (or where your body ended up, depending on how you died!) and. All of your stuff will be automatically returned to your inventory, but it won't be re-equipped! You'll have to do that yourself. It's also a good idea to carry more than one, or buy a cocoon before you run back to your corpse, in case whatever killed you is still there and waiting for you to open your cocoon! (Or you might die on your way back to safety after opening your cocoon, leaving your stuff vulnerable. This is why buying a new capsule should be your first priority upon cloning.) If you however are carrying a cocoon in your inventory and try to open your already deployed cocoon from death you might run into problems with targeting - should target the one on the ground.
Cocoons are available from Eschaton Outfitters, EO on your map in Freedom City - conveniently located W,D,D from Clone Arrangers. If the shop is closed you can buy a cocoon from the automat located outside. If your cocoon "expires" before you can get to it, your stuff will be left exposed, just as if you'd never had one in the first place!
Cocoons are also less effective the higher amount of XP you accumulate - meaning there's a chance it won't save all of your items, or even any. So holding a white one after you become tougher might be a waste. After 20K XP you will lose some items if you have a cocoon in your inventory.
four three different types of cocoons.
White cocoons last for eight hours in-game (1 hour realtime), and work flawlessly as long as you have less than 7,500 XP.
Blue cocoons last for one in-game day (3 hours realtime), and work flawlessly as long as you have less than 20,000 XP.
last for two in-game days (6 hours realtime) and no longer exist (RIP).
Black cocoons explode with pipe bomb magnitude ('oh fuck' hours realtime), and destroy your gear. They always work.