סימן קיט סעיף יב
מִי שֶׁשָּׁכַח לֶאֱכוֹל אֶת הָאֲפִיקוֹמָן, אִם נִזְכַּר קֹדֶם בִּרְכַּת הַמָּזוֹן, אַף עַל פִּי שֶׁכְּבָר נָטַל מַיִם אַחֲרוֹנִים אוֹ שֶׁאָמַר, הַב לָן וּנְבָרֵךְ, אוֹכְלוֹ וְאֵינוֹ צָרִיךְ לְבָרֵךְ בִּרְכַּת הַמּוֹצִיא. וְאַף עַל גַּב דְּאַסַּח דַּעְתֵּיה מֵלֶּאֱכוֹל, לֹא חָשִׁיב הֶסַּח הַדַּעַת, כֵּיוָן שֶׁהוּא מְחֻיָּב לֶאֱכוֹל, וְאַתַּכָּא דְּרַחְמָנָא קְסָמְכֵינָן. וּמִכָּל מָקוֹם יֵשׁ לוֹ לִטֹּוֹל יָדָיו וְלֹא יְבָרֵךְ עַל נְטִילַת יָדָיִם. וְאִם לֹא נִזְכַּר עַד לְאַחַר בִּרְכַּת הַמָּזוֹן קֹדֶם שֶׁבֵּרַךְ בּוֹרֵא פְּרִי הַגָּפֶן עַל כּוֹס שְׁלִישִׁי, יִטּוֹל יָדָיו, וְגַם כֵּן לֹא יְבָרֵךְ עַל נְטִילַת יָדָיִם (פרי מגדים), וִיבָרֵךְ בִּרְכַּת הַמּוֹצִיא, וְיֹאכַל כַּזַּיִת, וְאַחַר כָּךְ יְבָרֵךְ בִּרְכַּת הַמָּזוֹן, וִיבָרֵךְ עַל כּוֹס שְׁלִישִׁי וְיִשְׁתֶּה. אֲבָל אִם לֹא נִזְכַּר עַד לְאַחַר שֶׁבֵּרַךְ בּוֹרֵא פְּרִי הַגָּפֶן עַל כּוֹס שְׁלִישִׁי, יִשְׁתֶה אֶת הַכּוֹס. וְאִם רָגִיל בְּפַעַם אַחֶרֶת לְבָרֵךְ בִּרְכַּת הַמָּזוֹן בְּלֹא כוֹס, יִטֹּל יָדָיו וְיֹאכַל אֲפִיקוֹמָן וִיבָרֵךְ בִּרְכַּת הַמָּזוֹן בְּלֹא כוֹס. אֲבָל אִם הוּא נִזְהָר לְבָרֵךְ תָּמִיד בִּרְכַּת הַמָּזוֹן עַל הַכּוֹס, וְעַתָּה לֹא יוּכַל לְבָרֵךְ עַל הַכּוֹס, מִשּׁוּם דַּהֲוֵי מוֹסִיף עַל הַכּוֹסוֹת, לָכֵן לֹא יֹאכַל אֲפִיקוֹמָן, וְיִסְמוֹךְ עַל הַמַּצָּה שֶׁאָכַל תְּחִלָּה (תע"ז).
If you forgot to eat the afikoman; and reminded yourself before saying Birkas Hamazon, although you already had washed your hands at the end of the meal or said, "Come, let us say the blessings," you may eat the afikoman, and do not have to say Hamotzi. And even though you had not intended to eat anymore, this does not constitute a diversion of the mind, since it is your duty to eat the afikoman, and are sitting at Hashem's table, (and must fulfill His will; thus you were not completely distracted). Nevertheless, you should wash your hands, without saying Al netilas yadayim. But if you did not remind yourself, until after saying Birkas Hamazon, before saying Borei peri hagafen over the third cup, then you should wash your hands again, without saying, Al netilas yadayim, and recite the berachah of Hamotzi, eat a kazayis of the afikoman, say Birkas Hamazon; then say the berachah over the third cup, and drink it. But if you only reminded yourself after saying Borei peri hagafen over the third cup, you should drink the cup. If on other occasions you are accustomed to recite Birkas Hamazon, without a cup of wine, you should wash your hands, eat the afikoman, and say Birkas Hamazon without a cup of wine. However, if you are scrupulous, and always says Birkas Hamazon, over a cup of wine, and now cannot do it, because you would be adding to the four cups, (which is forbidden), then you should not eat the afikoman, but rely on the matzah, which you ate before.
תנא דבי אליהו כל השונה הלכות בכל יום מובטח לו שהוא בן העולם הבא שנאמר הליכות עולם לו אל תקרי הליכות אלא הלכות (נדה ע"ג.)