1) HALACHAH: "MATZOS SHEMURAH"
OPINIONS: The Torah teaches, "You shall guard the Matzos" (Shemos 12:17) -- during the production of Matzos, one must watch (or "guard") the wheat to prevent it from becoming Chametz, for the sake of the Mitzvah of Matzah. The Gemara discusses the extent to which Matzah must be watched and prevented from becoming Chametz.
One opinion suggests that it must be watched from before the time that it is kneaded, and the Gemara cites proof for this opinion. Nevertheless, Rava teaches that when people cut the grain in the fields and tie it into bundles (long before the wheat is made into flour and kneaded), they should have in mind that they are doing so for the sake of the Mitzvah of Matzah.
What is the Halachah?
(a) The RIF rules, based on the words of Rava, that the Shemirah must be done from the time that the grain is cut.
(b) The SHE'ILTOS (Parshas Bo) writes that from the moment the wheat comes in contact with water, it must be watched from becoming Chametz. The ROSH confirms this opinion and says that in his area water is always present in the vicinity of the flour mills. Therefore, the practice is to watch the wheat from the time that it is ground into flour.
The RAN adds another reason for why the flour should be watched from the time that it is ground. Rava said that watching it from the time of kneading is not sufficient Shemirah; rather, one must watch it from before the time it is kneaded, which is from the time it is ground. This may be the opinion of RASHI in Chulin (7a) as well, who mentions that the flour must be watched from the time it is ground.
(c) The ROSH (2:26) rules that it suffices to have Shemirah from the time of kneading, because the proof from Rava's statement was not established as conclusive. Even the Rif and others who rule that the flour should be watched from before kneading mean that it is only proper to watch it then, but not that it is obligatory. That is, if one does not watch the wheat from the time that it is cut, the Matzah is still valid for the Mitzvah.
HALACHAH: All three opinions are cited by the SHULCHAN ARUCH (OC 453:4). In practice, l'Chatchilah one should watch the wheat from the time that it is cut, in order to fulfill the Mitzvah of Matzah in the most ideal way, as the Rosh writes. If one is unable to watch it from that time, then b'Di'eved he should watch it from the time of grinding, or at least from whenever it comes near water. In extenuating circumstances, one may fulfill the Mitzvah with Matzah that was watched only from the time of kneading.
2) HALACHAH: MACHINE MATZOS
OPINIONS: The Torah teaches, "You shall guard the Matzos" (Shemos 12:17) -- during the production of Matzos, one must watch (or "guard") the wheat to prevent it from becoming Chametz, and he must have in mind that he is watching it for the sake of the Mitzvah of Matzah ("Lishmah").
Today, it is common for Matzos to be made by machines. The machines knead the dough and bake it. Obviously, a machine cannot have in mind that it is making Matzah for the sake of the Mitzvah. Consequently, machine-made Matzah should not be valid for use at the Seder for the Mitzvah to eat Matzah. What is the Halachah?
The Acharonim compare this case with that of Matzah made by a person who is unable to have intention to make the Matzah for the sake of the Mitzvah, such as a Nochri or a child. The Rishonim argue whether Matzah can be made Lishmah in such a case.
(a) The BEIS YOSEF (OC 460) cites the RASHBA who says that Matzah kneaded by a Nochri may not be used for the Mitzvah, even if a Jew stood over him as he made the Matzah. The Jew's intention that the Matzah be made for the sake of the Mitzvah by the Nochri is ineffective, since the Jew did not make the Matzah himself. This is also the conclusion of the RITVA.
(b) RAV HAI GA'ON and the RE'AH (cited by the Ritva) assert that the Torah does not require specifically that the person who makes the Matzah do so Lishmah. Rather, the Torah requires only that the Matzah be watched and guarded by someone, Lishmah. If a Jew stands over a Nochri or over a child who kneads the dough, and he watches the dough from becoming Chametz with intention that he is doing so for the sake of the Mitzvah of Matzah, the Matzah may be used for the Mitzvah.
HALACHAH: The MISHNAH BERURAH (OC 460:3) cites both opinions with regard to a Jew who watches over a Nochri or a child who makes Matzah. He cites the MAGEN AVRAHAM who rules that when there is no other option, one may rely on the lenient opinion and use such Matzah for the Mitzvah. Although the Magen Avraham writes that the Jew must constantly remind the Nochri that the Matzah that he makes is for the sake of the Mitzvah, the Mishnah Berurah (Sha'ar ha'Tziyun #5) points out that according to Rav Hai Ga'on and the Re'ah, this does not seem to be necessary, because the Kavanah of the Jew, as he stands over the Nochri and guards the Matzah, suffices.
According to this ruling, Matzah made by a machine while a Jew stands by with intention to guard the dough from becoming Chametz for the sake of the Mitzvah of Matzah would be acceptable for the Mitzvah, if no other Matzah is available. In fact, Matzah made by a machine which a Jew activated may be acceptable even l'Chatchilah, because the machine (which does not have a mind of its own) might be considered an extension of the hands of the Jew. However, there are many other issues involved with Matzah made by machines (see MIKRA'EI KODESH, Pesach II:3:b; MO'ADIM U'ZEMANIM, Hilchos Pesach), and therefore in practice one should consult a competent rabbinical authority or follow his family's custom.