was one of the official positions belonging to the of the Ministry of the Center under the ritsuryō system in ancient Japan, and was assigned as a technical officer in charge of divination and geomorphology based on the theory of the yin-and-yang five phases. In the Middle Ages and early modern period, the term was used to refer to those who performed prayers and divination in the private sector, and some of them were regarded as a kind of clergy.
History Introduction of the yin-and-yang five phases philosophy and the establishment of the Bureau of Onmyō Based on the ancient Chinese concept of yin and yang and five phases, which began in the Xia and Shang dynasties and was almost completed in the Zhou dynasty, that all phenomena are based on the combination of yin-and-yang five phases of wood, fire, earth, metal, and water, onmyōji is a uniquely Japanese profession that is responsible for astrology, calendar, I Ching, water clock, etc., which are closely related to this concept. The yin-and-yang five phases philosophy itself, which is the premise of this system, is thought to have come directly from the mainland China (the Northern and Southern dynasties or earlier) or via the western part of the Korean Peninsula (Goguryeo and Baekje) during the Asuka period, or at the latest by the time the Five Classics doctors came to Japan from Baekje in 512 or the I Ching doctors came to Japan in 554.
At first, the influence of these studies on politics and culture was minimal. However, in 602, Gwalleuk came to Japan from Baekje and taught various studies, including the yin-and-yang five phases, to 34 selected officials, including Prince Shōtoku. As a result, an official calendar was adopted in Japan for the first time, and Japanese missions to Sui China was launched in 607 to absorb Buddha's teachings, yin-and-yang five phases philosophies, and the calendar system. In addition, the influence of yin-and-yang five phases philosophies became apparent in the establishment of Prince Shōtoku's seventeen-article constitution and the Twelve Level Cap and Rank System. Thereafter, the Imperial court continued to send international students to accompany Japanese missions to Sui China (later Japanese missions to Tang China) and invited many monks and scholars from mainland China or the west coast of the Korean Peninsula to further absorb knowledge. As the introduction of various schools of thought progressed, Japan came to believe that it was important to consider the movements and positions of the Chinese constellations, to determine the good and bad fortune, disasters and fortune based on the principle of compatibility of birth and death, to divine the future, and to obtain guidelines for all personnel matters.
Later, Emperor Tenmu was such a master of astrology and fugue that he took his own divination tools and told fortunes during the Jinshin War. He also had a deep knowledge of the yin-and-yang five phases philosophy, which led to the establishment of the Bureau of Onmyō and Japan's first observatory in 676, and the use of the term "onmyōji" in 685, which further increased the popularity of the yin-and-yang five phases philosophy. In 718, the Yōrō Code established the Bureau of Onmyō as an internal department of the Ministry of Center, and when it was stipulated that the positions of , , onmyōji, , and should be permanently assigned as technical officers, the Bureau of Onmyō became officially in charge of divination along with the turtle shell diviners who belonged to the Department of Divinities.
In the Bureau of Onmyō, a was established, with a Head of Onmyō at the top, administrative officers below him, and technical officers such as doctors, trainees, and other general staff. However, since the technical officers, such as doctors and onmyōji, were in charge of technology that had been introduced from the continent, they were appointed by foreigners who were well versed in academics and skilled in reading Classical Chinese texts, especially monks who had come from the Han dynasty and the Sui dynasty in mainland China, as well as from Goguryeo and Baekje, which had power on the west coast of the Korean Peninsula, and rarely from Silla, which initially had power on the east coast of the Korean Peninsula. In particular, around the time of the defeat of the Baekje dynasty in the Battle of Baekgang in 663, when Japan sent reinforcements to Baekje, a close ally of Japan, and Silla unified the Korean Peninsula, a large number of knowledgeable people from Baekje came to Japan as exiles, and many of them were appointed to the bureau. It was also possible to appoint technical officers from the civilian population.
When the Bureau of Onmyō was first established, the technical officers' duties were purely limited to I Ching, geomorphology (like what we call "feng shui" today), astronomical observation, astrology, making calendars, judging good days and bad days, and keeping time with water clocks. They did not perform any religious rituals or spells like the Department of Divinities or monks. However, they played an important role in the relocation of the capital by selecting good days for repairs and predicting the good and bad fortune of the land and its direction.
Of the technical officers assigned to the Bureau of Onmyō, the onmyōji who specialized in I Ching and geomorphology can be defined as "onmyōji in the narrow sense," and all the technical officers, including Doctor of Astrology, Doctor of Onmyō, onmyōji, Doctor of Calendar, and Doctor of Water Clock, as "onmyōji in the broad sense." After this, this group of onmyōji in the broad sense was sometimes referred to as "onmyōdō."
Changes in the treatment of onmyōji under the ritsuryō system Under the ritsuryō system, it was strictly forbidden for any outsider (not only priests and monks, but also all government officials and private citizens) to study astrology, yin and yang, calendars, and time management, and to preach about disasters and good omens, except for those who were appointed as trainees at the Bureau of Onmyō. Any equipment related to astronomical observation or time measurement, or books related to onmyōdō was also forbidden to be taken out of the Bureau of Onmyō, and even forbidden to be simply owned by private individuals. For this reason, until the beginning of the Heian period (early 9th century), when the ritsuryō system was relatively strictly enforced, onmyōdō was managed as classified information monopolized by the Bureau of Onmyō. Thereafter, to keep up with the trends of the times, were often issued to revise the details of the ritsuryō system, and as the number of government positions in each ministry tended to increase, the number of positions in the Bureau of Onmyō was also increased considerably by the middle of the Heian period.
In general, the court rank of the technical officers in each ministry was set low, but the rank of the technical officers in the Bureau of Onmyō was set higher than that of the technical officers in other ministries. However, since the Bureau of Onmyō was an internal bureau of the Ministry of Center, the rank of the fourth grade administrative officials was naturally lower than that of the main ministry, and only a Head of Onmyō allowed to ascend to the hall of the Seiryōden, the place of daily life of the Emperor, to .
In the beginning, the fourth class officials and the technical officials, the doctors and onmyōji, were appointed strictly separately, and the latter were appointed by the learned monks who came from the advanced countries of China and Korea. This was because it was impossible for the Imperial court, which was a secular government, to allow monks to serve freely because of the way they were treated. The reason for this was that it was necessary to return monks appointed as doctors or onmyōji to the secular world by Imperial decree before they could be appointed as administrative officials, and such decree should not be issued frequently. As a substitute, secular personnel were appointed as students of astrology, onmyōdō, and calendars to learn the various arts of onmyōdō and to cultivate personnel who could serve and work freely at the Imperial court. Later, this practice gradually became more ambiguous, and it became possible for a learned monk to be appointed as a technical official without returning to secular life, and to be transferred to a higher position (especially as a Head or Vice Head) or be ordered to serve concurrently as an administrative official. However, to raise the rank of a technical officer, who was basically a learned monk who did not return to the secular world, it was not possible to raise the rank of a technical officer without changing the position of technical officer according to the , which was the basis of the ritsuryō system. In addition, as the training of trainees progressed, more and more secular bureaucrats became technical officers, and personnel exchanges became even more free. In any case, there were many transfers and concurrent appointments from technical officers to administrative officers in the Bureau of Onmyō. A Head of Onmyō, namely a director of the Bureau of Onmyō, was also a former technical official and many technical officials held concurrent positions in the Bureau of Onmyō. The Bureau of Onmyō became a technical government office from the Nara period to the early Heian period.
However, with the abolition of Japanese missions to Tang China after 838, the opportunity to invite talented foreigners from the Tang dynasty on the mainland China was lost (the unified Silla on the Korean Peninsula was not as close as it once was with Baekje). As a result of continuing to train technical officers in a closed manner by limiting the number of trainees to only 30, in the early Heian period, there was gradually a scarcity of human resources for technical officers at the Bureau of Onmyō. In addition, there was a shortage of positions due to the intensifying struggle for power among the nobles. A Head of Onmyō, who was the only man in the Bureau of Onmyō who had direct access to the Emperor, was not appointed from the ranks of technical officers such as doctors, but was used more and more as a position of the nobles. Since it was the last position in the directorate, it tended to be used as a treatment for noblemen who were in relatively poor circumstances. From this period onward, there was a particularly large number of assignments outside the capacity of the bureau, and these assignments became permanent. This was no longer a part of the consideration for monks, but was simply for the purpose of assigning positions to nobles.