Main

The amniotic egg is very different from the anamniotic egg of extant amphibians, which lacks an eggshell and extraembryonic membranes. The amniotic egg consists of a suite of fetal membranes, including the amnion, chorion and allantois, as well as an external shell that can be either strongly mineralized (as in rigid-shelled eggs) or weakly mineralized (as in parchment-shelled eggs). The extraembryonic membranes enclose specific egg elements, regulate gas and fluid exchange between the egg and the external environment, store nutrients and collect waste1,2,3.

Where and how the fetal membranes of the amniotic egg evolved has been debated, and two competing hypotheses have been proposed (Fig. 1). The conventional, ‘terrestrial model’2 is that the precursor to amniotes laid eggs on land, similar in many respects to the directly developing eggs of a variety of extant amphibians, and the fetal membranes were gradually acquired so that the egg could adapt to terrestrial environments by retaining water inside and allowing oxygen and carbon dioxide to pass through the eggshell. This widely accepted model has been challenged by the ‘extended embryo retention model’3,4,5,6,7, that the extraembryonic membranes appeared in the oviducts of the amniotic ancestor as specializations to control fetal–maternal interaction in association with extended embryo retention (EER). The EER model could occur with the embryo either in a post-neurula stage (oviparity)3 or with live bearing (viviparity)6,7. Among extant amniotes, turtles, crocodilians and birds generally lay eggs at an early developmental stage (non-EER oviparity), whereas most squamates (lizards and snakes) and mammals either display oviparity with EER or viviparity. Evolutionary studies based on extant amniotes give equivocal results about whether oviparity or viviparity arose first8,9,10,11,12,13. Circumstantial evidence for the EER model is the near absence of fossils of amniotic eggs before the Late Triassic period and the discovery of viviparity in many extinct amniotes as old as the Early Permian period14,15,16,17. Supporters of the terrestrial egg model note that EER is absent in archelosaurs, including chelonians, crocodiles and birds, as well as extinct dinosaurs, pterosaurs and their ancestors14,18.

Fig. 1: The two competing theories for the evolution of the amniotic egg.
figure 1

In the terrestrial model (left), non-EER oviparity (purple) was the primitive condition; oviparity with EER and viviparity (blue) evolved multiple times in amniotes. In the EER model (right), the evolutionarily labile reproductive mode of EER across oviparity to viviparity (blue) was primitive, while non-EER oviparity (purple) evolved multiple times in amniotes.

Whether the first amniote displayed EER or not is key to testing between the two models. As EER occurs widely among extant lizards and snakes (squamates) and mammals3, exploring the occurrence of EER among oviparous primitive archosauromorphs is decisive to determine the developmental stage of the first amniotic egg (Fig. 1). In this study, we report an articulated embryo of the choristodere Ikechosaurus sp. inside a parchment-shelled egg. The ossification sequence of the embryo confirms that choristoderes are basal archosauromorphs. The shell structure reveals that the aquatic choristodere was oviparous and presumably came ashore to lay its eggs, like extant sea turtles and crocodilians. The specimen, together with previous evidence of viviparity in other taxa, demonstrates that an evolutionarily labile reproductive strategy across oviparity to viviparity existed in choristoderes, a basal clade of archosauromorphs, and potentially also in other various aquatic vertebrates of the past, such as mesosaurs, ichthyosaurs and sauropterygians. We run phylogenetic analyses on extant and extinct amniotes to test whether EER and viviparity are the ancestral conditions in Amniota.

Results

Viviparity and oviparity in choristoderes

Choristoderes are a clade of extinct diapsids that lived primarily in Laurasia from the Middle Jurassic period to the Early Miocene epoch (approximately 168–120 Myr). The gavial-like neochoristoderes were top predators in freshwater bodies, competing with contemporaneous crocodiles19. The new specimen (MES-NJU 57004) was collected from yellowish white, thinly laminated tuffaceous mudstone of the Lower Cretaceous Jiufotang Formation (Jehol Biota, approximately 125–120 Myr) in the Lamagou locality adjacent to Chaoyang City, western Liaoning, northeast China. Many choristoderes have been discovered in the Jiufotang Formation and the underlying Yixian Formation in western Liaoning, including the lizard-like Monjurosuchus and Philydrosaurus, the long-necked Hyphalosaurus and the neochoristoderan Ikechosaurus. Some specimens of these choristoderes are associated with eggs and embryos19.

