---
phase: 17-kintsugi-aion-repair
plan: 01
subsystem: kintsugi
tags: [ouroboros, aion, kintsugi, stathera, per-symbol-mode]

# Dependency graph
requires:
  - phase: 13-registry-mode-enum
    provides: OuroborosMode.AION enum and ouroboros_mode on SymbolEntry
  - phase: 16-sidecar-aion-startup
    provides: Sidecar Aion startup with per-symbol mode awareness
provides:
  - Per-symbol ouroboros_mode lookup in all kintsugi modules via _get_mode_for_symbol()
  - Conditional today-guard in repair.py (Day=enforced, Aion=skipped)
  - Dead-letter replay confirmed mode-agnostic (KINT-03)
affects: [17-02-PLAN, heartbeat-aion-checks, fleet-recompute]

# Tech tracking
tech-stack:
  added: []
  patterns:
    [
      "Per-symbol mode lookup via _get_mode_for_symbol() helper in kintsugi._helpers",
    ]

key-files:
  created: []
  modified:
    - python/opendeviationbar/kintsugi/_helpers.py
    - python/opendeviationbar/kintsugi/discovery.py
    - python/opendeviationbar/kintsugi/verify.py
    - python/opendeviationbar/kintsugi/telemetry.py
    - python/opendeviationbar/kintsugi/repair.py

key-decisions:
  - "Safe default: _get_mode_for_symbol() returns 'day' for unknown symbols"
  - "Aion today-guard skip relies on committed_floors (L8) + ReplacingMergeTree (L2) for dedup"

patterns-established:
  - "Per-symbol mode lookup: _get_mode_for_symbol(symbol) replaces global get_operational_ouroboros_mode()"

requirements-completed: [KINT-02, KINT-03]

# Metrics
duration: 3min
completed: 2026-03-27
---

# Phase 17 Plan 01: Kintsugi Per-Symbol Mode Summary

**Per-symbol ouroboros_mode wired through all 6 kintsugi call sites with conditional today-guard for Aion symbols**

## Performance

- **Duration:** 3 min
- **Started:** 2026-03-27T15:24:44Z
- **Completed:** 2026-03-27T15:28:36Z
- **Tasks:** 2
- **Files modified:** 5

## Accomplishments

- Added `_get_mode_for_symbol()` helper that reads ouroboros_mode from symbol registry with safe "day" default
- Replaced all `get_operational_ouroboros_mode()` calls in kintsugi with per-symbol lookup (6 call sites across 4 files)
- Made today-guard conditional: enforced for Day-mode (unchanged behavior), skipped for Aion (KINT-02)
- Confirmed dead-letter replay is mode-agnostic with zero ouroboros_mode references (KINT-03)

## Task Commits

Each task was committed atomically:

1. **Task 1: Add \_get_mode_for_symbol helper + wire discovery, verify, telemetry** - `b1a2108` (feat)
2. **Task 2: Conditional today-guard for Aion in repair.py** - `ebc33d3` (feat)

## Files Created/Modified

- `python/opendeviationbar/kintsugi/_helpers.py` - Added \_get_mode_for_symbol() helper function
- `python/opendeviationbar/kintsugi/discovery.py` - Per-symbol mode in \_discover_shards_stathera() and_enrich_shards()
- `python/opendeviationbar/kintsugi/verify.py` - Per-symbol mode in verify_repair()
- `python/opendeviationbar/kintsugi/telemetry.py` - Per-symbol mode in \_log_repair()
- `python/opendeviationbar/kintsugi/repair.py` - Per-symbol mode + conditional today-guard in \_repair()

## Decisions Made

- Safe default: `_get_mode_for_symbol()` returns "day" for unknown symbols (conservative fallback)
- Aion today-guard skip relies on existing defense layers: committed_floors dedup (L8) in live_engine.rs and ReplacingMergeTree (L2) prevent duplicate bars from concurrent writes

## Deviations from Plan

None - plan executed exactly as written.

## Issues Encountered

- Worktree was behind main (missing phase 13-16 changes with OuroborosMode.AION and ouroboros_mode on SymbolEntry). Resolved via fast-forward merge from main before starting work.

## User Setup Required

None - no external service configuration required.

## Next Phase Readiness

- All kintsugi modules now use per-symbol ouroboros_mode from registry
- Ready for Plan 02: Aion repair strategy (\_repair_aion with genesis-forward reconciliation)
- The conditional today-guard enables Aion shards to be repaired for today's data

---

_Phase: 17-kintsugi-aion-repair_
_Completed: 2026-03-27_
