God is Omniscient. That means God is infinitely knowing and all-seeing. There is not one thing He doesn't know, not one thing He doesn't see and understand perfectly. He possesses all knowledge and all wisdom (Knowledge is knowing things, wisdom is correctly using what you know). We struggle with both, we don't have the knowledge we should neither do we use the knowledge we have correctly, God is perfect at both. God knows everything we think, He knows our true motivations, He knows us completely and perfectly. When Jesus says He knows our works He knows that which truly occupies us, that which we intend to do, why we will do it and the results of our doing it. If all that is true, and it is, our thoughts and our works should be fully directed by God. That's the only real chance they have of making a true difference. Our works show who and what we are. They can show our faith in Christ or they can show our faith in self or the reasoning of men. God knew perfectly the works of the Laodiceans, therefore He knew them. What Jesus says to them next is the result of knowing their works perfectly.