Answer prose round 1: 0 🔴, 8 🟡 (0 misread); reword the running loops' docstrings, help and decision, widen the decision's title, keep filed items out of items_taken_in

This commit is contained in:
2026-10-29 20:42:37 +01:00
parent 0a9fe07084
commit ac9d107066
16 changed files with 37 additions and 36 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ Decisions live in `docs/decisions.md`:
- loop-claude: one session per project, its id derived from the checkout's path relative to `~/code`, or to `/` outside it
- loop-claude: the archive keeps the raw transcript, and a failed archive stops the loop
- loop-claude: the worker's claude compacts its context before it fills a 200k window, at about 170k tokens, and `CLAUDE.md` → "Compact instructions" says what the summary keeps
- loop-inbox: a waiting loop-claude lists its question as one file per session under `~/.local/state/loop-claude/`, and takes the first answer, from its terminal or from loop-inbox, that names that question
- loop-inbox: a loop-claude lists itself while it runs, and its waiting question, as files per session under `~/.local/state/loop-claude/`, and takes the first answer, from its terminal or from loop-inbox, that names that question
- machine load: a heavy command waits for one of the machine's heavy slots, one for every 4 CPUs, which every session shares, and loop-claude starts a worker only while at least a quarter of the machine's memory is available
- machine load: every container a session starts has a memory limit and a swap limit as large as its work needs; rule-hook's `docker-run-memory` blocks a `docker run` or `docker create` without them outside run-heavy, under which a container that lacks them gets the slot's share of three quarters of the memory; and no daemon-wide cap limits all containers together
- principles: about seven things per level, four or five where they act on each other, more where a reader finds them by name; crossing a limit asks for a grouping or a recorded reason
+1 -1
View File
@@ -2,7 +2,7 @@
## Unreleased
- New tool `loop-inbox` lists the interrupts of every loop-claude on the machine, oldest first, in one terminal. Each entry shows the loop's checkout, how long it has waited and the question's first lines. Pick one to answer the question as on the loop's terminal, except that Enter alone goes back; `/talk` opens claude in loop-inbox's terminal. Of a pasted answer, only the first line is sent, and the rest is dropped. The loop takes the first answer, from its terminal or loop-inbox, so it works as before with no loop-inbox running. A loop that ends drops off the list, even one killed outright. A loop whose claude is already open, such as for a release ready to cut or the routing calls, is listed but answered in that claude. A loop asking for its project's model, as on a project's first run, asks on its own terminal only. Below the questions, loop-inbox lists every loop that runs, with the ID and tagline of each todo.md item its chunk takes. Link it onto `PATH` as README → Install shows.
- New tool `loop-inbox` lists the interrupts of every loop-claude on the machine, oldest first, in one terminal. Each entry shows the loop's checkout, how long it has waited and the question's first lines. Pick one to answer the question as on the loop's terminal, except that Enter alone goes back; `/talk` opens claude in loop-inbox's terminal. Of a pasted answer, only the first line is sent, and the rest is dropped. The loop takes the first answer, from its terminal or loop-inbox, so it works as before with no loop-inbox running. A loop that ends drops off the list, even one killed outright. A loop whose claude is already open, such as for a release ready to cut or the routing calls, is listed but answered in that claude. A loop asking for its project's model, as on a project's first run, asks on its own terminal only. Below the questions, loop-inbox lists every running loop, with the ID and tagline of each `todo.md` item its chunk takes. Link it onto `PATH` as README → Install shows.
- Ctrl-C in a claude that `loop-claude` opens on its terminal, for `/talk`, a release ready to cut or the routing calls, now reaches only that claude. Before, it also stopped `loop-claude`, which closed that claude a quarter second later.
- `reading-cost` now lists the files a chunk read in the worktree `chunk-preflight` made, `<checkout>-item-<ID>`. It listed none, since no transcript command names that worktree.
- `larv-review ruling-base` now finds the last measured commit when run in a subfolder of a checkout. Before, it found no change to the comprehension history there and fell back to the merge base.
+1 -1
View File
@@ -99,7 +99,7 @@ Install puts only `loop-claude` and `loop-inbox` on `PATH`; call the others by t
- `judge-replay <model>` replays loop-claude's judge on archived verdicts of the projects run on the model, and prints the lowest rung that, like each rung above it, returns them; `judge-replay --help` states the replay.
- `larv-review <command>` holds larv-review's mechanical rules: the chunk's review folder, the paired ruling's base and vote count, each pass's round count, the scoring run's trigger, and the comprehension history's format and latest places, and its count of how often seats agree; `larv-review --help` states them.
- `loop-claude <task>` runs a project's next chunk cycle after cycle; `loop-claude --help` states its contract.
- `loop-inbox` shows the interrupts of every loop-claude on the machine, oldest first, and takes each one's answer, `/talk` included. Below them it lists every loop that runs, with the ID and tagline of each todo.md item its chunk takes. `loop-inbox --help` states how.
- `loop-inbox` shows the interrupts of every loop-claude on the machine, oldest first, takes each one's answer, `/talk` included, and lists every running loop with the `todo.md` items its chunk takes; `loop-inbox --help` states how.
- `metric-bench [history]` benches cheap static metrics of a project's Python against the places its comprehension history names as hardest; `metric-bench --help` states the metrics and the scores.
- `rank_todo.py [--check] [todo.md]` scores and ranks a project's `todo.md`; `rank_todo.py --help` states the format.
- `reading-cost [--reset] [record]` appends a figure for each chunk `loop-claude` finished to a project's `docs/reading-cost.md`, and says whether the figures rise; `reading-cost --help` states the measure.
+2 -2
View File
@@ -68,7 +68,7 @@ class Reply:
# Routes the next cycle's judge and reviewers, as highest_likelihood_taken_in routes the worker.
highest_escape_and_impact_taken_in: int = dataclasses.field(metadata={"description": "The highest E + I the worker states for a todo.md item it took into this chunk; 0 when it states none."})
# Lists the chunk's items in loop-inbox: running_loops.py.
items_taken_in: list[int] = dataclasses.field(metadata={"description": "The IDs of the todo.md items the worker states this chunk takes, the one it was routed on included; empty when it states none."})
items_taken_in: list[int] = dataclasses.field(metadata={"description": "The IDs of the todo.md items the worker states this chunk takes, the item the chunk was routed on included, never an item it only filed in todo.md for later; empty when it states none."})
# Routes the worker one rung up, as the judge interrupts or quotes an answer, or on the next cycle: loop_claude/escalation_mark.py.
escalation: str = dataclasses.field(metadata={"description": "Empty unless the chunk is unfinished, interrupt is true or answer quotes a passage, and the worker's run ends asking loop-claude for a higher rung, citing an escalation trigger. Then: a verbatim quote, without elisions, of the transcript passage where the trigger fired, such as a review round's commit title or the worker's report of the finding or failing test. " + escalation_mark.QUOTE_AFTER_STEP + " Never a later mention of the trigger, and never the request itself."})
evidence: str = dataclasses.field(metadata={"description": "A verbatim quote of the one transcript passage the verdict rests on, without elisions: what triggers the interrupt; for a quoted answer, the worker's question; else what shows the chunk finished or the work remaining."})
@@ -137,7 +137,7 @@ def fits(value: object, kind: object) -> bool:
def taken_in_from(output: dict) -> TakenIn:
"""The reply's readings of the items taken in. An ID below 1, or an L or E + I off its scale, counts as none: holding the rung is safe, and three failures would stop an unattended loop."""
"""The reply's readings of the items taken in. An ID below 1 is left out, and an L or E + I off its scale counts as 0. Neither fails the reply: three failures would stop an unattended loop, and holding the rung is safe."""
likelihood = output["highest_likelihood_taken_in"]
escape_and_impact = output["highest_escape_and_impact_taken_in"]
return TakenIn(
+1 -1
View File
@@ -42,7 +42,7 @@ class Cycle:
project: Rung | None
# Empty when the previous cycle's verdict was not Unfinished.
unfinished_evidence: str
# Lists in loop-inbox the IDs of the items each ruling finds the chunk takes.
# Lists in loop-inbox the items the chunk takes, given the IDs an unfinished ruling found taken in.
show_taken_in: typing.Callable[[tuple[int, ...]], None]
+1 -1
View File
@@ -213,7 +213,7 @@ def run_loop(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launc
def shown_items(show: Show, root: str, routed: int) -> typing.Callable[[tuple[int, ...]], None]:
"""What lists in loop-inbox the items a chunk takes, given those taken in; routed is the item it was routed on, 0 for none. It reads the taglines once, as the cycle starts."""
"""A function that lists in loop-inbox the items a chunk takes, given the IDs the judge found taken in. routed is the item the chunk was routed on, 0 for none. shown_items reads todo.md once, as the cycle starts, and the function shows those taglines."""
todo = fetched_todo(root)
return lambda taken_in: show(taken_items(todo, routed, taken_in))
+1 -1
View File
@@ -26,7 +26,7 @@ class LoopRun:
route: Route | None = None
# How many unfinished verdicts the chunk has had running; a finished chunk and a rerun each set it to 0. It stays apart from route and unfinished_evidence, though all three change together at each verdict: merging or renaming a field stops a running loop at its next reload.
unfinished_run: int = 0
# The IDs of the items the last unfinished verdict found the chunk takes, which loop-inbox lists until the next ruling. A finished chunk empties it.
# The IDs of the items the last unfinished verdict found the chunk takes, which loop-inbox lists until the next ruling.
items_taken_in: tuple[int, ...] = ()
+13 -13
View File
@@ -1,11 +1,11 @@
"""The files by which a loop-claude shows loop-inbox that it runs, and the todo.md items its chunk takes.
A running loop holds its session's lock (session_lock.py) in Paths.waiting for its whole run, and keeps <session>.running
beside it: its checkout, and the ID and tagline of each item its chunk takes. Those are the item it was routed on, then
the items the judge's latest ruling found the worker took in, each once, with its tagline on the default branch as last
fetched. loop-inbox lists a loop, and its questions (waiting.py), only while its lock is held, so a killed loop drops off
the list though its files stay. loop-inbox removes them: <session>.running through drop_ended_loops here, and the
question through waiting.drop_ended.
A running loop holds its session's lock (session_lock.py) in Paths.waiting for its whole run. Beside the lock it keeps
<session>.running, which holds the loop's checkout and each item its chunk takes, by ID and by its tagline on the default
branch as last fetched. The items are the one the chunk was routed on, then those the judge's latest ruling found the
worker took in, each listed once. loop-inbox lists a loop, and its question (waiting.py), only while the loop holds its
lock. So a killed loop drops off the list, though its files stay until loop-inbox removes them: <session>.running
through drop_ended_loops here, and the question through waiting.drop_ended.
"""
import contextlib
import dataclasses
@@ -20,7 +20,7 @@ from failure import Failure
from todo_table import items
from file_writes import replace_json
# How many times, 0.1 s apart, a loop tries to take its lock: loop-inbox takes it for a moment each time it looks whether the loop has ended.
# How many times, 0.1 s apart, a loop tries to take its lock: loop-inbox takes it for a moment each time it checks whether the loop has ended.
LOCK_TRIES = 10
@@ -28,7 +28,7 @@ LOCK_TRIES = 10
class Taken:
"""A todo.md item a chunk takes."""
id: int
# The item's tagline without its bold marks; empty where the default branch's todo.md holds no such item.
# The item's tagline without its bold marks; empty where the default branch's todo.md can't be read or holds no such item.
tagline: str
@@ -37,7 +37,7 @@ class RunningLoop:
session: str
# The checkout the loop runs in.
root: str
# The routed item first; empty before the chunk names one.
# The routed item first; empty until the chunk has an item.
items: tuple[Taken, ...]
@@ -46,8 +46,8 @@ Show = typing.Callable[[tuple[Taken, ...]], None]
@dataclasses.dataclass(frozen=True)
class Listed:
"""What a running loop shows loop-inbox through."""
# Where the loop keeps its questions: Paths.waiting while it holds its lock. Else a folder of its own, which loop-inbox doesn't read, so the loop never touches the questions of the loop that holds the lock.
"""How a running loop shows itself in loop-inbox."""
# Where the loop keeps its questions: Paths.waiting where it holds its session's lock. Where another loop on the session holds the lock, a folder of its own that loop-inbox doesn't read, so this loop never touches the other's questions.
folder: pathlib.Path
show: Show
@@ -81,7 +81,7 @@ def shown_running(folder: pathlib.Path, session: str, root: str, effects: Effect
def locked_soon(stack: contextlib.ExitStack, folder: pathlib.Path, session: str, effects: Effects) -> Failure | None:
"""Holds the session's lock until stack closes, trying LOCK_TRIES times; the last failure where every try failed."""
"""Holds the session's lock until stack closes, trying LOCK_TRIES times; returns None once it holds the lock, else the last try's failure."""
for _ in range(LOCK_TRIES):
attempt = contextlib.ExitStack()
unlocked = attempt.enter_context(held(folder, session))
@@ -130,7 +130,7 @@ def is_item(item: object) -> bool:
def taken_items(todo: str | Failure, routed: int, taken_in: tuple[int, ...]) -> tuple[Taken, ...]:
"""The items a chunk takes, as the module docstring says, with their taglines from todo, the default branch's todo.md. routed is 0 for none."""
"""The items a chunk takes, as the module docstring says, with their taglines from todo, the default branch's todo.md. routed, the item the chunk was routed on, is 0 for none."""
found = items(todo) if isinstance(todo, str) else []
taglines = {item.id: item.tagline.removeprefix("**").removesuffix("**") for item in found} if isinstance(found, list) else {}
ids = dict.fromkeys(([routed] if routed else []) + list(taken_in))
+1 -1
View File
@@ -1,4 +1,4 @@
"""The lock by which loop-inbox tells that a loop-claude still runs.
"""The lock by which loop-inbox tells whether a loop-claude still runs.
A loop holds <session>.lock for its whole run (running_loops.py), with flock, which the kernel frees however the loop
ends, killed included. The lock file stays once the loop ends: docs/decisions.md → `loop-inbox: …` says why.
+1 -1
View File
@@ -4,7 +4,7 @@ import dataclasses
@dataclasses.dataclass(frozen=True)
class TakenIn:
"""What the judge read in the transcript about the todo.md items the worker took into the chunk, the one it was routed on included."""
"""What the judge read in the transcript about the todo.md items the worker took into the chunk, the item the chunk was routed on included."""
# Their IDs; loop-inbox lists them.
items: tuple[int, ...] = ()
# The highest L among them, 0 for none: an escalation steps up from the rung that L picks, and an unfinished verdict also raises the worker to it.
+4 -3
View File
@@ -3,8 +3,9 @@
A waiting loop keeps its ask in <session>.json in Paths.waiting: the question, with an id new for each question.
<session> is the worker's session id, so a loop lists one question at a time. The loop removes the ask once the question
is answered or the loop stops. loop-inbox lists an ask only while the loop holds the session's lock (running_loops.py),
and removes one whose lock is free. The ask's state says whether the loop waits for an answer, or has claude open for it, on the loop's own terminal or in loop-inbox. loop-inbox answers by replacing <session>.answer, which
names the ask's id. So an answer meant for an earlier question, or sent as the loop took an answer on its terminal,
and removes one whose lock is free. The ask's state says whether the loop waits for an answer, or has claude open for
it, on the loop's own terminal or in loop-inbox. loop-inbox answers by replacing <session>.answer, which names the
ask's id. So an answer meant for an earlier question, or sent as the loop took an answer on its terminal,
never answers a later one.
/talk from loop-inbox goes in three steps, so that only one claude ever holds the worker's session:
@@ -122,7 +123,7 @@ def shown(folder: pathlib.Path, ask: Ask, effects: Effects) -> None:
def listed(folder: pathlib.Path, ask: Ask, effects: Effects) -> typing.Iterator[None]:
"""Lists ask in loop-inbox while the with block runs, then takes it out, with any answer. A failure to list it only warns: the question is still answered on the loop's terminal.
loop-inbox lists the ask only while the loop holds the session's lock, which it doesn't take here: folder must be the one running_loops.shown_running yields, which holds the lock for the loop's whole run.
listed doesn't take the session's lock, which loop-inbox needs held to list the ask. Pass the folder running_loops.shown_running yields: shown_running holds the lock for the loop's whole run.
"""
shown(folder, ask, effects)
try:
+3 -3
View File
@@ -4,7 +4,7 @@ How it shows the loops and a question was picked on 2026-10-28 by a bench of thr
audience, as ~/.claude/CLAUDE.md → "Working loop" → "Bench a syntax with the people who write it." has it: a block per
loop with its checkout's path and how long it has waited, and an answer prompt saying that Enter alone doesn't stop the loop.
A second bench, on 2026-10-29, picked the running loops' section: below the waiting loops, a line per loop with its
checkout and the number it waits as, then a line per item its chunk takes, with its ID and tagline.
checkout and its number in the list above where it waits for an answer, then a line per item its chunk takes, with its ID and tagline.
"""
import dataclasses
import textwrap
@@ -27,7 +27,7 @@ NARROWEST = 20
@dataclasses.dataclass(frozen=True)
class Listing:
"""The waiting loops as they were when the human began typing a number, so a loop's number doesn't change while they type it, and the running loops."""
"""The waiting and running loops as they were when the human began typing a number, so a loop's number doesn't change while they type it."""
shown: tuple[Ask, ...] = ()
typed: str = ""
note: str = ""
@@ -116,7 +116,7 @@ def listing_lines(screen: Listing, now: float, local_time: typing.Callable[[floa
def running_lines(running: tuple[RunningLoop, ...], shown: tuple[Ask, ...], width: int) -> list[str]:
"""Each running loop's checkout, with the number it waits as, and a line per item its chunk takes."""
"""Each running loop's checkout, with its number in the waiting list where it waits for an answer, and a line per item its chunk takes."""
if not running:
return ["No loop runs."]
numbers = {ask.session: number for number, ask in enumerate(shown, 1)}
+3 -3
View File
@@ -21,9 +21,9 @@ loop-inbox running. A loop with claude open, for a release ready to cut, the rou
asking for its project's model, as on a project's first run, asks on its own terminal only. q quits
loop-inbox; the loops keep waiting.
Below the questions, each running loop shows its checkout, the number it waits as, if any, and a
line per todo.md item its chunk takes, with its tagline from the default branch. A loop whose
process is gone drops off this list too.
Below the questions, loop-inbox lists each running loop: its checkout, its number in the list
above where it waits for an answer, and a line per todo.md item its chunk takes, with the item's
tagline on the default branch. A loop whose process is gone drops off this list too.
The loops' questions are files in ~/.local/state/loop-claude, read and written as
bin/loop_claude/waiting.py describes; the running loops are files beside them, as
+1 -1
View File
@@ -450,7 +450,7 @@ class RunningLoops(unittest.TestCase):
self.assertEqual(list((self.folder / "unlisted").iterdir()), [])
def test_takes_the_lock_once_loop_inbox_lets_go_of_it(self):
# loop-inbox holds the lock for a moment as it looks whether the loop runs.
# loop-inbox holds the lock for a moment as it checks whether the loop runs.
looking = contextlib.ExitStack()
looking.enter_context(session_lock.held(self.folder, "s1"))
with running_loops.shown_running(self.folder, "s1", "/code/log", dataclasses.replace(self.effects, sleep=lambda seconds: looking.close())):
+2 -2
View File
@@ -101,7 +101,7 @@ Hours. A chunk ran a median 0.7 hours from its first message to its last, one in
Valid while cache reads cost a twentieth of input and Claude Code's compaction keeps the worker's task.
## loop-inbox: a waiting loop-claude lists its question as one file per session under `~/.local/state/loop-claude/`, and takes the first answer, from its terminal or from loop-inbox, that names that question
## loop-inbox: a loop-claude lists itself while it runs, and its waiting question, as files per session under `~/.local/state/loop-claude/`, and takes the first answer, from its terminal or from loop-inbox, that names that question
2026-10-28, lilleman, todo item 243. Serves goal 1. With several loops running, each asked on its own terminal, and the human searched the terminals for the ones that waited. loop-inbox lists every loop's interrupts, the routing calls included, oldest first, and the human answers each one there. A loop asking for its project's model, as on a project's first run, asks on its terminal only: the human has just started it there, and no worker session exists yet. `bin/loop_claude/waiting.py` holds the protocol:
- An answer reaching the wrong loop is the worst failure. Each answer names the question it answers by a fresh id, so an answer meant for an earlier question, or sent as the terminal answered, never answers a later one.
@@ -110,7 +110,7 @@ Valid while cache reads cost a twentieth of input and Claude Code's compaction k
- loop-inbox runs the claude command the loop wrote, `bypassPermissions` included, so that claude runs in the same sandbox as the loop. Since loop-inbox runs a command read from a file, the folder is private to the user.
- Files, read by polling, need no daemon and only the standard library, and a loop with no loop-inbox running is answered on its terminal as before.
- loop-inbox lists a question only while its loop holds the session's lock file with flock, and removes a question whose lock is free. The loop holds the lock for its whole run. The kernel frees the lock however the loop ends, killed included. A process id could not tell a running loop from a killed one: on 2026-10-29 this machine's kernel handed out its 32,768 ids again every 30 to 75 minutes, so a killed loop's question came back whenever another process got its id. The lock file stays once the loop ends, one per project: removing it while another process has it open could let loop-inbox lock a file no loop holds. Todo item 252.
- A loop also lists itself as running, with the items its chunk takes, in `<session>.running`, under the same lock: one lock tells loop-inbox both that the loop runs and that its question stands. The routed item comes from the route; the judge names the items the worker took in, as an array of IDs in its reply's `items_taken_in`, and a reload hands them over. A second loop on the session cannot take the lock: it runs unlisted and keeps its questions in a folder of its own, so it never touches those of the loop that holds the lock. `bin/loop_claude/running_loops.py` states the rule. Todo item 255.
- A loop also lists itself as running, with the items its chunk takes, in `<session>.running`, under the same lock: one lock tells loop-inbox both that the loop runs and that its question stands. The judge names the items the worker took in, as an array of IDs in its reply's `items_taken_in`. Todo item 255.
A bench of three readers seated as the README's audience picked the name `loop-inbox`, 3–0.
+1 -1
View File
@@ -163,7 +163,7 @@ F is 8 until then, about one S 3 change, lilleman's call in PR #283. A chunk cos
### 215. Decode a reload's handed JSON with a decoder for `LoopRun` and its `Route`, in place of `decoded_as`'s generic one with its two sentinels and `Route.fits` hook.
Release 0.3.0's Mid A (PR #324 at c713910) named `bin/loop_claude/loop/reload.py:43` `decoded_as`: "a generic decoder with two sentinels and a duck-typed fits hook defined on Route". This lowers Shape: `decoded_as` is generic over any type, yet `decode_handed` calls it with one dataclass, `LoopRun`. Keep what it does today: a field added since the running script started may be missing, and a handed dataclass holding a field its `RETIRED` names decodes as None where its type allows None, and is rejected otherwise; `LoopRun.items_taken_in`, a tuple of item IDs, decodes from a JSON array of integers alone. Make `decoded_as` easier to read.
Release 0.3.0's Mid A (PR #324 at c713910) named `bin/loop_claude/loop/reload.py:43` `decoded_as`: "a generic decoder with two sentinels and a duck-typed fits hook defined on Route". This lowers Shape: `decoded_as` is generic over any type, yet `decode_handed` calls it with one dataclass, `LoopRun`. Keep what it does today: a field added since the running script started may be missing, and a handed dataclass holding a field its `RETIRED` names decodes as None where its type allows None, and is rejected otherwise. `LoopRun.items_taken_in`, a tuple of item IDs, decodes only from a JSON array of integers. Make `decoded_as` easier to read.
### 237. Give `judge` and `judge_once` in `bin/loop_claude/cycle/judge.py` a record of the inputs they share, in place of nine and eight parameters, or record why they stay.