Answer architecture round 2: 2 🔴, 3 🟡; route from the ladder by rung, keep a stepped-up rung across reruns and reloads, test the judge's bundled range, and file item 136 for routing on the item taken
This commit is contained in:
+20
-15
@@ -1,11 +1,11 @@
|
||||
"""The routing ladder, and the step an R + C moves a task from the project's rung: docs/decisions.md → `routing:`."""
|
||||
"""The routing ladder, and the rung an R + C picks from the project's rung: docs/decisions.md → `routing:`."""
|
||||
import dataclasses
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Rung:
|
||||
model: str
|
||||
# Empty leaves the effort to claude's default for the model, as for a model off the ladder.
|
||||
# Empty leaves the effort to claude's settings, as for a model off the ladder.
|
||||
effort: str = ""
|
||||
|
||||
def flags(self) -> list[str]:
|
||||
@@ -35,24 +35,29 @@ BANDS = ((4, -3), (6, -2), (8, -1), (10, 0), (12, 1), (14, 2), (16, 3))
|
||||
ABOVE_THE_BANDS = 4
|
||||
|
||||
|
||||
def project_rung(model: str) -> int | None:
|
||||
"""The index of the model's cheapest rung, which for Opus 5.5 is its default effort; None for a model off the ladder."""
|
||||
return next((index for index, rung in enumerate(LADDER) if rung.model == model), None)
|
||||
def project_rung(model: str) -> Rung | None:
|
||||
"""The model's cheapest rung, which for Opus 5.5 is its default effort; None for a model off the ladder."""
|
||||
return next((rung for rung in LADDER if rung.model == model), None)
|
||||
|
||||
|
||||
def steps(risk_and_complexity: int) -> int:
|
||||
return next((step for highest, step in BANDS if risk_and_complexity <= highest), ABOVE_THE_BANDS)
|
||||
def picked(anchor: Rung, risk_and_complexity: int) -> Rung:
|
||||
"""The rung a task's R + C picks from anchor, the project's rung, stopping at either end of the ladder."""
|
||||
return climbed(anchor, next((step for highest, step in BANDS if risk_and_complexity <= highest), ABOVE_THE_BANDS))
|
||||
|
||||
|
||||
def climbed(index: int, by: int) -> int:
|
||||
"""The rung by steps from index, stopping at either end of the ladder."""
|
||||
return max(0, min(len(LADDER) - 1, index + by))
|
||||
def stepped_up(rung: Rung) -> Rung:
|
||||
"""The rung above, or the top one; a rung off the ladder steps to the bottom one."""
|
||||
return climbed(rung, 1)
|
||||
|
||||
|
||||
def picked(anchor: int, risk_and_complexity: int) -> int:
|
||||
"""The rung a task's R + C picks from anchor, the project's rung."""
|
||||
return climbed(anchor, steps(risk_and_complexity))
|
||||
def highest(*rungs: Rung) -> Rung:
|
||||
"""The most competent of the rungs; one off the ladder ranks below every rung on it."""
|
||||
return max(rungs, key=position)
|
||||
|
||||
|
||||
def index_of(rung: Rung) -> int | None:
|
||||
return LADDER.index(rung) if rung in LADDER else None
|
||||
def climbed(rung: Rung, by: int) -> Rung:
|
||||
return LADDER[max(0, min(len(LADDER) - 1, position(rung) + by))]
|
||||
|
||||
|
||||
def position(rung: Rung) -> int:
|
||||
return LADDER.index(rung) if rung in LADDER else -1
|
||||
|
||||
Reference in New Issue
Block a user