He left
袁绍 to join
曹操 in 191, and Cao welcomed him as 'my Zhang Liang'. He ran the court at Xu while Cao was at war and brought in other advisers such as
郭嘉. In 212 he opposed Cao taking the title Duke of Wei and died soon after; one account says Cao sent him an empty food box, and he understood and took poison.