I first ran across this idea when reading the Kathasaritsagara of Somadeva.

It says that the number of verses in the extant text are only a subset of a larger text that exists in heaven. Depending on the situation on earth a different number of verses might manifest.

I've since run across it in passing in some tantric writings as well.

Does anyone know the origin of this idea of a large heavenly corpus in contrast to a smaller earthly one? Or have any citations for texts that mention it?

Best,

Dean