In the article of Emperor Temmu in 680 of the oldest history book in Japan, "Nihonshoki" (Chronicles of Japan), there was a description on the government posts of Kunaikyo (Minister of the Sovereign's Household) and Miyanouchi no tsukasa no kami and also in the article of in 686, there was another description on Emperor Temmu's funeral that shinobigoto (speech given to the spirit of the departed about his/her merit) was conducted for the "miyanouchi-no-koto" (Imperial family's affairs), from which the original government post was established in the period of Emperor Temmu.
日本最古の歴史書とされる『日本書紀』の天武天皇9年（680年）の条には「宮内卿」「宮内官大夫」の官職が記述され、686年（朱鳥元年）の条には天武天皇の葬送に際して「宮内事」を誄（しのびごと）したとあり、天武天皇の時代には原型となる官職が形成されたと見られる。