The new specimen is a small skeleton (approximately 102.73 mm long; Fig. 2a) that exhibits the typical pose of a vertebrate embryo: curving and with the head contacting the tail17. The skeleton is dorsoventrally flattened and exposed in ventral view covered by a thin layer of ferric oxide. Computed tomography (CT) scans reveal that the skeleton is nearly complete and all bony elements are articulated except for the distal end of the tail, which was slightly displaced (Fig. 3 and Extended Data Figs. 1 and 2). The embryo shows many diagnostic traits of Ikechosaurus: the snout is long, broad and flat in front of the orbits and gradually tapers to about the midpoint along the snout; the interorbital bar is narrow; the jugal extends anteriorly to the midpoint of the lacrimal; the postorbital region is flared; the temporal openings lie largely above one another; and the parietal extends only about half way along the posterior edge of the upper temporal opening20 (see the Supplementary Results for a detailed description of the skeleton). The fact that Ikechosaurus is the only neochoristoderan in the region supports this assignment19.

Fig. 2: Structure of the choristodere egg (MES-NJU 57004).
figure 2

a, An overview of the embryo inside the egg. b,c, Photomicrographs show loosely arranged shell units and pores (black arrows) preserved along the marginal zone of the egg. dg, Energy dispersive spectroscopy mapping of silica (d), calcium (e), manganese (f) and iron (g) showing the inferred eggshell (white triangles), which contains materials from both the phosphate matrix and the enclosing mudstone. Scale bars, 1 cm (a), 100 µm (b,c), 1 mm (dg).

Fig. 3: CT scans of the choristodere skeleton (Ikechosaurus sp.) and its reconstruction.
figure 3

a,b, Ventral (a) and dorsal (b) views of the reconstructed skeleton. cf, Coronal slices showing dorsal (c) and ventral (d) sections of the posterior skull, proximal left forelimb and presacral axial bones (e), and pelvic girdle, proximal axial bones and femur (f). g,h, Transverse slices show the relationship of centra and neural arches in dorsal (g) and caudal (h) vertebrae. cdv, centra of dorsal vertebrae; ce, cervical; cl, clavicle; cv, caudal vertebra; den, dentary; ept, ectopterygoid; fe, femur; fi, fibula; fro, frontal; hdt, hand digit; hu, humerus; il, ilium; isc, ischium; ju, jugal; lac, lacrimal; mc, metacarpal; mt, metatarsal; mx, maxillary; na, nasal; ot, otic area; pa, parietal; pal, palatine; pdt, pes digit; pmx, premaxillary; po, postorbital; pof, postfrontal; prf, prefrontal; pt, pterygoid; pub, pubis; q, quadrate; qj, quadratojugal; r, rib; ra, radius; sa, surangular; sc, scapula; so, supraoccipital; sq, squamosal; st, stapes; t, tooth; ti, tibia; ul, ulna; v, vertebra. Scale bar, 10 mm.

The phylogenetic position of Choristodera in Amniota remains controversial, having been placed as a basal clade of archosauromorphs21, a sister group of archosauromorphs, or basal to archosauromorphs and lepidosauromorphs22. The ossification sequence of the new embryo confirms that choristoderes are basal archosauromorphs (see Supplementary Results for evidence that the choristodere embryo is an archosauromorph). The high degree of ossification of the skeleton indicates that the unhatched embryo was in a late developmental stage. Ontogenetically, the animal was precocial or superprecocial23: its well-developed skull with sharp teeth suggests that it was ready to hunt and the relatively well-ossified pelvic girdle and hindlimbs that it could run and swim soon after hatching.

We identified traces of a parchment-shelled egg around the tiny skeleton, which is embedded in an incomplete, oval phosphate matrix, demarcated by a 0.43–0.50-mm-wide halo. The halo contains materials from both the phosphate matrix and the enclosing mudstone (Fig. 2d–g). The small size, embryonic pose and egg-shaped matrix prove that this is an embryo inside an egg. The outer edge of the halo is slightly meandering and locally folded. Loosely arranged, irregularly shaped, flake-like structures (around 50-μm thick by estimate) are locally present along the marginal area, surrounding pore-like structures (Fig. 2b,c). These features indicate that the halo is preserved eggshell, which is pliable and has a thin calcareous layer composed of flake-like shell units and many pores24.

