The Tokugawa established the Kogi-Onmitsu (公儀隠密) secret police in order to spy on other Daimyos.
Kogi-Onmitsu was the direct intelligence organization of the Edo-Shogunate. At most, there were around 3,000 members in this circle. The Kogi-Onmitsu did not participate in night raids and guerrilla warfare. They were a police force in Edo. The existence of the Kogi-Onmitsu decreased the demand for shinobi even more in the society of Edo.
The job of the Kogi-Onmitsu was mainly the preservation of Edo and spying on other Daimyos. During the Sengoku Period, shinobi missions that involved staying in hostile territories for a long period existed. Kogi-Onmitsu were often appointed to live in places far from Edo. In many cases, they got regular jobs at their places of appointment. These Onmitsu were called Kusa. They needed to gain the trust of the local people and gather information. They often disguised themselves as farmers, postmen called Hikyaku (飛脚), shipping agents, or sailors.
The profession of Kusa was long term. Some of them could never go back to Edo and they would have to live in other provinces. Others lived with their families and their sons and grandchildren had to inherit the mission just like in the Sengoku Period.