In the Daye era of the Sui dynasty, near the end of the sixth century, a man walked into the county office of Wuyang and asked to see the magistrate.
He was not from Wuyang. His case did not belong to Wuyang either.
Nine years earlier, he had brought a cow into the household of his wife’s family. In those days the two families lived together, and the cow was kept along with everything else. Over eight or nine years the cow calved, and one animal became more than ten.
Then the household was to be divided, and the wife’s family refused to give the cow back.
He had sued in his own county for years. Several magistrates in succession had failed to settle it. Out of options, he crossed into the next county and put the matter in front of the magistrate there, a man named Zhang Yunji.

One cow, and a case that could not be decided
The difficulty needs to be spelled out, because it explains everything that follows.
According to the Old Book of Tang, the man came from Yuanwu county, which bordered on Wuyang. The phrase used for what he had done is that he brought a cow to rely on his wife’s family, and the cow in question was a breeding cow. It stayed in that yard for eight or nine years, and in that time it produced more than ten calves.
An ox is a living thing. It grows, it calves, its coat changes colour, and after a few years it does not even look the same. Nine years on, the original cow standing in the middle of a herd of its own offspring would not be easy to identify.
That creates a very practical problem. To prove that this animal is mine, what can I show.
There was no written contract. In that period, when a family handed an animal over to relatives, nobody drew up documents. There was no witness, no seal, no counterpart copy. What existed was one sentence, that he had brought the cow when he came, and a few neighbours who might or might not remember.
The other side had something to say as well. The cow had been kept in their yard for eight or nine years. They had supplied the fodder and the labour. Why should it leave now. And since the animal had produced so many calves, which of them was even the one he brought.
One side had no evidence. The other had possession. The magistrates who failed were not stupid. Cases of this kind are simply undecidable, unless somebody finds a way to answer the question of whose cow it is without needing evidence at all.
A case he had no business taking
By the rules of the time, this case was not Zhang Yunji’s to hear.
His first words to the man were a question. You have your own magistrate, he said. Why have you come here. That was not a dodge. It was accurate. The dispute had happened in Yuanwu, and the man was a subject of Yuanwu, and Wuyang had no standing in it.
The record gives the man’s reaction in four characters, which come to something like this. He wept and could not stop. Then he told the whole story from the beginning.
Zhang Yunji heard him out and took the case.
One detail is worth noticing. Once he had taken it, he did not send anyone to Yuanwu for the old files. He did not sit down and take a long statement. He did not tell the man to go and find some old neighbour who would swear for him. What he did instead was strange. He had the owner of the cow tied up.
A coat over a man’s head
What happened next made the case famous.
Zhang Yunji had the man bound and his head covered with a garment. Then he had him taken to the village where the wife’s family lived.
When he arrived, he gave an order. Every ox in the village was to be rounded up and brought together.
Then he made an announcement. He was hunting an ox thief.
That is the whole design. He turned the man he was helping into a man he had caught, and he turned a dispute over ownership into an investigation into where the cattle had come from. And then, in front of the assembled villagers, he went from animal to animal and asked the same question. Where did this ox come from.
What happened next is ordinary human behaviour.
The wife’s family had no idea what was going on. They saw officers holding a man whose head was covered, heard that an ox thief was being hunted, and watched the magistrate work through every animal in the village asking where it came from. Their first thought was not that the cow belonged to their son-in-law and they were keeping it. Their first thought was not to get drawn in. An ox in the yard with no explanation was evidence that a thief lived in the house, and cattle theft was a serious crime.
So they pointed at the animal that had been in dispute for nine years and said that it was their son-in-law’s cow, and that they did not know where it had come from.
Zhang Yunji lifted the garment from the man’s head and said to the family, this is your son-in-law, and you may return the cow to him.
The family knocked their heads on the ground and admitted the offence. When word reached Yuanwu, the officials there were, the record says, deeply ashamed.
Why the manoeuvre works
Taking the design apart, it swaps three things.
The first is the nature of the case. This was a civil dispute about who owned an animal. Zhang Yunji turned it into a criminal investigation into where a herd had come from. The two look similar and carry completely different weight. Losing a civil case means handing over a cow. Being caught up in cattle theft means the whole household is in danger. In that moment the family was not choosing whether to return a cow to a son-in-law. It was choosing whether its own yard contained an animal it could not account for. Faced with those two questions, people protect themselves first, and the way to protect yourself is to give the animal away.
The second is the direction of the proof. The original problem was that the claimant could not prove the cow was his. Zhang Yunji reversed it. Instead of making the claimant prove ownership, he made the family account for the animal. Once a person has to explain where something came from, he has to say something about who it belongs to, and in protecting himself he said exactly what Zhang Yunji wanted him to say.
The third, and the most important, is the venue. He did not ask the question in his court. He went to the village, gathered the animals, and asked in front of the whole community.
In a courtroom, the question of who owns the cow is a matter between two parties, and the family can simply insist that the animal was raised in their yard. In a village, ownership has third parties. The neighbours are standing there. Everyone knows which animal was led into whose gate. Asking the question in that setting put the matter back among the people who had seen it, instead of leaving it as two competing statements.
To call the manoeuvre a trick undersells it. It is closer to an attempt to replace a statement with the testimony of bystanders. Rather than pushing the family to admit holding the cow, he arranged for them to identify it themselves in front of everyone who knew them.
It has a weakness too. It works only if the family’s fear of being implicated outweighs its wish to keep the animal. Against a family stubborn enough to take the fight all the way to the court and deny everything, the performance would fail. So it is a good move, not a general rule.
Two smaller cases, and one sentence
The Old Book of Tang gives Zhang Yunji more than this one case.
There is a small affair involving scallions. On a road he met an old woman who was growing them and had built herself a straw shelter beside the plot so she could guard it day and night. Zhang Yunji told her to go home and stop wearing herself out. If the scallions were stolen, he said, come and report it to me. She did as he suggested and went home. After one night, a great many of them were gone. She came and told him. Zhang Yunji summoned every man and woman within ten li of the plot and had them brought before him one at a time to be questioned and examined, and the thief was found quickly.
The same section records a remark that stands as his reputation in Wuyang. A traveller set out before dawn and left a coat lying in the road. He walked more than ten li before he noticed. Someone told him that in the territory of Wuyang nothing left on the road is picked up, and that if he went back, the coat would still be there. He went back and found it exactly where he had dropped it.
An ox case, a scallion case, and one sentence about a coat. Read together, they are what earned this magistrate the line in the official history that his administrative record was exceptionally good.
How to read the Old Book of Tang
One thing has to be said about the source.
The story comes from the Old Book of Tang, in the chapter on good officials. Zhang Yunji is a real figure with a real biography. He came from Beihai in Qingzhou and served as magistrate of Wuyang during the Daye era of the Sui. The chapter opens its account of his time in that office with a single line, that he sought to teach and guide those under him by moral conduct, and that the people remembered him for it. He later became assistant governor of Gaoyang commandery, and when there was no governor above him he ran the whole commandery alone. When the rebel leader Wang Xuba besieged the city and the food ran out, so that officials and common people were eating the leaves of locust trees and chopped straw, not one person defected. Early in the Zhenguan era he rose to vice minister of punishments, was granted the title of baron, and was appointed governor of Youzhou, where he died shortly afterwards.
But a caution belongs here. The Old Book of Tang was compiled decades after the dynasty it describes, in the Later Jin of the Five Dynasties, and accounts of the previous dynasty carry the colour of report and legend. This particular chapter is more inclined that way than most. Writing about good officials, it naturally prefers the decisions that were swift, clever and popular. The covered head in the ox case and the summoning of everyone within ten li in the scallion case are exactly the episodes that style of writing likes best. So the skeleton can be taken as sound. Two neighbouring counties, an animal kept with relatives for eight or nine years, several magistrates unable to decide, and a judgment eventually obtained by some kind of deception. The dialogue and the staging were arranged afterwards, and should not be read as a transcript.
There is also a moral purpose sitting behind stories like this one. A tale about a magistrate who takes a case from another county exists to make a point, which is that a good official does not hide behind the phrase that is not my jurisdiction.
What is genuinely hard here
Strip away the trick, and the hard part of this case is a problem that has not gone away. How do you decide a matter when there is no document, no neutral witness, and nothing but two people telling incompatible stories.
Zhang Yunji’s answer was practical. If no evidence can prove whose cow it is, then create a situation in which the other side testifies against itself. He was not betting that the family would develop a conscience. He was betting that people under pressure protect themselves first, and that whatever they say to protect themselves would amount to a statement that the cow was not theirs.
That is the same road modern courts take when they decide on limited evidence. With no direct proof, the decision comes from what the parties will say and will not say, and from where the gaps in their accounts line up.
For English readers, the best known doorway into Chinese detective work is Judge Dee, the magistrate-detective made famous by the Dutch diplomat Robert van Gulik. Judge Dee sits in his court, questions the living, examines the dead, and reads the file. Zhang Yunji did something different. He did not stay in his court. He rode out to the village and lent the authority of his office to a scene he had staged.
Further off in time stands Song Ci, who in 1247 completed Collected Cases of Injustice Rectified, the earliest surviving systematic work of forensic medicine anywhere in the world. That book solves one end of the problem, which is how to make evidence that can be tested again and again and gives the same answer whoever tests it. Zhang Yunji was handed the opposite end, a case in which no such evidence existed. One of them teaches how to make evidence solid. The other shows what to do when there is none.
The cow went home in the end. When it was first led into that yard, nobody could have guessed that nine years later the question of who owned it would be settled not by a deed, but by a coat over a man’s head.