Skip to content

feat(tools): route_advice.py — the routing policy evaluator (M16 16.2)#258

Merged
danielPoloWork merged 1 commit into
mainfrom
feat/m16-2-route-advice
Jul 9, 2026
Merged

feat(tools): route_advice.py — the routing policy evaluator (M16 16.2)#258
danielPoloWork merged 1 commit into
mainfrom
feat/m16-2-route-advice

Conversation

@danielPoloWork

Copy link
Copy Markdown
Owner

Closes #253 (M16 16.2). Plan: .issues/M16-model-effort-routing-milestone.md · Policy: #257 (16.1, ADR-0017).

What

tools/route_advice.py — the os/routing policy as a tool, same architecture as
pr_review.py (#107): a pure fixture-tested core + a thin gh shell that degrades cleanly.

  • Pure core advise(signals, spec, host) — monotonic escalation exactly as _schema.md
    specifies: start at the defaults floor, every matched rule raises to at least its
    min_tier/min_effort, final = max. Deterministic and order-independent (tested with
    reversed 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.
  • Loud rejection on load (spec_problems) — the enforcement ADR-0017 assigned to 16.2: a
    spec 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 raise
    nothing — 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).
  • Three input modes: --labels a,b,c [--flags …] fully offline; --issue N fetches one
    issue's labels; --milestone "T" batch — one advice line per open issue (the 16.3
    /eados status surface). The gh shell degrades to SKIP / exit 2 like pr_review.py.
  • normalize_effort() maps host vocabulary to the OS scale ("ultracode" → max).
  • UTF-8 stdio guard per Tooling: force UTF-8 stdout — crash/mojibake on non-UTF-8 (Windows cp1252) consoles #128; no new dependencies; existing tools/*.py gate-coverage applies.

Dogfood (live, this repo)

--milestone "M15 …" printed all 17 open issues; label-only advice matches the reviewed
backfill 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-heavy raise it to
the 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

🤖 Generated with Claude Code

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>
@danielPoloWork danielPoloWork added the enhancement New feature or request label Jul 9, 2026
@danielPoloWork danielPoloWork self-assigned this Jul 9, 2026
@danielPoloWork danielPoloWork marked this pull request as ready for review July 9, 2026 20:36
@danielPoloWork danielPoloWork merged commit 9623df9 into main Jul 9, 2026
2 checks passed
@danielPoloWork danielPoloWork deleted the feat/m16-2-route-advice branch July 9, 2026 20:36
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[16.2] tools/route_advice.py — pure evaluator: issue signals → recommended tier + effort + rationale

1 participant