Lots of good advice here. It's hard to hear others when our own voices are louder, especially when it's the voice in our head.
For me, I had to realize that all that defensiveness was really my own sense of shame, and moreover, my own sense of worth (which was non-existent). I was angry at my wife. I blamed her. I was angry at her because I was still a pentulant child inside, one who saw her as a "mother" of sorts, and emotionally, I felt abandoned, because she was no longer loving towards me, no longer made me feel special. I wanted her to love me again. So I did everything I could to try and "nice her" into loving me again. Of course she saw through that, and stood her ground, and that would only make me feel more empty and lost, and in my fear, and anger, and overwhelming desperation for attention, I would rage against her, like a child throwing a tantrum. That was the heart of the defensiveness. On the outside, I could admit that I had done terrible things to her, that I was the one who betrayed her and deserved her ire. But inside, the only voice I could hear was my own, and it was pitiful.
You need to stop and listen to what your wife is saying. You need to not open your mouth and just take in her words and where they are coming from- even if they hurt you. Let them hurt. Let her express herself and her hurt that you caused.
This advice from @changeforthebetter is spot on. Sometimes it is not about what words our spouses are saying, it is the "why" of what they are saying. Once we have discovered our own "why's" of why we had the affair, I think the next step is understanding the "whys" of our spouses. When your spouse says something that makes you feel hurt or angry, why do you think they said that? If you find that you say mean/defensive things to your spouse when you feel scared and hurt and unsure inside, then what does that mean? Could it be that she says things because of how she feels inside? Think of all this pain and hurt and emptiness you feel inside, and how desperate it can feel, how endless, and note how it makes us lash out when all we really want to do is cry. We just want to be heard, and to be loved, and understood.
Our spouses need to know that we understand what we did to them. I mean really understand, on a deeper level. It isn't about what you did, or who you did it with, or any of the associated details. It is about how those things made them feel inside. Nothing about sharing our passwords, or writing timelines, or throwing away things from the affair makes the hurt and emptiness inside of them go away. In fact, just last night, my wife was telling me that every time I couldn't see or hear her, that it was 100 times more painful than the affair itself. It was worse.
The next time you feel defensive, I suggest this. Just be quiet and listen. Then go take some time to reflect on not only what was said, but why. For example, if she says, "You forgot to do <some task>...", is she really saying, "You forgot about me. Again. I don't matter to you." And if she says more directly, "I don't matter to you. You don't love me.", does telling her that you do love her really what she needs to hear? Maybe she needs to hear what she already knows. That there was simply no way you could have loved her and done that to her. She just needs to hear that you understand what she feels and knows inside. I know it might feel ass-backwards right now, but I think honesty and vulnerability are much more loving than any words we say.
I think you will find that, the more you listen to and "feel" her emotions, and the more honest you are with yourself within, the defensiveness will take care of itself. This is why I preach about self-love so much. Once we don't require others to make us feel better, we can instead be there for them, and see and hear their pain over our own.