Of the salawat of our master Shaykh Ahmad ibn Idris is this formula for removing forgetfulness.
اللَّهُمَّ صَلِّ وَ سَلِّمْ وَ بَارِكْ عَلَى مَوْلَانَا مُحَمَّدٍ النُّورِ المُذْهِبِ لِلنِّسْيَانِ بِنُورِهِ وَعَلَى آلِهِ فِي كُلِّ لَمْحَةٍ وَنَفَسٍ عَدَدَ مَا وَسِعَهُ عِلْمُكَ (١٠٠)
O Allah send prayers, peace, and blessings on our master Muhammad and on his family; the light which removes forgetfulness by his light, in every glance and breath as many times as all that is contained in the knowledge of Allah. (100x)
Our master Shaykh Salih says:
Forgetfulness is sometimes a result of being proccupied with the dunya which has an affect on the light of the heart, and this formula’s special quality is that it removes that darkness and protects the light of the heart from deficiency which leads to forgetfulness. And this salah removes forgetfulness by the intentions of the reciter and the meanings of the words as he ﷺ says, “Actions are only by intentions…”