According to a hadith
The pen has been lifted from three people, (meaning pen does not write or record good/bad deeds for these three people)
Who are they?
Accountability is waived for the child who has not yet reached puberty, until he reaches that stage, because of the report narrated by Abu Dawood (4403) and at-Tirmidhi (1423) from
‘Ali (may Allah be pleased with him), that the Prophet (blessings and peace of Allah be upon him) said:
“The Pen has been lifted from three: from the sleeper until he awakens, from the child until he reaches puberty and from the insane person until he comes to his senses.”
Classed as saheeh by al-Albaani in Irwa al-Ghaleel, 2/4, no. 297