Zhang Yi was from Chengdu, the capital of Yi Province. He started his official career after Liu Zhang, the Governor of Yi Province, nominated him as a xiaolian. Between 212 and 214, when conflictbroke out between Liu Zhang and another warlord Liu Bei, Liu Zhang sent Zhang Yi to Deyang County to block Liu Bei's reinforcements from entering Yi Province. However, Liu Bei's general Zhang Fei defeated the force led by Zhang Yi, who was forced to return to Chengdu. In 214, as Liu Bei's forces besieged Liu Zhang in Chengdu, Liu Zhang sent Zhang Yi as his envoy to negotiate the terms of surrender with Liu Bei. Liu Bei promised that he would treat Liu Zhang well if he surrendered, which Liu Zhang did. Liu Bei's adviser, Zhuge Liang, named Zhang Yi as one of the most capable officials who served under Liu Zhang, and urged Liu Bei to employ him. Liu Bei then appointed Zhang Yi as the Administrator of Ba Commandery. In late 222 or early 223, after Liu Bei lost the Battle of Xiaoting against his ally-turned-rival Sun Quan, the localtribes in southern Yizhou Commandery, led by Yong Kai, started a rebellion. Yong Kai and the rebels captured Zhang Yi but did not dare to kill him and instead sent him as a captive to Sun Quan, who did not bother to see Zhang Yi and had him directly thrown into prison.
As a prisoner of Wu
Around 223, when the states of Shu Han and Eastern Wu reestablished their alliance against their rival state Cao Wei, Zhuge Liang, who had become Imperial Chancellor of Shu, sent Deng Zhi as an envoy to Wu to meet its ruler, Sun Quan. One of Deng Zhi's tasks was to seek the release of Zhang Yi and bring him back to Shu. Only then did Sun Quan meet Zhang Yi for the first time. During the farewell banquet he held before sending Deng Zhi off, Sun Quan spoke to Zhang Yi and was very impressed with him. Later, after Zhang Yi left with Deng Zhi, Sun Quan regretted letting Zhang Yi leave because he wanted to recruit Zhang Yi to serve under him. He then sent his men to pursue them and bring Zhang Yi back, but Zhang Yi already sensed that Sun Quan did not want to let him leave, had sped up his journey upon leaving Wu and returned to Shu just one day ahead of Sun Quan's men.
Service in the Chancellor's office
After his return to Shu, Zhang Yi served as an Army Adviser under Zhuge Liang and as an Assistant Officer at General Headquarters in Yi Province. Around 227, when Zhuge Liang launched the first of a series of military campaigns against Shu's rival state Wei, he appointed Zhang Yi as Colonel of Trainee Archers and Chief Clerk in the Imperial Chancellor's office. Zhang Yi did not join Zhuge Liang at the frontline and instead took charge of communications between Zhuge Liang and the Shu central government in Chengdu. As Zhuge Liang wanted to review everything before making a decision, Zhang Yi had to travel north to Hanzhong Commandery, where Zhuge Liang was stationed, to seek his opinion on key policy issues. As Zhang Yi left Chengdu, hundreds of people lined the streets to bid him farewell. In his later career, Zhang Yi was appointed as General Who Assists Han but remained as Chief Clerk in Zhuge Liang's office. He died in 230 at around the age of 63. His two sons, Zhang Mu and Zhang Yu, continued serving as officials in Shu.