Case Moth caterpillars, family Psychidae, use silk and plant materials to build a case around themselves, and extend their head and thorax to feed. There is a rear opening for excreta.
This individual, probably Clania lewinii has fixed its case to the branch with a loop of silk. When disturbed it retreated inside the case, and tightened the loop, drawing the case opening up under the twig. Neat.