Kokyu Junishi (後宮十二司)
As the term "junishi (twelve offices)" suggests, the Kokyu junishi consisted of twelve offices including Naishi no tsukasa (Female Palace Attendants Office), Kura no tsukasa (Office concerned about clothes of Emperor and Empress), Fumi no tsukasa (Book and Writing Materials Office), Kusuri no tsukasa (Medical Office), Suwamono no tsukasa (Military Equipment Office), Mikado no tsukasa (Emperor Attendants Office), Tonomo no tsukasa (Housekeeping Branch of the Imperial Household Ministry), Kamori no tsukasa (Housekeeping Office), Mondo no tsukasa (Water Office), Kashiwade no tsukasa (Table Office), Sake no tsukasa (Sake Office) and Nui no tsukasa (Sewing Office). These offices were intended mainly for emperor's domestic governing institutions at the empress's residence, not related to official court ranks. However, there was grading called juni for the payment of horoku (remuneration) and a prescription that a female officer should receive the same treatment as a male officer belonging to the same class in juni. According to this, the highest juni among kunin was Kura no tsukasa followed by Kashiwade no tsukasa, Mui no tsukasa and Naishi no tsukasa, which influenced grading of kokyu junishi. Moreover, the structure of Shitokan being in a incomplete form, in Kura no tsukasa/Kashiwade no tsukasa/Mui no tsukasa/Naishi no tsukasa, a Santokan system (excluding sakan) was adopted such as Sho/kami (a director), ten/suke (an undersecretary) and sho (matsurigotohito/jo...(hangan or a judge), and in other eight tsukasa, the Nitokan system was adopted. In order to fill in the lacking posts of a hangan and a sakan, women in a lower social status who did not appear even in the Goku Shikiin (staff) Code such as nyoju/uneme and shijo/kashigime were employed.
Originally, the dairi where the kokyu was placed was an emperor's private space, so that entries of male kugyo/officials were basically restricted. Therefore, kunin were needed to carry out the service in the kokyu.
In the late Nara period, the position of Naishi no tsukasa who acted as corresponding clerks between an emperor and the kokyu or male officials came to be treated equally to that of the Kura no tsukasa that ranked first in the junishi and preserved three sacred imperial treasures. In the early Heian period, job grades such as kurodo that had authority of comings and goings in the kokyu appeared, which lowered the role of the kokyu junishi, and in the middle of the tenth century, while the structural reform of the kokyu was performed in the form of the functions of eleven tsukasa being absorbed/integrated by the Naishino tsukasa, the Sekkanseiji Period (regency period) made a start.