In case someone comes to this thread in the future, here is the solution I came up with: https://github.com/exo-do/nodebb-plugin-reputation-rules/blob/master/ReputationManager.js
A main object and 3 sets as I said, nothing complex (in fact working with sets is pretty easy) but a bit confusing.
When I save or update the main object I have to also call 3 times db.setAdd() or db.setRemove() depending on vote type (upvote, downvote or undo) but thats all.
Thanks again for your help guys