A deity appeared before Kumārakassapa in Andhavana and propounded a riddle:
"There is an anthill burning day and night. The brahmin said: 'Take your tool, Sumedha (sage), and dig.' As the brahmin dug, he came across, successively, a bar, a frog, a forked passage, a strainer, a tortoise, a cleaver, a joint of meat - all of which he was told to cast out and dig on. He then came across a cobra, which he was asked not to harm, but to worship."
At the suggestion of the deity, Kassapa related the story to the Buddha, who solved the riddle. The anthill is the body, the brahmin the arahant, the tool wisdom, digging perseverance, the bar ignorance, the forked passage doubting, the strainer the five nīvaranas, the tortoise the fivefold upādāna - kkhandhas, the cleaver the fivefold pleasures of sense, the joint of meat passion's delights (nandīrāga), and the cobra (nāga) the arahant monk (M.i.142ff).
According to the Commentary (MA.i.340), Kumārakassapa was not an arahant at the time of the preaching of the sutta. The deity was a deity of the Suddhāvāsa brahma world. He was one of five friends who, in the time of Kassapa Buddha, had entered the Order and who, in order to meditate uninterruptedly, had climbed a rock by means of a ladder which they had then removed, thus cutting off their return. The eldest became an arahant in three days, the second (anuthera) was this deity, who had become an anāgāmī. The third was Pukkusāti, the fourth Bāhiya Dārucīriya and the last Kumārakassapa. This deity was responsible for the arahantship both of Bāhiya and Kassapa, for Kassapa took the Vammīka Sutta as the subject of his meditations and thus developed insight.