A yeshiva uses the same title for a very different office. The mashgiach ruchani, the spiritual overseer, is a senior figure in Lithuanian-style yeshivos whose responsibility is the character and inner life of the students rather than their command of Talmudic text. Where the rosh yeshiva teaches the material, the mashgiach ruchani gives the mussar talk, the ethical address that is a fixture of yeshiva life, meets students individually about personal and religious struggles, and is generally the person a student in difficulty goes to rather than the head of the institution.
The office descends directly from the mussar movement founded by Rabbi Yisrael Salanter in nineteenth century Lithuania, which held that intellectual mastery of Jewish law was not enough without deliberate, structured cultivation of character, and pushed for a dedicated figure inside every yeshiva responsible for exactly that cultivation. Salanter's students institutionalized the position as they built the great Lithuanian yeshivos of the following generation, and it survived the destruction of that world and crossed into the yeshivos rebuilt in the United States and Israel after the Second World War.
The kashrut mashgiach and the mashgiach ruchani share only the word overseer and the general Jewish instinct that supervision, whether of a kitchen or of a soul, is a distinct office requiring its own holder rather than something a teacher or an administrator does on the side. Both descend from the same conviction that religious integrity needs a dedicated watcher, applied to two entirely different domains.