While some docodonts like Agilodocodon were going up into the trees, another branch of the group was specializing into semi-aquatic habits instead.
Castorocauda is known from the Middle Jurassic of China (165-161 mya), represented by an exceptionally preserved fossil showing soft tissue and hair impressions. About 40cm long (1′4″), it would have lived in a wetland environment and was well-adapted for swimming, with a flattened scaly beaver-like tail, webbed toes, and a coat of dense fur very similar to that of modern mammals, made up of both guard hairs and underfur.
Its strong forelimbs suggest it was capable of digging burrows, like modern platypus, and its sharp backwards-pointing teeth indicate a diet of slippery prey such as fish and worms.
It was also one of the earliest known mammals with (possibly venomous) spurs on its ankles. This feature is only seen today in monotremes, but seems to have been an ancestral trait common to all early mammals that was later lost in the lineage leading to marsupials and placentals.