Jami` at-Tirmidhi 2141
'Abdullah bin 'Amr narrated:
"The Messenger of Allah (s.a.w) came out to us with two books in hand. And he said:
'Do you know what these two books are?' We said: 'No, O Messenger of Allah ! Unless you inform us.' He said about the one that was in his right hand: 'This is a book from the Lord of the worlds, in it are the names of the people of Paradise, and the name of their fathers and their tribes. Then there is a summary at the end of them, there being no addition to them nor deduction from them forever.' Then he said about the one that was in his left: 'This is a book from the Lord of the worlds, in it are the names of the people of Fire, and the name of their fathers and their tribes. Then there is a summary at the end of them, there being no addition to them nor deduction from them forever.' The companions said: 'So why work O Messenger of Allah! Since the matter is already decided (and over)?' He said: 'Seek to do what is right and draw nearer, for indeed the inhabitant of Paradise, shall have his work sealed off with the deeds of the people of Paradise, whichever deeds he did. And indeed the inhabitant of Fire, shall have his work sealed off with the deeds of the people of Fire, whichever deeds he did.' Then the Messenger of Allah motioned with his hands, casting them down and said: 'Your Lord finished with the slaves, a group in Paradise, and a group in the Blazing Fire.'"

Another chain reports a similar narration.
حَدَّثَنَا قُتَيْبَةُ بْنُ سَعِيدٍ، قال: حَدَّثَنَا اللَّيْثُ، عَنْ أَبِي قَبِيلٍ، عَنْ شُفَىِّ بْنِ مَاتِعٍ، عَنْ عَبْدِ اللَّهِ بْنِ عَمْرِو بْنِ الْعَاصِي، قَالَ خَرَجَ عَلَيْنَا رَسُولُ اللَّهِ صلى الله عليه وسلم وَفِي يَدِهِ كِتَابَانِ فَقَالَ ‏"‏ أَتَدْرُونَ مَا هَذَانِ الْكِتَابَانِ ‏"‏ ‏.‏ فَقُلْنَا لاَ يَا رَسُولَ اللَّهِ إِلاَّ أَنْ تُخْبِرَنَا ‏.‏ فَقَالَ لِلَّذِي فِي يَدِهِ الْيُمْنَى ‏"‏ هَذَا كِتَابٌ مِنْ رَبِّ الْعَالَمِينَ فِيهِ أَسْمَاءُ أَهْلِ الْجَنَّةِ وَأَسْمَاءُ آبَائِهِمْ وَقَبَائِلِهِمْ ثُمَّ أُجْمِلَ عَلَى آخِرِهِمْ فَلاَ يُزَادُ فِيهِمْ وَلاَ يُنْقَصُ مِنْهُمْ أَبَدًا ‏"‏ ‏.‏ ثُمَّ قَالَ لِلَّذِي فِي شِمَالِهِ ‏"‏ هَذَا كِتَابٌ مِنْ رَبِّ الْعَالَمِينَ فِيهِ أَسْمَاءُ أَهْلِ النَّارِ وَأَسْمَاءُ آبَائِهِمْ وَقَبَائِلِهِمْ ثُمَّ أُجْمِلَ عَلَى آخِرِهِمْ فَلاَ يُزَادُ فِيهِمْ وَلاَ يُنْقَصُ مِنْهُمْ أَبَدًا ‏"‏ ‏.‏ فَقَالَ أَصْحَابُهُ فَفِيمَ الْعَمَلُ يَا رَسُولَ اللَّهِ إِنْ كَانَ أَمْرٌ قَدْ فُرِغَ مِنْهُ فَقَالَ ‏"‏ سَدِّدُوا وَقَارِبُوا فَإِنَّ صَاحِبَ الْجَنَّةِ يُخْتَمُ لَهُ بِعَمَلِ أَهْلِ الْجَنَّةِ وَإِنْ عَمِلَ أَىَّ عَمَلٍ وَإِنَّ صَاحِبَ النَّارِ يُخْتَمُ لَهُ بِعَمَلِ أَهْلِ النَّارِ وَإِنْ عَمِلَ أَىَّ عَمَلٍ ‏"‏ ‏.‏ ثُمَّ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم بِيَدَيْهِ فَنَبَذَهُمَا ثُمَّ قَالَ ‏"‏ فَرَغَ رَبُّكُمْ مِنَ الْعِبَادِ فَرِيقٌ فِي الْجَنَّةِ وَفَرِيقٌ فِي السَّعِيرِ ‏"‏ ‏.‏ حَدَّثَنَا قُتَيْبَةُ حَدَّثَنَا بَكْرُ بْنُ مُضَرَ عَنْ أَبِي قَبِيلٍ نَحْوَهُ ‏.‏ قَالَ أَبُو عِيسَى وَفِي الْبَابِ عَنِ ابْنِ عُمَرَ ‏.‏ وَهَذَا حَدِيثٌ حَسَنٌ غَرِيبٌ صَحِيحٌ ‏.‏ وَأَبُو قَبِيلٍ اسْمُهُ حُيَىُّ بْنُ هَانِئٍ ‏.‏