There are three types of amniotic eggs: membrane-shelled; parchment-shelled; and rigid-shelled25,26. A mineral layer is not developed in membrane-shelled eggs (monotremes, a few squamates), is thinner than an organic layer in parchment-shelled eggs (a few chelonians and most squamates) and is well developed and thicker than the organic layer in rigid-shelled eggs (a few squamates, most chelonians, crocodilians and birds)25. It could be argued that the described choristodere specimen is an incomplete viviparous egg27,28. In extant squamates, the egg of viviparous species lacks the calcified layer but is enveloped with a very thin organic layer (commonly less than 10 μm), whereas oviparous squamates lay eggs with a calcified outer layer and a relatively thick organic layer (usually over 30 μm)29,30, as in this specimen. A similar eggshell structure, with a thick organic layer (over 100 μm) and a very thin mineral layer (less than 10 μm), has also been documented in isolated eggs of the basal choristoderan Hyphalosaurus baitaigouensis31. These shell structures reveal that the aquatic choristoderes were oviparous and presumably came ashore to lay their eggs, like extant sea turtles and crocodilians. Putative females of the neochoristoderan Champsosaurus possessed fused sacral centra and more robust limb bones than males, perhaps adaptations for nesting on land32. Other choristoderes were viviparous, such as one specimen of H. baitaigouensis28 and Monjurosuchus splendens14. The co-occurrence of viviparity and oviparity in one nominal species, H. baitaigouensis, indicates that it had a bimodal reproductive mode, that is, both viviparity and oviparity occurred in a single species as in the basalmost sauropsid Mesosaurus tenuidens and few extant squamates14,33.

Macroevolutionary study

The new specimen exemplifies the complexity of parity modes in some early reptiles and provides information to constrain the evolution of reproductive strategies in archosauromorphs, reptiles and amniotes in general. We return to the question of whether EER is the ancestral condition. To test this hypothesis, we collected data on reproductive modes from representative taxa spanning the phylogenetic diversity of extant amniotes, and from all extinct taxa where information is available (Supplementary Table 1). The balance of data on fossil taxa inevitably favours those that laid rigid-shelled eggs because those are preserved more readily than eggs without mineralized shells. In particular, we could find no examples of extinct synapsids with evidence of reproductive mode. However, we compensated for this by broadly sampling extant taxa for which reproductive data are secure. Most oviparous squamates lay membrane- and parchment-shelled eggs at the limb-bud stage. In contrast, most amniotes that lay rigid-shelled eggs obligately oviposit at an early developmental stage, for instance, at the blastula stage in birds, the gastrula stage in chelonians and tuataras, and the neurula stage in crocodilians33,34,35. In these forms, the thick calcite layer delays the exchange rate of respiratory gases and may prevent the development of the embryo before the eggs are laid36. Therefore, both eggshell and developmental stage of the embryo at oviposition provide information constraining the ancestral state of reproductive modes.

We coded each extant and extinct taxon for three characters: (1) reproduction mode: viviparous, oviparous; (2) eggshell mineralization: membrane-shelled, parchment, rigid; (3) EER: absent, present. EER was defined as amniotes that lay eggs at the limb-bud stage or later33. EER was identified in extinct taxa based on fossil adults that contain embryos at the limb-bud stage or later or are associated with neonates, which were commonly identified as evidence for viviparity previously (Supplementary Table 1). We conservatively treated all fossils for which we could not judge the stage of development of an egg at oviposition as non-EER. Character 2 is dependent on character 1, so viviparous taxa were coded as inapplicable (‘−’) for character 2. To resolve the problem of character dependency, characters 1 and 2 were amalgamated into a single structured Markov model (SMM) equipped with hidden states. We also applied an analogous approach within a parsimony framework using Sankoff (cost) matrices. We conducted an exhaustive multiplicative set of ancestral states analyses, accounting for: (1) different phylogenetic time-scaling methods; (2) alternative tree topologies; (3) exclusion of key fossils; (4) different ancestral state reconstruction methods, evolutionary models and optimization criteria; (5) among lineage rate heterogeneity; and (6) constraining extant node states based on previous studies. Together, these totalled over 100,000 individual analyses. Further details can be found in the Methods.

