Are there any Buddhist suttas in the scriptures about retaining memory? As I understand, the early Buddhist teachings were transmitted orally and memorized by monks and they were written down only much later. It must have been tremendous feet of human memory to retain so many of the sutras in the Tipitaka.
I want to ask, are there any teachings, maybe in the vinaya pitaka, which will help a monk increase his or her memory in order to remember the sutras.
In the sutta quote from AN 6.51 below, Ven. Ananda explains how one learns, understands and remembers the teachings.

Ānanda said this:
“Reverend Sāriputta, take a mendicant who memorizes the
teaching—statements, songs, discussions, verses, inspired
exclamations, legends, stories of past lives, amazing stories, and
classifications.
Then, just as they learned and memorized it, they teach others in
detail, make them recite in detail, practice reciting in detail, and
think about and consider the teaching in their heart, examining it
with the mind.
They enter the rains retreat in a monastery with senior mendicants who
are very learned, knowledgeable in the scriptures, who have memorized
the teachings, the texts on monastic training, and the outlines. From
time to time they go up to those mendicants and ask them questions:
‘Why, sir, does it say this? What does that mean?’ Those venerables
clarify what is unclear, reveal what is obscure, and dispel doubt
regarding the many doubtful matters.
This is how a mendicant gets to hear a teaching they haven’t heard
before. It’s how they remember those teachings they have heard. It’s
how they keep rehearsing the teachings they’ve already got to know.
And it’s how they come to understand what they haven’t understood
before.”
“It’s incredible, reverend, it’s amazing! How well said this was by
Venerable Ānanda! And we will remember Venerable Ānanda as someone who
has these six qualities.
For Ānanda memorizes the teaching … statements, songs, discussions,
verses, inspired exclamations, legends, stories of past lives, amazing
stories, and classifications. Those venerables clarify to Ānanda what
is unclear, reveal what is obscure, and dispel doubt regarding the
many doubtful matters.”
AN 6.51