Does intent matter when it comes to Karma?
So does the fact that I am armed with this knowledge negate the act of charity?
No, it does not negate the act of charity. In fact, doing a good action with the intent of reaping good karma is one of the reasons for knowing what is Dharma and Adharma and following the scriptures which talk about them.
People want to know how to achieve happiness, and the scriptures provide the means. The scriptures say things like, "One who desires heaven should offer charity." So, the person armed with this knowledge will offer charity so that he can reap the positive karmic fruits. Likewise, the scriptures say things like, "One who murders another goes to hell." And so a person armed with this knowledge who wants to avoid hell will choose not to commit murder.
So because the scripture is telling you to do good actions because you want a particular fruit, it follows that the intent does not negate the fruit acquired.
But then where does intent matter regarding actions?
It matters when you commit sins: actions prohibited by scripture.
When you do a sin intentionally, the punishment is much more severe than if the sin was done unintentionally. Likewise, the penance for a sin committed intentionally is much more taxing than the penance for a sin committed unintentionally.
(All) sages prescribe a penance for a sin unintentionally committed; some declare, on the evidence of the revealed texts, (that
it may be performed) even for an intentional (offence).
A sin unintentionally committed is expiated by the recitation of Vedic texts, but that which (men) in their folly commit intentionally,
by various (special) penances.
Now, knowledge of whether an action is sinful or not is different from whether you committed the sin intentionally or not.
For example, suppose a person knows meat-eating is sinful. He then ate a dish that had some meat in it, but he didn't know that it had meat in it. This person acquired the sin of unintentional consumption of meat.
On the other hand, suppose a person does not know that meat-eating is sinful. He then decides to eat cow flesh. This person acquired the sin of intentional consumption of meat.
However, if you know an action is sinful, and you do it, the karmic punishment is much more severe than doing the action without knowing it is sinful.
However, if you refuse to read scriptures thinking that the punishment of sins will be less severe because you are ignorant of what is sinful or not, then the punishment for doing all those sinful actions will be much, much more severe than even doing actions intentionally and having knowledge that those actions are sinful.