# Phase 32: Historical Gap Cleanup - Context

**Gathered:** 2026-03-28
**Status:** Ready for planning
**Mode:** Auto-generated (infrastructure/operational phase)

<domain>
## Phase Boundary

Bulk reprocess 98K historical day-boundary gaps from Parquet as continuous Aion streams. These gaps exist because bars were originally produced in day mode (each UTC day processed independently) and then migrated to Aion mode (ouroboros_mode re-tagged but gaps not filled). The repair uses `repair_direct_parquet.py` at ~24 days/min with 24 workers.

</domain>

<decisions>
## Implementation Decisions

### Claude's Discretion

All implementation choices are at Claude's discretion — operational phase.

Key context:

- 98K gaps across 42 (symbol, threshold) pairs spanning 2018-01-16 to 2026-02-26
- Each gap is at a UTC day boundary (orphan bar didn't capture all remaining trades)
- `repair_direct_parquet.py` processes Parquet ticks → Rust bars → CH at ~24 days/min
- Must use `ouroboros_mode="aion"` for the repair (continuous, not day-recompute)
- Only 2 exchange gaps total — remaining should all be pipeline gaps after repair
- Kintsugi already healing at ~45 gaps/pass but would take ~36 hours for 98K gaps
- Bulk repair via pueue on bigblack is the correct approach (same as #275 repair session)
- CLEANUP-01 requirement

</decisions>

<code_context>

## Existing Code Insights

### Key Files

- `scripts/repair_direct_parquet.py` — Parquet→Rust→CH bulk repair, 24 workers, thread-local CH cache
- `python/opendeviationbar/kintsugi/discovery.py` — `discover_shards()` finds gaps
- `scripts/CLAUDE.md` — repair scripts section, anti-patterns, bigblack capacity

### Approach

The repair script already handles continuous Aion reprocessing. The task is:

1. Identify the date ranges with day-boundary gaps per symbol
2. Run repair_direct_parquet.py for each symbol covering those dates
3. Use `--ouroboros-mode aion` (now the default after Phase 31)
4. Verify with Stathera audit after completion

</code_context>

<specifics>
## Specific Ideas

This is a remote operational task on bigblack. The plan should create a script/command that can be run via pueue, not inline code changes.

</specifics>

<deferred>
## Deferred Ideas

None.

</deferred>