The ancestral state reconstruction results are unequivocal for both the amalgamated character (reproduction mode + eggshell mineralization) and EER presence (Fig. 4). Viviparity with EER dominates the deeper nodes, being the most likely condition for the roots of Amniota (mean marginal maximum likelihood (ML)-based ancestral state across 100 trees for the best-fitting model and other models whose Akaike information criterion (AIC) difference was less than 2 compared to the best-fitting model for viviparity-ML: 99.5–100%; EER-ML: 99.8–100%), Reptilia (viviparity-ML: 98.5–100%; EER-ML: 100%), Diapsida (sensu lato) (viviparity-ML: 100%; EER-ML: 100%), Archelosauria (viviparity-ML: 98.5–100%; EER-ML: 99.6–100%) and Archosauromorpha (viviparity-ML: 99.4–100%; EER-ML: 99.8–100%), irrespective of which time-scaling approach or best-fitting model (including models whose AIC differed from the best-fitting model by less than 2) was considered (Supplementary Tables 36).

Fig. 4: Phylogeny of amniotes, showing known reproduction mode and eggshell mineralization, and the EER of 80 extant and extinct species (tips, to right), and the inferred mean ancestral states for all branching points (larger pie charts at the nodes).
figure 4

The dominant inferred state towards the root (left) is viviparity with EER. This is a consensus tree based on a sample of 100 trees time-scaled using the fossilized birth-death (FBD) tip-dating method (with node age constraints for major clades) and component ARD model with a switch-on dependency (CARD_sw) for eggshell mineralization and reproduction mode (best-fitting ML model based on the AIC score; Supplementary Table 6). Note that alternative evolutionary models do not recover viviparity as the ancestral state in Lepidosauria (Supplementary Tables 36). Ikechosaurus sp. is shown in red and indicated by a red arrow. Elephant and bird icons reproduced from PhyloPic under a Creative Commons license CC BY 3.0 (elephant, T. Michael Keesey; bird, Chloé Schmidt).

Using a different ancestral state reconstruction also does not change the main conclusions: 10 of 18 maximum parsimony (MP)-based ancestral state reconstructions recover viviparity at the origin of Amniota, with the remaining reconstructions mostly favouring membrane-shelled eggs as the ancestral state of amniotes (all MP-based reconstructions using accelerated transformation (ACCTRAN) favour viviparity at the origin of Amniota; Supplementary Tables 2126). All MP-based ancestral state reconstructions favour EER as the ancestral state of Amniota. Bayesian traits (BT) results are consistent with ML-based ancestral state reconstructions (Supplementary Tables 2831 and Extended Data Fig. 4). Fixing the nodes of both Lepidosauria and Squamata to a non-viviparous state (Supplementary Tables 2831 and Extended Data Fig. 5) still results in viviparity being the most likely condition for the origin of Amniota (mean BT-based ancestral state for viviparity: 87.4–97.7%), only leading to increased variability in the ancestral state estimates (Reptilia viviparity-BT: 79.8–97.2%; Diapsida (sensu lato) viviparity-BT: 72.3–99.7%) and potentially suggesting that viviparity re-evolved in Archosauromorpha (Archelosauria viviparity-BT: 16.6–91.2%; Archosauromorpha viviparity-BT: 48.9–96.1%).

Among archosaurs, the results reflect the possession of rigid-shelled eggs by extant birds and crocodilians, which is consistent with the proposal15 that the first dinosaurian eggs were membrane-shelled, although the results are less clear. Most best-fitting models favour rigid-shelled eggs at the root of Theropoda (rigid-ML: 81.6–98.5%; EER-ML: 0–1.5%); however, non-EER, membrane-shelled eggs are most likely at the root of Saurischia (membrane-shelled-ML: 67.5–97.2%; EER-ML: 0.1–0.4%), Dinosauria (membrane-shelled-ML: 60.5–96.7%; EER-ML: 0.1–1.4%) and probably also Archosauria (membrane-shelled-ML: 52–96.1%; EER-ML: 0.2–13.6%). The non-EER results are consistent across all variant analyses but the reproduction mode and eggshell mineralization results are somewhat equivocal for later-diverging clades. The results from the best-fitting models are compatible with parchment-shelled eggs as the ancestral state for Saurischia (parchment-ML: 1–30.3%), Dinosauria (parchment-ML: 1.1–35.6%) and Archosauria (parchment-ML: 1.3–42.5%). If we also consider simpler ML models with a worse fit (AIC difference greater than 2), where character state transition rates are more constrained compared to the best-fitting models, the evidence for parchment-shelled eggs for these clades increases. Note, however, that parsimony-based analyses favour rigid-shelled eggs as the ancestral state of the three clades. Bayesian analyses are generally consistent with ML-based results but evidence for parchment-shelled eggs in these three clades is generally lower; fixing the node of Lepidosauria and Squamata to a non-viviparous state leads to a higher variability in the ancestral state estimates. These discrepancies emphasize that while the ancestral state results are consistent for deep nodes, the results for later-diverging clades should be treated with more caution. A similar example is found in Lepidosauria for which parsimony and alternative ML and BT evolutionary models do not recover viviparity as ancestral (Supplementary Tables 326 and 2845).

