"And he that searcheth the hearts knoweth what is the mind of the Spirit, because he maketh intercession for the saints according to the will of God." (Romans 8: 27)
When we read this passage, readers are often convinced that the Spirit of God is searching our hearts.
We have to understand that Jesus is our Advocate today, and He is making intercession for us:
"34Who is he that condemneth? It is Christ that died, yea rather, that is risen again, who is even at the right hand of God, who also maketh intercession for us." (Romans 8: 34)
"For we have not an high priest which cannot be touched with the feeling of our infirmities; but was in all points tempted like as we are, yet without sin." (Hebrews 4: 15)
So, we can know that Jesus knows our hearts: what is weighing on our hearts, and even the sins which we still think and feel.
Regarding this knowledge about our hearts:
"20For if our heart condemn us, God is greater than our heart, and knoweth all things. 21Beloved, if our heart condemn us not, then have we confidence toward God." (1 John 3: 20-21)
Now, regarding the Spirit of God, yes indeed He is making intercession on our behalf, and in accordance with the will of God.
"12Wherefore, my beloved, as ye have always obeyed, not as in my presence only, but now much more in my absence, work out your own salvation with fear and trembling. 13For it is God which worketh in you both to will and to do of his good pleasure." (Philippians 2: 12-13)
Other passages witness to this powerful truth about the Holy Spirit and the will of God:
"16Rejoice evermore. 17Pray without ceasing. 18In every thing give thanks: for this is the will of God in Christ Jesus concerning you." (1 Thessalonians 5: 16-18)
God works within us and through us because of His Spirit, yet even though Jesus does not physically live in us, we can know that He knows us, and everything about us, and thus he hears every prayer we pray.