Answer stability round 1: 0 🔴, 6 🟡 (0 misread); slim chunk_figures, type a call's kind, keep the state through replace_json, add the missing state and raise tests

This commit is contained in:
2026-11-08 20:02:58 +01:00
parent 0c93614f4a
commit f0ff379251
9 changed files with 73 additions and 33 deletions
+7 -5
View File
@@ -1,4 +1,4 @@
"""The routing figures summed over every chunk, and the routing changes they call for: docs/decisions.md → `routing:`."""
"""The routing figures summed over every chunk, and the routing changes they call for: docs/decisions.md → `routing: loop-claude measures review rounds…`."""
import collections
import dataclasses
import statistics
@@ -54,8 +54,9 @@ def totals(chunks: list[ChunkFigures], skipped: tuple[str, ...] = (), unread: tu
)
Kind = typing.Literal["rounds", "unfinished", "reports"]
# Each kind of call to the sentence it is put to the human in, filled with its subjects in order.
SENTENCES = {
SENTENCES: dict[Kind, str] = {
"rounds": "Chunks routed onto {} took more review rounds past each pass's first than chunks routed onto {}.",
"unfinished": "Chunks routed onto {} took more unfinished verdicts than chunks routed onto {}.",
"reports": "{} subagents' reports took more of the worker's context than their searches would have.",
@@ -64,8 +65,8 @@ SENTENCES = {
@dataclasses.dataclass(frozen=True)
class Call:
"""A routing change the figures call for, known again by its fields when raised twice. kind is a key of SENTENCES; subjects are the two rungs compared, lower first, or the subagent type."""
kind: str
"""A routing change the figures call for. Its fields, not its sentence, tell whether it was raised before. kind names its sentence in SENTENCES; subjects are the two rungs compared, lower first, or the subagent type."""
kind: Kind
subjects: tuple[str, ...]
def sentence(self) -> str:
@@ -77,7 +78,8 @@ def calls(figures: Figures) -> list[Call]:
compared = sorted((rung for rung, chunks in figures.routed.items() if len(chunks) >= MEASURED_AT_LEAST and position(rung) >= 0), key=position)
found = []
for lower, upper in zip(compared, compared[1:]):
for kind, of in (("rounds", lambda chunk: chunk.rounds_past_first), ("unfinished", lambda chunk: chunk.unfinished)):
measures: tuple[tuple[Kind, typing.Callable[[ChunkFigures], int]], ...] = (("rounds", lambda chunk: chunk.rounds_past_first), ("unfinished", lambda chunk: chunk.unfinished))
for kind, of in measures:
if mean(figures.routed[lower], of) > mean(figures.routed[upper], of):
found.append(Call(kind, (str(lower), str(upper))))
# Characters stand in for tokens: reports and the tool results their subagents read are both text the worker would read, so their sums compare their shares of its context.