From 6982bc05e586f8af10cf110ad9224d449e93b58f Mon Sep 17 00:00:00 2001 From: Bryan <28662377+bryanwieg@users.noreply.github.com> Date: Tue, 24 Nov 2026 00:51:09 +0000 Subject: [PATCH 01/10] Plan: limit Fable for implementation (quick plan) Co-Authored-By: Claude Opus 5.5 --- docs/plans/fable-limits/01-fable-limits.md | 117 ++++++++++++++++++ docs/plans/fable-limits/design.md | 29 +++++ docs/plans/fable-limits/models-available.json | 14 +++ docs/plans/fable-limits/models.md | 46 +++++++ 4 files changed, 206 insertions(+) create mode 100644 docs/plans/fable-limits/01-fable-limits.md create mode 100644 docs/plans/fable-limits/design.md create mode 100644 docs/plans/fable-limits/models-available.json create mode 100644 docs/plans/fable-limits/models.md diff --git a/docs/plans/fable-limits/01-fable-limits.md b/docs/plans/fable-limits/01-fable-limits.md new file mode 100644 index 0000000..c8b4441 --- /dev/null +++ b/docs/plans/fable-limits/01-fable-limits.md @@ -0,0 +1,117 @@ +# Phase 01: Tier rule and premium ratio gate + +Implement with the implement-in-phases skill; do not build from this file +without it. Model tiers map to models in [models.md](models.md). +Status: planned +Before: `tier` makes any stage with J, C or K at 2 `top`, and `route` takes the premium pair above the standard pick whenever the standard pairs run out before a requested step up, so Fable high and Fable low are the usual picks. +After: `top` comes only from a total of 9 or more, and a premium step-up below `top` needs a score/cost ratio at least the standard pick's, except on a `--up` retry. model-selection.md and docs/model-routing.md describe both rules. + +## Assumptions +- Verified: `select-models.py` takes its tier from plan-check.py's `tier` through `stage_tier`, so one change covers planning and routing. (plugins/phased-delivery/scripts/select-models.py:480-485) +- Verified: Each route candidate carries `score` and `cost` (the benchmark run cost), which the frontier already compares. (plugins/phased-delivery/scripts/select-models.py:488-493, frontier) + +## Size + +Quick plan: +- plan-mode.py sketch: quick, score 6.0 +- tier rule (interface, plan_check.tier): 3.0 +- premium step-up ratio gate (internal): 1 +- docs and tests (internal): 2 + +## Outcome tests +Budget: The plugin suite stays under a minute. + +| Outcome | Test | Written in | Passes from | +| --- | --- | --- | --- | +| `select-models.py route` for a stage scored J1F1R1C1K2P1V0S0 (total 7) prints tier `middle+`, not `top`; a stage totalling 9 or more still prints `top`. | `plugins/phased-delivery/tests/test_select_models.py::test_route_fable_limits` | 01.1 | 01.1 | +| When the standard pairs run out before a `middle+` or risk step, `route` prints the premium pair above the standard pick only when its score/cost ratio is at least the standard pick's, and otherwise the standard pick with the reason in `why`; with `--up 1` it still prints the premium pair. | `plugins/phased-delivery/tests/test_select_models.py::test_route_fable_limits` | 01.1 | 01.1 | + +## Stages + +| Stage | Goal | Tier | Order | Status | +| --- | --- | --- | --- | --- | +| 01.1 | `tier` makes `top` only from a total of 9 or more, and `route` takes a premium step-up below `top` only when its score/cost ratio is at least the standard pick's or the step is a `--up` retry. | middle | first | planned | +| 01.2 | model-selection.md and docs/model-routing.md state the new tier rule and the ratio gate, with the measurement that led to them. | middle | after 01.1 | planned | + +## 01.1 Tier rule, ratio gate and test + +Goal: `tier` makes `top` only from a total of 9 or more, and `route` takes a premium step-up below `top` only when its score/cost ratio is at least the standard pick's or the step is a `--up` retry. + +Context: +- `plugins/phased-delivery/scripts/plan-check.py:97-98`: The override that makes J, C or K at 2 `top`. +- `plugins/phased-delivery/scripts/select-models.py:619-622`: The step-up branch of the premium gate below top. +- `plugins/phased-delivery/tests/test_select_models.py:122`: The existing premium gate test and its edited-profiles pattern to follow. +- Design, Rules: "`top` comes only from a total of 9 or more." +- Design, Rules: "A `--up` retry after a failed build still steps up" + +Contracts: +- function `tier` (provides; plugins/phased-delivery/scripts/select-models.py): tier(mb: dict of J F R C K P V S scores) -> (total, tier, why); top only when total >= 9 + +Files: +- `plugins/phased-delivery/scripts/plan-check.py` (edit): `tier` without the J, C or K = 2 override +- `plugins/phased-delivery/scripts/select-models.py` (edit): the premium gate's step-up branch checks the score/cost ratio unless `--up` was given +- `plugins/phased-delivery/tests/test_select_models.py` (edit): `test_route_fable_limits` and any expectations the tier change moves + +Behaviour: +- Given scores totalling 8 or less with J, C or K at 2, when `tier` runs, then the tier is `middle+` (a measure at 2 on `middle`), not `top`. +- Given scores totalling 9 or more, when `tier` runs, then the tier is `top`, as before. +- Given a middle+ or risk step below top where the standard pairs run out and the premium pair above has a lower score/cost ratio than the standard pick, when `route` runs without `--up`, then it prints the standard pick, and `why` says the premium pair was left out for its score/cost ratio. +- Given the same stage, when `route` runs with `--up 1`, then it prints the premium pair above the standard pick, as before. +- Given a premium pair whose ratio is at least the standard pick's, when `route` runs, then the step up takes it, as before. + +External inputs: +none + +Tests: +- writes `plugins/phased-delivery/tests/test_select_models.py::test_route_fable_limits` (outcome): `select-models.py route` for a stage scored J1F1R1C1K2P1V0S0 (total 7) prints tier `middle+`, not `top`; a stage totalling 9 or more still prints `top`. +- writes `plugins/phased-delivery/tests/test_select_models.py::test_route_fable_limits` (outcome): When the standard pairs run out before a `middle+` or risk step, `route` prints the premium pair above the standard pick only when its score/cost ratio is at least the standard pick's, and otherwise the standard pick with the reason in `why`; with `--up 1` it still prints the premium pair. +- keeps passing `plugins/phased-delivery/tests/test_select_models.py::test_route_premium_below_top` (integration): the cost-and-score rule and the --up step still hold + +Done when: +- `python3 -m pytest -q -p no:cacheprovider --basetemp=/cache/pytest-r plugins/phased-delivery/tests` passes + +Out of scope: +- The floors, caps and other route rules +- The plan's recorded tiers in existing phase files + +Model basis: J1 F1 R1 C1 K0 P1 V0 S0 = 5 -> middle + +## 01.2 Docs for the new rules + +Goal: model-selection.md and docs/model-routing.md state the new tier rule and the ratio gate, with the measurement that led to them. + +Context: +- Builds on 01.1: the new tier rule and ratio gate to describe +- `plugins/phased-delivery/skills/plan-in-phases/model-selection.md:46`: Override 1, which is removed. +- `plugins/phased-delivery/skills/plan-in-phases/model-selection.md:200`: The route table row the ratio rule joins. +- `docs/model-routing.md:94-95`: The routing notes' premium rule list. +- Design, Problem: "Fable at +medium thinking or above should be for the top 10% most complex tasks" + +Contracts: +none + +Files: +- `plugins/phased-delivery/skills/plan-in-phases/model-selection.md` (edit): overrides without J, C or K = 2 to top, examples re-scored, and the ratio rule in the route table +- `docs/model-routing.md` (edit): the rule change and the 38-stage measurement + +Behaviour: +- Given a planner reading model-selection.md, when it picks a tier, then nothing tells it a single 2 means top. + +External inputs: +none + +Tests: +none + +Done when: +- `grep -n 'K = 2: use' plugins/phased-delivery/skills/plan-in-phases/model-selection.md` finds nothing + +Out of scope: +- implement-in-phases guides + +Model basis: J1 F1 R0 C0 K0 P1 V1 S0 = 4 -> middle + +## Notes +- 2026-11-24: measured before the change: 15 of 38 scored stages routed to Fable high, 10 to Fable low; with the override dropped, 2 to Fable high (5%). +- The ratio uses the profiles' `score` and benchmark run `cost` that `route` already compares; no new data. Reason: The selector's frontier already ranks pairs by those two numbers. diff --git a/docs/plans/fable-limits/design.md b/docs/plans/fable-limits/design.md new file mode 100644 index 0000000..b9a61a3 --- /dev/null +++ b/docs/plans/fable-limits/design.md @@ -0,0 +1,29 @@ +# Fable limits for implementation: design + +Agreed with the user on 2026-11-24. + +## Problem + +Across the 38 stages scored in this repository's plans and eval tasks, `route` +sends 15 (39%) to Fable high and 10 more to Fable low. Ten of the fifteen +`top` stages reach it only through K = 2, with totals of 5 to 7. Fable at +medium thinking or above should be for the top 10% most complex tasks; picking +it this often means the implementation criteria are not tuned. + +## Rules + +- `top` comes only from a total of 9 or more. The override "J = 2, C = 2 or + K = 2: use top" is dropped; a measure at 2 still raises `middle` to + `middle+`. +- Fable low as a step up is fine as long as it beats Opus high in + cost/performance ratio. Codified for any premium pair below `top`: when the + standard pairs run out before a step up the stage asked for (`middle+` or + risk), the premium pair above the standard pick is taken only when its score + divided by its benchmark run cost is at least the standard pick's; otherwise + the standard pick stays. A `--up` retry after a failed build still steps up, + because the standard pick has already failed. + +## Check + +On the 38 scored stages with the current profiles, Fable at medium or above is +picked for at most 10% of stages. diff --git a/docs/plans/fable-limits/models-available.json b/docs/plans/fable-limits/models-available.json new file mode 100644 index 0000000..42422f4 --- /dev/null +++ b/docs/plans/fable-limits/models-available.json @@ -0,0 +1,14 @@ +{ + "tool": "claude-code", + "tool_version": "2.1.330", + "looked_up_from": "Agent tool parameter description (model and effort enums), 2026-11-23", + "subagent_model_choice": "allowed", + "opted_in": true, + "opt_in_where": "phased-delivery skills set model and effort per models.md", + "models": [ + {"id": "fable", "efforts": ["low", "medium", "high", "xhigh", "max"]}, + {"id": "opus", "efforts": ["low", "medium", "high", "xhigh", "max"]}, + {"id": "sonnet", "efforts": ["low", "medium", "high", "xhigh", "max"]}, + {"id": "haiku", "efforts": ["low", "medium", "high", "xhigh", "max"]} + ] +} diff --git a/docs/plans/fable-limits/models.md b/docs/plans/fable-limits/models.md new file mode 100644 index 0000000..e689549 --- /dev/null +++ b/docs/plans/fable-limits/models.md @@ -0,0 +1,46 @@ +# Models + +Generated by `scripts/select-models.py` from `models-available.json` and +the plugin's `model-profiles.json`; rerun it rather than editing this file. + +Looked up: claude-code 2.1.330, from Agent tool parameter description (model and effort enums), 2026-11-23 +Profiles: 438ab73a830ba4736e7ab9e51196e3b2c0ccfdc3ce65c2a7889d70081e9d9749 (data checked 2026-11-21); Data: Artificial Analysis (https://artificialanalysis.ai) +Subagent model choice: allowed +Score: intelligence; cost: run_cost_usd; best score 61.8; floors: top 97%, middle 85%, small 50%; cheaper within 3 points wins + +| Tier | Model | Effort | Score | Cost | Report row | +| --- | --- | --- | --- | --- | --- | +| small | haiku | xhigh | 34.6 | 192.70 | Claude Haiku 5.5 (Xhigh) | +| middle | opus | high | 51.8 | 2715.98 | Claude Opus 5.5 (High, Default Fallback) | +| middle+ | fable | low | 53.9 | 2861.78 | Claude Fable 5.2 (Low, Default Fallback) | +| top | fable | high | 61.8 | 7105.77 | Claude Fable 5.2 (High, Default Fallback) | + +Matches (tool model -> report model): +- fable -> Claude Fable 5.2 (alias: newest release containing the name) +- opus -> Claude Opus 5.5 (alias: newest release containing the name) +- sonnet -> Claude Sonnet 5.5 (alias: newest release containing the name) +- haiku -> Claude Haiku 5.5 (alias: newest release containing the name) + +Candidates considered: +- fable at high: score 61.8, cost 7105.77 +- fable at medium: score 56.4, cost 3359.66 +- fable at low: score 53.9, cost 2861.78 +- opus at high: score 51.8, cost 2715.98 +- opus at medium: score 48.2, cost 2031.27 +- sonnet at high: score 41.5, cost 1268.30 +- opus at low: score 34.8, cost 979.66 +- haiku at xhigh: score 34.6, cost 192.70 +- sonnet at medium: score 30.8, cost 679.16 +- haiku at high: score 29.9, cost 121.41 +- sonnet at low: score 25.6, cost 499.20 +- haiku at medium: score 24.6, cost 72.70 +- haiku at low: score 18.6, cost 39.60 + +Excluded: +- fable at max: denied: above this model's high ceiling +- fable at xhigh: denied: above this model's high ceiling +- opus at max: denied: above this model's high ceiling +- opus at xhigh: denied: above this model's high ceiling +- sonnet at max: denied: above this model's high ceiling +- sonnet at xhigh: denied: above this model's high ceiling +- haiku at max: denied: above this model's xhigh ceiling From 777011ad8cadc1de503d1746012d866b1d1df77b Mon Sep 17 00:00:00 2001 From: Bryan <28662377+bryanwieg@users.noreply.github.com> Date: Tue, 24 Nov 2026 00:53:10 +0000 Subject: [PATCH 02/10] 01.1 Tier rule, ratio gate and test Stage: 01.1 Plan: docs/plans/fable-limits/01-fable-limits.md Tier: middle Tool: claude-code Model: orchestrator Effort: default Attempt: 1 Tokens: unknown Cost: unknown Tool-Calls: unknown Co-Authored-By: Claude Opus 5.5 --- plugins/phased-delivery/scripts/plan-check.py | 2 -- .../phased-delivery/scripts/select-models.py | 12 ++++++-- .../tests/test_select_models.py | 30 ++++++++++++++++--- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/plugins/phased-delivery/scripts/plan-check.py b/plugins/phased-delivery/scripts/plan-check.py index 6c814a0..3e4af2f 100644 --- a/plugins/phased-delivery/scripts/plan-check.py +++ b/plugins/phased-delivery/scripts/plan-check.py @@ -94,8 +94,6 @@ def quote_found(q, text): def tier(mb): total = sum(mb[m] for m in MEASURES) - if mb["J"] == 2 or mb["C"] == 2 or mb["K"] == 2: - return total, "top", "J, C or K = 2" t, why = ("small" if total <= 3 else "middle" if total <= 8 else "top"), "" if t == "small" and not (all(mb[m] == 0 for m in "JCKS") and mb["P"] == 0 and mb["V"] == 0): t, why = "middle", "small only for mechanical stages" diff --git a/plugins/phased-delivery/scripts/select-models.py b/plugins/phased-delivery/scripts/select-models.py index f63ddba..e6cb0c1 100755 --- a/plugins/phased-delivery/scripts/select-models.py +++ b/plugins/phased-delivery/scripts/select-models.py @@ -616,8 +616,16 @@ def route_main(args): # unless the standard pairs cannot give a step up the stage asked for: # the next model up at low thinking beats more thinking on a smaller one. other, other_notes, other_short, _ = pick_pair(standard, tier, best, scores, signals, *steps) - if other is not None and other_short and choice["score"] > other["score"]: - choice = next(c for c in front if c["score"] > other["score"]) # front is cheapest first + above = next((c for c in front if c["score"] > other["score"]), None) if other else None # cheapest first + if other is not None and other_short and above is not None and not options.up \ + and above["score"] / above["cost"] < other["score"] / other["cost"]: + # A step up the plan asked for (middle+ or risk) takes a premium pair only + # when it is worth its price: a score/cost ratio at least the standard pick's. + notes = other_notes + [f"premium {above['label']} left out below top: its score/cost " + f"is below {other['label']}'s"] + choice = other + elif other is not None and other_short and choice["score"] > other["score"]: + choice = above notes = other_notes + [f"no standard pair above {other['label']} for the step up: " f"{choice['label']}, the cheapest pair above it"] elif other is not None and (choice["cost"] > other["cost"] or choice["score"] < other["score"]): diff --git a/plugins/phased-delivery/tests/test_select_models.py b/plugins/phased-delivery/tests/test_select_models.py index cd75503..6e3dff9 100644 --- a/plugins/phased-delivery/tests/test_select_models.py +++ b/plugins/phased-delivery/tests/test_select_models.py @@ -95,8 +95,8 @@ def test_route_stage_signals(offered, tmp_path): assert pair(route(offered, "J0F2R0C0K0P0V0S0")) == ("terra", "low") # F2 prefers the faster close pair: top is astra high, sol high is faster. assert pair(route(offered, "J1F2R1C1K0P2V2S0")) == ("sol", "high") - # J2 moves up the model before the thinking level: nova low costs 1.33x astra high. - assert pair(route(offered, "J2F1R0C0K0P0V0S0")) == ("nova", "low") + # J2 on a top stage (total 9) moves up the model before the thinking level: nova low costs 1.33x astra high. + assert pair(route(offered, "J2F1R1C2K0P2V1S0")) == ("nova", "low") # Risk moves one frontier pair up from the middle pick, terra high. assert pair(route(offered, "J1F1R0C0K1P0V0S0")) == ("sol", "low") # The J2 preference never undoes the risk step: without astra and sol high, @@ -105,8 +105,8 @@ def test_route_stage_signals(offered, tmp_path): narrow.write_text(json.dumps({**OFFERED, "models": [ m if m["id"] != "gpt-9-sol" else {**m, "efforts": ["low", "medium"]} for m in OFFERED["models"] if m["id"] != "gpt-9-astra"]})) - assert pair(route(narrow, "J2F1R0C0K0P0V0S0")) == ("nova", "low") - assert pair(route(narrow, "J2F1R0C0K1P0V0S0")) == ("nova", "medium") + assert pair(route(narrow, "J2F1R1C2K0P2V1S0")) == ("nova", "low") + assert pair(route(narrow, "J2F1R1C2K1P2V0S0")) == ("nova", "medium") def edited_profiles(tmp_path, changes): @@ -136,6 +136,28 @@ def test_route_premium_below_top(offered, tmp_path): assert pair(short) == ("nova", "low") and "step up" in short["why"] +def test_route_fable_limits(tmp_path): + # A single 2 no longer makes a stage top: K2 at total 7 is middle+; a total of 9 is top. + offered_path = tmp_path / "offered.json" + offered_path.write_text(json.dumps(OFFERED)) + assert route(offered_path, "J1F1R1C1K2P1V0S0")["tier"] == "middle+" + assert route(offered_path, "J2F1R1C2K0P2V1S0")["tier"] == "top" + # Without sol and terra xhigh, the standard pairs end at the middle pick, terra + # high (51.2 for 90, 0.57 per unit), so the middle+ step reaches astra high + # (58.5 for 300, 0.20): a worse score/cost ratio, so terra high stays. + narrow = tmp_path / "narrow.json" + narrow.write_text(json.dumps({**OFFERED, "models": [ + m if m["id"] != "gpt-9-terra" else {**m, "efforts": ["low", "medium", "high"]} + for m in OFFERED["models"] if m["id"] != "gpt-9-sol"]})) + held = route(narrow, "J1F1R0C0K0P2V0S0") + assert pair(held) == ("terra", "high") and "score/cost" in held["why"] + # A --up retry after a failure still steps up to the premium pair. + assert pair(route(narrow, "J1F1R0C0K0P2V0S0", "--up", "1")) == ("astra", "high") + # A premium pair worth its price (58.5 for 100, 0.59) is taken for the step. + cheap = edited_profiles(tmp_path, {("GPT-9 Astra", "high"): {"run_cost_usd": 100}}) + assert pair(route(narrow, "J1F1R0C0K0P2V0S0", profiles=cheap)) == ("astra", "high") + + def test_route_speed_gain(offered, tmp_path): # sol high at 45 is only 1.125x astra high's 40: under SPEED_GAIN, so F2 keeps astra. slow = edited_profiles(tmp_path, {("GPT-9 Sol", "high"): {"speed": 45}}) From be2c45d5c39bfd14e56cadd3beef99b81394d679 Mon Sep 17 00:00:00 2001 From: Bryan <28662377+bryanwieg@users.noreply.github.com> Date: Tue, 24 Nov 2026 00:53:43 +0000 Subject: [PATCH 03/10] 01.2 Docs for the new rules Stage: 01.2 Plan: docs/plans/fable-limits/01-fable-limits.md Tier: middle Tool: claude-code Model: orchestrator Effort: default Attempt: 1 Tokens: unknown Cost: unknown Tool-Calls: unknown Co-Authored-By: Claude Opus 5.5 --- docs/model-routing.md | 16 +++++++++++++- .../skills/plan-in-phases/model-selection.md | 21 +++++++++++-------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/docs/model-routing.md b/docs/model-routing.md index 4448ad0..cf9f1f8 100644 --- a/docs/model-routing.md +++ b/docs/model-routing.md @@ -98,7 +98,11 @@ How it works now: risk, `--up`), the cheapest pair above the standard pick is taken. The user's view, from practice: more thinking scores well on benchmarks but can do worse on real work, so the next model up at low thinking beats a - smaller model above high. Hence Opus stays capped at `high`; + smaller model above high. Hence Opus stays capped at `high`. Since + 2026-11-24 that step takes the premium pair only when its score/cost + ratio is at least the standard pick's (the user's rule: Fable low is + fine as long as it beats Opus high in cost/performance), except on a + `--up` retry after a failed build; - reviews (`--review`) run on `top` and ignore the stage's scores. - **Rule sweep, 2026-11-23** (free: all 6,561 score combinations through `route` on the live profiles): @@ -116,6 +120,16 @@ How it works now: medium. - The J2/C2 preference never fires: no pair scores at least Fable high at a lower thinking level. It waits for a larger model. +- **Fable limits, 2026-11-24:** Fable at medium thinking or above should be + for the top 10% most complex stages. On the 38 stages scored in this + repository's plans and eval tasks, `route` sent 15 (39%) to Fable high + and 10 to Fable low; 10 of the 15 `top` stages got there only through + K = 2, at totals of 5 to 7. Two changes: `top` comes only from a total of + 9 or more (the "J, C or K = 2" override is gone), and the premium step-up + above needs the better score/cost ratio. After: 2 stages (5%) on Fable + high, both totalling 9; none on Fable low (on the current profiles Fable + 5.2 low scores 0.0188 points per unit of run cost, Opus 5.5 high 0.0191); + 28 on Opus high; 8 on Haiku xhigh. - **Limits:** a token cap per stage (150k `small`, 400k `middle` and `middle+`, 1M `top`) passed to `claude -p` as a dollar cap at the pair's input price, since `--max-budget-usd` is the hard stop it offers. A build diff --git a/plugins/phased-delivery/skills/plan-in-phases/model-selection.md b/plugins/phased-delivery/skills/plan-in-phases/model-selection.md index 7679399..f67fbdf 100644 --- a/plugins/phased-delivery/skills/plan-in-phases/model-selection.md +++ b/plugins/phased-delivery/skills/plan-in-phases/model-selection.md @@ -41,11 +41,14 @@ stage's pair from its eight scores (see "Route each stage"). | 4–8 | `middle` | | 9–16 | `top` | +A single measure at 2 does not make a stage `top`: only a total of 9 or +more does. (Changed 2026-11-24: the old override, any of J, C or K at 2 +means `top`, sent 39% of stages to the most expensive pair.) A measure at 2 +raises `middle` to `middle+` (override 2). + Overrides, which always win over the total: -1. **J = 2, C = 2 or K = 2: use `top`.** Open-ended design, shared - contracts and stacked risk are where weaker models fail quietly. -2. **`small` only for mechanical stages:** J, C, K and S all 0, P = 0 (the +1. **`small` only for mechanical stages:** J, C, K and S all 0, P = 0 (the brief names a near-identical example) and V = 0 (every "Done when" item is a command). Otherwise use at least `middle`, whatever the total. The cheapest candidates do well at writing out a precise change and poorly @@ -53,7 +56,7 @@ Overrides, which always win over the total: accounting accurately for their own actions; `small` work must need none of those, and its builder's report is never taken as evidence (see implement-in-phases). -3. **`middle` with any measure at 2: use `middle+`**, the next more capable +2. **`middle` with any measure at 2: use `middle+`**, the next more capable candidate above the `middle` pick in `models.md`. ## Choose the model and thinking level: the plan's model table @@ -197,7 +200,7 @@ What `route` does, in this order: | Risk (K of 1 or more) | One frontier pair up. | | Design or contract (J = 2 or C = 2) | Among pairs meeting the floor that score at least the pick and cost at most 1.5 times it, the lowest thinking level: a larger model at lower thinking. | | Long or wide (S, R or F = 2) | Among pairs meeting the floor within 3 points of the pick (with K of 1 or more, at least the risk step's score) and costing at most 1.5 times it, the fastest, if at least 1.2 times the pick's speed (thinking levels of one model differ by a few percent). | -| Premium below `top` | A premium pick below `top` is routed again without premium pairs; the premium pair stays only if it costs no more than that standard pick and scores at least as well. When the standard pairs run out before a step up the stage asked for (`middle+`, risk, `--up`), the cheapest pair scoring above the standard pick is taken instead: the next model up at low thinking, not more thinking on a smaller model. | +| Premium below `top` | A premium pick below `top` is routed again without premium pairs; the premium pair stays only if it costs no more than that standard pick and scores at least as well. When the standard pairs run out before a step up the stage asked for (`middle+`, risk, `--up`), the cheapest pair scoring above the standard pick is taken instead (the next model up at low thinking, not more thinking on a smaller model), but only when its score divided by its benchmark run cost is at least the standard pick's; otherwise the standard pick stays. A `--up` retry after a failed build takes it regardless. | | `--down N`, `--up N` | Move N frontier pairs cheaper or dearer from the pick, stopping at either end. N is 0 or more; not both at once. | | `--review` | `top`, ignoring premium spend and the stage's scores (no caps, risk step or preferences). | @@ -269,14 +272,14 @@ dispatch. neighboring entry the brief names, and add one test: J0 F1 R0 C0 K0 P0 V0 S0 = 1 -> `small`. - Change a function, run its tests, expect one named test to fail, then - update that test: J0 F1 R0 C0 K0 P0 V0 S2 = 3 -> override 2 -> `middle`. + update that test: J0 F1 R0 C0 K0 P0 V0 S2 = 3 -> override 1 -> `middle`. - Fill in the body of a planned parser function against a defined signature, reading a config file another tool writes, with tests: J1 F1 R1 C1 K1 P1 V0 S0 = 6 -> `middle`. - Same parser, but the input format must be inferred from samples and the - brief leaves the error-handling approach open: J2 ... -> override 1 -> - `top`. Better still, the planner should settle the approach and - re-score. + brief leaves the error-handling approach open: J2 F1 R1 C1 K1 P1 V0 S0 + = 7 -> override 2 -> `middle+`. Better still, the planner should settle + the approach and re-score. - Replace the session store with a new one, migrating stored sessions and retiring the old path: J1 F2 R2 C2 K2 P2 V1 S1 = 13 -> `top`. From 8616a489b7ce0c006d5e3d7d316554b24264e7e6 Mon Sep 17 00:00:00 2001 From: Bryan <28662377+bryanwieg@users.noreply.github.com> Date: Tue, 24 Nov 2026 00:57:42 +0000 Subject: [PATCH 04/10] Let a premium step-up win within a 10% score/cost margin Fixes-Stage: 01.1 Tool: claude-code Model: orchestrator Effort: default Tokens: unknown Co-Authored-By: Claude Opus 5.5 --- plugins/phased-delivery/scripts/select-models.py | 10 +++++++--- plugins/phased-delivery/tests/test_select_models.py | 9 ++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/plugins/phased-delivery/scripts/select-models.py b/plugins/phased-delivery/scripts/select-models.py index e6cb0c1..96af229 100755 --- a/plugins/phased-delivery/scripts/select-models.py +++ b/plugins/phased-delivery/scripts/select-models.py @@ -99,6 +99,10 @@ # A long or wide stage takes a faster pair only at this multiple of the pick's # speed: thinking levels of one model differ by a few percent, which is noise. SPEED_GAIN = 1.2 +# A premium step-up below top is taken while its score per unit of run cost is +# no more than this fraction worse than the standard pick's: a near tie goes to +# the larger model, which may need fewer tokens than the benchmark shows. +PREMIUM_RATIO_MARGIN = 0.10 SCORES_FORM = "J F R C K P V S in that order, each followed by 0, 1 or 2, such as J1F1R0C0K0P0V0S0" HERE = os.path.dirname(os.path.abspath(__file__)) @@ -618,11 +622,11 @@ def route_main(args): other, other_notes, other_short, _ = pick_pair(standard, tier, best, scores, signals, *steps) above = next((c for c in front if c["score"] > other["score"]), None) if other else None # cheapest first if other is not None and other_short and above is not None and not options.up \ - and above["score"] / above["cost"] < other["score"] / other["cost"]: + and above["score"] / above["cost"] < (1 - PREMIUM_RATIO_MARGIN) * other["score"] / other["cost"]: # A step up the plan asked for (middle+ or risk) takes a premium pair only - # when it is worth its price: a score/cost ratio at least the standard pick's. + # when it is worth its price: a score/cost ratio within the margin of the standard pick's. notes = other_notes + [f"premium {above['label']} left out below top: its score/cost " - f"is below {other['label']}'s"] + f"is more than {PREMIUM_RATIO_MARGIN:.0%} below {other['label']}'s"] choice = other elif other is not None and other_short and choice["score"] > other["score"]: choice = above diff --git a/plugins/phased-delivery/tests/test_select_models.py b/plugins/phased-delivery/tests/test_select_models.py index 6e3dff9..d155638 100644 --- a/plugins/phased-delivery/tests/test_select_models.py +++ b/plugins/phased-delivery/tests/test_select_models.py @@ -153,9 +153,12 @@ def test_route_fable_limits(tmp_path): assert pair(held) == ("terra", "high") and "score/cost" in held["why"] # A --up retry after a failure still steps up to the premium pair. assert pair(route(narrow, "J1F1R0C0K0P2V0S0", "--up", "1")) == ("astra", "high") - # A premium pair worth its price (58.5 for 100, 0.59) is taken for the step. - cheap = edited_profiles(tmp_path, {("GPT-9 Astra", "high"): {"run_cost_usd": 100}}) - assert pair(route(narrow, "J1F1R0C0K0P2V0S0", profiles=cheap)) == ("astra", "high") + # Within PREMIUM_RATIO_MARGIN the premium pair is taken: 58.5 for 108 is + # 0.54, 5% below terra high's 0.57; 58.5 for 120 (0.49, 14% below) is not. + near = edited_profiles(tmp_path, {("GPT-9 Astra", "high"): {"run_cost_usd": 108}}) + assert pair(route(narrow, "J1F1R0C0K0P2V0S0", profiles=near)) == ("astra", "high") + far = edited_profiles(tmp_path, {("GPT-9 Astra", "high"): {"run_cost_usd": 120}}) + assert pair(route(narrow, "J1F1R0C0K0P2V0S0", profiles=far)) == ("terra", "high") def test_route_speed_gain(offered, tmp_path): From 877e14c1f85d163913e429e78f0ef75b8b06230c Mon Sep 17 00:00:00 2001 From: Bryan <28662377+bryanwieg@users.noreply.github.com> Date: Tue, 24 Nov 2026 00:57:42 +0000 Subject: [PATCH 05/10] Document the 10% score/cost margin Fixes-Stage: 01.2 Tool: claude-code Model: orchestrator Effort: default Tokens: unknown Co-Authored-By: Claude Opus 5.5 --- docs/model-routing.md | 18 +++++++++++------- docs/plans/fable-limits/design.md | 4 ++++ .../skills/plan-in-phases/model-selection.md | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/docs/model-routing.md b/docs/model-routing.md index cf9f1f8..076b2ca 100644 --- a/docs/model-routing.md +++ b/docs/model-routing.md @@ -100,9 +100,11 @@ How it works now: can do worse on real work, so the next model up at low thinking beats a smaller model above high. Hence Opus stays capped at `high`. Since 2026-11-24 that step takes the premium pair only when its score/cost - ratio is at least the standard pick's (the user's rule: Fable low is - fine as long as it beats Opus high in cost/performance), except on a - `--up` retry after a failed build; + ratio is no more than 10% below the standard pick's + (`PREMIUM_RATIO_MARGIN`), except on a `--up` retry after a failed + build. The user's reasoning: Fable is expected to comprehend much better + than Opus and may need fewer tokens at low thinking, so a near tie goes + to Fable low; a clearly worse ratio does not; - reviews (`--review`) run on `top` and ignore the stage's scores. - **Rule sweep, 2026-11-23** (free: all 6,561 score combinations through `route` on the live profiles): @@ -126,10 +128,12 @@ How it works now: and 10 to Fable low; 10 of the 15 `top` stages got there only through K = 2, at totals of 5 to 7. Two changes: `top` comes only from a total of 9 or more (the "J, C or K = 2" override is gone), and the premium step-up - above needs the better score/cost ratio. After: 2 stages (5%) on Fable - high, both totalling 9; none on Fable low (on the current profiles Fable - 5.2 low scores 0.0188 points per unit of run cost, Opus 5.5 high 0.0191); - 28 on Opus high; 8 on Haiku xhigh. + above needs a score/cost ratio within 10% of the standard pick's. After: + 2 stages (5%) on Fable high, both totalling 9; 23 on Fable low, the + `middle+` and risk steps (on the current profiles Fable 5.2 low scores + 0.0188 points per unit of run cost, Opus 5.5 high 0.0191, 1.3% apart); + 5 on Opus high; 8 on Haiku xhigh. A strict "beats" rule was tried first + and rejected: it hinged on that 1.3%. - **Limits:** a token cap per stage (150k `small`, 400k `middle` and `middle+`, 1M `top`) passed to `claude -p` as a dollar cap at the pair's input price, since `--max-budget-usd` is the hard stop it offers. A build diff --git a/docs/plans/fable-limits/design.md b/docs/plans/fable-limits/design.md index b9a61a3..89a2c0b 100644 --- a/docs/plans/fable-limits/design.md +++ b/docs/plans/fable-limits/design.md @@ -22,6 +22,10 @@ it this often means the implementation criteria are not tuned. divided by its benchmark run cost is at least the standard pick's; otherwise the standard pick stays. A `--up` retry after a failed build still steps up, because the standard pick has already failed. +- Revised the same day: the user is "ok for now with letting fable low win + if the cost is within an appropriate margin", since Fable should comprehend + better and may need fewer tokens at low thinking. The premium pair's ratio + may be up to 10% below the standard pick's (`PREMIUM_RATIO_MARGIN`). ## Check diff --git a/plugins/phased-delivery/skills/plan-in-phases/model-selection.md b/plugins/phased-delivery/skills/plan-in-phases/model-selection.md index f67fbdf..fb02659 100644 --- a/plugins/phased-delivery/skills/plan-in-phases/model-selection.md +++ b/plugins/phased-delivery/skills/plan-in-phases/model-selection.md @@ -200,7 +200,7 @@ What `route` does, in this order: | Risk (K of 1 or more) | One frontier pair up. | | Design or contract (J = 2 or C = 2) | Among pairs meeting the floor that score at least the pick and cost at most 1.5 times it, the lowest thinking level: a larger model at lower thinking. | | Long or wide (S, R or F = 2) | Among pairs meeting the floor within 3 points of the pick (with K of 1 or more, at least the risk step's score) and costing at most 1.5 times it, the fastest, if at least 1.2 times the pick's speed (thinking levels of one model differ by a few percent). | -| Premium below `top` | A premium pick below `top` is routed again without premium pairs; the premium pair stays only if it costs no more than that standard pick and scores at least as well. When the standard pairs run out before a step up the stage asked for (`middle+`, risk, `--up`), the cheapest pair scoring above the standard pick is taken instead (the next model up at low thinking, not more thinking on a smaller model), but only when its score divided by its benchmark run cost is at least the standard pick's; otherwise the standard pick stays. A `--up` retry after a failed build takes it regardless. | +| Premium below `top` | A premium pick below `top` is routed again without premium pairs; the premium pair stays only if it costs no more than that standard pick and scores at least as well. When the standard pairs run out before a step up the stage asked for (`middle+`, risk, `--up`), the cheapest pair scoring above the standard pick is taken instead (the next model up at low thinking, not more thinking on a smaller model), but only when its score divided by its benchmark run cost is no more than 10% below the standard pick's (`PREMIUM_RATIO_MARGIN`); otherwise the standard pick stays. A `--up` retry after a failed build takes it regardless. | | `--down N`, `--up N` | Move N frontier pairs cheaper or dearer from the pick, stopping at either end. N is 0 or more; not both at once. | | `--review` | `top`, ignoring premium spend and the stage's scores (no caps, risk step or preferences). | From ac87ae20dc6625c573a6dfeaec033cf6c0b47697 Mon Sep 17 00:00:00 2001 From: Bryan <28662377+bryanwieg@users.noreply.github.com> Date: Tue, 24 Nov 2026 00:59:30 +0000 Subject: [PATCH 06/10] Narrow the premium score/cost margin to 5% Fixes-Stage: 01.1 Tool: claude-code Model: orchestrator Effort: default Tokens: unknown Co-Authored-By: Claude Opus 5.5 --- docs/model-routing.md | 7 ++++--- docs/plans/fable-limits/design.md | 4 +++- plugins/phased-delivery/scripts/select-models.py | 2 +- .../skills/plan-in-phases/model-selection.md | 2 +- plugins/phased-delivery/tests/test_select_models.py | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/model-routing.md b/docs/model-routing.md index 076b2ca..e87e55f 100644 --- a/docs/model-routing.md +++ b/docs/model-routing.md @@ -100,11 +100,12 @@ How it works now: can do worse on real work, so the next model up at low thinking beats a smaller model above high. Hence Opus stays capped at `high`. Since 2026-11-24 that step takes the premium pair only when its score/cost - ratio is no more than 10% below the standard pick's + ratio is no more than 5% below the standard pick's (`PREMIUM_RATIO_MARGIN`), except on a `--up` retry after a failed build. The user's reasoning: Fable is expected to comprehend much better than Opus and may need fewer tokens at low thinking, so a near tie goes - to Fable low; a clearly worse ratio does not; + to Fable low; a clearly worse ratio does not. 5%, not 10%: Fable has its + own quota, and once it is used up builds fall back to Opus anyway; - reviews (`--review`) run on `top` and ignore the stage's scores. - **Rule sweep, 2026-11-23** (free: all 6,561 score combinations through `route` on the live profiles): @@ -128,7 +129,7 @@ How it works now: and 10 to Fable low; 10 of the 15 `top` stages got there only through K = 2, at totals of 5 to 7. Two changes: `top` comes only from a total of 9 or more (the "J, C or K = 2" override is gone), and the premium step-up - above needs a score/cost ratio within 10% of the standard pick's. After: + above needs a score/cost ratio within 5% of the standard pick's. After: 2 stages (5%) on Fable high, both totalling 9; 23 on Fable low, the `middle+` and risk steps (on the current profiles Fable 5.2 low scores 0.0188 points per unit of run cost, Opus 5.5 high 0.0191, 1.3% apart); diff --git a/docs/plans/fable-limits/design.md b/docs/plans/fable-limits/design.md index 89a2c0b..4d8d1a4 100644 --- a/docs/plans/fable-limits/design.md +++ b/docs/plans/fable-limits/design.md @@ -25,7 +25,9 @@ it this often means the implementation criteria are not tuned. - Revised the same day: the user is "ok for now with letting fable low win if the cost is within an appropriate margin", since Fable should comprehend better and may need fewer tokens at low thinking. The premium pair's ratio - may be up to 10% below the standard pick's (`PREMIUM_RATIO_MARGIN`). + may be up to 5% below the standard pick's (`PREMIUM_RATIO_MARGIN`); 5% + rather than 10% because Fable has its own quota, and once it is used up + builds fall back to Opus anyway. ## Check diff --git a/plugins/phased-delivery/scripts/select-models.py b/plugins/phased-delivery/scripts/select-models.py index 96af229..7cefb63 100755 --- a/plugins/phased-delivery/scripts/select-models.py +++ b/plugins/phased-delivery/scripts/select-models.py @@ -102,7 +102,7 @@ # A premium step-up below top is taken while its score per unit of run cost is # no more than this fraction worse than the standard pick's: a near tie goes to # the larger model, which may need fewer tokens than the benchmark shows. -PREMIUM_RATIO_MARGIN = 0.10 +PREMIUM_RATIO_MARGIN = 0.05 SCORES_FORM = "J F R C K P V S in that order, each followed by 0, 1 or 2, such as J1F1R0C0K0P0V0S0" HERE = os.path.dirname(os.path.abspath(__file__)) diff --git a/plugins/phased-delivery/skills/plan-in-phases/model-selection.md b/plugins/phased-delivery/skills/plan-in-phases/model-selection.md index fb02659..3de8851 100644 --- a/plugins/phased-delivery/skills/plan-in-phases/model-selection.md +++ b/plugins/phased-delivery/skills/plan-in-phases/model-selection.md @@ -200,7 +200,7 @@ What `route` does, in this order: | Risk (K of 1 or more) | One frontier pair up. | | Design or contract (J = 2 or C = 2) | Among pairs meeting the floor that score at least the pick and cost at most 1.5 times it, the lowest thinking level: a larger model at lower thinking. | | Long or wide (S, R or F = 2) | Among pairs meeting the floor within 3 points of the pick (with K of 1 or more, at least the risk step's score) and costing at most 1.5 times it, the fastest, if at least 1.2 times the pick's speed (thinking levels of one model differ by a few percent). | -| Premium below `top` | A premium pick below `top` is routed again without premium pairs; the premium pair stays only if it costs no more than that standard pick and scores at least as well. When the standard pairs run out before a step up the stage asked for (`middle+`, risk, `--up`), the cheapest pair scoring above the standard pick is taken instead (the next model up at low thinking, not more thinking on a smaller model), but only when its score divided by its benchmark run cost is no more than 10% below the standard pick's (`PREMIUM_RATIO_MARGIN`); otherwise the standard pick stays. A `--up` retry after a failed build takes it regardless. | +| Premium below `top` | A premium pick below `top` is routed again without premium pairs; the premium pair stays only if it costs no more than that standard pick and scores at least as well. When the standard pairs run out before a step up the stage asked for (`middle+`, risk, `--up`), the cheapest pair scoring above the standard pick is taken instead (the next model up at low thinking, not more thinking on a smaller model), but only when its score divided by its benchmark run cost is no more than 5% below the standard pick's (`PREMIUM_RATIO_MARGIN`); otherwise the standard pick stays. A `--up` retry after a failed build takes it regardless. | | `--down N`, `--up N` | Move N frontier pairs cheaper or dearer from the pick, stopping at either end. N is 0 or more; not both at once. | | `--review` | `top`, ignoring premium spend and the stage's scores (no caps, risk step or preferences). | diff --git a/plugins/phased-delivery/tests/test_select_models.py b/plugins/phased-delivery/tests/test_select_models.py index d155638..643f351 100644 --- a/plugins/phased-delivery/tests/test_select_models.py +++ b/plugins/phased-delivery/tests/test_select_models.py @@ -154,7 +154,7 @@ def test_route_fable_limits(tmp_path): # A --up retry after a failure still steps up to the premium pair. assert pair(route(narrow, "J1F1R0C0K0P2V0S0", "--up", "1")) == ("astra", "high") # Within PREMIUM_RATIO_MARGIN the premium pair is taken: 58.5 for 108 is - # 0.54, 5% below terra high's 0.57; 58.5 for 120 (0.49, 14% below) is not. + # 0.54, 4.8% below terra high's 0.57; 58.5 for 120 (0.49, 14% below) is not. near = edited_profiles(tmp_path, {("GPT-9 Astra", "high"): {"run_cost_usd": 108}}) assert pair(route(narrow, "J1F1R0C0K0P2V0S0", profiles=near)) == ("astra", "high") far = edited_profiles(tmp_path, {("GPT-9 Astra", "high"): {"run_cost_usd": 120}}) From 3f2a80fc3e8a800e7057bef44e534a1ca8a4a585 Mon Sep 17 00:00:00 2001 From: Bryan <28662377+bryanwieg@users.noreply.github.com> Date: Tue, 24 Nov 2026 01:01:41 +0000 Subject: [PATCH 07/10] Fix review findings: ratio gate only for premium step-ups, no division, risk and --down tests Fixes-Stage: 01.1 Tool: claude-code Model: orchestrator Effort: default Tokens: unknown Co-Authored-By: Claude Opus 5.5 --- .../phased-delivery/scripts/select-models.py | 26 ++++++++++--------- .../tests/test_select_models.py | 7 +++++ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/plugins/phased-delivery/scripts/select-models.py b/plugins/phased-delivery/scripts/select-models.py index 7cefb63..f38f9a8 100755 --- a/plugins/phased-delivery/scripts/select-models.py +++ b/plugins/phased-delivery/scripts/select-models.py @@ -620,18 +620,20 @@ def route_main(args): # unless the standard pairs cannot give a step up the stage asked for: # the next model up at low thinking beats more thinking on a smaller one. other, other_notes, other_short, _ = pick_pair(standard, tier, best, scores, signals, *steps) - above = next((c for c in front if c["score"] > other["score"]), None) if other else None # cheapest first - if other is not None and other_short and above is not None and not options.up \ - and above["score"] / above["cost"] < (1 - PREMIUM_RATIO_MARGIN) * other["score"] / other["cost"]: - # A step up the plan asked for (middle+ or risk) takes a premium pair only - # when it is worth its price: a score/cost ratio within the margin of the standard pick's. - notes = other_notes + [f"premium {above['label']} left out below top: its score/cost " - f"is more than {PREMIUM_RATIO_MARGIN:.0%} below {other['label']}'s"] - choice = other - elif other is not None and other_short and choice["score"] > other["score"]: - choice = above - notes = other_notes + [f"no standard pair above {other['label']} for the step up: " - f"{choice['label']}, the cheapest pair above it"] + if other is not None and other_short and choice["score"] > other["score"]: + above = next(c for c in front if c["score"] > other["score"]) # front is cheapest first + # A step up the plan asked for (middle+ or risk) takes a premium pair only while + # its score/cost ratio is within the margin of the standard pick's; a --up retry + # after a failure takes it regardless. Cross-multiplied: costs may be 0. + if above["row"]["premium"] and not options.up and above["score"] * other["cost"] \ + < (1 - PREMIUM_RATIO_MARGIN) * other["score"] * above["cost"]: + choice = other + notes = other_notes + [f"premium {above['label']} left out below top: its score/cost " + f"is more than {PREMIUM_RATIO_MARGIN:.0%} below {other['label']}'s"] + else: + choice = above + notes = other_notes + [f"no standard pair above {other['label']} for the step up: " + f"{choice['label']}, the cheapest pair above it"] elif other is not None and (choice["cost"] > other["cost"] or choice["score"] < other["score"]): notes = other_notes + [f"premium {choice['label']} left out below top: " f"{other['label']} costs less or scores at least as well"] diff --git a/plugins/phased-delivery/tests/test_select_models.py b/plugins/phased-delivery/tests/test_select_models.py index 643f351..b413767 100644 --- a/plugins/phased-delivery/tests/test_select_models.py +++ b/plugins/phased-delivery/tests/test_select_models.py @@ -153,6 +153,13 @@ def test_route_fable_limits(tmp_path): assert pair(held) == ("terra", "high") and "score/cost" in held["why"] # A --up retry after a failure still steps up to the premium pair. assert pair(route(narrow, "J1F1R0C0K0P2V0S0", "--up", "1")) == ("astra", "high") + # The risk step is held the same way, and --up still steps. + risk = route(narrow, "J1F1R0C0K1P0V0S0") + assert pair(risk) == ("terra", "high") and "score/cost" in risk["why"] + assert pair(route(narrow, "J1F1R0C0K1P0V0S0", "--up", "1")) == ("astra", "high") + # A --down retry whose step up lands on a standard pair is not held by the ratio. + down = route(narrow, "J1F1R0C0K1P2V0S0", "--down", "1") + assert pair(down) == ("terra", "high") and "score/cost" not in down["why"] # Within PREMIUM_RATIO_MARGIN the premium pair is taken: 58.5 for 108 is # 0.54, 4.8% below terra high's 0.57; 58.5 for 120 (0.49, 14% below) is not. near = edited_profiles(tmp_path, {("GPT-9 Astra", "high"): {"run_cost_usd": 108}}) From 5c581aade7740dc189b6141d0be1053a04b238f0 Mon Sep 17 00:00:00 2001 From: Bryan <28662377+bryanwieg@users.noreply.github.com> Date: Tue, 24 Nov 2026 01:01:41 +0000 Subject: [PATCH 08/10] Fix review findings: example tier, sample source, README routing sentence Fixes-Stage: 01.2 Tool: claude-code Model: orchestrator Effort: default Tokens: unknown Co-Authored-By: Claude Opus 5.5 --- README.md | 4 +++- docs/model-routing.md | 4 +++- docs/plans/fable-limits/design.md | 4 +++- .../phased-delivery/skills/plan-in-phases/model-selection.md | 3 ++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e4fddd7..c3a0ae6 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,9 @@ a dollar cap: 150k tokens for `small`, 400k for `middle`, 1M for `top`, at the pair's input price. A stage stopped at its cap is retried one step down the frontier; one that fails its checks, one step up. Premium models (output price of $30 or more per million tokens) are used below `top` only -when cheaper than the standard pick and as good, and get $10 per phase; past +when cheaper than the standard pick and as good, or as the step up past the +last standard pick while their score per unit of cost is within 5% of it; +`top` comes only from a total score of 9 or more. They get $10 per phase; past that, builds use none. Reviews always run on `top`, and their cost counts against that budget. The builder may edit files and runs only the commands your project's permission rules allow; set diff --git a/docs/model-routing.md b/docs/model-routing.md index e87e55f..77bb224 100644 --- a/docs/model-routing.md +++ b/docs/model-routing.md @@ -125,7 +125,9 @@ How it works now: at a lower thinking level. It waits for a larger model. - **Fable limits, 2026-11-24:** Fable at medium thinking or above should be for the top 10% most complex stages. On the 38 stages scored in this - repository's plans and eval tasks, `route` sent 15 (39%) to Fable high + repository's plans and eval tasks (main's 29 plus the 9 in + `docs/plans/implement-structured/` on the `implement-structured` + branch), `route` sent 15 (39%) to Fable high and 10 to Fable low; 10 of the 15 `top` stages got there only through K = 2, at totals of 5 to 7. Two changes: `top` comes only from a total of 9 or more (the "J, C or K = 2" override is gone), and the premium step-up diff --git a/docs/plans/fable-limits/design.md b/docs/plans/fable-limits/design.md index 4d8d1a4..e5ca8c6 100644 --- a/docs/plans/fable-limits/design.md +++ b/docs/plans/fable-limits/design.md @@ -4,7 +4,9 @@ Agreed with the user on 2026-11-24. ## Problem -Across the 38 stages scored in this repository's plans and eval tasks, `route` +Across the 38 stages scored in this repository's plans and eval tasks (main's +29 plus the 9 in `docs/plans/implement-structured/` on the `implement-structured` +branch), `route` sends 15 (39%) to Fable high and 10 more to Fable low. Ten of the fifteen `top` stages reach it only through K = 2, with totals of 5 to 7. Fable at medium thinking or above should be for the top 10% most complex tasks; picking diff --git a/plugins/phased-delivery/skills/plan-in-phases/model-selection.md b/plugins/phased-delivery/skills/plan-in-phases/model-selection.md index 3de8851..888aaad 100644 --- a/plugins/phased-delivery/skills/plan-in-phases/model-selection.md +++ b/plugins/phased-delivery/skills/plan-in-phases/model-selection.md @@ -272,7 +272,8 @@ dispatch. neighboring entry the brief names, and add one test: J0 F1 R0 C0 K0 P0 V0 S0 = 1 -> `small`. - Change a function, run its tests, expect one named test to fail, then - update that test: J0 F1 R0 C0 K0 P0 V0 S2 = 3 -> override 1 -> `middle`. + update that test: J0 F1 R0 C0 K0 P0 V0 S2 = 3 -> override 1 -> `middle` + -> override 2 -> `middle+`. - Fill in the body of a planned parser function against a defined signature, reading a config file another tool writes, with tests: J1 F1 R1 C1 K1 P1 V0 S0 = 6 -> `middle`. From 44b8bced691c1a8816164d1ee1be8cfaec21fbfa Mon Sep 17 00:00:00 2001 From: Bryan <28662377+bryanwieg@users.noreply.github.com> Date: Tue, 24 Nov 2026 01:02:00 +0000 Subject: [PATCH 09/10] Phase 01 built: revision for the 5% margin, review and notes Phase: docs/plans/fable-limits/01-fable-limits.md Co-Authored-By: Claude Opus 5.5 --- docs/plans/fable-limits/01-fable-limits.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/plans/fable-limits/01-fable-limits.md b/docs/plans/fable-limits/01-fable-limits.md index c8b4441..2afc01b 100644 --- a/docs/plans/fable-limits/01-fable-limits.md +++ b/docs/plans/fable-limits/01-fable-limits.md @@ -2,9 +2,9 @@ Implement with the implement-in-phases skill; do not build from this file without it. Model tiers map to models in [models.md](models.md). -Status: planned +Status: built 5c581aa Before: `tier` makes any stage with J, C or K at 2 `top`, and `route` takes the premium pair above the standard pick whenever the standard pairs run out before a requested step up, so Fable high and Fable low are the usual picks. -After: `top` comes only from a total of 9 or more, and a premium step-up below `top` needs a score/cost ratio at least the standard pick's, except on a `--up` retry. model-selection.md and docs/model-routing.md describe both rules. +After: `top` comes only from a total of 9 or more, and a premium step-up below `top` needs a score/cost ratio no more than 5% below the standard pick's, except on a `--up` retry. model-selection.md and docs/model-routing.md describe both rules. ## Assumptions - Verified: `select-models.py` takes its tier from plan-check.py's `tier` through `stage_tier`, so one change covers planning and routing. (plugins/phased-delivery/scripts/select-models.py:480-485) @@ -24,18 +24,18 @@ Budget: The plugin suite stays under a minute. | Outcome | Test | Written in | Passes from | | --- | --- | --- | --- | | `select-models.py route` for a stage scored J1F1R1C1K2P1V0S0 (total 7) prints tier `middle+`, not `top`; a stage totalling 9 or more still prints `top`. | `plugins/phased-delivery/tests/test_select_models.py::test_route_fable_limits` | 01.1 | 01.1 | -| When the standard pairs run out before a `middle+` or risk step, `route` prints the premium pair above the standard pick only when its score/cost ratio is at least the standard pick's, and otherwise the standard pick with the reason in `why`; with `--up 1` it still prints the premium pair. | `plugins/phased-delivery/tests/test_select_models.py::test_route_fable_limits` | 01.1 | 01.1 | +| When the standard pairs run out before a `middle+` or risk step, `route` prints the premium pair above the standard pick only when its score/cost ratio is no more than 5% below the standard pick's, and otherwise the standard pick with the reason in `why`; with `--up 1` it still prints the premium pair. | `plugins/phased-delivery/tests/test_select_models.py::test_route_fable_limits` | 01.1 | 01.1 | ## Stages | Stage | Goal | Tier | Order | Status | | --- | --- | --- | --- | --- | -| 01.1 | `tier` makes `top` only from a total of 9 or more, and `route` takes a premium step-up below `top` only when its score/cost ratio is at least the standard pick's or the step is a `--up` retry. | middle | first | planned | -| 01.2 | model-selection.md and docs/model-routing.md state the new tier rule and the ratio gate, with the measurement that led to them. | middle | after 01.1 | planned | +| 01.1 | `tier` makes `top` only from a total of 9 or more, and `route` takes a premium step-up below `top` only when its score/cost ratio is no more than 5% below the standard pick's or the step is a `--up` retry. | middle | first | done | +| 01.2 | model-selection.md and docs/model-routing.md state the new tier rule and the ratio gate, with the measurement that led to them. | middle | after 01.1 | done | ## 01.1 Tier rule, ratio gate and test -Goal: `tier` makes `top` only from a total of 9 or more, and `route` takes a premium step-up below `top` only when its score/cost ratio is at least the standard pick's or the step is a `--up` retry. +Goal: `tier` makes `top` only from a total of 9 or more, and `route` takes a premium step-up below `top` only when its score/cost ratio is no more than 5% below the standard pick's or the step is a `--up` retry. Context: - `plugins/phased-delivery/scripts/plan-check.py:97-98`: The override that makes J, C or K at 2 `top`. @@ -55,16 +55,16 @@ Files: Behaviour: - Given scores totalling 8 or less with J, C or K at 2, when `tier` runs, then the tier is `middle+` (a measure at 2 on `middle`), not `top`. - Given scores totalling 9 or more, when `tier` runs, then the tier is `top`, as before. -- Given a middle+ or risk step below top where the standard pairs run out and the premium pair above has a lower score/cost ratio than the standard pick, when `route` runs without `--up`, then it prints the standard pick, and `why` says the premium pair was left out for its score/cost ratio. +- Given a middle+ or risk step below top where the standard pairs run out and the premium pair above has a score/cost ratio more than 5% below the standard pick's, when `route` runs without `--up`, then it prints the standard pick, and `why` says the premium pair was left out for its score/cost ratio. - Given the same stage, when `route` runs with `--up 1`, then it prints the premium pair above the standard pick, as before. -- Given a premium pair whose ratio is at least the standard pick's, when `route` runs, then the step up takes it, as before. +- Given a premium pair whose ratio is no more than 5% below the standard pick's, when `route` runs, then the step up takes it, as before. External inputs: none Tests: - writes `plugins/phased-delivery/tests/test_select_models.py::test_route_fable_limits` (outcome): `select-models.py route` for a stage scored J1F1R1C1K2P1V0S0 (total 7) prints tier `middle+`, not `top`; a stage totalling 9 or more still prints `top`. -- writes `plugins/phased-delivery/tests/test_select_models.py::test_route_fable_limits` (outcome): When the standard pairs run out before a `middle+` or risk step, `route` prints the premium pair above the standard pick only when its score/cost ratio is at least the standard pick's, and otherwise the standard pick with the reason in `why`; with `--up 1` it still prints the premium pair. +- writes `plugins/phased-delivery/tests/test_select_models.py::test_route_fable_limits` (outcome): When the standard pairs run out before a `middle+` or risk step, `route` prints the premium pair above the standard pick only when its score/cost ratio is no more than 5% below the standard pick's, and otherwise the standard pick with the reason in `why`; with `--up 1` it still prints the premium pair. - keeps passing `plugins/phased-delivery/tests/test_select_models.py::test_route_premium_below_top` (integration): the cost-and-score rule and the --up step still hold Done when: @@ -115,3 +115,7 @@ Model basis: J1 F1 R0 C0 K0 P1 V1 S0 = 4 -> middle ## Notes - 2026-11-24: measured before the change: 15 of 38 scored stages routed to Fable high, 10 to Fable low; with the override dropped, 2 to Fable high (5%). - The ratio uses the profiles' `score` and benchmark run `cost` that `route` already compares; no new data. Reason: The selector's frontier already ranks pairs by those two numbers. +- Plan start: 6982bc0. Quick plan: no plan review. +- 2026-11-24: stages built directly by the orchestrator. +- 2026-11-24: revised after 01.1 and 01.2 at the user's request: a premium step-up is taken while its score/cost ratio is no more than 5% below the standard pick's (`PREMIUM_RATIO_MARGIN`), not only when it is at least as good; first 10%, then 5% because Fable has its own quota and builds fall back to Opus once it is used up. Measured after: 2 Fable high (5%), 23 Fable low, 5 Opus high, 8 Haiku xhigh of the 38 stages. +- 2026-11-24: phase review (fable high, in-session): not ready, 1 blocking (this file still described the strict rule; fixed by the revision above) and 7 should-fix, all fixed in 3f2a80f (gate only for premium step-ups, so a `--down` retry is not held; cross-multiplied, no division; risk and `--down` tests) and 5c581aa (example tier, where the 38-stage sample comes from, the README routing sentence; README.md added to 01.2's files by this revision). From afca52fd7950c03b4858e7bbb7ca7d1e7a5554c8 Mon Sep 17 00:00:00 2001 From: Bryan <28662377+bryanwieg@users.noreply.github.com> Date: Tue, 24 Nov 2026 00:24:46 +0000 Subject: [PATCH 10/10] CI: run the phased-delivery tests on pull requests Co-Authored-By: Claude Opus 5.5 --- .github/workflows/tests.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..a046485 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,25 @@ +name: Tests + +# Run the phased-delivery plugin's test suite on every pull request and on +# pushes to main. The tests use only the Python standard library, git and +# POSIX sh; external CLIs (claude, codex) are stubbed. + +on: + pull_request: + push: + branches: [main] + +permissions: + contents: read + +jobs: + pytest: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.x" + - run: python -m pip install pytest + - run: python -m pytest -q -p no:cacheprovider plugins/phased-delivery/tests