## Phase 115: Kalika Architecture Hardening — Module Glue, Scaffolding Completion, Critical Content Gaps, Build Order Fixes & Final Test Coverage

The fifth audit pass for Kalika's original mathematics and theoretical-physics
core. Unlike previous passes that found missing _topics_, this one found missing
_connective tissue_ — the glue tasks between modules, orphaned scaffolded
directories with no content, build order violations where later phases depend on
infrastructure not yet built, and 5 critical content gaps that any expert would
immediately flag. After this phase, the pre-materials Kalika core is
structurally sound and architecturally coherent, and the subsequent
materials-science expansion (Phases 116-128) can build on it cleanly.

---

### 115.1 Module Glue Tasks (Connecting the 50+ Libraries)

#### 115.1.1 CAS-to-Numerical Bridge

- [x] **115.1.1.1** Implement `Expr.compile()`: given a symbolic expression from
      the CAS engine (@kalika/cas-engine), compile it to a callable numerical
      function `(params: Float64Array) => Float64` (or complex variant) via code
      generation — either JIT-compiled JavaScript, WASM function, or native via
      napi-rs. This is the critical bridge enabling: ODE solvers to accept
      symbolically-derived right-hand sides, optimization to minimize symbolic
      objective functions, and plotting to evaluate expressions at arbitrary
      points without per-point interpretation overhead
- [x] **115.1.1.2** Implement symbolic-to-numerical fallback pipeline: when the
      CAS symbolic solver fails (e.g., no closed-form integral, no analytic ODE
      solution), automatically discretize the problem and hand off to the
      numerical engine — `integrate()` falls back to adaptive quadrature,
      `dsolve()` falls back to Runge-Kutta, `solve()` falls back to
      Newton-Raphson — with a clear notification to the user that the result is
      numerical, not exact

#### 115.1.2 QFT Pipeline Glue

- [x] **115.1.2.1** Implement Lagrangian-to-Feynman-rules pipeline: given a
      symbolic Lagrangian from the Lagrangian builder (101.2.1.2), automatically
      extract all propagators and vertices (by expanding the Lagrangian in
      fields, identifying bilinear terms → propagators and higher terms →
      vertices, reading off Feynman rules including symmetry factors) and pass
      the resulting FeynmanModel data structure to the diagram generator
      (101.2.2.1) — the explicit "wire" between model building and amplitude
      calculation
- [x] **115.1.2.2** Implement amplitude-to-cross-section pipeline: given a list
      of Feynman diagram amplitudes from the evaluation step
      (101.2.2.2-101.2.2.5), implement: sum over diagrams → square the total
      amplitude (|M|²) → sum/average over spins and colors → pass the squared
      matrix element function to the phase-space integrator (101.2.5.1) — the
      explicit glue between amplitude computation and observable prediction
- [x] **115.1.2.3** Implement GR-to-QFT-on-curved-spacetime bridge: given a
      metric g*μν from the GR module (101.3), compute the vielbein e^a*μ and
      spin connection ω^{ab}*μ, construct the curved-space Dirac operator
      γ^μ(∂*μ + ω_μ), and feed into the spectral geometry module (114.4) for
      heat kernel / one-loop effective action computation — enabling quantum
      field theory on arbitrary curved backgrounds

#### 115.1.3 Lattice Pipeline Glue

- [x] **115.1.3.1** Implement gauge configuration I/O: save lattice gauge field
      configurations to disk in ILDG (International Lattice Data Grid) format or
      HDF5 with standard metadata (lattice dimensions, beta, fermion action
      parameters, trajectory number, plaquette value), and load saved
      configurations for measurement — the critical workflow step between gauge
      generation (HMC) and physics measurements
- [x] **115.1.3.2** Implement stat-mech-to-lattice bridge: configure the generic
      lattice Monte Carlo engine (102.8) to simulate classical statistical
      mechanics models (Ising, Potts, XY, Heisenberg, clock models) by
      specifying the action as a sum over nearest-neighbor interactions rather
      than gauge-theory plaquettes — reusing the MC infrastructure for condensed
      matter applications