While the best EER model is consistently recovered as all-rates-different (ARD), the best model to explain character state evolution for reproduction mode and eggshell mineralization is more enigmatic and changes depending on the distribution of branch lengths, the time-scaling methods used and topology (Supplementary Tables 27 and 2845). However, the component ARD model with or without a switch-on dependency is always among the best-fitting ML-based models irrespective of which time-scaling approach or topology is considered (Supplementary Tables 320). The component ARD model is generally also found among the best-fitting BT-based models; however, the evidence for alternative model hypotheses is generally lower for analyses with fossilized Lepidosauria and Squamata node states due to smaller-log Bayesian factors (BFs) (Supplementary Tables 2845).

Discussion

It is widely accepted that viviparity evolved from oviparity through EER in squamates and mammals33,34,35, and this may also have been the case in the various aquatic vertebrates of the past, such as choristoderes, as well as mesosaurs, ichthyosaurs and some sauropterygians. This implies that viviparity might have derived from membrane- or parchment-shelled eggs with EER in these clades. Yet, our results strongly suggest viviparity as the ancestral condition of amniotes and the marine reptile clades.

This result is subject to a number of biases: first, the phylogenetic placement of extinct marine reptiles within the Amniota is contested37. Our results, however, are qualitatively unchanged if we revise the phylogeny to place extinct marine reptiles within the Lepidosauromorpha or in other basal diapsid locations (Supplementary Tables 1520 and 4045). Completely removing the extinct marine reptiles from the analyses has little impact on the results, with only models with a worse fit and some of the models for which the states of both Lepidosauria and Squamata were fixed a priori showing more uncertainty in the ancestral state reconstructions (Supplementary Table 1114 and 3639). Further, the placement of Mesosaurus, coded ambiguously as either viviparous or oviparous with non-mineralized eggs14,17 near the root of the Amniota does not affect these results; if it is removed, the results remain qualitatively the same (Supplementary Tables 710 and 3235).

Second, our dataset may be taphonomically biased. It could be argued that well-skeletonized embryos in adult oviducts are more likely to be preserved than membrane- or parchment-shelled eggs, and that isolated eggs are difficult to assign to species. Consequently, viviparity might be overrepresented by extinct viviparous clades in our analysis. Given that Ikechosaurus is a derived choristodere22, the discovery of oviparity in this presumably viviparous clade suggests that either oviparity evolved from viviparity or viviparity evolved from extinct oviparous ancestors with EER in choristoderes (the latter hypothesis, however, is not backed by the fossil record). This might also be true for extinct viviparous clades, such as mesosaurs, ichthyosaurs and sauropterygians that belong to basal parareptiles or amniotes in general and diapsids or lepidomorphs, respectively. As fully aquatic amniotes could not come onto land to lay their eggs and embryos in eggs could not survive in water, viviparity in these extinct amniotes must have evolved from either semi-aquatic or terrestrial viviparous ancestors (as implicated by our analyses), or oviparous ancestors that displayed EER but whose eggs have not been preserved in the fossil record27. In either case, these early amniotes reflect EER as the primitive reproductive mode of amniotes (Fig. 1, model on the right).

