Ku-ji simply means “nine syllables”, and refers to a variety of mantras that consist of nine syllables. The syllables used in kuji are numerous, especially within the realm of mikkyo (Japanese esoteric Buddhism). The kuji most often referred to is of Taoist origin, not Buddhist. There is no record of the kuji in any of the Shingon or Tendai records that were brought back from China. The use of kuji is largely a layman’s practice, and not seen in the orthodox Buddhist traditions. It is found extensively in Shugendō, the ascetic mountain tradition of Japan, and ryobu Shinto which is the result of blending Buddhist, and Shinto beliefs.
The kuji are first introduced in the Taoist text Baopuzi (抱朴子) a poem written by Ge Hong c.280-340 ADE. In it he introduces the kuji in chapter 17 titled DengShe/ 登涉 (Climbing [mountains] and crossing rivers) as a prayer to the six Jia (generals of yang), ancient Taoist gods. in Daoist Magic, the Chia Spirit Generals are powerful celestial guardians and part of Tammon-Ten’s (Vaiśravaṇa), The God of the North, Celestial Thunder Court.