Biogeochemical models have elucidated atmospheric history and geochemical data during last 500 million years, but a similar understanding of the Precambrian is lacking. This proposal addresses two fundamental issues in the co-evolution of life and environment. The first concerns developing a basic understanding of the evolution of the geological nitrogen cycle. The second concerns developing a model of the controls on the pH of the ocean over geologic time and how pH affects the coupled carbon-oxygen cycle. The model will be constrained by new proxies of pH from Precambrian limestones. The pH model should also provide information on how oceanic pH might generally be regulated on rocky planets. The work is thus relevant to Exobiology Program goals of studying 'Early Evolution of Life and the Biosphere', 'Large scale environmental change and Macro-evolution', and 'Life Elsewhere'. The motivation for studying the nitrogen cycle stems from new results in work previously funded by NASA Exobiology, which indicate that Earth's atmospheric pressure changed substantially over time. Independent datasets of fossil raindrop imprints and the size distribution of vesicles in ancient lava flows suggest that the air was substantially thinner at 2.7 Ga, with surface pressure < 0.5 bar. Small levels of N2 in the Archean can be explained if a major sink for nitrogen was ammonium in buried and subducted minerals. In Task 1, we will model the geological nitrogen cycle to understand controls on N2 levels in three phases of Earth history: (1) prebiotic, (2) biotic and anoxic, and (3) biotic and oxic. We hypothesize that an ancient origin of N-fixation sequestered N into the solid Earth (e.g., as ammonium and nitride compounds) causing N2 levels to be low in the late Archean. Then, we hypothesize, N2 levels rose with the 2.4-2.3 Ga Great Oxidation Event. Models will be constrained by our paleobarometry proxies and make predictions about Archean marine ammonium levels. In Task 2, we seek to understand oceanic pH and its effect on the carbon cycle over time by developing a new model (Task 2A) and making new pH proxy measurements (Task 2B). The carbon cycle, in turn, affects atmospheric O2 because the segregation of buried photosynthesized organic carbon is a net source of O2. Thallium isotopes indicate that the ocean fluxes through low temperature seafloor hydrothermal systems on a timescale of only 20-100 kyr. A pH-dependent release of seafloor calcium during water-rock reactions removes carbon as calcite and may modulate the burial ratio of organic carbon vs. inorganic carbon. We hypothesize that rock-water interaction in such cycling has buffered the pH of the ocean to be neutral to alkaline over geological history. In Task 2A, we seek to demonstrate, for the first time, how this control can work with a time-dependent model. Oceanic pH was important for the origin and evolution of life. Mafic crusts are expected on many rocky worlds, so the work is relevant to oceans and life on rocky exoplanets. In Task 2B, we will collect and analyze new data to constrain the pH of the Precambrian oceans using the boron isotope composition of limestones. Previously, uncertainties about isotope exchange between borate and boric acid limited this method. But recent progress in measuring isotope equilibrium constants and establishing new protocols, inter-lab comparisons, and a B isotope composition of modern seawater, make it timely to apply this proxy to deep-time pH. We propose to examine B isotopes in limestones from the Mesoproterozoic, Paleoproterozoic, late Archean, and early Archean to constrain how ocean pH changed through time. We will test the hypothesis that neither changing composition in the oceans nor changing climatic temperature will have overcome a pH-regulation by seafloor weathering.