Koshin is described as a folk faith in Japan with Taoist origins:
The main Kōshin belief that survived from an original complex faith, is the concept that three worms, called Sanshi (三尸), live in everyone’s body. The Sanshi keep track of the good deeds and particularly the bad deeds of the person they inhabit. On the night called Kōshin-Machi (which happens each 60 days), while the person sleeps, the Sanshis leave the body and go to Ten-Tei(天帝), the Heavenly god, to report about the deeds of that person.
Ten-Tei will then decide to punish bad people, making them ill, shortening their lifetime and in extreme cases putting an end to their lives. Believers of Kōshin will try to live a life without bad deeds, but those who have reason to fear will try to stay awake during Kōshin nights, as the only way to prevent the Sanshi from leaving the body and reporting to Ten-Tei.
Which (of course) lead to festivals every 60 days where people attempted to stay up for the entire day to stop the worms from leaving their bodies.
Below is a very old, traditional Koshin shrine near our home.
This faith is also affiliated with the 3 monkeys (seen in the middle bottom):
Three monkeys covering eyes, mouth and ears with their hands are the best known symbols of Kōshin faith. They are Mizaru (not see), Iwazaru (not say) and Kikazaru (not hear). It is not very clear why the three monkeys became part of Kōshin belief, but is assumed that it is because like the monkeys, the Sanshis and Ten-Tei are not to see, hear, or tell the bad deeds of a person.
Statues of Shōmen-Kongō with the three monkeys have existed in temples and shrines since the Edo era. Sometimes carved stones called Kōshin-tō were placed around a dwelling for protection. Such stones can present diverse forms, from having only Chinese characters (kanji) to including a depiction of Shōmen- Kongō with one, two or three monkeys.
So many layers to Japan’s complex history, hidden from the Gaijin.