Documentation Index
Fetch the complete documentation index at: https://opensre.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Routing Policy Architecture (ADR)
Status
Accepted — May 21, 2026.Context
The interactive-shell routing policy had grown through layered heuristics in single modules. Rule precedence was implicit in code order, postprocessing mixed normalization with fail-closed policy checks, and backward-compat tuple handling leaked into orchestration paths.Decision
- Deterministic mapping is split into declarative rule packs with one explicit precedence table.
- Rule matching windows are named typed strategies instead of inline numeric slices.
- Planner postprocessing runs as pure transforms over a typed
PlannerState. - Fail-closed policy transforms and normalization transforms are registered separately and executed in one ordered list.
- Legacy planner-result tuple compatibility is collapsed behind a single adapter (
planner_result_adapter.py). - Routing contracts include policy-trace artifacts to detect silent precedence drift.
Precedence Model
Deterministic mapper precedence is declared inRULE_PRECEDENCE in:
app/cli/interactive_shell/routing/handle_message_with_agent/orchestration/slash_commands/mapper_runner.py
Current order:
synthetic_suiteregistry_commandsintegration_detailsfallback_provider_switchfallback_sample_alertfallback_investigationfallback_implementationfallback_task_cancelfallback_shell
Extension Guide
When adding a new routing rule or transform:- Add rule/transform implementation in the appropriate module (
rule_sets/*orpostprocessing.py). - Add one explicit entry to the precedence/transform list.
- Add/adjust contract fixtures in:
app/cli/interactive_shell/routing/tests/contracts/policy_contracts.yml
- Add invariants or behavior tests for ordering, dedupe, and fail-closed behavior.
- Ensure complexity guardrails continue to pass.
New Rule Checklist
- Rule has a clear typed contract (input/output and side effects).
- Rule is registered in the explicit precedence table.
- Policy trace fixture updated with expected rule hit(s).
- Golden mapping/postprocessing contracts updated.
- Invariant tests cover order and fail-closed behavior.
- Complexity guardrail test still passes.
Tracer