Please explain the context of Rousseau's Confessions.
Rousseau had always been an iconoclastic thinker, and many of his works had aroused the ire of other eighteenth century philosophers. They took umbrage in particular at his critique of civilization and progress, both of which he viewed as corrupting to man. Confessions was an autobiographical work, but it was also an attempt to defend himself against his many critics. Finally, it was a response to the powers that be in France that had driven him from the country under charges of blasphemy. Rousseau's response was to write an almost unprecedentedly open and candid portrait of himself, depicting his childhood, including his early proclivity for theft and the pleasure he got at being spanked by the sister of his former teacher. But he also engages in a series of unflinching, if rather self-serving, descriptions of instances when he was persecuted for his unorthodox (and in his mind, superior) beliefs.
So if we imagine Confessions as a riposte to Rousseau's critics, we see that the philosophe was doubling down on his own controversy, telling embarrassing stories about his sexual escapades (including his love of being sexually dominated by women,) offering instances of when his genius was clearly misunderstood, and describing his quarrels with other geniuses, particularly Diderot. In the process, he sought to further his own philosophical and literary agenda, pioneering the autobiography and demonstrating how talented people had to struggle against the strictures that society placed on them. Finally, Rousseau intended the book to be something no public figure (since Augustine, from whom Rousseau got the title of the book) had done. He laid his life in front of the reader, and, he said, God:
I have entered upon a performance which is without example, whose accomplishment will have no imitator. I mean to present my fellow-mortals with a man in all the integrity of nature; and this man shall be myself...I am not made like any one I have been acquainted with, perhaps like no one in existence...whether Nature did wisely in breaking the mould with which she formed me, can only be determined after having read this work. Whenever the last trumpet shall sound, I will present myself before the sovereign judge with this book in my hand, and loudly proclaim, thus have I acted; these were my thoughts; such was I.