Who wrote the Ramayana?

The sage Valmiki once asked: is there anyone truly good and brave in this world? The sage Narada told him the story of Rama.
Later, by a river, Valmiki saw a hunter shoot a bird as it sang with its mate.
His grief burst out as a curse, in a perfect rhythm. It was the first verse of poetry.
Then Brahma appeared, and told him to tell Rama's story in that verse. That poem is the Ramayana, twenty-four thousand verses long.
Source: Valmiki Ramayana. Episodes found only in later retellings are marked as such.