A dog barks at a good man walking past the gate.
The dog is not making a judgement about character. It has never met the man. It barks because the man does not live here.
That is 跖狗吠尧 (zhi gou fei yao), the Chinese idiom for loyalty that has nothing to do with right and wrong. Zhi is the famous robber of legend. Yao is the sage king. The robber’s dog barks at the sage.
The line is in the Strategies of the Warring States, in the section on Qi. The man who said it was Diao Bo, a retainer of Qi. He said it while insulting himself.

To understand him you have to start with Tian Dan.
In 284 BC the army of Yan, with four other states marching behind it, broke the state of Qi. In half a year more than seventy walled cities fell. Two held out, Ju and Jimo, and both flew the flag of Qi.
The king of Qi died in the rout. His son Fa Zhang changed his name and worked as a hired hand in the house of a local official in Ju.
At Jimo the commander was killed, and the people inside the walls pushed a man forward to lead them.
His name was Tian Dan. He had been a clerk in the market of Linzi, the capital. A market clerk kept the scales honest, collected the fee, and settled quarrels. He spent his days in crowds.
He did not hold the city with soldiers.
He put his own clan into the ranks. He put his wives and concubines into the ranks. He gave away the wine and the meat. When the walls needed iron, he had the households bring out their pots.
Then he did something few commanders would think of. He let the Yan army believe that the people of Qi were terrified of two things. Having their noses cut off. Having their ancestors dug up.
The Yan commanders took the bait. They mutilated prisoners. They opened the graves outside the wall.
From the top of the wall the people of Jimo watched, and wept, and afterwards their hands were steady.
The last move was the cattle.
More than a thousand oxen. A blade bound to each pair of horns. A silk cloth painted with five colours thrown over each back. Reeds tied to each tail and soaked in oil. In the night the reeds were lit. The oxen ran, and five thousand men ran behind them.
The Yan army broke. Qi Jie, the general who had replaced the famous Yue Yi after a rumour planted by Tian Dan, died in the panic.
Tian Dan chased the retreat and took the seventy cities back, one after another.
Then he did the thing that surprised people. He did not take the throne. He brought Fa Zhang down from Ju, installed him in Linzi, and made him king.
Qi existed again.
Tian Dan was made Lord of Anping.
And that is when Diao Bo began telling everyone that Tian Dan was a small man.
Diao Bo was a retainer with a quick tongue and a reputation for it. In the court, in the market, wherever two people were talking, he said the same thing. Lord of Anping is a petty man.
Word of this reached Tian Dan.
Tian Dan did not get angry. He set out wine and invited Diao Bo to drink.
At the table he asked a question that was almost rude in its softness.
In what way have I, Dan, offended you, sir, that you are so often good enough to praise me at court?
Praise. He used the word for praise.
There was no way to fight an opening like that. Diao Bo put down his cup and answered.
The dog of Zhi, he said, barks at Yao. Not because it thinks Zhi is noble and Yao is base. A dog barks at anyone who is not its master.
Then he gave an example.
Suppose there is a worthy man called Gongsun and a worthless man called Xu. Suppose the two of them fall out and start to fight. What does the dog of Xu do? It goes for the back of the worthy man’s leg.
Why. Because that leg does not belong to its master.
Then he added the part that made the whole speech dangerous.
Give that dog a chance to leave the worthless man and serve a worthy one, he said, and it will not stop at the leg.
He had called himself a dog, in front of the man he had been slandering.
He had also finished the sentence. I insulted you because my master was not you. Now my master is you.
Tian Dan understood.
He stood up and said: I have heard the instruction.
The next morning he recommended Diao Bo to the king.
That could have been the end of it.
There were nine men at that court.
The record calls them the nine favourites of the king and does not give their names. They hated Tian Dan for the ordinary reason. He had soldiers, he had the affection of the people, and he had brought the state back from nothing. Next to that, they were furniture.
They worked out a plan.
They went to the king and said that when Yan attacked Qi, Chu had sent a general with ten thousand men to help. The state was now settled. Should someone not go and thank the king of Chu?
The king asked who could go.
All nine said: Diao Bo.
So Diao Bo went to Chu.
The king of Chu received him, poured wine for him, and kept him there for days without sending him home.
In that gap the nine men moved.
They told the king that one man on a mission had held a great king for days. On what strength. On the strength of what stood behind him.
And the Lord of Anping, they said, has no sense of a minister’s place before his ruler. No separation of high and low. He gathers the people in, comforts them, fills the gaps in their lives. He reaches out to the frontier tribes. He makes private arrangements with the strongest men in the other states. A man does that when he intends something.
Let the king look into it.
The king looked into it.
One day he spoke a sentence: bring the chancellor Dan to me.
Dan. His given name. To use the given name of a minister is to push him down a step.
Tian Dan came. He took off his cap. He took off his shoes and stood barefoot. He bared his shoulders and knelt on the floor. That was the posture of a man confessing a crime.
He withdrew and asked to be sentenced to death.
Five days passed. The king did not kill him and did not see him.
On the fifth day a message came out. You have done me no wrong. You keep the courtesy of a subject, I keep the courtesy of a king, and that is all.
It sounded like mercy. It was a wall. You are the subject. I am the king. There is nothing between us.
Then Diao Bo came back from Chu.
The king gave him wine.
When the wine had gone round a few times, the king said it again. Bring the chancellor Tian Dan to me.
Diao Bo left his mat, knelt, and put his forehead on the floor.
Where did Your Majesty learn a sentence like that, he asked. That is the language of a falling state.
Then he asked a question. Upward, how does Your Majesty compare with King Wen of Zhou?
The king said: I do not compare.
Downward, how does Your Majesty compare with Duke Huan of Qi?
The king said: I do not compare.
I knew it, Diao Bo said. King Wen got Lu Shang and called him Grand Duke. Duke Huan got Guan Yiwu and called him Uncle. Now Your Majesty has the Lord of Anping, and calls him Dan.
Then he counted the debt.
Your Majesty could not hold the altars of your father. Yan raised an army and smashed the ruins of Qi, and Your Majesty fled into the hills at Chengyang. The Lord of Anping took frightened Jimo, a wall of three li, an outer wall of five li, seven thousand worn out men, and captured the Yan commander and won back a thousand li of Qi.
At that hour, if he had shut the gate of Chengyang and crowned himself, nobody under heaven could have stopped him.
He measured it against the way things should be done. He measured it against what is right. He decided it could not be done. So he built a plank road through the hills, brought Your Majesty and the queen out of Chengyang, and Your Majesty came home and faced the people as their ruler.
The state is settled now. The people are at peace. And Your Majesty says Dan.
A child would not do this sum, he said. A child would not do it.
If Your Majesty does not kill those nine men and apologise to the Lord of Anping, the state is in danger.
The king killed the nine. He drove their families out of Qi. He added ten thousand households at Yeyi to the lands of the Lord of Anping.
The idiom outlived the argument.
Like most Chinese proverbs, it lost a corner on the way.
Its original sense is cold. A dog barks, and the barking has nothing to do with virtue. It has to do with ownership. Change the master and the barking turns to face the other way.
The man who said it was calling himself a dog, and he was not embarrassed. He thought it was simply true. A dog barks at outsiders. That is what a dog is for.
The later use is smaller. From the Ming and Qing onward the phrase is a curse. The running dog of a villain, yapping at good men. In that version Zhi is the villain, Yao is the good man, and the dog is an accomplice.
The scene in the Strategies is more complicated than the curse.
Read as a Chinese fable, the lesson is not that dogs are wicked. The lesson is that a man can be loyal to the wrong master and still call it loyalty, and only notice when he changes sides.
A man slandered another man in public. The man he slandered invited him to dinner and then promoted him. And when the promoted man came home, he knelt on the floor and put his own neck on the table for the man who had promoted him.
That afternoon in Linzi the wine was still warm. The king had just finished speaking.
Outside, the households of nine men were being emptied.