When should you say what you know? What should you do when you see a question raised in public, say here on stack-exchange, that you know the answer to, because you are looking into as part of current research project?

For example, I see a TCS.SX question that I know the answer to, because I worked on the problem recently.  I haven't finished writing up the results yet and am trying to get a few more results to make an acceptable paper.  

Should I contact the asker personally?  Claim credit publicly by publishing answer on the site?  What should I do?
I'll share my side of the story that is mentioned in Shiva's answer.

Shiva had several questions related to my own research (space-bounded algorithms for reachability problems). We were currently putting the final touches on a full draft of the proof, and were not ready to announce the result.  However, it was clear that Shiva was very interested in this area, so I emailed him saying we had a result in the works and gave him just the theorem statement.  A week later, we had our draft complete and I sent him a copy.  A few weeks later we shared our updated draft on the ECCC.

This worked well for several reasons.


Shiva and I have never met in person, but now we know each other as colleagues interested in similar problems.
Shiva also sent me a copy of his most recent work, which is also related and interesting.
The questions gave me an extra boost of motivation to complete a full draft quickly.


I recommend this course of action in the future: partial disclosure via private communication, full disclosure, and public announcement.