Answer prose round 1: 0 🔴, 10 🟡; split the AGENTS rule's conditions, say one interrupt carries the calls, unfold the figures' clauses, and drop a false README claim

This commit is contained in:
2026-10-15 01:08:03 +02:00
parent ef3ddd9a52
commit ac41116640
9 changed files with 20 additions and 21 deletions
+5 -5
View File
@@ -60,11 +60,11 @@ and counts its unfinished verdicts afresh. A rung no longer on the ladder, or be
item's R + C picks, is dropped, and the chunk is routed afresh from todo.md. A todo.md or an
archive that cannot be read or parsed is said on stderr, and the chunk is routed without it.
Every 20 cycles across all projects in the archive, counting the cycles a verdict closed, the loop
that closes the 20th measures every finished chunk there, with no model run: tokens by project,
subagent type, rung and the tool whose results they took in, and for each chunk an item routed, by
the rung it started on, its review rounds past each pass's first, its unfinished verdicts and its
subagents' rungs. It writes them to routing-figures.md at the archive's root. They call for a
Counting the cycles a verdict closed across all projects in the archive, the first loop to close
one 20 or more cycles after the last measurement measures every finished chunk there, with no model
run: tokens by project, subagent type, rung and the tool whose results they took in, and, for each
chunk a todo.md item routed, grouped by the rung it started on: its review rounds past each pass's
first, its unfinished verdicts and its subagents' rungs. It writes them to routing-figures.md at the archive's root. They call for a
routing change when chunks routed onto a rung took more review rounds or unfinished verdicts than
chunks routed onto the next rung up, each rung with 5 chunks or more, or when the reports of 5 or
more subagents of one type were longer than the tool results they read. Each call not raised before
+1 -1
View File
@@ -14,7 +14,7 @@ from utc_stamp import utc
def check_routing(root: pathlib.Path, rung: Rung, paths: Paths, effects: Effects) -> Stop | None:
"""Stops only when claude cannot start for the calls; a figure it cannot measure or keep is said on stderr, and the loop goes on. rung runs the claude the calls are put to."""
"""Stops only when claude cannot start for the calls; a figure it cannot measure or keep is said on stderr, and the loop goes on. rung is the rung of the claude that puts the calls to the human."""
with archive.locked(root) as held:
new = new_calls(root, paths, effects) if held else []
if isinstance(new, Failure):
+1 -1
View File
@@ -75,7 +75,7 @@ class Measured:
def measure_archive(root: pathlib.Path, home: str, since: str) -> Measured | Failure:
"""The figures of each chunk that finished after since, measured one chunk at a time, since the archive outgrows memory. Only an archive that cannot be listed fails."""
"""The figures of each chunk that finished after since, measured one chunk at a time because the archive outgrows memory. Only an archive that cannot be listed fails."""
try:
projects = sorted({path.parent.parent for path in root.rglob("*.outcomes.md")})
except OSError as failure:
+6 -9
View File
@@ -24,7 +24,7 @@ PROMPT = "prompt"
@dataclasses.dataclass(frozen=True)
class Subagent:
"""What the subagent's .meta.json names, its agentType and the toolUseId of the worker's Agent call that launched it, each empty where it names none; and its transcript's entries."""
"""kind is the agentType and launched_by the toolUseId of the launching Agent call, as the subagent's .meta.json names them, each empty where it names none; entries are its transcript's entries."""
kind: str
launched_by: str
entries: list[dict]
@@ -113,7 +113,7 @@ def add(tokens: dict[str, collections.Counter[str]], project: str, kind: str, ru
def rung_at(cycles: list[tuple[str, str]], timestamp: str) -> Rung | str:
"""The rung the worker line stamped first at or after timestamp names: the rung of the cycle that ran then. A line off the ladder names itself."""
"""The rung of the cycle running at timestamp: the worker named by the first outcome stamped at or after it, or else by the last outcome. A worker off the ladder is returned as its text."""
second = timestamp[:19] + "Z"
found = next((rung for stamp, rung in cycles if stamp >= second), cycles[-1][1] if cycles else "unrouted")
route = route_from(found)
@@ -128,10 +128,7 @@ def subagent_rung(entries: list[dict], arguments: dict, worker: Rung | str) -> R
def spend(entries: list[dict]) -> list[tuple[str, list[str], int]]:
"""Each message's timestamp, the tools whose results it took in, and its input, cache-written and output tokens.
Claude Code writes one entry per content block of a message, each with the message's usage, so a message counts once.
"""
"""Each message's timestamp, the tools whose results it took in, and its input, cache-written and output tokens, counted once per message, as reading_cost's tokens_in counts them."""
messages: dict[str, tuple[str, object, list[str]]] = {}
for entry in entries:
if entry.get("type") != "assistant" or not isinstance(message := entry.get("message"), dict):
@@ -177,7 +174,7 @@ def rounds_past_first(worker: list[dict], home: str) -> int:
def due(cycle: int, last_measured: int) -> bool:
"""Whether the archive's cycle count has run CYCLES_PER_CHECK past the cycle the figures were last measured at: counting from the last measurement, a count another loop pushed past a multiple still measures."""
"""Whether CYCLES_PER_CHECK cycles have closed since the figures were last measured. Counting from the last measurement still measures when another loop's cycles carried the count past a multiple of CYCLES_PER_CHECK."""
return cycle >= last_measured + CYCLES_PER_CHECK
@@ -201,7 +198,7 @@ def calls(figures: Figures) -> list[str]:
for what, of in (("review rounds past each pass's first", lambda chunk: chunk.rounds_past_first), ("unfinished verdicts", lambda chunk: chunk.unfinished)):
if mean(figures.routed[lower], of) > mean(figures.routed[upper], of):
found.append(f"Chunks routed onto {lower} took more {what} than chunks routed onto {upper}.")
# Characters stand in for tokens: both sides are text the worker would read. Both would fill the same peak context, so comparing the sums compares their shares of it.
# Characters stand in for tokens: reports and searches are both text the worker would read, so their sums compare their shares of its context.
found += [f"{kind} subagents' reports took more of the worker's context than their searches would have." for kind, reports in sorted(figures.reports.items()) if reports.subagents >= MEASURED_AT_LEAST and reports.report > reports.searches]
return found
@@ -214,7 +211,7 @@ def render(figures: Figures, found: list[str], at: str, cycle: int, since: str)
"""The figures as markdown; MEASURED_AT reads the cycle back. since is the latest reset's stamp, empty for none."""
sections = [
"# Routing figures",
f"Measured {at}, at cycle {cycle} across loop-claude's archive, from {figures.chunks} finished chunk{'' if figures.chunks == 1 else 's'}{f' that finished after the reset of {since}' if since else ''}. Tokens are input, cache-written and output tokens; cache reads are left out. A message's tokens count towards the tools whose results it took in, split evenly.",
f"Measured {at}, at cycle {cycle} across loop-claude's archive, from {figures.chunks} finished chunk{'' if figures.chunks == 1 else 's'}{f' that finished after the reset of {since}' if since else ''}. Tokens are input, cache-written and output tokens; cache reads are left out. A message's tokens count towards the tools whose results it took in, split evenly; a message that took in no tool result counts towards `prompt`.",
"## Calls for a routing change",
"".join(f"- {call}\n" for call in found).rstrip("\n") or "None.",
*[part for dimension in DIMENSIONS for part in (f"## Tokens by {dimension}", table((dimension.capitalize(), "Tokens"), [(label, str(tokens)) for label, tokens in figures.tokens[dimension].most_common()]))],