cotcodec / harness/routing
Purpose
Routing chooses an orchestration condition per visible message from explicit, auditable features rather than using one condition globally.
Mental model & key files
features.pyextracts message/state features available at decision time.policy.pymaps those features to a condition and records the decision.- Optimization and evaluation live outside the online policy so frozen policies remain reproducible.
Patterns to follow / invariants
- Features must be available strictly before the routed outcome.
- Record feature values, policy version/hash, selected arm, and fallback reason.
- Keep a fixed-condition baseline and charge routing overhead to the routed arm.
- Fail closed or use a preregistered fallback for unknown message types.
Common tasks → first action
- Feature change: prove no future-label leakage and update serialization tests.
- Policy change: freeze a new version and compare against fixed-arm baselines.
Gotchas
- A router trained and evaluated on the same tasks is not a valid routing result.
- Model self-reports are not free features; count their tokens, latency, and risk.