Dobby appears in Harry’s bedroom and tells Harry that his life will be in danger if he returns to Hogwarts for his second year.
Between his excitement about meeting Harry, his sense of urgency in his mission to warn him, his astonishment at Harry’s kindness, and his guilt and fear of returning to Malfoy Manor, Dobby works himself into a noisy emotional frenzy before he is able to explain anything to Harry. After his racket causes Uncle Vernon to interrupt and tell Harry to be quiet (while Dobby hides in the closet), Dobby accidentally reveals that he has been intercepting Harry’s mail all summer. Doby, in fact, has Harry’s mail with him now and promises to give it to Harry if the boy will agree to not go back to Hogwarts. When Harry refuses to agree to this bargain, Dobby ruins Aunt Petunia’s pudding and then disappears (CS2).
Harry discovers Dobby in his bedroom slightly after 7:30 in the evening (CS1).
Of his misguided attempt to protect Harry by blocking his mail, Dobby says he "did it for the best - " (CS2). In retrospect, this seems to anticipate DH's broad critique of "for the greater good" justifications. -BB
It's unclear just what Dobby was so afraid of. What was this plot anyway? Here's what he tells Harry:
"Harry Potter must stay where he is safe. He is too great, too good, to lose. If Harry Potter goes back to Hogwarts, he will be in mortal danger."
"Why?" said Harry in surprise.
"There is a plot, Harry Potter. A plot to make most terrible things happen at Hogwarts School of Witchcraft and Wizardry this year," whispered Dobby, suddenly trembling all over. "Dobby has known it for months, sir. Harry Potter must not put himself in peril. He is too important, sir!"
The plot is to make terrible things happen at Hogwarts. What things? Clearly it involves the diary, but Lucius certainly doesn't know that it's a Horcrux containing part of his evil master's soul or he wouldn't be handing it off casually to any Weasley he could find. The implication is that Lucius planted the diary simply to get Arthur Weasley into trouble, since Arthur had written that annoying new law which resulted in the Ministry raiding various prominent family homes looking for Dark Magic items. The fact that Dobby has known about the plot "for months" indicates that it doesn't actually have anything to do with Voldemort's recent return, since that happened only a few weeks before. So the worst that Dobby would know is that there's a plot to embarrass the Weasleys.
Thinking through this in reverse, we could say that since Dobby actually appears to know more than he logically should about the danger of the diary, that he must have been able to sense something more about that evil object and that it had the potential to cause great harm. Perhaps this is another example of the power of house-elf magic.