# Task Breakdown for 32k Context Window ## Overview All tasks are designed to fit within a single 32k context window (~50-80 lines of SPEC + ~200 lines of code). ## Dependency Graph ``` Phase 1: Alert Refactor (6 tasks) ┌─────────────────────────┐ │ fix-alert-test-get-all │ ← Fix 1 failing test first └─────────┬───────────────┘ │ ┌─────────▼───────────────┐ │ alert-service-create │ ← Create service class └─────────┬───────────────┘ │ ┌─────────▼───────────────┐ │ alert-service-migrate-get│ ← Migrate GET endpoints └─────────┬───────────────┘ │ ┌─────────▼───────────────┐ │ alert-service-migrate-w │ ← Migrate POST/PUT/DELETE └─────────┬───────────────┘ │ ┌─────────▼───────────────┐ │ alert-service-cleanup │ ← Remove direct DB calls └─────────┬───────────────┘ │ ┌─────────▼───────────────┐ │ alert-service-verify │ ← Full test suite pass └─────────────────────────┘ Phase 1b: Fix Test Fixture (parallel to Phase 1) ┌─────────────────────────┐ │ fix-test-watchlist-fixt │ ← Fix user_id mismatch └─────────┬───────────────┘ │ ├───────────────┐ ▼ │ ┌─────────────────────┐ │ │ complete-rotation- │ │ │ ranking │───┘ └─────────┬───────────┘ │ ┌─────────▼───────────┐ │ complete-rotation- │ │ signals │ └─────────┬───────────┘ │ ┌─────────▼───────────┐ │ complete-rotation- │ │ macro │ └─────────────────────┘ Phase 2: Pipeline (2 tasks, sequential) ┌─────────────────────┐ │ pipeline-orchestrator│ │ -tasks │ ← Define tasks └─────────┬───────────┘ │ ┌─────────▼───────────┐ │ pipeline-orchestrator│ │ -api │ ← API endpoints └─────────────────────┘ Phase 2: Backtest (1 task, independent) ┌─────────────────────┐ │ phase2-backtest- │ │ integration │ ← Wire backtest to pipeline └─────────────────────┘ Phase 2: News Ingestion (1 task, independent) ┌─────────────────────┐ │ phase2-wire-news- │ │ ingestion │ ← Already in progress └─────────────────────┘ Phase 2: Financials (1 task, COMPLETE) ┌─────────────────────┐ │ phase2-wire-financials│ │ -ingestion │ ✅ COMPLETE └─────────────────────┘ ``` ## Task Sizes (SPEC lines) | Task | SPEC Lines | Expected Code Lines | |------|-----------|-------------------| | fix-alert-test-get-all | ~35 | 1 file, ~10 changes | | alert-service-create | ~40 | ~150 lines (new file) | | alert-service-migrate-get | ~35 | ~10 lines changed | | alert-service-migrate-write | ~35 | ~20 lines changed | | alert-service-cleanup | ~30 | ~20 lines changed | | alert-service-verify | ~25 | 0 lines (tests only) | | fix-test-watchlist-fixture | ~35 | ~5 lines changed | | complete-rotation-ranking | ~35 | ~80 lines | | complete-rotation-signals | ~35 | ~40 lines | | complete-rotation-macro | ~30 | ~30 lines | | pipeline-orchestrator-tasks | ~45 | ~120 lines | | pipeline-orchestrator-api | ~50 | ~100 lines | | phase2-backtest-integration | ~40 | ~50 lines | | phase2-wire-news-ingestion | ~40 | ~50 lines | All SPEC files are under 50 lines (well within 200 token limit for prompts). ## Execution Order 1. **fix-alert-test-get-all** — Fix the one failing test (prerequisite for all alert work) 2. **alert-service-create** — Create the service class 3. **alert-service-migrate-get** — Migrate GET endpoints 4. **alert-service-migrate-write** — Migrate write endpoints 5. **alert-service-cleanup** — Remove direct DB calls 6. **alert-service-verify** — Verify everything passes 7. **fix-test-watchlist-fixture** — Fix fixture (can be done anytime before rotation tasks) 8. **complete-rotation-ranking** → **signals** → **macro** (sequential) 9. **pipeline-orchestrator-tasks** → **pipeline-orchestrator-api** (sequential) 10. **phase2-backtest-integration** (independent, can be done anytime) 11. **phase2-wire-news-ingestion** (independent, can be done anytime)