# Prime Composite Wavefield Lab — Research Exports v2

## Purpose

This version preserves the existing visual laboratory and adds reproducible data exports for the Prime Phase Field program. The central design principle is a visible information boundary:

- **Pre-reveal exports** contain only the seed, selected prime clocks, residue phases, and divisibility obtained by continuing those clocks.
- **Post-reveal exports** contain factorization, primality, LPF, SPF, Ω, ω, complete future gap boundaries, and factor geometry.

The visual lab still computes target truth internally for display. The separation in this version is therefore a disciplined export boundary, not yet a physically isolated two-process prediction engine. A later standalone script can use these schemas to enforce Freeze → Predict → Reveal at the process/file level.

## New central page: Research exports

Open the **Research exports** tab. Choose a clock bank:

1. **Prime cutoff `q ≤ B`** — the recommended partial-sieve experiment. Default `B=31`.
2. **First `K` required clocks** — a clock-count-matched experiment.
3. **Full required bank `q ≤ √N`** — the exact bounded sieve field.

The page immediately reports:

- selected clocks versus all required clocks;
- largest selected clock;
- number of pre-reveal survivors;
- revealed primes and false survivors, shown only as an audit summary.

A power exponent cap controls how many nested `q^a` lanes are retained in power-hit exports. “Automatic through N” retains every exact power lane available through the run endpoint.

## Core exports

### Pre-reveal

| Button | File | Main use |
|---|---|---|
| Clock state at seed CSV | One row per selected prime `q` | Raw phase fingerprint `S mod q`, sine/cosine phase, and next-strike distance |
| Candidate field CSV | One row per future integer | Partial/full clock hits, survivor rank, and aggregated nested-power context |
| Sparse `q^a` hits CSV | One row per actual divisibility event | Exact reconstruction of valuation lanes and power spectra |

The seed-state table plus candidate offset `t` is sufficient to reconstruct every later residue:

`(S+t) mod q = (S mod q + t) mod q`.

### Post-reveal

| Button | File | Main use |
|---|---|---|
| Truth table CSV | One row per integer | Prime truth, full factorization, SPF, LPF, Ω, ω, Λ, and gap context |
| Complete-gap features CSV | One row per completed prime gap | Layer metrics, largest-owner variables, middle tests, and selected-bank counts |
| Factor occurrences CSV | One row per factor occurrence | Exact 3D/2D skeleton coordinates and multiplicities |

### Reproducibility

| Button | File | Main use |
|---|---|---|
| Run manifest JSON | Settings and schema only | Records the exact bank, run, controls, formulas, and information boundary |
| Complete research package JSON | All core tables in one file | Avoids a sequence of separate browser downloads |

## Contextual exports added to the existing pages

- **Wave field:** displayed integers, current metric, raw values, smoothed display values, and truth columns.
- **3D factor skeleton:** factor occurrences for the selected gap.
- **2D stacked side:** factor occurrences for the currently overlaid gap group.
- **Prime-power waves:** all displayed `q^a` lanes in long format.
- **All-clock power sum:** one valuation column per displayed integer with its power signature.
- **Large-range sampler:** every exact sampled skeleton and its sampling block/offset.
- **Gap clumps + control:** each aligned 61-point gap curve plus observed and parity-control summaries.
- **Layer births + repeats:** one row per completed gap with selected signal, layer records, and exact strike counts.
- **Clock spectrum:** every Fourier bin, power, period, nearest clock/power source, and resolution flag.

The existing arithmetic-block and complex-plane exports remain in place.

## Zeta export enhancement

The zeta comparison CSV now includes local first differences in addition to the cumulative curves:

- `exact_first_difference`;
- `zero_first_difference`;
- `control_first_difference`;
- `lambda_from_exact_difference = 1 + ΔEψ`;
- `lambda_hat_zero = 1 + ΔEK`;
- `lambda_hat_control`;
- normalized local scores divided by `log(n)`;
- `gamma_max` and the rough finest integer wavelength `2π(n+1/2)/gamma_max`.

This permits the decisive local test: whether a finite zero reconstruction locates individual prime-power events, rather than merely correlating with a cumulative residual.

## Corrections included

- The all-clock power view retains the proper-divisor guard `q<n`, so a prime does not create a self-hit.
- The Wave field copy now states that `ω−1` also vanishes at composite prime powers.
- The yellow layer-ring caption now reports actual records among completed gaps instead of assuming equality with the global powers-of-two envelope when a trailing gap is incomplete.

## Default-run validation

For `S=61,729`, `H=500`:

- full bank: 53 clocks and 43 survivors, exactly matching the 43 future primes;
- cutoff `q≤31`: 11 clocks, 72 survivors, 43 revealed primes, and 29 false survivors;
- the full-bank candidate export matches all 500 rows of the prior frontier CSV in hit counts, hitting-prime lists, and coverage status;
- the enhanced zeta export satisfies `1 + ΔEψ = Λ(n)` on every non-seed row;
- all new buttons were opened and downloaded in a headless-browser test with zero JavaScript page errors.

## Recommended first exports

### High-scale phase field

- Seed: `459824117`
- Horizon: `5000`
- Export partial banks for several predeclared cutoffs, then the full bank.
- Start with `B = 31, 97, 251, 997`, plus a matched first-K sequence.
- Export clock state, candidates, sparse power hits, truth, gaps, and manifest.

### Zeta locality

- Seed: `61729`
- Horizon: `5000`
- Smoothing: `Raw`
- Scale: `Exact common units`
- Export at `K=1000` and `K=100000`.

Do not select cutoffs after inspecting which one performs best. Declare the cutoff sequence first, keep every run, and compare against equal-cost partial-sieve baselines.