#### 115.1.4 Knowledge Graph Ingestion Hooks

- [x] **115.1.4.1** Implement computation result event system: define a
      `ComputationResultEvent` type emitted by every CAS computation, formal
      verification, and physics calculation — carrying: input expression, output
      expression, derivation chain, verification status, domain tags, and
      timestamp. All computation modules emit these events; the knowledge graph
      (108.2) subscribes and ingests verified results automatically
- [x] **115.1.4.2** Implement theorem registration: when a user formally
      verifies a result in Lean 4 (Phase 104), automatically register it in the
      knowledge graph as a new theorem node with: statement, proof reference,
      dependencies (which other theorems were used), domain tags, and
      contributor attribution — making every formal verification permanently
      enrich the platform

#### 115.1.5 Notebook-to-Physics UI Affordances

- [x] **115.1.5.1** Implement domain-specific notebook templates: pre-configured
      notebook types for common physics workflows — "QFT Amplitude Calculation"
      (pre-imports Feynman engine, has cells for model selection, diagram
      generation, amplitude evaluation, cross-section), "GR Spacetime Explorer"
      (pre-imports metric library, has cells for metric entry, curvature
      computation, geodesic visualization), "Lattice Monte Carlo" (pre-imports
      lattice framework, has cells for action specification, HMC parameters,
      measurement), "Conformal Bootstrap" (pre-imports bootstrap module, has
      cells for symmetry setup, conformal block computation, SDP formulation) —
      making the UI physics-aware, not just a generic CAS interface

---

### 115.2 Scaffolding Completion

- [x] **115.2.1.1** Update Phase 99.1.1.1 scaffolding task to include ALL
      library directories from Phases 99-115: add the 33+ libraries introduced
      in later phases (tropical, periods, positive-geometry, algebraic-geometry,
      geometric-analysis, symplectic, higher-categories,
      noncommutative-geometry, vertex-algebras, quantum-groups, three-manifolds,
      classical-mechanics, electrodynamics, fluid-dynamics, thermodynamics,
      optics, plasma-physics, astrophysics, nonlinear-dynamics, atomic-physics,
      optimization, autodiff, measure-theory, approximation,
      algebraic-combinatorics, non-perturbative, supersymmetry,
      spectral-geometry, optimal-transport, open-quantum-systems, surrogate,
      neural-physics, algebraic-geometry) to the initial scaffolding — ensuring
      all directories exist from day one
- [x] **115.2.1.2** Populate orphaned scaffolded directories: create
      package.json, project.json, tsconfig.json, and src/index.ts for the 10
      scaffolded directories that have no explicit task filling them —
      `arithmetic` (re-exports from cas-engine), `calculus` (re-exports from
      cas-engine), `cohomology` (re-exports from topology + algebraic-geometry),
      `differential-geometry` (standalone library populated from tasks in
      101.3 + 110.2), `feynman` (standalone library populated from tasks in
      101.2.2), `mathematical-physics` (re-exports from multiple physics
      libraries), `operators` (re-exports from analysis + quantum-mechanics),
      `particles` (particle data from 102.5.1.1), `quantum-computing`
      (re-exports from quantum-mechanics + information-theory), `tensor`
      (standalone library populated from tasks in 101.3.1)

---

### 115.3 Topological Quantum Computation (`@kalika/topological-qc`)

- [x] **115.3.1.1** Implement anyon model framework: anyonic particle types with
      fusion rules (a × b = Σ N^c\_{ab} c), braiding (R-matrices: R^{ab}\_c),
      and F-matrices (associativity: (a×b)×c ↔ a×(b×c)) — the algebraic data of
      a modular tensor category specifying a topological phase of matter
