feat(tools): route_advice.py — the routing policy evaluator (M16 16.2)#258
Merged
Conversation
Closes #253. Pure core over os/routing/routing.yaml: labels + asserted flags in -> tier/effort/model + matched-rule rationale out, by monotonic escalation (floor, raises, max-of-matches, order-independent). Loud rejection on load when the spec breaks its own _schema.md invariants - the enforcement ADR-0017 assigned to 16.2. Thin gh shell (--issue, --milestone batch) degrades cleanly to SKIP/exit 2 like pr_review.py; --labels mode is fully offline. UTF-8 stdio guard per #128. test_route_advice.py: fixture + shipped spec, escalation, rejection matrix, host/alias resolution, anchor cases; discovered by run_all.py (47 scripts green). Existing tools/*.py gate-coverage applies. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 9, 2026
danielPoloWork
added a commit
that referenced
this pull request
Jul 9, 2026
…rd (#260) The owner enriched the M15 backfill table (Title/Model/Effort columns, ultracode spelled as the Claude Code alias of max); on top: status -> in progress, a delivery record (16.1 #257 / 16.2 #258 merged, 16.3 #259 open, 16.4 queued on M15 #239), and the backfill marked APPLIED 2026-07-09 (owner-approved; Routing: lines written to #234-#250). Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #253 (M16 16.2). Plan:
.issues/M16-model-effort-routing-milestone.md· Policy: #257 (16.1, ADR-0017).What
tools/route_advice.py— theos/routingpolicy as a tool, same architecture aspr_review.py(#107): a pure fixture-tested core + a thinghshell that degrades cleanly.advise(signals, spec, host)— monotonic escalation exactly as_schema.mdspecifies: start at the
defaultsfloor, every matched rule raises to at least itsmin_tier/min_effort, final = max. Deterministic and order-independent (tested withreversed signal order). Output: tier / effort / current model for the catalog host / the
matched rules with their
why— so the human sees the reasoning they may overrule.spec_problems) — the enforcement ADR-0017 assigned to 16.2: aspec that parses but references an unknown tier/effort/flag, a host missing a tier's model, an
alias to an unknown effort, an examples verdict outside
tiers, a rule that can raisenothing — all fail at load, never misroute silently. A typo'd asserted flag is rejected the
same way (
signals_for); unknown labels stay legal (the tracker owns that vocabulary).--labels a,b,c [--flags …]fully offline;--issue Nfetches oneissue's labels;
--milestone "T"batch — one advice line per open issue (the 16.3/eados statussurface). Theghshell degrades toSKIP/ exit 2 likepr_review.py.normalize_effort()maps host vocabulary to the OS scale ("ultracode" →max).tools/*.pygate-coverage applies.Dogfood (live, this repo)
--milestone "M15 …"printed all 17 open issues; label-only advice matches the reviewedbackfill table wherever labels suffice (#234 frontier/high, #238 fast/low, #241 frontier/high,
#235 standard/high…) and correctly under-routes exactly the issues whose table row depends on an
asserted flag (e.g. #247 → standard/high from labels;
sets-pattern/decision-heavyraise it tothe table's frontier/max) — the documented flag mechanism, which the #254 backfill records
per-issue. With flags:
--labels "adr,severity:high" --flags decision-heavy→frontier-reasoning/max (Fable 5).Verification
test_route_advice.py: fixture spec + the shipped instance under loud rejection, theescalation matrix, 11 invariant-violation rejections, host/alias resolution, the ratified M16
anchor cases, formatting. Discovered suite: 47/47 OK (
run_all.py— no ci.yml changeneeded per tests: CI test enumeration is hand-maintained in two places and ungated — add a discovery runner #168).
eados_lint.pyself-lint: OK.🤖 Generated with Claude Code