Checking flour for insects:
A. Flour insects:
Worms and other insects that are found in flour are forbidden to be eaten. This applies even if the flour was kept in a vessel. This applies irrelevant of the size of the insect [so long as they can be seen by the naked eye].
B. Checking/Sifting flour for bugs:
Checking flour: All foods that are not commonly infested do not need to be checked for insects, and hence flour that is not commonly infested does not require checking. All foods that are commonly infested when attached to the ground must be checked for insects prior to their consumption. If they are not commonly infested when attached to the ground, but are commonly infested after their detachment, some Poskim rule it is not necessary to check them for insects prior to consumption [if they are not definitely infested]. Accordingly, flour and dried fruits are not required to be checked prior to eating [unless they are assumed to be definitely infested]. Other Poskim however rule that all commonly infested foods must be checked, even if commonly infested only when detached. Accordingly, flour that is commonly infested must be checked for insects prior to use. Other Poskim rule that only flour that has been kept on the ground must be checked, while all flour that is kept in a vessel, and hence only had a chance to become infested while in the vessel, does not need to be checked at all for insects even if it commonly infested. Other Poskim however argue that all commonly infested flour must be checked, even if found in a vessel. [Today, the flour is often stored in rooms prior to packaging, and hence would not have the leniency of flour kept in vessels.] Practically, in those areas and times that flour is commonly infested, it is to be checked for insects prior to use, and so is the custom. [See Q&A for definition of commonly infested!] The entire flour is to be checked, and one is not to suffice with a sample checking. Some write that in general, today, industrial flour is viewed as commonly infested being that it passes through machinery that is very difficult to clean, and is hence infested with insects. Therefore, some Hashgacha agencies [particularly in Eretz Yisrael] instruct that all flour is to be checked for insects prior to use. Other Hashgacha agencies however [particularly in the USA and other areas of Diaspora] instruct that flour does not need to be checked at all unless signs of infestation are visible, as despite the above concern, infestation is not common. Practically, this matter depends on each place and time in accordance to their level of infestation, as there exist areas that have more infestation than others, and there exist times when there is more infestation than others. One is to check with his local Rav and Kashrus agency regarding the flour in his area. A Baal Nefesh is to be meticulous regarding this matter in order so he does not stumble on a Biblical prohibition.
Bedieved if one did not check commonly infested flour: Flour that was not checked/sifted for insects and was already used in a food, or to make bread, remains Kosher even in areas and times that flour is commonly infested. [If however the flour is most certainly infested, then if it was left on the floor [such as in a storage room] since it was ground, it is only permitted in a case of great loss. If however it was always left in a vessel [such as a storage container or flour bag/sack], it is permitted Bedieved.] In all cases that one used commonly infested flour without sifting it, if applicable, he is to check the food for insects prior to eating it. [If checking the food is not possible, [such as if the flour was made into dough and the like] then he should check any remaining flour from that bag and if no worms are found it is permitted. If however even a single worm is found, some prohibit the dough/food. If there is no more flour from that bag left to check, the food is permitted.]
In those areas and times that flour is not commonly infested, it does not need to be checked prior to use. Accordingly, many Hashgacha agencies in the USA and Diaspora instruct that flour does not need to be checked prior to use. However, in those areas and times that flour is commonly infested, it is to be checked for insects prior to use. Accordingly, Hashgacha agencies in Eretz Yisrael instruct that all flour is to be checked for insects prior to use. One is to check with his local Rav and Kashrus agency regarding the flour in his area.
Bedieved: If flour that is commonly infested was not checked prior to using it to make dough or a dish, the food remains permitted. If however the flour was definitely infested, or one finds an insect in the dish/bread, or remaining flour, a Rav is to be contacted.
 Michaber 84/5; Rosh 20/3 [brought in Bes Yosef 84]; Hagahos Shaareiy Dura 52/1 in name of Reb Chaim
