A while ago I was working with Yoni on Telepath, a project to make your laptop do passive machine learning on your emotional state. It would know how you were feeling, record it for your Quantified Self purposes, and even correlate your moods with your at-computer activities. It might even be able to measure and correlate fluctuations in your cognitive performance.
How? It would look at your keystrokes, your mouse movements, your open applications, the light level, what music you were listening to, and more. It would listen. It would even look at you: with the webcam, it can get your heart rate and heart-rate variability, check your posture, look at your expression, notice when you're looking at the screen and when you're away, and more. There's a ton of signal here. If we can be clever about processing it, we don't need to ever ask you what's going on. It would go way beyond RescueTime or manual experiential sampling.
The project is on hold, because it's hard to do machine learning good enough on all those sources of data, and we got busy hacking on other things. But a few people were asking me about the personal logging part of it, since Stephen Wolfram has demonstrated that keylogging is cool, so last week I open-sourced the keylogger. You can now get the Telepath Logger on GitHub if you are running Mac OSX, or you can download a prebuilt version here.
It currently records keypresses, mouse movements, window and document switches, light levels, accelerometry (if you have a sudden motion sensor), and, optionally, webcam photos. My version also really beeps at me when I type bad-writing adverbs and plays the drums whenever the accelerometer notices sharp motion, which I find hilarious, but which is not enabled by default. All the log files are stored locally and it doesn't do any networking, but it's not encrypted, so if someone had access to your computer, they could also try to inefficiently dig through your typing history for the interesting parts.
That said, if you just want an open-source Quantified Self keylogger, then Selfspy has many more features and effort into it. If you want, I dunno, a keylogger that can also play inappropriate drums whenever anyone bumps the table your MacBook Pro is on, then check out mine.