During Emperor Gaozong's Shangyuan 上元 era (674–676), Liu Yizhi was made an imperial chronicler, and a scholar at Hongwen Pavilion (弘文館). He and several colleagues also known for literary talent—Yuan Wanqing (元萬頃),
Fan Lübing, Miao Chuke (苗楚客), Zhou Simao (周思茂), and Han Chubin (韓楚賓)—were asked to serve as advisors to Emperor Gaozong's powerful wife
Empress Wu (later known as Wu Zetian), and they wrote a number of works on her behalf, including the
Biographies of Notable Women (列女傳),
Guidelines for Imperial Subjects (臣軌), and
New Teachings for Official Staff Members (百僚新誡). Collectively, they became known as the "North Gate Scholars" (北門學士), because they served inside the palace, which was to the north of the imperial government buildings, and Empress Wu sought advice from them to divert the powers of the
chancellors. At that time, both he and his brother Liu Yizhi (劉懿之, note different character) served in government, a fact that impressed many people. In 677, Liu was made the assistant head of the legislative bureau of government (中書省,
Zhongshu Sheng) and the military advisor to Emperor Gaozong's and Empress Wu's youngest son
Li Lun (the later Emperor Ruizong). However, it was at this time that an incident involving his sister would cause him to be exiled. His sister was serving in a position inside the palace. Empress Wu had sent her to visit Empress Wu's mother Lady Yang, the Lady of Rong, at that time. Against regulations, when Liu Yizhi found out about this, he went to Lady Yang's mansion to meet his sister. As a result of this violation, he was exiled to Xi Prefecture (巂州, roughly modern
Liangshan Yi Autonomous Prefecture,
Sichuan) for several years. Later, at Empress Wu's request, Liu Yizhi was recalled from exile, and he was made
Zhongshu Sheren (中書舍人), a mid-level official at the legislative bureau, and again the military advisor to Li Lun (whose name was by then changed to Li Dan and whose title was then the Prince of Xiang). He also soon again became the assistant head of the legislative bureau. Emperor Gaozong was impressed with Liu Yizhi's family's reputation for faithfulness and filial piety, and had once told Liu, "The Prince of Xiang is my beloved son. Because you come from a family of faithfulness and filial piety, I want you to teach and guide him." It was further said that Liu himself was filially pious and caring for his siblings, and that he was generous with his salaries, often giving them to relatives with need, and that this further impressed Emperor Gaozong. Emperor Gaozong died in 683 and was succeeded by Li Dan's older brother
Li Zhe the
Crown Prince (as Emperor Zhongzong), but Empress Wu retained All of the power, as
empress dowager and
regent. In 684, after Emperor Zhongzong showed signs of independence, she deposed him and replaced him with Li Dan (as Emperor Ruizong). Liu was involved in the planning for this, and he was, in return, given the designation
Tong Zhongshu Menxia Sanpin (同中書門下三品), making him a chancellor
de facto. He was also created the Baron of Linhuai. It was said that at that time, the edicts issued by Empress Dowager Wu and Emperor Ruizong were mostly drafted by Liu, and that he wrote them well and quickly. == During Empress dowager's Wu regency ==