Agilodocodon
Before we get to the actual-Mammalia-mammals, there’s one more group of mammaliaformes who deserve some attention – the docodonts.
Falling evolutionarily just outside of Mammalia itself, docodonts first appeared in the mid-Jurassic and lasted until the Early Cretaceous. They used to only be known from teeth and jaw fragments and were thought to have been fairly generic shrew-like terrestrial insectivores, but more recent discoveries have shown them to have actually been some of the earliest mammals to specialize into diverse habitats.
Agilodocodon was adapted for climbing around in trees, making it one of the earliest known arboreal mammals (although not the first climbing synapsid). Living in China during the Middle Jurassic (165-161 mya), it measured about 13cm long (5″) and had sharp gripping claws and flexible wrists and ankles similar to modern climbing mammals like tree squirrels.
When it was first described in 2015 it was suggested that its spade-like front teeth were specialized for gnawing bark and feeding on tree sap – but a later study found that its teeth didn’t really resemble those of any modern sap-eating mammals, and in fact were closer in shape to those of insectivorous marsupials and elephant shrews.