The reason: Although insects of spontaneous generation are permitted to be eaten, nevertheless, the insects found in flour are forbidden as perhaps the worm/insect left the flour and went onto the ground and then returned to the flour, in which case even spontaneous generation insects are forbidden. [Michaber ibid; Rosh ibid] Furthermore, even if the flour was in a vessel and there is no chance that it went onto the ground, it is forbidden, as perhaps it separated onto the wall of the vessel and then returned, as explained next. [Shach 84/15; Taz 84/7; Hagahos Sheid 52/1] Vetzaruch Iyun Gadol on the Michaber ibid who here suspects that perhaps the worms separated while in 84/4 he does not suspect that the worm separated from a fruit even if it has a hole inside. [Taz 84/8]
Other opinions: Some Poskim rule that worms found in flour are permitted. [Aguda Chulin 72 in name of Rokeiach, brought in Taz 84/8 and Beis Yosef 84, based on Menachos 85b] The reason for this is because being we do not suspect the worms went to the ground and then came back into the vessel. [Taz ibid]
 Shach 84/15; Taz 84/7; Beir Heiytiv 84/11; Beis Yosef 84; Hagahos Sheid 52/1; Kneses Hagedola 84/84; Peri Toar 84/12; Beis Lechem Yehuda 84/7; P”M 84 M”Z 7 and S.D. 15; Kreisi Upleisi 84/9 and 4; Ben Ish Chaiy Naso 12; Poskim in Kaf Hachaim 84/39
The reason: As perhaps the worms have separated from the flour to the walls of the vessel and then returned, in which case even worms of spontaneous generation are forbidden, as only by liquids do we rule that the worm must separate onto the ground to become forbidden. [Shach ibid; Taz ibid; Hagahos Sheid ibid; P”M ibid] Furthermore, some Poskim rule that that every kernel of flour is viewed as its own entity and if the insect crawls from one to another it is considered separated. [Chochmas Adam 38/11; Ben Ish Chaiy ibid; Kaf Hachaim 84/40] By liquids however there is a special teaching from a verse that permits a worm that separated to the walls of a vessel. This teaching is not applicable to foods. [P”M ibid]
Other opinions: Some Poskim rule that worms which are found in flour that has been kept in a vessel are permitted to be eaten being that a) we do not suspect the worms went out of the vessel to the ground and then came back into the vessel and b) Even if the worms separated from the flour and went to the walls of the vessel and then returned to the flour it remains permitted, as only when a spontaneous generation crawls on the ground does it become forbidden, as rules Michaber 84/1 regarding water. [Rebbe Yitzchak brought in Hagahos Sheid ibid, brought in Beis Yosef 84 and Taz ibid; Peri Chadash 84/17, brought in Beir Heiytiv ibid and Pischeiy Teshuvah 84/3 and many other Achronim; Machazik Bracha 84/4] The Poskim ibid negate this opinion, as the above leniency applies only to liquids. However, some Poskim use this opinion to create a Safek Sfeka to permit the flour in certain cases to be explained. Furthermore, they rule based on this opinion that a) One is not to protest those who are lenient. B) When asked one should answer that majority of Poskim are stringent, and if the asker wants to be lenient he is not to be protested. C) There is no need to publicize any prohibition on this matter d) There is no need to check such flour for infestation. The reason for this is because there are various doubts involved as a) Perhaps the insect did not separate at all from the vessel. B) Even if it did perhaps we rule like the Peri Chadash; c) Even if we don’t, once the flour is baked into bread it is only Rabbinically forbidden. [Noda Beyehuda 26, brought in Pischeiy Teshuvah ibid; See Hakashrus 7 footnote 26]
 Taz 84/8; Shach 84/14; Kneses Hagedola 84/87; Peri Chadash 84/16; Lechem Hapanim 84/5; Beis Lechem Yehuda 84/6; Peri Chadash 84/16; Aruch Hashulchan 84/48; Poskim in Kaf Hachaim 84/36
