I'm curious about how medieval Islam dealt with its religious history - e.g. in comparison to how the historical books of the Bible, Josephus, Eusebius etc. dealt with parts of the history of Judaism and Christianity. I'm thinking from the time of Muhammad up to around the time of Ibn Khaldun as the period in question. General overviews and specific examples both appreciated, sources/further reading on Islamic religious historiography even more so!
Islamic history was, like Jewish and Christian history, originally preserved orally. As these oral histories were passed on, early Muslims attached special importance to whom they heard these stories from. As such, each of these early religious traditions, known technically as hadith consists of both a text (matn) and a chain of who told the story to whom (isnad). It is safe to assume that a number of these hadith preserve authentic memories of what Muhammad or his Companions did or said in the early 600s, but these stories and their authenticating chains of transmission weren't written down in the forms that survive today until the 800s.
At that time, several experts of Islamic religious experts decided to collect and collate the hadith that they knew or considered most important and the earliest collections—each of which is unique based upon its editor's knowledge and interests—became the canon of hadith that have been most commonly cited ever since. (Here is one consolidated resource in English.) This situation gives modern scholars at least two very productive avenues for approaching our sources of early Islamic history. Either they can look at the role of the collectors in the 800s, and this allows them to study what problems people were trying to answer with historical precedents in the 800s. Or they can look at the chains of transmission, and this tells them what stories people were interested in hearing and remembering in various places between the 600s and 800s.
As you can imagine, either effort is a daunting task, and neither of them produces a "total" picture that we might want of early Islamic history. It would be something akin to trying to reconstruct early American history from cases that the Supreme Court cited in the late 1900s, an interesting and fruitful approach, albeit inherently incomplete. Nevertheless, some Islamic scholars have tackled these very questions. I'll briefly summarize the findings of Fred Donner, whose Narratives of Islamic Origins (1998) provides some of the best answers for your questions. Donner categorized a number of themes, and I'll highlight a few.
Prophetic Themes. As Muslims mingled with newly conquered Christian and Jewish populations, they remembered hadith emphasizing Muhammad's unique role as prophet as a way to set themselves apart from Christians and Jews. These hadith were collected and cultivated especially in the area of the Fertile Crescent, where there were strong Jewish traditions and Christians in close contact with the Byzantine Empire. They seem to have been less important and less likely to have been remembered in Arabia itself.
Quranic Themes. These hadith elaborate on Quranic passages, which are often difficult to interpret on their own. Many of these hadith explain that Muhammad received a particular passage to answer a particular need of the early community, or that he explained it in a particular way. These hadith were best preserved in Iraq and Yemen, suggesting that these were early centers of Quranic scholarship, whereas there is surprisingly little evidence for their transmission in Egypt and Syria.
Community Themes. Some of these dealt with defining the Islamic community, known as the umma, and these hadith were probably fairly commonly preserved, since they could be used to answer many questions. More particular hadith dealing with how the umma was meant to be managed and administrated seem to have focused around the circle of people associated with the early Umayyad dynasty, who were especially entrenched in Syria.
Themes of Hegemony, Leadership, and Authority. Many hadith speak directly or indirectly to who should rule and how, and Donner discerned a fairly complex image of how these traditions were cultivated over time. Some of them can be used to justify Muslim rule over Christians and Jews, and would have likely been popularly remembered by Muslims in the Fertile Crescent. Others deal with issues of Arab or non-Arab rule, and these would have been remembered across the Middle East. And a number also deal with some secondary administrative details, which were probably most important in the administrative centers such as Syria, Iraq, and Egypt. Donner doesn't try to pin these hadith down too closely, since there was a very complicated history of civil wars that would have made these hadith variously important in different places at different times. He does, however, give a much more thorough categorization of them than I am repeating here.
With these themes in mind, it's actually possible to suggest how early Muslims thought about and eventually came to record their history as hadith. Between about 630 and 670, the Muslim community focused especially on defining themselves according to piety, and there seems to have been relatively little interest in developing historical traditions. Muslims first began to curate their own historical traditions as a way to set themselves apart from the people they conquered and intermingled with. In some places, this may have begun as early as 655, and this period lasted until around 730. As Muslim rule had become more firmly entrenched, histories dealing with administration and law held special importance as the caliphate developed between about 700 and 770. Finally, around 770, the hadith began to be written down, and this allows us to see more particular concerns develop, as jurists collected hadith to answer fine questions about taxation, apostasy, or other local problems. This was the process that produced the diverse collections that survive today and give us an early snapshot of the concerns that drove early Islamic historians to do their work!
How does askhistorians feel about doing peoples assignments for them?