- [x] **115.3.1.2** Implement standard anyon models: Fibonacci anyons (τ × τ =
      1 + τ, universal for quantum computation), Ising anyons (σ × σ = 1 + ψ,
      from Majorana zero modes, non-universal), SU(2)\_k Chern-Simons anyons for
      k = 1,2,3,4, and Kitaev's toric code (e, m, ε anyons with Z₂ fusion) —
      with pre-computed F-matrices and R-matrices
- [x] **115.3.1.3** Implement topological quantum gate compilation: given a
      target unitary gate U and an anyon model, find a braid word (sequence of
      elementary braiding operations σ_i) that approximates U to within error ε
      — using the Solovay-Kitaev theorem for Fibonacci anyons (dense image in
      SU(2)) or exact decomposition for Ising (Clifford group only). Verify
      approximation error via trace distance
- [x] **115.3.1.4** Implement topological entanglement entropy: for a 2D ground
      state |ψ⟩ (from DMRG/PEPS or exact diagonalization), compute the
      topological contribution γ to the entanglement entropy S(A) = αL - γ + ...
      by the Kitaev-Preskill or Levin-Wen construction — detecting topological
      order from the wavefunction. γ = log D where D is the total quantum
      dimension D = √(Σ d_a²)
- [x] **115.3.1.5** Implement braiding simulation: given N anyons on a 2D
      surface with specified fusion channels, simulate braiding operations as
      unitary transformations on the fusion Hilbert space, compute measurement
      probabilities, and visualize braid diagrams — for designing and analyzing
      topological quantum circuits

---

### 115.4 Post-Minkowskian Gravitational Dynamics

- [x] **115.4.1.1** Implement post-Minkowskian (PM) scattering angle: compute
      the scattering angle χ(b, E) for two massive bodies as a function of
      impact parameter b and center-of-mass energy E, order-by-order in G
      (Newton's constant) — at 1PM (Newtonian), 2PM (first relativistic
      correction), 3PM (Bern-Cheung-Solon et al. 2019), 4PM (2021), and
      interfacing with amplitude methods for higher orders. The PM expansion is
      the modern approach to binary dynamics using QFT amplitudes techniques
- [x] **115.4.1.2** Implement PM-to-EOB mapping: convert post-Minkowskian
      scattering data (scattering angle, radial action) to bound-orbit dynamics
      via the effective-one-body (EOB) Hamiltonian — the
      Bini-Damour-Kaelin-Galley boundary-to-bound map. This connects scattering
      amplitudes (computed via Feynman diagrams in the QFT module) to
      gravitational wave observables
- [x] **115.4.1.3** Implement gravitational self-force: for extreme mass-ratio
      inspirals (EMRI: stellar-mass object orbiting a supermassive black hole),
      compute the self-force correction to geodesic motion using mode-sum
      regularization or effective source methods — producing waveforms for LISA
      (space-based GW detector). Connect to the GR module's geodesic solver
      (101.3.2.5) and perturbation theory (101.3.3)

---

### 115.5 Neutrino Physics (`@kalika/neutrino-physics`)

- [x] **115.5.1.1** Implement neutrino oscillation probability: P(ν*α → ν*β) for
      three-flavor mixing with PMNS matrix U(θ₁₂, θ₁₃, θ₂₃, δ_CP), mass-squared
      differences Δm²₂₁ and Δm²₃₁, and matter effects
      (Mikheyev-Smirnov-Wolfenstein/MSW effect) — the constant-density
      approximation and the adiabatic approximation for varying density. Compute
      for vacuum, constant matter (Earth), and solar density profile
- [x] **115.5.1.2** Implement neutrino mass mechanisms: type-I seesaw (m_ν =
      -m_D M_R^{-1} m_D^T), type-II (triplet Higgs), type-III (fermion triplet),
      inverse seesaw, linear seesaw — given the high-scale parameters, compute
      the light neutrino mass matrix and verify compatibility with oscillation
      data (NuFIT global fit: θ₁₂ ≈ 33.4°, θ₂₃ ≈ 49.3°, θ₁₃ ≈ 8.5°)
