Answer architecture round 2: 0 🔴, 1 🟡; join prose lists with one markdown_text.listed, and floor the replays at lowest_worker_rung

This commit is contained in:
2026-10-16 12:18:03 +02:00
parent 12909f233d
commit f319a96e7e
11 changed files with 40 additions and 34 deletions
+3 -2
View File
@@ -3,12 +3,13 @@ import json
import re
import typing
from loop_claude.cycle.prompts import ANSWER_DESTINATIONS, ANSWERS_RECORDED, either
from loop_claude.cycle.prompts import ANSWER_DESTINATIONS, ANSWERS_RECORDED
from claude_code.reply import claude_reply, Limited
from loop_claude.effects import Effects
from failure import Failure
from loop_claude.project.records import HUMAN_RULE_NAMES
from todo_table import LEVELS
from markdown_text import listed
from loop_claude.cycle.retry import retried
from model_routing.ladder import Rung
from loop_claude.stop import Stop
@@ -45,7 +46,7 @@ JUDGE_RULES = (
f"its own. Even then, it is finished only once {ANSWERS_RECORDED}. An answer counts as recorded "
f"where README.md or the records above hold it, {', '.join(HUMAN_RULE_NAMES)} included. It also counts where "
f"the transcript shows the agent writing it into {ANSWER_DESTINATIONS}; writing it into "
f"{either(HUMAN_RULE_NAMES)} does not count. finished=false when work remains that a further run can "
f"{listed(HUMAN_RULE_NAMES, 'or')} does not count. finished=false when work remains that a further run can "
"continue: an open PR, a review not yet run, CI not yet reported, an answer not yet recorded."
)
+3 -13
View File
@@ -2,15 +2,10 @@ from model_routing.ladder import climbed, LADDER, position, review_rungs, Review
from model_routing.route import ESCALATION_MARKER, Route
from loop_claude.routing import escalation_rungs
from loop_claude.project.records import HUMAN_RULE_NAMES, RECORD_FILES
from markdown_text import quoted
def either(names: tuple[str, ...]) -> str:
"""The names as `a, b or c`."""
return f"{', '.join(names[:-1])} or {names[-1]}"
from markdown_text import listed, quoted
# Where the judge may quote an answer from, named as the human and the worker see them; of README.md the judge sees only the premises.
QUOTE_SOURCES = either(("README.md's Goals and Audience", *RECORD_FILES, *HUMAN_RULE_NAMES))
QUOTE_SOURCES = listed(("README.md's Goals and Audience", *RECORD_FILES, *HUMAN_RULE_NAMES), "or")
# Where the worker may write an answer the human typed, so it counts as recorded.
ANSWER_DESTINATIONS = "README.md's Goals or Audience, " + ", ".join(RECORD_FILES) + ", todo.md or a comment"
ANSWERS_RECORDED = f"every answer the human typed in it that a later chunk could need is recorded in {ANSWER_DESTINATIONS} at the one place it governs"
@@ -40,17 +35,12 @@ def review_launches(route: Route, anchor: Rung | None) -> str:
for reviews, kind in REVIEWS:
if rungs[kind] != route.rung:
launched.setdefault(rungs[kind], []).append(reviews)
launches = "".join(f" Launch {listed(reviews)} with the Agent tool set to {rung.agent_args()}, {rung_named(rung, route, anchor)}." for rung, reviews in launched.items())
launches = "".join(f" Launch {listed(reviews, 'and')} with the Agent tool set to {rung.agent_args()}, {rung_named(rung, route, anchor)}." for rung, reviews in launched.items())
scan = " Run a full scan only from such a subagent, since the scan's agents run on the model that starts them." if rungs["security"] != route.rung else ""
planning = f" Your rung is below the project's: launch each subagent that files or scores todo.md items on the rung `~/.claude/bin/subagent-rung --plan {anchor.model} <L>` prints." if position(route.rung) < position(anchor) else ""
return f"{launches}{scan}{planning}"
def listed(names: list[str]) -> str:
"""The names as `a, b and c`."""
return names[0] if len(names) == 1 else f"{', '.join(names[:-1])} and {names[-1]}"
def rung_named(rung: Rung, route: Route, anchor: Rung) -> str:
"""Why a review runs on rung: it is the project's, anchor, or the one the route's item's E + I picks."""
return "the project's rung" if rung == anchor else f"the rung item {route.item}'s E + I of {route.escape_and_impact} picks"