Koshin-sama is a popular and powerful deity variously identified with the kami of agriculture (ta no kami), of soil (jigami), of travel (dosojin) and of craftsmanship. He is of Taoist origin, has a Buddhist identity as the gongen of the messenger of India, seimen kongo and an unofficial Shinto identity in the minds of ordinary people. Koshin refers both to the day, ko-shin; monkey-day, the 57th in the Chinese sixty-day, sixty-year cycle and to the deity, Koshin-sama, who protects people on this day when the three worms (sanshi) black, green and white which inhabit the body ascend to heaven during sleep and report on their host's sins to the heavenly emperor. Koshin is worshipped by koshin-ko believers who meet together six times a year on koshin day to perform rites, discuss religious and village affairs and stay up all night. Remaining awake was originally a form of Taoist abstention and in this case is a device to avoid one's spirit 'worms' being taken away for judgement while asleep. In addition, Koshin is credited with innumerable different roles and functions in Japanese popular religion, especially the healing of specific illnesses.
A Popular Dictionary of Shinto. Brian Bocking.