# TASK: Smart dispatcher — phase-aware model selection + queue selection (Redmine 492+493) ## Context Spec of record: docs/SPEC-20260829-charles-brief.md (Roadmap 2+3). The quota/back-pressure turn (internal/quota) lands in the repo BEFORE this turn starts — build on it, do not re-implement. ## Part A — Phase-aware model selection (ticket 492) - Routing v1: work phases get different tiers. Convention: a task's phase is derived v1 from explicit fields first, fallbacks second: 1. Redmine custom field (configurable field name, e.g. "phase", values: plan/implement/review/grind) 2. harness.toml `[models.phases]` map: phase -> class (plan=primary, implement=code, review=review, grind=flash-class default) 3. fallback: existing class map (unchanged behavior). - The conductor exposes which phase it ran in the REPORT header (model + phase + class) — telemetry for the eventual auto-classifier (v2, NOT this turn). - Unknown phase value = config error naming valid phases. ## Part B — Queue selection (ticket 493) - Loop intake query becomes selection-aware: - Redmine sort: priority desc, due_date asc (config keys in `[redmine.selection]`); respect relations (issue blocked while relates/blocks parent open — use /relations or issue relations field; skip blocked, log reason). - Quota gate: consult internal/quota snapshot (from the prior turn) — heavy classes deferred when quota-low or peak-window per its config. - Resource gate: same pattern for the busy-system gate. - Pick order = sort order; one turn at a time (v0 concurrency), scan continues after each. - Selection decisions land in the loop JSONL (task id, chosen/deferred + reason) — auditable. ## Discipline TDD red/green (fake Redmine server pattern exists; add phase-routing and blocked-relation cases), ALL DEV IN DOCKER, docs standard (README config tables updated), push to origin main, NEVER broad pkill. ## Deliverable `REPORT-20260829-0700-dispatcher.md` in `~/.coordinate/inbox-pmo/`: phase map surface, selection rules + defer reasons, test results, how a priority-5 due-today ticket beats a priority-3 no-due one (test cited).