The Eastern (dongchang 東廠) and Western Depots (xichang 西廠) and the Brocade Guards (jinyiwei 錦衣衛) were security and surveillance units created during the Ming period 明 (1368-1644). They were supervised by high court eunuchs and wielded considerable power. Historians say they were the "eyes and ears of the emperor" because they had particularly been designed for the purpose of spying out state officials and eliminating potential rivals.
The Brocade Guards (jinyiwei 錦衣衛, full title of the institution: jinyiwei qinjun du zhihuishi si 錦衣衛親軍都指揮使司) were created in 1382, as a further standardization of the personal body guard (gongweisi 拱衛司) of Zhu Yuanzhang 朱元璋 (the eventual founder of the Ming, Emperor Taizu 明太祖, r. 1368-1398), when he was still King of Wu 吳. In 1369 the institution was called *Commandery of the Imperial Guard (qinjun duwei fu 親軍都尉府). It consisted of five companies subordinated to the imperial regalia service (yiluansi 儀鑾司). The guards retained the duties of personal guard and ceremonial display but additionally were given the task of surveying the officialdom. They were headed by a commander (zhihuishi 指揮使), generals (jiangjun 將軍), *guardsmen (lishi 力士) and commandants (xiaowei 校尉) and had in the beginning a size of c. 1,500 men. A drastical increase of the strength was enforced until the Jiajing reign-period 嘉靖 (1522-1566), when the guards reached a total size of 50,000 to 60,000 troops. These were then divided into 17 battalions (qianhusuo 千戶所), whose troops were commanded by *company commanders (zongqi 總旗), platoon commanders (xiaoqi 小旗) and lower officers. Mounted troops were known under the name *"red-brown cavalry" (tiqi 緹騎). The office of the Guards was headed by a "civilian" associate administrator (tongzhi 同知) and assistants (qianshi 僉事).
The Guards administered two institutions with administrative and jurisdictional rights, namely the Southern Administrative Court (nan zhenfusi 南鎮撫司) and the Northern Administrative Court (bei zhenfusi 南北鎮撫司). The former was responsible for archiving the records and files (about judicial matters, faji 法紀, and about military matters, junji 軍紀), and the latter for correspondence with the emperor about jurisdictional cases (zhaoyu 詔獄, also called jinyiwei yu 錦衣衛獄), including the right to maintain an own jail and execute punishments. In the late years of the Hongwu reign-period 洪武 (1368-1398) the guards were forbidden to carry out penal matters autonomously, but the custom was reintroduced during the Yongle reign-period 永樂 (1402-1424). In 1478 Emperor Xianzong 明憲宗 (r. 1464-1487) bestowed the commander of the Northern Court a seal which allowed him to report directly to the emperor and to obtain his orders firsthand.
The three depots in the inner parts of the Forbidden City were entrusted with similar duties giving the eunuchs greatest power. There was the Eastern Depot (dongchang 東廠), the Western Depot (xichang 西廠) and the Palace Depot (neihangchang 內行廠). In 1420 the intelligence organization of the Eastern Depot was created that was supervised by two directors of ceremonial "wielding the pen" (silijian bingbi taijian 司禮監秉筆太監, also called duzhu 督主 *chief supervisor). They were assisted by a *commander of the penal battalions (zhangxing qianhu 掌刑千戶) and a *commander of the execution companies (lixing baihu 理刑百戶各), who oversaw *servicemen (liyi 隸役) and *detention personnel (jishi 緝事). The rights of the Eastern Depot surpassed that of the Brocade Guards, and its commander was allowed to directly memorialize to the emperor and to execute imperial verdicts autonomously, even to arrest and try officials, and to punish them. The Western Depot organization was created in 1477. It was supervised by the chief eunuch Wang Zhi 汪直 (d. 1487). Its authority exceeded that of the Eastern Depot, yet its abolishment was discussed by and then, and it was therefore temporarily closed. In the early sixteenth century the Palace Depot was created, as an administrative instance above the two other depots. Its creation was the result of an internal quarrel between the highest court eunuchs. The Palace Depot was headed by Liu Jin 劉瑾 (1451-1510), and it was the most cruel of all the secret eunuch institutions. After Liu's death in 1510 it was abolished.
There was in fact no difference in the jurisdictional rights of the Depots and the Guard, but the latter was not part of the regular bureaucracy, and had therefore formally to memorialize if wanting to contact the emperor. It was furthermore possible that relatives of the guard members participated in its activities, while the Depots were supervised by chief eunuchs, trusted advisors to the emperor. The latter's authority was greater than that of the Guard, and it also spied out the Guards' activities. Each part of this internal espionage system kept an eye on the other. From the mid-Ming period on the rivalry between the Guards and the Depots increased, but they also cooperated successfully in their reign of terror. All associated institutions were therefore called with the joint term changwei 廠衛 "Depots and Guards".
Historiographers report that the chief supervisor of the Eastern Depot had available up to 16,000 collaborators all over the country. The senior informants were called "controllers of the files" (dangtou 檔頭), the lesser ones, carrying out the questioning of alleged delinquents, "underlings" (fanzi 番子). On order from above these informants also took over punitive or intimidating tasks to terrorize state officials, often extorting money from the targeted persons. In the worst case, persons were arrested and tortured to death. A common means of 'punishment' was public flogging or beating (tingzhang 廷杖), a punishment that normally required the emperor's consent or order. For each five blows, the executioner was changed, so that the force of the blows was constantly severe. In the beginnings, the executioners contented themselves with the number of blows announced in the verdict, but later on, all "delinquents" were beaten to death. During the Zhengde and Jiajing reign-periods 280 officials were punished with the bamboo cane, and 28 beaten to death. Six high officials who belonged to the Donglin Faction (Donglin dang 東林黨) died in the secret jails of the Guards. Under the domination of Liu Qin, a special cangue was introduced with a weight of 300 pounds (jin 斤), squeezing the delinquents to death within a few days. The notorious tyrant Wei Zhongxian 魏忠賢 (1568–1627) introduced some extremely cruel corporal punishments, namely cutting in two at the waist (duanji 斷脊), cutting off fingers (duozhi 墮指), cutting out the heart (cixin 刺心), or "the lute" punishment (pipa xing 琵琶刑, tan pipa 彈琵琶) by which the ribs of a victim were treated with a knife as if they were the strings of a lute.
Although such cruelties were ended after the downfall of Wei Zhongxian, the institutions continued until the end of the Ming.