A jade pendant carries him through a tribulation, and in Northern Qi he writes a tale of loyalty
Late on Saturday night, Qin Yuntao, an engineering student and literature graduate student, discusses the rise and fall of Northern Qi with his girlfriend, Luo Jingya. They talk about Lou Zhaojun's ruthlessness and the Gao clan's debauchery, unaware that the ancestral pale-green jade pendant beside his pillow conceals a secret of time and space. At dawn, its green light flares. He opens his eyes to find himself in a ruined mountain temple in Northern Qi's second Tianbao year.
He buries A Qiong, who died while fleeing famine, then joins a stream of refugees heading for Yecheng, where he meets the siblings A Man and uses modern farming and disease-prevention techniques to weave "miracles" that win people's hearts. Just then, his distant kinsman Qin Haichuan is framed for witchcraft by the Xianbei aristocrat Hulv Jin and sentenced to execution. Qin Yuntao shouts, "Stay your blade!" and stakes his ability to cure Princess Yi'an's strange illness on a meeting with Emperor Wenxuan, Gao Yang.
In the throne hall, he sees through the supposed "witchcraft" and identifies it as bubonic plague. He saves the princess within three days and is named an "Onmyoji," entering the imperial court. Hulv Jin bears a grudge and asks Yang Liuyan, the Gu Master of the Southern Frontier, to set up a soul-devouring Gu formation. At the arena, Qin Yuntao uses wet cotton to cover his nose and sulfur to drive off the Gu, breaking the trap, but is poisoned by Gu. Fortunately, Yang Liuyan saves him late that night, leaving behind a silver hairpin and a love that remains unfulfilled.
His proposals to reform agriculture and water conservancy provoke slander, and he is dispatched to Jizhou, territory controlled by Xianbei nobles. Using his engineering knowledge, Qin Yuntao builds waterwheels and repairs canals, turning drought-stricken fields into granaries. On the battlefield in Shuozhou, he improves the crossbow and fights alongside the female general Luo Chunxiu. When the princess refuses a political marriage, takes a death-faking drug, loses her memory, and wanders into the northern desert, he ventures alone into Turkic lands to find his beloved.
After witnessing the Gao clan destroy itself and Hulv Guang die unjustly, Qin Yuntao loses heart. Gao Wei plans to exterminate the Qin household, but Yang Liuyan leads the Qinghe Stockade's disciples to save them with a Ten Thousand Gu Formation. He takes the survivors south and creates a hidden paradise at Qinghe Stockade. When Northern Zhou conquers Northern Qi, the jade pendant glows green once more, and he returns to the modern era.