  Most of the information on our cosmos stems from either late-time
observations or the imprint of early-time inhomogeneities on the cosmic
microwave background. We explore to what extent early modifications of gravity,
which become significant after recombination but then decay towards the
present, can be constrained by current cosmological observations. For the
evolution of the gravitational modification, we adopt the decaying mode of a
hybrid-metric Palatini $f(\mathcal{R})$ gravity model which is designed to
reproduce the standard cosmological background expansion history and due to the
decay of the modification is naturally compatible with Solar-System tests. We
embed the model in the effective field theory description of Horndeski
scalar-tensor gravity with an early-time decoupling of the gravitational
modification. Since the quasistatic approximation for the perturbations in the
model breaks down at high redshifts, where modifications remain relevant, we
introduce a computationally efficient correction to describe the evolution of
the scalar field fluctuation in this regime. We compare the decaying early-time
modification against geometric probes and recent Planck measurements and find
no evidence for such effects in the observations. Current data constrains the
scalar field value at $|f_{\mathcal{R}}(z=z_{\rm on})| \lesssim 10^{-2}$ for
modifications introduced at redshifts $z_{\rm on}\sim(500-1000)$ with
present-day value $|f_{\mathcal{R}0}|\lesssim10^{-8}$. Finally, we comment on
constraints that will be achievable with future 21~cm surveys and gravitational
wave experiments.
