Dou Wei (Tang dynasty)

Dou Wei (died 618), courtesy name Wenwei, formally Duke Jing of Yan'an, was a Sui dynasty official who, after the founding of the Tang dynasty in 618, briefly served as a chancellor until his death later that month.

Background
Dou Wei was from Fufeng Commandery (扶風, roughly modern Baoji, Shaanxi). His father Dou Chi (竇熾) served as a high-level official for both Northern Zhou and Sui and was a hereditary noble. Dou Wei was considered quiet and studious in his youth, much unlike his brothers and cousins who, as nobles, were far more interested in military matters. The Sui official Li Delin knew of his talent and recommended him as a junior official at the Palace Library, but while it was regular for junior officials there to be promoted regularly, Dou was not promoted, and remained at his post for more than a decade, during which he studied the archives and became even more knowledgeable than before.

During the Sui dynasty
Dou later served as a scribe for Yang Xiu the Prince of Shu, a son of Sui's founding emperor Emperor Wen, but when he saw that Yang Xiu was engaging in improper behavior, he resigned, and subsequently when Emperor Wen discovered Yang Xiu's improper deeds in 602 and subsequently deposed him, many of Yang Xiu's subordinates were punished, but Dou escaped punishment. In 608, during the reign of Emperor Wen's son Emperor Yang, he became a senior official at the legislative bureau (內史省, Neishi Sheng), but as he often pointed out problems with Emperor Yang's governance, he offended Emperor Yang and was demoted to be the director of civil service matters (考功郎中, Kaogong Langzhong), and subsequently was removed from governmental office altogether.

In 617, the general Li Yuan the Duke of Tang rebelled and captured the capital Chang'an, declaring Emperor Yang's grandson Yang You the Prince of Dai emperor (as Emperor Gong). Li Yuan's deceased wife Duchess Dou was a niece of Dou Wei's, and Li Yuan, who retained power as regent, retained Dou on staff. At that time, the government was in a state of flux, and with Dou being knowledgeable with ceremonies and governmental organization, Li Yuan entrusted to him the task of reorganizing the government as well as preparing the ceremonies to have Yang You yield the throne to Li Yuan. Li Yuan compared him to the Han dynasty official Shusun Tong (叔孫通), who organized the ceremonies for Emperor Gao of Han.

During the Tang dynasty
In spring 618, Emperor Yang was killed during a coup at Jiangdu (江都, in modern Yangzhou, Jiangsu) led by the general Yuwen Huaji, and when the news reached Chang'an, Li Yuan had Yang You yield the throne to him, establishing Tang dynasty as its Emperor Gaozu. He made Dou Wei the head of the legislative bureau (內史令, Neishi Ling), considered one of the posts for a chancellor. Dou became ill later that month and died. Emperor Gaozu posthumously created him the Duke of Yan'an.