Well TOR was created by DARPA. So to hide their agents they made it public, turning in to a hidden in plain sight situation. But yeah, NSA have spyed on TOR users before, especially by exit nodes.
"
So no, Tor won't make you anonymous, just a bit harder to find.
"An adversary may try to de-anonymize the user by some means. One way this may be achieved is by
exploiting vulnerable software on the user's computer.
[16] The
NSA had a technique that targets a vulnerability – which they codenamed "EgotisticalGiraffe" – in an outdated
Firefox browser version at one time bundled with the Tor package
[17] and, in general, targets Tor users for close monitoring under its
XKeyscore program.
[18] Attacks against Tor are an active area of academic research
[19][20] which is welcomed by the Tor Project itself.
[21] The bulk of the funding for Tor's development has come from the
federal government of the United States,
[22] initially through the
Office of Naval Research and
DARPA.
[23]"
How else do you think they manage to take down pedonetworks etc on Tor if it was 100% secure? It isn't, and never will be.