So aham asmi, that I am, appears already in the Isha Upanishad, one of the older principal Upanishads, where it functions as a philosophical identity statement rather than as a breathing instruction. The breath practice built on it, ajapa japa, unspoken repetition, is a later elaboration, worked out in the Tantric Vijnana Bhairava and carried forward into the hatha yoga manuals of the medieval and early modern period, which describe the breath as naturally forming the sound so on the inhale and ham on the exhale without any deliberate effort by the practitioner, so that the repetition is said to be happening continuously whether or not a person notices it, and the practice consists only of noticing rather than of producing anything new. Its transmission today runs almost entirely through pranayama and kundalini yoga instruction, usually as a companion practice to formal seated meditation rather than as a mantra recited aloud.
A persistent point of dispute among teachers is the reversal into hamsa, the word for a goose or swan and a common symbol for the individual soul in Indian literature. Read backward, so ham becomes ham sa, and some lineages teach that the breath's true, natural order is ham on the inhale and sah on the exhale, so that so ham as usually taught has the two syllables the wrong way round, while other lineages hold that the ordering is arbitrary and the pairing with hamsa is symbolic wordplay rather than a claim about which syllable belongs to which phase of breath. Neither camp has produced a physiological argument that settles which order, if either, is accurate to actual breathing, and the disagreement is better understood as a difference in interpretive emphasis than as a factual one.