The absence of rigid-shelled eggs through the Carboniferous period, Permian period and most of the Triassic period2,14,15 has long been noted: if such eggs truly existed widely during this time interval, it could change our results entirely, pointing to rigid-shelled eggs as the ancestral amniote condition. However, as rigid-shelled eggs are more likely to be preserved than membrane- or parchment-shelled eggs and perhaps the partially ossified and tiny bones of retained embryos within the mother, this might not be a preservation bias but a real absence15. Conversely, given the scarcity of fossil evidence on the reproductive mode of Palaeozoic amniotes and the low fossilization potential of membrane- or parchment-shelled eggs, the possibility remains that the earliest amniote eggs were, indeed, membrane- or parchment-shelled. The addition of more extinct taxa will provide an important test of these results14,15.

The occurrence of parchment-shelled eggs associated with EER in choristoderes extends the wide occurrence of this phenomenon among amniotes and may be the primitive reproductive mode that occurred before archosaurs (crocodilians, dinosaurs, birds) and chelonians acquired non-EER oviparity and rigid-shelled eggs1. As membrane- and parchment-shelled eggs associated with EER are also common in extant mammals and squamates, this suggests that this condition was common among early terrestrial amniotes, for example, in the first 100 Myr of their evolution from the Carboniferous to the Triassic, favouring a model that amniotic fetal membranes evolved in association with EER. Similarly, a phylogenetic study of extant tetrapods38 inferred that many of the structures that characterize the Amniota (delayed deposition of eggs, large yolk mass, cellular yolk sac and amnion) may have evolved in an aquatic environment in association with delayed egg laying.

Methods

CT scanning and reconstruction

