Q. Where do we get the idea of being written in God’s record book?
A. Moses said, “I pray that You forgive their sin, but if not, erase me from the book which You have written”. God answered, “Whoever has sinned against Me, him I will I erase from My book” (Ex. 32:32-33).
In another passage, David prayed, “May they (the wicked) be erased from the Book of Life, and may they not be written down with the righteous” (Psalm 69:23).
All this assumes that God has a Book of Life in which He records the names of the righteous and from which He excludes the sinners.
However, this principle is qualified by a Midrash which says that in the verse, “On Your book may all of them be written down” (Psalm 139:16), “all of them” means all generations – all humankind.
So if there is a book for the righteous, and yet all humans are inscribed in a book, there must also be a book for the sinners, and a third one for the intermediate category.
The conclusion that the Talmud comes to (RH 16b) is that God opens three books on Rosh HaShanah and hopefully by Yom Kippur we who are in the intermediate category will have mended our ways sufficiently to be moved into the Good Book.