Origins and early development The origins of Qimen Dunjia are obscured by legend and hagiography. Traditional accounts attribute the system's creation to the
Yellow Emperor (黃帝,
Huángdì) or to the mythical sage
Jiutian Xuannü (九天玄女, the Mysterious Lady of the Nine Heavens), who is said to have transmitted the method to aid in military campaigns against the rebel
Chi You. These origin narratives, while not historically verifiable, reflect the system's longstanding association with military strategy and statecraft in Chinese cultural memory. More reliably, elements of the cosmological framework underlying Qimen Dunjia can be traced to the
Warring States period (475–221 BCE) and the
Han dynasty (206 BCE – 220 CE), when correlative cosmology — the systematic mapping of correspondences between celestial phenomena, temporal cycles, and terrestrial events — became a central feature of Chinese intellectual culture. The
Huainanzi (c. 139 BCE) and other Han-era texts describe cosmological models involving the
Heavenly Stems and Earthly Branches, directional correlations, and cyclical time calculations that form the conceptual basis for later Qimen Dunjia practice.
Military applications Qimen Dunjia has been closely associated with military strategy throughout its history. The system's structure — which maps spatial, temporal, and cosmological variables onto a grid that can be read to determine advantageous positions, timing, and directions — lent itself to battlefield applications. Traditional Chinese historical and literary sources attribute the use of Qimen Dunjia or related methods to several prominent military figures, including
Zhuge Liang (181–234 CE), the celebrated strategist of the
Three Kingdoms period, who is credited in popular tradition with employing the
baguazhen (八卦陣, "Eight Trigrams formation"), a tactical arrangement said to derive from Qimen Dunjia principles. The strategist and polymath
Liu Bowen (Liu Ji, 1311–1375) is traditionally credited with applying Qimen Dunjia in his military counsel to
Zhu Yuanzhang, the founder of the
Ming dynasty. While such attributions blend historical fact with legend, they illustrate the persistent cultural association between Qimen Dunjia and strategic decision-making at the highest levels of Chinese governance.
Imperial court usage During the
Ming (1368–1644) and
Qing (1644–1912) dynasties, Qimen Dunjia was among the divinatory and cosmological systems maintained by the
Qintianjian (欽天監, Imperial Astronomical Bureau), the state body responsible for astronomical observation, calendar production, and divination on behalf of the emperor. Certain Qimen Dunjia texts were reportedly classified and their use restricted to court officials, reflecting the system's perceived strategic value. The restriction of advanced divinatory texts was part of a broader pattern in which the Chinese imperial court sought to maintain control over cosmological knowledge that could be used to challenge or undermine the ruling dynasty's claim to the
Mandate of Heaven.
Modern period Following the fall of the Qing dynasty in 1912 and subsequent modernisation campaigns — particularly during the
New Culture Movement and later under the
People's Republic of China — Qimen Dunjia, along with other traditional divinatory practices, was officially characterised as
superstition (迷信,
míxìn) and discouraged. However, the practice survived in popular usage and experienced a significant revival from the late 20th century onward, particularly in
Taiwan,
Hong Kong,
Singapore, and
Malaysia, where it has been adapted for contemporary applications including business strategy, financial planning, and personal consultation. == Structure and technique ==