What does Hamlet mean by lines 376 & 377 if he is aware that Rozencrantz and Guildenstern are spys?
Surely the act of admitting he is playing at being mad is detrimental, if the two are working against him.
"I am but mad north-north-west. When the wind is southerly I know a hawk from a handsaw."
Hamlet actually admits to Rosencrantz and Guildenstern that he is not as mad as they think he is. This line occurs in Act 2, scene 2, after Hamlet has determined that his two friends "were sent for" and the conversation turns to the players. Hamlet welcomes the players, and seems to boast that he has deceived his "uncle-father and aunt-mother."
Hamlet's words are intentionally obtuse. The fact that neither Rosencrantz nor Guildenstern reacts to this admission shows either their lack of surprise or their disbelief. Either they think Hamlet was only pretending to be mad all along or they really do not believe he is sane. I think it is the latter, and Hamlet feels safe in that the two underestimate him. Rosencrantz and Guildenstern seem to be intent on getting to the bottom of Hamlet's melancholy and are oblivious to the fact that Hamlet is toying with them. Hamlet continues to toy with them after the play-within-a-play when they try to "pluck out the heart of [his] mystery." Hamlet knows that the two are incapable of figuring him out and do not recognize the truth when they hear it. Hamlet toys with Polonius in much the same way, insulting Polonius to his face, and calling him a "fishmonger" or Jephthah, an Old Testament character who sacrificed his daughter. He tells the truth, much like a king's fool, but is not taken seriously.
Hamlet is saying that Rosencrantz and Guildenstern are fools and he dares them to prove him wrong. He challenges them by placing the truth before their very eyes and watches as they damn themselves by not seeing it. Exposing himself to them is a calculated risk in that if the two really are as foolish as Hamlet beleives, they will ignore his admission, and Hamlet will have "won" his challenge. We see throughout the play that Hamlet is often impulsive and rash, it is in keeping with his character that he would tempt fate a bit, especially if it allows him to mock his enemies for their folly.