Other opinions: Some Poskim rule that small insects found in flour are permitted, as we do not suspect that the insect separated from the flour. [Bach 84] The Poskim ibid negates this ruling.
 See Michaber 84/8; The entire allowance of eating Pas Paltar in chapter 113 even though the flour is not checked is based on this Heter.
 Michaber 84/8 regarding fruits that become infested while attached to the tree; Rambam 15; Rav Papa in Chullin 67
 Taz 84/12 in implication of Michaber ibid; Kneses Hagedola 84/4; Lechem Hapanim 84/13; Shulchan Gavoa 84; Zivcheiy Tzedek 84/30; P”M 84 M”Z 11; Kaf Hachaim 84/63
 Shach 84/29; P”M 84 S.D. 29; Beir Heiytiv 84/17; Kaf Hachaim 84/63
 The reason: As it only grows the worms when detached and it thus contains a Safek Sfeka as to its stance as: a) Perhaps it does not contain any “insects; b) Even if it does contain insects, perhaps they did not separate. Now, a Safek Sfeka is permitted even by a Biblical prohibition. [Taz ibid]
 Taz ibid
 Beir Heiytiv 84/17; See Shach 84/29; P”M 84 S.D. 29
 The reason: As since they are commonly infested there is no longer a Safek Sfeka involved. [Beir Heiytiv ibid; Shach 84/29 in name of Issur Viheter; P”M ibid]
 The reason: As if they contain bugs, perhaps the bugs have separated and returned in which case they are forbidden to be eaten. [Michaber 84/5]
 Noda Beyehuda 26, brought in Yad Efraim and Yad Avraham 84
 Mishkanos Yaakov 27, brought in Pischeiy Teshuvah ibid
 Hakashrus 7 footnote 26
 Hakashrus 7/7
 Rama 84/8; See Hakashrus 7/9 footnote 28
 Hakashrus 7/5
 Hakashrus 7/5; Eida Hachareidis instructs consumers to check their packaged flour prior to use. They claim to receive complaints from many people that have found worms in their flour and hence consider it a common occurrence. Personally, in all my years of checking Israeli flour, I have not found insects inside, and hence the entire concern of Israeli Hashgachas to require checking to home bought packages of flour seems to contradict the rules above that if infestation is uncommon, checking is not required. Just because the Hashgacha hears a few cases in which insects were found does not make it common. See this article of the Rabbanut who require checking in times of seen infestation: http://www.kikar.co.il/174936.html. In the kashrus guidelines of the Rabbanut in Eretz Yisrael for bakeries they only require sample checking of flour.
 So I received from the Star K and OK as their official checking policy. The OK also stated that they sift the flour in the factory prior to packaging; Rav Pinchas Padwa Shlita told me that in Chutz Laaretz no one checks their flour for insects, but in Eretz Yisrael they are Machmir.
 Beir Heiytiv 84/17
 Beir Heiytiv ibid
 Michaber 84/9; Taz 84/12, in implication of Michaber ibid, learns that even initially flour does not need checking; Beir Heiytiv 84/17 that although initially must check, Bedieved is permitted.
 The reason: As this is a case of Safek Sfeka: a) Perhaps the insects did not separate from the flour. b) Even if they did, perhaps they disintegrated in the food and are nullified in 60x. Now, a Safek Sfeka is permitted even by a Biblical prohibition. [Shach 84/29 in name of Rashba; Beir Heiytiv ibid; See Taz ibid] This allowance applies even if the flour is very commonly infested, as nevertheless, this case still contains a Safek Sfeika. [See Shach ibid; P”M 84 S.D. 29]
 See Shach ibid in name of Issur Viheter; P”M 84 S.D. 29
 Noda Beyehuda 26, brought in Pischeiy Teshuvah ibid and Yad Efraim and Yad Avraham 84; Zivcheiy Tzedek 84/36; Kaf Hachaim 84/47
 Noda Beyehuda 26, brought in Pischeiy Teshuvah ibid and Yad Efraim and Yad Avraham 84; See Hakashrus 7 footnote 26
 Michaber 84/9; Hakashrus 13/23
 Hakashrus 7/11 in name of Rav Wozner; Vetzaruch Iyun from Michaber 84/9 and other Poskim ibid who rule it is permitted Bedieved.
 Hakashrus 7/11