The specimen was scanned at the University of Bristol, UK, on the Nikon X‐Tek H 225 ST X‐ray scanner at 225 kV and 188 μA (42.3 W) from a rotating tungsten target, with 2-s exposure, 1× binning, 24-dB gain and a 3-mm copper filter, slice thickness = 48.45 μm and total number of slices = 1,142. Each scan captured 3,141 projections, with four frames averaged per projection. The reconstructed scan data were subsequently combined in VGStudio v.3 (https://www.volumegraphics.com). A three‐dimensional (3D) model was created from the CT data using the segmentation tools in Avizo v.9.1.1 Lite (Visualization Science Group; https://www.fei.com/software/amira-avizo/). All scan data and 3D models are available in the supplementary data.

Scanning electron microscopy

Samples were examined using a JEOL 8530F Hyperprobe at the School of Earth Sciences, University of Bristol, and a LEO 1530VP scanning electron microscope at the Technical Services Centre, Nanjing Institute of Geology and Palaeontology, Chinese Academy of Sciences. Both instruments were equipped with a secondary electron detector, a back-scattered electron detector and an energy dispersive X-ray spectrometer.

Phylogenetic macroevolutionary analysis

Data collation

Data were compiled on key reproductive parameters for as many extinct amniotes as possible, distinguishing three characters, each with two or three states: reproduction mode: (1) viviparity and (2) oviparity; eggshell mineralization: (1) non-mineralized, (2) weakly mineralized, (3) rigid; and EER: (1) absent and (2) present.These eggshell and parity characteristics have been documented widely in the literature, and we indicate exact data sources in our data compilation (Supplementary Table 1). We identified 59 extinct taxa for which eggs or viviparity had been identified (6 mammals; 1 mesosaur; 6 turtles; 13 ichthyosaurs; 5 sauropterygians; 4 squamates; 3 choristoderes; 1 protorosaur; 2 crocodilians; 4 pterosaurs; 13 dinosaurs; 1 bird). We added a further 21 extant taxa, making a total of 80. As the basis for an initial analysis of ancestral states for Amniota and subclades, we compiled a supertree for the 80 taxa, using a standard genomic tree39 as scaffold (Supplementary Table 2), supplemented by recent cladistic analyses of extinct groups40. Seymouria baylorensis and Diadectes sideropelicus were added as outgroups to a polytomy including the Amniota.

Phylogenetic time-scaling

We obtained first and last appearance dates (FAD and LAD, respectively) for each taxon in our analysis using the Paleobiology Database41. We then time-scaled the supertree using four different approaches: (1) the minimum branch length (mbl) method42; (2) the equal branch length (equal) method43; (3) the FBD tip-dating method44,45,46 with only the root; and (4) with both the root and the node ages of major extant clades constrained. The mbl and equal methods are a posteriori time-scaling methods47 that avoid zero-length branches by imposing a minimum branch length of 1 Myr (mbl) or by taking an equal share from preceding non-zero-length branches (equal). We generated 100 time-scaled trees with the timePaleoPhy function of the paleotree package48 with tip dates sampled from a uniform distribution (dateTreatment = minMax) bounded by FADs and LADs and the vartime argument set to 1 Myr. The FBD method jointly considers speciation, extinction and fossil preservation rates to estimate divergence times in a Bayesian framework44,45,46. We applied a clockless tip-dating approach using MrBayes (v.3.2.7a)49,50 where the empty morphological matrix was generated using the createMrBayesTipDatingNexus function of the paleotree package48. Topology was constrained to the input supertree; uniform priors bounded by the respective FADs and LADs were used to calibrate the tip ages. To place the time-scaled trees in absolute time, M. tenuidens (Early Permian, Kungurian, 278.4 Myr) was used as the anchor taxon. For all node calibrations, we used offset gamma distributions with a shape parameter of 3. Based on Benton et al.51 for the root of the Amniota, we used an offset gamma distribution with a mean age of 325.1 Myr, a minimum age of 318 Myr and an s.d. of 4.099175 Myr. Additional major crown clade calibrations50 for the second FBD analysis were parametrized as follows: Mammalia (minimum age = 164.9, mean age = 182.3402, s.d. = 10.06911); Diapsida (255.9, 274.9603, 11.0045); Lepidosauria (238, 245.0047, 4.044152); Squamata (168.9, 188.2463, 11.16956); Archosauria (247.1, 253.3423, 3.603972); and Aves (66, 75.91138, 5.722338). The default FBD and clock priors52 provided by createMrBayesTipDatingNexus were kept. We disallowed sampled ancestors (prset samplestrat = fossiltip;). we ran the two FBD analyses four times, using four chains per run, for 1,000,000,000 generations, sampling every 100,000th generation. We checked convergence using Tracer v.1.7.1 (ref. 53), ascertaining an effective sample size (ESS) of all parameters exceeding 200 for combined traces. We used the obtainDatedPosteriorTreesMrB function of the paleotree package to obtain a sample of 100 time-scaled trees from the posterior, employing a burn-in of 50%. Before the ancestral state reconstruction, we removed the outgroup taxa S. baylorensis and D. sideropelicus.

Ancestral state estimation

Hierarchical character dependencies have long presented a challenge in ancestral state estimation54,55,56. In our analysis, character 1 and 2 are hierarchically related; the state of character 2 (eggshell mineralization) is dependent on character 1 (reproduction mode) being in a specific state (state = oviparous). This is equivalent to the classic tail colour problem of Maddison54. Recently, Tarasov55 demonstrated that SMMs equipped with hidden states solve the problem of modelling character complexes with hierarchical dependencies. In doing so, he also demonstrated the invariant nature of characters and states. These concepts are equivalent; characters can be transformed into states and vice versa. We followed the approach of Tarasov55 and amalgamated characters 1 and 2 into a single SMM with 6 states (Extended Data Fig. 3). Ancestral states were estimated under two variations of this model. SMM_ind assumes that reproduction mode and eggshell mineralization evolve independently. This is analogous to modelling the characters separately using two independent models, except for the fact that under the SMM approach, simultaneous changes to character 1 and character 2 are prohibited. Alternatively, SMM_sw assumes ‘switch-on’ dependency. That is, character 2 (eggshell mineralization) can only change state if character 1 (reproduction mode) is in a specific state (state = oviparous).

The SMM_ind and SMM_sw approaches consider different models on rate transition between the character states, resulting in eight evolutionary models: a component equal-rate (ER) model (CER_ind and CER_sw: transitions between states among component characters share a single rate parameter); a component symmetrical model (CSYM_ind and CSYM_sw: transitions between states among component characters are symmetrical); a component ARD model (CARD_ind and CARD_sw: transitions between states among component characters are all different); and an equal rates model (ER_ind and ER_sw: transitions between aggregated rates share a single rate parameter). The SMMs used in this study are summarized in Extended Data Fig. 3.

We used an ML approach to estimate the ancestral states for the SMMs, applying the asr_mk_model function (with the optimization algorithm set to ‘optim’) of the castor R package57. To avoid optimization problems, the input trees were scaled to a tree height of 1 before the ML analyses. The transition matrix was fitted ten times and the maximum allowed number of iterations per fitting trial was set to 500. We used the ‘tip.priors’ argument to assign probabilities to amalgamated states. M. tenuidens is a special case. Current fossil evidence does not enable us to determine confidently whether M. tenuidens was viviparous or oviparous with membrane-shelled eggs14,17. Again, we used the tip.priors argument to specify this uncertainty. For the CARD models, which are not time-reversible, marginal ancestral likelihoods were computed without rerooting the input tree. We used the AIC to select the best-fitting model. We then calculated the mean marginal ancestral states of the best-fitting model for each set of 100 input trees, which were plotted on a consensus tree generated using the consensus.edges function of the R package phytools58. Plots were generated using the R package strap59.

The presence and absence of EER was also modelled using asr_mk_model with default parameter settings, the optimization algorithm set to optim, using the same input trees, and providing the two-state character for EER via the ‘tip_states’ argument. We used an ER model (EER ER) and an ARD model (EER ARD). Model selection was again carried out using the AIC. The calculation and plotting of mean marginal ancestral states followed the same practice as for the SMMs.

In addition to ML, we also ran an MP-based ancestral state reconstruction for the same characters using the ancestral.pars function of the phangorn package60,61. As the parsimony approach does not estimate transition rates, the evolutionary models used in the ML approach cannot fully be translated into a parsimony setting. We generated three parsimony models for the amalgamated character (reproductive mode and mineralization): one ACCTRAN approach that allows all character transitions and two most-parsimonious reconstructions (MPR) approaches that attempt to model either independence of reproduction mode and eggshell mineralization (similar to SMM_ind) or a switch-on dependency (similar to SMM_sw) using Sankoff (cost) matrices54,56. The number of required steps for transitions that were forbidden in the model was set to a value (step cost = 100) that would make it practically impossible for the transition to occur. The ACCTRAN62 approach as implemented by ancestral.pars does not allow for cost matrices, thus requiring the MPR63,64 approach. Contrast matrices were used to assign probabilities to amalgamated states and account for uncertainty in tip states. The MP-based ancestral state reconstruction was repeated for the EER character using ACCTRAN.

Furthermore, we also ran a BT ancestral state reconstruction using the package BayesTraits65,66 for each set of 100 time-scaled input trees. As with the ML and MP approaches, the input data was formatted to account for uncertainty in (amalgamated) tip states. To avoid optimization problems, input time-scaled trees were rescaled to have a mean branch length of 0.01. We used the same SMM and EER used in the ML approach. A reverse-jump, continuous time Markov67,68 Chain Monte Carlo algorithm (rjMCMC) was applied to both homogeneous and variable rate models, the latter allowing for shifts in the rate of evolution \({\sigma }_{v}^{2}\) on individual branches69,70. For the models with multiple transition rate parameters, we ran the multistate approach using the rjMCMC method with an exponential (0, 10) hyperprior. For the single-rate models (ER_ind, ER_sw, EER ER), a uniform (0, 10) distribution was set as the transition rate prior. Three independent MCMC chains per model were run for 11,000,000 iterations and parameters were sampled every 10,000 iterations; 1,000,000 iterations were discarded as burn-in. We calculated the ML of the models using the stepping stone sampler71 implemented in BayesTraits. We sampled 1,000 stones and used 100,000 iterations per stone. Convergence was assessed using the R package CODA72, ensuring that the smallest ESS always exceeded 200 for the combined chains. Models were compared using a log BF test73 applied to the mean log MLs from the combined three MCMC chains. To calculate the log BF, the homogeneous rate ER_sw and homogeneous rate EER ER models served as the simple comparison models for the SMMs and the EER models, respectively. Mean ancestral states were calculated across the combined three MCMC chains for each model and plotting followed the same practice used for the ML approach. Given the uncertainty in the ancestral state reconstructions for Lepidosauria and Squamata8,9,10,74,75,76,77, we reran our Bayesian SMM analyses, this time fixing the nodes of the two clades to a non-viviparous state.

Robustness tests

To test the robustness of our results, we reran all our analyses dropping M. tenuidens and extinct marine reptiles, respectively, from our input phylogeny. We also reran the mbl and equal time-scaled trees with a modified phylogenetic position of the extinct marine reptiles, adding them either as a sister taxon to Archelosauria, Archosauromorpha or Lepidosauria21,78,79.

Reporting summary

Further information on research design is available in the Nature Portfolio Reporting Summary linked to this article.