- [x] **115.5.1.3** Implement neutrino cross-sections: quasi-elastic (ν*μ n → μ⁻
      p), deep inelastic (ν*μ N → μ⁻ X), coherent elastic neutrino-nucleus
      (CEνNS), and neutrino-electron elastic scattering — needed for experiment
      simulation and analysis (DUNE, Hyper-Kamiokande, JUNO)

---

### 115.6 Big Bang Nucleosynthesis (`@kalika/bbn`)

- [x] **115.6.1.1** Implement BBN nuclear reaction network: neutron-proton
      interconversion (weak rates at finite temperature), and the nuclear
      reaction chain n+p→D+γ, D+D→³He+n, D+D→T+p, ³He+D→⁴He+p, T+D→⁴He+n, and
      the remaining ~80 reactions for ⁷Li/⁷Be production — solving the coupled
      Boltzmann equations from T ~ 10 MeV (n/p freeze-out) to T ~ 10 keV
      (nucleosynthesis completion)
- [x] **115.6.1.2** Implement BBN abundance prediction: given cosmological
      parameters (η = n*b/n*γ baryon-to-photon ratio, N_eff effective number of
      neutrino species, τ_n neutron lifetime), compute primordial abundances Y_p
      (⁴He mass fraction), D/H, ³He/H, ⁷Li/H — and compare with observational
      constraints (Planck η, measured D/H from quasar absorption, Y_p from HII
      regions)
- [x] **115.6.1.3** Implement BSM BBN constraints: given a BSM model modifying:
      N_eff (extra light species), expansion rate (modified gravity), neutron
      lifetime (exotic decays), or nuclear rates (new light particles in loops)
      — compute modified abundances and derive constraints on BSM parameters.
      This is a powerful, model-independent probe of new physics

---

### 115.7 Entanglement Measures (Comprehensive) (`@kalika/entanglement`)

- [x] **115.7.1.1** Implement von Neumann entanglement entropy: S(ρ_A) = -Tr(ρ_A
      log ρ_A) for a bipartite system, computed from the reduced density matrix
      ρ_A = Tr_B(|ψ⟩⟨ψ|) — via exact diagonalization (small systems), DMRG (1D),
      or QMC Renyi entropy trick (2D). Verify area law S ~ L^{d-1} for gapped
      systems and logarithmic violation S ~ (c/3)log(L) for 1D critical systems
      (c = central charge)
- [x] **115.7.1.2** Implement Renyi entropies: S_n(ρ_A) = (1/(1-n)) log
      Tr(ρ_A^n) for n = 2,3,4,... — computable via replica trick (n copies of
      the system), swap trick in QMC, or tensor network methods. S₂ is
      particularly useful because it is measurable in quantum simulations via
      random measurements
- [x] **115.7.1.3** Implement entanglement negativity: N(ρ*{AB}) =
      (||ρ^{T_B}*{AB}||₁ - 1)/2 where T_B is partial transpose — an entanglement
      measure for mixed states (unlike von Neumann entropy which measures total
      correlations). Computable from the spectrum of the partially transposed
      density matrix
- [x] **115.7.1.4** Implement mutual information: I(A:B) = S(A) + S(B) - S(AB) —
      the total correlation (classical + quantum) between subsystems A and B.
      Compute as the combination of entanglement entropies. Verify strong
      subadditivity S(ABC) + S(B) ≤ S(AB) + S(BC)
- [x] **115.7.1.5** Implement topological entanglement entropy (Kitaev-Preskill
      / Levin-Wen): extract the topological contribution γ from entanglement
      entropy using the specific region geometries of Kitaev-Preskill (three
      regions meeting at a point) or Levin-Wen (annular region), linking γ to
      the total quantum dimension D of the topological phase — the primary
      computational diagnostic for topological order

---

### 115.8 Additional Critical Content

#### 115.8.1 Dispersion Relations & Sum Rules

