Although I believe that there is an age of accountability. And that age is variable.
Therefore, I wouldn't put a strict number of years on accountability.....IOW, I've met some 6 yr olds..that had more pure faith and Christian love than many...And they knew what sin was...and the consequences of it.
I've also known 7 yr olds..that were most certainly capable of sin. And did it.
fwiw-
~”And that age is variable.”~
I would tend to agree. Still, in the Church, we make rules for the majority and deal with the exceptions on a case-by-case basis. If a child is behind mentally, then his or her bishop may determine to hold off on baptism until the person is sufficiently developed to know right from wrong.
For the average person, though, 8 is a good age - most children begin to understand the concept of moral consequence about that time. We trust that God will take care of the gray areas - He’s smarter than we are.