In several places the Talmud records[1] discussions and debates amongst the Tanoim regarding the inclusion of various seforim in the canon of the kisvei ha'kodesh. Before deciding which seforim to include, how did the Tanoim know that there was supposed to be an entity of kisvei ha'kodesh at all? The chamisha chumshei Torah were dictated word for word and letter for letter to Moshe Rabbeinu by Hakadosh Boruch Hu, and therefore the gemoroh derives halochos from the fact that a specific word is spelled molei or choseir, from seemingly extra words, awkward expressions, or irregular grammatical constructs. Most assume[2], however, that the seforim in neviim and kesuvim were not dictated min ha'shomayim. How, then, did the chachomim know that they should add neviim and kesuvim on to the body of Torah shebichsav?
Rambam (at the end of Hilchos Purim) understood the Talmud Yerushalmi as having said that in the time of moshiach the neviim and kesuvim will lose their kisvei ha'kodesh status. According to his understanding it would seem as if the inclusion of neviim and kesuvim in the canon of kisvei ha'kodesh is merely a horoas shoah m'drabbonon. (Even though Megillas Esther will remain in the times of moshiach, it seems that it will be a text of Torah shebichsav but will not be part of kisvei ha'kodesh; this is a similar notion to the opinion from the days of the Talmud that the Book of Esther was never incorporated into Tanach and yet one can only fulfill the mitzvah m'drabonon of reading the Megillah if it is written properly on parchment, etc.) However, according to Ra'avad, who thinks that Tanach will remain even after the coming of moshiach, it appears that the idea of the Tanach is a real halacha min haTorah. From where, then, did the anshei k'nesses ha'gedolah know this halacha min haTorah?
Towards the end of parshas B'shalach Hashem used three expressions when instructing Moshe Rabbeinu to record the story of Amalek into the chumash: zos, zikoron, and ba'sefer. The gemoroh (Megillah 7a) comments that this references the division of Torah shebichsav into the three sections of Torah, neviim, and kesuvim[3].
The expression "zeh hadovor" introducing a nevuah only appears in the chumash when Moshe rabbeinu was given halochos which will be binding throughout all generations[4]. Only in these instances did Hashem dictate to him word for word and letter for letter. Perhaps this is the meaning of the gemoroh's comment that the word zos is an illusion to Toras Moshe, since zos has the connotation of direct dictation.
Regarding distinction between neviim and kesuvim, the following comment is attributed to Reb Chaim Soloveitchik: both neviim and kesuvim were composed with ruach hakodesh, but whereas the kesuvim were initially intended to be written down, and only then to be read, and therefore are referred as kesuvim (writings), the books of the neviim were initially intended to serve as prophecies to be delivered orally and only later to be written down and therefore are referred to as neviim based on the biblical expression, "niv sifosayim - the produce of the lips", i.e. the spoken word. This is also the meaning of the Talmudic statement (Menachos 30a) that Hakodosh Boruch Hu dictated the entire chumash (except for shiras Ha'azinu)[5] to Moshe, and Moshe would first deliver the nevuah orally to Bnei Yisroel and only then write it down. Only after the prophecy was first delivered was it considered nevuas Moshe, and only thereafter could it be written down to obtain the status of Toras Moshe.
[1] Mishna Yodayim end of chapter 3, Shabbos 13b, Megillah 7a
[2] See comment of Netziv to Sheiltos, chapter 8, #10
[3] I seem to recall hearing this point from Rav Simcha Wasserman, z"l
[4] See Rashi at the beginning of parshas Matos and the interpretation of the Kedushas Levi there. See B'ikvei Ha'tzon page 135
[5]Netziv in his commentary to Devorim 31:19