Route the worker's subagents by their task's R + C, and keep seats and the security pass on the project's rung

This commit is contained in:
2026-10-15 00:09:22 +02:00
parent 1d00d3ee82
commit 258b7e4de5
14 changed files with 123 additions and 24 deletions
+5 -3
View File
@@ -22,10 +22,12 @@ def fresh(task: str, premises: str, route: Route, anchor: Rung | None) -> str:
def routed_by(route: Route, anchor: Rung | None) -> str:
said = f"loop-claude runs you on {route.rung}, routed by item {route.item}'s R + C of {route.risk_and_complexity}. Name each todo.md item this chunk takes, with its R + C, whether or not it is item {route.item}."
if anchor is None or highest(route.rung, anchor) == route.rung:
if anchor is None or route.rung == anchor:
return said
# The Agent tool takes a family name, such as opus, and runs that family's latest model; each rung names its family's latest, so the two match.
return f"{said} Your rung is below the project's, {anchor}: launch each reviewer, each comprehension seat and the security pass's subagent with the Agent tool's model `{anchor.model.split('-')[1]}` and effort `{anchor.effort}`, and run a full scan only from such a subagent, since the scan's agents run on the model that starts them."
# Below the project's rung, the reviewers stay on it to hold quality; above it, the seats score every chunk on one rung, and the security pass spends no more than the project chose.
below = highest(route.rung, anchor) == anchor
launched = "each reviewer, each comprehension seat and the security pass's subagent" if below else "each comprehension seat and the security pass's subagent"
return f"{said} Your rung is {'below' if below else 'above'} the project's, {anchor}: launch {launched} with the Agent tool's model `{anchor.family()}` and effort `{anchor.effort}`, and run a full scan only from such a subagent, since the scan's agents run on the model that starts them."
def resumed(unfinished_evidence: str) -> str:
+2 -1
View File
@@ -48,7 +48,8 @@ counts from the model's cheapest rung, and an R + C of 8 or less picks a rung be
such an item, or with a C missing, the chunk runs on the model's cheapest rung. The worker's first
prompt names the rung and the item, and asks the worker to name each item the chunk takes, with its
R + C. When that rung is below the model's cheapest, the prompt also has the worker launch each
reviewer, each comprehension seat and the security pass in subagents on the cheapest rung. The
reviewer, each comprehension seat and the security pass in subagents on the cheapest rung; when it
is above, each comprehension seat and the security pass. The
judge reports the highest R + C the worker states, and the next cycle steps up to the rung that
R + C picks, never down. Every second unfinished verdict on a chunk steps it up one rung. Each
finished or unfinished verdict, stop and step-up in the archive names the worker's rung, with the
+6 -2
View File
@@ -541,8 +541,12 @@ class WorkerArgs(unittest.TestCase):
opus = Rung("claude-opus-5-5", "medium")
below = prompts.fresh("Do it.", "## Goals", routing.Route(Rung("claude-sonnet-5-5", "high"), 3, 5), opus)
self.assertIn("whether or not it is item 3. Your rung is below the project's, claude-opus-5-5 at medium effort: launch each reviewer, each comprehension seat and the security pass's subagent with the Agent tool's model `opus` and effort `medium`, and run a full scan only from such a subagent, since the scan's agents run on the model that starts them.\n\n", below)
for route in (routing.Route(opus, 3, 9), routing.Route(Rung("claude-opus-5-5", "high"), 3, 11)):
self.assertNotIn("below the project's", prompts.fresh("Do it.", "## Goals", route, opus))
self.assertNotIn("the project's", prompts.fresh("Do it.", "## Goals", routing.Route(opus, 3, 9), opus))
def test_keeps_seats_and_the_security_pass_on_the_projects_rung_while_the_worker_runs_above_it(self):
opus = Rung("claude-opus-5-5", "medium")
above = prompts.fresh("Do it.", "## Goals", routing.Route(Rung("claude-opus-5-5", "high"), 3, 11), opus)
self.assertIn("whether or not it is item 3. Your rung is above the project's, claude-opus-5-5 at medium effort: launch each comprehension seat and the security pass's subagent with the Agent tool's model `opus` and effort `medium`, and run a full scan only from such a subagent, since the scan's agents run on the model that starts them.\n\n", above)
def test_opens_a_fresh_session_by_name_and_resumes_an_open_one(self):
opened = session.session_named("A proj loop-claude", pathlib.Path("/h/.claude/projects"))