Mao Muzhi's father was Mao Bao, a distinguished general. His given name underwent many changes in his later years. First, he changed his given name to his style name Xianzu (憲祖) in 361 due to taboo as Emperor Ai of Jin's wife, was named Wang Muzhi. As Huan Wen rose to power and slowly took control of the state, Mao went through another name change due to taboo again, as Huan Wen's mother's given name was 'Xian (憲)'. This time, he used his childhood name, 'Husheng (虎生)'[1]
Mao Muzhi first served in the staff of Yu Yi, who at the time was busy preparing invasions against Cheng Han and Later Zhao. His brother Yu Bing died in 344, and with no one else in the Yu clan to handle home affairs, Yu Yi chose his son Yu Fangzhi (庾方之) to guard Xiangyang. However, Fangzhi was too young, so Yu Yi entrusted Muzhi, to be Fangzhi's marshal.[2] Yu Yi died the following year in 345 from an ulcer, which led to many among his staff led by Gan Zan (干瓚) to mutiny. Mao Muzhi, Yuan Zhen, Jiang Bin (江虨) and Zhu Dao (朱燾) joined forces and put down Gan Zan's rebellion.[3]
After the death of Yu Yi, Mao Muzhi went to serve Huan Wen, who in 345 became Inspector of Jingzhou. Mao Muzhi participated in Huan's second northern expedition in 356 serving as Administrator of Yingchuan. After Huan Wen captured Luoyang, Mao Muzhi was left to guard Luoyang while they wait for Xie Shang's arrival.[4]
In 369, Mao Muzhi, now Mao Husheng, was involved in Huan Wen's third northern expedition to destroy Former Yan. Husheng was serving as Huan Wen's Champion General and was tasked in building a canal at Juye to allow water to flow from the Wen River to the Qing River. After Huan Wen was badly defeated at Fangtou, Husheng was appointed Chief Controller of four commanderies, and as Administrator of Eastern Yan. He was further made Administrator of Huainan to defend Liyang when Yuan Zhen's Rebellion broke out shortly after the defeat at Fangtou.[5]
After Huan Wen deposed Emperor Fei in 371, Mao Husheng was made Chief Controller in Jingzhou north of the Mian River and in Yizheng in Yangzhou.[6] His brother, Mao Anzhi (毛安之) also played an important role in Huan Wen's government, tasked in defending the palace with his guards.