HATMANAH ON SHABBOS [Shabbos: Hatmanah]
Gemara
34a (Rava): After dark, Hatmanah is forbidden [even] in something that does not add heat. This is a decree lest one boil the food [before wrapping it].
Question (Abaye): If so, [we should forbid] even Bein ha'Shemashos!
Answer (Rava): We are not concerned for this, for normally pots are already boiling Bein ha'Shemashos.
(Rava): Hatmanah is forbidden in something that adds heat, even before Shabbos. This is a decree lest one wrap in hot ashes and coals.
Question (Abaye): Before Shabbos this is permitted!
Answer (Rava): We decree lest he stoke the coals after dark.
49a (Mishnah): Hatmanah is permitted in wool shearings. One may not move them.
Question: How may one take the food? [He may not move the wool!]
Answer #1: He lifts the cover [of the pot with the wool on it], and the wool falls [to the side];
Answer #2 (R. Elazar ben Azaryah): He tilts the box [in which Hatmanah was done] and takes from the pot.
Answer #3 (Chachamim): He takes the food and returns it.
51a (Mishnah): If a pot was covered and became exposed, one may cover it.
(Beraisa): On Shabbos, even though one may not do Hatmanah even in something that does not add heat, one may increase the coverings;
Keitzad (how does one do so)? R. Shimon ben Gamliel says, one may remove the sheet it was wrapped in and wrap in a coat, or vice-versa.
Similarly, R. Shimon (ben Gamliel) taught that Hatmanah is forbidden only in the kettle that was on the fire. If one transferred the water to another kettle, one may be Matmin the latter kettle.
(Hatmanah on Shabbos is forbidden lest one heat the food beforehand.) Since he cools the food (through transferring it to another kettle), we are not concerned lest he heat it!
Rishonim
Rambam (Hilchos Shabbos 4:4): If hot food was wrapped before Shabbos and became exposed on Shabbos, one may cover it, for he does not add. One may change the covering on Shabbos. E.g. he may remove a garment and wrap in dove's wings, or vice-versa.
Magid Mishneh: The Rambam connotes that R. Shimon comes to explain that the Heter to add is only through changing to a better covering. One may not add another covering. Others including the Ramban and Rashba permit even this.
Beis Yosef (DH u'Mah she'Chasav Oh): One could explain the Rambam differently. Perhaps it is more reasonable to forbid changing to a better covering, like the Ran and Tur say. If so, the Rambam permits the Heter to change to a better covering, and all the more so to add.
Note: I do not know how the Beis Yosef explains 'for he does not add.' Perhaps this was not in the Beis Yosef's text of the Rambam.
Rambam (5): If one cleared the food or hot water it into another Kli, one may wrap it on Shabbos in something that does not add heat.
Rosh (Shabbos 4:10): The Mishnah permits covering a pot that was covered and became exposed. It seems that similarly, one may expose it and cover it, just like one may take and return. The Mishnah teaches about when it was covered and became exposed to teach that even if it became exposed before Shabbos, one may cover it. It discusses (what became exposed) before Shabbos, just like the Reisha, which discusses something that was not covered before Shabbos. However, if he exposed (this is the text of Bach and Korban Nesan'el) it before Shabbos with intent not to cover it after dark, he may not cover it, for this is like initial Hatmanah [on Shabbos].
Rosh (12): The Ri deletes 'Keitzad' from the text of the Beraisa, for the first Tana permits only adding, but not to expose it and wrap it again. R. Shimon permits even this, whether the new wrapping is better or worse, and all the more so to return it to the initial wrapping, which is not so much like initial Hatmanah. Similarly, R. Shimon taught another leniency, that if one transferred the water to another kettle, he may wrap the latter kettle. According to this, the Halachah follows the first Tana. We can say that the Mishnah permits recovering a pot b'Di'eved, if it became exposed, like the first Tana. R. Yonah defends our text. 'Keitzad' explains how one may increase the coverings. Is this only when it was covered from before Shabbos with a good insulation, such as a coat, or even with a poor insulation, such as a sheet? R. Shimon teaches that it is even in the latter case. The Seifa permits removing the coat and wrapping with a sheet, even though we know this all the more so from the Reisha. The Yerushalmi says that even if it was wrapped only with a cloth, one may add coverings. R. Zeira says that this is only if the initial wrapping helped. Rav says that all coverings help, and R. Chanina supports this. R. Shimon teaches that if one wants to do Hatmanah on Shabbos, he empties it into another kettle, and wraps it.
Poskim
Shulchan Aruch (OC 257:3): Even though we do not wrap on Shabbos even in something that does not add heat, if one wrapped before Shabbos and it became exposed after dark, one may cover it again.
Beis Yosef (DH Af): The Tur says that if one exposed the food before Shabbos without intent to cover it again, he may not cover it. R. Yerucham says like Tosfos and the Rosh, that one may cover on Shabbos a pot that was covered from before Shabbos, unless he exposed it before Shabbos with intent not to cover it after dark. However, Semag, Semak and Sefer ha'Terumah forbid covering after dark whenever it became exposed during the day. The Mishnah says 'it became exposed', i.e. b'Di'eved, to teach that this is only if it became exposed after dark, but if it became exposed before Shabbos, even by itself, one may not cover it after dark. The Yerushalmi says so. It seems that the Rambam agrees. Hagahos Maimoniyos brought both opinions, and did not decide the matter. Most Poskim, including the Rambam, are stringent, and the Yerushalmi supports them, so it is proper to be stringent.
Taz (4): The Beis Yosef explains that the Ri holds that the first Tana permits l'Chatchilah to expose and return the cover, but one may not change coverings, for this is like a new Hatmanah. Also the Rosh initially said so! We must say that the Rosh asked 'according to the Ri, we must say that...' Why did the Shulchan Aruch say 'if it became exposed'? The Poskim derived that l'Chatchilah one may not expose it with intent to recover it with the same wrapping, and according to the Beis Yosef's reasoning, all the more so not to change! Later, he permits changing! We must say that the Reisha discusses b'Di'eved not to forbid l'Chatchilah on Shabbos, rather, to teach that if it became exposed during the day, one may not cover it after dark, like the Beis Yosef brought from Semag. Our text of Tosfos is better. Initially he permits l'Chatchilah to expose on Shabbos, and later he forbids if he exposed it before dark, even if he intended to cover it on Shabbos.
Magen Avraham (12): The Shulchan Aruch forbids if it became exposed during the day. The Bach is lenient.
Gra (DH v'Nisgalah, based on Damesek Eliezer): On 34a, the Rif and Rambam's text is opposite to ours. In something that adds heat, we decree lest one overheat the pot and need to uncover it, and he will cover it [on Shabbos]. The Ra'avad asked that according to the Rambam, Abaye suggested that Bein ha'Shemashos should be more lenient than during the day! The Ran said that the Rambam holds that Abaye suggested to forbid Bein ha'Shemashos even in something that does not add heat.
Mishnah Berurah (25): Even if it became exposed by itself during the day, one may not cover it after dark, and all the more so if he exposed it during the day, even if he intended to cover it at night.
Kaf ha'Chayim (29): The Gra forbids covering on Shabbos even if he exposed it Bein ha'Shemashos.
Shulchan Aruch (ibid.): Similarly, if one wanted to add to it on Shabbos, he may add. Similarly, if one wanted to totally remove it and put another (wrapping) in place of it, whether the latter is more or less warm than the first, even if it was initially covered with only a sheet, he may remove it and cover it with a coat.
Beis Yosef (DH u'Mah she'Chasav Oh): The Tur forbids even to totally remove the wrapping and put another in place of it. Tosfos rejects the text "Keitzad", for R. Shimon argues with the first Tana, who permits only to add, but not to change. Semag and Semak agree. They rule like the first Tana. The Rosh says that R. Yonah defends the text, and this is the Rif's text. The Ran (23b DH Tanu) says that the Beraisa teaches two laws. 1) Not only may one add. Rather, even if one removed what he put from before Shabbos, he may cover it, even though it looks like initial Hatmanah. 2) Even if initially it was covered with a mere sheet, and it is as if it was exposed, he may cover it [with a heavy wrapping]. The Yerushalmi supports this, and so say R. Yerucham, and Sefer ha'Terumah. Also Semak retracted to be lenient. Since the Rambam's opinion is not clear, we follow those who are lenient.
Shulchan Aruch (ibid.): This is if the pot was fully cooked. If it was not fully cooked, one may not even add to the covering, for this causes it to cook.
Gra (DH v'Hu): We learn from stirring (253:2, that if a food is not fully cooked, one may not do anything to hasten cooking).
Magen Avraham (13): Surely, Hatmanah in something that does not add heat does not cause cooking. Rather, we discuss like it says in Sa'if 8.
Bi'ur Halachah (DH Gorem): In Sa'if 8, the pot is on an oven with coals inside. The covering does not touch the pot. Such Hatmanah is permitted. Adding covers would hasten cooking. The Beis Meir and Nehar Shalom say that the Shulchan Aruch discusses all cases. A hot pot continues cooking even if wrapped in something that does not add heat. More covering causes cooking. Rashi says that removing coats will prevent it from burning, even though coats do not add heat! The Gra agrees. In Sa'if 2, he proved that Hatmanah on Shabbos is forbidden even in something that does not add heat, even if it was fully cooked, from the Beraisa. It must discuss a fully cooked food, like it says in Sa'if 4. (He did not say that Sa'if 4 is different, for it discusses something that does not add heat!) Therefore, I omitted the Magen Avraham's opinion.
Kaf ha'Chayim (32): Many hold like the Magen Avraham. Nehar Shalom says that the Shulchan Aruch connotes unlike him.
Shulchan Aruch (5): If one cleared the food on Shabbos from the pot it was cooked in to another pot, one may wrap it on Shabbos in something that does not add heat.