Mishkat al-Masabih 96
وَعَنْ عَبْدِ اللَّهِ بْنِ عَمْرِو بْنِ الْعَاصِ قَالَ: خَرَجَ عَلَيْنَا رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ وَفِي يَده كِتَابَانِ فَقَالَ: «أَتَدْرُونَ مَا هَذَانِ الكتابان فَقُلْنَا لَا يَا رَسُولَ اللَّهِ إِلَّا أَنْ تُخْبِرَنَا فَقَالَ لِلَّذِي فِي يَدِهِ الْيُمْنَى هَذَا كِتَابٌ مِنْ رَبِّ الْعَالَمِينَ فِيهِ أَسْمَاءُ أَهْلِ الْجَنَّةِ وَأَسْمَاء آبَائِهِم وقبائلهم ثمَّ أجمل على آخِرهم فَلَا يُزَادُ فِيهِمْ وَلَا يُنْقَصُ مِنْهُمْ أَبَدًا ثُمَّ قَالَ لِلَّذِي فِي شِمَالِهِ هَذَا كِتَابٌ مِنْ رَبِّ الْعَالَمِينَ فِيهِ أَسْمَاءُ أَهْلِ النَّارِ وَأَسْمَاء آبَائِهِم وقبائلهم ثمَّ أجمل على آخِرهم فَلَا يُزَادُ فِيهِمْ وَلَا يُنْقَصُ مِنْهُمْ أَبَدًا فَقَالَ أَصْحَابُهُ فَفِيمَ الْعَمَلُ يَا رَسُولَ اللَّهِ إِنْ كَانَ أَمْرٌ قَدْ فُرِغَ مِنْهُ فَقَالَ سَدِّدُوا وَقَارِبُوا فَإِنَّ صَاحِبَ الْجَنَّةِ يُخْتَمُ لَهُ بِعَمَلِ أَهْلِ الْجَنَّةِ وَإِنْ عَمِلَ أَيَّ عَمَلٍ وَإِنَّ صَاحِبَ النَّارِ يُخْتَمُ لَهُ بِعَمَلِ أَهْلِ النَّارِ وَإِنْ عَمِلَ أَيَّ عَمَلٍ ثُمَّ قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ بِيَدَيْهِ فَنَبَذَهُمَا ثُمَّ قَالَ فَرَغَ رَبُّكُمْ مِنَ الْعِبَادِ فريق فِي الْجنَّة وفريق فِي السعير» . رَوَاهُ التِّرْمِذِيُّ وَقَالَ: هَذَا حَدِيثٌ حَسَنٌ غَرِيبٌ صَحِيح
From ʿAbdullah ibn ʿAmr ibn al-ʿAs, who said: The Messenger of Allah ﷺ came out to us with two books in his hand, and said: "Do you know what these two books are?" We said: "No, O Messenger of Allah, unless you tell us." He said of the one in his right hand: "This is a book from the Lord of the worlds containing the names of the people of Paradise and the names of their fathers and their tribes; then the total has been given at the end of them, so no one will ever be added to them or removed from them." Then he said of the one in his left: "This is a book from the Lord of the worlds containing the names of the people of the Fire and the names of their fathers and their tribes; then the total has been given at the end of them, so no one will ever be added to them or removed from them." His Companions said: "Then what is the point of deeds, O Messenger of Allah, if it is a matter that has been settled?" He said: "Keep to what is right and come close [to it], for the one destined for Paradise will have his end sealed with the deeds of the people of Paradise, whatever deeds he did, and the one destined for the Fire will have his end sealed with the deeds of the people of the Fire, whatever deeds he did." Then the Messenger of Allah ﷺ gestured with his hands and cast them [the books] aside, then said: "Your Lord has finished with the slaves: a group in Paradise and a group in the Blaze." Reported by at-Tirmidhi, who said: This is a hasan gharib sahih hadith.