The Palace Library (Chinese: 秘書省; in Vietnam: 秘書所, Bí thư sở) was a central government agency in Imperial and monarchical China, Korea, and Vietnam generally in charge of maintaining and archiving the collection of the monarch's documents.
The office was in existence for the most part from the mid-200s CE (Cao Wei) to 1380 (Ming dynasty). Over the millennia there were 5 names for this office:
Orchid Pavilion (蘭臺; "Lantai"): used during the Tang dynasty between 662 and 670
Unicorn Pavilion (麟臺; "Lintai"): used during the Tang dynasty and the Wu Zhou between 684 and 712
In addition to preserving the emperor's official documents, the agency was sometimes also tasked to compile or edit historical records and state calendars. Before the Sui dynasty, it also handled documents flowing into and out of the imperial palace, making it interchangeable with the Secretariat. During the late Tang dynasty (after early 700s) and the Song dynasty, the office was largely non-functional and staffed by eminent officials for sinecure purposes.
The office during the Tang dynasty was headed by one director (秘書監) and two vice directors (秘書少監), and during the Song dynasty by one director and one vice director. The office was also staffed with assistant directors (秘書丞) and assistants (秘書郎 or 秘書郎中). During the Yuan dynasty, the office was headed by four chief ministers (秘書卿), two directors (秘書太監), two vice directors, and two assistant directors (秘書丞 or 秘書監丞), all eunuchs.
Modeled after the Chinese institution, the office also existed in Goryeo dynasty under several names:
As Department of the Inner Library (內書省; "Naeseo Seong"): from 918 to 995
As Department of the Palace Library: from 995 to 1298
As Directorate of the Palace Library: from 1298 to 1308 and from 1356 to 1362
As Office of Proofreading Documents (典校署; "Jeongyo Seo"): from 1308 to 1356
As Court of Proofreading Documents (典校寺; "Jeongyo Sa"): from 1362 to 1392
In general, the office was staffed by 1 supervisor (判事; "pansa"), 1 director (監 or 令), 1 vice director (少監 or 副令), 2 assistant directors (丞) and 1 assistant (郎).
Vietnam
The Palace Library Office (Hán-Nôm: 秘書所, Bí thư sở) of the Nguyễn dynasty was one of the four sở of the cabinet of the Nguyễn dynasty. It was first established under the reign of the Minh Mạng Emperor under the name Palace Library Section (秘書曹, Bí thư tào) and would retain its final form during the reign of the Thiệu Trị Emperor. The Palace Library Office of the Southern Court took care of the copying of poems and documents, preserving important documents such as official correspondence with other countries, national maps, and public bibliographies.[1]