- [x] **115.8.1.1** Implement dispersion relation framework: given an analytic
      scattering amplitude A(s) with known discontinuity (imaginary part),
      reconstruct the full amplitude via the Kramers-Kronig / dispersion
      integral Re A(s) = (1/π) P∫ Im A(s')/( s'-s) ds' — with subtracted
      dispersion relations for convergence. Used across optics, scattering
      theory, and hadron physics
- [x] **115.8.1.2** Implement QCD sum rules (SVZ/Shifman-Vainshtein-Zakharov):
      given an operator product expansion of a correlator Π(q²) = Σ C_n(q²)⟨O_n⟩
      with Wilson coefficients C_n and vacuum condensates ⟨O_n⟩ (⟨αs/π GG⟩,
      ⟨qq̄⟩, etc.), perform Borel transform, match to hadronic spectral function
      (pole + continuum model), and extract hadronic parameters (masses, decay
      constants, coupling constants) — the standard method for hadron
      spectroscopy from first principles

#### 115.8.2 Baryogenesis & Leptogenesis

- [x] **115.8.2.1** Implement leptogenesis Boltzmann equations: given heavy
      right-handed neutrino masses M*i, Yukawa couplings, and CP asymmetry ε_i,
      solve the coupled Boltzmann equations for the heavy neutrino abundance Y_N
      and lepton asymmetry Y_L as functions of z = M/T, compute the baryon
      asymmetry Y_B via sphaleron conversion (Y_B = -(28/79) Y*{B-L}), and
      compare with the observed value Y_B ≈ 8.7 × 10⁻¹¹ — matching ULYSSES
      (Universal Leptogenesis Equation Solver) capabilities
- [x] **115.8.2.2** Implement sphaleron rate computation: the electroweak
      sphaleron rate Γ_sph that converts lepton asymmetry to baryon asymmetry,
      as a function of temperature — above the electroweak phase transition
      (unsuppressed) and below (exponentially suppressed by the sphaleron energy
      E_sph ≈ 8πv/g)

#### 115.8.3 Axion Physics

- [x] **115.8.3.1** Implement axion parameter space: given the axion decay
      constant f*a, compute the axion mass m_a ≈ 5.7 μeV (10¹² GeV/f_a),
      axion-photon coupling g*{aγγ} = α/(2πf*a) · (E/N - 1.92), axion-nucleon
      couplings, cosmological relic density (misalignment mechanism: Ω_a h² ≈
      0.12 (f_a/10¹² GeV)^{1.19} (θ_i/π)²), and detection rates for axion
      haloscopes (ADMX) and helioscopes (CAST/IAXO) — producing axion
      exclusion/discovery plots in the (m_a, g*{aγγ}) plane
- [x] **115.8.3.2** Implement axion cosmology: axion field evolution
      (misalignment mechanism, domain wall formation/annihilation, axion string
      decay), compute relic abundance as a function of initial misalignment
      angle θ_i and PQ symmetry breaking scale, interface with BBN module
      (115.6) for constraints from extra radiation during nucleosynthesis

#### 115.8.4 Donaldson-Thomas / Gromov-Witten Invariants

- [x] **115.8.4.1** Implement topological vertex computation: the
      Aganagic-Klemm-Marino-Vafa topological vertex C\_{λμν}(q) expressed as a
      sum over 3D partitions (plane partitions), compute the topological string
      partition function Z_top for toric Calabi-Yau threefolds as a product of
      vertex contributions and propagators — the standard method for computing
      GW/DT invariants of toric geometries
- [x] **115.8.4.2** Implement GW/DT correspondence: given Gromov-Witten
      invariants N*{g,β} (virtual counts of genus-g curves in class β), convert
      to Gopakumar-Vafa invariants n^g*β (integer BPS counts) and
      Donaldson-Thomas invariants via the MNOP conjecture (GW/DT wall-crossing)
      — connecting enumerative geometry to string theory BPS counting

---

### 115.9 Build Order & Dependency Fixes

