From: Rabbi Moshe Sofer
To: Unknown recipient
The Chasam Sofer defends the established practice of divorcing an insane wife by writing a get and entrusting it to a shaliach holachah to deliver upon her recovery. He rules that formal appointment of an agent is ineffective while the wife is insane (per the Talmudic principle in Nazir 12a), but validates the procedure through the mechanism of zachin l'adam — acting for another's benefit in their absence — combined with valid lishmah, since she is already his wife. In practice, if the husband is present when she recovers he should give the get himself or appoint a new agent; the original agent may act on zachin only if the husband is distant.
Source: Shu"t Chasam Sofer EH I §11