How does the Lord know the condition of our heart? By our works.
The Lord knows the condition of our hearts because He (for those He purposes to save) is the One (by His will and the work of the Holy Spirit) Who changes it. Our works are the outward result of our having been born again of the Spirit. As Paul says in Ephesians 2, it is by God's grace that we have have been saved through faith, which is not our own doing, but the gift of God, not a result of our works, so that no possibility of our boasting in in ourselves. We are
His workmanship, created in Christ Jesus for good works,
which God prepared beforehand, that we should walk in them.
By what works? Well, by looking at OSAS, that's the big question.
Yes, it is a big question, but easily answered: By the work of Christ at Calvary and the work of the Holy Spirit, both initially (at the time we are born again of the Spirit) and to the day of Christ as, in His power, we are kept from stumbling and finally presented blameless before the presence of His glory with great joy (Jude 24).
One of the great misunderstandings of this doctrine we call perseverance of the saints is that we are responsible in and of ourselves for this perseverance. No, we see very clearly in Philippians 2 that it is God who works in us, so that we will both will and work for His good pleasure (2:13). We persevere to the end because God sustains us, working in and through us, and of course not failing. Great is His faithfulness.
Unconditional and unmerited are not words of Scripture...
The actual use of those two words is not necessary; Scripture clearly teaches that:
God's granting of His great salvation is conditional on absolutely nothing that man may or may not do ~ it is in this sense that it is unconditional. This granting of His great salvation is dependent only on His mercy and compassion, which He either has or has not toward any one person depending on His will alone. This is God's purpose of election, which is executed before anyone has done anything good or bad (i.e. works) or even yet born. It is not because of human works but because of Him Who calls. This is Romans 9.
The definition of grace ~ a word that is most certainly used in Scripture ~ is unmerited favor. God gives the grace of salvation to His Elect, and there is nothing we can do to merit it, as it is based on His will and His will alone. The prophet Ezekiel gives us a great picture of salvation, relaying to us God's own words:
"I will take you from the nations and gather you from all the countries and bring you into your own land. I will sprinkle clean water on you, and you shall be clean from all your uncleannesses, and from all your idols I will cleanse you. And I will give you a new heart, and a new spirit I will put within you. And I will remove the heart of stone from your flesh and give you a heart of flesh. And I will put my Spirit within you, and cause you to walk in my statutes and be careful to obey my rules. You shall dwell in the land that I gave to your fathers, and you shall be my people, and I will be your God."
[Ezekiel 36:24-28]
Grace and peace to all.