Wikipedia
was a counselor of the third rank in the Imperial court of Japan. The role dates to the 7th century. This advisory position remained a part of the Imperial court of Japan from the 8th century until the Meiji period in the 19th century. This became a Taihō Code office in the early feudal Japanese government or daijō-kan.
In the ranks of the Imperial bureaucracy, the Shōnagon came between the Chūnagon (middle counselors) and the Sangi (associate counselors).
Typically, the office was held by three fifth-rank members of the kuge. These officials were responsible for reading ordinary reports and for making of Imperial travel arrangements. The Shōnagon are said to help the memories of the principal officers, to put seals to deeds, and carry communications to others within the daijō-kan. They are both military and civil.