- [x] **115.9.1.1** Create AD foundation early: extract the core automatic
      differentiation engine (113.2.1.1 forward-mode, 113.2.1.2 reverse-mode) as
      a dependency-free utility library `@kalika/autodiff-core` that can be
      built immediately after the numerical engine (Phase 103), before Phase 104
      — resolving the dependency where PINNs (104.6) need AD but AD (113.2)
      isn't available until 14 phases later
- [x] **115.9.1.2** Create SDP solver early: extract the SDP solver (113.1.1.2)
      as a dependency-free optimization library `@kalika/sdp-core` buildable
      after the numerical engine (Phase 103), before Phase 109 — resolving the
      dependency where the conformal bootstrap (109.5) needs SDP but the
      optimization library (113.1) isn't available until 4 phases later
- [x] **115.9.1.3** Document build order: create a build dependency graph
      showing which phases depend on which, annotating the critical path, and
      identifying which phases can be built in parallel — enabling efficient
      parallelization of implementation effort

---

### 115.10 Missing Test Coverage

- [x] **115.10.1.1** Write Risch algorithm decidability tests: verify that the
      Risch algorithm correctly reports "no elementary antiderivative exists"
      for known non-elementary integrals (∫e^{-x²}dx, ∫sin(x)/x dx, ∫x^x dx) —
      minimum 20 test cases testing the algorithm's decision procedure, not just
      its integration output
- [x] **115.10.1.2** Write e-graph equality saturation unit tests: test the
      e-graph engine in isolation — verify saturation termination, extraction of
      minimum-cost expression, handling of associativity/commutativity, and
      correctness of equivalence class merging — minimum 30 unit tests for the
      engine internals
- [x] **115.10.1.3** Write BSM model Feynman rule tests: for MSSM, 2HDM, and one
      additional BSM model, verify that auto-derived Feynman rules match
      published reference Feynman rules (comparing vertex factors, propagator
      forms, ghost terms) — minimum 15 test cases per model
- [x] **115.10.1.4** Write data flywheel integration tests: verify that a
      computation result propagates through the full pipeline: CAS computation →
      numerical verification → knowledge graph ingestion → embedding generation
      → retrieval via semantic search — minimum 5 end-to-end pipeline tests
- [x] **115.10.1.5** Write cross-module integration tests: verify 10 specific
      cross-module data flows: (1) symbolic Lagrangian → Feynman rules → diagram
      → amplitude → cross-section, (2) metric → Christoffel → Riemann → heat
      kernel coefficients, (3) CAS Expr → compiled numerical function → ODE
      solver, (4) lattice HMC → config save → config load → measurement, (5)
      symbolic result → Lean verification → knowledge graph entry, (6) notebook
      cell → CAS evaluation → LaTeX rendering, (7) Lie algebra → representation
      → tensor product decomposition → branching rules, (8) BSM parameters →
      SLHA output → spectrum → decay rates, (9) CY polytope → Hodge numbers →
      intersection numbers → line bundle cohomology → particle spectrum, (10)
      perturbative series → Borel transform → Padé → singularity identification
      → trans-series

---

### 115.11 Tests for New Content

- [x] **115.11.1.1** Write topological QC tests: verify Fibonacci anyon braiding
      produces dense SU(2) subgroup, Ising anyon braiding generates Clifford
      group, topological entanglement entropy γ = log(φ) for Fibonacci phase (φ
      = golden ratio) — minimum 15 test cases
- [x] **115.11.1.2** Write PM/gravitational tests: verify 1PM scattering angle
      matches Newtonian prediction χ₁ = 2GM/(bv²), BBN deuterium abundance D/H ≈
      2.5 × 10⁻⁵ for standard cosmological parameters, neutrino oscillation
      P(ν_μ→ν_e) matches exact formula for vacuum — minimum 15 test cases
- [x] **115.11.1.3** Write entanglement tests: verify S = (c/3)log(L/a) for
      critical Ising chain (c=1/2), topological entanglement entropy γ = log(2)
      for toric code, mutual information satisfies strong subadditivity —
      minimum 10 test cases
