How do I keep an item upon death?

You're really close, all you're missing is a :.

give InstantNuggets compass 1 0 {"keep_on_death":{}}

The component in the give command is a json object and as such it requires a : between the key ("keep_on_death") and the value ({}).