Cao Pi zhiguai 曹毗志怪 "Ghost stories by Cao Pi" is an early collection of phantastic stories compiled by the Later Han period 後漢 (25-220 CE) scholar Cao Pi 曹毗. There are two other story collections with the same title, one by the Eastern Jin period 東晉 (317-420) writer Zu Taizhi 祖台之, the Zu Taizhi zhiguai 祖台之志怪 and another book called called Kongshi zhiguai 孔氏志怪, also from the Jin period, written by a certain Master Kong 孔. A book with a similar title is Master Zhi's Zhiguaiji 殖氏志怪記 from the Later Han period.
Cao Pi's Zhiguai is listed in Wen Tingshi's 文廷式 supplementary bibliography to the official dynastic history Jinshu 晉書, called Bu Jinshu yiwen zhi 補晉書藝文志, that was compiled during the Qing period 清 (1644-1911). Cao Pi's Zhiguai was lost during the Song period 宋 (960-1279), and there is only one fragments surviving that can be found in Lu Xun's 魯迅 reprint series Gu xiaoshuo gouchen 古小說鉤沉. This fragment deals with a story of Emperor Wu 漢武帝 (r. 141-87 BCE) of the Han dynasty and the magician Dongfang Shuo 東方朔. The same story was also included in a book called Guanfu guyu 關輔古語, as quoted in the geography Sanfu huangtu 三輔黃圖, and in the books Soushenji
搜神記, Youminglu 幽明錄, and Za guiguai zhi 雜鬼怪志 (quoted in the Yuzhu baodian 玉燭寶典). The story is inclined to the Buddhist belief of several world ages (kalpas, Chinese jie 劫) and is therefore also to be found in Buddhist biographical collections as Gaosengzhuan 高僧傳 and the book Zhu Falan zhuan 竺法蘭傳.