At the beginning, there is a boy whose father dies in some sort of accident, in a museum that he works for. I can't remember what happens to the mother but I'm pretty sure that she's dead.
The kid finds some sort of clockwork thing which used to be his father's that can write, but it is a bit broken.
Then the kid's mean uncle or something like that takes him to this market which the mean uncle lives in the roof of and gets paid to wind and take care of all the market's clocks.
Later, the uncle dies, but the kid secretly keeps on living in the roof of the market and taking care of the clocks. He pretends that he is picking up the money for his master. The kid also steals wind up toys to hopefully some day fix his dad's clockwork thingy.
The boy later meets this girl and they go on some sort of adventure. During those adventures at one point, the girl gets mad at the boy for some reason that I don't remember and the girl accidentally slams a door on the boy's hand which breaks it, so he can't fix the clocks any more. So then he just oils them, but eventually they stop working, so some men are going to come check it out so the boy and the girl have to stop them from finding the boy without a guardian and putting him in an orphanage. I don't remember how, but I think that they somehow succeed. At the, end the boy gets his clockwork machine working and it can write.